@zzzen/pyright-internal 1.2.0-dev.20230507 → 1.2.0-dev.20230521
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer/analyzerFileInfo.d.ts +1 -0
- package/dist/analyzer/analyzerFileInfo.js +4 -3
- package/dist/analyzer/analyzerFileInfo.js.map +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.d.ts +17 -15
- package/dist/analyzer/backgroundAnalysisProgram.js +43 -53
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.d.ts +0 -2
- package/dist/analyzer/binder.js +2 -20
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.d.ts +1 -1
- package/dist/analyzer/checker.js +97 -29
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +14 -15
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/constructorTransform.js +5 -1
- package/dist/analyzer/constructorTransform.js.map +1 -1
- package/dist/analyzer/constructors.js +248 -189
- package/dist/analyzer/constructors.js.map +1 -1
- package/dist/analyzer/dataClasses.js +5 -2
- package/dist/analyzer/dataClasses.js.map +1 -1
- package/dist/analyzer/declarationUtils.js +1 -0
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/docStringConversion.js +1 -1
- package/dist/analyzer/docStringConversion.js.map +1 -1
- package/dist/analyzer/enums.js +8 -0
- package/dist/analyzer/enums.js.map +1 -1
- package/dist/analyzer/importResolver.d.ts +4 -4
- package/dist/analyzer/importResolver.js +93 -69
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/importResult.d.ts +2 -2
- package/dist/analyzer/importStatementUtils.js +2 -2
- package/dist/analyzer/importStatementUtils.js.map +1 -1
- package/dist/analyzer/namedTuples.js +2 -5
- package/dist/analyzer/namedTuples.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +1 -1
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.js +2 -34
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/parseTreeWalker.js +2 -2
- package/dist/analyzer/parseTreeWalker.js.map +1 -1
- package/dist/analyzer/patternMatching.js +1 -0
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +18 -34
- package/dist/analyzer/program.js +57 -259
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/protocols.js +4 -2
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/service.d.ts +8 -16
- package/dist/analyzer/service.js +33 -47
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.d.ts +1 -15
- package/dist/analyzer/sourceFile.js +14 -96
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/sourceMapper.js +1 -1
- package/dist/analyzer/sourceMapper.js.map +1 -1
- package/dist/analyzer/symbol.d.ts +3 -1
- package/dist/analyzer/symbol.js +5 -0
- package/dist/analyzer/symbol.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.js +1 -1
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.d.ts +2 -2
- package/dist/analyzer/typeEvaluator.js +495 -196
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +7 -2
- package/dist/analyzer/typeEvaluatorTypes.js.map +1 -1
- package/dist/analyzer/typeGuards.js +1 -0
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typePrinter.d.ts +3 -3
- package/dist/analyzer/typePrinter.js +255 -101
- package/dist/analyzer/typePrinter.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +12 -7
- package/dist/analyzer/typeUtils.js +174 -49
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typeVarContext.d.ts +1 -2
- package/dist/analyzer/typeVarContext.js +16 -34
- package/dist/analyzer/typeVarContext.js.map +1 -1
- package/dist/analyzer/typedDicts.js +138 -41
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +10 -3
- package/dist/analyzer/types.js +32 -16
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysisBase.d.ts +25 -19
- package/dist/backgroundAnalysisBase.js +161 -115
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/backgroundThreadBase.d.ts +1 -1
- package/dist/backgroundThreadBase.js +1 -1
- package/dist/backgroundThreadBase.js.map +1 -1
- package/dist/commands/dumpFileDebugInfoCommand.js +3 -4
- package/dist/commands/dumpFileDebugInfoCommand.js.map +1 -1
- package/dist/common/configOptions.js +1 -1
- package/dist/common/configOptions.js.map +1 -1
- package/dist/common/extensibility.d.ts +26 -5
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/logTracker.d.ts +2 -0
- package/dist/common/logTracker.js +8 -1
- package/dist/common/logTracker.js.map +1 -1
- package/dist/common/lspUtils.d.ts +4 -1
- package/dist/common/lspUtils.js +38 -1
- package/dist/common/lspUtils.js.map +1 -1
- package/dist/common/pythonVersion.d.ts +2 -1
- package/dist/common/pythonVersion.js +1 -0
- package/dist/common/pythonVersion.js.map +1 -1
- package/dist/common/textRange.js +1 -1
- package/dist/common/textRange.js.map +1 -1
- package/dist/common/workspaceEditUtils.d.ts +3 -3
- package/dist/common/workspaceEditUtils.js +15 -17
- package/dist/common/workspaceEditUtils.js.map +1 -1
- package/dist/languageServerBase.d.ts +2 -5
- package/dist/languageServerBase.js +35 -62
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/autoImporter.d.ts +51 -52
- package/dist/languageService/autoImporter.js +126 -211
- package/dist/languageService/autoImporter.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.js +8 -33
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/completionProvider.d.ts +42 -81
- package/dist/languageService/completionProvider.js +608 -841
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/documentSymbolCollector.d.ts +2 -2
- package/dist/languageService/documentSymbolCollector.js +40 -30
- package/dist/languageService/documentSymbolCollector.js.map +1 -1
- package/dist/languageService/documentSymbolProvider.d.ts +13 -35
- package/dist/languageService/documentSymbolProvider.js +52 -264
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.d.ts +1 -3
- package/dist/languageService/hoverProvider.js +11 -97
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/referencesProvider.d.ts +3 -3
- package/dist/languageService/referencesProvider.js +6 -8
- package/dist/languageService/referencesProvider.js.map +1 -1
- package/dist/languageService/renameProvider.d.ts +0 -1
- package/dist/languageService/renameProvider.js +2 -6
- package/dist/languageService/renameProvider.js.map +1 -1
- package/dist/languageService/signatureHelpProvider.js +1 -1
- package/dist/languageService/signatureHelpProvider.js.map +1 -1
- package/dist/languageService/symbolIndexer.d.ts +23 -0
- package/dist/languageService/symbolIndexer.js +105 -0
- package/dist/languageService/symbolIndexer.js.map +1 -0
- package/dist/languageService/tooltipUtils.d.ts +8 -1
- package/dist/languageService/tooltipUtils.js +102 -1
- package/dist/languageService/tooltipUtils.js.map +1 -1
- package/dist/languageService/workspaceSymbolProvider.d.ts +17 -0
- package/dist/languageService/workspaceSymbolProvider.js +133 -0
- package/dist/languageService/workspaceSymbolProvider.js.map +1 -0
- package/dist/localization/localize.d.ts +38 -4
- package/dist/localization/localize.js +21 -4
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.en-us.json +23 -6
- package/dist/parser/parseNodes.d.ts +8 -8
- package/dist/parser/parseNodes.js +20 -10
- package/dist/parser/parseNodes.js.map +1 -1
- package/dist/parser/parser.d.ts +3 -3
- package/dist/parser/parser.js +136 -159
- package/dist/parser/parser.js.map +1 -1
- package/dist/parser/stringTokenUtils.d.ts +3 -13
- package/dist/parser/stringTokenUtils.js +8 -181
- package/dist/parser/stringTokenUtils.js.map +1 -1
- package/dist/parser/tokenizer.d.ts +3 -0
- package/dist/parser/tokenizer.js +211 -24
- package/dist/parser/tokenizer.js.map +1 -1
- package/dist/parser/tokenizerTypes.d.ts +31 -1
- package/dist/parser/tokenizerTypes.js +51 -1
- package/dist/parser/tokenizerTypes.js.map +1 -1
- package/dist/pyright.js +26 -4
- package/dist/pyright.js.map +1 -1
- package/dist/readonlyAugmentedFileSystem.js +1 -1
- package/dist/readonlyAugmentedFileSystem.js.map +1 -1
- package/dist/tests/chainedSourceFiles.test.js +15 -20
- package/dist/tests/chainedSourceFiles.test.js.map +1 -1
- package/dist/tests/checker.test.js +14 -0
- package/dist/tests/checker.test.js.map +1 -1
- package/dist/tests/completions.test.js +11 -236
- package/dist/tests/completions.test.js.map +1 -1
- package/dist/tests/docStringConversion.test.js +36 -2
- package/dist/tests/docStringConversion.test.js.map +1 -1
- package/dist/tests/fourslash/completions.override2.fourslash.js +1 -16
- package/dist/tests/fourslash/completions.override2.fourslash.js.map +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.js +1 -1
- package/dist/tests/harness/fourslash/testLanguageService.js.map +1 -1
- package/dist/tests/harness/fourslash/testState.d.ts +14 -8
- package/dist/tests/harness/fourslash/testState.js +27 -37
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/importResolver.test.js +84 -4
- package/dist/tests/importResolver.test.js.map +1 -1
- package/dist/tests/textRange.test.js +45 -0
- package/dist/tests/textRange.test.js.map +1 -0
- package/dist/tests/tokenizer.test.js +272 -58
- package/dist/tests/tokenizer.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +16 -0
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +14 -0
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +7 -2
- package/dist/tests/typeEvaluator4.test.js.map +1 -1
- package/dist/tests/typeEvaluator5.test.js +29 -9
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/workspaceEditUtils.test.js +15 -10
- package/dist/tests/workspaceEditUtils.test.js.map +1 -1
- package/dist/workspaceFactory.js +3 -5
- package/dist/workspaceFactory.js.map +1 -1
- package/package.json +1 -1
- package/dist/languageService/importAdder.d.ts +0 -40
- package/dist/languageService/importAdder.js +0 -388
- package/dist/languageService/importAdder.js.map +0 -1
- package/dist/tests/fourslash/completions.commitChars.fourslash.d.ts +0 -1
- package/dist/tests/fourslash/completions.commitChars.fourslash.js +0 -81
- package/dist/tests/fourslash/completions.commitChars.fourslash.js.map +0 -1
- package/dist/tests/importAdder.test.js +0 -1325
- package/dist/tests/importAdder.test.js.map +0 -1
- /package/dist/tests/{importAdder.test.d.ts → textRange.test.d.ts} +0 -0
@@ -1,17 +1,14 @@
|
|
1
1
|
import { CancellationToken, CompletionItemKind, SymbolKind } from 'vscode-languageserver';
|
2
|
-
import { ImportResolver } from '../analyzer/importResolver';
|
3
|
-
import {
|
2
|
+
import { ImportResolver, ModuleNameAndType } from '../analyzer/importResolver';
|
3
|
+
import { ImportGroup } from '../analyzer/importStatementUtils';
|
4
4
|
import { Symbol } from '../analyzer/symbol';
|
5
5
|
import { ExecutionEnvironment } from '../common/configOptions';
|
6
6
|
import { TextEditAction } from '../common/editAction';
|
7
7
|
import { Position } from '../common/textRange';
|
8
8
|
import { ParseResults } from '../parser/parser';
|
9
9
|
import { CompletionMap } from './completionProvider';
|
10
|
-
import {
|
11
|
-
|
12
|
-
Absolute = "absolute",
|
13
|
-
Relative = "relative"
|
14
|
-
}
|
10
|
+
import { SourceFileInfo } from '../common/extensibility';
|
11
|
+
import { IndexAliasData } from './symbolIndexer';
|
15
12
|
export interface AutoImportSymbol {
|
16
13
|
readonly importAlias?: IndexAliasData;
|
17
14
|
readonly symbol?: Symbol;
|
@@ -22,59 +19,62 @@ export interface ModuleSymbolTable {
|
|
22
19
|
forEach(callbackfn: (symbol: AutoImportSymbol, name: string, library: boolean) => void): void;
|
23
20
|
}
|
24
21
|
export declare type ModuleSymbolMap = Map<string, ModuleSymbolTable>;
|
25
|
-
export interface AbbreviationInfo {
|
26
|
-
importFrom?: string;
|
27
|
-
importName: string;
|
28
|
-
}
|
29
22
|
export interface AutoImportResult {
|
30
|
-
name: string;
|
31
|
-
symbol?: Symbol;
|
32
|
-
source?: string;
|
33
|
-
insertionText: string;
|
34
|
-
edits?: TextEditAction[];
|
35
|
-
alias?: string;
|
36
|
-
kind?: CompletionItemKind;
|
23
|
+
readonly name: string;
|
24
|
+
readonly symbol?: Symbol;
|
25
|
+
readonly source?: string;
|
26
|
+
readonly insertionText: string;
|
27
|
+
readonly edits?: TextEditAction[];
|
28
|
+
readonly alias?: string;
|
29
|
+
readonly kind?: CompletionItemKind;
|
37
30
|
}
|
38
31
|
export interface AutoImportOptions {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
readonly patternMatcher?: (pattern: string, name: string) => boolean;
|
33
|
+
readonly allowVariableInAll?: boolean;
|
34
|
+
readonly lazyEdit?: boolean;
|
35
|
+
}
|
36
|
+
export interface ImportParts {
|
37
|
+
readonly importName: string;
|
38
|
+
readonly symbolName?: string;
|
39
|
+
readonly importFrom?: string;
|
40
|
+
readonly filePath: string;
|
41
|
+
readonly dotCount: number;
|
42
|
+
readonly moduleNameAndType: ModuleNameAndType;
|
43
|
+
}
|
44
|
+
export interface ImportAliasData {
|
45
|
+
readonly importParts: ImportParts;
|
46
|
+
readonly importGroup: ImportGroup;
|
47
|
+
readonly symbol?: Symbol;
|
48
|
+
readonly kind?: SymbolKind;
|
49
|
+
readonly itemKind?: CompletionItemKind;
|
44
50
|
}
|
45
|
-
export declare
|
51
|
+
export declare type AutoImportResultMap = Map<string, AutoImportResult[]>;
|
52
|
+
export declare function buildModuleSymbolsMap(files: readonly SourceFileInfo[]): ModuleSymbolMap;
|
53
|
+
export declare function addModuleSymbolsMap(files: readonly SourceFileInfo[], moduleSymbolMap: ModuleSymbolMap): void;
|
46
54
|
export declare class AutoImporter {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
private _invocationPosition;
|
55
|
+
protected readonly execEnvironment: ExecutionEnvironment;
|
56
|
+
protected readonly importResolver: ImportResolver;
|
57
|
+
protected readonly parseResults: ParseResults;
|
58
|
+
private readonly _invocationPosition;
|
51
59
|
private readonly _excludes;
|
52
|
-
|
53
|
-
|
54
|
-
private readonly _filePath;
|
60
|
+
protected readonly moduleSymbolMap: ModuleSymbolMap;
|
61
|
+
protected readonly options: AutoImportOptions;
|
55
62
|
private readonly _importStatements;
|
56
|
-
|
57
|
-
private readonly _perfInfo;
|
58
|
-
constructor(_execEnvironment: ExecutionEnvironment, _importResolver: ImportResolver, _parseResults: ParseResults, _invocationPosition: Position, _excludes: CompletionMap, _moduleSymbolMap: ModuleSymbolMap, _options: AutoImportOptions);
|
59
|
-
getAutoImportCandidatesForAbbr(abbr: string | undefined, abbrInfo: AbbreviationInfo, token: CancellationToken): AutoImportResult[];
|
63
|
+
constructor(execEnvironment: ExecutionEnvironment, importResolver: ImportResolver, parseResults: ParseResults, _invocationPosition: Position, _excludes: CompletionMap, moduleSymbolMap: ModuleSymbolMap, options: AutoImportOptions);
|
60
64
|
getAutoImportCandidates(word: string, similarityLimit: number, abbrFromUsers: string | undefined, token: CancellationToken): AutoImportResult[];
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
protected getCandidates(word: string, similarityLimit: number, abbrFromUsers: string | undefined, token: CancellationToken): Map<string, AutoImportResult[]>;
|
66
|
+
protected addImportsFromModuleMap(word: string, similarityLimit: number, abbrFromUsers: string | undefined, aliasMap: Map<string, Map<string, ImportAliasData>>, results: AutoImportResultMap, token: CancellationToken): void;
|
67
|
+
protected addImportsFromImportAliasMap(importAliasMap: Map<string, Map<string, ImportAliasData>>, abbrFromUsers: string | undefined, results: AutoImportResultMap, token: CancellationToken): void;
|
68
|
+
protected processModuleSymbolTable(topLevelSymbols: ModuleSymbolTable, moduleFilePath: string, word: string, similarityLimit: number, isStubOrHasInit: {
|
69
|
+
isStub: boolean;
|
70
|
+
hasInit: boolean;
|
71
|
+
}, abbrFromUsers: string | undefined, importAliasMap: Map<string, Map<string, ImportAliasData>>, results: AutoImportResultMap, token: CancellationToken): void;
|
72
|
+
protected getNameForImportFrom(library: boolean, moduleFilePath: string): string | undefined;
|
73
|
+
protected isStubFileOrHasInit<T>(map: Map<string, T>, filePath: string): {
|
74
|
+
isStub: boolean;
|
75
|
+
hasInit: boolean;
|
70
76
|
};
|
71
|
-
private _getCandidates;
|
72
|
-
private _addImportsFromLibraryMap;
|
73
|
-
private _addImportsFromModuleMap;
|
74
|
-
private _isStubFileOrHasInit;
|
75
|
-
private _processModuleSymbolTable;
|
76
77
|
private _shouldIncludeVariable;
|
77
|
-
private _addImportsFromImportAliasMap;
|
78
78
|
private _addToImportAliasMap;
|
79
79
|
private _compareImportAliasData;
|
80
80
|
private _getImportPartsForSymbols;
|
@@ -84,7 +84,6 @@ export declare class AutoImporter {
|
|
84
84
|
private _containsName;
|
85
85
|
private _getModuleNameAndTypeFromFilePath;
|
86
86
|
private _getTextEditsForAutoImportByFilePath;
|
87
|
-
private _perfIndexCount;
|
88
87
|
private _addResult;
|
89
88
|
}
|
90
|
-
export declare function convertSymbolKindToCompletionItemKind(kind: SymbolKind | undefined): 2 | 22 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 17 | 19 | 20 | 21 |
|
89
|
+
export declare function convertSymbolKindToCompletionItemKind(kind: SymbolKind | undefined): 2 | 22 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 17 | 19 | 20 | 21 | 24 | 23 | 25 | undefined;
|
@@ -26,9 +26,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
26
|
return result;
|
27
27
|
};
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
29
|
-
exports.convertSymbolKindToCompletionItemKind = exports.AutoImporter = exports.
|
29
|
+
exports.convertSymbolKindToCompletionItemKind = exports.AutoImporter = exports.addModuleSymbolsMap = exports.buildModuleSymbolsMap = void 0;
|
30
30
|
const vscode_languageserver_1 = require("vscode-languageserver");
|
31
|
-
const analyzerNodeInfo_1 = require("../analyzer/analyzerNodeInfo");
|
32
31
|
const importStatementUtils_1 = require("../analyzer/importStatementUtils");
|
33
32
|
const sourceFileInfoUtils_1 = require("../analyzer/sourceFileInfoUtils");
|
34
33
|
const SymbolNameUtils = __importStar(require("../analyzer/symbolNameUtils"));
|
@@ -37,18 +36,16 @@ const cancellationUtils_1 = require("../common/cancellationUtils");
|
|
37
36
|
const collectionUtils_1 = require("../common/collectionUtils");
|
38
37
|
const pathUtils_1 = require("../common/pathUtils");
|
39
38
|
const StringUtils = __importStar(require("../common/stringUtils"));
|
40
|
-
const timing_1 = require("../common/timing");
|
41
39
|
const completionProvider_1 = require("./completionProvider");
|
42
|
-
var ImportFormat;
|
43
|
-
(function (ImportFormat) {
|
44
|
-
ImportFormat["Absolute"] = "absolute";
|
45
|
-
ImportFormat["Relative"] = "relative";
|
46
|
-
})(ImportFormat = exports.ImportFormat || (exports.ImportFormat = {}));
|
47
40
|
// Build a map of all modules within this program and the module-
|
48
41
|
// level scope that contains the symbol table for the module.
|
49
|
-
function buildModuleSymbolsMap(files
|
50
|
-
const
|
51
|
-
(
|
42
|
+
function buildModuleSymbolsMap(files) {
|
43
|
+
const map = new Map();
|
44
|
+
addModuleSymbolsMap(files, map);
|
45
|
+
return map;
|
46
|
+
}
|
47
|
+
exports.buildModuleSymbolsMap = buildModuleSymbolsMap;
|
48
|
+
function addModuleSymbolsMap(files, moduleSymbolMap) {
|
52
49
|
files.forEach((file) => {
|
53
50
|
if (file.shadows.length > 0) {
|
54
51
|
// There is corresponding stub file. Don't add
|
@@ -57,140 +54,126 @@ function buildModuleSymbolsMap(files, includeSymbolsFromIndices, token) {
|
|
57
54
|
}
|
58
55
|
const filePath = file.sourceFile.getFilePath();
|
59
56
|
const symbolTable = file.sourceFile.getModuleSymbolTable();
|
60
|
-
if (symbolTable) {
|
61
|
-
const fileName = (0, pathUtils_1.stripFileExtension)((0, pathUtils_1.getFileName)(filePath));
|
62
|
-
// Don't offer imports from files that are named with private
|
63
|
-
// naming semantics like "_ast.py".
|
64
|
-
if (SymbolNameUtils.isPrivateOrProtectedName(fileName)) {
|
65
|
-
return;
|
66
|
-
}
|
67
|
-
moduleSymbolMap.set(filePath, {
|
68
|
-
forEach(callbackfn) {
|
69
|
-
symbolTable.forEach((symbol, name) => {
|
70
|
-
if (!(0, symbolUtils_1.isVisibleExternally)(symbol)) {
|
71
|
-
return;
|
72
|
-
}
|
73
|
-
const declarations = symbol.getDeclarations();
|
74
|
-
if (!declarations || declarations.length === 0) {
|
75
|
-
return;
|
76
|
-
}
|
77
|
-
const declaration = declarations[0];
|
78
|
-
if (!declaration) {
|
79
|
-
return;
|
80
|
-
}
|
81
|
-
if (declaration.type === 8 /* Alias */ && (0, sourceFileInfoUtils_1.isUserCode)(file)) {
|
82
|
-
// We don't include import alias in auto import
|
83
|
-
// for workspace files.
|
84
|
-
return;
|
85
|
-
}
|
86
|
-
const variableKind = declaration.type === 1 /* Variable */ &&
|
87
|
-
!declaration.isConstant &&
|
88
|
-
!declaration.isFinal
|
89
|
-
? vscode_languageserver_1.SymbolKind.Variable
|
90
|
-
: undefined;
|
91
|
-
callbackfn({ symbol, kind: variableKind }, name, /* library */ !(0, sourceFileInfoUtils_1.isUserCode)(file));
|
92
|
-
});
|
93
|
-
},
|
94
|
-
});
|
57
|
+
if (!symbolTable) {
|
95
58
|
return;
|
96
59
|
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
60
|
+
const fileName = (0, pathUtils_1.stripFileExtension)((0, pathUtils_1.getFileName)(filePath));
|
61
|
+
// Don't offer imports from files that are named with private
|
62
|
+
// naming semantics like "_ast.py".
|
63
|
+
if (SymbolNameUtils.isPrivateOrProtectedName(fileName)) {
|
101
64
|
return;
|
102
65
|
}
|
66
|
+
moduleSymbolMap.set(filePath, {
|
67
|
+
forEach(callbackfn) {
|
68
|
+
symbolTable.forEach((symbol, name) => {
|
69
|
+
if (!(0, symbolUtils_1.isVisibleExternally)(symbol)) {
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
const declarations = symbol.getDeclarations();
|
73
|
+
if (!declarations || declarations.length === 0) {
|
74
|
+
return;
|
75
|
+
}
|
76
|
+
const declaration = declarations[0];
|
77
|
+
if (!declaration) {
|
78
|
+
return;
|
79
|
+
}
|
80
|
+
if (declaration.type === 8 /* Alias */ && (0, sourceFileInfoUtils_1.isUserCode)(file)) {
|
81
|
+
// We don't include import alias in auto import
|
82
|
+
// for workspace files.
|
83
|
+
return;
|
84
|
+
}
|
85
|
+
const variableKind = declaration.type === 1 /* Variable */ && !declaration.isConstant && !declaration.isFinal
|
86
|
+
? vscode_languageserver_1.SymbolKind.Variable
|
87
|
+
: undefined;
|
88
|
+
callbackfn({ symbol, kind: variableKind }, name, /* library */ !(0, sourceFileInfoUtils_1.isUserCode)(file));
|
89
|
+
});
|
90
|
+
},
|
91
|
+
});
|
92
|
+
return;
|
103
93
|
});
|
104
|
-
return moduleSymbolMap;
|
105
94
|
}
|
106
|
-
exports.
|
95
|
+
exports.addModuleSymbolsMap = addModuleSymbolsMap;
|
107
96
|
class AutoImporter {
|
108
|
-
constructor(
|
109
|
-
this.
|
110
|
-
this.
|
111
|
-
this.
|
97
|
+
constructor(execEnvironment, importResolver, parseResults, _invocationPosition, _excludes, moduleSymbolMap, options) {
|
98
|
+
this.execEnvironment = execEnvironment;
|
99
|
+
this.importResolver = importResolver;
|
100
|
+
this.parseResults = parseResults;
|
112
101
|
this._invocationPosition = _invocationPosition;
|
113
102
|
this._excludes = _excludes;
|
114
|
-
this.
|
115
|
-
this.
|
116
|
-
|
117
|
-
this._stopWatch = new timing_1.Duration();
|
118
|
-
this._perfInfo = {
|
119
|
-
indexUsed: false,
|
120
|
-
totalInMs: 0,
|
121
|
-
moduleTimeInMS: 0,
|
122
|
-
indexTimeInMS: 0,
|
123
|
-
importAliasTimeInMS: 0,
|
124
|
-
symbolCount: 0,
|
125
|
-
indexCount: 0,
|
126
|
-
importAliasCount: 0,
|
127
|
-
};
|
128
|
-
this._filePath = (0, analyzerNodeInfo_1.getFileInfo)(_parseResults.parseTree).filePath;
|
129
|
-
this._importStatements = (0, importStatementUtils_1.getTopLevelImports)(this._parseResults.parseTree, /* includeImplicitImports */ true);
|
130
|
-
this._perfInfo.indexUsed = !!this._options.libraryMap;
|
131
|
-
}
|
132
|
-
getAutoImportCandidatesForAbbr(abbr, abbrInfo, token) {
|
133
|
-
const map = this._getCandidates(abbrInfo.importName, /* similarityLimit */ 1, abbr, token);
|
134
|
-
const result = map.get(abbrInfo.importName);
|
135
|
-
if (!result) {
|
136
|
-
return [];
|
137
|
-
}
|
138
|
-
return result.filter((r) => r.source === abbrInfo.importFrom);
|
103
|
+
this.moduleSymbolMap = moduleSymbolMap;
|
104
|
+
this.options = options;
|
105
|
+
this._importStatements = (0, importStatementUtils_1.getTopLevelImports)(this.parseResults.parseTree, /* includeImplicitImports */ true);
|
139
106
|
}
|
140
107
|
getAutoImportCandidates(word, similarityLimit, abbrFromUsers, token) {
|
141
108
|
const results = [];
|
142
|
-
const map = this.
|
109
|
+
const map = this.getCandidates(word, similarityLimit, abbrFromUsers, token);
|
143
110
|
map.forEach((v) => (0, collectionUtils_1.appendArray)(results, v));
|
144
111
|
return results;
|
145
112
|
}
|
146
|
-
|
147
|
-
this._perfInfo.totalInMs = this._stopWatch.getDurationInMilliseconds();
|
148
|
-
return this._perfInfo;
|
149
|
-
}
|
150
|
-
_getCandidates(word, similarityLimit, abbrFromUsers, token) {
|
113
|
+
getCandidates(word, similarityLimit, abbrFromUsers, token) {
|
151
114
|
const resultMap = new Map();
|
152
115
|
const importAliasMap = new Map();
|
153
|
-
this.
|
154
|
-
this.
|
155
|
-
this._addImportsFromImportAliasMap(importAliasMap, abbrFromUsers, resultMap, token);
|
116
|
+
this.addImportsFromModuleMap(word, similarityLimit, abbrFromUsers, importAliasMap, resultMap, token);
|
117
|
+
this.addImportsFromImportAliasMap(importAliasMap, abbrFromUsers, resultMap, token);
|
156
118
|
return resultMap;
|
157
119
|
}
|
158
|
-
|
159
|
-
|
160
|
-
const startTime = this._stopWatch.getDurationInMilliseconds();
|
161
|
-
(_a = this._options.libraryMap) === null || _a === void 0 ? void 0 : _a.forEach((indexResults, filePath) => {
|
162
|
-
if (indexResults.privateOrProtected) {
|
163
|
-
return;
|
164
|
-
}
|
165
|
-
if (this._moduleSymbolMap.has(filePath)) {
|
166
|
-
// Module map is already taking care of this file. this can happen if the module is used by
|
167
|
-
// user code.
|
168
|
-
return;
|
169
|
-
}
|
120
|
+
addImportsFromModuleMap(word, similarityLimit, abbrFromUsers, aliasMap, results, token) {
|
121
|
+
this.moduleSymbolMap.forEach((topLevelSymbols, filePath) => {
|
170
122
|
// See if this file should be offered as an implicit import.
|
171
|
-
const isStubFileOrHasInit = this.
|
172
|
-
this.
|
123
|
+
const isStubFileOrHasInit = this.isStubFileOrHasInit(this.moduleSymbolMap, filePath);
|
124
|
+
this.processModuleSymbolTable(topLevelSymbols, filePath, word, similarityLimit, isStubFileOrHasInit, abbrFromUsers, aliasMap, results, token);
|
173
125
|
});
|
174
|
-
this._perfInfo.indexTimeInMS = this._stopWatch.getDurationInMilliseconds() - startTime;
|
175
126
|
}
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
127
|
+
addImportsFromImportAliasMap(importAliasMap, abbrFromUsers, results, token) {
|
128
|
+
(0, cancellationUtils_1.throwIfCancellationRequested)(token);
|
129
|
+
importAliasMap.forEach((mapPerSymbolName) => {
|
130
|
+
mapPerSymbolName.forEach((importAliasData) => {
|
131
|
+
var _a, _b;
|
132
|
+
if (abbrFromUsers) {
|
133
|
+
// When alias name is used, our regular exclude mechanism would not work. we need to check
|
134
|
+
// whether import, the alias is referring to, already exists.
|
135
|
+
// ex) import numpy
|
136
|
+
// np| <= auto-import here.
|
137
|
+
// or
|
138
|
+
// from scipy import io as spio
|
139
|
+
// io| <= auto-import here
|
140
|
+
// If import statement for the module already exist, then bail out.
|
141
|
+
// ex) import module[.submodule] or from module[.submodule] import symbol
|
142
|
+
if (this._importStatements.mapByFilePath.has(importAliasData.importParts.filePath)) {
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
// If it is the module itself that got imported, make sure we don't import it again.
|
146
|
+
// ex) from module import submodule as ss
|
147
|
+
// submodule <= auto-import here
|
148
|
+
if (importAliasData.importParts.importFrom) {
|
149
|
+
const imported = this._importStatements.orderedImports.find((i) => i.moduleName === importAliasData.importParts.importFrom);
|
150
|
+
if (imported &&
|
151
|
+
imported.node.nodeType === 22 /* ImportFrom */ &&
|
152
|
+
imported.node.imports.some((i) => i.name.value === importAliasData.importParts.symbolName)) {
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
}
|
157
|
+
const alreadyIncluded = this._containsName(importAliasData.importParts.importName, importAliasData.importParts.importFrom, results);
|
158
|
+
if (alreadyIncluded) {
|
159
|
+
return;
|
160
|
+
}
|
161
|
+
const autoImportTextEdits = this._getTextEditsForAutoImportByFilePath({ name: importAliasData.importParts.symbolName, alias: abbrFromUsers }, {
|
162
|
+
name: (_a = importAliasData.importParts.importFrom) !== null && _a !== void 0 ? _a : importAliasData.importParts.importName,
|
163
|
+
}, importAliasData.importParts.importName, importAliasData.importGroup, importAliasData.importParts.filePath);
|
164
|
+
this._addResult(results, {
|
165
|
+
name: importAliasData.importParts.importName,
|
166
|
+
alias: abbrFromUsers,
|
167
|
+
symbol: importAliasData.symbol,
|
168
|
+
kind: (_b = importAliasData.itemKind) !== null && _b !== void 0 ? _b : convertSymbolKindToCompletionItemKind(importAliasData.kind),
|
169
|
+
source: importAliasData.importParts.importFrom,
|
170
|
+
insertionText: autoImportTextEdits.insertionText,
|
171
|
+
edits: autoImportTextEdits.edits,
|
172
|
+
});
|
173
|
+
});
|
182
174
|
});
|
183
|
-
this._perfInfo.moduleTimeInMS = this._stopWatch.getDurationInMilliseconds() - startTime;
|
184
175
|
}
|
185
|
-
|
186
|
-
const fileDir = (0, pathUtils_1.getDirectoryPath)(filePath);
|
187
|
-
const initPathPy = (0, pathUtils_1.combinePaths)(fileDir, '__init__.py');
|
188
|
-
const initPathPyi = initPathPy + 'i';
|
189
|
-
const isStub = filePath.endsWith('.pyi');
|
190
|
-
const hasInit = map.has(initPathPy) || map.has(initPathPyi);
|
191
|
-
return { isStub, hasInit };
|
192
|
-
}
|
193
|
-
_processModuleSymbolTable(topLevelSymbols, moduleFilePath, word, similarityLimit, isStubOrHasInit, abbrFromUsers, importAliasMap, results, token) {
|
176
|
+
processModuleSymbolTable(topLevelSymbols, moduleFilePath, word, similarityLimit, isStubOrHasInit, abbrFromUsers, importAliasMap, results, token) {
|
194
177
|
(0, cancellationUtils_1.throwIfCancellationRequested)(token);
|
195
178
|
const [importSource, importGroup, moduleNameAndType] = this._getImportPartsForSymbols(moduleFilePath);
|
196
179
|
if (!importSource) {
|
@@ -199,7 +182,6 @@ class AutoImporter {
|
|
199
182
|
const dotCount = StringUtils.getCharacterCount(importSource, '.');
|
200
183
|
topLevelSymbols.forEach((autoImportSymbol, name, library) => {
|
201
184
|
var _a;
|
202
|
-
this._perfIndexCount(autoImportSymbol, library);
|
203
185
|
if (!this._shouldIncludeVariable(autoImportSymbol, name, isStubOrHasInit.isStub, library)) {
|
204
186
|
return;
|
205
187
|
}
|
@@ -232,9 +214,7 @@ class AutoImporter {
|
|
232
214
|
}, importAliasMap);
|
233
215
|
return;
|
234
216
|
}
|
235
|
-
const nameForImportFrom = this.
|
236
|
-
? (0, importStatementUtils_1.getRelativeModuleName)(this._importResolver.fileSystem, this._filePath, moduleFilePath)
|
237
|
-
: undefined;
|
217
|
+
const nameForImportFrom = this.getNameForImportFrom(library, moduleFilePath);
|
238
218
|
const autoImportTextEdits = this._getTextEditsForAutoImportByFilePath({ name, alias: abbrFromUsers }, { name: importSource, nameForImportFrom }, name, importGroup, moduleFilePath);
|
239
219
|
this._addResult(results, {
|
240
220
|
name,
|
@@ -271,6 +251,17 @@ class AutoImporter {
|
|
271
251
|
itemKind: vscode_languageserver_1.CompletionItemKind.Module,
|
272
252
|
}, { importParts, importGroup, kind: vscode_languageserver_1.SymbolKind.Module, itemKind: vscode_languageserver_1.CompletionItemKind.Module }, importAliasMap);
|
273
253
|
}
|
254
|
+
getNameForImportFrom(library, moduleFilePath) {
|
255
|
+
return undefined;
|
256
|
+
}
|
257
|
+
isStubFileOrHasInit(map, filePath) {
|
258
|
+
const fileDir = (0, pathUtils_1.getDirectoryPath)(filePath);
|
259
|
+
const initPathPy = (0, pathUtils_1.combinePaths)(fileDir, '__init__.py');
|
260
|
+
const initPathPyi = initPathPy + 'i';
|
261
|
+
const isStub = filePath.endsWith('.pyi');
|
262
|
+
const hasInit = map.has(initPathPy) || map.has(initPathPyi);
|
263
|
+
return { isStub, hasInit };
|
264
|
+
}
|
274
265
|
_shouldIncludeVariable(autoImportSymbol, name, isStub, library) {
|
275
266
|
var _a;
|
276
267
|
// If it is not a stub file and symbol is Variable, we only include it if
|
@@ -278,63 +269,11 @@ class AutoImporter {
|
|
278
269
|
if (isStub || autoImportSymbol.kind !== vscode_languageserver_1.SymbolKind.Variable) {
|
279
270
|
return true;
|
280
271
|
}
|
281
|
-
if (this.
|
272
|
+
if (this.options.allowVariableInAll && !library && ((_a = autoImportSymbol.symbol) === null || _a === void 0 ? void 0 : _a.isInDunderAll())) {
|
282
273
|
return true;
|
283
274
|
}
|
284
275
|
return SymbolNameUtils.isPublicConstantOrTypeAlias(name);
|
285
276
|
}
|
286
|
-
_addImportsFromImportAliasMap(importAliasMap, abbrFromUsers, results, token) {
|
287
|
-
(0, cancellationUtils_1.throwIfCancellationRequested)(token);
|
288
|
-
const startTime = this._stopWatch.getDurationInMilliseconds();
|
289
|
-
importAliasMap.forEach((mapPerSymbolName) => {
|
290
|
-
this._perfInfo.importAliasCount += mapPerSymbolName.size;
|
291
|
-
mapPerSymbolName.forEach((importAliasData) => {
|
292
|
-
var _a, _b;
|
293
|
-
if (abbrFromUsers) {
|
294
|
-
// When alias name is used, our regular exclude mechanism would not work. we need to check
|
295
|
-
// whether import, the alias is referring to, already exists.
|
296
|
-
// ex) import numpy
|
297
|
-
// np| <= auto-import here.
|
298
|
-
// or
|
299
|
-
// from scipy import io as spio
|
300
|
-
// io| <= auto-import here
|
301
|
-
// If import statement for the module already exist, then bail out.
|
302
|
-
// ex) import module[.submodule] or from module[.submodule] import symbol
|
303
|
-
if (this._importStatements.mapByFilePath.has(importAliasData.importParts.filePath)) {
|
304
|
-
return;
|
305
|
-
}
|
306
|
-
// If it is the module itself that got imported, make sure we don't import it again.
|
307
|
-
// ex) from module import submodule as ss
|
308
|
-
// submodule <= auto-import here
|
309
|
-
if (importAliasData.importParts.importFrom) {
|
310
|
-
const imported = this._importStatements.orderedImports.find((i) => i.moduleName === importAliasData.importParts.importFrom);
|
311
|
-
if (imported &&
|
312
|
-
imported.node.nodeType === 22 /* ImportFrom */ &&
|
313
|
-
imported.node.imports.some((i) => i.name.value === importAliasData.importParts.symbolName)) {
|
314
|
-
return;
|
315
|
-
}
|
316
|
-
}
|
317
|
-
}
|
318
|
-
const alreadyIncluded = this._containsName(importAliasData.importParts.importName, importAliasData.importParts.importFrom, results);
|
319
|
-
if (alreadyIncluded) {
|
320
|
-
return;
|
321
|
-
}
|
322
|
-
const autoImportTextEdits = this._getTextEditsForAutoImportByFilePath({ name: importAliasData.importParts.symbolName, alias: abbrFromUsers }, {
|
323
|
-
name: (_a = importAliasData.importParts.importFrom) !== null && _a !== void 0 ? _a : importAliasData.importParts.importName,
|
324
|
-
}, importAliasData.importParts.importName, importAliasData.importGroup, importAliasData.importParts.filePath);
|
325
|
-
this._addResult(results, {
|
326
|
-
name: importAliasData.importParts.importName,
|
327
|
-
alias: abbrFromUsers,
|
328
|
-
symbol: importAliasData.symbol,
|
329
|
-
kind: (_b = importAliasData.itemKind) !== null && _b !== void 0 ? _b : convertSymbolKindToCompletionItemKind(importAliasData.kind),
|
330
|
-
source: importAliasData.importParts.importFrom,
|
331
|
-
insertionText: autoImportTextEdits.insertionText,
|
332
|
-
edits: autoImportTextEdits.edits,
|
333
|
-
});
|
334
|
-
});
|
335
|
-
});
|
336
|
-
this._perfInfo.importAliasTimeInMS = this._stopWatch.getDurationInMilliseconds() - startTime;
|
337
|
-
}
|
338
277
|
_addToImportAliasMap(alias, data, importAliasMap) {
|
339
278
|
// Since we don't resolve alias declaration using type evaluator, there is still a chance
|
340
279
|
// where we show multiple aliases for same symbols. but this should still reduce number of
|
@@ -430,14 +369,14 @@ class AutoImporter {
|
|
430
369
|
if (word.length <= 0 || name.length <= 0) {
|
431
370
|
return false;
|
432
371
|
}
|
433
|
-
if (!this.
|
372
|
+
if (!this.options.patternMatcher) {
|
434
373
|
const index = word[0] !== '_' && name[0] === '_' && name.length > 1 ? 1 : 0;
|
435
374
|
if (word[0].toLocaleLowerCase() !== name[index].toLocaleLowerCase()) {
|
436
375
|
return false;
|
437
376
|
}
|
438
377
|
return StringUtils.isPatternInSymbol(word, name);
|
439
378
|
}
|
440
|
-
return this.
|
379
|
+
return this.options.patternMatcher(word, name);
|
441
380
|
}
|
442
381
|
_shouldExclude(name) {
|
443
382
|
return this._excludes.has(name, completionProvider_1.CompletionMap.labelOnlyIgnoringAutoImports);
|
@@ -456,7 +395,7 @@ class AutoImporter {
|
|
456
395
|
// convert to a module name that can be used in an
|
457
396
|
// 'import from' statement.
|
458
397
|
_getModuleNameAndTypeFromFilePath(filePath) {
|
459
|
-
return this.
|
398
|
+
return this.importResolver.getModuleNameForImport(filePath, this.execEnvironment);
|
460
399
|
}
|
461
400
|
_getTextEditsForAutoImportByFilePath(importNameInfo, moduleNameInfo, insertionText, importGroup, filePath) {
|
462
401
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
@@ -506,9 +445,9 @@ class AutoImporter {
|
|
506
445
|
if (moduleNameInfo.name === importStatement.moduleName) {
|
507
446
|
return {
|
508
447
|
insertionText: (_d = importNameInfo.alias) !== null && _d !== void 0 ? _d : insertionText,
|
509
|
-
edits: this.
|
448
|
+
edits: this.options.lazyEdit
|
510
449
|
? undefined
|
511
|
-
: (0, importStatementUtils_1.getTextEditsForAutoImportSymbolAddition)(importNameInfo, importStatement, this.
|
450
|
+
: (0, importStatementUtils_1.getTextEditsForAutoImportSymbolAddition)(importNameInfo, importStatement, this.parseResults),
|
512
451
|
};
|
513
452
|
}
|
514
453
|
}
|
@@ -534,9 +473,9 @@ class AutoImporter {
|
|
534
473
|
// If not, add what we want at the existing import from statement.
|
535
474
|
return {
|
536
475
|
insertionText: (_f = importNameInfo.alias) !== null && _f !== void 0 ? _f : insertionText,
|
537
|
-
edits: this.
|
476
|
+
edits: this.options.lazyEdit
|
538
477
|
? undefined
|
539
|
-
: (0, importStatementUtils_1.getTextEditsForAutoImportSymbolAddition)(importNameInfo, imported, this.
|
478
|
+
: (0, importStatementUtils_1.getTextEditsForAutoImportSymbolAddition)(importNameInfo, imported, this.parseResults),
|
540
479
|
};
|
541
480
|
}
|
542
481
|
}
|
@@ -554,19 +493,11 @@ class AutoImporter {
|
|
554
493
|
}
|
555
494
|
return {
|
556
495
|
insertionText: (_j = importNameInfo.alias) !== null && _j !== void 0 ? _j : insertionText,
|
557
|
-
edits: this.
|
496
|
+
edits: this.options.lazyEdit
|
558
497
|
? undefined
|
559
|
-
: (0, importStatementUtils_1.getTextEditsForAutoImportInsertion)(importNameInfo, moduleNameInfo, this._importStatements, importGroup, this.
|
498
|
+
: (0, importStatementUtils_1.getTextEditsForAutoImportInsertion)(importNameInfo, moduleNameInfo, this._importStatements, importGroup, this.parseResults, this._invocationPosition),
|
560
499
|
};
|
561
500
|
}
|
562
|
-
_perfIndexCount(autoImportSymbol, library) {
|
563
|
-
if (autoImportSymbol.symbol) {
|
564
|
-
this._perfInfo.symbolCount++;
|
565
|
-
}
|
566
|
-
else if (library) {
|
567
|
-
this._perfInfo.indexCount++;
|
568
|
-
}
|
569
|
-
}
|
570
501
|
_addResult(results, result) {
|
571
502
|
let entries = results.get(result.name);
|
572
503
|
if (!entries) {
|
@@ -577,22 +508,6 @@ class AutoImporter {
|
|
577
508
|
}
|
578
509
|
}
|
579
510
|
exports.AutoImporter = AutoImporter;
|
580
|
-
function createModuleSymbolTableFromIndexResult(indexResults, library) {
|
581
|
-
return {
|
582
|
-
forEach(callbackfn) {
|
583
|
-
indexResults.symbols.forEach((data) => {
|
584
|
-
if (!data.externallyVisible) {
|
585
|
-
return;
|
586
|
-
}
|
587
|
-
callbackfn({
|
588
|
-
importAlias: data.alias,
|
589
|
-
kind: data.kind,
|
590
|
-
itemKind: data.itemKind,
|
591
|
-
}, data.name, library);
|
592
|
-
});
|
593
|
-
},
|
594
|
-
};
|
595
|
-
}
|
596
511
|
function convertSymbolKindToCompletionItemKind(kind) {
|
597
512
|
switch (kind) {
|
598
513
|
case vscode_languageserver_1.SymbolKind.File:
|