Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { setUriThrowOnMissingScheme } from 'vscode-uri';
import Uri from 'vscode-uri';
import { Path } from './path';
// TODO: disable it because of #4487
setUriThrowOnMissingScheme(false);
export default class URI {
private readonly codeUri: Uri;
private _path: Path | undefined;
constructor(uri: string | Uri = '') {
if (uri instanceof Uri) {
this.codeUri = uri;
} else {
this.codeUri = Uri.parse(uri);
}
}
/**
* TODO move implementation to `DefaultUriLabelProviderContribution.getName`
import glob from 'glob';
import URI, { setUriThrowOnMissingScheme } from 'vscode-uri';
import { access, createReadStream, PathLike, readFile, writeFile } from 'fs';
import { createInterface } from 'readline';
import { dirname, join } from 'path';
import { Location, Position, Range } from 'vscode-languageserver-protocol';
import { SpawnOptions } from 'child_process';
setUriThrowOnMissingScheme(false);
export class Env {
private delimiter = ':';
public extensions = [''];
constructor(
private _paths: string | string[] = process.env.PATH as string,
private platform: string = process.platform as string
) {
if (this.isWin()) {
this.delimiter = ';';
this.extensions = ['.bat', '.exe', '.cmd', ''];
}
}
paths(): string[] {