nteract / hydrogen

:atom: Run code interactively, inspect data, and plot. All the power of Jupyter kernels, inside your favorite text editor.
https://nteract.gitbooks.io/hydrogen/
MIT License
3.92k stars 334 forks source link

autocomplete: filter out suggestions that don't match any characters #1198

Open n-riesco opened 6 years ago

n-riesco commented 6 years ago

See https://github.com/n-riesco/ijavascript/issues/143

Currently, Hydrogen doesn't trigger a complete request unless the user has typed autocomplete-plus.minimumWordLength characters.

I'm proposing that Hydrogen also filters out suggestions that don't match at least minimumWordLength characters. If I'm not mistaken, this can easlity be handled at parseCompletions, by filtering those suggestion where (cursor_end - cursor_start) < minimumWordLength.

n-riesco commented 6 years ago

After more thought, I think this should be a separate setting in Hydrogen.

For some users having suggestions that don't match any characters is inconvenient, but for others is useful, because it allows exploring object properties (e.g. a user wants to explore what's exported under Math.).

Another option (that goes against the policy of having language-specific code) would be to add another regexp here.