本文整理匯總了TypeScript中vscode-languageserver.SymbolInformation.create方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SymbolInformation.create方法的具體用法?TypeScript SymbolInformation.create怎麽用?TypeScript SymbolInformation.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vscode-languageserver.SymbolInformation
的用法示例。
在下文中一共展示了SymbolInformation.create方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: createLineReferenceFromSourceMap
return lodash.flatten(queryResults.map((queryResult) => {
const lineReference = createLineReferenceFromSourceMap(
lodash.get(queryResult, refractSymbol.sourceMapPath, []),
document,
documentLines
);
let results = {};
const description = lodash.get(queryResult, refractSymbol.descriptionPath, '');
const lodashChain =
lodash
.chain(refractSymbol.childs)
.map((child) => {
return extractSymbols(queryResult, document, documentLines, child, description);
})
.flatten()
if (!lodash.isEmpty(lineReference)) {
results = SymbolInformation.create(
description,
refractSymbol.symbol,
Range.create(lineReference.startRow, lineReference.startIndex, lineReference.endRow, lineReference.endIndex),
null,
containerName);
return lodashChain.concat(results).value();
}
return lodashChain.value();
}));
示例2: query
return lodash.transform(queryResults, (result, queryResult) => {
/*
WARNING: This might be your reaction when you'll look into this code: 😱
Thing is there is no really source map here and I do not want to solve this
thing in this release. The long term idea would be to wait till the underlying
parser will be updated to generate sourcemaps on generated content as well
and everybody will be happy; till that moment, please bear with me.
*/
let sourceMap;
['meta.title.attributes.sourceMap',
'attributes.href.attributes.sourceMap',
(qs) => query(qs, [{ query: { attributes: { method: {} } }, symbolKind: 0 }]),
].some((path: string | Function): boolean => {
if (typeof (path) === 'function') {
sourceMap = lodash.get((path as Function)(queryResult)[0], 'attributes.method.attributes.sourceMap');
return true;
} else {
if (lodash.has(queryResult, path)) {
sourceMap = lodash.get(queryResult, path);
return true;
}
}
});
const lineReference = createLineReferenceFromSourceMap(
sourceMap,
document,
documentLines,
);
let description = '';
['meta.title.content',
'attributes.href.content',
(qs) => query(qs, [{ query: { attributes: { method: {} } }, symbolKind: 0 }]),
].some((path: string | Function): boolean => {
if (typeof (path) === 'function') {
description = decodeURI(lodash.get((path as Function)(queryResult)[0], 'attributes.method.content'));
return true;
} else {
if (lodash.has(queryResult, path)) {
description = decodeURI(lodash.get(queryResult, path));
return true;
}
}
});
if (!lodash.isEmpty(lineReference)) {
result.push(SymbolInformation.create(
description,
queryResult.symbolKind,
Range.create(
lineReference.startRow,
lineReference.startIndex,
lineReference.endRow,
lineReference.endIndex,
),
null,
queryResult.container));
}
});
示例3:
let res = externals.map(external => {
return SymbolInformation.create(external.name, util.formEmptyKind(), util.formEmptyRange(), util.formExternalUri(external));
});