2

I am looking for a solution how can I enable all suggestions for JavaScript code, for example I write this same code in VSC and WebStorm:

enter image description here

In WebStorm I have all suggestion that match the word remov, but in VSC I have information: No suggestions.

I try use answer from this question, but nothing work:

How to enable Intellisense for JavaScript in Visual Studio Code

VSCode intelliSense autocomplete for javascript

VS Code autocompletion base on word in file

I have version VSC 1.24.0

My settings.json file:

{
    "php.validate.executablePath": "C:\\php7\\php.exe",
    "workbench.iconTheme": "vscode-icons",
    "files.associations": {
        "*.ejs": "html",
        "*.js": "javascript"
    },
    "css.fileExtensions": [
        "css",
        "scss"
    ],
    "sublimeTextKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.snippetSuggestions": "top",
    "editor.formatOnPaste": true,
    "editor.wordWrap": "on",
    "window.menuBarVisibility": "toggle",
    "window.zoomLevel": 0,
    "workbench.colorTheme": "Afterglow",
    "editor.fontSize": 14,
    "editor.renderIndentGuides": false,
    "files.autoSave": "onFocusChange",
    "vsicons.dontShowNewVersionMessage": true,
    "editor.quickSuggestions": {
        "other": true,
        "comments": true,
        "strings": true
    },
    "editor.quickSuggestionsDelay": 1,
    "editor.suggestOnTriggerCharacters": true,
    "editor.wordBasedSuggestions": true,
    "editor.parameterHints": true
}

Edit:

All code which I use:

document.addEventListener("DOMContentLoaded", function () {


    function Calendar(input) {
        this.now = new Date();
        this.day = this.now.getDate();
        this.month = this.now.getMonth();
        this.year = this.now.getFullYear();

        this.input = input; 
        this.divCnt = null; 
        this.divHeader = null; 
        this.divTable = null; 
        this.divDateText = null; 
        this.divButtons = null; 


        this.init = function() {

            this.divCnt = document.createElement('div');
            this.divCnt.classList.add('calendar');

            this.divButtons = document.createElement('div');
            this.divButtons.className = "calendar-prev-next";

            this.divDateText = document.createElement('div');
            this.divDateText.className = 'date-name';

            this.divHeader = document.createElement('div');
            this.divHeader.classList.add('calendar-header');

            this.divHeader.appendChild(this.divButtons);
            this.divHeader.appendChild(this.divDateText);

            this.divHeader.appendChild();
        };

    }

});
4
  • You need to provide a more complete code example that shows how divHeader is declared and assigned Commented Jun 8, 2018 at 4:53
  • This is not about the divHeader declaration. I just gave a brief example. I just want to force a syntax suggestion like the webstorm does. Commented Jun 8, 2018 at 7:47
  • I need more context because that context is what determines why intellisense is not be showing here. Please provide a complete code example Commented Jun 8, 2018 at 19:58
  • @MattBierner i edit my post. And I check Sublime Text 3, in this program suggestions appear correctly as in WebStom. Only in VSC suggestions do not work correctly. Commented Jun 8, 2018 at 20:12

2 Answers 2

1

VS Code's intellisense cannot infer the type of divCnt since it is not assigned in the constructor. You can enable proper intellisense by either assigning the value in the constructor or by using jsdocs:

function Calendar(input) {
    this.divCnt = /** @type {HTMLDivElement} */ (null);
}

Root cause is https://github.com/Microsoft/TypeScript/issues/10868

Sign up to request clarification or add additional context in comments.

Comments

-1

Just install node.js and @types/jquery, then restart your PC.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.