Skip to content

Commit

Permalink
[show-hint addon] fixed fromList didn't show all completions if the c…
Browse files Browse the repository at this point in the history
…ursor was inside the token

The hint logic of the `fromList` command did not respect the cursor position inside the token.
Now it will list all matching completions for the substring up to the cursor, instead of only the ones matching the complete token. The behavior is now the same as for the regular autocompletion.
  • Loading branch information
neon-dev authored and marijnh committed Mar 20, 2018
1 parent dd7f998 commit e732d0e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
var to = CodeMirror.Pos(cur.line, token.end);
if (token.string && /\w/.test(token.string[token.string.length - 1])) {
var term = token.string, from = CodeMirror.Pos(cur.line, token.start);
var length = token.string.length - (token.end - cur.ch);
var term = token.string.substr(0, length), from = CodeMirror.Pos(cur.line, token.start);
} else {
var term = "", from = to;
}
Expand Down

0 comments on commit e732d0e

Please sign in to comment.