@codingame/monaco-vscode-chat-service-override 17.2.0 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -4
- package/package.json +36 -30
- package/vscode/src/vs/base/common/objectCache.d.ts +2 -2
- package/vscode/src/vs/base/common/objectCache.js +3 -3
- package/vscode/src/vs/platform/browserElements/common/browserElements.d.ts +10 -0
- package/vscode/src/vs/platform/browserElements/common/browserElements.js +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +40 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClearActions.js +158 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContext.js +256 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +234 -572
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatGettingStarted.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +29 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +107 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +344 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +84 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatAttachInstructionsAction.d.ts +18 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatAttachInstructionsAction.js +137 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatModeActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatModeActions.js +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatRunPromptAction.js +40 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatSaveToPromptAction.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/chatSaveToPromptAction.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/promptFilePickers.d.ts +15 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/promptFilePickers.js +171 -101
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/attachInstructions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/attachInstructions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/dialogs/askToSelectPrompt/utils/runPrompt.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/index.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/promptActions/index.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +176 -69
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAccessibilityService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +15 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +22 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +35 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +80 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +11 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +12 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +13 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +15 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +3 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.js +10 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +18 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/overlayToolbarDecorator.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/simpleBrowserEditorOverlay.js +118 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditor.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +46 -48
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.d.ts +49 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPasteProviders.js +379 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseAccessibleView.js +31 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup.js +382 -152
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus.js +99 -56
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatVariables.js +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatViewPane.js +9 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockContextProviderService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorContrib.js +10 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.d.ts +18 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelToolsService.js +95 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatSetup.css +92 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/media/github.svg +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/google.svg +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/media/simpleBrowserOverlay.css +10 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/createPromptCommand.js +111 -111
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptName.js +36 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.d.ts +5 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/dialogs/askForPromptSourceFolder.js +91 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/errors.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.d.ts +1 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/createPromptCommand/utils/createPromptFile.js +4 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +95 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +348 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatProgressTypes/chatToolInvocation.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatResponseResourceFileSystemProvider.js +93 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatServiceImpl.js +46 -36
- package/vscode/src/vs/workbench/contrib/chat/common/chatSessionStore.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/configMigration.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/configMigration.js +21 -11
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/index.js +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/index.js +3 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptHeaderDiagnosticsProvider.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptHeaderDiagnosticsProvider.js +12 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptLinkDiagnosticsProvider.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptLinkDiagnosticsProvider.js +1 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptLinkProvider.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/promptPathAutocompletion.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceBase.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceBase.js +9 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceManagerBase.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/providerInstanceManagerBase.js +12 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/parsers/textModelPromptParser.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.d.ts +21 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.js +111 -124
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +22 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +159 -97
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/treeUtils.d.ts +15 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/treeUtils.js +2 -14
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +8 -2
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +198 -33
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatCurrentLine.js +28 -18
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/attachInstructionsCommand.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/contributions/attachInstructionsCommand.js +0 -73
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterDecoration.d.ts +0 -29
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterDecoration.js +0 -74
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterMarkerDecoration.d.ts +0 -14
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/frontMatterMarkerDecoration.js +0 -40
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/decorationBase.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/decorationBase.js +0 -40
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/index.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/index.js +0 -9
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/reactiveDecorationBase.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/reactiveDecorationBase.js +0 -68
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/decorations/utils/types.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/promptDecorationsProvider.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/promptDecorationsProvider.js +0 -121
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/types.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/contributions/languageFeatures/providers/decorationsProvider/types.js +0 -13
|
@@ -4,140 +4,140 @@ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
|
4
4
|
import { getCodeEditor } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorBrowser';
|
|
5
5
|
import { SnippetController2 } from '@codingame/monaco-vscode-api/vscode/vs/editor/contrib/snippet/browser/snippetController2';
|
|
6
6
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
7
|
-
import {
|
|
7
|
+
import { Action2, MenuId, registerAction2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
8
8
|
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
9
9
|
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
10
10
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
12
|
+
import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
13
13
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
14
14
|
import { NeverShowAgainScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
|
|
15
15
|
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
16
16
|
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
17
|
-
import { PromptsConfig } from '@codingame/monaco-vscode-
|
|
18
|
-
import {
|
|
17
|
+
import { PromptsConfig } from '@codingame/monaco-vscode-47472025-cc45-5680-86cd-09ceaba921a1-common/vscode/vs/platform/prompts/common/config';
|
|
18
|
+
import { PromptsType } from '@codingame/monaco-vscode-47472025-cc45-5680-86cd-09ceaba921a1-common/vscode/vs/platform/prompts/common/prompts';
|
|
19
19
|
import { SyncResource } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
20
20
|
import { IUserDataSyncEnablementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
21
|
-
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
22
21
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
23
22
|
import { CONFIGURE_SYNC_COMMAND_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataSync/common/userDataSync';
|
|
24
23
|
import { ISnippetsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/snippets/browser/snippets.service';
|
|
25
24
|
import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatContextKeys';
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
25
|
+
import { getLanguageIdForPromptsType } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/promptSyntax/constants';
|
|
26
|
+
import { CHAT_CATEGORY } from '@codingame/monaco-vscode-3a35f433-1297-5707-ab58-c261b8180e6d-common/vscode/vs/workbench/contrib/chat/browser/actions/chatActions';
|
|
29
27
|
import { askForPromptFileName } from './dialogs/askForPromptName.js';
|
|
30
28
|
import { askForPromptSourceFolder } from './dialogs/askForPromptSourceFolder.js';
|
|
31
29
|
import { createPromptFile } from './utils/createPromptFile.js';
|
|
32
30
|
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
type,
|
|
52
|
-
placeHolder,
|
|
53
|
-
labelService,
|
|
54
|
-
openerService,
|
|
55
|
-
promptsService,
|
|
56
|
-
workspaceService,
|
|
57
|
-
quickInputService,
|
|
58
|
-
});
|
|
59
|
-
if (!selectedFolder) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const fileName = await askForPromptFileName(type, selectedFolder.uri, quickInputService, fileService);
|
|
63
|
-
if (!fileName) {
|
|
64
|
-
return;
|
|
32
|
+
class AbstractNewPromptOrInstructionsFileAction extends Action2 {
|
|
33
|
+
constructor(id, title, type) {
|
|
34
|
+
super({
|
|
35
|
+
id,
|
|
36
|
+
title,
|
|
37
|
+
f1: false,
|
|
38
|
+
precondition: ( ContextKeyExpr.and(PromptsConfig.enabledCtx, ChatContextKeys.enabled)),
|
|
39
|
+
category: CHAT_CATEGORY,
|
|
40
|
+
keybinding: {
|
|
41
|
+
weight: KeybindingWeight.WorkbenchContrib
|
|
42
|
+
},
|
|
43
|
+
menu: {
|
|
44
|
+
id: MenuId.CommandPalette,
|
|
45
|
+
when: ( ContextKeyExpr.and(PromptsConfig.enabledCtx, ChatContextKeys.enabled))
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
this.type = type;
|
|
65
49
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
SnippetController2.get(editor)?.apply([{
|
|
80
|
-
range: editor.getModel().getFullModelRange(),
|
|
81
|
-
template: snippets[0].body
|
|
82
|
-
}]);
|
|
50
|
+
async run(accessor) {
|
|
51
|
+
const logService = accessor.get(ILogService);
|
|
52
|
+
const openerService = accessor.get(IOpenerService);
|
|
53
|
+
const commandService = accessor.get(ICommandService);
|
|
54
|
+
const notificationService = accessor.get(INotificationService);
|
|
55
|
+
const userDataSyncEnablementService = accessor.get(IUserDataSyncEnablementService);
|
|
56
|
+
const snippetService = accessor.get(ISnippetsService);
|
|
57
|
+
const editorService = accessor.get(IEditorService);
|
|
58
|
+
const fileService = accessor.get(IFileService);
|
|
59
|
+
const instaService = accessor.get(IInstantiationService);
|
|
60
|
+
const selectedFolder = await instaService.invokeFunction(askForPromptSourceFolder, this.type);
|
|
61
|
+
if (!selectedFolder) {
|
|
62
|
+
return;
|
|
83
63
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
64
|
+
const fileName = await instaService.invokeFunction(askForPromptFileName, this.type, selectedFolder.uri);
|
|
65
|
+
if (!fileName) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const promptUri = await createPromptFile(fileService, {
|
|
69
|
+
fileName,
|
|
70
|
+
folder: selectedFolder.uri,
|
|
71
|
+
content: ''
|
|
72
|
+
});
|
|
73
|
+
await openerService.open(promptUri);
|
|
74
|
+
const editor = getCodeEditor(editorService.activeTextEditorControl);
|
|
75
|
+
if (editor && editor.hasModel() && isEqual(editor.getModel().uri, promptUri)) {
|
|
76
|
+
const languageId = getLanguageIdForPromptsType(this.type);
|
|
77
|
+
const snippets = await snippetService.getSnippets(languageId, { fileTemplateSnippets: true, noRecencySort: true, includeNoPrefixSnippets: true });
|
|
78
|
+
if (snippets.length > 0) {
|
|
79
|
+
SnippetController2.get(editor)?.apply([{
|
|
80
|
+
range: editor.getModel().getFullModelRange(),
|
|
81
|
+
template: snippets[0].body
|
|
82
|
+
}]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (selectedFolder.storage !== 'user') {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const isConfigured = userDataSyncEnablementService
|
|
89
|
+
.isResourceEnablementConfigured(SyncResource.Prompts);
|
|
90
|
+
const isSettingsSyncEnabled = userDataSyncEnablementService.isEnabled();
|
|
91
|
+
if ((isConfigured === true) || (isSettingsSyncEnabled === false)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
notificationService.prompt(Severity.Info, ( localize(
|
|
95
|
+
5042,
|
|
96
|
+
"Do you want to backup and sync your user prompt, instruction and mode files with Setting Sync?'"
|
|
97
|
+
)), [
|
|
98
|
+
{
|
|
99
|
+
label: ( localize(5043, "Enable")),
|
|
100
|
+
run: () => {
|
|
101
|
+
commandService.executeCommand(CONFIGURE_SYNC_COMMAND_ID)
|
|
102
|
+
.catch((error) => {
|
|
103
|
+
logService.error(`Failed to run '${CONFIGURE_SYNC_COMMAND_ID}' command: ${error}.`);
|
|
104
|
+
});
|
|
105
|
+
},
|
|
105
106
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
{
|
|
108
|
+
label: ( localize(5044, "Learn More")),
|
|
109
|
+
run: () => {
|
|
110
|
+
openerService.open(( URI.parse('https://aka.ms/vscode-settings-sync-help')));
|
|
111
|
+
},
|
|
111
112
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
function register(type, id, title) {
|
|
121
|
-
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
122
|
-
id,
|
|
123
|
-
weight: KeybindingWeight.WorkbenchContrib,
|
|
124
|
-
handler: async (accessor) => {
|
|
125
|
-
return command(accessor, type);
|
|
126
|
-
},
|
|
127
|
-
when: ( ContextKeyExpr.and(PromptsConfig.enabledCtx, ChatContextKeys.enabled)),
|
|
128
|
-
});
|
|
129
|
-
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
|
|
130
|
-
command: {
|
|
131
|
-
id,
|
|
132
|
-
title,
|
|
133
|
-
category: CHAT_CATEGORY
|
|
134
|
-
},
|
|
135
|
-
when: ( ContextKeyExpr.and(PromptsConfig.enabledCtx, ChatContextKeys.enabled))
|
|
136
|
-
});
|
|
113
|
+
], {
|
|
114
|
+
neverShowAgain: {
|
|
115
|
+
id: 'workbench.command.prompts.create.user.enable-sync-notification',
|
|
116
|
+
scope: NeverShowAgainScope.PROFILE,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
137
120
|
}
|
|
138
121
|
const NEW_PROMPT_COMMAND_ID = 'workbench.command.new.prompt';
|
|
139
122
|
const NEW_INSTRUCTIONS_COMMAND_ID = 'workbench.command.new.instructions';
|
|
140
|
-
|
|
141
|
-
|
|
123
|
+
const NEW_MODE_COMMAND_ID = 'workbench.command.new.mode';
|
|
124
|
+
class NewPromptFileAction extends AbstractNewPromptOrInstructionsFileAction {
|
|
125
|
+
constructor() {
|
|
126
|
+
super(NEW_PROMPT_COMMAND_ID, ( localize(5045, "New Prompt File...")), PromptsType.prompt);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
class NewInstructionsFileAction extends AbstractNewPromptOrInstructionsFileAction {
|
|
130
|
+
constructor() {
|
|
131
|
+
super(NEW_INSTRUCTIONS_COMMAND_ID, ( localize(5046, "New Instructions File...")), PromptsType.instructions);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
class NewModeFileAction extends AbstractNewPromptOrInstructionsFileAction {
|
|
135
|
+
constructor() {
|
|
136
|
+
super(NEW_MODE_COMMAND_ID, ( localize(5047, "New Mode File...")), PromptsType.mode);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
registerAction2(NewPromptFileAction);
|
|
140
|
+
registerAction2(NewInstructionsFileAction);
|
|
141
|
+
registerAction2(NewModeFileAction);
|
|
142
142
|
|
|
143
|
-
export { NEW_INSTRUCTIONS_COMMAND_ID, NEW_PROMPT_COMMAND_ID };
|
|
143
|
+
export { NEW_INSTRUCTIONS_COMMAND_ID, NEW_MODE_COMMAND_ID, NEW_PROMPT_COMMAND_ID };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IQuickInputService } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service";
|
|
1
|
+
import { PromptsType } from "@codingame/monaco-vscode-47472025-cc45-5680-86cd-09ceaba921a1-common/vscode/vs/platform/prompts/common/prompts";
|
|
3
2
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
4
|
-
import {
|
|
5
|
-
export declare
|
|
3
|
+
import { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/editor/browser/editorExtensions";
|
|
4
|
+
export declare function askForPromptFileName(accessor: ServicesAccessor, type: PromptsType, selectedFolder: URI, existingFileName?: string): Promise<string | undefined>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
3
|
-
import { getPromptFileExtension } from '@codingame/monaco-vscode-
|
|
3
|
+
import { getPromptFileExtension, PromptsType } from '@codingame/monaco-vscode-47472025-cc45-5680-86cd-09ceaba921a1-common/vscode/vs/platform/prompts/common/prompts';
|
|
4
|
+
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
4
5
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
6
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
5
7
|
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
6
8
|
import { isValidBasename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/extpath';
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
: ( localize(4982, "Enter the name of the prompt file"));
|
|
10
|
+
async function askForPromptFileName(accessor, type, selectedFolder, existingFileName) {
|
|
11
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
12
|
+
const fileService = accessor.get(IFileService);
|
|
12
13
|
const sanitizeInput = (input) => {
|
|
13
14
|
const trimmedName = input.trim();
|
|
14
15
|
if (!trimmedName) {
|
|
@@ -23,30 +24,55 @@ const askForPromptFileName = async (type, selectedFolder, quickInputService, fil
|
|
|
23
24
|
const fileName = sanitizeInput(value);
|
|
24
25
|
if (!fileName) {
|
|
25
26
|
return {
|
|
26
|
-
content: ( localize(
|
|
27
|
+
content: ( localize(5048, "Please enter a name.")),
|
|
27
28
|
severity: Severity.Warning
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
if (!isValidBasename(fileName)) {
|
|
31
32
|
return {
|
|
32
|
-
content: ( localize(
|
|
33
|
+
content: ( localize(5049, "The name contains invalid characters.")),
|
|
33
34
|
severity: Severity.Error
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
37
|
const fileUri = URI.joinPath(selectedFolder, fileName);
|
|
37
38
|
if (await fileService.exists(fileUri)) {
|
|
38
39
|
return {
|
|
39
|
-
content: ( localize(
|
|
40
|
+
content: ( localize(5050, "A file for the given name already exists.")),
|
|
40
41
|
severity: Severity.Error
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
44
|
return undefined;
|
|
44
45
|
};
|
|
45
|
-
const
|
|
46
|
+
const placeHolder = existingFileName ? getPlaceholderStringForRename(type) : getPlaceholderStringForNew(type);
|
|
47
|
+
const result = await quickInputService.input({ placeHolder, validateInput, value: existingFileName });
|
|
46
48
|
if (!result) {
|
|
47
49
|
return undefined;
|
|
48
50
|
}
|
|
49
51
|
return sanitizeInput(result);
|
|
50
|
-
}
|
|
52
|
+
}
|
|
53
|
+
function getPlaceholderStringForNew(type) {
|
|
54
|
+
switch (type) {
|
|
55
|
+
case PromptsType.instructions:
|
|
56
|
+
return localize(5051, "Enter the name of the instructions file");
|
|
57
|
+
case PromptsType.prompt:
|
|
58
|
+
return localize(5052, "Enter the name of the prompt file");
|
|
59
|
+
case PromptsType.mode:
|
|
60
|
+
return localize(5053, "Enter the name of the custom chat mode file");
|
|
61
|
+
default:
|
|
62
|
+
throw ( new Error('Unknown prompt type'));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function getPlaceholderStringForRename(type) {
|
|
66
|
+
switch (type) {
|
|
67
|
+
case PromptsType.instructions:
|
|
68
|
+
return localize(5054, "Enter a new name of the instructions file");
|
|
69
|
+
case PromptsType.prompt:
|
|
70
|
+
return localize(5055, "Enter a new name of the prompt file");
|
|
71
|
+
case PromptsType.mode:
|
|
72
|
+
return localize(5056, "Enter a new name of the custom chat mode file");
|
|
73
|
+
default:
|
|
74
|
+
throw ( new Error('Unknown prompt type'));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
51
77
|
|
|
52
78
|
export { askForPromptFileName };
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import { IQuickInputService } from "@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service";
|
|
7
|
-
interface IAskForFolderOptions {
|
|
8
|
-
readonly type: TPromptsType;
|
|
9
|
-
readonly placeHolder: string;
|
|
10
|
-
readonly labelService: ILabelService;
|
|
11
|
-
readonly openerService: IOpenerService;
|
|
12
|
-
readonly promptsService: IPromptsService;
|
|
13
|
-
readonly quickInputService: IQuickInputService;
|
|
14
|
-
readonly workspaceService: IWorkspaceContextService;
|
|
15
|
-
}
|
|
16
|
-
export declare const askForPromptSourceFolder: (options: IAskForFolderOptions) => Promise<IPromptPath | undefined>;
|
|
17
|
-
export {};
|
|
1
|
+
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
|
+
import { IPromptPath } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/types";
|
|
3
|
+
import { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
4
|
+
import { PromptsType } from "@codingame/monaco-vscode-47472025-cc45-5680-86cd-09ceaba921a1-common/vscode/vs/platform/prompts/common/prompts";
|
|
5
|
+
export declare function askForPromptSourceFolder(accessor: ServicesAccessor, type: PromptsType, existingFolder?: URI | undefined, isMove?: boolean): Promise<IPromptPath | undefined>;
|
|
@@ -1,29 +1,41 @@
|
|
|
1
1
|
|
|
2
2
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
3
3
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
4
|
-
import { extUri, basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
4
|
+
import { isEqual, extUri, basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
5
|
+
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
6
|
+
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
5
7
|
import { PROMPT_DOCUMENTATION_URL } from '@codingame/monaco-vscode-fab30422-b487-5f4e-8d30-8b4d266e3fcd-common/vscode/vs/workbench/contrib/chat/common/promptSyntax/constants';
|
|
8
|
+
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
9
|
+
import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/types.service';
|
|
10
|
+
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
11
|
+
import { PromptsType } from '@codingame/monaco-vscode-47472025-cc45-5680-86cd-09ceaba921a1-common/vscode/vs/platform/prompts/common/prompts';
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
const
|
|
13
|
+
async function askForPromptSourceFolder(accessor, type, existingFolder, isMove = false) {
|
|
14
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
15
|
+
const promptsService = accessor.get(IPromptsService);
|
|
16
|
+
const labelService = accessor.get(ILabelService);
|
|
17
|
+
const workspaceService = accessor.get(IWorkspaceContextService);
|
|
9
18
|
const folders = promptsService.getSourceFolders(type);
|
|
10
19
|
if (folders.length === 0) {
|
|
11
|
-
|
|
20
|
+
await showNoFoldersDialog(accessor, type);
|
|
21
|
+
return;
|
|
12
22
|
}
|
|
13
|
-
if (folders.length === 1) {
|
|
23
|
+
if (!existingFolder && folders.length === 1) {
|
|
14
24
|
return folders[0];
|
|
15
25
|
}
|
|
16
26
|
const pickOptions = {
|
|
17
|
-
placeHolder,
|
|
27
|
+
placeHolder: existingFolder ? getPlaceholderStringforMove(type, isMove) : getPlaceholderStringforNew(type),
|
|
18
28
|
canPickMany: false,
|
|
19
29
|
matchOnDescription: true,
|
|
20
30
|
};
|
|
21
31
|
const foldersList = ( folders.map(folder => {
|
|
22
32
|
const uri = folder.uri;
|
|
33
|
+
const detail = (existingFolder && isEqual(uri, existingFolder)) ? ( localize(5057, "Current Location")) : undefined;
|
|
23
34
|
if (folder.storage === 'user') {
|
|
24
35
|
return {
|
|
25
36
|
type: 'item',
|
|
26
|
-
label: ( localize(
|
|
37
|
+
label: ( localize(5058, "User Data Folder")),
|
|
38
|
+
detail,
|
|
27
39
|
description: labelService.getUriLabel(uri),
|
|
28
40
|
tooltip: uri.fsPath,
|
|
29
41
|
folder
|
|
@@ -36,6 +48,7 @@ const askForPromptSourceFolder = async (options) => {
|
|
|
36
48
|
return {
|
|
37
49
|
type: 'item',
|
|
38
50
|
label: basename(uri),
|
|
51
|
+
detail,
|
|
39
52
|
description: labelService.getUriLabel(uri, { relative: true }),
|
|
40
53
|
tooltip: uri.fsPath,
|
|
41
54
|
folder,
|
|
@@ -43,7 +56,8 @@ const askForPromptSourceFolder = async (options) => {
|
|
|
43
56
|
}
|
|
44
57
|
return {
|
|
45
58
|
type: 'item',
|
|
46
|
-
label: ( localize(
|
|
59
|
+
label: ( localize(5059, "Current Workspace")),
|
|
60
|
+
detail,
|
|
47
61
|
description: labelService.getUriLabel(uri, { relative: false }),
|
|
48
62
|
tooltip: uri.fsPath,
|
|
49
63
|
folder,
|
|
@@ -54,24 +68,84 @@ const askForPromptSourceFolder = async (options) => {
|
|
|
54
68
|
return;
|
|
55
69
|
}
|
|
56
70
|
return answer.folder;
|
|
57
|
-
}
|
|
58
|
-
|
|
71
|
+
}
|
|
72
|
+
function getPlaceholderStringforNew(type) {
|
|
73
|
+
switch (type) {
|
|
74
|
+
case PromptsType.instructions:
|
|
75
|
+
return localize(5060, "Select a location to create the instructions file in...");
|
|
76
|
+
case PromptsType.prompt:
|
|
77
|
+
return localize(5061, "Select a location to create the prompt file in...");
|
|
78
|
+
case PromptsType.mode:
|
|
79
|
+
return localize(5062, "Select a location to create the mode file in...");
|
|
80
|
+
default:
|
|
81
|
+
throw ( new Error('Unknown prompt type'));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function getPlaceholderStringforMove(type, isMove) {
|
|
85
|
+
if (isMove) {
|
|
86
|
+
switch (type) {
|
|
87
|
+
case PromptsType.instructions:
|
|
88
|
+
return localize(5063, "Select a location to move the instructions file to...");
|
|
89
|
+
case PromptsType.prompt:
|
|
90
|
+
return localize(5064, "Select a location to move the prompt file to...");
|
|
91
|
+
case PromptsType.mode:
|
|
92
|
+
return localize(5065, "Select a location to move the mode file to...");
|
|
93
|
+
default:
|
|
94
|
+
throw ( new Error('Unknown prompt type'));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
switch (type) {
|
|
98
|
+
case PromptsType.instructions:
|
|
99
|
+
return localize(5066, "Select a location to copy the instructions file to...");
|
|
100
|
+
case PromptsType.prompt:
|
|
101
|
+
return localize(5067, "Select a location to copy the prompt file to...");
|
|
102
|
+
case PromptsType.mode:
|
|
103
|
+
return localize(5068, "Select a location to copy the mode file to...");
|
|
104
|
+
default:
|
|
105
|
+
throw ( new Error('Unknown prompt type'));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function showNoFoldersDialog(accessor, type) {
|
|
109
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
110
|
+
const openerService = accessor.get(IOpenerService);
|
|
59
111
|
const docsQuickPick = {
|
|
60
112
|
type: 'item',
|
|
61
|
-
label: (
|
|
113
|
+
label: getLearnLabel(type),
|
|
62
114
|
description: PROMPT_DOCUMENTATION_URL,
|
|
63
115
|
tooltip: PROMPT_DOCUMENTATION_URL,
|
|
64
116
|
value: ( URI.parse(PROMPT_DOCUMENTATION_URL)),
|
|
65
117
|
};
|
|
66
118
|
const result = await quickInputService.pick([docsQuickPick], {
|
|
67
|
-
placeHolder: (
|
|
119
|
+
placeHolder: getMissingSourceFolderString(type),
|
|
68
120
|
canPickMany: false,
|
|
69
121
|
});
|
|
70
|
-
if (
|
|
71
|
-
|
|
122
|
+
if (result) {
|
|
123
|
+
await openerService.open(result.value);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function getLearnLabel(type) {
|
|
127
|
+
switch (type) {
|
|
128
|
+
case PromptsType.prompt:
|
|
129
|
+
return localize(5069, 'Learn how to configure reusable prompts');
|
|
130
|
+
case PromptsType.instructions:
|
|
131
|
+
return localize(5070, 'Learn how to configure reusable instructions');
|
|
132
|
+
case PromptsType.mode:
|
|
133
|
+
return localize(5071, 'Learn how to configure custom chat modes');
|
|
134
|
+
default:
|
|
135
|
+
throw ( new Error('Unknown prompt type'));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function getMissingSourceFolderString(type) {
|
|
139
|
+
switch (type) {
|
|
140
|
+
case PromptsType.instructions:
|
|
141
|
+
return localize(5072, 'No instruction source folders found.');
|
|
142
|
+
case PromptsType.prompt:
|
|
143
|
+
return localize(5073, 'No prompt source folders found.');
|
|
144
|
+
case PromptsType.mode:
|
|
145
|
+
return localize(5074, 'No custom chat mode source folders found.');
|
|
146
|
+
default:
|
|
147
|
+
throw ( new Error('Unknown prompt type'));
|
|
72
148
|
}
|
|
73
|
-
|
|
74
|
-
return;
|
|
75
|
-
};
|
|
149
|
+
}
|
|
76
150
|
|
|
77
151
|
export { askForPromptSourceFolder };
|
|
@@ -5,12 +5,12 @@ class BaseCreatePromptError extends Error {
|
|
|
5
5
|
}
|
|
6
6
|
class FolderExists extends BaseCreatePromptError {
|
|
7
7
|
constructor(path) {
|
|
8
|
-
super(( localize(
|
|
8
|
+
super(( localize(5075, "Folder already exists at '{0}'.", path)));
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
class InvalidPromptName extends BaseCreatePromptError {
|
|
12
12
|
constructor(name) {
|
|
13
|
-
super(( localize(
|
|
13
|
+
super(( localize(5076, "Invalid prompt file name '{0}'.", name)));
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
2
2
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
3
|
-
import { IOpenerService } from "@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service";
|
|
4
3
|
interface ICreatePromptFileOptions {
|
|
5
4
|
readonly fileName: string;
|
|
6
5
|
readonly folder: URI;
|
|
7
6
|
readonly content: string;
|
|
8
|
-
fileService: IFileService;
|
|
9
|
-
openerService: IOpenerService;
|
|
10
7
|
}
|
|
11
|
-
export declare
|
|
8
|
+
export declare function createPromptFile(fileService: IFileService, options: ICreatePromptFileOptions): Promise<URI>;
|
|
12
9
|
export {};
|
|
@@ -4,21 +4,20 @@ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
|
4
4
|
import { assert } from '@codingame/monaco-vscode-api/vscode/vs/base/common/assert';
|
|
5
5
|
import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
6
6
|
import { dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
7
|
-
import { isPromptOrInstructionsFile } from '@codingame/monaco-vscode-
|
|
7
|
+
import { isPromptOrInstructionsFile } from '@codingame/monaco-vscode-47472025-cc45-5680-86cd-09ceaba921a1-common/vscode/vs/platform/prompts/common/prompts';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
const { fileName, folder, content
|
|
9
|
+
async function createPromptFile(fileService, options) {
|
|
10
|
+
const { fileName, folder, content } = options;
|
|
11
11
|
const promptUri = URI.joinPath(folder, fileName);
|
|
12
12
|
assert(isPromptOrInstructionsFile(promptUri), ( new InvalidPromptName(fileName)));
|
|
13
13
|
if (await fileService.exists(promptUri)) {
|
|
14
14
|
const promptInfo = await fileService.resolve(promptUri);
|
|
15
15
|
assert(!promptInfo.isDirectory, ( new FolderExists(promptUri.fsPath)));
|
|
16
|
-
await openerService.open(promptUri);
|
|
17
16
|
return promptUri;
|
|
18
17
|
}
|
|
19
18
|
await fileService.createFolder(dirname(promptUri));
|
|
20
19
|
await fileService.createFile(promptUri, VSBuffer.fromString(content));
|
|
21
20
|
return promptUri;
|
|
22
|
-
}
|
|
21
|
+
}
|
|
23
22
|
|
|
24
23
|
export { createPromptFile };
|
package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|