How to use the vscode-uri.revive 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 / main / browser / debug / debug-main.ts View on Github external
if (options.configuration.name === nameOrConfiguration) {
                    configuration = options.configuration;
                }
            }
        } else {
            configuration = nameOrConfiguration;
        }

        if (!configuration) {
            console.error(`There is no debug configuration for ${nameOrConfiguration}`);
            return false;
        }

        const session = await this.sessionManager.start({
            configuration,
            workspaceFolderUri: folder && Uri.revive(folder.uri).toString()
        });

        return !!session;
    }
github eclipse-theia / theia / packages / plugin-ext / src / plugin / file-system.ts View on Github external
$readFile(handle: number, resource: UriComponents, options?: { encoding?: string }): Promise {
        this.checkProviderExists(handle);

        return Promise.resolve(this.fsProviders.get(handle)!.readFile(URI.revive(resource))).then(data => {
            const buffer = Buffer.isBuffer(data) ? data : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
            const encoding = options === null ? undefined : options && options.encoding;
            return buffer.toString(encoding);
        }
        );
    }
github eclipse-theia / theia / packages / plugin-ext / src / plugin / editors-and-documents.ts View on Github external
}
        }

        if (delta.removedEditors) {
            for (const id of delta.removedEditors) {
                const editor = this.editors.get(id);
                this.editors.delete(id);
                if (editor) {
                    removedEditors.push(editor);
                }
            }
        }

        if (delta.addedEditors) {
            for (const data of delta.addedEditors) {
                const resource = URI.revive(data.documentUri);
                ok(this.documents.has(resource.toString()), `document '${resource}' doesn't exist`);
                ok(!this.editors.has(data.id), `editor '${data.id}' already exists!`);

                const documentData = this.documents.get(resource.toString());
                const editor = new TextEditorExt(
                    this.rpc.getProxy(PLUGIN_RPC_CONTEXT.TEXT_EDITORS_MAIN),
                    data.id,
                    documentData!,
                    data.selections.map(Converter.toSelection),
                    data.options,
                    data.visibleRanges.map(Converter.toRange),
                    Converter.toViewColumn(data.editorPosition)
                );
                this.editors.set(data.id, editor);
            }
        }
github eclipse-theia / theia / packages / plugin-ext / src / plugin / workspace.ts View on Github external
$onFileRename(event: FileMoveEvent): void {
        this.workspaceDidRenameFileEmitter.fire(Object.freeze({ oldUri: URI.revive(event.oldUri), newUri: URI.revive(event.newUri) }));
    }
github eclipse-theia / theia / packages / plugin-ext / src / main / browser / documents-main.ts View on Github external
async $trySaveDocument(uri: UriComponents): Promise {
        const widget = await this.editorManager.getByUri(new URI(CodeURI.revive(uri)));
        if (widget) {
            await Saveable.save(widget);
            return true;
        }

        return false;
    }
github eclipse-theia / theia / packages / plugin-ext / src / plugin / window-state.ts View on Github external
async asExternalUri(target: URI): Promise {
        if (!target.scheme.trim().length) {
            throw new Error('Invalid scheme - cannot be empty');
        }
        if (Schemes.HTTP !== target.scheme && Schemes.HTTPS !== target.scheme) {
            throw new Error(`Invalid scheme '${target.scheme}'`);
        }

        const uri = await this.proxy.$asExternalUri(target);
        return URI.revive(uri);
    }
github eclipse-theia / theia / packages / plugin-ext / src / plugin / documents.ts View on Github external
        return this.proxy.$tryCreateDocument(options).then(data => URI.revive(data));
    }
github eclipse-theia / theia / packages / plugin-ext / src / plugin / workspace.ts View on Github external
$onWillRename(event: FileWillMoveEvent): Promise {
        return this.workspaceWillRenameFileEmitter.fire({
            oldUri: URI.revive(event.oldUri),
            newUri: URI.revive(event.newUri),
            waitUntil: (thenable: Promise): void => { }
        });
    }
}
github eclipse-theia / theia / packages / plugin-ext / src / main / browser / documents-main.ts View on Github external
async $tryOpenDocument(uri: UriComponents): Promise {
        const ref = await this.modelService.createModelReference(new URI(CodeURI.revive(uri)));
        if (ref.object) {
            this.modelReferenceCache.add(ref);
            return true;
        } else {
            ref.dispose();
            return false;
        }
    }
github eclipse-theia / theia / packages / plugin-ext / src / main / browser / text-editors-main.ts View on Github external
protected toRemoteUri(uri?: UriComponents): UriComponents | undefined {
        if (uri && uri.scheme === 'file') {
            return theiaUritoUriComponents(this.fileEndpoint.withQuery(URI.revive(uri).toString()));
        }
        return uri;
    }