Skip to content

explorer: add copyPathQuoteStyle setting to wrap copied paths with quotes#317956

Open
RajeshKumar11 wants to merge 4 commits into
microsoft:mainfrom
RajeshKumar11:fix/explorer-copy-path-quote-style-229280
Open

explorer: add copyPathQuoteStyle setting to wrap copied paths with quotes#317956
RajeshKumar11 wants to merge 4 commits into
microsoft:mainfrom
RajeshKumar11:fix/explorer-copy-path-quote-style-229280

Conversation

@RajeshKumar11
Copy link
Copy Markdown
Contributor

Fixes #229280

Summary

Adds a new explorer.copyPathQuoteStyle setting that controls whether copied file paths are wrapped with quotes.

Options:

  • none (default) -- no wrapping, preserves existing behavior
  • double -- wraps paths in double quotes, e.g. "C:\My Folder\file.txt"
  • single -- wraps paths in single quotes, e.g. 'C:\My Folder\file.txt'

Motivation

When copying paths that contain spaces, the copied value is not directly usable in terminal commands without manual quoting. This setting lets users configure automatic quote wrapping to match their shell preferences.

Files Changed

  • src/vs/workbench/contrib/files/browser/files.contribution.ts -- registers the explorer.copyPathQuoteStyle configuration setting
  • src/vs/workbench/contrib/files/browser/fileCommands.ts -- reads the setting in resourcesToClipboard() and applies quote wrapping

Copilot AI review requested due to automatic review settings May 22, 2026 08:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new Explorer setting to control whether copied file paths are wrapped in quotes, and applies it when copying file paths to the clipboard.

Changes:

  • Introduced explorer.copyPathQuoteStyle configuration with none|double|single options.
  • Updated resourcesToClipboard to wrap each copied path in the configured quote style.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/contrib/files/browser/files.contribution.ts Registers the new explorer.copyPathQuoteStyle setting and its descriptions.
src/vs/workbench/contrib/files/browser/fileCommands.ts Applies the new setting when generating clipboard text for copied resource paths.

const quote = quoteStyle === 'double' ? '"' : quoteStyle === 'single' ? "'" : '';
const text = resources.map(resource => {
const label = labelService.getUriLabel(resource, { relative, noPrefix: true, separator });
return quote ? `${quote}${label}${quote}` : label;

const text = resources.map(resource => labelService.getUriLabel(resource, { relative, noPrefix: true, separator })).join(lineDelimiter);
const quoteStyle = configurationService.getValue<'none' | 'double' | 'single'>('explorer.copyPathQuoteStyle');
const quote = quoteStyle === 'double' ? '"' : quoteStyle === 'single' ? "'" : '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: setting to wrap absolute path Copy Path command with quotes

3 participants