-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #40941 - Suggest trigger at language boundaries #43349
Conversation
@@ -46,7 +46,19 @@ export class LineContext { | |||
} | |||
const pos = editor.getPosition(); | |||
model.tokenizeIfCheap(pos.lineNumber); | |||
const word = model.getWordAtPosition(pos); | |||
|
|||
// When we are at an embedded language boundary, check the word at the previous character |
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.
This some pretty ugly logic. Let me know if there is some better way to express this
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.
Talked to @alexandrudima about this and the outcome is that getWordAtPosition
should be fixed instead of the consumer. Today the function is biased towards the right but it should look left when (1) there was no result on the right and (2) when it started at a language-border.
Ok, I didn't do that initially because I was concerned about regressions. I've pushed an update that moves the fix into Take a look at the test case for |
Fixes #40941 **Bug** Suggestions not auto triggered when you `x` in `const z = <div x>`. See #40941 (comment) for explaination of root cause **Proposed fix** In the case where suggestions are triggered at the boundary between two languages, I believe we should trigger. This change adds special logic to handle that case by making sure we check the word at the previous character position instead of at the current character positon when at language boundaries
…r the left language
👍 |
Fixes #40941
Bug
Suggestions not auto triggered when you type
x
inconst z = <div x>
. See #40941 (comment) for explaination of root causeProposed fix
In the case where suggestions are triggered at the boundary between two languages, I believe we should trigger. This change adds special logic to handle that case by making sure we check the word at the previous character position instead of at the current character positon when at language boundaries