Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable start line and column for Zed only #422

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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