Skip to content

Commit

Permalink
Default presentation of Explorer: Copy Relative Path Separator in Set…
Browse files Browse the repository at this point in the history
…ting editor is confusing (fix #128345)
  • Loading branch information
bpasero committed Jul 10, 2021
1 parent 4f90d80 commit 4ee40e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/vs/workbench/contrib/files/browser/fileCommands.ts
Expand Up @@ -275,7 +275,14 @@ CommandsRegistry.registerCommand({
async function resourcesToClipboard(resources: URI[], relative: boolean, clipboardService: IClipboardService, labelService: ILabelService, configurationService: IConfigurationService): Promise<void> {
if (resources.length) {
const lineDelimiter = isWindows ? '\r\n' : '\n';
const separator = relative ? configurationService.getValue<'/' | '\\' | undefined>('explorer.copyRelativePathSeparator') : undefined;

let separator: '/' | '\\' | undefined = undefined;
if (relative) {
const relativeSeparator = configurationService.getValue('explorer.copyRelativePathSeparator');
if (relativeSeparator === '/' || relativeSeparator === '\\') {
separator = relativeSeparator;
}
}

const text = resources.map(resource => labelService.getUriLabel(resource, { relative, noPrefix: true, separator })).join(lineDelimiter);
await clipboardService.writeText(text);
Expand Down
7 changes: 5 additions & 2 deletions src/vs/workbench/contrib/files/browser/files.contribution.ts
Expand Up @@ -407,13 +407,16 @@ configurationRegistry.registerConfiguration({
'type': 'string',
'enum': [
'/',
'\\'
'\\',
'auto'
],
'enumDescriptions': [
nls.localize('copyRelativePathSeparator.slash', "Use slash as path separation character."),
nls.localize('copyRelativePathSeparator.backslash', "Use backslash as path separation character."),
nls.localize('copyRelativePathSeparator.auto', "Uses operating system specific path separation character."),
],
'description': nls.localize('copyRelativePathSeparator', "The path separation character used when copying relative file paths. Will use the operating system default unless specified."),
'description': nls.localize('copyRelativePathSeparator', "The path separation character used when copying relative file paths."),
'default': 'auto'
}
}
});
Expand Down

0 comments on commit 4ee40e7

Please sign in to comment.