File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { Editor , JSONContent } from "@tiptap/react" ;
2
- import { ContextItemWithId , InputModifiers , RuleWithSource } from "core" ;
2
+ import {
3
+ ContextItemWithId ,
4
+ InputModifiers ,
5
+ RuleWithSource ,
6
+ SlashCommandSource ,
7
+ } from "core" ;
3
8
import { memo , useMemo } from "react" ;
4
9
import { defaultBorderRadius , vscBackground } from ".." ;
5
10
import { useAppSelector } from "../../redux/hooks" ;
@@ -38,6 +43,15 @@ const EDIT_DISALLOWED_CONTEXT_PROVIDERS = [
38
43
"repo-map" ,
39
44
] ;
40
45
46
+ const EDIT_ALLOWED_SLASH_COMMAND_SOURCES : SlashCommandSource [ ] = [
47
+ "yaml-prompt-block" ,
48
+ "mcp-prompt" ,
49
+ "prompt-file-v1" ,
50
+ "prompt-file-v2" ,
51
+ "invokable-rule" ,
52
+ "json-custom-command" ,
53
+ ] ;
54
+
41
55
function ContinueInputBox ( props : ContinueInputBoxProps ) {
42
56
const isStreaming = useAppSelector ( ( state ) => state . session . isStreaming ) ;
43
57
const availableSlashCommands = useAppSelector (
@@ -50,7 +64,14 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
50
64
const editModeState = useAppSelector ( ( state ) => state . editModeState ) ;
51
65
52
66
const filteredSlashCommands = useMemo ( ( ) => {
53
- return isInEdit ? [ ] : availableSlashCommands ;
67
+ if ( isInEdit ) {
68
+ return availableSlashCommands . filter ( ( cmd ) =>
69
+ cmd . slashCommandSource
70
+ ? EDIT_ALLOWED_SLASH_COMMAND_SOURCES . includes ( cmd . slashCommandSource )
71
+ : false ,
72
+ ) ;
73
+ }
74
+ return availableSlashCommands ;
54
75
} , [ isInEdit , availableSlashCommands ] ) ;
55
76
56
77
const filteredContextProviders = useMemo ( ( ) => {
Original file line number Diff line number Diff line change 1
- import { ContextProviderDescription } from "core" ;
1
+ import { ContextProviderDescription , SlashCommandSource } from "core" ;
2
2
3
3
export type ComboBoxItemType =
4
4
| "contextProvider"
@@ -26,4 +26,5 @@ export interface ComboBoxItem {
26
26
icon ?: string ;
27
27
action ?: ( ) => void ;
28
28
subActions ?: ComboBoxSubAction [ ] ;
29
+ slashCommandSource ?: SlashCommandSource ;
29
30
}
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export const selectSlashCommandComboBoxInputs = createSelector(
22
22
description : cmd . description ,
23
23
type : "slashCommand" as ComboBoxItemType ,
24
24
content : content ,
25
+ source : cmd . source ,
25
26
} as ComboBoxItem ;
26
27
} ) || [ ]
27
28
) ;
You can’t perform that action at this time.
0 commit comments