diff --git a/clients/vscode/src/chat/utils.ts b/clients/vscode/src/chat/utils.ts index 108cb929baa1..055a6dae0ae2 100644 --- a/clients/vscode/src/chat/utils.ts +++ b/clients/vscode/src/chat/utils.ts @@ -121,6 +121,13 @@ export function chatPanelLineRangeToVSCodeRange(lineRange: LineRange): VSCodeRan return new VSCodeRange(Math.max(0, lineRange.start - 1), 0, lineRange.end, 0); } +export function vscodeRangeToChatPanelLineRange(range: VSCodeRange): LineRange { + return { + start: range.start.line + 1, + end: range.end.line + 1, + }; +} + export function chatPanelLocationToVSCodeRange(location: Location | undefined): VSCodeRange | null { if (!location) { return null; diff --git a/clients/vscode/src/chat/webview.ts b/clients/vscode/src/chat/webview.ts index 0fddc1ec8943..080db7ba6909 100644 --- a/clients/vscode/src/chat/webview.ts +++ b/clients/vscode/src/chat/webview.ts @@ -54,6 +54,7 @@ import { isValidForSyncActiveEditorSelection, localUriToListFileItem, escapeGlobPattern, + vscodeRangeToChatPanelLineRange, } from "./utils"; import { findFiles } from "../findFiles"; import mainHtml from "./html/main.html"; @@ -607,7 +608,7 @@ export class ChatWebview { const filepath = localUriToChatPanelFilepath(editor.document.uri, this.gitProvider); return collectFunctions(symbols || []).map((symbol) => ({ filepath, - range: { start: symbol.location.range.start.line + 1, end: symbol.location.range.end.line + 1 }, + range: vscodeRangeToChatPanelLineRange(symbol.location.range), label: symbol.name, })); } catch (error) {