Skip to content

Commit e732d0e

Browse files
neon-devmarijnh
authored andcommitted
[show-hint addon] fixed fromList didn't show all completions if the cursor 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.
1 parent dd7f998 commit e732d0e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

addon/hint/show-hint.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@
400400
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
401401
var to = CodeMirror.Pos(cur.line, token.end);
402402
if (token.string && /\w/.test(token.string[token.string.length - 1])) {
403-
var term = token.string, from = CodeMirror.Pos(cur.line, token.start);
403+
var length = token.string.length - (token.end - cur.ch);
404+
var term = token.string.substr(0, length), from = CodeMirror.Pos(cur.line, token.start);
404405
} else {
405406
var term = "", from = to;
406407
}

0 commit comments

Comments
 (0)