🐛 isolate git uri handling

fixes #23297
This commit is contained in:
Joao Moreno
2017-04-10 15:28:13 +02:00
parent 0a7bd0a19e
commit 564b9a8a1e
4 changed files with 42 additions and 30 deletions

25
extensions/git/src/uri.ts Normal file
View File

@@ -0,0 +1,25 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { Uri } from 'vscode';
export function fromGitUri(uri: Uri): { path: string; ref: string; } {
return JSON.parse(uri.query);
}
// As a mitigation for extensions like ESLint showing warnings and errors
// for git URIs, let's change the file extension of these uris to .git.
export function toGitUri(uri: Uri, ref: string): Uri {
return uri.with({
scheme: 'git',
path: `${uri.path}.git`,
query: JSON.stringify({
path: uri.fsPath,
ref
})
});
}