Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use file system path for copy commands #12002

Merged
merged 2 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
execute: async uris => {
if (uris.length) {
const lineDelimiter = isWindows ? '\r\n' : '\n';
const text = uris.map(resource => resource.path).join(lineDelimiter);
const text = uris.map(resource => resource.path.fsPath()).join(lineDelimiter);
await this.clipboardService.writeText(text);
} else {
await this.messageService.info('Open a file first to copy its path');
Expand Down
6 changes: 3 additions & 3 deletions packages/workspace/src/browser/workspace-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@ export class WorkspaceCommandContribution implements CommandContribution {
const text = uris.map((uri: URI) => {
const workspaceRoot = this.workspaceService.getWorkspaceRootUri(uri);
if (workspaceRoot) {
return workspaceRoot.relative(uri);
return workspaceRoot.relative(uri)?.fsPath();
} else {
return uri.path;
return uri.path.fsPath();
}
}).join(lineDelimiter);
await this.clipboardService.writeText(text);
Expand Down Expand Up @@ -425,7 +425,7 @@ export class WorkspaceCommandContribution implements CommandContribution {

protected trimFileName(name: string): string {
if (name && name.length > 30) {
return `${name.substr(0, 30)}...`;
return `${name.substring(0, 30)}...`;
}
return name;
}
Expand Down