-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vscode): only display
Edit with Tabby
when chat is enabled (#3020)
- Loading branch information
Showing
3 changed files
with
42 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { | ||
CancellationToken, | ||
CodeAction, | ||
CodeActionContext, | ||
CodeActionKind, | ||
CodeActionProvider as CodeActionProviderInterface, | ||
Range, | ||
Selection, | ||
TextDocument, | ||
} from "vscode"; | ||
import { ContextVariables } from "./ContextVariables"; | ||
|
||
export class CodeActionProvider implements CodeActionProviderInterface { | ||
constructor(private readonly contextVariables: ContextVariables) {} | ||
|
||
provideCodeActions( | ||
_document: TextDocument, | ||
_range: Range | Selection, | ||
_context: CodeActionContext, | ||
token: CancellationToken, | ||
): CodeAction[] | undefined { | ||
if (token.isCancellationRequested) { | ||
return; | ||
} | ||
|
||
if (!this.contextVariables.chatEnabled) { | ||
return; | ||
} | ||
|
||
const inlineEditing = new CodeAction("Edit using Tabby", CodeActionKind.RefactorRewrite); | ||
|
||
inlineEditing.command = { | ||
command: "tabby.chat.edit.start", | ||
title: "Edit using Tabby", | ||
}; | ||
|
||
return [inlineEditing]; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters