Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfung committed Dec 24, 2024
1 parent f217f2a commit 2ce182b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions clients/vscode/src/chat/WebviewHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,7 @@ export class WebviewHelper {
}
}

const targetRange = fileLocation.location
? chatPanelLocationToVSCodeRange(fileLocation.location) ?? new Range(0, 0, 0, 0)
: new Range(0, 0, 0, 0);
const targetRange = chatPanelLocationToVSCodeRange(fileLocation.location) ?? new Range(0, 0, 0, 0);
try {
await commands.executeCommand(
"editor.action.goToLocations",
Expand Down
5 changes: 4 additions & 1 deletion clients/vscode/src/chat/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ export function chatPanelLineRangeToVSCodeRange(lineRange: LineRange): VSCodeRan
return new VSCodeRange(Math.max(0, lineRange.start - 1), 0, lineRange.end, 0);
}

export function chatPanelLocationToVSCodeRange(location: Location): VSCodeRange | null {
export function chatPanelLocationToVSCodeRange(location: Location | undefined): VSCodeRange | null {
if (!location) {
return null
}
if (typeof location === "number") {
const position = new VSCodePosition(Math.max(0, location - 1), 0);
return new VSCodeRange(position, position);
Expand Down

0 comments on commit 2ce182b

Please sign in to comment.