2

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.

3
  • Please try File | Invalidate Caches | Invalidate and Restart. If it doesn't help, attach a complete sample project to reproduce. Commented Dec 16, 2013 at 12:31
  • if invalidating caches doesn't help, please attach your idea.log - there are might be some errors affecting the completion Commented Dec 16, 2013 at 14:12
  • @CrazyCoder: Invalidating the caches worked well. Please consider posting it as an answer, so that I may accept it and shower you with fake internet points and cookies. Commented Dec 16, 2013 at 15:12

2 Answers 2

2

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

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

Comments

0

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.

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.