@@ -16,7 +16,7 @@ import { ExplorerViewPaneContainer } from 'vs/workbench/contrib/files/browser/ex
16
16
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService' ;
17
17
import { toErrorMessage } from 'vs/base/common/errorMessage' ;
18
18
import { IListService } from 'vs/platform/list/browser/listService' ;
19
- import { CommandsRegistry } from 'vs/platform/commands/common/commands' ;
19
+ import { CommandsRegistry , ICommandHandler } from 'vs/platform/commands/common/commands' ;
20
20
import { IContextKey , IContextKeyService , ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
21
21
import { IFileService } from 'vs/platform/files/common/files' ;
22
22
import { KeybindingsRegistry , KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry' ;
@@ -248,6 +248,11 @@ async function resourcesToClipboard(resources: URI[], relative: boolean, clipboa
248
248
}
249
249
}
250
250
251
+ const copyPathCommandHandler : ICommandHandler = async ( accessor , resource : URI | object ) => {
252
+ const resources = getMultiSelectedResources ( resource , accessor . get ( IListService ) , accessor . get ( IEditorService ) , accessor . get ( IExplorerService ) ) ;
253
+ await resourcesToClipboard ( resources , false , accessor . get ( IClipboardService ) , accessor . get ( ILabelService ) , accessor . get ( IConfigurationService ) ) ;
254
+ } ;
255
+
251
256
KeybindingsRegistry . registerCommandAndKeybindingRule ( {
252
257
weight : KeybindingWeight . WorkbenchContrib ,
253
258
when : EditorContextKeys . focus . toNegated ( ) ,
@@ -256,12 +261,25 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
256
261
primary : KeyMod . Shift | KeyMod . Alt | KeyCode . KeyC
257
262
} ,
258
263
id : COPY_PATH_COMMAND_ID ,
259
- handler : async ( accessor , resource : URI | object ) => {
260
- const resources = getMultiSelectedResources ( resource , accessor . get ( IListService ) , accessor . get ( IEditorService ) , accessor . get ( IExplorerService ) ) ;
261
- await resourcesToClipboard ( resources , false , accessor . get ( IClipboardService ) , accessor . get ( ILabelService ) , accessor . get ( IConfigurationService ) ) ;
262
- }
264
+ handler : copyPathCommandHandler
263
265
} ) ;
264
266
267
+ KeybindingsRegistry . registerCommandAndKeybindingRule ( {
268
+ weight : KeybindingWeight . WorkbenchContrib ,
269
+ when : EditorContextKeys . focus ,
270
+ primary : KeyChord ( KeyMod . CtrlCmd | KeyCode . KeyK , KeyMod . CtrlCmd | KeyMod . Alt | KeyCode . KeyC ) ,
271
+ win : {
272
+ primary : KeyMod . Shift | KeyMod . Alt | KeyCode . KeyC
273
+ } ,
274
+ id : COPY_PATH_COMMAND_ID ,
275
+ handler : copyPathCommandHandler
276
+ } ) ;
277
+
278
+ const copyRelativePathCommandHandler : ICommandHandler = async ( accessor , resource : URI | object ) => {
279
+ const resources = getMultiSelectedResources ( resource , accessor . get ( IListService ) , accessor . get ( IEditorService ) , accessor . get ( IExplorerService ) ) ;
280
+ await resourcesToClipboard ( resources , true , accessor . get ( IClipboardService ) , accessor . get ( ILabelService ) , accessor . get ( IConfigurationService ) ) ;
281
+ } ;
282
+
265
283
KeybindingsRegistry . registerCommandAndKeybindingRule ( {
266
284
weight : KeybindingWeight . WorkbenchContrib ,
267
285
when : EditorContextKeys . focus . toNegated ( ) ,
@@ -270,10 +288,18 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
270
288
primary : KeyChord ( KeyMod . CtrlCmd | KeyCode . KeyK , KeyMod . CtrlCmd | KeyMod . Shift | KeyCode . KeyC )
271
289
} ,
272
290
id : COPY_RELATIVE_PATH_COMMAND_ID ,
273
- handler : async ( accessor , resource : URI | object ) => {
274
- const resources = getMultiSelectedResources ( resource , accessor . get ( IListService ) , accessor . get ( IEditorService ) , accessor . get ( IExplorerService ) ) ;
275
- await resourcesToClipboard ( resources , true , accessor . get ( IClipboardService ) , accessor . get ( ILabelService ) , accessor . get ( IConfigurationService ) ) ;
276
- }
291
+ handler : copyRelativePathCommandHandler
292
+ } ) ;
293
+
294
+ KeybindingsRegistry . registerCommandAndKeybindingRule ( {
295
+ weight : KeybindingWeight . WorkbenchContrib ,
296
+ when : EditorContextKeys . focus ,
297
+ primary : KeyChord ( KeyMod . CtrlCmd | KeyCode . KeyK , KeyMod . CtrlCmd | KeyMod . Shift | KeyMod . Alt | KeyCode . KeyC ) ,
298
+ win : {
299
+ primary : KeyChord ( KeyMod . CtrlCmd | KeyCode . KeyK , KeyMod . CtrlCmd | KeyMod . Shift | KeyCode . KeyC )
300
+ } ,
301
+ id : COPY_RELATIVE_PATH_COMMAND_ID ,
302
+ handler : copyRelativePathCommandHandler
277
303
} ) ;
278
304
279
305
KeybindingsRegistry . registerCommandAndKeybindingRule ( {
0 commit comments