@zzzen/pyright-internal 1.2.0-dev.20230219 → 1.2.0-dev.20230305
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/backgroundAnalysisProgram.d.ts +1 -1
- package/dist/analyzer/backgroundAnalysisProgram.js +3 -3
- package/dist/analyzer/backgroundAnalysisProgram.js.map +1 -1
- package/dist/analyzer/binder.d.ts +0 -1
- package/dist/analyzer/binder.js +18 -93
- package/dist/analyzer/binder.js.map +1 -1
- package/dist/analyzer/checker.js +50 -30
- package/dist/analyzer/checker.js.map +1 -1
- package/dist/analyzer/codeFlowEngine.js +5 -5
- package/dist/analyzer/codeFlowEngine.js.map +1 -1
- package/dist/analyzer/constraintSolver.js +0 -10
- package/dist/analyzer/constraintSolver.js.map +1 -1
- package/dist/analyzer/declaration.d.ts +3 -4
- package/dist/analyzer/declaration.js +6 -1
- package/dist/analyzer/declaration.js.map +1 -1
- package/dist/analyzer/declarationUtils.d.ts +1 -5
- package/dist/analyzer/declarationUtils.js +2 -47
- package/dist/analyzer/declarationUtils.js.map +1 -1
- package/dist/analyzer/docStringConversion.js +9 -3
- package/dist/analyzer/docStringConversion.js.map +1 -1
- package/dist/analyzer/importResolver.d.ts +3 -2
- package/dist/analyzer/importResolver.js +28 -19
- package/dist/analyzer/importResolver.js.map +1 -1
- package/dist/analyzer/parseTreeUtils.d.ts +4 -2
- package/dist/analyzer/parseTreeUtils.js +77 -2
- package/dist/analyzer/parseTreeUtils.js.map +1 -1
- package/dist/analyzer/patternMatching.d.ts +1 -0
- package/dist/analyzer/patternMatching.js +47 -2
- package/dist/analyzer/patternMatching.js.map +1 -1
- package/dist/analyzer/program.d.ts +5 -4
- package/dist/analyzer/program.js +182 -43
- package/dist/analyzer/program.js.map +1 -1
- package/dist/analyzer/properties.js +8 -3
- package/dist/analyzer/properties.js.map +1 -1
- package/dist/analyzer/protocols.js +8 -5
- package/dist/analyzer/protocols.js.map +1 -1
- package/dist/analyzer/pythonPathUtils.js +27 -13
- package/dist/analyzer/pythonPathUtils.js.map +1 -1
- package/dist/analyzer/service.d.ts +7 -3
- package/dist/analyzer/service.js +24 -7
- package/dist/analyzer/service.js.map +1 -1
- package/dist/analyzer/sourceFile.js +3 -0
- package/dist/analyzer/sourceFile.js.map +1 -1
- package/dist/analyzer/symbol.js +1 -4
- package/dist/analyzer/symbol.js.map +1 -1
- package/dist/analyzer/symbolUtils.d.ts +0 -3
- package/dist/analyzer/symbolUtils.js +1 -14
- package/dist/analyzer/symbolUtils.js.map +1 -1
- package/dist/analyzer/typeDocStringUtils.js +5 -3
- package/dist/analyzer/typeDocStringUtils.js.map +1 -1
- package/dist/analyzer/typeEvaluator.js +586 -294
- package/dist/analyzer/typeEvaluator.js.map +1 -1
- package/dist/analyzer/typeEvaluatorTypes.d.ts +10 -2
- package/dist/analyzer/typeGuards.js +2 -2
- package/dist/analyzer/typeGuards.js.map +1 -1
- package/dist/analyzer/typeUtils.d.ts +1 -0
- package/dist/analyzer/typeUtils.js +14 -1
- package/dist/analyzer/typeUtils.js.map +1 -1
- package/dist/analyzer/typedDicts.js +26 -17
- package/dist/analyzer/typedDicts.js.map +1 -1
- package/dist/analyzer/types.d.ts +2 -1
- package/dist/analyzer/types.js.map +1 -1
- package/dist/backgroundAnalysisBase.d.ts +2 -3
- package/dist/backgroundAnalysisBase.js +12 -13
- package/dist/backgroundAnalysisBase.js.map +1 -1
- package/dist/commands/commandController.js +1 -0
- package/dist/commands/commandController.js.map +1 -1
- package/dist/commands/quickActionCommand.js +2 -2
- package/dist/commands/quickActionCommand.js.map +1 -1
- package/dist/common/cancellationUtils.d.ts +18 -2
- package/dist/common/cancellationUtils.js +80 -3
- package/dist/common/cancellationUtils.js.map +1 -1
- package/dist/common/collectionUtils.d.ts +1 -0
- package/dist/common/collectionUtils.js +8 -1
- package/dist/common/collectionUtils.js.map +1 -1
- package/dist/common/extensibility.d.ts +4 -3
- package/dist/common/extensibility.js.map +1 -1
- package/dist/common/fileBasedCancellationUtils.d.ts +0 -1
- package/dist/common/fileBasedCancellationUtils.js +7 -81
- package/dist/common/fileBasedCancellationUtils.js.map +1 -1
- package/dist/common/positionUtils.d.ts +2 -0
- package/dist/common/positionUtils.js +15 -1
- package/dist/common/positionUtils.js.map +1 -1
- package/dist/common/{textEditUtils.d.ts → textEditTracker.d.ts} +2 -6
- package/dist/common/{textEditUtils.js → textEditTracker.js} +6 -49
- package/dist/common/textEditTracker.js.map +1 -0
- package/dist/common/workspaceEditUtils.d.ts +14 -8
- package/dist/common/workspaceEditUtils.js +115 -59
- package/dist/common/workspaceEditUtils.js.map +1 -1
- package/dist/languageServerBase.js +9 -3
- package/dist/languageServerBase.js.map +1 -1
- package/dist/languageService/callHierarchyProvider.js +4 -2
- package/dist/languageService/callHierarchyProvider.js.map +1 -1
- package/dist/languageService/codeActionProvider.js +1 -1
- package/dist/languageService/codeActionProvider.js.map +1 -1
- package/dist/languageService/completionProvider.js +49 -43
- package/dist/languageService/completionProvider.js.map +1 -1
- package/dist/languageService/completionProviderUtils.d.ts +1 -1
- package/dist/languageService/completionProviderUtils.js +3 -3
- package/dist/languageService/completionProviderUtils.js.map +1 -1
- package/dist/languageService/definitionProvider.js +2 -1
- package/dist/languageService/definitionProvider.js.map +1 -1
- package/dist/languageService/documentSymbolProvider.js +2 -1
- package/dist/languageService/documentSymbolProvider.js.map +1 -1
- package/dist/languageService/hoverProvider.js +14 -3
- package/dist/languageService/hoverProvider.js.map +1 -1
- package/dist/languageService/importAdder.d.ts +2 -2
- package/dist/languageService/importAdder.js +5 -3
- package/dist/languageService/importAdder.js.map +1 -1
- package/dist/languageService/indentationUtils.d.ts +6 -2
- package/dist/languageService/indentationUtils.js +33 -13
- package/dist/languageService/indentationUtils.js.map +1 -1
- package/dist/languageService/renameModuleProvider.d.ts +10 -2
- package/dist/languageService/renameModuleProvider.js +87 -14
- package/dist/languageService/renameModuleProvider.js.map +1 -1
- package/dist/localization/localize.d.ts +12 -2
- package/dist/localization/localize.js +5 -1
- package/dist/localization/localize.js.map +1 -1
- package/dist/localization/package.nls.en-us.json +6 -2
- package/dist/parser/parser.js +18 -18
- package/dist/parser/parser.js.map +1 -1
- package/dist/pyright.js +1 -1
- package/dist/pyright.js.map +1 -1
- package/dist/tests/docStringConversion.test.js +23 -0
- package/dist/tests/docStringConversion.test.js.map +1 -1
- package/dist/tests/fourslash/completions.errorNodes.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/completions.errorNodes.fourslash.js +24 -0
- package/dist/tests/fourslash/completions.errorNodes.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.docstring.parameter.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.docstring.parameter.fourslash.js +57 -0
- package/dist/tests/fourslash/hover.docstring.parameter.fourslash.js.map +1 -0
- package/dist/tests/fourslash/hover.slots.fourslash.d.ts +1 -0
- package/dist/tests/fourslash/hover.slots.fourslash.js +16 -0
- package/dist/tests/fourslash/hover.slots.fourslash.js.map +1 -0
- package/dist/tests/harness/fourslash/testState.js +9 -2
- package/dist/tests/harness/fourslash/testState.js.map +1 -1
- package/dist/tests/importAdder.test.js +16 -3
- package/dist/tests/importAdder.test.js.map +1 -1
- package/dist/tests/indentationUtils.reindent.test.js +22 -1
- package/dist/tests/indentationUtils.reindent.test.js.map +1 -1
- package/dist/tests/moveSymbol.importAdder.test.js +183 -24
- package/dist/tests/moveSymbol.importAdder.test.js.map +1 -1
- package/dist/tests/moveSymbol.insertion.test.js +137 -2
- package/dist/tests/moveSymbol.insertion.test.js.map +1 -1
- package/dist/tests/moveSymbol.misc.test.js +109 -4
- package/dist/tests/moveSymbol.misc.test.js.map +1 -1
- package/dist/tests/renameModuleTestUtils.d.ts +1 -1
- package/dist/tests/renameModuleTestUtils.js +9 -5
- package/dist/tests/renameModuleTestUtils.js.map +1 -1
- package/dist/tests/testStateUtils.js +2 -2
- package/dist/tests/testStateUtils.js.map +1 -1
- package/dist/tests/textEditUtil.test.js +2 -2
- package/dist/tests/textEditUtil.test.js.map +1 -1
- package/dist/tests/typeEvaluator1.test.js +8 -0
- package/dist/tests/typeEvaluator1.test.js.map +1 -1
- package/dist/tests/typeEvaluator2.test.js +13 -1
- package/dist/tests/typeEvaluator2.test.js.map +1 -1
- package/dist/tests/typeEvaluator3.test.js +29 -4
- package/dist/tests/typeEvaluator3.test.js.map +1 -1
- package/dist/tests/typeEvaluator4.test.js +1 -1
- package/dist/tests/typeEvaluator5.test.js +6 -0
- package/dist/tests/typeEvaluator5.test.js.map +1 -1
- package/dist/tests/workspaceEditUtils.test.js +7 -7
- package/dist/tests/workspaceEditUtils.test.js.map +1 -1
- package/package.json +3 -3
- package/dist/common/textEditUtils.js.map +0 -1
package/dist/parser/parser.js
CHANGED
@@ -355,7 +355,7 @@ class Parser {
|
|
355
355
|
this._getKeywordToken(25 /* Match */);
|
356
356
|
const expression = this._parseTestOrStarListAsExpression(
|
357
357
|
/* allowAssignmentExpression */ true,
|
358
|
-
/* allowMultipleUnpack */ true, 12 /* MissingPatternSubject */, localize_1.Localizer.Diagnostic.expectedReturnExpr());
|
358
|
+
/* allowMultipleUnpack */ true, 12 /* MissingPatternSubject */, () => localize_1.Localizer.Diagnostic.expectedReturnExpr());
|
359
359
|
smellsLikeMatchStatement =
|
360
360
|
expression.nodeType !== 0 /* Error */ && this._peekToken().type === 10 /* Colon */;
|
361
361
|
// Set the token index back to the start.
|
@@ -367,7 +367,7 @@ class Parser {
|
|
367
367
|
const matchToken = this._getKeywordToken(25 /* Match */);
|
368
368
|
const subjectExpression = this._parseTestOrStarListAsExpression(
|
369
369
|
/* allowAssignmentExpression */ true,
|
370
|
-
/* allowMultipleUnpack */ true, 12 /* MissingPatternSubject */, localize_1.Localizer.Diagnostic.expectedReturnExpr());
|
370
|
+
/* allowMultipleUnpack */ true, 12 /* MissingPatternSubject */, () => localize_1.Localizer.Diagnostic.expectedReturnExpr());
|
371
371
|
const matchNode = parseNodes_1.MatchNode.create(matchToken, subjectExpression);
|
372
372
|
const nextToken = this._peekToken();
|
373
373
|
if (!this._consumeTokenIfType(10 /* Colon */)) {
|
@@ -1132,7 +1132,7 @@ class Parser {
|
|
1132
1132
|
// for_stmt: [async] 'for' exprlist 'in' testlist suite ['else' suite]
|
1133
1133
|
_parseForStatement(asyncToken) {
|
1134
1134
|
const forToken = this._getKeywordToken(17 /* For */);
|
1135
|
-
const targetExpr = this._parseExpressionListAsPossibleTuple(2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedExpr(), forToken);
|
1135
|
+
const targetExpr = this._parseExpressionListAsPossibleTuple(2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedExpr(), forToken);
|
1136
1136
|
let seqExpr;
|
1137
1137
|
let forSuite;
|
1138
1138
|
let elseSuite;
|
@@ -1143,7 +1143,7 @@ class Parser {
|
|
1143
1143
|
else {
|
1144
1144
|
seqExpr = this._parseTestOrStarListAsExpression(
|
1145
1145
|
/* allowAssignmentExpression */ false,
|
1146
|
-
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedInExpr());
|
1146
|
+
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedInExpr());
|
1147
1147
|
forSuite = this._parseLoopSuite();
|
1148
1148
|
// Versions of Python earlier than 3.9 didn't allow unpack operators if the
|
1149
1149
|
// tuple wasn't enclosed in parentheses.
|
@@ -1226,7 +1226,7 @@ class Parser {
|
|
1226
1226
|
asyncToken = this._getKeywordToken(3 /* Async */);
|
1227
1227
|
}
|
1228
1228
|
const forToken = this._getKeywordToken(17 /* For */);
|
1229
|
-
const targetExpr = this._parseExpressionListAsPossibleTuple(2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedExpr(), forToken);
|
1229
|
+
const targetExpr = this._parseExpressionListAsPossibleTuple(2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedExpr(), forToken);
|
1230
1230
|
let seqExpr;
|
1231
1231
|
if (!this._consumeTokenIfKeyword(22 /* In */)) {
|
1232
1232
|
seqExpr = this._handleExpressionParseError(0 /* MissingIn */, localize_1.Localizer.Diagnostic.expectedIn());
|
@@ -1841,7 +1841,7 @@ class Parser {
|
|
1841
1841
|
if (!this._isNextTokenNeverExpression()) {
|
1842
1842
|
const returnExpr = this._parseTestOrStarListAsExpression(
|
1843
1843
|
/* allowAssignmentExpression */ true,
|
1844
|
-
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedReturnExpr());
|
1844
|
+
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedReturnExpr());
|
1845
1845
|
this._reportConditionalErrorForStarTupleElement(returnExpr);
|
1846
1846
|
returnNode.returnExpression = returnExpr;
|
1847
1847
|
returnNode.returnExpression.parent = returnNode;
|
@@ -2164,7 +2164,7 @@ class Parser {
|
|
2164
2164
|
if (!this._isNextTokenNeverExpression()) {
|
2165
2165
|
exprList = this._parseTestOrStarListAsExpression(
|
2166
2166
|
/* allowAssignmentExpression */ true,
|
2167
|
-
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedYieldExpr());
|
2167
|
+
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedYieldExpr());
|
2168
2168
|
this._reportConditionalErrorForStarTupleElement(exprList);
|
2169
2169
|
}
|
2170
2170
|
return parseNodes_1.YieldNode.create(yieldToken, exprList);
|
@@ -2287,9 +2287,9 @@ class Parser {
|
|
2287
2287
|
}
|
2288
2288
|
return tupleNode;
|
2289
2289
|
}
|
2290
|
-
_parseExpressionListAsPossibleTuple(errorCategory,
|
2290
|
+
_parseExpressionListAsPossibleTuple(errorCategory, getErrorString, errorToken) {
|
2291
2291
|
if (this._isNextTokenNeverExpression()) {
|
2292
|
-
this._addError(
|
2292
|
+
this._addError(getErrorString(), errorToken);
|
2293
2293
|
return parseNodes_1.ErrorNode.create(errorToken, errorCategory);
|
2294
2294
|
}
|
2295
2295
|
const exprListResult = this._parseExpressionList(/* allowStar */ true);
|
@@ -2298,9 +2298,9 @@ class Parser {
|
|
2298
2298
|
}
|
2299
2299
|
return this._makeExpressionOrTuple(exprListResult, /* enclosedInParens */ false);
|
2300
2300
|
}
|
2301
|
-
_parseTestListAsExpression(errorCategory,
|
2301
|
+
_parseTestListAsExpression(errorCategory, getErrorString) {
|
2302
2302
|
if (this._isNextTokenNeverExpression()) {
|
2303
|
-
return this._handleExpressionParseError(errorCategory,
|
2303
|
+
return this._handleExpressionParseError(errorCategory, getErrorString());
|
2304
2304
|
}
|
2305
2305
|
const exprListResult = this._parseTestExpressionList();
|
2306
2306
|
if (exprListResult.parseError) {
|
@@ -2308,9 +2308,9 @@ class Parser {
|
|
2308
2308
|
}
|
2309
2309
|
return this._makeExpressionOrTuple(exprListResult, /* enclosedInParens */ false);
|
2310
2310
|
}
|
2311
|
-
_parseTestOrStarListAsExpression(allowAssignmentExpression, allowMultipleUnpack, errorCategory,
|
2311
|
+
_parseTestOrStarListAsExpression(allowAssignmentExpression, allowMultipleUnpack, errorCategory, getErrorString) {
|
2312
2312
|
if (this._isNextTokenNeverExpression()) {
|
2313
|
-
return this._handleExpressionParseError(errorCategory,
|
2313
|
+
return this._handleExpressionParseError(errorCategory, getErrorString());
|
2314
2314
|
}
|
2315
2315
|
const exprListResult = this._parseTestOrStarExpressionList(allowAssignmentExpression, allowMultipleUnpack);
|
2316
2316
|
if (exprListResult.parseError) {
|
@@ -2979,7 +2979,7 @@ class Parser {
|
|
2979
2979
|
// were a thing in Python 2.x. We'll parse them to improve parse recovery
|
2980
2980
|
// and emit an error.
|
2981
2981
|
this._addError(localize_1.Localizer.Diagnostic.backticksIllegal(), nextToken);
|
2982
|
-
const expressionNode = this._parseTestListAsExpression(2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedExpr());
|
2982
|
+
const expressionNode = this._parseTestListAsExpression(2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedExpr());
|
2983
2983
|
this._consumeTokenIfType(22 /* Backtick */);
|
2984
2984
|
return expressionNode;
|
2985
2985
|
}
|
@@ -3338,7 +3338,7 @@ class Parser {
|
|
3338
3338
|
_parseExpressionStatement() {
|
3339
3339
|
let leftExpr = this._parseTestOrStarListAsExpression(
|
3340
3340
|
/* allowAssignmentExpression */ false,
|
3341
|
-
/* allowMultipleUnpack */ false, 2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedExpr());
|
3341
|
+
/* allowMultipleUnpack */ false, 2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedExpr());
|
3342
3342
|
let annotationExpr;
|
3343
3343
|
if (leftExpr.nodeType === 0 /* Error */) {
|
3344
3344
|
return leftExpr;
|
@@ -3365,7 +3365,7 @@ class Parser {
|
|
3365
3365
|
const rightExpr = this._tryParseYieldExpression() ||
|
3366
3366
|
this._parseTestOrStarListAsExpression(
|
3367
3367
|
/* allowAssignmentExpression */ false,
|
3368
|
-
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedAssignRightHandExpr());
|
3368
|
+
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedAssignRightHandExpr());
|
3369
3369
|
this._isParsingTypeAnnotation = wasParsingTypeAnnotation;
|
3370
3370
|
return parseNodes_1.AssignmentNode.create(leftExpr, rightExpr);
|
3371
3371
|
}
|
@@ -3376,7 +3376,7 @@ class Parser {
|
|
3376
3376
|
if (tokenizer_1.Tokenizer.isOperatorAssignment(this._peekOperatorType())) {
|
3377
3377
|
const operatorToken = this._getNextToken();
|
3378
3378
|
const rightExpr = this._tryParseYieldExpression() ||
|
3379
|
-
this._parseTestListAsExpression(2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedBinaryRightHandExpr());
|
3379
|
+
this._parseTestListAsExpression(2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedBinaryRightHandExpr());
|
3380
3380
|
// Make a shallow copy of the dest expression but give it a new ID.
|
3381
3381
|
const destExpr = Object.assign({}, leftExpr);
|
3382
3382
|
destExpr.id = (0, parseNodes_1.getNextNodeId)();
|
@@ -3393,7 +3393,7 @@ class Parser {
|
|
3393
3393
|
this._tryParseYieldExpression() ||
|
3394
3394
|
this._parseTestOrStarListAsExpression(
|
3395
3395
|
/* allowAssignmentExpression */ false,
|
3396
|
-
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, localize_1.Localizer.Diagnostic.expectedAssignRightHandExpr());
|
3396
|
+
/* allowMultipleUnpack */ true, 2 /* MissingExpression */, () => localize_1.Localizer.Diagnostic.expectedAssignRightHandExpr());
|
3397
3397
|
if (rightExpr.nodeType === 0 /* Error */) {
|
3398
3398
|
break;
|
3399
3399
|
}
|