coc-pyright 1.1.283 → 1.1.284

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.
Files changed (2) hide show
  1. package/lib/index.js +181 -126
  2. package/package.json +3 -3
package/lib/index.js CHANGED
@@ -6053,18 +6053,13 @@ var require_positionUtils = __commonJS({
6053
6053
  character: 0
6054
6054
  };
6055
6055
  }
6056
- let offsetAdjustment = 0;
6057
- if (offset >= lines.end) {
6058
- offset = lines.end - 1;
6059
- offsetAdjustment = 1;
6060
- }
6061
- const itemIndex = lines.getItemContaining(offset);
6062
- (0, debug_1.assert)(itemIndex >= 0 && itemIndex <= lines.length);
6056
+ const itemIndex = offset >= lines.end ? lines.count - 1 : lines.getItemContaining(offset);
6057
+ (0, debug_1.assert)(itemIndex >= 0 && itemIndex <= lines.count);
6063
6058
  const lineRange = lines.getItemAt(itemIndex);
6064
6059
  (0, debug_1.assert)(lineRange !== void 0);
6065
6060
  return {
6066
6061
  line: itemIndex,
6067
- character: offset - lineRange.start + offsetAdjustment
6062
+ character: Math.max(0, Math.min(lineRange.length, offset - lineRange.start))
6068
6063
  };
6069
6064
  }
6070
6065
  exports.convertOffsetToPosition = convertOffsetToPosition;
@@ -14192,9 +14187,9 @@ var init_main2 = __esm({
14192
14187
  DiagnosticSeverity3.Information = 3;
14193
14188
  DiagnosticSeverity3.Hint = 4;
14194
14189
  })(DiagnosticSeverity || (DiagnosticSeverity = {}));
14195
- (function(DiagnosticTag2) {
14196
- DiagnosticTag2.Unnecessary = 1;
14197
- DiagnosticTag2.Deprecated = 2;
14190
+ (function(DiagnosticTag3) {
14191
+ DiagnosticTag3.Unnecessary = 1;
14192
+ DiagnosticTag3.Deprecated = 2;
14198
14193
  })(DiagnosticTag || (DiagnosticTag = {}));
14199
14194
  (function(CodeDescription2) {
14200
14195
  function is(value) {
@@ -20586,6 +20581,7 @@ var require_diagnosticRules = __commonJS({
20586
20581
  DiagnosticRule2["strictListInference"] = "strictListInference";
20587
20582
  DiagnosticRule2["strictSetInference"] = "strictSetInference";
20588
20583
  DiagnosticRule2["strictDictionaryInference"] = "strictDictionaryInference";
20584
+ DiagnosticRule2["analyzeUnannotatedFunctions"] = "analyzeUnannotatedFunctions";
20589
20585
  DiagnosticRule2["strictParameterNoneValue"] = "strictParameterNoneValue";
20590
20586
  DiagnosticRule2["enableTypeIgnoreComments"] = "enableTypeIgnoreComments";
20591
20587
  DiagnosticRule2["reportGeneralTypeIssues"] = "reportGeneralTypeIssues";
@@ -20783,6 +20779,7 @@ var require_configOptions = __commonJS({
20783
20779
  diagnosticRules_1.DiagnosticRule.strictListInference,
20784
20780
  diagnosticRules_1.DiagnosticRule.strictSetInference,
20785
20781
  diagnosticRules_1.DiagnosticRule.strictDictionaryInference,
20782
+ diagnosticRules_1.DiagnosticRule.analyzeUnannotatedFunctions,
20786
20783
  diagnosticRules_1.DiagnosticRule.strictParameterNoneValue
20787
20784
  ];
20788
20785
  if (includeNonOverridable) {
@@ -20872,6 +20869,7 @@ var require_configOptions = __commonJS({
20872
20869
  strictListInference: false,
20873
20870
  strictSetInference: false,
20874
20871
  strictDictionaryInference: false,
20872
+ analyzeUnannotatedFunctions: true,
20875
20873
  strictParameterNoneValue: true,
20876
20874
  enableTypeIgnoreComments: true,
20877
20875
  reportGeneralTypeIssues: "none",
@@ -20950,6 +20948,7 @@ var require_configOptions = __commonJS({
20950
20948
  strictListInference: false,
20951
20949
  strictSetInference: false,
20952
20950
  strictDictionaryInference: false,
20951
+ analyzeUnannotatedFunctions: true,
20953
20952
  strictParameterNoneValue: true,
20954
20953
  enableTypeIgnoreComments: true,
20955
20954
  reportGeneralTypeIssues: "error",
@@ -21028,6 +21027,7 @@ var require_configOptions = __commonJS({
21028
21027
  strictListInference: true,
21029
21028
  strictSetInference: true,
21030
21029
  strictDictionaryInference: true,
21030
+ analyzeUnannotatedFunctions: true,
21031
21031
  strictParameterNoneValue: true,
21032
21032
  enableTypeIgnoreComments: true,
21033
21033
  reportGeneralTypeIssues: "error",
@@ -21108,7 +21108,6 @@ var require_configOptions = __commonJS({
21108
21108
  this.logTypeEvaluationTime = false;
21109
21109
  this.typeEvaluationTimeThreshold = 50;
21110
21110
  this.initializedFromJson = false;
21111
- this.analyzeUnannotatedFunctions = true;
21112
21111
  this.executionEnvironments = [];
21113
21112
  this.projectRoot = projectRoot;
21114
21113
  this.typeCheckingMode = typeCheckingMode;
@@ -24189,7 +24188,7 @@ var require_types = __commonJS({
24189
24188
  }
24190
24189
  }
24191
24190
  UnionType2.addType = addType;
24192
- function containsType(unionType, subtype, recursionCount = 0) {
24191
+ function containsType(unionType, subtype, exclusionSet, recursionCount = 0) {
24193
24192
  if (isClassInstance(subtype) && subtype.condition === void 0 && subtype.literalValue !== void 0) {
24194
24193
  if (ClassType.isBuiltIn(subtype, "str") && unionType.literalStrMap !== void 0) {
24195
24194
  return unionType.literalStrMap.has(subtype.literalValue);
@@ -24197,7 +24196,17 @@ var require_types = __commonJS({
24197
24196
  return unionType.literalIntMap.has(subtype.literalValue);
24198
24197
  }
24199
24198
  }
24200
- return unionType.subtypes.find((t) => isTypeSame(t, subtype, {}, recursionCount)) !== void 0;
24199
+ const foundIndex = unionType.subtypes.findIndex((t, i) => {
24200
+ if (exclusionSet === null || exclusionSet === void 0 ? void 0 : exclusionSet.has(i)) {
24201
+ return false;
24202
+ }
24203
+ return isTypeSame(t, subtype, {}, recursionCount);
24204
+ });
24205
+ if (foundIndex < 0) {
24206
+ return false;
24207
+ }
24208
+ exclusionSet === null || exclusionSet === void 0 ? void 0 : exclusionSet.add(foundIndex);
24209
+ return true;
24201
24210
  }
24202
24211
  UnionType2.containsType = containsType;
24203
24212
  function addTypeAliasSource(unionType, typeAliasSource) {
@@ -24619,7 +24628,8 @@ var require_types = __commonJS({
24619
24628
  if (subtypes1.length !== subtypes2.length) {
24620
24629
  return false;
24621
24630
  }
24622
- return findSubtype(type1, (subtype) => !UnionType.containsType(unionType2, subtype, recursionCount)) === void 0;
24631
+ const exclusionSet = /* @__PURE__ */ new Set();
24632
+ return findSubtype(type1, (subtype) => !UnionType.containsType(unionType2, subtype, exclusionSet, recursionCount)) === void 0;
24623
24633
  }
24624
24634
  case 10: {
24625
24635
  const type2TypeVar = type2;
@@ -25990,7 +26000,7 @@ var require_typeUtils = __commonJS({
25990
26000
  }
25991
26001
  exports.isTupleClass = isTupleClass;
25992
26002
  function isUnboundedTupleClass(type) {
25993
- return type.tupleTypeArguments && type.tupleTypeArguments.some((t) => t.isUnbounded);
26003
+ return type.tupleTypeArguments && type.tupleTypeArguments.some((t) => t.isUnbounded || (0, types_1.isUnpackedVariadicTypeVar)(t.type));
25994
26004
  }
25995
26005
  exports.isUnboundedTupleClass = isUnboundedTupleClass;
25996
26006
  function partiallySpecializeType(type, contextClassType, selfClass, typeClassType) {
@@ -28180,7 +28190,6 @@ var require_package_nls_en_us = __commonJS({
28180
28190
  declaredReturnTypeUnknown: "Declared return type is unknown",
28181
28191
  defaultValueContainsCall: "Function calls and mutable objects not allowed within parameter default value expression",
28182
28192
  defaultValueNotAllowed: 'Parameter with "*" or "**" cannot have default value',
28183
- defaultValueNotEllipsis: 'Default values in stub files should be specified as "..."',
28184
28193
  deprecatedType: 'This type is deprecated as of Python {version}; use "{replacement}" instead',
28185
28194
  delTargetExpr: "Expression cannot be deleted",
28186
28195
  dictExpandIllegalInComprehension: "Dictionary expansion not allowed in comprehension",
@@ -28562,6 +28571,7 @@ var require_package_nls_en_us = __commonJS({
28562
28571
  unaccessedImport: 'Import "{name}" is not accessed',
28563
28572
  unaccessedSymbol: '"{name}" is not accessed',
28564
28573
  unaccessedVariable: 'Variable "{name}" is not accessed',
28574
+ unannotatedFunctionSkipped: 'Analysis of function "{name}" is skipped because it unannotated',
28565
28575
  unexpectedAsyncToken: 'Expected "def", "with" or "for" to follow "async"',
28566
28576
  unexpectedExprToken: "Unexpected token at end of expression",
28567
28577
  unexpectedIndent: "Unexpected indentation",
@@ -29039,7 +29049,6 @@ var require_localize = __commonJS({
29039
29049
  Diagnostic6.declaredReturnTypeUnknown = () => getRawString("Diagnostic.declaredReturnTypeUnknown");
29040
29050
  Diagnostic6.defaultValueContainsCall = () => getRawString("Diagnostic.defaultValueContainsCall");
29041
29051
  Diagnostic6.defaultValueNotAllowed = () => getRawString("Diagnostic.defaultValueNotAllowed");
29042
- Diagnostic6.defaultValueNotEllipsis = () => getRawString("Diagnostic.defaultValueNotEllipsis");
29043
29052
  Diagnostic6.deprecatedType = () => new ParameterizedString(getRawString("Diagnostic.deprecatedType"));
29044
29053
  Diagnostic6.dictExpandIllegalInComprehension = () => getRawString("Diagnostic.dictExpandIllegalInComprehension");
29045
29054
  Diagnostic6.dictInAnnotation = () => getRawString("Diagnostic.dictInAnnotation");
@@ -29421,6 +29430,7 @@ var require_localize = __commonJS({
29421
29430
  Diagnostic6.unaccessedImport = () => new ParameterizedString(getRawString("Diagnostic.unaccessedImport"));
29422
29431
  Diagnostic6.unaccessedSymbol = () => new ParameterizedString(getRawString("Diagnostic.unaccessedSymbol"));
29423
29432
  Diagnostic6.unaccessedVariable = () => new ParameterizedString(getRawString("Diagnostic.unaccessedVariable"));
29433
+ Diagnostic6.unannotatedFunctionSkipped = () => new ParameterizedString(getRawString("Diagnostic.unannotatedFunctionSkipped"));
29424
29434
  Diagnostic6.unexpectedAsyncToken = () => getRawString("Diagnostic.unexpectedAsyncToken");
29425
29435
  Diagnostic6.unexpectedExprToken = () => getRawString("Diagnostic.unexpectedExprToken");
29426
29436
  Diagnostic6.unexpectedIndent = () => getRawString("Diagnostic.unexpectedIndent");
@@ -32389,7 +32399,7 @@ var require_typeDocStringUtils = __commonJS({
32389
32399
  return result;
32390
32400
  };
32391
32401
  Object.defineProperty(exports, "__esModule", { value: true });
32392
- exports.getVariableDocString = exports.getFunctionOrClassDeclDocString = exports.getClassDocString = exports.getModuleDocString = exports.getVariableInStubFileDocStrings = exports.getPropertyDocStringInherited = exports.getOverloadedFunctionDocStringsInherited = exports.getFunctionDocStringInherited = void 0;
32402
+ exports.getVariableDocString = exports.getFunctionOrClassDeclDocString = exports.getClassDocString = exports.getModuleDocString = exports.getModuleNodeDocString = exports.getVariableInStubFileDocStrings = exports.getPropertyDocStringInherited = exports.getOverloadedFunctionDocStringsInherited = exports.getFunctionDocStringInherited = void 0;
32393
32403
  var declaration_1 = require_declaration();
32394
32404
  var ParseTreeUtils = __importStar(require_parseTreeUtils());
32395
32405
  var sourceMapper_1 = require_sourceMapper();
@@ -32483,12 +32493,24 @@ var require_typeDocStringUtils = __commonJS({
32483
32493
  return docStrings;
32484
32494
  }
32485
32495
  exports.getVariableInStubFileDocStrings = getVariableInStubFileDocStrings;
32496
+ function getModuleNodeDocString(modules) {
32497
+ for (const module3 of modules) {
32498
+ if (module3.statements) {
32499
+ const docString = ParseTreeUtils.getDocString(module3.statements);
32500
+ if (docString) {
32501
+ return docString;
32502
+ }
32503
+ }
32504
+ }
32505
+ return void 0;
32506
+ }
32507
+ exports.getModuleNodeDocString = getModuleNodeDocString;
32486
32508
  function getModuleDocString(type, resolvedDecl, sourceMapper) {
32487
32509
  let docString = type.docString;
32488
32510
  if (!docString) {
32489
32511
  if (resolvedDecl && (0, sourceMapper_1.isStubFile)(resolvedDecl.path)) {
32490
32512
  const modules = sourceMapper.findModules(resolvedDecl.path);
32491
- docString = _getModuleNodeDocString(modules);
32513
+ docString = getModuleNodeDocString(modules);
32492
32514
  }
32493
32515
  }
32494
32516
  return docString;
@@ -32622,17 +32644,6 @@ var require_typeDocStringUtils = __commonJS({
32622
32644
  }
32623
32645
  return void 0;
32624
32646
  }
32625
- function _getModuleNodeDocString(modules) {
32626
- for (const module3 of modules) {
32627
- if (module3.statements) {
32628
- const docString = ParseTreeUtils.getDocString(module3.statements);
32629
- if (docString) {
32630
- return docString;
32631
- }
32632
- }
32633
- }
32634
- return void 0;
32635
- }
32636
32647
  }
32637
32648
  });
32638
32649
 
@@ -33038,6 +33049,9 @@ var require_completionProvider = __commonJS({
33038
33049
  return result;
33039
33050
  }
33040
33051
  }
33052
+ if (curNode.nodeType === 31 && this._options.triggerCharacter === "[") {
33053
+ return void 0;
33054
+ }
33041
33055
  if (curNode.nodeType === 22) {
33042
33056
  return this._getImportFromCompletions(curNode, priorWord);
33043
33057
  }
@@ -35055,7 +35069,7 @@ var require_aliasDeclarationUtils = __commonJS({
35055
35069
  let curDeclaration = declaration;
35056
35070
  const alreadyVisited = [];
35057
35071
  let isPrivate = false;
35058
- let isPrivatePyTypedImport = false;
35072
+ let sawPyTypedTransition = false;
35059
35073
  let privatePyTypedImported;
35060
35074
  let privatePyTypedImporter;
35061
35075
  while (true) {
@@ -35116,14 +35130,17 @@ var require_aliasDeclarationUtils = __commonJS({
35116
35130
  } else {
35117
35131
  curDeclaration = declarations[declarations.length - 1];
35118
35132
  }
35119
- if (isPrivatePyTypedImport) {
35120
- privatePyTypedImported = privatePyTypedImported !== null && privatePyTypedImported !== void 0 ? privatePyTypedImported : curDeclaration === null || curDeclaration === void 0 ? void 0 : curDeclaration.moduleName;
35121
- }
35122
- if (symbol.isPrivatePyTypedImport()) {
35123
- isPrivatePyTypedImport = true;
35124
- }
35125
- if (isPrivatePyTypedImport) {
35126
- privatePyTypedImporter = privatePyTypedImporter !== null && privatePyTypedImporter !== void 0 ? privatePyTypedImporter : curDeclaration === null || curDeclaration === void 0 ? void 0 : curDeclaration.moduleName;
35133
+ if (lookupResult === null || lookupResult === void 0 ? void 0 : lookupResult.isInPyTypedPackage) {
35134
+ if (!sawPyTypedTransition) {
35135
+ if (symbol.isPrivatePyTypedImport()) {
35136
+ privatePyTypedImporter = curDeclaration === null || curDeclaration === void 0 ? void 0 : curDeclaration.moduleName;
35137
+ }
35138
+ sawPyTypedTransition = true;
35139
+ } else {
35140
+ if (!symbol.isPrivatePyTypedImport()) {
35141
+ privatePyTypedImported = privatePyTypedImported !== null && privatePyTypedImported !== void 0 ? privatePyTypedImported : curDeclaration === null || curDeclaration === void 0 ? void 0 : curDeclaration.moduleName;
35142
+ }
35143
+ }
35127
35144
  }
35128
35145
  if (alreadyVisited.find((decl) => decl === curDeclaration)) {
35129
35146
  if (curDeclaration.path === declaration.path && curDeclaration.type === 8 && curDeclaration.submoduleFallback) {
@@ -35360,7 +35377,7 @@ var require_documentSymbolProvider = __commonJS({
35360
35377
  if (symbol.isIgnoredForProtocolMatch()) {
35361
35378
  return;
35362
35379
  }
35363
- if (options.indexingForAutoImportMode && !options.forceIndexing && !fileInfo.isStubFile && !fileInfo.isInPyTypedPackage && !symbol.isInDunderAll()) {
35380
+ if (options.indexingForAutoImportMode && !options.includeAllSymbols && !fileInfo.isStubFile && !fileInfo.isInPyTypedPackage && !symbol.isInDunderAll()) {
35364
35381
  return;
35365
35382
  }
35366
35383
  let declaration = (0, symbolUtils_1.getLastTypedDeclaredForSymbol)(symbol);
@@ -35476,6 +35493,7 @@ var require_hoverProvider = __commonJS({
35476
35493
  var vscode_languageserver_1 = require_main3();
35477
35494
  var docStringConversion_1 = require_docStringConversion();
35478
35495
  var ParseTreeUtils = __importStar(require_parseTreeUtils());
35496
+ var typeDocStringUtils_1 = require_typeDocStringUtils();
35479
35497
  var types_1 = require_types();
35480
35498
  var typeUtils_1 = require_typeUtils();
35481
35499
  var cancellationUtils_1 = require_cancellationUtils();
@@ -35634,10 +35652,16 @@ var require_hoverProvider = __commonJS({
35634
35652
  ${(0, tooltipUtils_1.getOverloadedFunctionTooltip)(type, evaluator)}`,
35635
35653
  true
35636
35654
  );
35655
+ } else if ((0, types_1.isFunction)(type)) {
35656
+ this._addResultsPart(
35657
+ parts,
35658
+ `(${label}) ${node.value}${sep}${evaluator.printType(type)}`,
35659
+ true
35660
+ );
35637
35661
  } else {
35638
35662
  this._addResultsPart(
35639
35663
  parts,
35640
- `(${label}) ` + node.value + sep + evaluator.printType(type),
35664
+ `(${label}) ${node.value}: ${evaluator.printType(type)}`,
35641
35665
  true
35642
35666
  );
35643
35667
  }
@@ -35646,8 +35670,7 @@ ${(0, tooltipUtils_1.getOverloadedFunctionTooltip)(type, evaluator)}`,
35646
35670
  break;
35647
35671
  }
35648
35672
  case 8: {
35649
- this._addResultsPart(parts, "(module) " + node.value, true);
35650
- this._addDocumentationPart(format, sourceMapper, parts, node, evaluator, resolvedDecl);
35673
+ this._addModuleParts(format, sourceMapper, parts, node.value, [resolvedDecl.path]);
35651
35674
  break;
35652
35675
  }
35653
35676
  case 4: {
@@ -35757,6 +35780,16 @@ ${(0, tooltipUtils_1.getOverloadedFunctionTooltip)(type, evaluator)}`,
35757
35780
  this._addDocumentationPartForType(format, sourceMapper, parts, type, resolvedDecl, evaluator);
35758
35781
  }
35759
35782
  }
35783
+ static _addModuleParts(format, sourceMapper, parts, name, resolvedPaths) {
35784
+ this._addResultsPart(parts, "(module) " + name, true);
35785
+ const modules = resolvedPaths.map((p) => sourceMapper.findModules(p)).flat();
35786
+ const docString = (0, typeDocStringUtils_1.getModuleNodeDocString)(modules);
35787
+ if (docString) {
35788
+ this._addDocumentationResultsPart(format, parts, docString);
35789
+ return true;
35790
+ }
35791
+ return false;
35792
+ }
35760
35793
  static _addDocumentationPartForType(format, sourceMapper, parts, type, resolvedDecl, evaluator) {
35761
35794
  const docString = (0, tooltipUtils_1.getDocumentationPartsForTypeAndDecl)(sourceMapper, type, resolvedDecl, evaluator);
35762
35795
  if (docString) {
@@ -38276,7 +38309,7 @@ var require_binder = __commonJS({
38276
38309
  node,
38277
38310
  path: pathOfLastSubmodule,
38278
38311
  loadSymbolsFromPath: false,
38279
- range: importAlias ? (0, positionUtils_1.convertTextRangeToRange)(importAlias, this._fileInfo.lines) : (0, textRange_1.getEmptyRange)(),
38312
+ range: (0, textRange_1.getEmptyRange)(),
38280
38313
  usesLocalName: !!importAlias,
38281
38314
  moduleName: importInfo.importName,
38282
38315
  firstNamePart: firstNamePartValue,
@@ -38288,7 +38321,7 @@ var require_binder = __commonJS({
38288
38321
  node,
38289
38322
  path: pathOfLastSubmodule,
38290
38323
  loadSymbolsFromPath: true,
38291
- range: importAlias ? (0, positionUtils_1.convertTextRangeToRange)(importAlias, this._fileInfo.lines) : (0, textRange_1.getEmptyRange)(),
38324
+ range: (0, textRange_1.getEmptyRange)(),
38292
38325
  usesLocalName: !!importAlias,
38293
38326
  moduleName: (_a = importInfo === null || importInfo === void 0 ? void 0 : importInfo.importName) !== null && _a !== void 0 ? _a : "",
38294
38327
  firstNamePart: firstNamePartValue,
@@ -44635,7 +44668,7 @@ var require_importResolver = __commonJS({
44635
44668
  readDir(dirRoot, prefix ? `${prefix}.${entry.name}` : entry.name);
44636
44669
  } else if (entry.name.includes(".py")) {
44637
44670
  const stripped = (0, pathUtils_1.stripFileExtension)(entry.name);
44638
- if (stripped !== "__init__") {
44671
+ if (!stripped.startsWith("_")) {
44639
44672
  cache.add(prefix ? `${prefix}.${stripped}` : stripped);
44640
44673
  }
44641
44674
  }
@@ -51467,6 +51500,7 @@ var require_typeEvaluator = __commonJS({
51467
51500
  var maxEffectiveTypeEvaluationAttempts = 16;
51468
51501
  var maxOverloadUnionExpansionCount = 64;
51469
51502
  var maxInferFunctionReturnRecursionCount = 12;
51503
+ var maxRecursiveTypeAliasRecursionCount = 10;
51470
51504
  var verifyTypeCacheEvaluatorFlags = false;
51471
51505
  var printExpressionTypes = false;
51472
51506
  var maxLiteralMathSubtypeCount = 64;
@@ -51890,7 +51924,7 @@ var require_typeEvaluator = __commonJS({
51890
51924
  }
51891
51925
  }
51892
51926
  if (flags & 65536) {
51893
- if ((0, typeUtils_1.isTypeAliasPlaceholder)(typeResult.type)) {
51927
+ if ((0, types_1.isTypeVar)(typeResult.type) && (0, typeUtils_1.isTypeAliasPlaceholder)(typeResult.type)) {
51894
51928
  typeResult.type.details.illegalRecursionDetected = true;
51895
51929
  }
51896
51930
  }
@@ -53041,6 +53075,13 @@ var require_typeEvaluator = __commonJS({
53041
53075
  if (diagLevel === "none") {
53042
53076
  return void 0;
53043
53077
  }
53078
+ const fileInfo = AnalyzerNodeInfo.getFileInfo(node);
53079
+ if (!fileInfo.diagnosticRuleSet.analyzeUnannotatedFunctions) {
53080
+ const containingFunction = ParseTreeUtils.getEnclosingFunction(node);
53081
+ if (containingFunction && ParseTreeUtils.isUnannotatedFunction(containingFunction) && ParseTreeUtils.isNodeContainedWithin(node, containingFunction.suite)) {
53082
+ return void 0;
53083
+ }
53084
+ }
53044
53085
  const diagnostic = addDiagnosticWithSuppressionCheck(diagLevel, message, node, range);
53045
53086
  if (diagnostic) {
53046
53087
  diagnostic.setRule(rule);
@@ -53724,15 +53765,6 @@ var require_typeEvaluator = __commonJS({
53724
53765
  let type;
53725
53766
  let isIncomplete = false;
53726
53767
  const allowForwardReferences = (flags & 4) !== 0 || fileInfo.isStubFile;
53727
- if (!evaluatorOptions.analyzeUnannotatedFunctions) {
53728
- const containingFunction = ParseTreeUtils.getEnclosingFunction(node);
53729
- if (containingFunction && ParseTreeUtils.isUnannotatedFunction(containingFunction)) {
53730
- return {
53731
- type: types_1.AnyType.create(),
53732
- isIncomplete: false
53733
- };
53734
- }
53735
- }
53736
53768
  const typeParamSymbol = AnalyzerNodeInfo.getTypeParameterSymbol(node);
53737
53769
  if (typeParamSymbol) {
53738
53770
  symbol = typeParamSymbol;
@@ -53752,6 +53784,16 @@ var require_typeEvaluator = __commonJS({
53752
53784
  useCodeFlowAnalysis = false;
53753
53785
  }
53754
53786
  symbol = symbolWithScope.symbol;
53787
+ setSymbolAccessed(fileInfo, symbol, node);
53788
+ if (!fileInfo.diagnosticRuleSet.analyzeUnannotatedFunctions) {
53789
+ const containingFunction = ParseTreeUtils.getEnclosingFunction(node);
53790
+ if (containingFunction && ParseTreeUtils.isUnannotatedFunction(containingFunction)) {
53791
+ return {
53792
+ type: types_1.AnyType.create(),
53793
+ isIncomplete: false
53794
+ };
53795
+ }
53796
+ }
53755
53797
  const effectiveTypeInfo = getEffectiveTypeOfSymbolForUsage(symbol, useCodeFlowAnalysis ? node : void 0);
53756
53798
  let effectiveType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(effectiveTypeInfo.type);
53757
53799
  if (effectiveTypeInfo.isIncomplete) {
@@ -53804,7 +53846,6 @@ var require_typeEvaluator = __commonJS({
53804
53846
  }
53805
53847
  }
53806
53848
  type = reportMissingTypeArguments(node, type, flags);
53807
- setSymbolAccessed(fileInfo, symbol, node);
53808
53849
  if ((flags & 1024) !== 0) {
53809
53850
  if (effectiveTypeInfo.includesVariableDecl && !type.typeAliasInfo) {
53810
53851
  let isAllowedTypeForVariable = (0, types_1.isTypeVar)(type) || (0, typeUtils_1.isTypeAliasPlaceholder)(type);
@@ -55096,7 +55137,7 @@ var require_typeEvaluator = __commonJS({
55096
55137
  if (typeAliasResult) {
55097
55138
  return typeAliasResult;
55098
55139
  }
55099
- if ((0, typeUtils_1.isTypeAliasPlaceholder)(baseTypeResult.type)) {
55140
+ if ((0, types_1.isTypeVar)(baseTypeResult.type) && (0, typeUtils_1.isTypeAliasPlaceholder)(baseTypeResult.type)) {
55100
55141
  const typeArgTypes = getTypeArgs(node, flags).map((t) => (0, typeUtils_1.convertToInstance)(t.type));
55101
55142
  const type2 = types_1.TypeBase.cloneForTypeAlias(baseTypeResult.type, baseTypeResult.type.details.recursiveTypeAliasName, "", baseTypeResult.type.details.recursiveTypeAliasScopeId, baseTypeResult.type.details.recursiveTypeParameters, typeArgTypes);
55102
55143
  return { type: type2 };
@@ -56242,7 +56283,7 @@ var require_typeEvaluator = __commonJS({
56242
56283
  }
56243
56284
  });
56244
56285
  }
56245
- if (!validatedTypes && argList.length > 0) {
56286
+ if (!validatedTypes && argList.some((arg) => arg.argumentCategory === 0)) {
56246
56287
  const isCustomMetaclass = !!type.details.effectiveMetaclass && (0, types_1.isInstantiableClass)(type.details.effectiveMetaclass) && !types_1.ClassType.isBuiltIn(type.details.effectiveMetaclass);
56247
56288
  if (!isCustomMetaclass && !usedMetaclassCallMethod) {
56248
56289
  const fileInfo = AnalyzerNodeInfo.getFileInfo(errorNode);
@@ -57166,8 +57207,8 @@ var require_typeEvaluator = __commonJS({
57166
57207
  const tupleTypeArgs = variadicArgs.map((argParam) => {
57167
57208
  var _a2;
57168
57209
  const argType = getTypeOfArgument(argParam.argument).type;
57169
- const containsVariadicTypeVar = (0, types_1.isUnpackedVariadicTypeVar)(argType) || (0, types_1.isClassInstance)(argType) && (0, typeUtils_1.isTupleClass)(argType) && argType.tupleTypeArguments && argType.tupleTypeArguments.some((arg) => (0, types_1.isUnpackedVariadicTypeVar)(arg.type));
57170
- if (containsVariadicTypeVar && argParam.argument.argumentCategory !== 1) {
57210
+ const containsVariadicTypeVar = (0, types_1.isUnpackedVariadicTypeVar)(argType) || (0, types_1.isClassInstance)(argType) && (0, typeUtils_1.isTupleClass)(argType) && argType.tupleTypeArguments && argType.tupleTypeArguments.length === 1 && (0, types_1.isUnpackedVariadicTypeVar)(argType.tupleTypeArguments[0].type);
57211
+ if (containsVariadicTypeVar && argParam.argument.argumentCategory !== 1 && !argParam.mapsToVarArgList) {
57171
57212
  addDiagnostic(AnalyzerNodeInfo.getFileInfo(errorNode).diagnosticRuleSet.reportGeneralTypeIssues, diagnosticRules_1.DiagnosticRule.reportGeneralTypeIssues, localize_1.Localizer.Diagnostic.typeVarTupleMustBeUnpacked(), (_a2 = argParam.argument.valueExpression) !== null && _a2 !== void 0 ? _a2 : errorNode);
57172
57213
  reportedArgError = true;
57173
57214
  }
@@ -58638,13 +58679,18 @@ var require_typeEvaluator = __commonJS({
58638
58679
  let effectiveExpectedType = expectedType;
58639
58680
  if (expectedType && (0, types_1.isUnion)(expectedType)) {
58640
58681
  let matchingSubtype;
58682
+ let matchingSubtypeResult;
58641
58683
  (0, typeUtils_1.doForEachSubtype)(expectedType, (subtype) => {
58642
- if (!matchingSubtype) {
58643
- const subtypeResult = useSpeculativeMode(node, () => {
58644
- return getTypeOfDictionaryExpected(node, subtype);
58645
- });
58646
- if (subtypeResult && assignType(subtype, subtypeResult.type)) {
58684
+ if (matchingSubtypeResult && !matchingSubtypeResult.typeErrors) {
58685
+ return;
58686
+ }
58687
+ const subtypeResult = useSpeculativeMode(node, () => {
58688
+ return getTypeOfDictionaryExpected(node, subtype);
58689
+ });
58690
+ if (subtypeResult && assignType(subtype, subtypeResult.type)) {
58691
+ if (!matchingSubtypeResult || matchingSubtypeResult.typeErrors && !subtypeResult.typeErrors) {
58647
58692
  matchingSubtype = subtype;
58693
+ matchingSubtypeResult = subtypeResult;
58648
58694
  }
58649
58695
  }
58650
58696
  });
@@ -58914,13 +58960,18 @@ var require_typeEvaluator = __commonJS({
58914
58960
  let effectiveExpectedType = expectedType;
58915
58961
  if (expectedType && (0, types_1.isUnion)(expectedType)) {
58916
58962
  let matchingSubtype;
58963
+ let matchingSubtypeResult;
58917
58964
  (0, typeUtils_1.doForEachSubtype)(expectedType, (subtype) => {
58918
- if (!matchingSubtype) {
58919
- const subtypeResult = useSpeculativeMode(node, () => {
58920
- return getTypeOfListOrSetExpected(node, subtype);
58921
- });
58922
- if (subtypeResult && assignType(subtype, subtypeResult.type)) {
58965
+ if (matchingSubtypeResult && !matchingSubtypeResult.typeErrors) {
58966
+ return;
58967
+ }
58968
+ const subtypeResult = useSpeculativeMode(node, () => {
58969
+ return getTypeOfListOrSetExpected(node, subtype);
58970
+ });
58971
+ if (subtypeResult && assignType(subtype, subtypeResult.type)) {
58972
+ if (!matchingSubtypeResult || matchingSubtypeResult.typeErrors && !subtypeResult.typeErrors) {
58923
58973
  matchingSubtype = subtype;
58974
+ matchingSubtypeResult = subtypeResult;
58924
58975
  }
58925
58976
  }
58926
58977
  });
@@ -63655,6 +63706,7 @@ var require_typeEvaluator = __commonJS({
63655
63706
  var _a;
63656
63707
  let returnType;
63657
63708
  let isIncomplete = false;
63709
+ let analyzeUnannotatedFunctions = true;
63658
63710
  if (types_1.FunctionType.isStubDefinition(type)) {
63659
63711
  return types_1.UnknownType.create();
63660
63712
  }
@@ -63665,7 +63717,8 @@ var require_typeEvaluator = __commonJS({
63665
63717
  returnType = types_1.NoneType.createInstance();
63666
63718
  } else if (type.details.declaration) {
63667
63719
  const functionNode = type.details.declaration.node;
63668
- if (evaluatorOptions.analyzeUnannotatedFunctions && !checkCodeFlowTooComplex(functionNode.suite)) {
63720
+ analyzeUnannotatedFunctions = AnalyzerNodeInfo.getFileInfo(functionNode).diagnosticRuleSet.analyzeUnannotatedFunctions;
63721
+ if (analyzeUnannotatedFunctions && !checkCodeFlowTooComplex(functionNode.suite)) {
63669
63722
  const codeFlowComplexity = AnalyzerNodeInfo.getCodeFlowComplexity(functionNode);
63670
63723
  const parametersAreAnnotated = type.details.parameters.length <= 1 || type.details.parameters.some((param) => param.hasDeclaredType);
63671
63724
  if (parametersAreAnnotated || codeFlowComplexity < maxReturnTypeInferenceCodeFlowComplexity) {
@@ -63690,7 +63743,7 @@ var require_typeEvaluator = __commonJS({
63690
63743
  type.inferredReturnType = returnType;
63691
63744
  }
63692
63745
  }
63693
- if (!isIncomplete && evaluatorOptions.analyzeUnannotatedFunctions && (0, typeUtils_1.isPartlyUnknown)(returnType) && types_1.FunctionType.hasUnannotatedParams(type) && !types_1.FunctionType.isStubDefinition(type) && !types_1.FunctionType.isPyTypedDefinition(type) && args) {
63746
+ if (!isIncomplete && analyzeUnannotatedFunctions && (0, typeUtils_1.isPartlyUnknown)(returnType) && types_1.FunctionType.hasUnannotatedParams(type) && !types_1.FunctionType.isStubDefinition(type) && !types_1.FunctionType.isPyTypedDefinition(type) && args) {
63694
63747
  const contextualReturnType = getFunctionInferredReturnTypeUsingArguments(type, args);
63695
63748
  if (contextualReturnType) {
63696
63749
  returnType = contextualReturnType;
@@ -64237,8 +64290,15 @@ var require_typeEvaluator = __commonJS({
64237
64290
  flags |= 2048;
64238
64291
  }
64239
64292
  }
64240
- destType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(destType);
64241
- srcType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(srcType);
64293
+ const transformedDestType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(destType);
64294
+ const transformedSrcType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(srcType);
64295
+ if (transformedDestType !== destType && transformedSrcType !== srcType && (0, types_1.isUnion)(transformedDestType) && (0, types_1.isUnion)(transformedSrcType)) {
64296
+ if (recursionCount > maxRecursiveTypeAliasRecursionCount) {
64297
+ return true;
64298
+ }
64299
+ }
64300
+ destType = transformedDestType;
64301
+ srcType = transformedSrcType;
64242
64302
  if ((0, types_1.isUnbound)(destType) || (0, types_1.isUnbound)(srcType)) {
64243
64303
  return true;
64244
64304
  }
@@ -64427,19 +64487,21 @@ var require_typeEvaluator = __commonJS({
64427
64487
  return types_1.TypeBase.isInstantiable(destType);
64428
64488
  }
64429
64489
  instantiableType = (0, typeUtils_1.convertToInstantiable)(typeTypeArg);
64430
- } else {
64490
+ } else if (types_1.TypeBase.isInstantiable(destType)) {
64431
64491
  typeTypeArg = objectType !== null && objectType !== void 0 ? objectType : types_1.AnyType.create();
64432
64492
  instantiableType = expandedSrcType;
64433
64493
  }
64434
- if ((0, types_1.isClassInstance)(typeTypeArg) || (0, types_1.isTypeVar)(typeTypeArg)) {
64435
- if (assignType(destType, instantiableType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
64436
- return true;
64494
+ if (instantiableType && typeTypeArg) {
64495
+ if ((0, types_1.isClassInstance)(typeTypeArg) || (0, types_1.isTypeVar)(typeTypeArg)) {
64496
+ if (assignType(destType, instantiableType, diag === null || diag === void 0 ? void 0 : diag.createAddendum(), destTypeVarContext, srcTypeVarContext, flags, recursionCount)) {
64497
+ return true;
64498
+ }
64499
+ diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({
64500
+ sourceType: printType(srcType),
64501
+ destType: printType(destType)
64502
+ }));
64503
+ return false;
64437
64504
  }
64438
- diag === null || diag === void 0 ? void 0 : diag.addMessage(localize_1.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({
64439
- sourceType: printType(srcType),
64440
- destType: printType(destType)
64441
- }));
64442
- return false;
64443
64505
  }
64444
64506
  }
64445
64507
  if ((0, types_1.isInstantiableClass)(destType)) {
@@ -64877,7 +64939,7 @@ var require_typeEvaluator = __commonJS({
64877
64939
  let bestDestTypeVarContext;
64878
64940
  let bestSrcTypeVarContext;
64879
64941
  let bestTypeVarContextScore;
64880
- if ((0, types_1.isClassInstance)(srcType) && (0, typeUtils_1.isLiteralType)(srcType) && types_1.UnionType.containsType(destType, srcType, recursionCount)) {
64942
+ if ((0, types_1.isClassInstance)(srcType) && (0, typeUtils_1.isLiteralType)(srcType) && types_1.UnionType.containsType(destType, srcType, void 0, recursionCount)) {
64881
64943
  return true;
64882
64944
  }
64883
64945
  (0, typeUtils_1.doForEachSubtype)(destType, (subtype) => {
@@ -65882,7 +65944,7 @@ var require_typeEvaluator = __commonJS({
65882
65944
  if ((0, types_1.isAnyOrUnknown)(srcType)) {
65883
65945
  return srcType;
65884
65946
  }
65885
- let effectiveSrcType = srcType;
65947
+ let effectiveSrcType = (0, typeUtils_1.transformPossibleRecursiveTypeAlias)(srcType);
65886
65948
  if ((0, types_1.isTypeVar)(srcType)) {
65887
65949
  if ((0, types_1.isTypeSame)(srcType, destType)) {
65888
65950
  return srcType;
@@ -65892,7 +65954,7 @@ var require_typeEvaluator = __commonJS({
65892
65954
  if ((0, types_1.isClass)(effectiveSrcType) && types_1.ClassType.isPartiallyEvaluated(effectiveSrcType)) {
65893
65955
  return srcType;
65894
65956
  }
65895
- if (destType.details.boundType) {
65957
+ if (destType.details.boundType && !(0, typeUtils_1.isTypeAliasPlaceholder)(effectiveSrcType)) {
65896
65958
  if (!assignType(
65897
65959
  destType.details.boundType,
65898
65960
  effectiveSrcType,
@@ -65934,6 +65996,9 @@ var require_typeEvaluator = __commonJS({
65934
65996
  if (constraints.length === 0) {
65935
65997
  return srcType;
65936
65998
  }
65999
+ if ((0, typeUtils_1.isTypeAliasPlaceholder)(srcType)) {
66000
+ return srcType;
66001
+ }
65937
66002
  if ((0, types_1.isTypeVar)(srcType) && srcType.details.constraints.length > 0) {
65938
66003
  if (srcType.details.constraints.every((sourceConstraint) => {
65939
66004
  return constraints.some((destConstraint) => assignType(destConstraint, sourceConstraint));
@@ -66471,6 +66536,11 @@ var require_checker = __commonJS({
66471
66536
  if (node.typeParameters) {
66472
66537
  this.walk(node.typeParameters);
66473
66538
  }
66539
+ if (!this._fileInfo.diagnosticRuleSet.analyzeUnannotatedFunctions && !this._fileInfo.isStubFile) {
66540
+ if (ParseTreeUtils.isUnannotatedFunction(node)) {
66541
+ this._evaluator.addInformation(localize_1.Localizer.Diagnostic.unannotatedFunctionSkipped().format({ name: node.name.value }), node.name);
66542
+ }
66543
+ }
66474
66544
  const functionTypeResult = this._evaluator.getTypeOfFunction(node);
66475
66545
  const containingClassNode = ParseTreeUtils.getEnclosingClass(node, true);
66476
66546
  if (functionTypeResult) {
@@ -66523,12 +66593,6 @@ var require_checker = __commonJS({
66523
66593
  }
66524
66594
  }
66525
66595
  }
66526
- if (param.defaultValue && this._fileInfo.isStubFile) {
66527
- const defaultValueType = this._evaluator.getType(param.defaultValue);
66528
- if (!defaultValueType || !(0, typeUtils_1.isEllipsisType)(defaultValueType)) {
66529
- this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidStubStatement, diagnosticRules_1.DiagnosticRule.reportInvalidStubStatement, localize_1.Localizer.Diagnostic.defaultValueNotEllipsis(), param.defaultValue);
66530
- }
66531
- }
66532
66596
  });
66533
66597
  const paramSpecParams = functionTypeResult.functionType.details.parameters.filter((param) => {
66534
66598
  if (param.typeAnnotation && (0, types_1.isTypeVar)(param.type) && (0, types_1.isParamSpec)(param.type)) {
@@ -68434,9 +68498,14 @@ var require_checker = __commonJS({
68434
68498
  }
68435
68499
  }
68436
68500
  _conditionallyReportShadowedImport(node) {
68501
+ var _a, _b;
68437
68502
  if (this._fileInfo.diagnosticRuleSet.reportShadowedImports === "none") {
68438
68503
  return;
68439
68504
  }
68505
+ const nodeModule = node.nodeType === 23 ? ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.nodeType) === 22 ? (_b = node.parent) === null || _b === void 0 ? void 0 : _b.module : void 0 : node.module;
68506
+ if (nodeModule === null || nodeModule === void 0 ? void 0 : nodeModule.leadingDots) {
68507
+ return;
68508
+ }
68440
68509
  const namePartNodes = node.nodeType === 21 ? node.module.nameParts : node.nodeType === 23 ? [node.name] : node.module.nameParts;
68441
68510
  const nameParts = namePartNodes.map((n) => n.value);
68442
68511
  const module3 = {
@@ -71569,9 +71638,7 @@ var require_tokenizer = __commonJS({
71569
71638
  }
71570
71639
  _addLineRange() {
71571
71640
  const lineLength = this._cs.position - this._prevLineStart;
71572
- if (lineLength > 0) {
71573
- this._lineRanges.push({ start: this._prevLineStart, length: lineLength });
71574
- }
71641
+ this._lineRanges.push({ start: this._prevLineStart, length: lineLength });
71575
71642
  this._prevLineStart = this._cs.position;
71576
71643
  }
71577
71644
  _handleNewLine(length, newLineType) {
@@ -71983,22 +72050,17 @@ var require_tokenizer = __commonJS({
71983
72050
  this._addComments(comment);
71984
72051
  }
71985
72052
  _handleComment() {
71986
- var _a, _b;
71987
72053
  const start = this._cs.position + 1;
71988
72054
  this._cs.skipToEol();
71989
72055
  const length = this._cs.position - start;
71990
72056
  const value = this._cs.getText().substring(start, start + length);
71991
72057
  const comment = tokenizerTypes_1.Comment.create(start, length, value);
71992
- const typeIgnoreRegexMatch = value.match(/((^|#)\s*)type:\s*ignore(\s*\[([\s*\w-,]*)\]|\s|$)/);
72058
+ const typeIgnoreRegexMatch = value.match(/^\s*type:\s*ignore(\s*\[([\s*\w-,]*)\]|\s|$)/);
71993
72059
  if (typeIgnoreRegexMatch) {
71994
- const commentStart = start + ((_a = typeIgnoreRegexMatch.index) !== null && _a !== void 0 ? _a : 0);
71995
- const textRange = {
71996
- start: commentStart + typeIgnoreRegexMatch[1].length,
71997
- length: typeIgnoreRegexMatch[0].length - typeIgnoreRegexMatch[1].length
71998
- };
72060
+ const textRange = { start, length: typeIgnoreRegexMatch[0].length };
71999
72061
  const ignoreComment = {
72000
72062
  range: textRange,
72001
- rulesList: this._getIgnoreCommentRulesList(commentStart, typeIgnoreRegexMatch)
72063
+ rulesList: this._getIgnoreCommentRulesList(start, typeIgnoreRegexMatch)
72002
72064
  };
72003
72065
  if (this._tokens.findIndex((t) => t.type !== 2 && t && t.type !== 3) < 0) {
72004
72066
  this._typeIgnoreAll = ignoreComment;
@@ -72006,26 +72068,22 @@ var require_tokenizer = __commonJS({
72006
72068
  this._typeIgnoreLines.set(this._lineRanges.length, ignoreComment);
72007
72069
  }
72008
72070
  }
72009
- const pyrightIgnoreRegexMatch = value.match(/((^|#)\s*)pyright:\s*ignore(\s*\[([\s*\w-,]*)\]|\s|$)/);
72071
+ const pyrightIgnoreRegexMatch = value.match(/^\s*pyright:\s*ignore(\s*\[([\s*\w-,]*)\]|\s|$)/);
72010
72072
  if (pyrightIgnoreRegexMatch) {
72011
- const commentStart = start + ((_b = pyrightIgnoreRegexMatch.index) !== null && _b !== void 0 ? _b : 0);
72012
- const textRange = {
72013
- start: commentStart + pyrightIgnoreRegexMatch[1].length,
72014
- length: pyrightIgnoreRegexMatch[0].length - pyrightIgnoreRegexMatch[1].length
72015
- };
72073
+ const textRange = { start, length: pyrightIgnoreRegexMatch[0].length };
72016
72074
  const ignoreComment = {
72017
72075
  range: textRange,
72018
- rulesList: this._getIgnoreCommentRulesList(commentStart, pyrightIgnoreRegexMatch)
72076
+ rulesList: this._getIgnoreCommentRulesList(start, pyrightIgnoreRegexMatch)
72019
72077
  };
72020
72078
  this._pyrightIgnoreLines.set(this._lineRanges.length, ignoreComment);
72021
72079
  }
72022
72080
  this._addComments(comment);
72023
72081
  }
72024
72082
  _getIgnoreCommentRulesList(start, match) {
72025
- if (match.length < 5 || match[4] === void 0) {
72083
+ if (match.length < 3 || match[2] === void 0) {
72026
72084
  return void 0;
72027
72085
  }
72028
- const splitElements = match[4].split(",");
72086
+ const splitElements = match[2].split(",");
72029
72087
  const commentRules = [];
72030
72088
  let currentOffset = start + match[0].indexOf("[") + 1;
72031
72089
  for (const element of splitElements) {
@@ -73114,14 +73172,15 @@ var require_parser = __commonJS({
73114
73172
  if (postColonCallback) {
73115
73173
  postColonCallback();
73116
73174
  }
73175
+ let bodyIndentToken;
73117
73176
  const possibleIndent = this._peekToken();
73118
73177
  if (!this._consumeTokenIfType(3)) {
73119
73178
  this._addError(localize_1.Localizer.Diagnostic.expectedIndentedBlock(), this._peekToken());
73120
- return suite;
73121
- }
73122
- const bodyIndentToken = possibleIndent;
73123
- if (bodyIndentToken.isIndentAmbiguous) {
73124
- this._addError(localize_1.Localizer.Diagnostic.inconsistentTabs(), bodyIndentToken);
73179
+ } else {
73180
+ bodyIndentToken = possibleIndent;
73181
+ if (bodyIndentToken.isIndentAmbiguous) {
73182
+ this._addError(localize_1.Localizer.Diagnostic.inconsistentTabs(), bodyIndentToken);
73183
+ }
73125
73184
  }
73126
73185
  while (true) {
73127
73186
  const nextToken2 = this._peekToken();
@@ -73148,12 +73207,6 @@ var require_parser = __commonJS({
73148
73207
  }
73149
73208
  if (!bodyIndentToken || dedentToken.indentAmount < bodyIndentToken.indentAmount) {
73150
73209
  break;
73151
- } else if (dedentToken.indentAmount === bodyIndentToken.indentAmount) {
73152
- const nextToken3 = this._peekToken();
73153
- if (this._consumeTokenIfType(4)) {
73154
- (0, parseNodes_1.extendRange)(suite, nextToken3);
73155
- break;
73156
- }
73157
73210
  }
73158
73211
  }
73159
73212
  const statement = this._parseStatement();
@@ -93196,7 +93249,7 @@ var ImportCompletionProvider = class {
93196
93249
  return [];
93197
93250
  const items = [];
93198
93251
  for (const o of result.items) {
93199
- items.push({ label: o.word, sortText: o.sortText, kind: import_coc10.CompletionItemKind.Module, filterText: o.filterText });
93252
+ items.push({ label: o.label || o.word, sortText: o.sortText, kind: import_coc10.CompletionItemKind.Module, filterText: o.filterText });
93200
93253
  }
93201
93254
  return items;
93202
93255
  }
@@ -94042,6 +94095,7 @@ var Ruff = class extends BaseLinter {
94042
94095
  message: msg.message,
94043
94096
  type: "",
94044
94097
  severity: 2 /* Warning */,
94098
+ tags: ["F401", "F841"].includes(msg.code) ? [import_coc24.DiagnosticTag.Unnecessary] : [],
94045
94099
  provider: this.info.id,
94046
94100
  file: msg.filename,
94047
94101
  fix: this.fixToWorkspaceEdit(msg.filename, msg.fix)
@@ -94176,6 +94230,7 @@ var LintingEngine = class {
94176
94230
  diagnostic.code = message.code;
94177
94231
  diagnostic.source = message.provider;
94178
94232
  diagnostic.fix = message.fix;
94233
+ diagnostic.tags = message.tags;
94179
94234
  return diagnostic;
94180
94235
  }
94181
94236
  shouldLintDocument(document) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-pyright",
3
- "version": "1.1.283",
3
+ "version": "1.1.284",
4
4
  "description": "Pyright extension for coc.nvim, static type checker for Python",
5
5
  "author": "Heyward Fann <fannheyward@gmail.com>",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  "@types/which": "^2.0.0",
45
45
  "@typescript-eslint/eslint-plugin": "^5.6.0",
46
46
  "@typescript-eslint/parser": "^5.6.0",
47
- "@zzzen/pyright-internal": "^1.2.0-dev.20221204",
47
+ "@zzzen/pyright-internal": "^1.2.0-dev.20221211",
48
48
  "coc.nvim": "^0.0.82",
49
49
  "diff-match-patch": "^1.0.5",
50
50
  "esbuild": "^0.15.6",
@@ -1526,6 +1526,6 @@
1526
1526
  ]
1527
1527
  },
1528
1528
  "dependencies": {
1529
- "pyright": "^1.1.283"
1529
+ "pyright": "^1.1.284"
1530
1530
  }
1531
1531
  }