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

Adds support for zip archives #99486

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -601,21 +601,25 @@ export default class TypeScriptServiceClient extends Disposable implements IType
return resource.with({ path: path.posix.join(dirName, fileName), query: '' }).toString(true);
}

if (resource.scheme !== fileSchemes.file) {
return undefined;
}

let result = resource.fsPath;
if (!result) {
return undefined;
}

if (resource.scheme === fileSchemes.file) {
result = path.normalize(result);
if (!fileSchemes.isSupportedScheme(resource.scheme)) {
return undefined;
}

result = path.normalize(result);

// Both \ and / must be escaped in regular expressions
return result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/');
result = result.replace(new RegExp('\\' + this.pathSeparator, 'g'), '/');

if (resource.scheme !== fileSchemes.file) {
result = `${resource.scheme}:${result}`;
}

return result;
}

public toPath(resource: vscode.Uri): string | undefined {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ export const file = 'file';
export const untitled = 'untitled';
export const git = 'git';
export const walkThroughSnippet = 'walkThroughSnippet';
export const zip = 'zip';

export const supportedSchemes = [
file,
untitled,
walkThroughSnippet
walkThroughSnippet,
zip
Comment on lines +10 to +16
Copy link
Author

Choose a reason for hiding this comment

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

This is temporary and will be replaced by the strategy described in the description, if greenlighted.

];

export function isSupportedScheme(scheme: string): boolean {
Expand Down