coc-pyright
Version:
Pyright extension for coc.nvim, static type checker for Python
1,275 lines (1,264 loc) • 6.79 MB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/which/node_modules/isexe/dist/cjs/posix.js
var require_posix = __commonJS({
"node_modules/which/node_modules/isexe/dist/cjs/posix.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.sync = exports2.isexe = void 0;
var fs_1 = require("fs");
var promises_1 = require("fs/promises");
var isexe = async (path13, options = {}) => {
const { ignoreErrors = false } = options;
try {
return checkStat(await (0, promises_1.stat)(path13), options);
} catch (e) {
const er = e;
if (ignoreErrors || er.code === "EACCES")
return false;
throw er;
}
};
exports2.isexe = isexe;
var sync = (path13, options = {}) => {
const { ignoreErrors = false } = options;
try {
return checkStat((0, fs_1.statSync)(path13), options);
} catch (e) {
const er = e;
if (ignoreErrors || er.code === "EACCES")
return false;
throw er;
}
};
exports2.sync = sync;
var checkStat = (stat, options) => stat.isFile() && checkMode(stat, options);
var checkMode = (stat, options) => {
var _a, _b, _c;
const myUid = options.uid ?? ((_a = process.getuid) == null ? void 0 : _a.call(process));
const myGroups = options.groups ?? ((_b = process.getgroups) == null ? void 0 : _b.call(process)) ?? [];
const myGid = options.gid ?? ((_c = process.getgid) == null ? void 0 : _c.call(process)) ?? myGroups[0];
if (myUid === void 0 || myGid === void 0) {
throw new Error("cannot get uid or gid");
}
const groups = /* @__PURE__ */ new Set([myGid, ...myGroups]);
const mod = stat.mode;
const uid = stat.uid;
const gid = stat.gid;
const u = parseInt("100", 8);
const g = parseInt("010", 8);
const o = parseInt("001", 8);
const ug = u | g;
return !!(mod & o || mod & g && groups.has(gid) || mod & u && uid === myUid || mod & ug && myUid === 0);
};
}
});
// node_modules/which/node_modules/isexe/dist/cjs/win32.js
var require_win32 = __commonJS({
"node_modules/which/node_modules/isexe/dist/cjs/win32.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.sync = exports2.isexe = void 0;
var fs_1 = require("fs");
var promises_1 = require("fs/promises");
var isexe = async (path13, options = {}) => {
const { ignoreErrors = false } = options;
try {
return checkStat(await (0, promises_1.stat)(path13), path13, options);
} catch (e) {
const er = e;
if (ignoreErrors || er.code === "EACCES")
return false;
throw er;
}
};
exports2.isexe = isexe;
var sync = (path13, options = {}) => {
const { ignoreErrors = false } = options;
try {
return checkStat((0, fs_1.statSync)(path13), path13, options);
} catch (e) {
const er = e;
if (ignoreErrors || er.code === "EACCES")
return false;
throw er;
}
};
exports2.sync = sync;
var checkPathExt = (path13, options) => {
const { pathExt = process.env.PATHEXT || "" } = options;
const peSplit = pathExt.split(";");
if (peSplit.indexOf("") !== -1) {
return true;
}
for (let i = 0; i < peSplit.length; i++) {
const p = peSplit[i].toLowerCase();
const ext2 = path13.substring(path13.length - p.length).toLowerCase();
if (p && ext2 === p) {
return true;
}
}
return false;
};
var checkStat = (stat, path13, options) => stat.isFile() && checkPathExt(path13, options);
}
});
// node_modules/which/node_modules/isexe/dist/cjs/options.js
var require_options = __commonJS({
"node_modules/which/node_modules/isexe/dist/cjs/options.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
}
});
// node_modules/which/node_modules/isexe/dist/cjs/index.js
var require_cjs = __commonJS({
"node_modules/which/node_modules/isexe/dist/cjs/index.js"(exports2) {
"use strict";
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
if (k2 === void 0) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() {
return m[k];
} };
}
Object.defineProperty(o, k2, desc);
} : function(o, m, k, k2) {
if (k2 === void 0) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
});
var __importStar = exports2 && exports2.__importStar || function(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) {
for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
};
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.sync = exports2.isexe = exports2.posix = exports2.win32 = void 0;
var posix = __importStar(require_posix());
exports2.posix = posix;
var win32 = __importStar(require_win32());
exports2.win32 = win32;
__exportStar(require_options(), exports2);
var platform = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
var impl = platform === "win32" ? win32 : posix;
exports2.isexe = impl.isexe;
exports2.sync = impl.sync;
}
});
// node_modules/which/lib/index.js
var require_lib = __commonJS({
"node_modules/which/lib/index.js"(exports2, module2) {
var { isexe, sync: isexeSync } = require_cjs();
var { join: join4, delimiter, sep: sep2, posix } = require("path");
var isWindows = process.platform === "win32";
var rSlash = new RegExp(`[${posix.sep}${sep2 === posix.sep ? "" : sep2}]`.replace(/(\\)/g, "\\$1"));
var rRel = new RegExp(`^\\.${rSlash.source}`);
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
var getPathInfo = (cmd, {
path: optPath = process.env.PATH,
pathExt: optPathExt = process.env.PATHEXT,
delimiter: optDelimiter = delimiter
}) => {
const pathEnv = cmd.match(rSlash) ? [""] : [
// windows always checks the cwd first
...isWindows ? [process.cwd()] : [],
...(optPath || /* istanbul ignore next: very unusual */
"").split(optDelimiter)
];
if (isWindows) {
const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]);
if (cmd.includes(".") && pathExt[0] !== "") {
pathExt.unshift("");
}
return { pathEnv, pathExt, pathExtExe };
}
return { pathEnv, pathExt: [""] };
};
var getPathPart = (raw, cmd) => {
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
return prefix + join4(pathPart, cmd);
};
var which6 = async (cmd, opt = {}) => {
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
const found = [];
for (const envPart of pathEnv) {
const p = getPathPart(envPart, cmd);
for (const ext2 of pathExt) {
const withExt = p + ext2;
const is = await isexe(withExt, { pathExt: pathExtExe, ignoreErrors: true });
if (is) {
if (!opt.all) {
return withExt;
}
found.push(withExt);
}
}
}
if (opt.all && found.length) {
return found;
}
if (opt.nothrow) {
return null;
}
throw getNotFoundError(cmd);
};
var whichSync = (cmd, opt = {}) => {
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
const found = [];
for (const pathEnvPart of pathEnv) {
const p = getPathPart(pathEnvPart, cmd);
for (const ext2 of pathExt) {
const withExt = p + ext2;
const is = isexeSync(withExt, { pathExt: pathExtExe, ignoreErrors: true });
if (is) {
if (!opt.all) {
return withExt;
}
found.push(withExt);
}
}
}
if (opt.all && found.length) {
return found;
}
if (opt.nothrow) {
return null;
}
throw getNotFoundError(cmd);
};
module2.exports = which6;
which6.sync = whichSync;
}
});
// node_modules/@zzzen/pyright-internal/dist/common/textRange.js
var require_textRange = __commonJS({
"node_modules/@zzzen/pyright-internal/dist/common/textRange.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.Range = exports2.Position = exports2.TextRange = void 0;
exports2.comparePositions = comparePositions;
exports2.getEmptyPosition = getEmptyPosition;
exports2.doRangesOverlap = doRangesOverlap;
exports2.doRangesIntersect = doRangesIntersect;
exports2.doesRangeContain = doesRangeContain;
exports2.positionsAreEqual = positionsAreEqual;
exports2.rangesAreEqual = rangesAreEqual;
exports2.getEmptyRange = getEmptyRange;
exports2.isEmptyPosition = isEmptyPosition;
exports2.isEmptyRange = isEmptyRange;
exports2.extendRange = extendRange;
exports2.combineRange = combineRange;
var TextRange;
(function(TextRange2) {
function create(start, length) {
if (start < 0) {
throw new Error("start must be non-negative");
}
if (length < 0) {
throw new Error("length must be non-negative");
}
return { start, length };
}
TextRange2.create = create;
function fromBounds(start, end) {
if (start < 0) {
throw new Error("start must be non-negative");
}
if (start > end) {
throw new Error("end must be greater than or equal to start");
}
return create(start, end - start);
}
TextRange2.fromBounds = fromBounds;
function getEnd(range) {
return range.start + range.length;
}
TextRange2.getEnd = getEnd;
function contains(range, position) {
return position >= range.start && position < getEnd(range);
}
TextRange2.contains = contains;
function containsRange(range, span) {
return span.start >= range.start && getEnd(span) <= getEnd(range);
}
TextRange2.containsRange = containsRange;
function overlaps(range, position) {
return position >= range.start && position <= getEnd(range);
}
TextRange2.overlaps = overlaps;
function overlapsRange(range, other) {
return overlaps(range, other.start) || overlaps(other, range.start);
}
TextRange2.overlapsRange = overlapsRange;
function extend(range, extension) {
let result = range;
if (extension) {
if (Array.isArray(extension)) {
extension.forEach((r) => {
result = extend(result, r);
});
} else {
if (extension.start < result.start) {
result = {
start: extension.start,
length: result.length + result.start - extension.start
};
}
const extensionEnd = getEnd(extension);
const resultEnd = getEnd(result);
if (extensionEnd > resultEnd) {
result = {
start: result.start,
length: result.length + extensionEnd - resultEnd
};
}
}
}
return result;
}
TextRange2.extend = extend;
function combine(ranges) {
if (ranges.length === 0) {
return void 0;
}
let combinedRange = { start: ranges[0].start, length: ranges[0].length };
for (let i = 1; i < ranges.length; i++) {
combinedRange = extend(combinedRange, ranges[i]);
}
return combinedRange;
}
TextRange2.combine = combine;
})(TextRange || (exports2.TextRange = TextRange = {}));
var Position7;
(function(Position8) {
function is(value) {
const candidate = value;
return candidate && candidate.line !== void 0 && candidate.character !== void 0;
}
Position8.is = is;
function print(value) {
return `(${value.line}:${value.character})`;
}
Position8.print = print;
})(Position7 || (exports2.Position = Position7 = {}));
var Range8;
(function(Range9) {
function is(value) {
const candidate = value;
return candidate && candidate.start !== void 0 && candidate.end !== void 0;
}
Range9.is = is;
function print(value) {
return `${Position7.print(value.start)}-${Position7.print(value.end)}`;
}
Range9.print = print;
})(Range8 || (exports2.Range = Range8 = {}));
function comparePositions(a, b) {
if (a.line < b.line) {
return -1;
} else if (a.line > b.line) {
return 1;
} else if (a.character < b.character) {
return -1;
} else if (a.character > b.character) {
return 1;
}
return 0;
}
function getEmptyPosition() {
return {
line: 0,
character: 0
};
}
function doRangesOverlap(a, b) {
if (comparePositions(b.start, a.end) >= 0) {
return false;
} else if (comparePositions(a.start, b.end) >= 0) {
return false;
}
return true;
}
function doRangesIntersect(a, b) {
if (comparePositions(b.start, a.end) > 0) {
return false;
} else if (comparePositions(a.start, b.end) > 0) {
return false;
}
return true;
}
function doesRangeContain(range, positionOrRange) {
if (Position7.is(positionOrRange)) {
return comparePositions(range.start, positionOrRange) <= 0 && comparePositions(range.end, positionOrRange) >= 0;
}
return doesRangeContain(range, positionOrRange.start) && doesRangeContain(range, positionOrRange.end);
}
function positionsAreEqual(a, b) {
return comparePositions(a, b) === 0;
}
function rangesAreEqual(a, b) {
return positionsAreEqual(a.start, b.start) && positionsAreEqual(a.end, b.end);
}
function getEmptyRange() {
return {
start: getEmptyPosition(),
end: getEmptyPosition()
};
}
function isEmptyPosition(pos) {
return pos.character === 0 && pos.line === 0;
}
function isEmptyRange(range) {
return isEmptyPosition(range.start) && isEmptyPosition(range.end);
}
function extendRange(range, extension) {
if (extension) {
if (Array.isArray(extension)) {
extension.forEach((r) => {
extendRange(range, r);
});
} else {
if (comparePositions(extension.start, range.start) < 0) {
range.start = extension.start;
}
if (comparePositions(extension.end, range.end) > 0) {
range.end = extension.end;
}
}
}
}
function combineRange(ranges) {
if (ranges.length === 0) {
return void 0;
}
const combinedRange = ranges[0];
for (let i = 1; i < ranges.length; i++) {
extendRange(combinedRange, ranges[i]);
}
return combinedRange;
}
}
});
// node_modules/@zzzen/pyright-internal/dist/common/core.js
var require_core = __commonJS({
"node_modules/@zzzen/pyright-internal/dist/common/core.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.Disposable = exports2.Comparison = void 0;
exports2.returnFalse = returnFalse;
exports2.returnTrue = returnTrue;
exports2.returnUndefined = returnUndefined;
exports2.identity = identity;
exports2.toLowerCase = toLowerCase;
exports2.equateValues = equateValues;
exports2.compareComparableValues = compareComparableValues;
exports2.compareValues = compareValues;
exports2.isArray = isArray2;
exports2.isString = isString2;
exports2.isNumber = isNumber;
exports2.isBoolean = isBoolean;
exports2.hasProperty = hasProperty;
exports2.toBoolean = toBoolean;
exports2.test_setDebugMode = test_setDebugMode;
exports2.isDebugMode = isDebugMode;
exports2.isThenable = isThenable;
exports2.isDefined = isDefined;
exports2.getEnumNames = getEnumNames;
exports2.containsOnlyWhitespace = containsOnlyWhitespace;
exports2.cloneStr = cloneStr;
var textRange_1 = require_textRange();
var Comparison;
(function(Comparison2) {
Comparison2[Comparison2["LessThan"] = -1] = "LessThan";
Comparison2[Comparison2["EqualTo"] = 0] = "EqualTo";
Comparison2[Comparison2["GreaterThan"] = 1] = "GreaterThan";
})(Comparison || (exports2.Comparison = Comparison = {}));
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
function returnUndefined() {
return void 0;
}
function identity(x) {
return x;
}
function toLowerCase(x) {
return x.toLowerCase();
}
function equateValues(a, b) {
return a === b;
}
function compareComparableValues(a, b) {
return a === b ? 0 : a === void 0 ? -1 : b === void 0 ? 1 : a < b ? -1 : 1;
}
function compareValues(a, b) {
return compareComparableValues(a, b);
}
function isArray2(value) {
return Array.isArray ? Array.isArray(value) : value instanceof Array;
}
function isString2(text) {
return typeof text === "string";
}
function isNumber(x) {
return typeof x === "number";
}
function isBoolean(x) {
return typeof x === "boolean";
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasProperty(map, key) {
return hasOwnProperty.call(map, key);
}
function toBoolean(trueOrFalse) {
const normalized = trueOrFalse == null ? void 0 : trueOrFalse.trim().toUpperCase();
if (normalized === "TRUE") {
return true;
}
return false;
}
var _debugMode = void 0;
function test_setDebugMode(debugMode) {
const oldValue = _debugMode;
_debugMode = debugMode;
return oldValue;
}
function isDebugMode() {
if (_debugMode === void 0) {
const argv = process.execArgv.join();
_debugMode = argv.includes("inspect") || argv.includes("debug");
}
return _debugMode;
}
function isThenable(v) {
return typeof (v == null ? void 0 : v.then) === "function";
}
function isDefined(element) {
return element !== void 0;
}
function getEnumNames(enumType) {
const result = [];
for (const value in enumType) {
if (isNaN(Number(value))) {
result.push(value);
}
}
return result;
}
function containsOnlyWhitespace(text, span) {
if (span) {
text = text.substring(span.start, textRange_1.TextRange.getEnd(span));
}
return /^\s*$/.test(text);
}
function cloneStr(str) {
return Buffer.from(str, "utf8").toString("utf8");
}
var Disposable;
(function(Disposable2) {
function is(value) {
return value && typeof value.dispose === "function";
}
Disposable2.is = is;
})(Disposable || (exports2.Disposable = Disposable = {}));
}
});
// node_modules/@zzzen/pyright-internal/dist/common/collectionUtils.js
var require_collectionUtils = __commonJS({
"node_modules/@zzzen/pyright-internal/dist/common/collectionUtils.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.emptyArray = void 0;
exports2.contains = contains;
exports2.append = append;
exports2.appendArray = appendArray;
exports2.partition = partition;
exports2.find = find;
exports2.addRange = addRange;
exports2.insertAt = insertAt;
exports2.cloneAndSort = cloneAndSort;
exports2.stableSort = stableSort;
exports2.map = map;
exports2.some = some;
exports2.every = every;
exports2.binarySearch = binarySearch;
exports2.binarySearchKey = binarySearchKey;
exports2.flatten = flatten;
exports2.getNestedProperty = getNestedProperty;
exports2.getOrAdd = getOrAdd;
exports2.removeArrayElements = removeArrayElements;
exports2.createMapFromItems = createMapFromItems;
exports2.addIfUnique = addIfUnique;
exports2.getMapValues = getMapValues;
exports2.addIfNotNull = addIfNotNull;
exports2.arrayEquals = arrayEquals;
var core_1 = require_core();
exports2.emptyArray = [];
function contains(array, value, equalityComparer = core_1.equateValues) {
if (array) {
for (const v of array) {
if (equalityComparer(v, value)) {
return true;
}
}
}
return false;
}
function append(to, value) {
if (value === void 0) {
return to;
}
if (to === void 0) {
return [value];
}
to.push(value);
return to;
}
function appendArray(to, elementsToPush) {
if (elementsToPush.length < 256) {
to.push(...elementsToPush);
return;
}
for (const elem of elementsToPush) {
to.push(elem);
}
}
function partition(array, cb) {
const trueItems = [];
const falseItems = [];
for (const item of array) {
if (cb(item)) {
trueItems.push(item);
} else {
falseItems.push(item);
}
}
return [trueItems, falseItems];
}
function find(array, predicate) {
for (let i = 0; i < array.length; i++) {
const value = array[i];
if (predicate(value, i)) {
return value;
}
}
return void 0;
}
function toOffset(array, offset) {
return offset < 0 ? array.length + offset : offset;
}
function addRange(to, from, start, end) {
if (from === void 0 || from.length === 0) {
return to;
}
if (to === void 0) {
return from.slice(start, end);
}
start = start === void 0 ? 0 : toOffset(from, start);
end = end === void 0 ? from.length : toOffset(from, end);
for (let i = start; i < end && i < from.length; i++) {
if (from[i] !== void 0) {
to.push(from[i]);
}
}
return to;
}
function insertAt(array, index, value) {
if (index === 0) {
array.unshift(value);
} else if (index === array.length) {
array.push(value);
} else {
for (let i = array.length; i > index; i--) {
array[i] = array[i - 1];
}
array[index] = value;
}
return array;
}
function cloneAndSort(array, comparer) {
return array.length === 0 ? array : array.slice().sort(comparer);
}
function selectIndex(_, i) {
return i;
}
function indicesOf(array) {
return array.map(selectIndex);
}
function stableSort(array, comparer) {
const indices = indicesOf(array);
stableSortIndices(array, indices, comparer);
return indices.map((i) => array[i]);
}
function stableSortIndices(array, indices, comparer) {
indices.sort((x, y) => comparer(array[x], array[y]) || (0, core_1.compareValues)(x, y));
}
function map(array, f) {
if (array) {
return array.map(f);
}
return void 0;
}
function some(array, predicate) {
if (array) {
if (predicate) {
return array.some(predicate);
} else {
return array.length > 0;
}
}
return false;
}
function every(array, callback) {
if (array) {
return array.every(callback);
}
return true;
}
function binarySearch(array, value, keySelector, keyComparer, offset) {
return binarySearchKey(array, keySelector(value), keySelector, keyComparer, offset);
}
function binarySearchKey(array, key, keySelector, keyComparer, offset) {
if (!some(array)) {
return -1;
}
let low = offset || 0;
let high = array.length - 1;
while (low <= high) {
const middle = low + (high - low >> 1);
const midKey = keySelector(array[middle]);
switch (keyComparer(midKey, key)) {
case -1:
low = middle + 1;
break;
case 0:
return middle;
case 1:
high = middle - 1;
break;
}
}
return ~low;
}
function flatten(array) {
const result = [];
for (const v of array) {
if (v) {
if ((0, core_1.isArray)(v)) {
addRange(result, v);
} else {
result.push(v);
}
}
}
return result;
}
function getNestedProperty(object, property) {
const value = property.split(".").reduce((obj, prop) => {
return obj && obj[prop];
}, object);
return value;
}
function getOrAdd(map2, key, newValueFactory) {
const value = map2.get(key);
if (value !== void 0) {
return value;
}
const newValue = newValueFactory();
map2.set(key, newValue);
return newValue;
}
function removeArrayElements(array, predicate) {
for (let i = 0; i < array.length; i++) {
if (predicate(array[i])) {
array.splice(i, 1);
i--;
}
}
return array;
}
function createMapFromItems(items, keyGetter) {
return items.map((t) => keyGetter(t)).reduce((map2, key, i) => {
map2.set(key, (map2.get(key) || []).concat(items[i]));
return map2;
}, /* @__PURE__ */ new Map());
}
function addIfUnique(arr, t, equalityComparer = core_1.equateValues) {
if (contains(arr, t, equalityComparer)) {
return arr;
}
arr.push(t);
return arr;
}
function getMapValues(m, predicate) {
const values = [];
m.forEach((v, k) => {
if (predicate(k, v)) {
values.push(v);
}
});
return values;
}
function addIfNotNull(arr, t) {
if (t === void 0) {
return arr;
}
arr.push(t);
return arr;
}
function arrayEquals(c1, c2, predicate) {
if (c1.length !== c2.length) {
return false;
}
return c1.every((v, i) => predicate(v, c2[i]));
}
}
});
// node_modules/vscode-uri/lib/umd/index.js
var require_umd = __commonJS({
"node_modules/vscode-uri/lib/umd/index.js"(exports2, module2) {
!function(t, e) {
if ("object" == typeof exports2 && "object" == typeof module2) module2.exports = e();
else if ("function" == typeof define && define.amd) define([], e);
else {
var r = e();
for (var n in r) ("object" == typeof exports2 ? exports2 : t)[n] = r[n];
}
}(exports2, () => (() => {
"use strict";
var t = { 470: (t2) => {
function e2(t3) {
if ("string" != typeof t3) throw new TypeError("Path must be a string. Received " + JSON.stringify(t3));
}
function r2(t3, e3) {
for (var r3, n3 = "", i = 0, o = -1, s = 0, a = 0; a <= t3.length; ++a) {
if (a < t3.length) r3 = t3.charCodeAt(a);
else {
if (47 === r3) break;
r3 = 47;
}
if (47 === r3) {
if (o === a - 1 || 1 === s) ;
else if (o !== a - 1 && 2 === s) {
if (n3.length < 2 || 2 !== i || 46 !== n3.charCodeAt(n3.length - 1) || 46 !== n3.charCodeAt(n3.length - 2)) {
if (n3.length > 2) {
var h = n3.lastIndexOf("/");
if (h !== n3.length - 1) {
-1 === h ? (n3 = "", i = 0) : i = (n3 = n3.slice(0, h)).length - 1 - n3.lastIndexOf("/"), o = a, s = 0;
continue;
}
} else if (2 === n3.length || 1 === n3.length) {
n3 = "", i = 0, o = a, s = 0;
continue;
}
}
e3 && (n3.length > 0 ? n3 += "/.." : n3 = "..", i = 2);
} else n3.length > 0 ? n3 += "/" + t3.slice(o + 1, a) : n3 = t3.slice(o + 1, a), i = a - o - 1;
o = a, s = 0;
} else 46 === r3 && -1 !== s ? ++s : s = -1;
}
return n3;
}
var n2 = { resolve: function() {
for (var t3, n3 = "", i = false, o = arguments.length - 1; o >= -1 && !i; o--) {
var s;
o >= 0 ? s = arguments[o] : (void 0 === t3 && (t3 = process.cwd()), s = t3), e2(s), 0 !== s.length && (n3 = s + "/" + n3, i = 47 === s.charCodeAt(0));
}
return n3 = r2(n3, !i), i ? n3.length > 0 ? "/" + n3 : "/" : n3.length > 0 ? n3 : ".";
}, normalize: function(t3) {
if (e2(t3), 0 === t3.length) return ".";
var n3 = 47 === t3.charCodeAt(0), i = 47 === t3.charCodeAt(t3.length - 1);
return 0 !== (t3 = r2(t3, !n3)).length || n3 || (t3 = "."), t3.length > 0 && i && (t3 += "/"), n3 ? "/" + t3 : t3;
}, isAbsolute: function(t3) {
return e2(t3), t3.length > 0 && 47 === t3.charCodeAt(0);
}, join: function() {
if (0 === arguments.length) return ".";
for (var t3, r3 = 0; r3 < arguments.length; ++r3) {
var i = arguments[r3];
e2(i), i.length > 0 && (void 0 === t3 ? t3 = i : t3 += "/" + i);
}
return void 0 === t3 ? "." : n2.normalize(t3);
}, relative: function(t3, r3) {
if (e2(t3), e2(r3), t3 === r3) return "";
if ((t3 = n2.resolve(t3)) === (r3 = n2.resolve(r3))) return "";
for (var i = 1; i < t3.length && 47 === t3.charCodeAt(i); ++i) ;
for (var o = t3.length, s = o - i, a = 1; a < r3.length && 47 === r3.charCodeAt(a); ++a) ;
for (var h = r3.length - a, c = s < h ? s : h, f = -1, u = 0; u <= c; ++u) {
if (u === c) {
if (h > c) {
if (47 === r3.charCodeAt(a + u)) return r3.slice(a + u + 1);
if (0 === u) return r3.slice(a + u);
} else s > c && (47 === t3.charCodeAt(i + u) ? f = u : 0 === u && (f = 0));
break;
}
var l = t3.charCodeAt(i + u);
if (l !== r3.charCodeAt(a + u)) break;
47 === l && (f = u);
}
var d = "";
for (u = i + f + 1; u <= o; ++u) u !== o && 47 !== t3.charCodeAt(u) || (0 === d.length ? d += ".." : d += "/..");
return d.length > 0 ? d + r3.slice(a + f) : (a += f, 47 === r3.charCodeAt(a) && ++a, r3.slice(a));
}, _makeLong: function(t3) {
return t3;
}, dirname: function(t3) {
if (e2(t3), 0 === t3.length) return ".";
for (var r3 = t3.charCodeAt(0), n3 = 47 === r3, i = -1, o = true, s = t3.length - 1; s >= 1; --s) if (47 === (r3 = t3.charCodeAt(s))) {
if (!o) {
i = s;
break;
}
} else o = false;
return -1 === i ? n3 ? "/" : "." : n3 && 1 === i ? "//" : t3.slice(0, i);
}, basename: function(t3, r3) {
if (void 0 !== r3 && "string" != typeof r3) throw new TypeError('"ext" argument must be a string');
e2(t3);
var n3, i = 0, o = -1, s = true;
if (void 0 !== r3 && r3.length > 0 && r3.length <= t3.length) {
if (r3.length === t3.length && r3 === t3) return "";
var a = r3.length - 1, h = -1;
for (n3 = t3.length - 1; n3 >= 0; --n3) {
var c = t3.charCodeAt(n3);
if (47 === c) {
if (!s) {
i = n3 + 1;
break;
}
} else -1 === h && (s = false, h = n3 + 1), a >= 0 && (c === r3.charCodeAt(a) ? -1 == --a && (o = n3) : (a = -1, o = h));
}
return i === o ? o = h : -1 === o && (o = t3.length), t3.slice(i, o);
}
for (n3 = t3.length - 1; n3 >= 0; --n3) if (47 === t3.charCodeAt(n3)) {
if (!s) {
i = n3 + 1;
break;
}
} else -1 === o && (s = false, o = n3 + 1);
return -1 === o ? "" : t3.slice(i, o);
}, extname: function(t3) {
e2(t3);
for (var r3 = -1, n3 = 0, i = -1, o = true, s = 0, a = t3.length - 1; a >= 0; --a) {
var h = t3.charCodeAt(a);
if (47 !== h) -1 === i && (o = false, i = a + 1), 46 === h ? -1 === r3 ? r3 = a : 1 !== s && (s = 1) : -1 !== r3 && (s = -1);
else if (!o) {
n3 = a + 1;
break;
}
}
return -1 === r3 || -1 === i || 0 === s || 1 === s && r3 === i - 1 && r3 === n3 + 1 ? "" : t3.slice(r3, i);
}, format: function(t3) {
if (null === t3 || "object" != typeof t3) throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof t3);
return function(t4, e3) {
var r3 = e3.dir || e3.root, n3 = e3.base || (e3.name || "") + (e3.ext || "");
return r3 ? r3 === e3.root ? r3 + n3 : r3 + "/" + n3 : n3;
}(0, t3);
}, parse: function(t3) {
e2(t3);
var r3 = { root: "", dir: "", base: "", ext: "", name: "" };
if (0 === t3.length) return r3;
var n3, i = t3.charCodeAt(0), o = 47 === i;
o ? (r3.root = "/", n3 = 1) : n3 = 0;
for (var s = -1, a = 0, h = -1, c = true, f = t3.length - 1, u = 0; f >= n3; --f) if (47 !== (i = t3.charCodeAt(f))) -1 === h && (c = false, h = f + 1), 46 === i ? -1 === s ? s = f : 1 !== u && (u = 1) : -1 !== s && (u = -1);
else if (!c) {
a = f + 1;
break;
}
return -1 === s || -1 === h || 0 === u || 1 === u && s === h - 1 && s === a + 1 ? -1 !== h && (r3.base = r3.name = 0 === a && o ? t3.slice(1, h) : t3.slice(a, h)) : (0 === a && o ? (r3.name = t3.slice(1, s), r3.base = t3.slice(1, h)) : (r3.name = t3.slice(a, s), r3.base = t3.slice(a, h)), r3.ext = t3.slice(s, h)), a > 0 ? r3.dir = t3.slice(0, a - 1) : o && (r3.dir = "/"), r3;
}, sep: "/", delimiter: ":", win32: null, posix: null };
n2.posix = n2, t2.exports = n2;
}, 674: (t2, e2) => {
if (Object.defineProperty(e2, "__esModule", { value: true }), e2.isWindows = void 0, "object" == typeof process) e2.isWindows = "win32" === process.platform;
else if ("object" == typeof navigator) {
let t3 = navigator.userAgent;
e2.isWindows = t3.indexOf("Windows") >= 0;
}
}, 796: (t2, e2, r2) => {
Object.defineProperty(e2, "__esModule", { value: true }), e2.uriToFsPath = e2.URI = void 0;
const n2 = r2(674), i = /^\w[\w\d+.-]*$/, o = /^\//, s = /^\/\//;
function a(t3, e3) {
if (!t3.scheme && e3) throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t3.authority}", path: "${t3.path}", query: "${t3.query}", fragment: "${t3.fragment}"}`);
if (t3.scheme && !i.test(t3.scheme)) throw new Error("[UriError]: Scheme contains illegal characters.");
if (t3.path) {
if (t3.authority) {
if (!o.test(t3.path)) throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character');
} else if (s.test(t3.path)) throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")');
}
}
const h = "", c = "/", f = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
class u {
static isUri(t3) {
return t3 instanceof u || !!t3 && "string" == typeof t3.authority && "string" == typeof t3.fragment && "string" == typeof t3.path && "string" == typeof t3.query && "string" == typeof t3.scheme && "string" == typeof t3.fsPath && "function" == typeof t3.with && "function" == typeof t3.toString;
}
scheme;
authority;
path;
query;
fragment;
constructor(t3, e3, r3, n3, i2, o2 = false) {
"object" == typeof t3 ? (this.scheme = t3.scheme || h, this.authority = t3.authority || h, this.path = t3.path || h, this.query = t3.query || h, this.fragment = t3.fragment || h) : (this.scheme = /* @__PURE__ */ function(t4, e4) {
return t4 || e4 ? t4 : "file";
}(t3, o2), this.authority = e3 || h, this.path = function(t4, e4) {
switch (t4) {
case "https":
case "http":
case "file":
e4 ? e4[0] !== c && (e4 = c + e4) : e4 = c;
}
return e4;
}(this.scheme, r3 || h), this.query = n3 || h, this.fragment = i2 || h, a(this, o2));
}
get fsPath() {
return v(this, false);
}
with(t3) {
if (!t3) return this;
let { scheme: e3, authority: r3, path: n3, query: i2, fragment: o2 } = t3;
return void 0 === e3 ? e3 = this.scheme : null === e3 && (e3 = h), void 0 === r3 ? r3 = this.authority : null === r3 && (r3 = h), void 0 === n3 ? n3 = this.path : null === n3 && (n3 = h), void 0 === i2 ? i2 = this.query : null === i2 && (i2 = h), void 0 === o2 ? o2 = this.fragment : null === o2 && (o2 = h), e3 === this.scheme && r3 === this.authority && n3 === this.path && i2 === this.query && o2 === this.fragment ? this : new d(e3, r3, n3, i2, o2);
}
static parse(t3, e3 = false) {
const r3 = f.exec(t3);
return r3 ? new d(r3[2] || h, w(r3[4] || h), w(r3[5] || h), w(r3[7] || h), w(r3[9] || h), e3) : new d(h, h, h, h, h);
}
static file(t3) {
let e3 = h;
if (n2.isWindows && (t3 = t3.replace(/\\/g, c)), t3[0] === c && t3[1] === c) {
const r3 = t3.indexOf(c, 2);
-1 === r3 ? (e3 = t3.substring(2), t3 = c) : (e3 = t3.substring(2, r3), t3 = t3.substring(r3) || c);
}
return new d("file", e3, t3, h, h);
}
static from(t3) {
const e3 = new d(t3.scheme, t3.authority, t3.path, t3.query, t3.fragment);
return a(e3, true), e3;
}
toString(t3 = false) {
return y(this, t3);
}
toJSON() {
return this;
}
static revive(t3) {
if (t3) {
if (t3 instanceof u) return t3;
{
const e3 = new d(t3);
return e3._formatted = t3.external, e3._fsPath = t3._sep === l ? t3.fsPath : null, e3;
}
}
return t3;
}
}
e2.URI = u;
const l = n2.isWindows ? 1 : void 0;
class d extends u {
_formatted = null;
_fsPath = null;
get fsPath() {
return this._fsPath || (this._fsPath = v(this, false)), this._fsPath;
}
toString(t3 = false) {
return t3 ? y(this, true) : (this._formatted || (this._formatted = y(this, false)), this._formatted);
}
toJSON() {
const t3 = { $mid: 1 };
return this._fsPath && (t3.fsPath = this._fsPath, t3._sep = l), this._formatted && (t3.external = this._formatted), this.path && (t3.path = this.path), this.scheme && (t3.scheme = this.scheme), this.authority && (t3.authority = this.authority), this.query && (t3.query = this.query), this.fragment && (t3.fragment = this.fragment), t3;
}
}
const p = { 58: "%3A", 47: "%2F", 63: "%3F", 35: "%23", 91: "%5B", 93: "%5D", 64: "%40", 33: "%21", 36: "%24", 38: "%26", 39: "%27", 40: "%28", 41: "%29", 42: "%2A", 43: "%2B", 44: "%2C", 59: "%3B", 61: "%3D", 32: "%20" };
function g(t3, e3, r3) {
let n3, i2 = -1;
for (let o2 = 0; o2 < t3.length; o2++) {
const s2 = t3.charCodeAt(o2);
if (s2 >= 97 && s2 <= 122 || s2 >= 65 && s2 <= 90 || s2 >= 48 && s2 <= 57 || 45 === s2 || 46 === s2 || 95 === s2 || 126 === s2 || e3 && 47 === s2 || r3 && 91 === s2 || r3 && 93 === s2 || r3 && 58 === s2) -1 !== i2 && (n3 += encodeURIComponent(t3.substring(i2, o2)), i2 = -1), void 0 !== n3 && (n3 += t3.charAt(o2));
else {
void 0 === n3 && (n3 = t3.substr(0, o2));
const e4 = p[s2];
void 0 !== e4 ? (-1 !== i2 && (n3 += encodeURIComponent(t3.substring(i2, o2)), i2 = -1), n3 += e4) : -1 === i2 && (i2 = o2);
}
}
return -1 !== i2 && (n3 += encodeURIComponent(t3.substring(i2))), void 0 !== n3 ? n3 : t3;
}
function m(t3) {
let e3;
for (let r3 = 0; r3 < t3.length; r3++) {
const n3 = t3.charCodeAt(r3);
35 === n3 || 63 === n3 ? (void 0 === e3 && (e3 = t3.substr(0, r3)), e3 += p[n3]) : void 0 !== e3 && (e3 += t3[r3]);
}
return void 0 !== e3 ? e3 : t3;
}
function v(t3, e3) {
let r3;
return r3 = t3.authority && t3.path.length > 1 && "file" === t3.scheme ? `//${t3.authority}${t3.path}` : 47 === t3.path.charCodeAt(0) && (t3.path.charCodeAt(1) >= 65 && t3.path.charCodeAt(1) <= 90 || t3.path.charCodeAt(1) >= 97 && t3.path.charCodeAt(1) <= 122) && 58 === t3.path.charCodeAt(2) ? e3 ? t3.path.substr(1) : t3.path[1].toLowerCase() + t3.path.substr(2) : t3.path, n2.isWindows && (r3 = r3.replace(/\//g, "\\")), r3;
}
function y(t3, e3) {
const r3 = e3 ? m : g;
let n3 = "", { scheme: i2, authority: o2, path: s2, query: a2, fragment: h2 } = t3;
if (i2 && (n3 += i2, n3 += ":"), (o2 || "file" === i2) && (n3 += c, n3 += c), o2) {
let t4 = o2.indexOf("@");
if (-1 !== t4) {
const e4 = o2.substr(0, t4);
o2 = o2.substr(t4 + 1), t4 = e4.lastIndexOf(":"), -1 === t4 ? n3 += r3(e4, false, false) : (n3 += r3(e4.substr(0, t4), false, false), n3 += ":", n3 += r3(e4.substr(t4 + 1), false, true)), n3 += "@";
}
o2 = o2.toLowerCase(), t4 = o2.lastIndexOf(":"), -1 === t4 ? n3 += r3(o2, false, true) : (n3 += r3(o2.substr(0, t4), false, true), n3 += o2.substr(t4));
}
if (s2) {
if (s2.length >= 3 && 47 === s2.charCodeAt(0) && 58 === s2.charCodeAt(2)) {
const t4 = s2.charCodeAt(1);
t4 >= 65 && t4 <= 90 && (s2 = `/${String.fromCharCode(t4 + 32)}:${s2.substr(3)}`);
} else if (s2.length >= 2 && 58 === s2.charCodeAt(1)) {
const t4 = s2.charCodeAt(0);
t4 >= 65 && t4 <= 90 && (s2 = `${String.fromCharCode(t4 + 32)}:${s2.substr(2)}`);
}
n3 += r3(s2, true, false);
}
return a2 && (n3 += "?", n3 += r3(a2, false, false)), h2 && (n3 += "#", n3 += e3 ? h2 : g(h2, false, false)), n3;
}
function b(t3) {
try {
return decodeURIComponent(t3);
} catch {
return t3.length > 3 ? t3.substr(0, 3) + b(t3.substr(3)) : t3;
}
}
e2.uriToFsPath = v;
const C = /(%[0-9A-Za-z][0-9A-Za-z])+/g;
function w(t3) {
return t3.match(C) ? t3.replace(C, (t4) => b(t4)) : t3;
}
}, 679: function(t2, e2, r2) {
var n2 = this && this.__createBinding || (Object.create ? function(t3, e3, r3, n3) {
void 0 === n3 && (n3 = r3);
var i2 = Object.getOwnPropertyDescriptor(e3, r3);
i2 && !("get" in i2 ? !e3.__esModule : i2.writable || i2.configurable) || (i2 = { enumerable: true, get: function() {
return e3[r3];
} }), Object.defineProperty(t3, n3, i2);
} : function(t3, e3, r3, n3) {
void 0 === n3 && (n3 = r3), t3[n3] = e3[r3];
}), i = this && this.__setModuleDefault || (Object.create ? function(t3, e3) {
Object.defineProperty(t3, "default", { enumerable: true, value: e3 });
} : function(t3, e3) {
t3.default = e3;
}), o = this && this.__importStar || function(t3) {
if (t3 && t3.__esModule) return t3;
var e3 = {};
if (null != t3) for (var r3 in t3) "default" !== r3 && Object.prototype.hasOwnProperty.call(t3, r3) && n2(e3, t3, r3);
return i(e3, t3), e3;
};
Object.defineProperty(e2, "__esModule", { value: true }), e2.Utils = void 0;
const s = o(r2(470)), a = s.posix || s, h = "/";
var c;
!function(t3) {
t3.joinPath = function(t4, ...e3) {
return t4.with({ path: a.join(t4.path, ...e3) });
}, t3.resolvePath = function(t4, ...e3) {
let r3 = t4.path, n3 = false;
r3[0] !== h && (r3 = h + r3, n3 = true);
let i2 = a.resolve(r3, ...e3);
return n3 && i2[0] === h && !t4.authority && (i2 = i2.substring(1)), t4.with({ path: i2 });
}, t3.dirname = function(t4) {
if (0 === t4.path.length || t4.path === h) return t4;
let e3 = a.dirname(t4.path);
return 1 === e3.length && 46 === e3.charCodeAt(0) && (e3 = ""), t4.with({ path: e3 });
}, t3.basename = function(t4) {
return a.basename(t4.path);
}, t3.extname = function(t4) {
return a.extname(t4.path);
};
}(c || (e2.Utils = c = {}));
} }, e = {};
function r(n2) {
var i = e[n2];
if (void 0 !== i) return i.exports;
var o = e[n2] = { exports: {} };
return t[n2].call(o.exports, o, o.exports, r), o.exports;
}
var n = {};
return (() => {
var t2 = n;
Object.defineProperty(t2, "__esModule", { value: true }), t2.Utils = t2.URI = void 0;
const e2 = r(796);
Object.defineProperty(t2, "URI", { enumerable: true, get: function() {
return e2.URI;
} });
const i = r(679);
Object.defineProperty(t2, "Utils", { enumerable: true, get: function() {
return i.Utils;
} });
})(), n;
})());
}
});
// node_modules/@zzzen/pyright-internal/dist/common/caseSensitivityDetector.js
var require_caseSensitivityDetector = __commonJS({
"node_modules/@zzzen/pyright-internal/dist/common/caseSensitivityDetector.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.CaseSensitivityDetector = void 0;
var CaseSensitivityDetector;
(function(CaseSensitivityDetector2) {
function is(value) {
return !!value.isCaseSensitive;
}
CaseSensitivityDetector2.is = is;
})(CaseSensitivityDetector || (exports2.CaseSensitivityDetector = CaseSensitivityDetector = {}));
}
});
// node_modules/@zzzen/pyright-internal/dist/common/debug.js
var require_debug = __commonJS({
"node_modules/@zzzen/pyright-internal/dist/common/debug.js"(exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true });
exports2.assert = assert;
exports2.fail = fail;
exports2.assertDefined = assertDefined;
exports2.assertEachDefined = assertEachDefined;
exports2.assertNever = assertNever;
exports2.getFunctionName = getFuncti