How to use the vscode-uri.parse 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 xsburg / vscode-javascript-booster / server / src / services / codeModService.ts View on Github external
}
                const stat = await fs.lstat(fileName);
                return {
                    isFile: stat.isFile(),
                    fileName
                };
            })
        ))
            .filter(x => x.isFile)
            .map(x => this._parseCodeModFile(x.fileName));
        // user-workspace code mods
        const wsFolders = await connectionService.connection().workspace.getWorkspaceFolders();
        if (wsFolders) {
            const codemodDir = connectionService.getSettings().codemodDir;
            for (let folder of wsFolders) {
                const folderUri = Uri.parse(folder.uri);
                if (folderUri.scheme !== 'file') {
                    continue;
                }

                const dirName = path.join(folderUri.fsPath, codemodDir);
                if (!(await fs.pathExists(dirName))) {
                    continue;
                }

                const names = await fs.readdir(dirName);
                for (let n of names) {
                    const fn = path.join(dirName, n);
                    if ((await fs.stat(fn)).isFile) {
                        codeMods.push(this._parseCodeModFile(fn));
                    }
                }
github Polymer / polymer-analyzer / src / url-loader / fs-url-loader.ts View on Github external
getFilePath(url: ResolvedUrl): Result {
    if (!url.startsWith('file://')) {
      return {successful: false, error: 'Not a local file:// url.'};
    }
    if (!this.canLoad(url)) {
      return {
        successful: false,
        error: `Path is not inside root directory: ${JSON.stringify(this.root)}`
      };
    }
    const path = Uri.parse(url).fsPath;
    return {successful: true, value: path};
  }
github vuejs / vetur / server / src / modes / template / services / htmlLinks.ts View on Github external
function isValidURI(uri: string) {
  try {
    Uri.parse(uri);
    return true;
  } catch (e) {
    return false;
  }
}
github neoclide / coc-tslint / server / index.ts View on Github external
async function loadLibrary(docUri: string) {
  trace('loadLibrary for ' + docUri)

  let uri = Uri.parse(docUri)
  let promise: Thenable
  let settings = await settingsCache.get(docUri)

  let getGlobalPath = () => getGlobalPackageManagerPath(settings.packageManager)

  if (uri.scheme === 'file') {
    let file = uri.fsPath
    let directory = path.dirname(file)
    if (settings && settings.nodePath) {
      promise = resolveModule('tslint', settings.nodePath, getGlobalPath())
    } else {
      promise = resolveModule('tslint', directory, getGlobalPath())
    }
  } else {
    promise = resolveModule('tslint', process.cwd(), getGlobalPath())
  }
github forcedotcom / lightning-language-server / packages / lightning-lsp-common / src / html-language-service / services / htmlCompletion.ts View on Github external
function collectExpressionSuggestions(valueStart: number): Boolean {
            if (valueStart >= 0 && offset < text.length && (text[offset] === '}' || text[offset] === '>')) {
                const expressionEnd = offset - 1;
                for (let i = expressionEnd; i >= valueStart; i--) {
                    if (text[i] === '{') {
                        const templateTag = componentUtil.tagFromFile(URI.parse(document.uri).fsPath, settings.isSfdxProject);
                        if (templateTag) {
                            const range = getReplaceRange(i + 1, offset);
                            tagProviders.forEach(provider => {
                                provider.collectExpressionValues(templateTag, value => {
                                    result.items.push({
                                        label: value,
                                        kind: CompletionItemKind.Reference,
                                        textEdit: TextEdit.replace(range, value + (text[offset] === '}' ? '' : '}')),
                                        insertTextFormat: InsertTextFormat.PlainText,
                                    });
                                });
                            });
                            return true;
                        }
                    }
                }
github joelday / papyrus-lang / packages / papyrus-lang-lsp-server / src / ProjectHost.ts View on Github external
constructor(
        projectUri: string,
        projectLoader: IProjectLoader,
        instantiationService: IInstantiationService
    ) {
        this._projectUri = projectUri;
        this._projectName = path.basename(URI.parse(projectUri).fsPath);

        this._projectLoader = projectLoader;
        this._instantiationService = instantiationService;

        this.reloadProject();
    }
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 forcedotcom / salesforcedx-vscode / packages / salesforcedx-vscode-replay-debugger / src / states / frameEntryState.ts View on Github external
this._signature.indexOf('.') > -1
        ? this._signature.substring(0, this._signature.lastIndexOf('.'))
        : this._signature;
    if (logContext.getStaticVariablesClassMap().has(className)) {
      frame.statics = logContext.getStaticVariablesClassMap().get(className)!;
    } else {
      logContext.getStaticVariablesClassMap().set(className, frame.statics);
    }
    logContext
      .getFrames()
      .push(
        new StackFrame(
          id,
          this._frameName,
          sourceUri
            ? new Source(basename(sourceUri), Uri.parse(sourceUri).fsPath)
            : undefined,
          undefined
        )
      );
    return false;
  }
}
github neoclide / coc.nvim / src / extensions / tsserver / features / watchBuild.ts View on Github external
private getcwd(uri: string): string {
    let { path } = Uri.parse(uri)
    let m = path.match(/\/\/\d+/)
    if (!m) return
    return path.slice(0, m.index)
  }