Skip to content

Commit

Permalink
[feat] enable start line and column for Zed only (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moshyfawn authored Sep 30, 2024
1 parent 5198f46 commit 56595d4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/common/ide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ export class IDE {
const endTag = templateNode.endTag || startTag;
let codeCommand = `${this.command}://file/${filePath}`;

// Note: Zed API not handling lines https://github.com/zed-industries/zed/issues/14820
if (startTag && endTag && this.type !== IdeType.ZED) {
if (startTag && endTag) {
const startRow = startTag.start.line;
const startColumn = startTag.start.column;
const endRow = endTag.end.line;
const endColumn = endTag.end.column - 1;
codeCommand += `:${startRow}:${startColumn}:${endRow}:${endColumn}`;
codeCommand += `:${startRow}:${startColumn}`;
// Note: Zed API doesn't seem to handle end row/column (ref: https://github.com/zed-industries/zed/issues/18520)
if (this.type !== IdeType.ZED) {
codeCommand += `:${endRow}:${endColumn}`;
}
}
return codeCommand;
}
Expand Down

0 comments on commit 56595d4

Please sign in to comment.