Skip to content

Commit 1b2fdd1

Browse files
author
Benjamin Pasero
committed
💄 "Copy Relative Path"
1 parent ac7ead3 commit 1b2fdd1

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

src/vs/workbench/parts/files/electron-browser/fileActions.contribution.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,18 @@ const copyRelativePathCommand = {
124124
};
125125

126126
// Editor Title Context Menu
127+
appendEditorTitleContextMenuItem(COPY_PATH_COMMAND_ID, copyPathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste');
128+
appendEditorTitleContextMenuItem(COPY_RELATIVE_PATH_COMMAND_ID, copyRelativePathCommand.title, ResourceContextKey.IsFileSystemResource, '1_cutcopypaste');
127129
appendEditorTitleContextMenuItem(REVEAL_IN_OS_COMMAND_ID, REVEAL_IN_OS_LABEL, ResourceContextKey.Scheme.isEqualTo(Schemas.file));
128-
appendEditorTitleContextMenuItem(COPY_PATH_COMMAND_ID, copyPathCommand.title, ResourceContextKey.IsFileSystemResource);
129-
appendEditorTitleContextMenuItem(COPY_RELATIVE_PATH_COMMAND_ID, copyRelativePathCommand.title, ResourceContextKey.IsFileSystemResource);
130130
appendEditorTitleContextMenuItem(REVEAL_IN_EXPLORER_COMMAND_ID, nls.localize('revealInSideBar', "Reveal in Side Bar"), ResourceContextKey.IsFileSystemResource);
131131

132-
function appendEditorTitleContextMenuItem(id: string, title: string, when: ContextKeyExpr, alt?: { id: string, title: string }): void {
132+
function appendEditorTitleContextMenuItem(id: string, title: string, when: ContextKeyExpr, group?: string): void {
133133

134134
// Menu
135135
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, {
136136
command: { id, title },
137137
when,
138-
group: '2_files',
139-
alt
138+
group: group || '2_files'
140139
});
141140
}
142141

@@ -215,10 +214,16 @@ MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
215214
});
216215

217216
MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
218-
group: 'navigation',
219-
order: 40,
217+
group: '1_cutcopypaste',
218+
order: 10,
220219
command: copyPathCommand,
221-
alt: copyRelativePathCommand,
220+
when: ResourceContextKey.IsFileSystemResource
221+
});
222+
223+
MenuRegistry.appendMenuItem(MenuId.OpenEditorsContext, {
224+
group: '1_cutcopypaste',
225+
order: 20,
226+
command: copyRelativePathCommand,
222227
when: ResourceContextKey.IsFileSystemResource
223228
});
224229

0 commit comments

Comments
 (0)