Help! Javascript variable assignments become tags

When using PHPStorm to do JavaScript development there are certain situations where the editor creates XML-style tags when I'm attempting to perform a variable assignment. For example, consider the block of code here:

My intent here is to set the private class variable this.#connectionParams.address to the value of the same field on the incoming object if it exists, or null if it does not. So at the end of line 11 I would want to type `.address | null`. 

So far so good, however, as soon as I type the space character before typing the pipe character the editor immediately replaces what I've typed with this:

For reference, the file has a .js file extension.

I assume there must be a project setting of some sort that I need to change to prevent this from happening, but for the life of me I cannot find it and no amount of Googleizing has revealed it. My only recourse at present is to type out a few space characters before I type the offending code, and then use my arrow keys to put the cursor in the correct position to then fill in the missing text. Does anyone know what I can do to make this not happen? 


Is Space selected as a key for Emmet abbreviation in `Settings | Editor | Emmet`? Does it help if you change it to another key?


Oksana, you're a hero. Changing that setting seems to have alleviated the problem entirely. Thank you ever so much.


I'm glad that it helped. Was it a React project? Was the file a plain JS one? I couldn't reproduce the same behavior.


It was a plain JS file, although it was ultimately for an AWS lambda function, so it was a NodeJS file, technically. The project itself isn't React, or any other specific framework. The code base is actually a NetSuite "SuiteScript" project, mostly.

I changed the setting you mentioned (Settings > Editor > Emmet) from "Space" to "Enter" and haven't had an issue since. I suppose there's always the possibility that one day, months from now, I'll stumble into just the right combination of things, hit the [ENTER] key and an XML tag will appear, but I'll cross that bridge when I come to it.

Thanks again for your help, it's much appreciated.


Please sign in to leave a comment.