Открыть боковую панель
code
vscode
Коммиты
2a5020c2
Коммит
2a5020c2
создал
Апр 16, 2025
по автору
Oleg Solomko
Просмотр файлов
add /save slash command
владелец
8b4ad1d4
Изменения
3
Скрыть пробелы
Построчно
Рядом
src/vs/workbench/contrib/chat/browser/actions/chatContextActions.ts
Просмотр файла @
2a5020c2
...
...
@@ -63,7 +63,7 @@ import { convertBufferToScreenshotVariable, ScreenshotVariableId } from '../cont
import
{
resizeImage
}
from
'
../imageUtils.js
'
;
import
{
INSTRUCTIONS_COMMAND_ID
}
from
'
../promptSyntax/contributions/attachInstructionsCommand.js
'
;
import
{
CHAT_CATEGORY
}
from
'
./chatActions.js
'
;
import
{
runAttachInstructionsAction
,
register
Reusable
PromptActions
}
from
'
./
reusableP
romptActions/index.js
'
;
import
{
runAttachInstructionsAction
,
registerPromptActions
}
from
'
./
p
romptActions/index.js
'
;
export
function
registerChatContextActions
()
{
registerAction2
(
AttachContextAction
);
...
...
@@ -978,4 +978,4 @@ export class AttachContextAction extends Action2 {
/**
* Register all actions related to reusable prompt files.
*/
register
Reusable
PromptActions
();
registerPromptActions
();
src/vs/workbench/contrib/chat/browser/actions/promptActions/index.ts
0 → 100644
Просмотр файла @
2a5020c2
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
registerRunPromptActions
}
from
'
./chatRunPromptAction.js
'
;
import
{
registerSaveToPromptActions
}
from
'
./chatSaveToPromptAction.js
'
;
import
{
registerAttachPromptActions
}
from
'
./chatAttachInstructionsAction.js
'
;
/**
* Helper to register all actions related to reusable prompt files.
*/
export
const
registerPromptActions
=
()
=>
{
registerRunPromptActions
();
registerAttachPromptActions
();
registerSaveToPromptActions
();
};
export
{
runAttachInstructionsAction
}
from
'
./chatAttachInstructionsAction.js
'
;
src/vs/workbench/contrib/chat/browser/chat.contribution.ts
Просмотр файла @
2a5020c2
...
...
@@ -103,6 +103,8 @@ import { LanguageModelToolsService } from './languageModelToolsService.js';
import
'
./promptSyntax/contributions/createPromptCommand/createPromptCommand.js
'
;
import
'
./promptSyntax/contributions/attachInstructionsCommand.js
'
;
import
{
ChatViewsWelcomeHandler
}
from
'
./viewsWelcome/chatViewsWelcomeHandler.js
'
;
import
{
runSaveToPromptAction
,
SAVE_TO_PROMPT_SLASH_COMMAND_NAME
}
from
'
./actions/promptActions/chatSaveToPromptAction.js
'
;
import
{
assertDefined
}
from
'
../../../../base/common/types.js
'
;
// Register configuration
const
configurationRegistry
=
Registry
.
as
<
IConfigurationRegistry
>
(
ConfigurationExtensions
.
Configuration
);
...
...
@@ -488,7 +490,7 @@ class ChatSlashStaticSlashCommandsContribution extends Disposable {
@
IChatSlashCommandService
slashCommandService
:
IChatSlashCommandService
,
@
ICommandService
commandService
:
ICommandService
,
@
IChatAgentService
chatAgentService
:
IChatAgentService
,
@
IChat
Variables
Service
chat
Variables
Service
:
IChat
Variables
Service
,
@
IChat
Widget
Service
chat
Widget
Service
:
IChat
Widget
Service
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
)
{
super
();
...
...
@@ -501,6 +503,22 @@ class ChatSlashStaticSlashCommandsContribution extends Disposable {
},
async
()
=>
{
commandService
.
executeCommand
(
ACTION_ID_NEW_CHAT
);
}));
this
.
_store
.
add
(
slashCommandService
.
registerSlashCommand
({
command
:
SAVE_TO_PROMPT_SLASH_COMMAND_NAME
,
detail
:
nls
.
localize
(
'
save-chat-to-prompt-file
'
,
"
Save chat to a prompt file
"
),
// TODO: @legomushroom - reuse the command name constant?
sortText
:
'
z3_save
'
,
executeImmediately
:
true
,
locations
:
[
ChatAgentLocation
.
Panel
]
},
async
()
=>
{
const
{
lastFocusedWidget
}
=
chatWidgetService
;
assertDefined
(
lastFocusedWidget
,
'
No currently active chat widget found.
'
,
);
runSaveToPromptAction
({
chat
:
lastFocusedWidget
},
commandService
);
}));
this
.
_store
.
add
(
slashCommandService
.
registerSlashCommand
({
command
:
'
help
'
,
detail
:
''
,
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать