coc-pyright 1.1.291 → 1.1.292
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/lib/index.js +695 -511
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -6580,7 +6580,6 @@ var require_parseNodes = __commonJS({
|
|
|
6580
6580
|
case 27:
|
|
6581
6581
|
case 48:
|
|
6582
6582
|
case 15:
|
|
6583
|
-
case 16:
|
|
6584
6583
|
case 31:
|
|
6585
6584
|
case 45:
|
|
6586
6585
|
return true;
|
|
@@ -7692,6 +7691,425 @@ var require_parseNodes = __commonJS({
|
|
|
7692
7691
|
}
|
|
7693
7692
|
});
|
|
7694
7693
|
|
|
7694
|
+
// node_modules/@zzzen/pyright-internal/dist/parser/stringTokenUtils.js
|
|
7695
|
+
var require_stringTokenUtils = __commonJS({
|
|
7696
|
+
"node_modules/@zzzen/pyright-internal/dist/parser/stringTokenUtils.js"(exports) {
|
|
7697
|
+
"use strict";
|
|
7698
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7699
|
+
exports.getUnescapedString = exports.UnescapeErrorType = void 0;
|
|
7700
|
+
var UnescapeErrorType;
|
|
7701
|
+
(function(UnescapeErrorType2) {
|
|
7702
|
+
UnescapeErrorType2[UnescapeErrorType2["InvalidEscapeSequence"] = 0] = "InvalidEscapeSequence";
|
|
7703
|
+
UnescapeErrorType2[UnescapeErrorType2["EscapeWithinFormatExpression"] = 1] = "EscapeWithinFormatExpression";
|
|
7704
|
+
UnescapeErrorType2[UnescapeErrorType2["SingleCloseBraceWithinFormatLiteral"] = 2] = "SingleCloseBraceWithinFormatLiteral";
|
|
7705
|
+
UnescapeErrorType2[UnescapeErrorType2["UnterminatedFormatExpression"] = 3] = "UnterminatedFormatExpression";
|
|
7706
|
+
})(UnescapeErrorType = exports.UnescapeErrorType || (exports.UnescapeErrorType = {}));
|
|
7707
|
+
function completeUnescapedString(incomplete) {
|
|
7708
|
+
return {
|
|
7709
|
+
...incomplete,
|
|
7710
|
+
value: incomplete.valueParts.join(""),
|
|
7711
|
+
formatStringSegments: incomplete.formatStringSegments.map((segment) => ({
|
|
7712
|
+
...segment,
|
|
7713
|
+
value: segment.valueParts.join("")
|
|
7714
|
+
}))
|
|
7715
|
+
};
|
|
7716
|
+
}
|
|
7717
|
+
function getUnescapedString(stringToken) {
|
|
7718
|
+
const escapedString = stringToken.escapedValue;
|
|
7719
|
+
const isRaw = (stringToken.flags & 8) !== 0;
|
|
7720
|
+
const isFormat = (stringToken.flags & 64) !== 0;
|
|
7721
|
+
if (isRaw && !isFormat) {
|
|
7722
|
+
return {
|
|
7723
|
+
value: escapedString,
|
|
7724
|
+
unescapeErrors: [],
|
|
7725
|
+
nonAsciiInBytes: false,
|
|
7726
|
+
formatStringSegments: []
|
|
7727
|
+
};
|
|
7728
|
+
}
|
|
7729
|
+
const charCodes = [];
|
|
7730
|
+
for (let index = 0; index < escapedString.length; index++) {
|
|
7731
|
+
charCodes.push(escapedString.charCodeAt(index));
|
|
7732
|
+
}
|
|
7733
|
+
const isBytes = (stringToken.flags & 32) !== 0;
|
|
7734
|
+
if (!isFormat) {
|
|
7735
|
+
if (!charCodes.some((curChar) => curChar === 13 || curChar === 10 || curChar === 92)) {
|
|
7736
|
+
return {
|
|
7737
|
+
value: escapedString,
|
|
7738
|
+
unescapeErrors: [],
|
|
7739
|
+
nonAsciiInBytes: isBytes && charCodes.some((curChar) => curChar >= 128),
|
|
7740
|
+
formatStringSegments: []
|
|
7741
|
+
};
|
|
7742
|
+
}
|
|
7743
|
+
}
|
|
7744
|
+
let formatExpressionNestCount = 0;
|
|
7745
|
+
let formatSegment = {
|
|
7746
|
+
offset: 0,
|
|
7747
|
+
length: 0,
|
|
7748
|
+
valueParts: [],
|
|
7749
|
+
isExpression: false,
|
|
7750
|
+
hasFormatSpecifier: false
|
|
7751
|
+
};
|
|
7752
|
+
let strOffset = 0;
|
|
7753
|
+
const output = {
|
|
7754
|
+
valueParts: [],
|
|
7755
|
+
unescapeErrors: [],
|
|
7756
|
+
nonAsciiInBytes: false,
|
|
7757
|
+
formatStringSegments: []
|
|
7758
|
+
};
|
|
7759
|
+
const addInvalidEscapeOffset = () => {
|
|
7760
|
+
if (!isRaw) {
|
|
7761
|
+
output.unescapeErrors.push({
|
|
7762
|
+
offset: strOffset - 1,
|
|
7763
|
+
length: 2,
|
|
7764
|
+
errorType: 0
|
|
7765
|
+
});
|
|
7766
|
+
}
|
|
7767
|
+
};
|
|
7768
|
+
const getEscapedCharacter = (offset = 0) => {
|
|
7769
|
+
if (strOffset + offset >= charCodes.length) {
|
|
7770
|
+
return 3;
|
|
7771
|
+
}
|
|
7772
|
+
return charCodes[strOffset + offset];
|
|
7773
|
+
};
|
|
7774
|
+
const scanHexEscape = (digitCount) => {
|
|
7775
|
+
let foundIllegalHexDigit = false;
|
|
7776
|
+
let hexValue = 0;
|
|
7777
|
+
let localValue = "";
|
|
7778
|
+
for (let i = 0; i < digitCount; i++) {
|
|
7779
|
+
const charCode = getEscapedCharacter(1 + i);
|
|
7780
|
+
if (!_isHexCharCode(charCode)) {
|
|
7781
|
+
foundIllegalHexDigit = true;
|
|
7782
|
+
break;
|
|
7783
|
+
}
|
|
7784
|
+
hexValue = 16 * hexValue + _getHexDigitValue(charCode);
|
|
7785
|
+
}
|
|
7786
|
+
if (foundIllegalHexDigit) {
|
|
7787
|
+
addInvalidEscapeOffset();
|
|
7788
|
+
localValue = "\\" + String.fromCharCode(getEscapedCharacter());
|
|
7789
|
+
strOffset++;
|
|
7790
|
+
} else {
|
|
7791
|
+
localValue = String.fromCharCode(hexValue);
|
|
7792
|
+
strOffset += 1 + digitCount;
|
|
7793
|
+
}
|
|
7794
|
+
return localValue;
|
|
7795
|
+
};
|
|
7796
|
+
const appendOutputChar = (charCode) => {
|
|
7797
|
+
const char = String.fromCharCode(charCode);
|
|
7798
|
+
output.valueParts.push(char);
|
|
7799
|
+
formatSegment.valueParts.push(char);
|
|
7800
|
+
};
|
|
7801
|
+
while (true) {
|
|
7802
|
+
let curChar = getEscapedCharacter();
|
|
7803
|
+
if (curChar === 3) {
|
|
7804
|
+
if (isFormat) {
|
|
7805
|
+
if (formatSegment.isExpression) {
|
|
7806
|
+
output.unescapeErrors.push({
|
|
7807
|
+
offset: formatSegment.offset,
|
|
7808
|
+
length: strOffset - formatSegment.offset,
|
|
7809
|
+
errorType: 3
|
|
7810
|
+
});
|
|
7811
|
+
}
|
|
7812
|
+
if (strOffset !== formatSegment.offset) {
|
|
7813
|
+
formatSegment.length = strOffset - formatSegment.offset;
|
|
7814
|
+
output.formatStringSegments.push(formatSegment);
|
|
7815
|
+
}
|
|
7816
|
+
}
|
|
7817
|
+
return completeUnescapedString(output);
|
|
7818
|
+
}
|
|
7819
|
+
if (curChar === 92) {
|
|
7820
|
+
if (isFormat && formatSegment.isExpression && !formatSegment.hasFormatSpecifier) {
|
|
7821
|
+
output.unescapeErrors.push({
|
|
7822
|
+
offset: strOffset,
|
|
7823
|
+
length: 1,
|
|
7824
|
+
errorType: 1
|
|
7825
|
+
});
|
|
7826
|
+
}
|
|
7827
|
+
strOffset++;
|
|
7828
|
+
if (isRaw) {
|
|
7829
|
+
appendOutputChar(curChar);
|
|
7830
|
+
continue;
|
|
7831
|
+
}
|
|
7832
|
+
curChar = getEscapedCharacter();
|
|
7833
|
+
let localValue = "";
|
|
7834
|
+
if (curChar === 13 || curChar === 10) {
|
|
7835
|
+
if (curChar === 13 && getEscapedCharacter(1) === 10) {
|
|
7836
|
+
if (isRaw) {
|
|
7837
|
+
localValue += String.fromCharCode(curChar);
|
|
7838
|
+
}
|
|
7839
|
+
strOffset++;
|
|
7840
|
+
curChar = getEscapedCharacter();
|
|
7841
|
+
}
|
|
7842
|
+
if (isRaw) {
|
|
7843
|
+
localValue = "\\" + localValue + String.fromCharCode(curChar);
|
|
7844
|
+
}
|
|
7845
|
+
strOffset++;
|
|
7846
|
+
} else {
|
|
7847
|
+
if (isRaw || isFormat && formatSegment.isExpression) {
|
|
7848
|
+
localValue = "\\" + String.fromCharCode(curChar);
|
|
7849
|
+
strOffset++;
|
|
7850
|
+
} else {
|
|
7851
|
+
switch (curChar) {
|
|
7852
|
+
case 92:
|
|
7853
|
+
case 39:
|
|
7854
|
+
case 34:
|
|
7855
|
+
localValue = String.fromCharCode(curChar);
|
|
7856
|
+
strOffset++;
|
|
7857
|
+
break;
|
|
7858
|
+
case 97:
|
|
7859
|
+
localValue = "\x07";
|
|
7860
|
+
strOffset++;
|
|
7861
|
+
break;
|
|
7862
|
+
case 98:
|
|
7863
|
+
localValue = "\b";
|
|
7864
|
+
strOffset++;
|
|
7865
|
+
break;
|
|
7866
|
+
case 102:
|
|
7867
|
+
localValue = "\f";
|
|
7868
|
+
strOffset++;
|
|
7869
|
+
break;
|
|
7870
|
+
case 110:
|
|
7871
|
+
localValue = "\n";
|
|
7872
|
+
strOffset++;
|
|
7873
|
+
break;
|
|
7874
|
+
case 114:
|
|
7875
|
+
localValue = "\r";
|
|
7876
|
+
strOffset++;
|
|
7877
|
+
break;
|
|
7878
|
+
case 116:
|
|
7879
|
+
localValue = " ";
|
|
7880
|
+
strOffset++;
|
|
7881
|
+
break;
|
|
7882
|
+
case 118:
|
|
7883
|
+
localValue = "\v";
|
|
7884
|
+
strOffset++;
|
|
7885
|
+
break;
|
|
7886
|
+
case 120:
|
|
7887
|
+
localValue = scanHexEscape(2);
|
|
7888
|
+
break;
|
|
7889
|
+
case 78: {
|
|
7890
|
+
let foundIllegalChar = false;
|
|
7891
|
+
let charCount = 1;
|
|
7892
|
+
if (getEscapedCharacter(charCount) !== 123) {
|
|
7893
|
+
foundIllegalChar = true;
|
|
7894
|
+
} else {
|
|
7895
|
+
charCount++;
|
|
7896
|
+
while (true) {
|
|
7897
|
+
const lookaheadChar = getEscapedCharacter(charCount);
|
|
7898
|
+
if (lookaheadChar === 125) {
|
|
7899
|
+
break;
|
|
7900
|
+
} else if (!_isAlphaNumericChar(lookaheadChar) && lookaheadChar !== 45 && !_isWhitespaceChar(lookaheadChar)) {
|
|
7901
|
+
foundIllegalChar = true;
|
|
7902
|
+
break;
|
|
7903
|
+
} else {
|
|
7904
|
+
charCount++;
|
|
7905
|
+
}
|
|
7906
|
+
}
|
|
7907
|
+
}
|
|
7908
|
+
if (foundIllegalChar) {
|
|
7909
|
+
addInvalidEscapeOffset();
|
|
7910
|
+
localValue = "\\" + String.fromCharCode(curChar);
|
|
7911
|
+
strOffset++;
|
|
7912
|
+
} else {
|
|
7913
|
+
localValue = "-";
|
|
7914
|
+
strOffset += 1 + charCount;
|
|
7915
|
+
}
|
|
7916
|
+
break;
|
|
7917
|
+
}
|
|
7918
|
+
case 117:
|
|
7919
|
+
localValue = scanHexEscape(4);
|
|
7920
|
+
break;
|
|
7921
|
+
case 85:
|
|
7922
|
+
localValue = scanHexEscape(8);
|
|
7923
|
+
break;
|
|
7924
|
+
default:
|
|
7925
|
+
if (_isOctalCharCode(curChar)) {
|
|
7926
|
+
let octalCode = curChar - 48;
|
|
7927
|
+
strOffset++;
|
|
7928
|
+
curChar = getEscapedCharacter();
|
|
7929
|
+
if (_isOctalCharCode(curChar)) {
|
|
7930
|
+
octalCode = octalCode * 8 + curChar - 48;
|
|
7931
|
+
strOffset++;
|
|
7932
|
+
curChar = getEscapedCharacter();
|
|
7933
|
+
if (_isOctalCharCode(curChar)) {
|
|
7934
|
+
octalCode = octalCode * 8 + curChar - 48;
|
|
7935
|
+
strOffset++;
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
7938
|
+
localValue = String.fromCharCode(octalCode);
|
|
7939
|
+
} else {
|
|
7940
|
+
localValue = "\\";
|
|
7941
|
+
addInvalidEscapeOffset();
|
|
7942
|
+
}
|
|
7943
|
+
break;
|
|
7944
|
+
}
|
|
7945
|
+
}
|
|
7946
|
+
}
|
|
7947
|
+
output.valueParts.push(localValue);
|
|
7948
|
+
formatSegment.valueParts.push(localValue);
|
|
7949
|
+
} else if (curChar === 10 || curChar === 13) {
|
|
7950
|
+
if (curChar === 13 && getEscapedCharacter(1) === 10) {
|
|
7951
|
+
appendOutputChar(curChar);
|
|
7952
|
+
strOffset++;
|
|
7953
|
+
curChar = getEscapedCharacter();
|
|
7954
|
+
}
|
|
7955
|
+
appendOutputChar(curChar);
|
|
7956
|
+
strOffset++;
|
|
7957
|
+
} else if (isFormat && curChar === 123) {
|
|
7958
|
+
if (!formatSegment.isExpression && getEscapedCharacter(1) === 123) {
|
|
7959
|
+
appendOutputChar(curChar);
|
|
7960
|
+
strOffset += 2;
|
|
7961
|
+
} else {
|
|
7962
|
+
if (formatExpressionNestCount === 0) {
|
|
7963
|
+
formatSegment.length = strOffset - formatSegment.offset;
|
|
7964
|
+
if (formatSegment.length > 0) {
|
|
7965
|
+
output.formatStringSegments.push(formatSegment);
|
|
7966
|
+
}
|
|
7967
|
+
strOffset++;
|
|
7968
|
+
formatSegment = {
|
|
7969
|
+
offset: strOffset,
|
|
7970
|
+
length: 0,
|
|
7971
|
+
valueParts: [],
|
|
7972
|
+
isExpression: true,
|
|
7973
|
+
hasFormatSpecifier: false
|
|
7974
|
+
};
|
|
7975
|
+
} else {
|
|
7976
|
+
appendOutputChar(curChar);
|
|
7977
|
+
strOffset++;
|
|
7978
|
+
}
|
|
7979
|
+
formatExpressionNestCount++;
|
|
7980
|
+
}
|
|
7981
|
+
} else if (isFormat && curChar === 125) {
|
|
7982
|
+
if (!formatSegment.isExpression && getEscapedCharacter(1) === 125) {
|
|
7983
|
+
appendOutputChar(curChar);
|
|
7984
|
+
strOffset += 2;
|
|
7985
|
+
} else if (formatExpressionNestCount === 0) {
|
|
7986
|
+
output.unescapeErrors.push({
|
|
7987
|
+
offset: strOffset,
|
|
7988
|
+
length: 1,
|
|
7989
|
+
errorType: 2
|
|
7990
|
+
});
|
|
7991
|
+
strOffset++;
|
|
7992
|
+
} else {
|
|
7993
|
+
formatExpressionNestCount--;
|
|
7994
|
+
if (formatExpressionNestCount === 0) {
|
|
7995
|
+
formatSegment.length = strOffset - formatSegment.offset;
|
|
7996
|
+
output.formatStringSegments.push(formatSegment);
|
|
7997
|
+
strOffset++;
|
|
7998
|
+
formatSegment = {
|
|
7999
|
+
offset: strOffset,
|
|
8000
|
+
length: 0,
|
|
8001
|
+
valueParts: [],
|
|
8002
|
+
isExpression: false,
|
|
8003
|
+
hasFormatSpecifier: false
|
|
8004
|
+
};
|
|
8005
|
+
} else {
|
|
8006
|
+
appendOutputChar(curChar);
|
|
8007
|
+
strOffset++;
|
|
8008
|
+
}
|
|
8009
|
+
}
|
|
8010
|
+
} else if (formatSegment.isExpression && (curChar === 39 || curChar === 34)) {
|
|
8011
|
+
const quoteChar = curChar;
|
|
8012
|
+
appendOutputChar(curChar);
|
|
8013
|
+
const isTriplicate = getEscapedCharacter(1) === quoteChar && getEscapedCharacter(2) === quoteChar;
|
|
8014
|
+
if (isTriplicate) {
|
|
8015
|
+
strOffset += 2;
|
|
8016
|
+
appendOutputChar(curChar);
|
|
8017
|
+
appendOutputChar(curChar);
|
|
8018
|
+
output.valueParts.push(String.fromCharCode(curChar));
|
|
8019
|
+
output.valueParts.push(String.fromCharCode(curChar));
|
|
8020
|
+
}
|
|
8021
|
+
while (true) {
|
|
8022
|
+
strOffset++;
|
|
8023
|
+
let strChar = getEscapedCharacter();
|
|
8024
|
+
if (strChar === 3) {
|
|
8025
|
+
break;
|
|
8026
|
+
}
|
|
8027
|
+
if (strChar === 92) {
|
|
8028
|
+
appendOutputChar(strChar);
|
|
8029
|
+
strOffset++;
|
|
8030
|
+
strChar = getEscapedCharacter();
|
|
8031
|
+
appendOutputChar(strChar);
|
|
8032
|
+
continue;
|
|
8033
|
+
}
|
|
8034
|
+
if (strChar === 10 || strChar === 13) {
|
|
8035
|
+
if (!isTriplicate) {
|
|
8036
|
+
break;
|
|
8037
|
+
}
|
|
8038
|
+
}
|
|
8039
|
+
if (strChar === quoteChar) {
|
|
8040
|
+
if (!isTriplicate) {
|
|
8041
|
+
strOffset++;
|
|
8042
|
+
appendOutputChar(strChar);
|
|
8043
|
+
break;
|
|
8044
|
+
}
|
|
8045
|
+
if (getEscapedCharacter(1) === quoteChar && getEscapedCharacter(2) === quoteChar) {
|
|
8046
|
+
strOffset += 3;
|
|
8047
|
+
appendOutputChar(strChar);
|
|
8048
|
+
appendOutputChar(strChar);
|
|
8049
|
+
appendOutputChar(strChar);
|
|
8050
|
+
break;
|
|
8051
|
+
}
|
|
8052
|
+
}
|
|
8053
|
+
appendOutputChar(strChar);
|
|
8054
|
+
}
|
|
8055
|
+
} else {
|
|
8056
|
+
if (formatSegment.isExpression && curChar === 58) {
|
|
8057
|
+
formatSegment.hasFormatSpecifier = true;
|
|
8058
|
+
}
|
|
8059
|
+
if (isBytes && curChar >= 128) {
|
|
8060
|
+
output.nonAsciiInBytes = true;
|
|
8061
|
+
}
|
|
8062
|
+
appendOutputChar(curChar);
|
|
8063
|
+
strOffset++;
|
|
8064
|
+
}
|
|
8065
|
+
}
|
|
8066
|
+
}
|
|
8067
|
+
exports.getUnescapedString = getUnescapedString;
|
|
8068
|
+
function _isWhitespaceChar(charCode) {
|
|
8069
|
+
return charCode === 32 || charCode === 9;
|
|
8070
|
+
}
|
|
8071
|
+
function _isAlphaNumericChar(charCode) {
|
|
8072
|
+
if (charCode >= 48 && charCode <= 57) {
|
|
8073
|
+
return true;
|
|
8074
|
+
}
|
|
8075
|
+
if (charCode >= 97 && charCode <= 122) {
|
|
8076
|
+
return true;
|
|
8077
|
+
}
|
|
8078
|
+
if (charCode >= 65 && charCode <= 90) {
|
|
8079
|
+
return true;
|
|
8080
|
+
}
|
|
8081
|
+
return false;
|
|
8082
|
+
}
|
|
8083
|
+
function _isOctalCharCode(charCode) {
|
|
8084
|
+
return charCode >= 48 && charCode <= 55;
|
|
8085
|
+
}
|
|
8086
|
+
function _isHexCharCode(charCode) {
|
|
8087
|
+
if (charCode >= 48 && charCode <= 57) {
|
|
8088
|
+
return true;
|
|
8089
|
+
}
|
|
8090
|
+
if (charCode >= 97 && charCode <= 102) {
|
|
8091
|
+
return true;
|
|
8092
|
+
}
|
|
8093
|
+
if (charCode >= 65 && charCode <= 70) {
|
|
8094
|
+
return true;
|
|
8095
|
+
}
|
|
8096
|
+
return false;
|
|
8097
|
+
}
|
|
8098
|
+
function _getHexDigitValue(charCode) {
|
|
8099
|
+
if (charCode >= 48 && charCode <= 57) {
|
|
8100
|
+
return charCode - 48;
|
|
8101
|
+
}
|
|
8102
|
+
if (charCode >= 97 && charCode <= 102) {
|
|
8103
|
+
return charCode - 97 + 10;
|
|
8104
|
+
}
|
|
8105
|
+
if (charCode >= 65 && charCode <= 70) {
|
|
8106
|
+
return charCode - 65 + 10;
|
|
8107
|
+
}
|
|
8108
|
+
return 0;
|
|
8109
|
+
}
|
|
8110
|
+
}
|
|
8111
|
+
});
|
|
8112
|
+
|
|
7695
8113
|
// node_modules/@zzzen/pyright-internal/dist/analyzer/parseTreeWalker.js
|
|
7696
8114
|
var require_parseTreeWalker = __commonJS({
|
|
7697
8115
|
"node_modules/@zzzen/pyright-internal/dist/analyzer/parseTreeWalker.js"(exports) {
|
|
@@ -8366,6 +8784,7 @@ var require_parseTreeUtils = __commonJS({
|
|
|
8366
8784
|
var positionUtils_1 = require_positionUtils();
|
|
8367
8785
|
var textRange_1 = require_textRange();
|
|
8368
8786
|
var parseNodes_1 = require_parseNodes();
|
|
8787
|
+
var StringTokenUtils = __importStar(require_stringTokenUtils());
|
|
8369
8788
|
var analyzerNodeInfo_1 = require_analyzerNodeInfo();
|
|
8370
8789
|
var parseTreeWalker_1 = require_parseTreeWalker();
|
|
8371
8790
|
var PrintExpressionFlags;
|
|
@@ -9406,7 +9825,7 @@ var require_parseTreeUtils = __commonJS({
|
|
|
9406
9825
|
let callNode;
|
|
9407
9826
|
while (curNode !== void 0) {
|
|
9408
9827
|
if (curNode.nodeType === 9) {
|
|
9409
|
-
if (isOffsetInsideCallArgs(curNode, insertionOffset)) {
|
|
9828
|
+
if (isOffsetInsideCallArgs(tokens, curNode, insertionOffset)) {
|
|
9410
9829
|
callNode = curNode;
|
|
9411
9830
|
break;
|
|
9412
9831
|
}
|
|
@@ -9466,17 +9885,46 @@ var require_parseTreeUtils = __commonJS({
|
|
|
9466
9885
|
activeIndex,
|
|
9467
9886
|
activeOrFake
|
|
9468
9887
|
};
|
|
9469
|
-
function isOffsetInsideCallArgs(node2, offset) {
|
|
9470
|
-
let found = true;
|
|
9888
|
+
function isOffsetInsideCallArgs(tokens2, node2, offset) {
|
|
9471
9889
|
const argumentStart = node2.leftExpression.length > 0 ? textRange_1.TextRange.getEnd(node2.leftExpression) - 1 : node2.leftExpression.start;
|
|
9472
|
-
const
|
|
9473
|
-
if (
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9890
|
+
const callEndOffset = textRange_1.TextRange.getEnd(node2);
|
|
9891
|
+
if (offset < argumentStart || callEndOffset < offset) {
|
|
9892
|
+
return false;
|
|
9893
|
+
}
|
|
9894
|
+
if (node2.arguments.length > 0) {
|
|
9895
|
+
const start = node2.arguments[0].start;
|
|
9896
|
+
const end = textRange_1.TextRange.getEnd(node2.arguments[node2.arguments.length - 1]);
|
|
9897
|
+
if (start <= offset && offset < end) {
|
|
9898
|
+
return true;
|
|
9477
9899
|
}
|
|
9478
9900
|
}
|
|
9479
|
-
|
|
9901
|
+
const index = tokens2.getItemAtPosition(argumentStart);
|
|
9902
|
+
if (index < 0 || tokens2.count <= index) {
|
|
9903
|
+
return true;
|
|
9904
|
+
}
|
|
9905
|
+
const token = tokens2.getItemAt(index);
|
|
9906
|
+
if (token.type === 5 && token.flags & 64 && textRange_1.TextRange.contains(token, offset)) {
|
|
9907
|
+
const stringToken = token;
|
|
9908
|
+
const result = StringTokenUtils.getUnescapedString(stringToken);
|
|
9909
|
+
const offsetInSegment = offset - stringToken.start - stringToken.prefixLength - stringToken.quoteMarkLength;
|
|
9910
|
+
const segment = result.formatStringSegments.find((s) => s.offset <= offsetInSegment && offsetInSegment < s.offset + s.length);
|
|
9911
|
+
if (!segment || !segment.isExpression) {
|
|
9912
|
+
return true;
|
|
9913
|
+
}
|
|
9914
|
+
const length = Math.min(segment.length, callEndOffset - stringToken.start - stringToken.prefixLength - stringToken.quoteMarkLength - segment.offset);
|
|
9915
|
+
for (let i = offsetInSegment - segment.offset; i < length; i++) {
|
|
9916
|
+
const ch = segment.value[i];
|
|
9917
|
+
if (ch === "(") {
|
|
9918
|
+
return false;
|
|
9919
|
+
}
|
|
9920
|
+
}
|
|
9921
|
+
return true;
|
|
9922
|
+
}
|
|
9923
|
+
const nextToken = tokens2.getItemAt(index + 1);
|
|
9924
|
+
if (nextToken.type === 13 && offset < textRange_1.TextRange.getEnd(nextToken)) {
|
|
9925
|
+
return false;
|
|
9926
|
+
}
|
|
9927
|
+
return true;
|
|
9480
9928
|
}
|
|
9481
9929
|
}
|
|
9482
9930
|
exports.getCallNodeAndActiveParameterIndex = getCallNodeAndActiveParameterIndex;
|
|
@@ -20921,7 +21369,7 @@ var require_configOptions = __commonJS({
|
|
|
20921
21369
|
return result;
|
|
20922
21370
|
};
|
|
20923
21371
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20924
|
-
exports.ConfigOptions = exports.getStrictDiagnosticRuleSet = exports.getBasicDiagnosticRuleSet = exports.getOffDiagnosticRuleSet = exports.getStrictModeNotOverriddenRules = exports.getDiagLevelDiagnosticRules = exports.getBooleanDiagnosticRules = exports.cloneDiagnosticRuleSet = exports.ExecutionEnvironment = exports.PythonPlatform = void 0;
|
|
21372
|
+
exports.ConfigOptions = exports.getStrictDiagnosticRuleSet = exports.getBasicDiagnosticRuleSet = exports.getOffDiagnosticRuleSet = exports.getStrictModeNotOverriddenRules = exports.getDiagLevelDiagnosticRules = exports.getBooleanDiagnosticRules = exports.cloneDiagnosticRuleSet = exports.SignatureDisplayType = exports.ExecutionEnvironment = exports.PythonPlatform = void 0;
|
|
20925
21373
|
var path_1 = require("path");
|
|
20926
21374
|
var pythonPathUtils_1 = require_pythonPathUtils();
|
|
20927
21375
|
var pathConsts = __importStar(require_pathConsts());
|
|
@@ -20945,6 +21393,11 @@ var require_configOptions = __commonJS({
|
|
|
20945
21393
|
}
|
|
20946
21394
|
};
|
|
20947
21395
|
exports.ExecutionEnvironment = ExecutionEnvironment;
|
|
21396
|
+
var SignatureDisplayType;
|
|
21397
|
+
(function(SignatureDisplayType2) {
|
|
21398
|
+
SignatureDisplayType2["compact"] = "compact";
|
|
21399
|
+
SignatureDisplayType2["formatted"] = "formatted";
|
|
21400
|
+
})(SignatureDisplayType = exports.SignatureDisplayType || (exports.SignatureDisplayType = {}));
|
|
20948
21401
|
function cloneDiagnosticRuleSet(diagSettings) {
|
|
20949
21402
|
return Object.assign({}, diagSettings);
|
|
20950
21403
|
}
|
|
@@ -21291,6 +21744,7 @@ var require_configOptions = __commonJS({
|
|
|
21291
21744
|
this.projectRoot = projectRoot;
|
|
21292
21745
|
this.typeCheckingMode = typeCheckingMode;
|
|
21293
21746
|
this.diagnosticRuleSet = ConfigOptions.getDiagnosticRuleSet(typeCheckingMode);
|
|
21747
|
+
this.functionSignatureDisplay = SignatureDisplayType.formatted;
|
|
21294
21748
|
}
|
|
21295
21749
|
static getDiagnosticRuleSet(typeCheckingMode) {
|
|
21296
21750
|
if (typeCheckingMode === "strict") {
|
|
@@ -21562,6 +22016,15 @@ var require_configOptions = __commonJS({
|
|
|
21562
22016
|
this.typeEvaluationTimeThreshold = configObj.typeEvaluationTimeThreshold;
|
|
21563
22017
|
}
|
|
21564
22018
|
}
|
|
22019
|
+
if (configObj.functionSignatureDisplay !== void 0) {
|
|
22020
|
+
if (typeof configObj.functionSignatureDisplay !== "string") {
|
|
22021
|
+
console2.error(`Config "functionSignatureDisplay" field must be true or false.`);
|
|
22022
|
+
} else {
|
|
22023
|
+
if (configObj.functionSignatureDisplay === "compact" || configObj.functionSignatureDisplay === "formatted") {
|
|
22024
|
+
this.functionSignatureDisplay = configObj.functionSignatureDisplay;
|
|
22025
|
+
}
|
|
22026
|
+
}
|
|
22027
|
+
}
|
|
21565
22028
|
}
|
|
21566
22029
|
ensureDefaultPythonPlatform(host, console2) {
|
|
21567
22030
|
if (this.defaultPythonPlatform !== void 0) {
|
|
@@ -23244,11 +23707,15 @@ var require_types = __commonJS({
|
|
|
23244
23707
|
})(TypeFlags = exports.TypeFlags || (exports.TypeFlags = {}));
|
|
23245
23708
|
exports.WildcardTypeVarScopeId = "*";
|
|
23246
23709
|
var EnumLiteral = class {
|
|
23247
|
-
constructor(className, itemName, itemType) {
|
|
23710
|
+
constructor(classFullName, className, itemName, itemType) {
|
|
23711
|
+
this.classFullName = classFullName;
|
|
23248
23712
|
this.className = className;
|
|
23249
23713
|
this.itemName = itemName;
|
|
23250
23714
|
this.itemType = itemType;
|
|
23251
23715
|
}
|
|
23716
|
+
getName() {
|
|
23717
|
+
return `${this.classFullName}.${this.itemName}`;
|
|
23718
|
+
}
|
|
23252
23719
|
};
|
|
23253
23720
|
exports.EnumLiteral = EnumLiteral;
|
|
23254
23721
|
exports.maxTypeRecursionCount = 32;
|
|
@@ -24371,6 +24838,12 @@ var require_types = __commonJS({
|
|
|
24371
24838
|
unionType.literalIntMap = /* @__PURE__ */ new Map();
|
|
24372
24839
|
}
|
|
24373
24840
|
unionType.literalIntMap.set(newType.literalValue, newType);
|
|
24841
|
+
} else if (ClassType.isEnumClass(newType)) {
|
|
24842
|
+
if (unionType.literalEnumMap === void 0) {
|
|
24843
|
+
unionType.literalEnumMap = /* @__PURE__ */ new Map();
|
|
24844
|
+
}
|
|
24845
|
+
const enumLiteral = newType.literalValue;
|
|
24846
|
+
unionType.literalEnumMap.set(enumLiteral.getName(), newType);
|
|
24374
24847
|
}
|
|
24375
24848
|
}
|
|
24376
24849
|
unionType.flags &= newType.flags;
|
|
@@ -24386,6 +24859,9 @@ var require_types = __commonJS({
|
|
|
24386
24859
|
return unionType.literalStrMap.has(subtype.literalValue);
|
|
24387
24860
|
} else if (ClassType.isBuiltIn(subtype, "int") && unionType.literalIntMap !== void 0) {
|
|
24388
24861
|
return unionType.literalIntMap.has(subtype.literalValue);
|
|
24862
|
+
} else if (ClassType.isEnumClass(subtype) && unionType.literalEnumMap !== void 0) {
|
|
24863
|
+
const enumLiteral = subtype.literalValue;
|
|
24864
|
+
return unionType.literalEnumMap.has(enumLiteral.getName());
|
|
24389
24865
|
}
|
|
24390
24866
|
}
|
|
24391
24867
|
const foundIndex = unionType.subtypes.findIndex((t, i) => {
|
|
@@ -25051,6 +25527,12 @@ var require_types = __commonJS({
|
|
|
25051
25527
|
UnionType.addType(unionType, typeToAdd);
|
|
25052
25528
|
}
|
|
25053
25529
|
return;
|
|
25530
|
+
} else if (ClassType.isEnumClass(typeToAdd) && typeToAdd.literalValue !== void 0 && unionType.literalEnumMap !== void 0) {
|
|
25531
|
+
const enumLiteral = typeToAdd.literalValue;
|
|
25532
|
+
if (!unionType.literalEnumMap.has(enumLiteral.getName())) {
|
|
25533
|
+
UnionType.addType(unionType, typeToAdd);
|
|
25534
|
+
}
|
|
25535
|
+
return;
|
|
25054
25536
|
}
|
|
25055
25537
|
}
|
|
25056
25538
|
const isPseudoGeneric = isClass(typeToAdd) && ClassType.isPseudoGenericClass(typeToAdd);
|
|
@@ -25537,7 +26019,7 @@ var require_typeUtils = __commonJS({
|
|
|
25537
26019
|
"node_modules/@zzzen/pyright-internal/dist/analyzer/typeUtils.js"(exports) {
|
|
25538
26020
|
"use strict";
|
|
25539
26021
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25540
|
-
exports.isTypeVarLimitedToCallable = exports.getTypeVarArgumentsRecursive = exports.addTypeVarsToListIfUnique = exports.getClassFieldsRecursive = exports.getClassIterator = exports.getClassMemberIterator = exports.lookUpClassMember = exports.lookUpObjectMember = exports.
|
|
26022
|
+
exports.isTypeVarLimitedToCallable = exports.getTypeVarArgumentsRecursive = exports.addTypeVarsToListIfUnique = exports.getClassFieldsRecursive = exports.getClassIterator = exports.getClassMemberIterator = exports.lookUpClassMember = exports.lookUpObjectMember = exports.getContainerDepth = exports.getProtocolSymbols = exports.transformExpectedTypeForConstructor = exports.validateTypeVarDefault = exports.applySolvedTypeVars = exports.populateTypeVarContextForSelfType = exports.partiallySpecializeType = exports.isUnboundedTupleClass = exports.isTupleClass = exports.isMaybeDescriptorInstance = exports.isDescriptorInstance = exports.isProperty = exports.isEllipsisType = exports.getUnionSubtypeCount = exports.getLiteralTypeClassName = exports.containsLiteralType = exports.containsType = exports.isLiteralTypeOrUnion = exports.isLiteralType = exports.getSpecializedTupleType = exports.getTypeVarScopeId = exports.transformPossibleRecursiveTypeAlias = exports.isTypeAliasRecursive = exports.isTypeAliasPlaceholder = exports.getTypeCondition = exports.addConditionToType = exports.getFullNameOfType = exports.derivesFromAnyOrUnknown = exports.isUnionableType = exports.preserveUnknown = exports.areTypesSame = exports.doForEachSubtype = exports.sortTypes = exports.mapSubtypes = exports.makeInferenceContext = exports.isIncompleteUnknown = exports.isOptionalType = exports.getParameterListDetails = exports.ParameterSource = exports.AssignTypeFlags = exports.ClassIteratorFlags = exports.ClassMemberLookupFlags = void 0;
|
|
25541
26023
|
exports.convertParamSpecValueToType = exports.convertTypeToParamSpecValue = exports.getDeclaringModulesForType = exports.computeMroLinearization = exports.isVarianceOfTypeArgumentCompatible = exports.requiresSpecialization = exports.requiresTypeArguments = exports.getGeneratorTypeArgs = exports.removeParamSpecVariadicsFromFunction = exports.removeParamSpecVariadicsFromSignature = exports.specializeTupleClass = exports.combineSameSizedTuples = exports.explodeGenericClass = exports.isPartlyUnknown = exports.containsUnknown = exports.getMembersForModule = exports.getMembersForClass = exports.convertToInstantiable = exports.convertToInstance = exports.isEffectivelyInstantiable = exports.getGeneratorYieldType = exports.getDeclaredGeneratorReturnType = exports.synthesizeTypeVarForSelfCls = exports.derivesFromClassRecursive = exports.specializeForBaseClass = exports.buildTypeVarContext = exports.buildTypeVarContextFromSpecializedClass = exports.setTypeArgumentsRecursive = exports.specializeClassType = void 0;
|
|
25542
26024
|
var collectionUtils_1 = require_collectionUtils();
|
|
25543
26025
|
var debug_1 = require_debug2();
|
|
@@ -26293,24 +26775,35 @@ var require_typeUtils = __commonJS({
|
|
|
26293
26775
|
}
|
|
26294
26776
|
});
|
|
26295
26777
|
}
|
|
26296
|
-
function
|
|
26778
|
+
function getContainerDepth(type, recursionCount = 0) {
|
|
26297
26779
|
if (recursionCount > types_1.maxTypeRecursionCount) {
|
|
26298
26780
|
return 1;
|
|
26299
26781
|
}
|
|
26300
26782
|
recursionCount++;
|
|
26301
|
-
if (!(0, types_1.isClassInstance)(type)
|
|
26783
|
+
if (!(0, types_1.isClassInstance)(type)) {
|
|
26302
26784
|
return 0;
|
|
26303
26785
|
}
|
|
26304
26786
|
let maxChildDepth = 0;
|
|
26305
|
-
type.tupleTypeArguments
|
|
26306
|
-
|
|
26307
|
-
|
|
26308
|
-
|
|
26787
|
+
if (type.tupleTypeArguments) {
|
|
26788
|
+
type.tupleTypeArguments.forEach((typeArgInfo) => {
|
|
26789
|
+
doForEachSubtype(typeArgInfo.type, (subtype) => {
|
|
26790
|
+
const childDepth = getContainerDepth(subtype, recursionCount);
|
|
26791
|
+
maxChildDepth = Math.max(childDepth, maxChildDepth);
|
|
26792
|
+
});
|
|
26309
26793
|
});
|
|
26310
|
-
})
|
|
26794
|
+
} else if (type.typeArguments) {
|
|
26795
|
+
type.typeArguments.forEach((typeArg) => {
|
|
26796
|
+
doForEachSubtype(typeArg, (subtype) => {
|
|
26797
|
+
const childDepth = getContainerDepth(subtype, recursionCount);
|
|
26798
|
+
maxChildDepth = Math.max(childDepth, maxChildDepth);
|
|
26799
|
+
});
|
|
26800
|
+
});
|
|
26801
|
+
} else {
|
|
26802
|
+
return 0;
|
|
26803
|
+
}
|
|
26311
26804
|
return 1 + maxChildDepth;
|
|
26312
26805
|
}
|
|
26313
|
-
exports.
|
|
26806
|
+
exports.getContainerDepth = getContainerDepth;
|
|
26314
26807
|
function lookUpObjectMember(objectType, memberName, flags = 0) {
|
|
26315
26808
|
if ((0, types_1.isClassInstance)(objectType)) {
|
|
26316
26809
|
return lookUpClassMember(objectType, memberName, flags);
|
|
@@ -27443,6 +27936,7 @@ var require_typeUtils = __commonJS({
|
|
|
27443
27936
|
constructor() {
|
|
27444
27937
|
this._isTransformingTypeArg = false;
|
|
27445
27938
|
this._pendingTypeVarTransformations = /* @__PURE__ */ new Set();
|
|
27939
|
+
this._pendingFunctionTransformations = [];
|
|
27446
27940
|
}
|
|
27447
27941
|
apply(type, recursionCount) {
|
|
27448
27942
|
var _a, _b;
|
|
@@ -27523,9 +28017,19 @@ var require_typeUtils = __commonJS({
|
|
|
27523
28017
|
return this._transformTypeVarsInClassType(type, recursionCount);
|
|
27524
28018
|
}
|
|
27525
28019
|
if ((0, types_1.isFunction)(type)) {
|
|
27526
|
-
|
|
28020
|
+
if (this._pendingFunctionTransformations.some((t) => t === type)) {
|
|
28021
|
+
return type;
|
|
28022
|
+
}
|
|
28023
|
+
this._pendingFunctionTransformations.push(type);
|
|
28024
|
+
const result = this._transformTypeVarsInFunctionType(type, recursionCount);
|
|
28025
|
+
this._pendingFunctionTransformations.pop();
|
|
28026
|
+
return result;
|
|
27527
28027
|
}
|
|
27528
28028
|
if ((0, types_1.isOverloadedFunction)(type)) {
|
|
28029
|
+
if (this._pendingFunctionTransformations.some((t) => t === type)) {
|
|
28030
|
+
return type;
|
|
28031
|
+
}
|
|
28032
|
+
this._pendingFunctionTransformations.push(type);
|
|
27529
28033
|
let requiresUpdate = false;
|
|
27530
28034
|
const newOverloads = [];
|
|
27531
28035
|
type.overloads.forEach((entry) => {
|
|
@@ -27535,6 +28039,7 @@ var require_typeUtils = __commonJS({
|
|
|
27535
28039
|
requiresUpdate = true;
|
|
27536
28040
|
}
|
|
27537
28041
|
});
|
|
28042
|
+
this._pendingFunctionTransformations.pop();
|
|
27538
28043
|
return requiresUpdate ? types_1.OverloadedFunctionType.create(newOverloads) : type;
|
|
27539
28044
|
}
|
|
27540
28045
|
return type;
|
|
@@ -30692,8 +31197,9 @@ var require_typedDicts = __commonJS({
|
|
|
30692
31197
|
exports.getTypeOfIndexedTypedDict = getTypeOfIndexedTypedDict;
|
|
30693
31198
|
function narrowForKeyAssignment(classType, key) {
|
|
30694
31199
|
var _a;
|
|
30695
|
-
|
|
30696
|
-
|
|
31200
|
+
if (!types_1.ClassType.isTypedDictClass(classType) || !classType.details.typedDictEntries) {
|
|
31201
|
+
return classType;
|
|
31202
|
+
}
|
|
30697
31203
|
const tdEntry = classType.details.typedDictEntries.get(key);
|
|
30698
31204
|
if (!tdEntry || tdEntry.isRequired) {
|
|
30699
31205
|
return classType;
|
|
@@ -33312,14 +33818,38 @@ var require_tooltipUtils = __commonJS({
|
|
|
33312
33818
|
return result;
|
|
33313
33819
|
};
|
|
33314
33820
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33315
|
-
exports.getAutoImportText = exports.getDocumentationPartsForTypeAndDecl = exports.getOverloadedFunctionDocStringsFromType = exports.getFunctionDocStringFromType = exports.getOverloadedFunctionTooltip = void 0;
|
|
33821
|
+
exports.getAutoImportText = exports.getDocumentationPartsForTypeAndDecl = exports.getOverloadedFunctionDocStringsFromType = exports.getFunctionDocStringFromType = exports.getConstructorTooltip = exports.getFunctionTooltip = exports.getOverloadedFunctionTooltip = exports.getToolTipForType = void 0;
|
|
33316
33822
|
var ParseTreeUtils = __importStar(require_parseTreeUtils());
|
|
33317
33823
|
var typeDocStringUtils_1 = require_typeDocStringUtils();
|
|
33318
33824
|
var types_1 = require_types();
|
|
33825
|
+
var configOptions_1 = require_configOptions();
|
|
33319
33826
|
var core_1 = require_core();
|
|
33320
|
-
|
|
33827
|
+
var functionParamIndentOffset = 4;
|
|
33828
|
+
function getToolTipForType(type, label, name, evaluator, isProperty, functionSignatureDisplay) {
|
|
33829
|
+
let signatureString = "";
|
|
33830
|
+
if ((0, types_1.isOverloadedFunction)(type)) {
|
|
33831
|
+
signatureString = label.length > 0 ? `(${label})
|
|
33832
|
+
` : "";
|
|
33833
|
+
signatureString += `${getOverloadedFunctionTooltip(type, evaluator, functionSignatureDisplay)}`;
|
|
33834
|
+
} else if ((0, types_1.isFunction)(type)) {
|
|
33835
|
+
signatureString = `${getFunctionTooltip(label, name, type, evaluator, isProperty, functionSignatureDisplay)}`;
|
|
33836
|
+
} else {
|
|
33837
|
+
signatureString = label.length > 0 ? `(${label}) ` : "";
|
|
33838
|
+
signatureString += `${name}: ${evaluator.printType(type)}`;
|
|
33839
|
+
}
|
|
33840
|
+
return signatureString;
|
|
33841
|
+
}
|
|
33842
|
+
exports.getToolTipForType = getToolTipForType;
|
|
33843
|
+
function getOverloadedFunctionTooltip(type, evaluator, functionSignatureDisplay, columnThreshold = 70) {
|
|
33321
33844
|
let content = "";
|
|
33322
|
-
const overloads = types_1.OverloadedFunctionType.getOverloads(type).map((o) =>
|
|
33845
|
+
const overloads = types_1.OverloadedFunctionType.getOverloads(type).map((o) => getFunctionTooltip(
|
|
33846
|
+
"",
|
|
33847
|
+
o.details.name,
|
|
33848
|
+
o,
|
|
33849
|
+
evaluator,
|
|
33850
|
+
false,
|
|
33851
|
+
functionSignatureDisplay
|
|
33852
|
+
));
|
|
33323
33853
|
for (let i = 0; i < overloads.length; i++) {
|
|
33324
33854
|
if (i !== 0 && overloads[i].length > columnThreshold && overloads[i - 1].length <= columnThreshold) {
|
|
33325
33855
|
content += "\n";
|
|
@@ -33335,6 +33865,35 @@ var require_tooltipUtils = __commonJS({
|
|
|
33335
33865
|
return content;
|
|
33336
33866
|
}
|
|
33337
33867
|
exports.getOverloadedFunctionTooltip = getOverloadedFunctionTooltip;
|
|
33868
|
+
function getFunctionTooltip(label, functionName, type, evaluator, isProperty = false, functionSignatureDisplay) {
|
|
33869
|
+
const labelFormatted = label.length === 0 ? "" : `(${label}) `;
|
|
33870
|
+
const indentStr = functionSignatureDisplay === configOptions_1.SignatureDisplayType.formatted ? "\n" + " ".repeat(functionParamIndentOffset) : "";
|
|
33871
|
+
const funcParts = evaluator.printFunctionParts(type);
|
|
33872
|
+
const paramSignature = formatSignature(funcParts, indentStr, functionSignatureDisplay);
|
|
33873
|
+
const sep = isProperty ? ": " : "";
|
|
33874
|
+
return `${labelFormatted}${functionName}${sep}${paramSignature} -> ${funcParts[1]}`;
|
|
33875
|
+
}
|
|
33876
|
+
exports.getFunctionTooltip = getFunctionTooltip;
|
|
33877
|
+
function getConstructorTooltip(label, constructorName, type, evaluator, functionSignatureDisplay) {
|
|
33878
|
+
let classText = label.length === 0 ? "" : `(${label}) `;
|
|
33879
|
+
if ((0, types_1.isOverloadedFunction)(type)) {
|
|
33880
|
+
const overloads = type.overloads.map((overload) => getConstructorTooltip("", constructorName, overload, evaluator, functionSignatureDisplay));
|
|
33881
|
+
overloads.forEach((overload, index) => {
|
|
33882
|
+
classText += overload + "\n\n";
|
|
33883
|
+
});
|
|
33884
|
+
} else if ((0, types_1.isFunction)(type)) {
|
|
33885
|
+
const indentStr = functionSignatureDisplay === configOptions_1.SignatureDisplayType.formatted ? "\n" + " ".repeat(functionParamIndentOffset) : " ";
|
|
33886
|
+
const funcParts = evaluator.printFunctionParts(type);
|
|
33887
|
+
const paramSignature = formatSignature(funcParts, indentStr, functionSignatureDisplay);
|
|
33888
|
+
classText += constructorName + paramSignature;
|
|
33889
|
+
}
|
|
33890
|
+
return classText;
|
|
33891
|
+
}
|
|
33892
|
+
exports.getConstructorTooltip = getConstructorTooltip;
|
|
33893
|
+
function formatSignature(funcParts, indentStr, functionSignatureDisplay) {
|
|
33894
|
+
return functionSignatureDisplay === configOptions_1.SignatureDisplayType.formatted && funcParts.length > 0 && funcParts[0].length > 1 ? `(${indentStr}${funcParts[0].join("," + indentStr)}
|
|
33895
|
+
)` : `(${funcParts[0].join(", ")})`;
|
|
33896
|
+
}
|
|
33338
33897
|
function getFunctionDocStringFromType(type, sourceMapper, evaluator) {
|
|
33339
33898
|
const decl = type.details.declaration;
|
|
33340
33899
|
const enclosingClass = decl ? ParseTreeUtils.getEnclosingClass(decl.node) : void 0;
|
|
@@ -34997,7 +35556,7 @@ ${methodBody}`;
|
|
|
34997
35556
|
this._addSymbol(name, symbol, priorWord, completionMap, {
|
|
34998
35557
|
boundObjectOrClass,
|
|
34999
35558
|
funcParensDisabled: isInImport,
|
|
35000
|
-
extraCommitChars: !isInImport
|
|
35559
|
+
extraCommitChars: !isInImport && !!priorWord
|
|
35001
35560
|
});
|
|
35002
35561
|
}
|
|
35003
35562
|
}
|
|
@@ -35120,13 +35679,14 @@ ${methodBody}`;
|
|
|
35120
35679
|
) || types_1.UnknownType.create();
|
|
35121
35680
|
return name + ": " + this._evaluator.printType(propertyType) + " (property)";
|
|
35122
35681
|
}
|
|
35123
|
-
|
|
35124
|
-
|
|
35125
|
-
|
|
35126
|
-
|
|
35127
|
-
|
|
35128
|
-
|
|
35129
|
-
|
|
35682
|
+
return (0, tooltipUtils_1.getToolTipForType)(
|
|
35683
|
+
functionType,
|
|
35684
|
+
"",
|
|
35685
|
+
name,
|
|
35686
|
+
this._evaluator,
|
|
35687
|
+
false,
|
|
35688
|
+
this._configOptions.functionSignatureDisplay
|
|
35689
|
+
);
|
|
35130
35690
|
}
|
|
35131
35691
|
case 6:
|
|
35132
35692
|
case 7: {
|
|
@@ -36191,7 +36751,7 @@ var require_hoverProvider = __commonJS({
|
|
|
36191
36751
|
var textRange_1 = require_textRange();
|
|
36192
36752
|
var tooltipUtils_1 = require_tooltipUtils();
|
|
36193
36753
|
var HoverProvider = class {
|
|
36194
|
-
static getHoverForPosition(sourceMapper, parseResults, position, format, evaluator, token) {
|
|
36754
|
+
static getHoverForPosition(sourceMapper, parseResults, position, format, evaluator, functionSignatureDisplay, token) {
|
|
36195
36755
|
var _a;
|
|
36196
36756
|
(0, cancellationUtils_1.throwIfCancellationRequested)(token);
|
|
36197
36757
|
const offset = (0, positionUtils_1.convertPositionToOffset)(position, parseResults.tokenizerOutput.lines);
|
|
@@ -36216,7 +36776,7 @@ var require_hoverProvider = __commonJS({
|
|
|
36216
36776
|
if (primaryDeclaration.type === 8 && declarations.length > 1) {
|
|
36217
36777
|
primaryDeclaration = declarations[1];
|
|
36218
36778
|
}
|
|
36219
|
-
this._addResultsForDeclaration(format, sourceMapper, results.parts, primaryDeclaration, node, evaluator);
|
|
36779
|
+
this._addResultsForDeclaration(format, sourceMapper, results.parts, primaryDeclaration, node, evaluator, functionSignatureDisplay);
|
|
36220
36780
|
} else if (!node.parent || node.parent.nodeType !== 37) {
|
|
36221
36781
|
if (results.parts.length === 0) {
|
|
36222
36782
|
const type = evaluator.getType(node) || types_1.UnknownType.create();
|
|
@@ -36245,7 +36805,7 @@ var require_hoverProvider = __commonJS({
|
|
|
36245
36805
|
}
|
|
36246
36806
|
return results.parts.length > 0 ? results : void 0;
|
|
36247
36807
|
}
|
|
36248
|
-
static _addResultsForDeclaration(format, sourceMapper, parts, declaration, node, evaluator) {
|
|
36808
|
+
static _addResultsForDeclaration(format, sourceMapper, parts, declaration, node, evaluator, functionSignatureDisplay) {
|
|
36249
36809
|
var _a;
|
|
36250
36810
|
const resolvedDecl = evaluator.resolveAliasDeclaration(declaration, true);
|
|
36251
36811
|
if (!resolvedDecl) {
|
|
@@ -36316,7 +36876,7 @@ var require_hoverProvider = __commonJS({
|
|
|
36316
36876
|
}
|
|
36317
36877
|
case 6:
|
|
36318
36878
|
case 7: {
|
|
36319
|
-
if (this._addInitOrNewMethodInsteadIfCallNode(format, node, evaluator, parts, sourceMapper, resolvedDecl)) {
|
|
36879
|
+
if (this._addInitOrNewMethodInsteadIfCallNode(format, node, evaluator, parts, sourceMapper, resolvedDecl, functionSignatureDisplay)) {
|
|
36320
36880
|
return;
|
|
36321
36881
|
}
|
|
36322
36882
|
this._addResultsPart(parts, "(class) " + node.value, true);
|
|
@@ -36332,29 +36892,10 @@ var require_hoverProvider = __commonJS({
|
|
|
36332
36892
|
label = isProperty ? "property" : "method";
|
|
36333
36893
|
}
|
|
36334
36894
|
let type = evaluator.getType(node);
|
|
36335
|
-
const sep = isProperty ? ": " : "";
|
|
36336
36895
|
if (type) {
|
|
36337
36896
|
type = this._limitOverloadBasedOnCall(node, evaluator, type);
|
|
36338
|
-
|
|
36339
|
-
|
|
36340
|
-
parts,
|
|
36341
|
-
`(${label})
|
|
36342
|
-
${(0, tooltipUtils_1.getOverloadedFunctionTooltip)(type, evaluator)}`,
|
|
36343
|
-
true
|
|
36344
|
-
);
|
|
36345
|
-
} else if ((0, types_1.isFunction)(type)) {
|
|
36346
|
-
this._addResultsPart(
|
|
36347
|
-
parts,
|
|
36348
|
-
`(${label}) ${node.value}${sep}${evaluator.printType(type)}`,
|
|
36349
|
-
true
|
|
36350
|
-
);
|
|
36351
|
-
} else {
|
|
36352
|
-
this._addResultsPart(
|
|
36353
|
-
parts,
|
|
36354
|
-
`(${label}) ${node.value}: ${evaluator.printType(type)}`,
|
|
36355
|
-
true
|
|
36356
|
-
);
|
|
36357
|
-
}
|
|
36897
|
+
const signatureString = (0, tooltipUtils_1.getToolTipForType)(type, label, node.value, evaluator, isProperty, functionSignatureDisplay);
|
|
36898
|
+
this._addResultsPart(parts, signatureString, true);
|
|
36358
36899
|
}
|
|
36359
36900
|
this._addDocumentationPart(format, sourceMapper, parts, node, evaluator, resolvedDecl);
|
|
36360
36901
|
break;
|
|
@@ -36396,7 +36937,7 @@ ${(0, tooltipUtils_1.getOverloadedFunctionTooltip)(type, evaluator)}`,
|
|
|
36396
36937
|
}
|
|
36397
36938
|
});
|
|
36398
36939
|
}
|
|
36399
|
-
static _addInitOrNewMethodInsteadIfCallNode(format, node, evaluator, parts, sourceMapper, declaration) {
|
|
36940
|
+
static _addInitOrNewMethodInsteadIfCallNode(format, node, evaluator, parts, sourceMapper, declaration, functionSignatureDisplay) {
|
|
36400
36941
|
var _a, _b;
|
|
36401
36942
|
let callLeftNode = node;
|
|
36402
36943
|
if (((_a = callLeftNode === null || callLeftNode === void 0 ? void 0 : callLeftNode.parent) === null || _a === void 0 ? void 0 : _a.nodeType) === 35 && node === callLeftNode.parent.memberName) {
|
|
@@ -36440,19 +36981,12 @@ ${(0, tooltipUtils_1.getOverloadedFunctionTooltip)(type, evaluator)}`,
|
|
|
36440
36981
|
}
|
|
36441
36982
|
}
|
|
36442
36983
|
if (methodType && ((0, types_1.isFunction)(methodType) || (0, types_1.isOverloadedFunction)(methodType))) {
|
|
36443
|
-
|
|
36444
|
-
|
|
36445
|
-
|
|
36446
|
-
|
|
36447
|
-
|
|
36448
|
-
|
|
36449
|
-
`;
|
|
36450
|
-
});
|
|
36451
|
-
} else if ((0, types_1.isFunction)(methodType)) {
|
|
36452
|
-
const functionParts = evaluator.printFunctionParts(methodType);
|
|
36453
|
-
classText = `${node.value}(${functionParts[0].join(", ")})`;
|
|
36454
|
-
}
|
|
36455
|
-
this._addResultsPart(parts, "(class) " + classText, true);
|
|
36984
|
+
methodType = this._limitOverloadBasedOnCall(node, evaluator, methodType);
|
|
36985
|
+
this._addResultsPart(
|
|
36986
|
+
parts,
|
|
36987
|
+
(0, tooltipUtils_1.getConstructorTooltip)("class", node.value, methodType, evaluator, functionSignatureDisplay),
|
|
36988
|
+
true
|
|
36989
|
+
);
|
|
36456
36990
|
const addedDoc = this._addDocumentationPartForType(format, sourceMapper, parts, methodType, declaration, evaluator);
|
|
36457
36991
|
if (!addedDoc) {
|
|
36458
36992
|
this._addDocumentationPartForType(format, sourceMapper, parts, classType, declaration, evaluator);
|
|
@@ -38604,7 +39138,7 @@ var require_binder = __commonJS({
|
|
|
38604
39138
|
node: importSymbolNode,
|
|
38605
39139
|
path: implicitImport.path,
|
|
38606
39140
|
loadSymbolsFromPath: true,
|
|
38607
|
-
range: (0,
|
|
39141
|
+
range: (0, textRange_1.getEmptyRange)(),
|
|
38608
39142
|
usesLocalName: false,
|
|
38609
39143
|
moduleName: this._fileInfo.moduleName,
|
|
38610
39144
|
isInExceptSuite: this._isInExceptSuite
|
|
@@ -40285,425 +40819,6 @@ var require_binder = __commonJS({
|
|
|
40285
40819
|
}
|
|
40286
40820
|
});
|
|
40287
40821
|
|
|
40288
|
-
// node_modules/@zzzen/pyright-internal/dist/parser/stringTokenUtils.js
|
|
40289
|
-
var require_stringTokenUtils = __commonJS({
|
|
40290
|
-
"node_modules/@zzzen/pyright-internal/dist/parser/stringTokenUtils.js"(exports) {
|
|
40291
|
-
"use strict";
|
|
40292
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40293
|
-
exports.getUnescapedString = exports.UnescapeErrorType = void 0;
|
|
40294
|
-
var UnescapeErrorType;
|
|
40295
|
-
(function(UnescapeErrorType2) {
|
|
40296
|
-
UnescapeErrorType2[UnescapeErrorType2["InvalidEscapeSequence"] = 0] = "InvalidEscapeSequence";
|
|
40297
|
-
UnescapeErrorType2[UnescapeErrorType2["EscapeWithinFormatExpression"] = 1] = "EscapeWithinFormatExpression";
|
|
40298
|
-
UnescapeErrorType2[UnescapeErrorType2["SingleCloseBraceWithinFormatLiteral"] = 2] = "SingleCloseBraceWithinFormatLiteral";
|
|
40299
|
-
UnescapeErrorType2[UnescapeErrorType2["UnterminatedFormatExpression"] = 3] = "UnterminatedFormatExpression";
|
|
40300
|
-
})(UnescapeErrorType = exports.UnescapeErrorType || (exports.UnescapeErrorType = {}));
|
|
40301
|
-
function completeUnescapedString(incomplete) {
|
|
40302
|
-
return {
|
|
40303
|
-
...incomplete,
|
|
40304
|
-
value: incomplete.valueParts.join(""),
|
|
40305
|
-
formatStringSegments: incomplete.formatStringSegments.map((segment) => ({
|
|
40306
|
-
...segment,
|
|
40307
|
-
value: segment.valueParts.join("")
|
|
40308
|
-
}))
|
|
40309
|
-
};
|
|
40310
|
-
}
|
|
40311
|
-
function getUnescapedString(stringToken) {
|
|
40312
|
-
const escapedString = stringToken.escapedValue;
|
|
40313
|
-
const isRaw = (stringToken.flags & 8) !== 0;
|
|
40314
|
-
const isFormat = (stringToken.flags & 64) !== 0;
|
|
40315
|
-
if (isRaw && !isFormat) {
|
|
40316
|
-
return {
|
|
40317
|
-
value: escapedString,
|
|
40318
|
-
unescapeErrors: [],
|
|
40319
|
-
nonAsciiInBytes: false,
|
|
40320
|
-
formatStringSegments: []
|
|
40321
|
-
};
|
|
40322
|
-
}
|
|
40323
|
-
const charCodes = [];
|
|
40324
|
-
for (let index = 0; index < escapedString.length; index++) {
|
|
40325
|
-
charCodes.push(escapedString.charCodeAt(index));
|
|
40326
|
-
}
|
|
40327
|
-
const isBytes = (stringToken.flags & 32) !== 0;
|
|
40328
|
-
if (!isFormat) {
|
|
40329
|
-
if (!charCodes.some((curChar) => curChar === 13 || curChar === 10 || curChar === 92)) {
|
|
40330
|
-
return {
|
|
40331
|
-
value: escapedString,
|
|
40332
|
-
unescapeErrors: [],
|
|
40333
|
-
nonAsciiInBytes: isBytes && charCodes.some((curChar) => curChar >= 128),
|
|
40334
|
-
formatStringSegments: []
|
|
40335
|
-
};
|
|
40336
|
-
}
|
|
40337
|
-
}
|
|
40338
|
-
let formatExpressionNestCount = 0;
|
|
40339
|
-
let formatSegment = {
|
|
40340
|
-
offset: 0,
|
|
40341
|
-
length: 0,
|
|
40342
|
-
valueParts: [],
|
|
40343
|
-
isExpression: false,
|
|
40344
|
-
hasFormatSpecifier: false
|
|
40345
|
-
};
|
|
40346
|
-
let strOffset = 0;
|
|
40347
|
-
const output = {
|
|
40348
|
-
valueParts: [],
|
|
40349
|
-
unescapeErrors: [],
|
|
40350
|
-
nonAsciiInBytes: false,
|
|
40351
|
-
formatStringSegments: []
|
|
40352
|
-
};
|
|
40353
|
-
const addInvalidEscapeOffset = () => {
|
|
40354
|
-
if (!isRaw) {
|
|
40355
|
-
output.unescapeErrors.push({
|
|
40356
|
-
offset: strOffset - 1,
|
|
40357
|
-
length: 2,
|
|
40358
|
-
errorType: 0
|
|
40359
|
-
});
|
|
40360
|
-
}
|
|
40361
|
-
};
|
|
40362
|
-
const getEscapedCharacter = (offset = 0) => {
|
|
40363
|
-
if (strOffset + offset >= charCodes.length) {
|
|
40364
|
-
return 3;
|
|
40365
|
-
}
|
|
40366
|
-
return charCodes[strOffset + offset];
|
|
40367
|
-
};
|
|
40368
|
-
const scanHexEscape = (digitCount) => {
|
|
40369
|
-
let foundIllegalHexDigit = false;
|
|
40370
|
-
let hexValue = 0;
|
|
40371
|
-
let localValue = "";
|
|
40372
|
-
for (let i = 0; i < digitCount; i++) {
|
|
40373
|
-
const charCode = getEscapedCharacter(1 + i);
|
|
40374
|
-
if (!_isHexCharCode(charCode)) {
|
|
40375
|
-
foundIllegalHexDigit = true;
|
|
40376
|
-
break;
|
|
40377
|
-
}
|
|
40378
|
-
hexValue = 16 * hexValue + _getHexDigitValue(charCode);
|
|
40379
|
-
}
|
|
40380
|
-
if (foundIllegalHexDigit) {
|
|
40381
|
-
addInvalidEscapeOffset();
|
|
40382
|
-
localValue = "\\" + String.fromCharCode(getEscapedCharacter());
|
|
40383
|
-
strOffset++;
|
|
40384
|
-
} else {
|
|
40385
|
-
localValue = String.fromCharCode(hexValue);
|
|
40386
|
-
strOffset += 1 + digitCount;
|
|
40387
|
-
}
|
|
40388
|
-
return localValue;
|
|
40389
|
-
};
|
|
40390
|
-
const appendOutputChar = (charCode) => {
|
|
40391
|
-
const char = String.fromCharCode(charCode);
|
|
40392
|
-
output.valueParts.push(char);
|
|
40393
|
-
formatSegment.valueParts.push(char);
|
|
40394
|
-
};
|
|
40395
|
-
while (true) {
|
|
40396
|
-
let curChar = getEscapedCharacter();
|
|
40397
|
-
if (curChar === 3) {
|
|
40398
|
-
if (isFormat) {
|
|
40399
|
-
if (formatSegment.isExpression) {
|
|
40400
|
-
output.unescapeErrors.push({
|
|
40401
|
-
offset: formatSegment.offset,
|
|
40402
|
-
length: strOffset - formatSegment.offset,
|
|
40403
|
-
errorType: 3
|
|
40404
|
-
});
|
|
40405
|
-
}
|
|
40406
|
-
if (strOffset !== formatSegment.offset) {
|
|
40407
|
-
formatSegment.length = strOffset - formatSegment.offset;
|
|
40408
|
-
output.formatStringSegments.push(formatSegment);
|
|
40409
|
-
}
|
|
40410
|
-
}
|
|
40411
|
-
return completeUnescapedString(output);
|
|
40412
|
-
}
|
|
40413
|
-
if (curChar === 92) {
|
|
40414
|
-
if (isFormat && formatSegment.isExpression && !formatSegment.hasFormatSpecifier) {
|
|
40415
|
-
output.unescapeErrors.push({
|
|
40416
|
-
offset: strOffset,
|
|
40417
|
-
length: 1,
|
|
40418
|
-
errorType: 1
|
|
40419
|
-
});
|
|
40420
|
-
}
|
|
40421
|
-
strOffset++;
|
|
40422
|
-
if (isRaw) {
|
|
40423
|
-
appendOutputChar(curChar);
|
|
40424
|
-
continue;
|
|
40425
|
-
}
|
|
40426
|
-
curChar = getEscapedCharacter();
|
|
40427
|
-
let localValue = "";
|
|
40428
|
-
if (curChar === 13 || curChar === 10) {
|
|
40429
|
-
if (curChar === 13 && getEscapedCharacter(1) === 10) {
|
|
40430
|
-
if (isRaw) {
|
|
40431
|
-
localValue += String.fromCharCode(curChar);
|
|
40432
|
-
}
|
|
40433
|
-
strOffset++;
|
|
40434
|
-
curChar = getEscapedCharacter();
|
|
40435
|
-
}
|
|
40436
|
-
if (isRaw) {
|
|
40437
|
-
localValue = "\\" + localValue + String.fromCharCode(curChar);
|
|
40438
|
-
}
|
|
40439
|
-
strOffset++;
|
|
40440
|
-
} else {
|
|
40441
|
-
if (isRaw || isFormat && formatSegment.isExpression) {
|
|
40442
|
-
localValue = "\\" + String.fromCharCode(curChar);
|
|
40443
|
-
strOffset++;
|
|
40444
|
-
} else {
|
|
40445
|
-
switch (curChar) {
|
|
40446
|
-
case 92:
|
|
40447
|
-
case 39:
|
|
40448
|
-
case 34:
|
|
40449
|
-
localValue = String.fromCharCode(curChar);
|
|
40450
|
-
strOffset++;
|
|
40451
|
-
break;
|
|
40452
|
-
case 97:
|
|
40453
|
-
localValue = "\x07";
|
|
40454
|
-
strOffset++;
|
|
40455
|
-
break;
|
|
40456
|
-
case 98:
|
|
40457
|
-
localValue = "\b";
|
|
40458
|
-
strOffset++;
|
|
40459
|
-
break;
|
|
40460
|
-
case 102:
|
|
40461
|
-
localValue = "\f";
|
|
40462
|
-
strOffset++;
|
|
40463
|
-
break;
|
|
40464
|
-
case 110:
|
|
40465
|
-
localValue = "\n";
|
|
40466
|
-
strOffset++;
|
|
40467
|
-
break;
|
|
40468
|
-
case 114:
|
|
40469
|
-
localValue = "\r";
|
|
40470
|
-
strOffset++;
|
|
40471
|
-
break;
|
|
40472
|
-
case 116:
|
|
40473
|
-
localValue = " ";
|
|
40474
|
-
strOffset++;
|
|
40475
|
-
break;
|
|
40476
|
-
case 118:
|
|
40477
|
-
localValue = "\v";
|
|
40478
|
-
strOffset++;
|
|
40479
|
-
break;
|
|
40480
|
-
case 120:
|
|
40481
|
-
localValue = scanHexEscape(2);
|
|
40482
|
-
break;
|
|
40483
|
-
case 78: {
|
|
40484
|
-
let foundIllegalChar = false;
|
|
40485
|
-
let charCount = 1;
|
|
40486
|
-
if (getEscapedCharacter(charCount) !== 123) {
|
|
40487
|
-
foundIllegalChar = true;
|
|
40488
|
-
} else {
|
|
40489
|
-
charCount++;
|
|
40490
|
-
while (true) {
|
|
40491
|
-
const lookaheadChar = getEscapedCharacter(charCount);
|
|
40492
|
-
if (lookaheadChar === 125) {
|
|
40493
|
-
break;
|
|
40494
|
-
} else if (!_isAlphaNumericChar(lookaheadChar) && lookaheadChar !== 45 && !_isWhitespaceChar(lookaheadChar)) {
|
|
40495
|
-
foundIllegalChar = true;
|
|
40496
|
-
break;
|
|
40497
|
-
} else {
|
|
40498
|
-
charCount++;
|
|
40499
|
-
}
|
|
40500
|
-
}
|
|
40501
|
-
}
|
|
40502
|
-
if (foundIllegalChar) {
|
|
40503
|
-
addInvalidEscapeOffset();
|
|
40504
|
-
localValue = "\\" + String.fromCharCode(curChar);
|
|
40505
|
-
strOffset++;
|
|
40506
|
-
} else {
|
|
40507
|
-
localValue = "-";
|
|
40508
|
-
strOffset += 1 + charCount;
|
|
40509
|
-
}
|
|
40510
|
-
break;
|
|
40511
|
-
}
|
|
40512
|
-
case 117:
|
|
40513
|
-
localValue = scanHexEscape(4);
|
|
40514
|
-
break;
|
|
40515
|
-
case 85:
|
|
40516
|
-
localValue = scanHexEscape(8);
|
|
40517
|
-
break;
|
|
40518
|
-
default:
|
|
40519
|
-
if (_isOctalCharCode(curChar)) {
|
|
40520
|
-
let octalCode = curChar - 48;
|
|
40521
|
-
strOffset++;
|
|
40522
|
-
curChar = getEscapedCharacter();
|
|
40523
|
-
if (_isOctalCharCode(curChar)) {
|
|
40524
|
-
octalCode = octalCode * 8 + curChar - 48;
|
|
40525
|
-
strOffset++;
|
|
40526
|
-
curChar = getEscapedCharacter();
|
|
40527
|
-
if (_isOctalCharCode(curChar)) {
|
|
40528
|
-
octalCode = octalCode * 8 + curChar - 48;
|
|
40529
|
-
strOffset++;
|
|
40530
|
-
}
|
|
40531
|
-
}
|
|
40532
|
-
localValue = String.fromCharCode(octalCode);
|
|
40533
|
-
} else {
|
|
40534
|
-
localValue = "\\";
|
|
40535
|
-
addInvalidEscapeOffset();
|
|
40536
|
-
}
|
|
40537
|
-
break;
|
|
40538
|
-
}
|
|
40539
|
-
}
|
|
40540
|
-
}
|
|
40541
|
-
output.valueParts.push(localValue);
|
|
40542
|
-
formatSegment.valueParts.push(localValue);
|
|
40543
|
-
} else if (curChar === 10 || curChar === 13) {
|
|
40544
|
-
if (curChar === 13 && getEscapedCharacter(1) === 10) {
|
|
40545
|
-
appendOutputChar(curChar);
|
|
40546
|
-
strOffset++;
|
|
40547
|
-
curChar = getEscapedCharacter();
|
|
40548
|
-
}
|
|
40549
|
-
appendOutputChar(curChar);
|
|
40550
|
-
strOffset++;
|
|
40551
|
-
} else if (isFormat && curChar === 123) {
|
|
40552
|
-
if (!formatSegment.isExpression && getEscapedCharacter(1) === 123) {
|
|
40553
|
-
appendOutputChar(curChar);
|
|
40554
|
-
strOffset += 2;
|
|
40555
|
-
} else {
|
|
40556
|
-
if (formatExpressionNestCount === 0) {
|
|
40557
|
-
formatSegment.length = strOffset - formatSegment.offset;
|
|
40558
|
-
if (formatSegment.length > 0) {
|
|
40559
|
-
output.formatStringSegments.push(formatSegment);
|
|
40560
|
-
}
|
|
40561
|
-
strOffset++;
|
|
40562
|
-
formatSegment = {
|
|
40563
|
-
offset: strOffset,
|
|
40564
|
-
length: 0,
|
|
40565
|
-
valueParts: [],
|
|
40566
|
-
isExpression: true,
|
|
40567
|
-
hasFormatSpecifier: false
|
|
40568
|
-
};
|
|
40569
|
-
} else {
|
|
40570
|
-
appendOutputChar(curChar);
|
|
40571
|
-
strOffset++;
|
|
40572
|
-
}
|
|
40573
|
-
formatExpressionNestCount++;
|
|
40574
|
-
}
|
|
40575
|
-
} else if (isFormat && curChar === 125) {
|
|
40576
|
-
if (!formatSegment.isExpression && getEscapedCharacter(1) === 125) {
|
|
40577
|
-
appendOutputChar(curChar);
|
|
40578
|
-
strOffset += 2;
|
|
40579
|
-
} else if (formatExpressionNestCount === 0) {
|
|
40580
|
-
output.unescapeErrors.push({
|
|
40581
|
-
offset: strOffset,
|
|
40582
|
-
length: 1,
|
|
40583
|
-
errorType: 2
|
|
40584
|
-
});
|
|
40585
|
-
strOffset++;
|
|
40586
|
-
} else {
|
|
40587
|
-
formatExpressionNestCount--;
|
|
40588
|
-
if (formatExpressionNestCount === 0) {
|
|
40589
|
-
formatSegment.length = strOffset - formatSegment.offset;
|
|
40590
|
-
output.formatStringSegments.push(formatSegment);
|
|
40591
|
-
strOffset++;
|
|
40592
|
-
formatSegment = {
|
|
40593
|
-
offset: strOffset,
|
|
40594
|
-
length: 0,
|
|
40595
|
-
valueParts: [],
|
|
40596
|
-
isExpression: false,
|
|
40597
|
-
hasFormatSpecifier: false
|
|
40598
|
-
};
|
|
40599
|
-
} else {
|
|
40600
|
-
appendOutputChar(curChar);
|
|
40601
|
-
strOffset++;
|
|
40602
|
-
}
|
|
40603
|
-
}
|
|
40604
|
-
} else if (formatSegment.isExpression && (curChar === 39 || curChar === 34)) {
|
|
40605
|
-
const quoteChar = curChar;
|
|
40606
|
-
appendOutputChar(curChar);
|
|
40607
|
-
const isTriplicate = getEscapedCharacter(1) === quoteChar && getEscapedCharacter(2) === quoteChar;
|
|
40608
|
-
if (isTriplicate) {
|
|
40609
|
-
strOffset += 2;
|
|
40610
|
-
appendOutputChar(curChar);
|
|
40611
|
-
appendOutputChar(curChar);
|
|
40612
|
-
output.valueParts.push(String.fromCharCode(curChar));
|
|
40613
|
-
output.valueParts.push(String.fromCharCode(curChar));
|
|
40614
|
-
}
|
|
40615
|
-
while (true) {
|
|
40616
|
-
strOffset++;
|
|
40617
|
-
let strChar = getEscapedCharacter();
|
|
40618
|
-
if (strChar === 3) {
|
|
40619
|
-
break;
|
|
40620
|
-
}
|
|
40621
|
-
if (strChar === 92) {
|
|
40622
|
-
appendOutputChar(strChar);
|
|
40623
|
-
strOffset++;
|
|
40624
|
-
strChar = getEscapedCharacter();
|
|
40625
|
-
appendOutputChar(strChar);
|
|
40626
|
-
continue;
|
|
40627
|
-
}
|
|
40628
|
-
if (strChar === 10 || strChar === 13) {
|
|
40629
|
-
if (!isTriplicate) {
|
|
40630
|
-
break;
|
|
40631
|
-
}
|
|
40632
|
-
}
|
|
40633
|
-
if (strChar === quoteChar) {
|
|
40634
|
-
if (!isTriplicate) {
|
|
40635
|
-
strOffset++;
|
|
40636
|
-
appendOutputChar(strChar);
|
|
40637
|
-
break;
|
|
40638
|
-
}
|
|
40639
|
-
if (getEscapedCharacter(1) === quoteChar && getEscapedCharacter(2) === quoteChar) {
|
|
40640
|
-
strOffset += 3;
|
|
40641
|
-
appendOutputChar(strChar);
|
|
40642
|
-
appendOutputChar(strChar);
|
|
40643
|
-
appendOutputChar(strChar);
|
|
40644
|
-
break;
|
|
40645
|
-
}
|
|
40646
|
-
}
|
|
40647
|
-
appendOutputChar(strChar);
|
|
40648
|
-
}
|
|
40649
|
-
} else {
|
|
40650
|
-
if (formatSegment.isExpression && curChar === 58) {
|
|
40651
|
-
formatSegment.hasFormatSpecifier = true;
|
|
40652
|
-
}
|
|
40653
|
-
if (isBytes && curChar >= 128) {
|
|
40654
|
-
output.nonAsciiInBytes = true;
|
|
40655
|
-
}
|
|
40656
|
-
appendOutputChar(curChar);
|
|
40657
|
-
strOffset++;
|
|
40658
|
-
}
|
|
40659
|
-
}
|
|
40660
|
-
}
|
|
40661
|
-
exports.getUnescapedString = getUnescapedString;
|
|
40662
|
-
function _isWhitespaceChar(charCode) {
|
|
40663
|
-
return charCode === 32 || charCode === 9;
|
|
40664
|
-
}
|
|
40665
|
-
function _isAlphaNumericChar(charCode) {
|
|
40666
|
-
if (charCode >= 48 && charCode <= 57) {
|
|
40667
|
-
return true;
|
|
40668
|
-
}
|
|
40669
|
-
if (charCode >= 97 && charCode <= 122) {
|
|
40670
|
-
return true;
|
|
40671
|
-
}
|
|
40672
|
-
if (charCode >= 65 && charCode <= 90) {
|
|
40673
|
-
return true;
|
|
40674
|
-
}
|
|
40675
|
-
return false;
|
|
40676
|
-
}
|
|
40677
|
-
function _isOctalCharCode(charCode) {
|
|
40678
|
-
return charCode >= 48 && charCode <= 55;
|
|
40679
|
-
}
|
|
40680
|
-
function _isHexCharCode(charCode) {
|
|
40681
|
-
if (charCode >= 48 && charCode <= 57) {
|
|
40682
|
-
return true;
|
|
40683
|
-
}
|
|
40684
|
-
if (charCode >= 97 && charCode <= 102) {
|
|
40685
|
-
return true;
|
|
40686
|
-
}
|
|
40687
|
-
if (charCode >= 65 && charCode <= 70) {
|
|
40688
|
-
return true;
|
|
40689
|
-
}
|
|
40690
|
-
return false;
|
|
40691
|
-
}
|
|
40692
|
-
function _getHexDigitValue(charCode) {
|
|
40693
|
-
if (charCode >= 48 && charCode <= 57) {
|
|
40694
|
-
return charCode - 48;
|
|
40695
|
-
}
|
|
40696
|
-
if (charCode >= 97 && charCode <= 102) {
|
|
40697
|
-
return charCode - 97 + 10;
|
|
40698
|
-
}
|
|
40699
|
-
if (charCode >= 65 && charCode <= 70) {
|
|
40700
|
-
return charCode - 65 + 10;
|
|
40701
|
-
}
|
|
40702
|
-
return 0;
|
|
40703
|
-
}
|
|
40704
|
-
}
|
|
40705
|
-
});
|
|
40706
|
-
|
|
40707
40822
|
// node_modules/@zzzen/pyright-internal/dist/parser/unicode.js
|
|
40708
40823
|
var require_unicode = __commonJS({
|
|
40709
40824
|
"node_modules/@zzzen/pyright-internal/dist/parser/unicode.js"(exports) {
|
|
@@ -45827,7 +45942,8 @@ var require_importResolver = __commonJS({
|
|
|
45827
45942
|
isStubFile,
|
|
45828
45943
|
isNativeLib: false,
|
|
45829
45944
|
name: dirName,
|
|
45830
|
-
path: path12
|
|
45945
|
+
path: path12,
|
|
45946
|
+
pyTypedInfo: (0, pyTypedUtils_1.getPyTypedInfo)(this.fileSystem, (0, pathUtils_1.combinePaths)(dirPath, dirName))
|
|
45831
45947
|
};
|
|
45832
45948
|
implicitImportMap.set(implicitImport.name, implicitImport);
|
|
45833
45949
|
}
|
|
@@ -45961,7 +46077,7 @@ var require_constraintSolver = __commonJS({
|
|
|
45961
46077
|
void 0,
|
|
45962
46078
|
void 0,
|
|
45963
46079
|
void 0,
|
|
45964
|
-
flags,
|
|
46080
|
+
flags & ~1,
|
|
45965
46081
|
recursionCount
|
|
45966
46082
|
)) {
|
|
45967
46083
|
return true;
|
|
@@ -47485,8 +47601,8 @@ var require_typeGuards = __commonJS({
|
|
|
47485
47601
|
if ((0, types_1.isNever)(filteredType) && anyOrUnknownSubstitutions.length > 0) {
|
|
47486
47602
|
return (0, types_1.combineTypes)(anyOrUnknownSubstitutions);
|
|
47487
47603
|
}
|
|
47488
|
-
if (anyOrUnknown.length > 0) {
|
|
47489
|
-
return (0, types_1.combineTypes)(
|
|
47604
|
+
if ((0, types_1.isNever)(filteredType) && anyOrUnknown.length > 0) {
|
|
47605
|
+
return (0, types_1.combineTypes)(anyOrUnknown);
|
|
47490
47606
|
}
|
|
47491
47607
|
return filteredType;
|
|
47492
47608
|
}
|
|
@@ -48311,7 +48427,7 @@ var require_patternMatching = __commonJS({
|
|
|
48311
48427
|
return types_1.NeverType.createNever();
|
|
48312
48428
|
}
|
|
48313
48429
|
if ((0, types_1.isAnyOrUnknown)(valueSubtypeExpanded) || (0, types_1.isAnyOrUnknown)(subjectSubtypeExpanded)) {
|
|
48314
|
-
return (0, types_1.isUnknown)(valueSubtypeExpanded) || (0, types_1.isUnknown)(subjectSubtypeExpanded) ?
|
|
48430
|
+
return (0, types_1.isUnknown)(valueSubtypeExpanded) || (0, types_1.isUnknown)(subjectSubtypeExpanded) ? (0, typeUtils_1.preserveUnknown)(valueSubtypeExpanded, subjectSubtypeExpanded) : types_1.AnyType.create();
|
|
48315
48431
|
}
|
|
48316
48432
|
const returnType = evaluator.useSpeculativeMode(pattern.expression, () => evaluator.getTypeOfMagicMethodReturn(
|
|
48317
48433
|
valueSubtypeExpanded,
|
|
@@ -51375,7 +51491,7 @@ var require_enums = __commonJS({
|
|
|
51375
51491
|
isMemberOfEnumeration = false;
|
|
51376
51492
|
}
|
|
51377
51493
|
if (isMemberOfEnumeration) {
|
|
51378
|
-
const enumLiteral = new types_1.EnumLiteral(enumClassInfo.classType.details.name, node.value, valueType);
|
|
51494
|
+
const enumLiteral = new types_1.EnumLiteral(enumClassInfo.classType.details.fullName, enumClassInfo.classType.details.name, node.value, valueType);
|
|
51379
51495
|
return types_1.ClassType.cloneAsInstance(types_1.ClassType.cloneWithLiteral(enumClassInfo.classType, enumLiteral));
|
|
51380
51496
|
}
|
|
51381
51497
|
return void 0;
|
|
@@ -52480,6 +52596,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
52480
52596
|
var maxEffectiveTypeEvaluationAttempts = 16;
|
|
52481
52597
|
var maxOverloadUnionExpansionCount = 64;
|
|
52482
52598
|
var maxInferFunctionReturnRecursionCount = 12;
|
|
52599
|
+
var maxInferredContainerDepth = 8;
|
|
52483
52600
|
var maxRecursiveTypeAliasRecursionCount = 10;
|
|
52484
52601
|
var verifyTypeCacheEvaluatorFlags = false;
|
|
52485
52602
|
var printExpressionTypes = false;
|
|
@@ -56604,8 +56721,7 @@ var require_typeEvaluator = __commonJS({
|
|
|
56604
56721
|
}
|
|
56605
56722
|
const type = (0, typeUtils_1.convertToInstance)((0, typeUtils_1.specializeTupleClass)(tupleClassType, buildTupleTypesList(entryTypeResults)));
|
|
56606
56723
|
if (isIncomplete) {
|
|
56607
|
-
|
|
56608
|
-
if ((0, typeUtils_1.getTupleDepth)(type) > maxInferredTupleDepth) {
|
|
56724
|
+
if ((0, typeUtils_1.getContainerDepth)(type) > maxInferredContainerDepth) {
|
|
56609
56725
|
return { type: types_1.UnknownType.create() };
|
|
56610
56726
|
}
|
|
56611
56727
|
}
|
|
@@ -59923,6 +60039,11 @@ var require_typeEvaluator = __commonJS({
|
|
|
59923
60039
|
void 0,
|
|
59924
60040
|
isEmptyContainer
|
|
59925
60041
|
)) : types_1.UnknownType.create();
|
|
60042
|
+
if (isIncomplete) {
|
|
60043
|
+
if ((0, typeUtils_1.getContainerDepth)(type) > maxInferredContainerDepth) {
|
|
60044
|
+
return { type: types_1.UnknownType.create() };
|
|
60045
|
+
}
|
|
60046
|
+
}
|
|
59926
60047
|
return { type, isIncomplete };
|
|
59927
60048
|
}
|
|
59928
60049
|
function getKeyAndValueTypesFromDictionary(node, keyTypes, valueTypes, forceStrictInference, expectedKeyType, expectedValueType, expectedTypedDictEntries, expectedDiagAddendum) {
|
|
@@ -60195,6 +60316,11 @@ var require_typeEvaluator = __commonJS({
|
|
|
60195
60316
|
void 0,
|
|
60196
60317
|
isEmptyContainer
|
|
60197
60318
|
)) : types_1.UnknownType.create();
|
|
60319
|
+
if (isIncomplete) {
|
|
60320
|
+
if ((0, typeUtils_1.getContainerDepth)(type) > maxInferredContainerDepth) {
|
|
60321
|
+
return { type: types_1.UnknownType.create() };
|
|
60322
|
+
}
|
|
60323
|
+
}
|
|
60198
60324
|
return { type, isIncomplete, typeErrors };
|
|
60199
60325
|
}
|
|
60200
60326
|
function verifySetEntryOrDictKeyIsHashable(entry, type, isDictKey) {
|
|
@@ -64776,6 +64902,13 @@ var require_typeEvaluator = __commonJS({
|
|
|
64776
64902
|
declIndexToConsider = index;
|
|
64777
64903
|
}
|
|
64778
64904
|
});
|
|
64905
|
+
} else {
|
|
64906
|
+
if (decls.length > 1 && decls.every((decl) => decl.type === 8)) {
|
|
64907
|
+
const nonExceptDecls = decls.filter((decl) => decl.type === 8 && !decl.isInExceptSuite);
|
|
64908
|
+
if (nonExceptDecls.length === 1) {
|
|
64909
|
+
declIndexToConsider = decls.findIndex((decl) => decl === nonExceptDecls[0]);
|
|
64910
|
+
}
|
|
64911
|
+
}
|
|
64779
64912
|
}
|
|
64780
64913
|
let sawExplicitTypeAlias = false;
|
|
64781
64914
|
decls.forEach((decl, index) => {
|
|
@@ -65936,7 +66069,27 @@ var require_typeEvaluator = __commonJS({
|
|
|
65936
66069
|
}
|
|
65937
66070
|
if ((0, types_1.isOverloadedFunction)(destType)) {
|
|
65938
66071
|
const overloadDiag = diag === null || diag === void 0 ? void 0 : diag.createAddendum();
|
|
65939
|
-
const
|
|
66072
|
+
const destOverloads = types_1.OverloadedFunctionType.getOverloads(destType);
|
|
66073
|
+
if ((0, types_1.isOverloadedFunction)(srcType)) {
|
|
66074
|
+
const srcOverloads = types_1.OverloadedFunctionType.getOverloads(srcType);
|
|
66075
|
+
if (destOverloads.length === srcOverloads.length) {
|
|
66076
|
+
if (destOverloads.every((destOverload, index) => {
|
|
66077
|
+
const srcOverload = srcOverloads[index];
|
|
66078
|
+
return assignType(
|
|
66079
|
+
destOverload,
|
|
66080
|
+
srcOverload,
|
|
66081
|
+
void 0,
|
|
66082
|
+
destTypeVarContext !== null && destTypeVarContext !== void 0 ? destTypeVarContext : new typeVarContext_1.TypeVarContext((0, typeUtils_1.getTypeVarScopeId)(destOverload)),
|
|
66083
|
+
srcTypeVarContext,
|
|
66084
|
+
flags,
|
|
66085
|
+
recursionCount
|
|
66086
|
+
);
|
|
66087
|
+
})) {
|
|
66088
|
+
return true;
|
|
66089
|
+
}
|
|
66090
|
+
}
|
|
66091
|
+
}
|
|
66092
|
+
const isAssignable = destOverloads.every((destOverload) => {
|
|
65940
66093
|
if (destTypeVarContext) {
|
|
65941
66094
|
destTypeVarContext.addSolveForScope((0, typeUtils_1.getTypeVarScopeId)(destOverload));
|
|
65942
66095
|
}
|
|
@@ -68257,6 +68410,10 @@ var require_checker = __commonJS({
|
|
|
68257
68410
|
if (!ParseTreeUtils.isWithinAssertExpression(node)) {
|
|
68258
68411
|
this._validateComparisonTypes(node);
|
|
68259
68412
|
}
|
|
68413
|
+
} else if (node.operator === 39 || node.operator === 40) {
|
|
68414
|
+
if (!ParseTreeUtils.isWithinAssertExpression(node)) {
|
|
68415
|
+
this._validateComparisonTypesForIsOperator(node);
|
|
68416
|
+
}
|
|
68260
68417
|
} else if (node.operator === 41 || node.operator === 42) {
|
|
68261
68418
|
if (!ParseTreeUtils.isWithinAssertExpression(node)) {
|
|
68262
68419
|
this._validateContainmentTypes(node);
|
|
@@ -68596,6 +68753,32 @@ var require_checker = __commonJS({
|
|
|
68596
68753
|
}), node);
|
|
68597
68754
|
}
|
|
68598
68755
|
}
|
|
68756
|
+
_validateComparisonTypesForIsOperator(node) {
|
|
68757
|
+
const rightType = this._evaluator.getType(node.rightExpression);
|
|
68758
|
+
if (!rightType || !(0, types_1.isNoneInstance)(rightType)) {
|
|
68759
|
+
return;
|
|
68760
|
+
}
|
|
68761
|
+
const leftType = this._evaluator.getType(node.leftExpression);
|
|
68762
|
+
if (!leftType) {
|
|
68763
|
+
return;
|
|
68764
|
+
}
|
|
68765
|
+
let foundMatchForNone = false;
|
|
68766
|
+
(0, typeUtils_1.doForEachSubtype)(leftType, (subtype) => {
|
|
68767
|
+
subtype = this._evaluator.makeTopLevelTypeVarsConcrete(subtype);
|
|
68768
|
+
if (this._evaluator.assignType(subtype, types_1.NoneType.createInstance())) {
|
|
68769
|
+
foundMatchForNone = true;
|
|
68770
|
+
}
|
|
68771
|
+
});
|
|
68772
|
+
const getMessage = () => {
|
|
68773
|
+
return node.operator === 39 ? localize_1.Localizer.Diagnostic.comparisonAlwaysFalse() : localize_1.Localizer.Diagnostic.comparisonAlwaysTrue();
|
|
68774
|
+
};
|
|
68775
|
+
if (!foundMatchForNone) {
|
|
68776
|
+
this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryComparison, diagnosticRules_1.DiagnosticRule.reportUnnecessaryComparison, getMessage().format({
|
|
68777
|
+
leftType: this._evaluator.printType(leftType, { expandTypeAlias: true }),
|
|
68778
|
+
rightType: this._evaluator.printType(rightType)
|
|
68779
|
+
}), node);
|
|
68780
|
+
}
|
|
68781
|
+
}
|
|
68599
68782
|
_validateComparisonTypes(node) {
|
|
68600
68783
|
let rightExpression = node.rightExpression;
|
|
68601
68784
|
if (rightExpression.nodeType === 7 && !rightExpression.parenthesized && ParseTreeUtils.operatorSupportsChaining(rightExpression.operator)) {
|
|
@@ -71974,11 +72157,11 @@ var require_sourceFile = __commonJS({
|
|
|
71974
72157
|
}
|
|
71975
72158
|
return documentSymbolProvider_1.DocumentSymbolProvider.getSymbolsForDocument(this._parseResults ? AnalyzerNodeInfo.getFileInfo(this._parseResults.parseTree) : void 0, this.getCachedIndexResults(), this._parseResults, this._filePath, query, token);
|
|
71976
72159
|
}
|
|
71977
|
-
getHoverForPosition(sourceMapper, position, format, evaluator, token) {
|
|
72160
|
+
getHoverForPosition(sourceMapper, position, format, evaluator, functionSignatureDisplay, token) {
|
|
71978
72161
|
if (this._isBindingNeeded || !this._parseResults) {
|
|
71979
72162
|
return void 0;
|
|
71980
72163
|
}
|
|
71981
|
-
return hoverProvider_1.HoverProvider.getHoverForPosition(sourceMapper, this._parseResults, position, format, evaluator, token);
|
|
72164
|
+
return hoverProvider_1.HoverProvider.getHoverForPosition(sourceMapper, this._parseResults, position, format, evaluator, functionSignatureDisplay, token);
|
|
71982
72165
|
}
|
|
71983
72166
|
getDocumentHighlight(sourceMapper, position, evaluator, token) {
|
|
71984
72167
|
if (this._isBindingNeeded || !this._parseResults) {
|
|
@@ -94957,8 +95140,9 @@ var BaseLinter = class {
|
|
|
94957
95140
|
}
|
|
94958
95141
|
return 3 /* Information */;
|
|
94959
95142
|
}
|
|
94960
|
-
async stdinRun(
|
|
94961
|
-
const
|
|
95143
|
+
async stdinRun(executionInfo, document) {
|
|
95144
|
+
const { execPath, args } = executionInfo;
|
|
95145
|
+
const child = (0, import_child_process3.spawn)(execPath, args, { cwd: import_coc13.workspace.root });
|
|
94962
95146
|
return new Promise((resolve) => {
|
|
94963
95147
|
child.stdin.setDefaultEncoding("utf8");
|
|
94964
95148
|
child.stdin.write(document.getText());
|
|
@@ -94977,14 +95161,14 @@ var BaseLinter = class {
|
|
|
94977
95161
|
return [];
|
|
94978
95162
|
}
|
|
94979
95163
|
try {
|
|
95164
|
+
const executionInfo = this.info.getExecutionInfo(args, import_coc13.Uri.parse(document.uri));
|
|
94980
95165
|
this.outputChannel.appendLine(`${"#".repeat(10)} Run linter ${this.info.id}:`);
|
|
94981
|
-
this.outputChannel.appendLine(
|
|
95166
|
+
this.outputChannel.appendLine(JSON.stringify(executionInfo));
|
|
94982
95167
|
this.outputChannel.appendLine("");
|
|
94983
95168
|
let result = "";
|
|
94984
95169
|
if (this.info.stdinSupport) {
|
|
94985
|
-
result = await this.stdinRun(
|
|
95170
|
+
result = await this.stdinRun(executionInfo, document);
|
|
94986
95171
|
} else {
|
|
94987
|
-
const executionInfo = this.info.getExecutionInfo(args, import_coc13.Uri.parse(document.uri));
|
|
94988
95172
|
const pythonToolsExecutionService = new PythonExecutionService();
|
|
94989
95173
|
result = (await pythonToolsExecutionService.exec(executionInfo, { cwd: import_coc13.workspace.root, token, mergeStdOutErr: false })).stdout;
|
|
94990
95174
|
}
|
|
@@ -95459,7 +95643,7 @@ var Ruff = class extends BaseLinter {
|
|
|
95459
95643
|
}
|
|
95460
95644
|
async runLinter(document, token) {
|
|
95461
95645
|
const fsPath = import_coc24.Uri.parse(document.uri).fsPath;
|
|
95462
|
-
const args = [
|
|
95646
|
+
const args = ["--format", "json", "--exit-zero", "--stdin-filename", fsPath, "-"];
|
|
95463
95647
|
return this.run(args, document, token);
|
|
95464
95648
|
}
|
|
95465
95649
|
};
|