Skip to content

fix: #165 disable completion in comments - #227

Open
liuxy0551 wants to merge 1 commit into
DTStack:nextfrom
liuxy0551:fix_165
Open

fix: #165 disable completion in comments#227
liuxy0551 wants to merge 1 commit into
DTStack:nextfrom
liuxy0551:fix_165

Conversation

@liuxy0551

Copy link
Copy Markdown
Collaborator

改动内容

#165

  • 光标位于 SQL 注释内时,不再触发代码补全
  • 通过当前语言的 Monarch tokenizer 判断注释状态,并在调用 worker/C3 前结束补全流程
  • 正确区分块注释内部和 */ 之后的位置
  • 新增单行注释、MySQL # 注释、块注释及非注释边界场景单测

预览地址

https://liuxy0551.github.io/monaco-sql-languages/

2026-07-29 15 09 38

@liuxy0551
liuxy0551 requested a review from Cythia828 July 29, 2026 08:20
@Cythia828

Copy link
Copy Markdown
Collaborator
image 看看是否存在这个问题

Comment thread src/languageFeatures.ts
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());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

每次补全请求都 getValueInRange 取光标前全部文本(一次大字符串分配),再 editor.tokenize 对整段做 Monarch 分词(又一次大字符串 + 分词)。建议补一个大文件 benchmark 确认回归可接受,如果发现延迟明显,可能需要切换到别的方案

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants