@@ -4,8 +4,6 @@ import { Client } from "../lsp/client";
4
4
import { Config } from "../Config" ;
5
5
import { isBrowser } from "../env" ;
6
6
7
- const MENU_ITEM_INDENT_SPACING = " " ;
8
-
9
7
interface CommandPaletteItem extends QuickPickItem {
10
8
command ?: string | Command | ( ( ) => void | Promise < void > ) ;
11
9
picked ?: boolean ;
@@ -24,13 +22,7 @@ export class CommandPalette {
24
22
25
23
// Status section
26
24
const status = this . client . status . current ?. status ;
27
- items . push (
28
- {
29
- label : "status" ,
30
- kind : QuickPickItemKind . Separator ,
31
- } ,
32
- this . itemForStatus ( ) ,
33
- ) ;
25
+ items . push ( this . itemForStatus ( ) ) ;
34
26
35
27
this . client . status . on ( "didChange" , ( ) => {
36
28
items [ 1 ] = this . itemForStatus ( ) ;
@@ -40,23 +32,30 @@ export class CommandPalette {
40
32
// Features section
41
33
const validStatuses = [ "ready" , "readyForAutoTrigger" , "readyForManualTrigger" ] ;
42
34
if ( status !== undefined && validStatuses . includes ( status ) ) {
43
- const iconPath = this . config . inlineCompletionTriggerMode === "automatic" ? new ThemeIcon ( "check" ) : undefined ;
44
- const labelPrefix = iconPath ? "" : MENU_ITEM_INDENT_SPACING ;
35
+ const isAutomatic = this . config . inlineCompletionTriggerMode === "automatic" ;
45
36
46
- items . push (
47
- {
48
- label : "enable/disable features" ,
49
- kind : QuickPickItemKind . Separator ,
50
- } ,
51
- {
52
- label : labelPrefix + "Code Completion" ,
53
- detail : MENU_ITEM_INDENT_SPACING + "Toggle between automatic and manual completion mode" ,
54
- picked : this . config . inlineCompletionTriggerMode === "automatic" ,
55
- command : "tabby.toggleInlineCompletionTriggerMode" ,
56
- iconPath : iconPath ,
37
+ const currentLanguageId = window . activeTextEditor ?. document . languageId ;
38
+ const isLanguageDisabled = currentLanguageId ? this . config . disabledLanguages . includes ( currentLanguageId ) : false ;
39
+
40
+ items . push ( {
41
+ label : ( isAutomatic ? "Disable" : "Enable" ) + " completions" ,
42
+ picked : isAutomatic ,
43
+ command : "tabby.toggleInlineCompletionTriggerMode" ,
44
+ alwaysShow : true ,
45
+ } ) ;
46
+
47
+ if ( currentLanguageId ) {
48
+ items . push ( {
49
+ label : ( isLanguageDisabled ? "Enable" : "Disable" ) + ` completions for ${ currentLanguageId } ` ,
50
+ picked : ! isLanguageDisabled ,
51
+ command : {
52
+ title : "triggerLanguageInlineCompletion" ,
53
+ command : "tabby.toggleLanguageInlineCompletion" ,
54
+ arguments : [ currentLanguageId ] ,
55
+ } ,
57
56
alwaysShow : true ,
58
- } ,
59
- ) ;
57
+ } ) ;
58
+ }
60
59
}
61
60
62
61
// Chat section
@@ -139,7 +138,7 @@ export class CommandPalette {
139
138
}
140
139
141
140
private itemForStatus ( ) : CommandPaletteItem {
142
- const STATUS_PREFIX = MENU_ITEM_INDENT_SPACING + "Status: " ;
141
+ const STATUS_PREFIX = "Status: " ;
143
142
const languageClientState = this . client . languageClient . state ;
144
143
switch ( languageClientState ) {
145
144
case LanguageClientState . Stopped :
0 commit comments