Autocomplete for all text in current file

How can I turn on autocomplete to suggest for all text in the current file? The context/scoping for autocomplete isn't very smart :-/

10 comments
Comment actions Permalink

Haven't got what you mean, sorry... Would you like to limit the completion to variables/functions from current file only? or, would you like the completion to suggest all words you have typed in current file? In the latter case, did you try 'hippie completion' (cyclic expand word) - it's Alt+Slash in default keymap? See https://www.jetbrains.com/help/webstorm/2016.3/hippie-completion-expanding-words.html

4
Comment actions Permalink

Elena, he means something like the Default Autocomplete that comes with Notepad++: https://notepad-plus-plus.org/community/topic/13583/plugin-update-an-alternative-auto-completion-for-notepad .

This would be something that would trigger without needing to press any hotkeys, but wouldn't get inserted without pressing Enter or Tab.

In my opinion, this would be a VERY helpful addition.  AFAIK, there is no way to do this in IntelliJ.

1
Comment actions Permalink

Webstorm auto-completes code where appropriate - while typing variable, etc. names, after `.`, etc.

Showing auto-completion just on entering plain text would be rather annoying.

0
Comment actions Permalink

Elena, I don't think you understand the feature yet.  It is not annoying.  One of the world's most popular text editors has it.

Consider typing the following:

my_map = {
  'key' = 'value',
  'very_long_key_that_is_hard_to_type' = 'value_that_i_really_want'
}
# Note: often we get dicts from external data sources and we can't control the key names to make them short.

my_|desired = my_map['very|

In the above, the final line has two pipes (|).  These are the points at which the auto-complete would appear either with min_match=3 (for `my_|`) or min_match=4 (for `very|`.  I usually set my min_match to 3 in settings.

In the first case, you would get the option to select `my_map` by pressing enter or ignoring the autocomplete.  If your min_match was 4, you would not see an autocomplete option here at all.

In the second case, you would see `very_long_key_that_is_hard_to_type`.  That would be VERY useful.

0
Comment actions Permalink

This is something I too am desperately looking for.

The ability to have Ctrl-space suggestions on JSON keys and also inside any string.

There is so much JSON "navigation" that simply autocompleting on functions and variables is not enough.

The coolest thing would be if you could supply Webstorm some sample JSON structures and it could then use that for suggestions when you are typing e.g.

docJSON.modeli(ctrl-space) to suggest modelindicatorId

 

0
Comment actions Permalink

>The ability to have Ctrl-space suggestions on JSON keys and also inside any string

WebStorm provides JSON auto-completion based on  JSON Schemas. see https://www.jetbrains.com/help/webstorm/2019.3/json.html

0
Comment actions Permalink

The JSON Schemas support is only for editing an entire JSON files e.g. Settings.json

I am talking about when you are editing a Javascript (.js) file e.g.

function documentPrinter(documentArray) {   var i, curJSONDoc;
for(i=0; i<documentArray.length; i++) {
curJSONDoc = documentArray[i];
console.log(curJSONDoc.modelindiatorgloballyUniqueUuidIdentifer, ":", curJSONDoc.modelindicatordescriptionText);
}
}

When you are writing the console.log line it would be *very* helpful to be able to enter (ctrl-space) after having typed .modeli to and then select modelindiatorgloballyUniqueUuidIdentifer  from a list.

0
Comment actions Permalink

hardly possible with static code analysis - such completion would require executing a code

0
Comment actions Permalink

What I am suggesting requires neither static code ananlysis nor code execution.

I do not expect anything very "intelligent" from webstorm.

I the most basic case I would configure the project with a list of all possible JSON keys I would like to be completed.

When ctrl-space is pressed webstorm would simply list all list items where the characters after the "." are a leading substring.

I would *not* expect Webstorm to be able to decide precisely what keys would be legal at a given place in the code.

 

0
Comment actions Permalink

You can try using JSDoc for this, like:

 

/**
* @typedef {Object} MyJSON
* @property {string} modelindiatorgloballyUniqueUuidIdentifer
* @property {string} modelindicatordescriptionText
*
*/

/**
*
* @param {MyJSON[]}documentArray
*/
function documentPrinter(documentArray){}
0

Please sign in to leave a comment.