-
Notifications
You must be signed in to change notification settings - Fork 7.5k
CSS code hints improvements #6242
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YuAo I saw your pull request, but I misread it and thought it was a bug report. Good catch!
So I fixed this in this commit while I was fixing #6231 . Note that I moved this code a bit in pull request #6258, so your change will have to be merged. I backed out my change for this fix after I noticed that this was actually a pull request :)
The gist of my fix is to also select initial item if any code has been typed (i.e. needle !== ""):
if (this.primaryTriggerKeys.indexOf(implicitChar) !== -1 ||
needle !== "") {
selectInitial = true;
}
But, this fix is not quite right because it prevents Ctrl+space from invoking css property hints when nothing has been typed.
Let me know if you'd like to continue with this, or if I should just fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@redmunds Oh, I didn't notice that. Because my Ctrl+Space is occupied by the input method switch.
I don't think that a code hint is helpful when nothing has been typed. It's better to having no code hint than having a not so useful code hint list floating around.
However, I think we can still fix this by checking the lastContext.
If lastContext is not null, we know that the user has previously typed something and have some hints. So we can get ride of the hint list this time.
If lastContext is null, we know that the user didn't get any hints the last time. We can now show him some hints anyway, if he requires (i.e. pressed Ctrl+Space).
I've added a commit.
Conflicts: src/extensions/default/CSSCodeHints/main.js "Select the initial hint on backspace key press" has been done by @redmunds on master, fixed conflicts
|
@redmunds That's all right. All fixed now. |
|
Thanks. Nice fix. Merging. |
Select the initial hint on backspace key press
Problem: When you input "col", the code hint plugin will present hints like "color","column-count",etc, with the initial item "color" selected. But, after you press backspace key once, nothing is selected on the hints list.
This patch set the
selectInitial = trueonimplicitChar === null, making the first hint selected on backspace key press.Clear hints when nothing's left
Problem: When you input "co", then press backspace twice to delete the CSS property, the code hints list remains open with hints like "align-content","align-items",etc.
This patch fixed the problem by returning
nullfor the hints list whenthis.info.offset === 0.