How to use the vscode-uri.isUri 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 / plugin-ext / src / plugin / workspace.ts View on Github external
workspaceFoldersToAdd.forEach(folderToAdd => {
                const uri = URI.isUri(folderToAdd.uri) && folderToAdd.uri.toString();
                if (uri && !rootsToAdd.has(uri)) {
                    rootsToAdd.add(uri);
                }
            });
        }
github eclipse-theia / theia / packages / plugin-ext-vscode / src / browser / plugin-vscode-commands-contribution.ts View on Github external
execute: async (resource: URI, columnOrOptions?: ViewColumn | TextDocumentShowOptions) => {
                if (!resource) {
                    throw new Error(`${VscodeCommands.OPEN.id} command requires at least URI argument.`);
                }
                if (!URI.isUri(resource)) {
                    throw new Error(`Invalid argument for ${VscodeCommands.OPEN.id} command with URI argument. Found ${resource}`);
                }

                let options: TextDocumentShowOptions | undefined;
                if (typeof columnOrOptions === 'number') {
                    options = {
                        viewColumn: fromViewColumn(columnOrOptions)
                    };
                } else if (columnOrOptions) {
                    options = {
                        ...columnOrOptions,
                        viewColumn: fromViewColumn(columnOrOptions.viewColumn)
                    };
                }
                const editorOptions = DocumentsMainImpl.toEditorOpenerOptions(this.shell, options);
                await open(this.openerService, new TheiaURI(resource), editorOptions);
github recca0120 / vscode-phpunit / server / src / Filesystem.ts View on Github external
asUri(uri: PathLike | URI): URI {
        if (URI.isUri(uri)) {
            return uri;
        }

        uri = uri as string;

        if (this.env.isWin()) {
            uri = uri.replace(/\\/g, '/').replace(/^(\w):/i, m => {
                return `/${m[0].toLowerCase()}%3A`;
            });
        }

        return URI.parse(uri).with({ scheme: 'file' });
    }
github eclipse-theia / theia / packages / plugin-ext-vscode / src / browser / plugin-vscode-commands-contribution.ts View on Github external
execute: async (left: URI, right: URI, label?: string, options?: TextDocumentShowOptions) => {
                if (!left || !right) {
                    throw new Error(`${VscodeCommands.DIFF} command requires at least two URI arguments. Found left=${left}, right=${right} as arguments`);
                }
                if (!URI.isUri(left)) {
                    throw new Error(`Invalid argument for ${VscodeCommands.DIFF.id} command with left argument. Expecting URI left type but found ${left}`);
                }
                if (!URI.isUri(right)) {
                    throw new Error(`Invalid argument for ${VscodeCommands.DIFF.id} command with right argument. Expecting URI right type but found ${right}`);
                }

                const leftURI = new TheiaURI(left);
                const editorOptions = DocumentsMainImpl.toEditorOpenerOptions(this.shell, options);
                await this.diffService.openDiffEditor(leftURI, new TheiaURI(right), label, editorOptions);
            }
        });
github eclipse-theia / theia / packages / plugin-ext-vscode / src / browser / plugin-vscode-commands-contribution.ts View on Github external
execute: async (left: URI, right: URI, label?: string, options?: TextDocumentShowOptions) => {
                if (!left || !right) {
                    throw new Error(`${VscodeCommands.DIFF} command requires at least two URI arguments. Found left=${left}, right=${right} as arguments`);
                }
                if (!URI.isUri(left)) {
                    throw new Error(`Invalid argument for ${VscodeCommands.DIFF.id} command with left argument. Expecting URI left type but found ${left}`);
                }
                if (!URI.isUri(right)) {
                    throw new Error(`Invalid argument for ${VscodeCommands.DIFF.id} command with right argument. Expecting URI right type but found ${right}`);
                }

                const leftURI = new TheiaURI(left);
                const editorOptions = DocumentsMainImpl.toEditorOpenerOptions(this.shell, options);
                await this.diffService.openDiffEditor(leftURI, new TheiaURI(right), label, editorOptions);
            }
        });