Part of my code make copilot crash · community · Discussion #20273

1 min read Original article ↗

I was using copilot, it was working great and then 2 minutes later there is no suggestions anymore. I had the same issue yesterday but it somehow worked again this morning... Now it's not working again.

I found out that after i wrote certain part of my code copilot doesn't suggest anything anymore.

I tried :

  • try the get suggestion on other files/languages
  • log out/ log in from the extension
  • reload it
  • reinstall it
  • restart vs code
  • restart the computer

Here is the log when I press enter (when there should have a suggestions)

[INFO] [default] [2022-07-10T07:59:07.641Z] [fetchCompletions] engine https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex
[INFO] [default] [2022-07-10T07:59:07.737Z] request.response: [https://copilot-proxy.githubusercontent.com/v1/engines/copilot-codex/completions] took 96 ms

For a bit of contexte, here is the code

//descriptions is a global object 

export function description(name,age,gender,stats)
{
    var descriptionGenerated="";
    //wealth category
    var familyType="";
    if (stats.wealth>=8) familyType="rich";
    else if(stats.wealth>=6) familyType="aisée";
    else if(stats.wealth>=4) familyType="modeste";
    else familyType="pauvre";

    //baby description 
    if(age<=3)
    {
        //get random baby description
        var descriptionId = Math.floor(Math.random()*descriptions.template.baby[gender].length);
        descriptionGenerated = formated(descriptions.template.baby[gender][descriptionId],{name:name,age:2,face:"test",eyes:"",familyWealth:familyType,future:"nul"});
    }


    //standard description 

    return descriptionGenerated;
    
}

and here is the part of code that make copilot crash

//baby description 
if(age<=3)
{
    //get random baby description
    var descriptionId = Math.floor(Math.random()*descriptions.template.baby[gender].length);
    descriptionGenerated = formated(descriptions.template.baby[gender][descriptionId],{name:name,age:2,face:"test",eyes:"",familyWealth:familyType,future:"nul"});
}