@@ -7,15 +7,18 @@ import { CancellationToken } from 'vs/base/common/cancellation';
7
7
import { Codicon } from 'vs/base/common/codicons' ;
8
8
import { KeyCode , KeyMod } from 'vs/base/common/keyCodes' ;
9
9
import { Schemas } from 'vs/base/common/network' ;
10
- import { IRange } from 'vs/editor /common/core/range ' ;
10
+ import { compare } from 'vs/base /common/strings ' ;
11
11
import { ThemeIcon } from 'vs/base/common/themables' ;
12
12
import { URI } from 'vs/base/common/uri' ;
13
13
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions' ;
14
+ import { IRange } from 'vs/editor/common/core/range' ;
15
+ import { EditorType } from 'vs/editor/common/editorCommon' ;
14
16
import { Command } from 'vs/editor/common/languages' ;
15
17
import { AbstractGotoSymbolQuickAccessProvider , IGotoSymbolQuickPickItem } from 'vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess' ;
16
18
import { localize , localize2 } from 'vs/nls' ;
17
19
import { Action2 , MenuId , registerAction2 } from 'vs/platform/actions/common/actions' ;
18
20
import { ICommandService } from 'vs/platform/commands/common/commands' ;
21
+ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
19
22
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry' ;
20
23
import { AnythingQuickAccessProviderRunOptions } from 'vs/platform/quickinput/common/quickAccess' ;
21
24
import { IQuickInputService , IQuickPickItem , QuickPickItem } from 'vs/platform/quickinput/common/quickInput' ;
@@ -27,13 +30,10 @@ import { CONTEXT_CHAT_LOCATION, CONTEXT_IN_CHAT_INPUT, CONTEXT_IN_QUICK_CHAT } f
27
30
import { IChatRequestVariableEntry } from 'vs/workbench/contrib/chat/common/chatModel' ;
28
31
import { ChatRequestAgentPart } from 'vs/workbench/contrib/chat/common/chatParserTypes' ;
29
32
import { IChatVariablesService } from 'vs/workbench/contrib/chat/common/chatVariables' ;
33
+ import { ILanguageModelToolsService } from 'vs/workbench/contrib/chat/common/languageModelToolsService' ;
30
34
import { AnythingQuickAccessProvider } from 'vs/workbench/contrib/search/browser/anythingQuickAccess' ;
31
35
import { ISymbolQuickPickItem , SymbolsQuickAccessProvider } from 'vs/workbench/contrib/search/browser/symbolsQuickAccess' ;
32
- import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
33
36
import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
34
- import { EditorType } from 'vs/editor/common/editorCommon' ;
35
- import { compare } from 'vs/base/common/strings' ;
36
- import { ILanguageModelToolsService } from 'vs/workbench/contrib/chat/common/languageModelToolsService' ;
37
37
38
38
export function registerChatContextActions ( ) {
39
39
registerAction2 ( AttachContextAction ) ;
@@ -107,7 +107,7 @@ class AttachFileAction extends Action2 {
107
107
const textEditorService = accessor . get ( IEditorService ) ;
108
108
109
109
const activeUri = textEditorService . activeEditor ?. resource ;
110
- if ( textEditorService . activeTextEditorControl ?. getEditorType ( ) === EditorType . ICodeEditor && activeUri && [ Schemas . file , Schemas . vscodeRemote ] . includes ( activeUri . scheme ) ) {
110
+ if ( textEditorService . activeTextEditorControl ?. getEditorType ( ) === EditorType . ICodeEditor && activeUri && [ Schemas . file , Schemas . vscodeRemote , Schemas . untitled ] . includes ( activeUri . scheme ) ) {
111
111
variablesService . attachContext ( 'file' , activeUri , ChatAgentLocation . Panel ) ;
112
112
}
113
113
}
@@ -132,7 +132,7 @@ class AttachSelectionAction extends Action2 {
132
132
133
133
const activeEditor = textEditorService . activeTextEditorControl ;
134
134
const activeUri = textEditorService . activeEditor ?. resource ;
135
- if ( textEditorService . activeTextEditorControl ?. getEditorType ( ) === EditorType . ICodeEditor && activeUri && [ Schemas . file , Schemas . vscodeRemote ] . includes ( activeUri . scheme ) ) {
135
+ if ( textEditorService . activeTextEditorControl ?. getEditorType ( ) === EditorType . ICodeEditor && activeUri && [ Schemas . file , Schemas . vscodeRemote , Schemas . untitled ] . includes ( activeUri . scheme ) ) {
136
136
const selection = activeEditor ?. getSelection ( ) ;
137
137
if ( selection ) {
138
138
variablesService . attachContext ( 'file' , { uri : activeUri , range : selection } , ChatAgentLocation . Panel ) ;
0 commit comments