fix: #165 disable completion in comments - #227
Open
liuxy0551 wants to merge 1 commit into
Open
Conversation
Collaborator
Cythia828
reviewed
Aug 12, 2026
Comment on lines
+150
to
+154
| const textBeforePosition = model.getValueInRange( | ||
| new Range(1, 1, position.lineNumber, position.column) | ||
| ); | ||
| // 在光标处追加哨兵字符,避免将刚结束的块注释误判为仍在注释中 | ||
| const tokenizedLines = editor.tokenize(`${textBeforePosition}x`, model.getLanguageId()); |
Collaborator
There was a problem hiding this comment.
每次补全请求都 getValueInRange 取光标前全部文本(一次大字符串分配),再 editor.tokenize 对整段做 Monarch 分词(又一次大字符串 + 分词)。建议补一个大文件 benchmark 确认回归可接受,如果发现延迟明显,可能需要切换到别的方案
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

改动内容
#165
*/之后的位置#注释、块注释及非注释边界场景单测预览地址
https://liuxy0551.github.io/monaco-sql-languages/