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

feat(vscode): add shortcut hint in codeLens title #3637

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
fix comments
antimonyGu committed Jan 14, 2025
commit 677b07798557c66d0b4fb5117539e29e29960fb2
4 changes: 2 additions & 2 deletions clients/tabby-agent/src/codeLens.ts
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ export class CodeLensProvider implements Feature {
lineCodeLenses.push({
range: codeLensRange,
command: {
title: `$(check)Accept`,
title: "$(check)Accept",
command: "tabby/chat/edit/resolve",
antimonyGu marked this conversation as resolved.
Show resolved Hide resolved
arguments: [{ location: codeLensLocation, action: "accept" }],
},
@@ -132,7 +132,7 @@ export class CodeLensProvider implements Feature {
lineCodeLenses.push({
range: codeLensRange,
command: {
title: `$(remove-close)Discard`,
title: "$(remove-close)Discard",
command: "tabby/chat/edit/resolve",
arguments: [{ location: codeLensLocation, action: "discard" }],
},
4 changes: 2 additions & 2 deletions clients/vscode/src/lsp/CodeLensMiddleware.ts
Original file line number Diff line number Diff line change
@@ -113,11 +113,11 @@ export class CodeLensMiddleware implements VscodeLspCodeLensMiddleware {
private addShortcut(codeLens: CodeLens) {
if (codeLens.command?.arguments?.[0].action === "accept") {
// FIXME: Read ~/.config/Code/User/keybindings.json from LSP client, then send to LSP server to avoid hardcode.
const acceptShortcut = isBrowser ? "" : ` (${process.platform === "darwin" ? "⌘+enter" : "Ctrl+enter"})`;
const acceptShortcut = isBrowser ? '' : ` (${process.platform === 'darwin' ? '⌘+Enter' : 'Ctrl+Enter'})`;

codeLens.command.title += acceptShortcut;
} else if (codeLens.command?.arguments?.[0].action === "discard") {
const discardShortcut = isBrowser ? "" : ` (esc)`;
const discardShortcut = isBrowser ? "" : ` (Esc)`;

codeLens.command.title += discardShortcut;
}