Skip to content

Commit 7923144

Browse files
author
lhy
committed
feat(CommandManager): 添加对选中文本的处理逻辑
当编辑器中有选中文本时,调用 `handleWorkspaceSelectionWithRangeQuery` 方法进行处理。如果没有选中文本,则继续查找最近的查询。这一改动增强了命令管理器对选中文本的处理能力。
1 parent 194d96c commit 7923144

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/CommandManager.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ export class CommandManager {
4848
return;
4949
}
5050

51+
// 检查是否有选中的文本
52+
const selection = editor.selection;
53+
if (!selection.isEmpty) {
54+
const selectedText = editor.document.getText(selection);
55+
if (selectedText.trim()) {
56+
await this.extension.handleWorkspaceSelectionWithRangeQuery(
57+
selectedText,
58+
selection
59+
);
60+
return;
61+
}
62+
}
63+
64+
// 如果没有选中文本,则查找最近的查询
5165
const cursorPosition = editor.selection.active;
5266
const document = editor.document;
5367
const text = document.getText();

0 commit comments

Comments
 (0)