提交 2de94654 编写于 作者: M Matt Bierner

Check type of token that triggered the quick suggestions

Fixes #34863

**Bug**
Quick suggestions currently check the token at the cursor location to determine if we are in a string or comment. Because token spans are setup like: `[start, end)`, this results in the incorrect token being checked when the quick suggestions are triggered immediatly before a comment or string

**Fix**
Check the token one index back from the cursor
上级 982277d9
......@@ -301,11 +301,11 @@ export class SuggestModel implements IDisposable {
} else if (quickSuggestions === true) {
// all good
} else {
// Check the type of the token that triggered this
model.tokenizeIfCheap(pos.lineNumber);
const { tokenType } = model
.getLineTokens(pos.lineNumber)
.findTokenAtOffset(pos.column - 1);
.findTokenAtOffset(Math.max(pos.column - 1 - 1, 0));
const inValidScope = quickSuggestions.other && tokenType === StandardTokenType.Other
|| quickSuggestions.comments && tokenType === StandardTokenType.Comment
|| quickSuggestions.strings && tokenType === StandardTokenType.String;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册