A code recommendation method includes obtaining code generation information, where the code generation information is used to describe a programming task of a code; generating at least one candidate code based on the code generation information; determining a to-be-fixed candidate code from the at least one candidate code, where the to-be-fixed candidate code includes an erroneous parameter, and the erroneous parameter does not meet at least one of a syntax constraint or a semantic constraint of a programming language corresponding to the programming task; fixing the erroneous parameter included in the to-be-fixed candidate code to obtain a fixed candidate code; and recommending the fixed candidate code and an unfixed candidate code in the at least one candidate code, where the unfixed candidate code is different from the to-be-fixed candidate code.
Full Text
What is claimed is: