javascriptvisual-studio-code

Turn off autocomplete for specific function in javascript in VS CODE


I am using VSCODE and on a windows computer.

I am looking to turn off autosuggest for the javascript function SpeechRecognitionAlternative which is populating when I attempt to write alert(). I do not want to turn off all of autosuggest, just for this specific function.


Solution

  • Friend, you can do that, although I think it is very unhelpful.

    I mean, when I type alert at VS-Code, the SpeechRecognitionAlternative shows last, so it's not hard to avoid it. You just need to type al and the auto completion will highlight alert already. Then you just press tab or enter and its done.

    To remove the auto completion for any specific (let me say) component, then it's very easy...

    Type SpeechRecognitionAlternative and CTRL+Click it...

    The file %AppData%/Local/.../lib.dom.d.ts will open at the right place. Then you just need to comment the following lines:

    // interface SpeechRecognitionAlternative {
        /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SpeechRecognitionAlternative/confidence) */
    //     readonly confidence: number;
        /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/SpeechRecognitionAlternative/transcript) */
    //     readonly transcript: string;
    // }
    
    /*
    declare var SpeechRecognitionAlternative: {
        prototype: SpeechRecognitionAlternative;
        new(): SpeechRecognitionAlternative;
    };
    */
    

    Then save and you're done.