Code Completion in Strings

Is there a way to enable code completion to work from within a string?

Example:

<div ></div>
<div class="real...

It would be awesome if an autocomplete list came up with reallylongclassnameidontwanttotypeagain in it.

5 comments
Comment actions Permalink

Hi there,

Is there a way to enable code completion to work from within a string?

What strings? Example please -- so far I see plain HTML here and nothing more.

It would be awesome if an autocomplete list came up with reallylongclassnameidontwanttotypeagain in it.

It will -- as long as there is a style with such name in one of your .css files.

0
Comment actions Permalink

Sorry. What I meant by strings is anything within quotation marks.

I did not know that the code completion would work in the example I gave if the classname was present in a .css file. I just tried it and it worked, so that's great!

However I still run into other situations where it would be nice to have code completion. An example is:

 
var str = 'object.notation.in.string';
var str2 = 'object.not...


In that case, it would be nice if "notation" came up in the code completion list. I guess in general what I'm asking is if there is a way to do general word completion like Notepad++ and Sublime have (and I'm sure others). Obviously the content aware code completion that Webstorm has by default is better in most cases, but it would be nice if there was this option too.

0
Comment actions Permalink

Code | Completion | Cyclic Expand Word

NOTE: it works with words, therefore object.notation.in.string will be treated as 4 separate words (because of dots)

0
Comment actions Permalink

Thank you, that generally works. I feel like there should be an option to have these words (the ones that come up when you cycle through the Cyclic Expand Word suggestions) added to the normal code completion list that comes up automatically. I guess I'm just being picky now though.

0
Comment actions Permalink

I don't think that's picky - I think that's a great idea, as long as it's an option.  

For more textual languages (such as YAML) this would make PHPStorm about perfect.  I often currentlly have to open YAML documents in Sublime, simply because I want that quick code completion based on the other things typed in the document.

For my purposes, being able to choose which is the 'default' code completion (Cyclic Expand Word, SmartType, Basic) gets used for each language type.

0

Please sign in to leave a comment.