Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 [];
}
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
);
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,
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(),
});
}
}
}
function dirname(resource: URI): URI {
if (resource.scheme === 'file') {
return URI.file(paths.dirname(resource.fsPath));
}
return resource.with({
path: paths.dirname(resource.path)
});
}
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;
}
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;
}
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;
}
map(res => ({
node: res[0],
uri: vscUri.file(fpath).toString()
})),
catchError(error => {
private filesystemPathForPathname(decodedPathname: string) {
return normalizeFsPath(Uri.file(decodedPathname).fsPath);
}
}