How to use the vscode-uri.setUriThrowOnMissingScheme function in vscode-uri

To help you get started, we’ve selected a few vscode-uri examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eclipse-theia / theia / packages / core / src / common / uri.ts View on Github external
*
 * 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`
github recca0120 / vscode-phpunit / server / src / Filesystem.ts View on Github external
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[] {