@zzzen/pyright-internal 1.2.0-dev.20260705 → 1.2.0-dev.20260719
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/checker.d.ts +2 -0
- package/dist/analyzer/checker.js +89 -4
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/functionTransform.js +188 -0
- package/dist/analyzer/functionTransform.js.map +1 -1
- package/dist/analyzer/packageTypeVerifier.js +11 -1
- package/dist/analyzer/packageTypeVerifier.js.map +1 -1
- package/dist/analyzer/properties.js +73 -8
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +7 -1
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeGuards.js +1 -1
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/types.d.ts +1 -1
- package/dist/analyzer/types.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +6 -0
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator8.test.js +38 -0
- package/dist/tests/typeEvaluator8.test.js.map +1 -1
- package/dist/tests/typeServer/inProcTypeServerTestUtils.d.ts +39 -0
- package/dist/tests/typeServer/inProcTypeServerTestUtils.js +366 -0
- package/dist/tests/typeServer/inProcTypeServerTestUtils.js.map +1 -0
- package/dist/tests/typeServer/notebook.typeServer.test.d.ts +1 -0
- package/dist/tests/typeServer/notebook.typeServer.test.js +315 -0
- package/dist/tests/typeServer/notebook.typeServer.test.js.map +1 -0
- package/dist/tests/typeServer/typeServer.inProc.test.d.ts +1 -0
- package/dist/tests/typeServer/typeServer.inProc.test.js +234 -0
- package/dist/tests/typeServer/typeServer.inProc.test.js.map +1 -0
- package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.d.ts +1 -0
- package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.js +298 -0
- package/dist/tests/typeServer/typeServer.virtualFileRedirect.test.js.map +1 -0
- package/dist/typeServer/cancellation.d.ts +5 -0
- package/dist/typeServer/cancellation.js +14 -0
- package/dist/typeServer/cancellation.js.map +1 -0
- package/dist/typeServer/diagnosticUtils.d.ts +4 -0
- package/dist/typeServer/diagnosticUtils.js +71 -0
- package/dist/typeServer/diagnosticUtils.js.map +1 -0
- package/dist/typeServer/enums.d.ts +14 -0
- package/dist/typeServer/enums.js +524 -0
- package/dist/typeServer/enums.js.map +1 -0
- package/dist/typeServer/eventEmitter.d.ts +12 -0
- package/dist/typeServer/eventEmitter.js +32 -0
- package/dist/typeServer/eventEmitter.js.map +1 -0
- package/dist/typeServer/nodeMain.d.ts +1 -0
- package/dist/typeServer/nodeMain.js +65 -0
- package/dist/typeServer/nodeMain.js.map +1 -0
- package/dist/typeServer/notebookCellChain.d.ts +34 -0
- package/dist/typeServer/notebookCellChain.js +182 -0
- package/dist/typeServer/notebookCellChain.js.map +1 -0
- package/dist/typeServer/notebookDocumentHandler.d.ts +23 -0
- package/dist/typeServer/notebookDocumentHandler.js +158 -0
- package/dist/typeServer/notebookDocumentHandler.js.map +1 -0
- package/dist/typeServer/notebookUriMapper.d.ts +39 -0
- package/dist/typeServer/notebookUriMapper.js +164 -0
- package/dist/typeServer/notebookUriMapper.js.map +1 -0
- package/dist/typeServer/profilingStub.d.ts +10 -0
- package/dist/typeServer/profilingStub.js +12 -0
- package/dist/typeServer/profilingStub.js.map +1 -0
- package/dist/typeServer/programTypes.d.ts +136 -0
- package/dist/typeServer/programTypes.js +3 -0
- package/dist/typeServer/programTypes.js.map +1 -0
- package/dist/typeServer/programWrapper.d.ts +134 -0
- package/dist/typeServer/programWrapper.js +731 -0
- package/dist/typeServer/programWrapper.js.map +1 -0
- package/dist/typeServer/protocol/tspSupplemental.d.ts +43 -0
- package/dist/typeServer/protocol/tspSupplemental.js +48 -0
- package/dist/typeServer/protocol/tspSupplemental.js.map +1 -0
- package/dist/typeServer/protocol/typeServerProtocol.d.ts +1102 -0
- package/dist/typeServer/protocol/typeServerProtocol.js +290 -0
- package/dist/typeServer/protocol/typeServerProtocol.js.map +1 -0
- package/dist/typeServer/server.d.ts +54 -0
- package/dist/typeServer/server.js +620 -0
- package/dist/typeServer/server.js.map +1 -0
- package/dist/typeServer/serverUtils.d.ts +4 -0
- package/dist/typeServer/serverUtils.js +21 -0
- package/dist/typeServer/serverUtils.js.map +1 -0
- package/dist/typeServer/stubGenerator.d.ts +42 -0
- package/dist/typeServer/stubGenerator.js +895 -0
- package/dist/typeServer/stubGenerator.js.map +1 -0
- package/dist/typeServer/typeCache.d.ts +31 -0
- package/dist/typeServer/typeCache.js +54 -0
- package/dist/typeServer/typeCache.js.map +1 -0
- package/dist/typeServer/typeEvalUtils.d.ts +13 -0
- package/dist/typeServer/typeEvalUtils.js +83 -0
- package/dist/typeServer/typeEvalUtils.js.map +1 -0
- package/dist/typeServer/typeGuards.d.ts +3 -0
- package/dist/typeServer/typeGuards.js +55 -0
- package/dist/typeServer/typeGuards.js.map +1 -0
- package/dist/typeServer/typeServerConversionTypes.d.ts +39 -0
- package/dist/typeServer/typeServerConversionTypes.js +448 -0
- package/dist/typeServer/typeServerConversionTypes.js.map +1 -0
- package/dist/typeServer/typeServerConversionUtils.d.ts +35 -0
- package/dist/typeServer/typeServerConversionUtils.js +524 -0
- package/dist/typeServer/typeServerConversionUtils.js.map +1 -0
- package/dist/typeServer/typeServerEvaluator.d.ts +16 -0
- package/dist/typeServer/typeServerEvaluator.js +36 -0
- package/dist/typeServer/typeServerEvaluator.js.map +1 -0
- package/dist/typeServer/typeServerFileSystem.d.ts +47 -0
- package/dist/typeServer/typeServerFileSystem.js +129 -0
- package/dist/typeServer/typeServerFileSystem.js.map +1 -0
- package/dist/typeServer/typeServerProtocolUtils.d.ts +2 -0
- package/dist/typeServer/typeServerProtocolUtils.js +7 -0
- package/dist/typeServer/typeServerProtocolUtils.js.map +1 -0
- package/dist/typeServer/typeServerServiceKeys.d.ts +7 -0
- package/dist/typeServer/typeServerServiceKeys.js +20 -0
- package/dist/typeServer/typeServerServiceKeys.js.map +1 -0
- package/dist/typeServer/typeUtils.d.ts +4 -0
- package/dist/typeServer/typeUtils.js +31 -0
- package/dist/typeServer/typeUtils.js.map +1 -0
- package/dist/typeServer/virtualFileOverlayFileSystem.d.ts +87 -0
- package/dist/typeServer/virtualFileOverlayFileSystem.js +181 -0
- package/dist/typeServer/virtualFileOverlayFileSystem.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* notebookUriMapper.ts
|
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
|
5
|
+
* Licensed under the MIT license.
|
|
6
|
+
*
|
|
7
|
+
* Maps notebook cell URIs to file-like URIs so notebook cells can be analyzed as if
|
|
8
|
+
* they were regular Python files.
|
|
9
|
+
*
|
|
10
|
+
* In a virtual workspace, a notebook might have a path like:
|
|
11
|
+
* vscode-vfs://path/to/notebook.ipynb
|
|
12
|
+
* but its cells arrive with paths like:
|
|
13
|
+
* vscode-notebook-cell://path/to/notebook.ipynb#cellName
|
|
14
|
+
* meaning the 'virtual' portion of the cell path is lost in the cell URI. This class
|
|
15
|
+
* resolves that by turning cell URIs into cell URIs that carry the virtual information:
|
|
16
|
+
* vscode-notebook-cell://path/to/notebook.ipynb#cellName
|
|
17
|
+
* becomes
|
|
18
|
+
* vscode-vfs://path/to/notebook.ipynb#cellName
|
|
19
|
+
*/
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.NotebookUriMapper = exports.INotebookUriMapper = void 0;
|
|
22
|
+
const uri_1 = require("../common/uri/uri");
|
|
23
|
+
var INotebookUriMapper;
|
|
24
|
+
(function (INotebookUriMapper) {
|
|
25
|
+
function is(obj) {
|
|
26
|
+
return obj && typeof obj.parseNotebookOpen === 'function';
|
|
27
|
+
}
|
|
28
|
+
INotebookUriMapper.is = is;
|
|
29
|
+
})(INotebookUriMapper || (exports.INotebookUriMapper = INotebookUriMapper = {}));
|
|
30
|
+
const notebookPrefixCellFragment = 'pylancePrefixCell';
|
|
31
|
+
const NotebookCellScheme = 'vscode-notebook-cell';
|
|
32
|
+
const InteractiveWindowInputBoxScheme = 'vscode-interactive-input';
|
|
33
|
+
const VSCodeChatCodeBlockScheme = 'vscode-chat-code-block';
|
|
34
|
+
const VSCodeCopilotChatCodeBlockScheme = 'vscode-copilot-chat-code-block';
|
|
35
|
+
class NotebookUriMapper {
|
|
36
|
+
constructor(_caseDetector) {
|
|
37
|
+
this._caseDetector = _caseDetector;
|
|
38
|
+
this._originalToMapped = new Map();
|
|
39
|
+
this._mappedToOriginal = new Map();
|
|
40
|
+
this._pendingDeletes = new Set();
|
|
41
|
+
this._inUseUris = new Set();
|
|
42
|
+
// Empty
|
|
43
|
+
}
|
|
44
|
+
parseNotebookOpen(params) {
|
|
45
|
+
// Clear out any pending deletes that are no longer in use. This might
|
|
46
|
+
// include the cells we're about to open.
|
|
47
|
+
this._clearPendingDeletes();
|
|
48
|
+
// First get the uri to the notebook. This is used as the base for the cells.
|
|
49
|
+
const notebookUri = uri_1.Uri.parse(params.notebookDocument.uri, this._caseDetector);
|
|
50
|
+
// If there are any cell uris in the params, stick them in the map.
|
|
51
|
+
params.cellTextDocuments.forEach((c) => {
|
|
52
|
+
const cellOriginal = uri_1.Uri.parse(c.uri, this._caseDetector);
|
|
53
|
+
const cellMapped = this._generateCellMappedUri(notebookUri, cellOriginal);
|
|
54
|
+
this._save(cellOriginal, cellMapped);
|
|
55
|
+
});
|
|
56
|
+
return notebookUri;
|
|
57
|
+
}
|
|
58
|
+
parseNotebookChange(params) {
|
|
59
|
+
// Any cell closures should be added to the pending deletes.
|
|
60
|
+
params.change.cells?.structure?.didClose?.forEach((c) => {
|
|
61
|
+
const cellOriginal = uri_1.Uri.parse(c.uri, this._caseDetector);
|
|
62
|
+
this._pendDelete(cellOriginal);
|
|
63
|
+
});
|
|
64
|
+
// Any new cell adds should be added to the cell URI map.
|
|
65
|
+
const notebookUri = uri_1.Uri.parse(params.notebookDocument.uri, this._caseDetector);
|
|
66
|
+
params.change.cells?.structure?.didOpen?.forEach((c) => {
|
|
67
|
+
const cellOriginal = uri_1.Uri.parse(c.uri, this._caseDetector);
|
|
68
|
+
const cellMapped = this._generateCellMappedUri(notebookUri, cellOriginal);
|
|
69
|
+
this._save(cellOriginal, cellMapped);
|
|
70
|
+
});
|
|
71
|
+
return notebookUri;
|
|
72
|
+
}
|
|
73
|
+
parseNotebookClose(params) {
|
|
74
|
+
// Add all of the current cells to the list of pending deletes.
|
|
75
|
+
params.cellTextDocuments.forEach((c) => {
|
|
76
|
+
const cellUri = uri_1.Uri.parse(c.uri, this._caseDetector);
|
|
77
|
+
this._pendDelete(cellUri);
|
|
78
|
+
});
|
|
79
|
+
return uri_1.Uri.parse(params.notebookDocument.uri, this._caseDetector);
|
|
80
|
+
}
|
|
81
|
+
markUsing(uri, using) {
|
|
82
|
+
if (NotebookUriMapper.isNotebookCell(uri)) {
|
|
83
|
+
// Remove or add to the in use set.
|
|
84
|
+
if (using) {
|
|
85
|
+
this._inUseUris.add(uri.key);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this._inUseUris.delete(uri.key);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
getOriginalCellUri(cellUri) {
|
|
93
|
+
// Should be in the map. Cell paths are added to
|
|
94
|
+
// the map when opening/changing a notebook.
|
|
95
|
+
return this._mappedToOriginal.get(cellUri.key) || cellUri;
|
|
96
|
+
}
|
|
97
|
+
getMappedCellUri(cellUri) {
|
|
98
|
+
// Should be in the map. Cell paths are added to the map
|
|
99
|
+
// when opening/changing a notebook.
|
|
100
|
+
return this._originalToMapped.get(cellUri.key) || cellUri;
|
|
101
|
+
}
|
|
102
|
+
getNotebookUriFromCell(cellUri) {
|
|
103
|
+
// If this is the original cell, we need the mapped cell.
|
|
104
|
+
const mappedCell = this.getMappedCellUri(cellUri);
|
|
105
|
+
// The mapped cell contains the URI from the notebook in it. Just
|
|
106
|
+
// need to remove the cell fragment and the last extension
|
|
107
|
+
return mappedCell.replaceExtension('').withQuery(mappedCell.query);
|
|
108
|
+
}
|
|
109
|
+
static isNotebookPrefixCell(uri) {
|
|
110
|
+
return uri.fragment === notebookPrefixCellFragment;
|
|
111
|
+
}
|
|
112
|
+
static isNotebookFile(uri) {
|
|
113
|
+
if (uri.scheme === VSCodeChatCodeBlockScheme || uri.scheme === VSCodeCopilotChatCodeBlockScheme) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
return uri.hasExtension('.ipynb') && uri.fragment.length <= 0;
|
|
117
|
+
}
|
|
118
|
+
static isNotebookCell(uri) {
|
|
119
|
+
if (uri.scheme === InteractiveWindowInputBoxScheme) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
// A URI with a fragment is a notebook cell if it contains the .ipynb extension (regular notebook
|
|
123
|
+
// mapped cell), uses the vscode-notebook-cell scheme (original cell URI), or contains the
|
|
124
|
+
// .interactive extension (interactive window mapped cell, e.g. untitled:/Foo.interactive.py#cellN).
|
|
125
|
+
return uri.fragment
|
|
126
|
+
? uri.containsExtension('.ipynb') ||
|
|
127
|
+
uri.scheme === NotebookCellScheme ||
|
|
128
|
+
uri.containsExtension('.interactive')
|
|
129
|
+
: false;
|
|
130
|
+
}
|
|
131
|
+
static getNotebookPrefixUri(notebookUri) {
|
|
132
|
+
return notebookUri.addExtension('.py').withFragment(notebookPrefixCellFragment);
|
|
133
|
+
}
|
|
134
|
+
_generateCellMappedUri(notebookUri, cellUri) {
|
|
135
|
+
// Should just be the notebook URI with the cell fragment with a '.py' extension.
|
|
136
|
+
return notebookUri.addExtension('.py').withFragment(cellUri.fragment);
|
|
137
|
+
}
|
|
138
|
+
_clearPendingDeletes() {
|
|
139
|
+
const pending = [...this._pendingDeletes];
|
|
140
|
+
pending.forEach((key) => {
|
|
141
|
+
if (!this._inUseUris.has(key)) {
|
|
142
|
+
this._delete(key);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
_pendDelete(original) {
|
|
147
|
+
this._pendingDeletes.add(original.key);
|
|
148
|
+
}
|
|
149
|
+
_save(original, mapped) {
|
|
150
|
+
this._originalToMapped.set(original.key, mapped);
|
|
151
|
+
this._mappedToOriginal.set(mapped.key, original);
|
|
152
|
+
this._pendingDeletes.delete(original.key);
|
|
153
|
+
}
|
|
154
|
+
_delete(originalKey) {
|
|
155
|
+
const mapped = this._originalToMapped.get(originalKey);
|
|
156
|
+
if (mapped) {
|
|
157
|
+
this._originalToMapped.delete(originalKey);
|
|
158
|
+
this._mappedToOriginal.delete(mapped.key);
|
|
159
|
+
this._pendingDeletes.delete(originalKey);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.NotebookUriMapper = NotebookUriMapper;
|
|
164
|
+
//# sourceMappingURL=notebookUriMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notebookUriMapper.js","sourceRoot":"","sources":["../../../../../src/typeServer/notebookUriMapper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AASH,2CAAwC;AAYxC,IAAiB,kBAAkB,CAIlC;AAJD,WAAiB,kBAAkB;IAC/B,SAAgB,EAAE,CAAC,GAAQ;QACvB,OAAO,GAAG,IAAI,OAAO,GAAG,CAAC,iBAAiB,KAAK,UAAU,CAAC;IAC9D,CAAC;IAFe,qBAAE,KAEjB,CAAA;AACL,CAAC,EAJgB,kBAAkB,kCAAlB,kBAAkB,QAIlC;AAED,MAAM,0BAA0B,GAAG,mBAAmB,CAAC;AACvD,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AAClD,MAAM,+BAA+B,GAAG,0BAA0B,CAAC;AACnE,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAC3D,MAAM,gCAAgC,GAAG,gCAAgC,CAAC;AAE1E,M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IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,MAAM,EAAE,CAAC;YACT,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAC3C,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1C,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC7C,CAAC;IACL,CAAC;CACJ;AAvJD,8CAuJC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Uri } from '../common/uri/uri';
|
|
2
|
+
export interface ProfilingInfo {
|
|
3
|
+
profileId: number;
|
|
4
|
+
profilingFolderUri: Uri;
|
|
5
|
+
outputFileUris?: Uri[];
|
|
6
|
+
}
|
|
7
|
+
export interface IProfilingService {
|
|
8
|
+
startProfiling(): ProfilingInfo | undefined;
|
|
9
|
+
stopProfiling(): ProfilingInfo | undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* profilingStub.ts
|
|
4
|
+
* Copyright (c) Microsoft Corporation.
|
|
5
|
+
* Licensed under the MIT license.
|
|
6
|
+
*
|
|
7
|
+
* The Pylance type server integrated with a profiling service. Profiling is a
|
|
8
|
+
* Pylance-only feature, so the standalone Pyright type server keeps only the shape
|
|
9
|
+
* (`ProfilingInfo`) that the program interfaces reference; there is no profiler.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
//# sourceMappingURL=profilingStub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profilingStub.js","sourceRoot":"","sources":["../../../../../src/typeServer/profilingStub.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { TypeServerProtocol } from './protocol/typeServerProtocol';
|
|
2
|
+
import { CancellationToken, Disposable, DocumentDiagnosticReport, FileEvent } from 'vscode-languageserver-protocol';
|
|
3
|
+
import { AbsoluteModuleDescriptor, AnalyzerFileInfo, ImportLookupResult, LookupImportOptions } from '../analyzer/analyzerFileInfo';
|
|
4
|
+
import { DunderAllInfo } from '../analyzer/analyzerNodeInfo';
|
|
5
|
+
import { FlowNode } from '../analyzer/codeFlowTypes';
|
|
6
|
+
import { Declaration, FunctionDeclaration } from '../analyzer/declaration';
|
|
7
|
+
import { ImportResult } from '../analyzer/importResult';
|
|
8
|
+
import { Scope } from '../analyzer/scope';
|
|
9
|
+
import { Symbol, SymbolTable } from '../analyzer/symbol';
|
|
10
|
+
import { ExpectedTypeResult } from '../analyzer/typeEvaluatorTypes';
|
|
11
|
+
import { ClassType, Type } from '../analyzer/types';
|
|
12
|
+
import { ConfigOptions } from '../common/configOptions';
|
|
13
|
+
import { ConsoleInterface } from '../common/console';
|
|
14
|
+
import { Diagnostic as PyrightDiagnostic } from '../common/diagnostic';
|
|
15
|
+
import { FileEditAction } from '../common/editAction';
|
|
16
|
+
import { SourceFileInfo } from '../common/extensibility';
|
|
17
|
+
import { ReadOnlyFileSystem } from '../common/fileSystem';
|
|
18
|
+
import { ServiceProvider } from '../common/serviceProvider';
|
|
19
|
+
import { Range } from '../common/textRange';
|
|
20
|
+
import { Uri } from '../common/uri/uri';
|
|
21
|
+
import { ModuleNode, ParseNode } from '../parser/parseNodes';
|
|
22
|
+
import { ParseFileResults, ParserOutput } from '../parser/parser';
|
|
23
|
+
import { IParserOutputProvider } from './typeServerConversionTypes';
|
|
24
|
+
import { ITypeServerEvaluator } from './typeServerEvaluator';
|
|
25
|
+
import { ProfilingInfo } from './profilingStub';
|
|
26
|
+
export interface ParseResults extends ParseFileResults {
|
|
27
|
+
moduleName: string;
|
|
28
|
+
uri: Uri;
|
|
29
|
+
}
|
|
30
|
+
export interface ISourceFileInfo extends SourceFileInfo {
|
|
31
|
+
getImports(): ISourceFileInfo[];
|
|
32
|
+
getImportedBy(): ISourceFileInfo[];
|
|
33
|
+
getBuiltinsImportForBinding(): ISourceFileInfo | undefined;
|
|
34
|
+
getImplicitImportForBinding(): ISourceFileInfo | undefined;
|
|
35
|
+
}
|
|
36
|
+
export interface ISymbolLookup {
|
|
37
|
+
getFileInfo(node: ParseNode): AnalyzerFileInfo;
|
|
38
|
+
getDeclaration(node: ParseNode): Declaration | undefined;
|
|
39
|
+
getScope(node: ParseNode): Scope | undefined;
|
|
40
|
+
getDunderAllInfo(node: ParseNode): DunderAllInfo | undefined;
|
|
41
|
+
getImportInfo(node: ParseNode): ImportResult | undefined;
|
|
42
|
+
getFlowNode(node: ParseNode): FlowNode | undefined;
|
|
43
|
+
getSymbolsForFile(fileUri: Uri, skipFileNeededCheck?: boolean, token?: CancellationToken): SymbolTable | undefined;
|
|
44
|
+
getSymbolsForNode(node: ParseNode, token?: CancellationToken): SymbolTable | undefined;
|
|
45
|
+
lookupSymbol(scopingNode: ParseNode, name: string, skipFileNeededCheck?: boolean, token?: CancellationToken): Symbol | undefined;
|
|
46
|
+
getScopeIdForNode(node: ParseNode): string;
|
|
47
|
+
getMatchingFileInfos(fileId: string): AnalyzerFileInfo[];
|
|
48
|
+
}
|
|
49
|
+
export interface ISourceMapper {
|
|
50
|
+
findDeclarations(decl: Declaration): Declaration[];
|
|
51
|
+
findDeclarationsByType(originatedPath: Uri, type: ClassType, useTypeAlias: boolean): Declaration[];
|
|
52
|
+
findFunctionDeclarations(decl: FunctionDeclaration): FunctionDeclaration[];
|
|
53
|
+
findClassDeclarationsByType(uri: Uri, type: ClassType): Declaration[];
|
|
54
|
+
getSourcePathsFromStub(stubUri: Uri, fromFile: Uri | undefined): Uri[];
|
|
55
|
+
getModuleNode(uri: Uri): ModuleNode | undefined;
|
|
56
|
+
findModules(stubFile: Uri): ModuleNode[];
|
|
57
|
+
getFileInfo(node: ParseNode): AnalyzerFileInfo;
|
|
58
|
+
}
|
|
59
|
+
export interface IProgramBase extends IParserOutputProvider {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
readonly rootPath: Uri;
|
|
62
|
+
readonly console: ConsoleInterface;
|
|
63
|
+
readonly configOptions: ConfigOptions;
|
|
64
|
+
readonly fileSystem: ReadOnlyFileSystem;
|
|
65
|
+
readonly serviceProvider: ServiceProvider;
|
|
66
|
+
readonly isAlive: boolean;
|
|
67
|
+
readonly isPyright: boolean;
|
|
68
|
+
readonly performsAnalysis: boolean;
|
|
69
|
+
readonly supportsPullDiagnostics: boolean;
|
|
70
|
+
owns(uri: Uri): boolean;
|
|
71
|
+
getParserOutput(fileUri: Uri): ParserOutput | undefined;
|
|
72
|
+
getParseResults(fileUri: Uri): ParseResults | undefined;
|
|
73
|
+
getModuleName(fileUri: Uri): string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Non-side-effecting existence probe. Returns true only if the program
|
|
76
|
+
* already has an `ISourceFileInfo` registered for `fileUri`. Unlike
|
|
77
|
+
* `getSourceFileInfo`, this does NOT lazily materialize a new entry, so
|
|
78
|
+
* it is safe to use when callers (e.g. workspace ownership checks) only
|
|
79
|
+
* want to know whether a file is already tracked.
|
|
80
|
+
*/
|
|
81
|
+
hasSourceFile(fileUri: Uri): boolean;
|
|
82
|
+
getSourceFileInfo(fileUri: Uri): ISourceFileInfo | undefined;
|
|
83
|
+
getTrackedFileList(): readonly ISourceFileInfo[];
|
|
84
|
+
lookupImport(fileUriOrModule: Uri | AbsoluteModuleDescriptor, options?: LookupImportOptions): ImportLookupResult | undefined;
|
|
85
|
+
}
|
|
86
|
+
export interface ITypeProvider {
|
|
87
|
+
getComputedType(arg: ParseNode | Declaration, token: CancellationToken): Type | undefined;
|
|
88
|
+
getExpectedType(arg: ParseNode | Declaration, token: CancellationToken): ExpectedTypeResult | undefined;
|
|
89
|
+
getDeclaredType(arg: ParseNode | Declaration, token: CancellationToken): Type | undefined;
|
|
90
|
+
}
|
|
91
|
+
export interface IProgram extends IProgramBase, ITypeProvider, Disposable {
|
|
92
|
+
readonly symbolLookup: ISymbolLookup;
|
|
93
|
+
createEvaluator(): ITypeServerEvaluator;
|
|
94
|
+
getSnapshot(token: CancellationToken): number;
|
|
95
|
+
run<T>(callback: (p: IProgram) => T, token: CancellationToken): T;
|
|
96
|
+
runEditMode<T>(callback: (p: IProgram) => T, token: CancellationToken): FileEditAction[];
|
|
97
|
+
enterEditMode(): void;
|
|
98
|
+
exitEditMode(): FileEditAction[];
|
|
99
|
+
addInterimFile(uri: Uri): IProgram;
|
|
100
|
+
resolveImport(sourceUri: Uri, moduleDescriptor: TypeServerProtocol.ModuleName, token: CancellationToken): Uri | undefined;
|
|
101
|
+
getPythonSearchPaths(token: CancellationToken): Uri[] | undefined;
|
|
102
|
+
getSourceMapper(fileUri: Uri, mapCompiled: boolean, preferStubs: boolean, token: CancellationToken): ISourceMapper | undefined;
|
|
103
|
+
getDocumentDiagnostics(uri: Uri, previousResultId: string | undefined, token: CancellationToken): DocumentDiagnosticReport;
|
|
104
|
+
getDiagnosticsForRangeWithoutFileIgnore?(fileUri: Uri, range: Range): readonly PyrightDiagnostic[];
|
|
105
|
+
getCachedTypeForDeclaration(decl: Declaration): Type | undefined;
|
|
106
|
+
setCachedTypeForDeclaration(decl: Declaration, type: Type): void;
|
|
107
|
+
getCachedProtocolDecl(tspDecl: TypeServerProtocol.Declaration): Declaration | undefined;
|
|
108
|
+
setCachedProtocolDecl(tspDecl: TypeServerProtocol.Declaration, decl: Declaration): void;
|
|
109
|
+
startProfiling(): ProfilingInfo | undefined;
|
|
110
|
+
stopProfiling(): ProfilingInfo | undefined;
|
|
111
|
+
updateFileContents(uri: Uri, newContents: string): void;
|
|
112
|
+
startWorkspaceDiagnostics(partialResultToken: string): void;
|
|
113
|
+
stopWorkspaceDiagnostics(): void;
|
|
114
|
+
/**
|
|
115
|
+
* Add a file to be tracked by the program for indexing purposes.
|
|
116
|
+
* Creates a source file info entry if it doesn't exist.
|
|
117
|
+
*/
|
|
118
|
+
addTrackedFile(uri: Uri, isThirdPartyImport: boolean, isInPyTypedPackage: boolean): void;
|
|
119
|
+
/**
|
|
120
|
+
* Set the list of tracked files for the program.
|
|
121
|
+
* Clears existing tracked state and sets the specified files as tracked.
|
|
122
|
+
*/
|
|
123
|
+
setTrackedFiles(uris: Uri[]): void;
|
|
124
|
+
/**
|
|
125
|
+
* Handle high memory usage by clearing caches or performing cleanup.
|
|
126
|
+
* Used by long workspace-wide walks (e.g. find-all-references / rename
|
|
127
|
+
* transitive seed discovery) to shed the type cache between files, mirroring
|
|
128
|
+
* the sync `ProgramView.handleMemoryHighUsage`. May be a no-op for
|
|
129
|
+
* implementations that don't manage their own in-process memory.
|
|
130
|
+
*/
|
|
131
|
+
handleMemoryHighUsage(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Notify the program that watched files have changed.
|
|
134
|
+
*/
|
|
135
|
+
changedWatchedFiles(changes: FileEvent[]): void;
|
|
136
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"programTypes.js","sourceRoot":"","sources":["../../../../../src/typeServer/programTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT license.
|
|
4
|
+
*
|
|
5
|
+
* programWrapper.ts
|
|
6
|
+
*
|
|
7
|
+
* Wraps Pyright's `Program` in the `IProgram` interface the type server consumes.
|
|
8
|
+
*
|
|
9
|
+
* The wrapper is thin: every method delegates synchronously to the underlying `Program`.
|
|
10
|
+
* It exists to (a) present the `IProgram` contract the conversion layer is written against,
|
|
11
|
+
* (b) reshape Pyright types (`SourceFileInfo`, `ParseFileResults`, `SourceMapper`) into the
|
|
12
|
+
* type-server-facing shapes, and (c) maintain a monotonic `snapshot` content-version counter
|
|
13
|
+
* (on the shared `ITypeCache`) that the server exposes to clients for cache coherence.
|
|
14
|
+
*
|
|
15
|
+
* Cancellation is handled the same way as everywhere else in Pyright: work runs inside
|
|
16
|
+
* `runWithCancellationToken`, and the evaluator polls the token, so long-running synchronous
|
|
17
|
+
* queries can be interrupted mid-request.
|
|
18
|
+
*/
|
|
19
|
+
import { TypeServerProtocol } from './protocol/typeServerProtocol';
|
|
20
|
+
import { CancellationToken, DocumentDiagnosticReport, FileEvent } from 'vscode-languageserver-protocol';
|
|
21
|
+
import { AbsoluteModuleDescriptor, ImportLookupResult, LookupImportOptions } from '../analyzer/analyzerFileInfo';
|
|
22
|
+
import { Declaration } from '../analyzer/declaration';
|
|
23
|
+
import { Program } from '../analyzer/program';
|
|
24
|
+
import { ExpectedTypeResult } from '../analyzer/typeEvaluatorTypes';
|
|
25
|
+
import { Type } from '../analyzer/types';
|
|
26
|
+
import { ConfigOptions } from '../common/configOptions';
|
|
27
|
+
import { ConsoleInterface } from '../common/console';
|
|
28
|
+
import { FileEditAction } from '../common/editAction';
|
|
29
|
+
import { ProgramView } from '../common/extensibility';
|
|
30
|
+
import { ReadOnlyFileSystem } from '../common/fileSystem';
|
|
31
|
+
import { ServiceProvider } from '../common/serviceProvider';
|
|
32
|
+
import { Uri } from '../common/uri/uri';
|
|
33
|
+
import { ParseNode } from '../parser/parseNodes';
|
|
34
|
+
import { ParserOutput } from '../parser/parser';
|
|
35
|
+
import { ITypeServerEvaluator } from './typeServerEvaluator';
|
|
36
|
+
import { INotebookUriMapper } from './notebookUriMapper';
|
|
37
|
+
import { ProfilingInfo } from './profilingStub';
|
|
38
|
+
import { IProgram, ISourceFileInfo, ISourceMapper, ISymbolLookup, ParseResults } from './programTypes';
|
|
39
|
+
import { ITypeCache } from './typeCache';
|
|
40
|
+
/**
|
|
41
|
+
* Adapter that lets the in-proc Pyright `Program` (which is mutable and has no
|
|
42
|
+
* native snapshot concept) satisfy the `IProgram` contract the type server's
|
|
43
|
+
* conversion layer is written against.
|
|
44
|
+
*
|
|
45
|
+
* - `run` runs the callback over the live `Program` via `_program.run(...)`.
|
|
46
|
+
* Because Pyright's evaluator is synchronous the callback executes atomically,
|
|
47
|
+
* so it simply receives `this` — there is no copy-on-write snapshot view.
|
|
48
|
+
* - A monotonic `snapshot` counter (on the shared `ITypeCache`) is bumped by the
|
|
49
|
+
* mutating methods below. It is a protocol-level content version: the server
|
|
50
|
+
* hands it to clients via `typeServer/getSnapshot`, rejects stale requests at
|
|
51
|
+
* the request boundary, and fires `SnapshotChangedNotification` on change.
|
|
52
|
+
* - Cross-request state (`_declTypeCache`, `_protocolDeclCache`, `_addedStubs`, …)
|
|
53
|
+
* lives on the wrapper, not on the `Program`, which has nowhere to put it, and
|
|
54
|
+
* is invalidated when the snapshot increments.
|
|
55
|
+
*/
|
|
56
|
+
export declare class ProgramWrapper implements IProgram {
|
|
57
|
+
private readonly _program;
|
|
58
|
+
private _cache;
|
|
59
|
+
private _cachedSearchPaths;
|
|
60
|
+
private _declTypeCache;
|
|
61
|
+
private _protocolDeclCache;
|
|
62
|
+
private _disableSnapshotIncrement;
|
|
63
|
+
private _addedStubs;
|
|
64
|
+
private _inEditMode;
|
|
65
|
+
constructor(_program: Program, _cache: ITypeCache);
|
|
66
|
+
get id(): string;
|
|
67
|
+
get typeCache(): ITypeCache;
|
|
68
|
+
get rootPath(): Uri;
|
|
69
|
+
get console(): ConsoleInterface;
|
|
70
|
+
get configOptions(): ConfigOptions;
|
|
71
|
+
get fs(): import("../common/fileSystem").FileSystem;
|
|
72
|
+
get fileSystem(): ReadOnlyFileSystem;
|
|
73
|
+
get serviceProvider(): ServiceProvider;
|
|
74
|
+
get uriMapper(): INotebookUriMapper | undefined;
|
|
75
|
+
get isAlive(): boolean;
|
|
76
|
+
get isPyright(): boolean;
|
|
77
|
+
get performsAnalysis(): boolean;
|
|
78
|
+
get supportsPullDiagnostics(): boolean;
|
|
79
|
+
get symbolLookup(): ISymbolLookup;
|
|
80
|
+
runEditMode<T>(callback: (p: IProgram) => T, token: CancellationToken): FileEditAction[];
|
|
81
|
+
enterEditMode(): void;
|
|
82
|
+
exitEditMode(): FileEditAction[];
|
|
83
|
+
run<T>(callback: (p: IProgram) => T, token: CancellationToken): T;
|
|
84
|
+
createEvaluator(): ITypeServerEvaluator;
|
|
85
|
+
getCachedTypeForDeclaration(decl: Declaration): Type | undefined;
|
|
86
|
+
setCachedTypeForDeclaration(decl: Declaration, type: Type): void;
|
|
87
|
+
getCachedProtocolDecl(tspDecl: TypeServerProtocol.Declaration): Declaration | undefined;
|
|
88
|
+
setCachedProtocolDecl(tspDecl: TypeServerProtocol.Declaration, decl: Declaration): void;
|
|
89
|
+
getSourceMapper(fileUri: Uri, mapCompiled: boolean, preferStubs: boolean, token: CancellationToken): ISourceMapper | undefined;
|
|
90
|
+
getUri(node: ParseNode): Uri;
|
|
91
|
+
isCaseSensitive(uri: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Ensures the file is analyzed and the evaluator's prefetched type cache is warmed up.
|
|
94
|
+
* This avoids expensive re-evaluation when the cache is cold (e.g., first request for a file
|
|
95
|
+
* that imports large libraries).
|
|
96
|
+
*/
|
|
97
|
+
ensureFileAnalyzed(fileUri: Uri, token: CancellationToken): void;
|
|
98
|
+
getComputedType(arg: ParseNode | Declaration, token: CancellationToken): Type | undefined;
|
|
99
|
+
getExpectedType(arg: ParseNode | Declaration, token: CancellationToken): ExpectedTypeResult | undefined;
|
|
100
|
+
getDeclaredType(arg: ParseNode | Declaration, token: CancellationToken): Type | undefined;
|
|
101
|
+
startProfiling(): ProfilingInfo | undefined;
|
|
102
|
+
stopProfiling(): ProfilingInfo | undefined;
|
|
103
|
+
startWorkspaceDiagnostics(partialResultToken: string): void;
|
|
104
|
+
stopWorkspaceDiagnostics(): void;
|
|
105
|
+
getPythonSearchPaths(token: CancellationToken): Uri[] | undefined;
|
|
106
|
+
lookupImport(fileUriOrModule: Uri | AbsoluteModuleDescriptor, options?: LookupImportOptions): ImportLookupResult | undefined;
|
|
107
|
+
owns(uri: Uri): boolean;
|
|
108
|
+
getParserOutput(fileUri: Uri): ParserOutput | undefined;
|
|
109
|
+
getParseResults(fileUri: Uri): ParseResults | undefined;
|
|
110
|
+
addStubCode(code: string, directoryUri?: Uri): {
|
|
111
|
+
uri: Uri;
|
|
112
|
+
parseResults: ParseResults;
|
|
113
|
+
};
|
|
114
|
+
getModuleName(fileUri: Uri): string | undefined;
|
|
115
|
+
getSourceFileInfo(fileUri: Uri): ISourceFileInfo | undefined;
|
|
116
|
+
hasSourceFile(fileUri: Uri): boolean;
|
|
117
|
+
getTrackedFileList(): readonly ISourceFileInfo[];
|
|
118
|
+
updateFileContents(uri: Uri, newContents: string): void;
|
|
119
|
+
addTrackedFile(uri: Uri, isThirdPartyImport: boolean, isInPyTypedPackage: boolean): void;
|
|
120
|
+
setTrackedFiles(uris: Uri[]): void;
|
|
121
|
+
handleMemoryHighUsage(): void;
|
|
122
|
+
getSnapshot(token: CancellationToken): number;
|
|
123
|
+
getDocumentDiagnostics(uri: Uri, previousResultId: string | undefined, token: CancellationToken): DocumentDiagnosticReport;
|
|
124
|
+
resolveImport(source: Uri, moduleDescriptor: TypeServerProtocol.ModuleName, token: CancellationToken): Uri | undefined;
|
|
125
|
+
changedWatchedFiles(changes: FileEvent[]): void;
|
|
126
|
+
addInterimFile(uri: Uri): IProgram;
|
|
127
|
+
dispose(): void;
|
|
128
|
+
private _massageTypeResult;
|
|
129
|
+
private _massageExpectedTypeResult;
|
|
130
|
+
private _makeSourceFileInfo;
|
|
131
|
+
private _incrementSnapshot;
|
|
132
|
+
private _getExecEnv;
|
|
133
|
+
}
|
|
134
|
+
export declare function makeProgram(program: ProgramView, cache?: ITypeCache): IProgram;
|