Madara's Ghost
Madara's Ghost

Reputation: 174957

PhpStorm does not autocomplete JavaScript native methods or properties

I use PhpStorm, I've noticed that when writing JavaScript, the IDE won't autocomplete native methods or properties of variables whose type PhpStorm should know.

var checkButton = document.forms.addSeller.check;
checkButton.onclick = function(e) {
    e.preventDefault();
    var request = new XMLHttpRequest;
    request.open("POST", "/seller");
    request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    request.onload = function() {
        if (request.readyState == 4) {
            if (request.status == 200) {
                var response = JSON.parse(request.responseText);
                console.log(response);
                var target = document.getElementById("seller_info");
                var image = document.createElement("img");
                image.src = response.logo;
                image.id = "seller_logo";
                target.appendChild(image);
            }
            else {
                alert("Problem!");
            }
        }
    };
    request.send("seller=" + document.forms.addSeller.seller.value);
}

None of the methods (.preventDefault(), .open(), .setRequestHeader()) or the properties (.onload, .onclick) were auto completed.

Settings looks fine as far as I can tell, but I hadn't found a specific JavaScript autocompletion setting.

Anyone knows how can I re-enable it? PhpStorm 100% knows which objects they are, because it does syntax highlighting and error reporting well, and when I CTRL+Click a method/property, it will open PhpStorm's internal syntax files on the correct symbol.

Upvotes: 2

Views: 2382

Answers (2)

Netfly
Netfly

Reputation: 11

I know, that this topic is old, but I had the same issue in PhpStorm 2020.1. The support of JetBrains helped me a lot to solve this.

My problem was, that I used the typoscript-plugin (TYPO3). The file type *.ts was added to typoscript files and removed for typescript.

So I had to add the *.d.ts to typescript again (I still use *.ts for typoscript). Somehow intellij uses *.d.ts files for the code completion. At least for JS.

After that everything worked like a charm.

Upvotes: 0

CrazyCoder
CrazyCoder

Reputation: 401887

Please try File | Invalidate Caches | Invalidate and Restart, it usually helps in case of such weird issues.

Upvotes: 2

Related Questions