How to use the vscode-uri.file 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 vuejs / vetur / server / src / modes / template / services / htmlDefinition.ts View on Github external
function getTagDefinition(tag: string, range: Range, open: boolean): Definition {
    tag = tag.toLowerCase(); 

    if (vueFileInfo && vueFileInfo.componentInfo.childComponents) {
      for (const cc of vueFileInfo.componentInfo.childComponents) {
        if (tag === cc.name) {
          if (cc.definition) {
            const loc: Location = {
              uri: URI.file(cc.definition.path).toString(),
              // Todo: Resolve actual default export range
              range: Range.create(0, 0, 0, 0)
            };
            return loc;
          }
        }
      }
    }
    return [];
  }
github eclipse-theia / theia / packages / plugin-ext / src / plugin / workspace.ts View on Github external
findFiles(include: theia.GlobPattern, exclude?: theia.GlobPattern | null, maxResults?: number,
        token: CancellationToken = CancellationToken.None): PromiseLike {
        let includePattern: string;
        let includeFolderUri: string | undefined;
        if (include) {
            if (typeof include === 'string') {
                includePattern = include;
            } else {
                includePattern = include.pattern;
                includeFolderUri = URI.file(include.base).toString();
            }
        } else {
            includePattern = '';
        }

        let excludePatternOrDisregardExcludes: string | false;
        if (exclude === undefined) {
            excludePatternOrDisregardExcludes = ''; // default excludes
        } else if (exclude) {
            if (typeof exclude === 'string') {
                excludePatternOrDisregardExcludes = exclude;
            } else {
                excludePatternOrDisregardExcludes = exclude.pattern;
            }
        } else {
            excludePatternOrDisregardExcludes = false; // no excludes
github GameMakerDiscord / gml-tools-langserver / src / startAndShutdown.ts View on Github external
);

                        this.reference.extensionAddExtension(
                            thisFunc.name,
                            ourJSDOC,
                            doNotAutoComplete,
                            Location.create(URI.file(ourPath).toString(), Range.create(0, 0, 0, 0)),
                            yyFile.name,
                            thisFile.filename
                        );
                    }
                    this.reference.extensionRecordSetHash(yyFile.name, thisFile.filename, thisHash);
                } else {
                    // Get our GML File:
                    const fpath = path.join(this.projectDirectory, 'extensions', yyFile.name, thisFile.filename);
                    const thisURI = URI.file(fpath);
                    const extensionFile = await fse.readFile(fpath, 'utf8');

                    // Check our Hash
                    const ourHasher = crypto.createHash('sha1');
                    const thisHash = ourHasher.update(extensionFile).digest('hex');

                    if (thisExtensionCache && thisExtensionCache[thisFile.filename]) {
                        const cachedHash = thisExtensionCache[thisFile.filename].hash;
                        if (cachedHash === thisHash) {
                            for (const thisExtName in this.projectCache.CachedReference.callables.extensions) {
                                if (
                                    this.projectCache.CachedReference.callables.extensions.hasOwnProperty(thisExtName)
                                ) {
                                    const thisExt = this.projectCache.CachedReference.callables.extensions[thisExtName];
                                    this.reference.extensionAddExtension(
                                        thisExtName,
github iamcco / vim-language-server / src / server / parser.ts View on Github external
if (!scanProcess) {
    startIndex();
  }
  if (config.indexes.runtimepath) {
    const list: string[] = [].concat(paths);

    for (let p of list) {
      if (!p) {
        continue;
      }
      p = p.trim();
      if (!p || p === "/") {
        continue;
      }
      scanProcess.send({
        uri: vscUri.file(join(p, "f")).toString(),
      });
    }
  }
}
github eclipse-theia / theia / packages / plugin-ext / src / plugin / workspace.ts View on Github external
function dirname(resource: URI): URI {
            if (resource.scheme === 'file') {
                return URI.file(paths.dirname(resource.fsPath));
            }
            return resource.with({
                path: paths.dirname(resource.path)
            });
        }
github GameMakerDiscord / gml-tools-langserver / src / startAndShutdown.ts View on Github external
private async documentCreateDocumentFolder(
        path: string,
        name: string,
        type: BasicResourceType,
        eventEntry?: EventInfo
    ) {
        let uri = URI.file(path).toString();

        const thisDocFolder: DocumentFolder = {
            name: name,
            type: type,
            fileFullText: '',
            diagnosticHandler: null
        };

        if (eventEntry) {
            thisDocFolder.eventInfo = eventEntry;
        }

        this.documents[uri] = thisDocFolder;
    }
github forcedotcom / lightning-language-server / packages / aura-language-server / src / aura-indexer / indexer.ts View on Github external
private getTagInfo(file: string, sfdxProject: boolean, contents: string, node: Node): TagInfo {
        if (!node) {
            return;
        }
        const attributes = node.attributes || {};
        const documentation = this.trimQuotes(attributes.description);

        const startColumn = new LineColumnFinder(contents).fromIndex(node.start);
        const endColumn = new LineColumnFinder(contents).fromIndex(node.end - 1);

        const location: Location = {
            uri: URI.file(file).toString(),
            range: {
                start: {
                    line: startColumn.line,
                    character: startColumn.col,
                },
                end: {
                    line: endColumn.line,
                    character: endColumn.col,
                },
            },
        };
        const name = componentUtil.componentFromFile(file, sfdxProject);
        const info = new TagInfo(file, TagType.CUSTOM, false, [], location, documentation, name, 'c');
        return info;
    }
github vuejs / vetur / server / src / modes / script / javascript.ts View on Github external
function createUriMappingForEdits(changes: ts.FileTextChanges[], service: ts.LanguageService) {
  const program = service.getProgram()!;
  const result: Record = {};
  for (const { fileName, textChanges } of changes) {
    const targetDoc = getSourceDoc(fileName, program);
    const edits = textChanges.map(({ newText, span }) => ({
      newText,
      range: convertRange(targetDoc, span)
    }));
    const uri = Uri.file(fileName).toString();
    if (result[uri]) {
      result[uri].push(...edits);
    } else {
      result[uri] = edits;
    }
  }
  return result;
}
github iamcco / vim-language-server / src / common / scan.ts View on Github external
map(res => ({
                      node: res[0],
                      uri: vscUri.file(fpath).toString()
                    })),
                    catchError(error => {
github Polymer / polymer-analyzer / src / url-loader / package-url-resolver.ts View on Github external
private filesystemPathForPathname(decodedPathname: string) {
    return normalizeFsPath(Uri.file(decodedPathname).fsPath);
  }
}