Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (() => {
try {
config.ensureAllFiles(span);
const program = config.getProgram(span);
if (!program) {
return Observable.empty();
}
if (query) {
let items: Observable<[number, ts.NavigateToItem]>;
if (typeof query === 'string') {
// Query by text query
items = Observable.from(config.getService().getNavigateToItems(query, limit, undefined, false))
// Same score for all
.map(item => [1, item]);
} else {
const queryWithoutPackage = omit(query, 'package') as SymbolDescriptor;
// Query by name
items = Observable.from(config.getService().getNavigateToItems(query.name || '', limit, undefined, false))
// Get a score how good the symbol matches the SymbolDescriptor (ignoring PackageDescriptor)
.map((item): [number, ts.NavigateToItem] => [getMatchScore(queryWithoutPackage, {
kind: item.kind,