@ttsc/vscode 0.30.3 → 0.31.0
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/README.md +1 -1
- package/dist/ttsc-vscode-0.31.0.vsix +0 -0
- package/lib/extension.js +1129 -500
- package/package.json +5 -3
- package/dist/ttsc-vscode-0.30.3.vsix +0 -0
package/lib/extension.js
CHANGED
|
@@ -634,22 +634,22 @@ var require_linkedMap = __commonJS({
|
|
|
634
634
|
}
|
|
635
635
|
forEach(callbackfn, thisArg) {
|
|
636
636
|
const state = this._state;
|
|
637
|
-
let
|
|
638
|
-
while (
|
|
637
|
+
let current2 = this._head;
|
|
638
|
+
while (current2) {
|
|
639
639
|
if (thisArg) {
|
|
640
|
-
callbackfn.bind(thisArg)(
|
|
640
|
+
callbackfn.bind(thisArg)(current2.value, current2.key, this);
|
|
641
641
|
} else {
|
|
642
|
-
callbackfn(
|
|
642
|
+
callbackfn(current2.value, current2.key, this);
|
|
643
643
|
}
|
|
644
644
|
if (this._state !== state) {
|
|
645
645
|
throw new Error(`LinkedMap got modified during iteration.`);
|
|
646
646
|
}
|
|
647
|
-
|
|
647
|
+
current2 = current2.next;
|
|
648
648
|
}
|
|
649
649
|
}
|
|
650
650
|
keys() {
|
|
651
651
|
const state = this._state;
|
|
652
|
-
let
|
|
652
|
+
let current2 = this._head;
|
|
653
653
|
const iterator = {
|
|
654
654
|
[Symbol.iterator]: () => {
|
|
655
655
|
return iterator;
|
|
@@ -658,9 +658,9 @@ var require_linkedMap = __commonJS({
|
|
|
658
658
|
if (this._state !== state) {
|
|
659
659
|
throw new Error(`LinkedMap got modified during iteration.`);
|
|
660
660
|
}
|
|
661
|
-
if (
|
|
662
|
-
const result = { value:
|
|
663
|
-
|
|
661
|
+
if (current2) {
|
|
662
|
+
const result = { value: current2.key, done: false };
|
|
663
|
+
current2 = current2.next;
|
|
664
664
|
return result;
|
|
665
665
|
} else {
|
|
666
666
|
return { value: void 0, done: true };
|
|
@@ -671,7 +671,7 @@ var require_linkedMap = __commonJS({
|
|
|
671
671
|
}
|
|
672
672
|
values() {
|
|
673
673
|
const state = this._state;
|
|
674
|
-
let
|
|
674
|
+
let current2 = this._head;
|
|
675
675
|
const iterator = {
|
|
676
676
|
[Symbol.iterator]: () => {
|
|
677
677
|
return iterator;
|
|
@@ -680,9 +680,9 @@ var require_linkedMap = __commonJS({
|
|
|
680
680
|
if (this._state !== state) {
|
|
681
681
|
throw new Error(`LinkedMap got modified during iteration.`);
|
|
682
682
|
}
|
|
683
|
-
if (
|
|
684
|
-
const result = { value:
|
|
685
|
-
|
|
683
|
+
if (current2) {
|
|
684
|
+
const result = { value: current2.value, done: false };
|
|
685
|
+
current2 = current2.next;
|
|
686
686
|
return result;
|
|
687
687
|
} else {
|
|
688
688
|
return { value: void 0, done: true };
|
|
@@ -693,7 +693,7 @@ var require_linkedMap = __commonJS({
|
|
|
693
693
|
}
|
|
694
694
|
entries() {
|
|
695
695
|
const state = this._state;
|
|
696
|
-
let
|
|
696
|
+
let current2 = this._head;
|
|
697
697
|
const iterator = {
|
|
698
698
|
[Symbol.iterator]: () => {
|
|
699
699
|
return iterator;
|
|
@@ -702,9 +702,9 @@ var require_linkedMap = __commonJS({
|
|
|
702
702
|
if (this._state !== state) {
|
|
703
703
|
throw new Error(`LinkedMap got modified during iteration.`);
|
|
704
704
|
}
|
|
705
|
-
if (
|
|
706
|
-
const result = { value: [
|
|
707
|
-
|
|
705
|
+
if (current2) {
|
|
706
|
+
const result = { value: [current2.key, current2.value], done: false };
|
|
707
|
+
current2 = current2.next;
|
|
708
708
|
return result;
|
|
709
709
|
} else {
|
|
710
710
|
return { value: void 0, done: true };
|
|
@@ -724,17 +724,17 @@ var require_linkedMap = __commonJS({
|
|
|
724
724
|
this.clear();
|
|
725
725
|
return;
|
|
726
726
|
}
|
|
727
|
-
let
|
|
727
|
+
let current2 = this._head;
|
|
728
728
|
let currentSize = this.size;
|
|
729
|
-
while (
|
|
730
|
-
this._map.delete(
|
|
731
|
-
|
|
729
|
+
while (current2 && currentSize > newSize) {
|
|
730
|
+
this._map.delete(current2.key);
|
|
731
|
+
current2 = current2.next;
|
|
732
732
|
currentSize--;
|
|
733
733
|
}
|
|
734
|
-
this._head =
|
|
734
|
+
this._head = current2;
|
|
735
735
|
this._size = currentSize;
|
|
736
|
-
if (
|
|
737
|
-
|
|
736
|
+
if (current2) {
|
|
737
|
+
current2.previous = void 0;
|
|
738
738
|
}
|
|
739
739
|
this._state++;
|
|
740
740
|
}
|
|
@@ -1058,9 +1058,9 @@ var require_events = __commonJS({
|
|
|
1058
1058
|
* To be kept private to fire an event to
|
|
1059
1059
|
* subscribers
|
|
1060
1060
|
*/
|
|
1061
|
-
fire(
|
|
1061
|
+
fire(event2) {
|
|
1062
1062
|
if (this._callbacks) {
|
|
1063
|
-
this._callbacks.invoke.call(this._callbacks,
|
|
1063
|
+
this._callbacks.invoke.call(this._callbacks, event2);
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
1066
|
dispose() {
|
|
@@ -1563,8 +1563,8 @@ ${JSON.stringify(Object.fromEntries(headers))}`));
|
|
|
1563
1563
|
this.clearPartialMessageTimer();
|
|
1564
1564
|
this.nextMessageLength = -1;
|
|
1565
1565
|
this.readSemaphore.lock(async () => {
|
|
1566
|
-
const
|
|
1567
|
-
const message = await this.options.contentTypeDecoder.decode(
|
|
1566
|
+
const bytes2 = this.options.contentDecoder !== void 0 ? await this.options.contentDecoder.decode(body) : body;
|
|
1567
|
+
const message = await this.options.contentTypeDecoder.decode(bytes2, this.options);
|
|
1568
1568
|
this.callback(message);
|
|
1569
1569
|
}).catch((error) => {
|
|
1570
1570
|
this.fireError(error);
|
|
@@ -1717,14 +1717,14 @@ var require_messageWriter = __commonJS({
|
|
|
1717
1717
|
}
|
|
1718
1718
|
async write(msg) {
|
|
1719
1719
|
return this.writeSemaphore.lock(async () => {
|
|
1720
|
-
const
|
|
1720
|
+
const payload2 = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer) => {
|
|
1721
1721
|
if (this.options.contentEncoder !== void 0) {
|
|
1722
1722
|
return this.options.contentEncoder.encode(buffer);
|
|
1723
1723
|
} else {
|
|
1724
1724
|
return buffer;
|
|
1725
1725
|
}
|
|
1726
1726
|
});
|
|
1727
|
-
return
|
|
1727
|
+
return payload2.then((buffer) => {
|
|
1728
1728
|
const headers = [];
|
|
1729
1729
|
headers.push(ContentLength, buffer.byteLength.toString(), CRLF);
|
|
1730
1730
|
headers.push(CRLF);
|
|
@@ -4745,8 +4745,8 @@ var init_main = __esm({
|
|
|
4745
4745
|
}
|
|
4746
4746
|
return this._content;
|
|
4747
4747
|
}
|
|
4748
|
-
update(
|
|
4749
|
-
this._content =
|
|
4748
|
+
update(event2, version) {
|
|
4749
|
+
this._content = event2.text;
|
|
4750
4750
|
this._version = version;
|
|
4751
4751
|
this._lineOffsets = void 0;
|
|
4752
4752
|
}
|
|
@@ -6250,13 +6250,13 @@ var require_protocol = __commonJS({
|
|
|
6250
6250
|
})(DidOpenTextDocumentNotification || (exports2.DidOpenTextDocumentNotification = DidOpenTextDocumentNotification = {}));
|
|
6251
6251
|
var TextDocumentContentChangeEvent;
|
|
6252
6252
|
(function(TextDocumentContentChangeEvent2) {
|
|
6253
|
-
function isIncremental(
|
|
6254
|
-
const candidate =
|
|
6253
|
+
function isIncremental(event2) {
|
|
6254
|
+
const candidate = event2;
|
|
6255
6255
|
return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number");
|
|
6256
6256
|
}
|
|
6257
6257
|
TextDocumentContentChangeEvent2.isIncremental = isIncremental;
|
|
6258
|
-
function isFull(
|
|
6259
|
-
const candidate =
|
|
6258
|
+
function isFull(event2) {
|
|
6259
|
+
const candidate = event2;
|
|
6260
6260
|
return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0;
|
|
6261
6261
|
}
|
|
6262
6262
|
TextDocumentContentChangeEvent2.isFull = isFull;
|
|
@@ -7557,52 +7557,52 @@ var require_codeConverter = __commonJS({
|
|
|
7557
7557
|
}
|
|
7558
7558
|
return proto.TextDocumentSaveReason.Manual;
|
|
7559
7559
|
}
|
|
7560
|
-
function asWillSaveTextDocumentParams(
|
|
7560
|
+
function asWillSaveTextDocumentParams(event2) {
|
|
7561
7561
|
return {
|
|
7562
|
-
textDocument: asTextDocumentIdentifier(
|
|
7563
|
-
reason: asTextDocumentSaveReason(
|
|
7562
|
+
textDocument: asTextDocumentIdentifier(event2.document),
|
|
7563
|
+
reason: asTextDocumentSaveReason(event2.reason)
|
|
7564
7564
|
};
|
|
7565
7565
|
}
|
|
7566
|
-
function asDidCreateFilesParams(
|
|
7566
|
+
function asDidCreateFilesParams(event2) {
|
|
7567
7567
|
return {
|
|
7568
|
-
files:
|
|
7568
|
+
files: event2.files.map((fileUri) => ({
|
|
7569
7569
|
uri: _uriConverter(fileUri)
|
|
7570
7570
|
}))
|
|
7571
7571
|
};
|
|
7572
7572
|
}
|
|
7573
|
-
function asDidRenameFilesParams(
|
|
7573
|
+
function asDidRenameFilesParams(event2) {
|
|
7574
7574
|
return {
|
|
7575
|
-
files:
|
|
7575
|
+
files: event2.files.map((file) => ({
|
|
7576
7576
|
oldUri: _uriConverter(file.oldUri),
|
|
7577
7577
|
newUri: _uriConverter(file.newUri)
|
|
7578
7578
|
}))
|
|
7579
7579
|
};
|
|
7580
7580
|
}
|
|
7581
|
-
function asDidDeleteFilesParams(
|
|
7581
|
+
function asDidDeleteFilesParams(event2) {
|
|
7582
7582
|
return {
|
|
7583
|
-
files:
|
|
7583
|
+
files: event2.files.map((fileUri) => ({
|
|
7584
7584
|
uri: _uriConverter(fileUri)
|
|
7585
7585
|
}))
|
|
7586
7586
|
};
|
|
7587
7587
|
}
|
|
7588
|
-
function asWillCreateFilesParams(
|
|
7588
|
+
function asWillCreateFilesParams(event2) {
|
|
7589
7589
|
return {
|
|
7590
|
-
files:
|
|
7590
|
+
files: event2.files.map((fileUri) => ({
|
|
7591
7591
|
uri: _uriConverter(fileUri)
|
|
7592
7592
|
}))
|
|
7593
7593
|
};
|
|
7594
7594
|
}
|
|
7595
|
-
function asWillRenameFilesParams(
|
|
7595
|
+
function asWillRenameFilesParams(event2) {
|
|
7596
7596
|
return {
|
|
7597
|
-
files:
|
|
7597
|
+
files: event2.files.map((file) => ({
|
|
7598
7598
|
oldUri: _uriConverter(file.oldUri),
|
|
7599
7599
|
newUri: _uriConverter(file.newUri)
|
|
7600
7600
|
}))
|
|
7601
7601
|
};
|
|
7602
7602
|
}
|
|
7603
|
-
function asWillDeleteFilesParams(
|
|
7603
|
+
function asWillDeleteFilesParams(event2) {
|
|
7604
7604
|
return {
|
|
7605
|
-
files:
|
|
7605
|
+
files: event2.files.map((fileUri) => ({
|
|
7606
7606
|
uri: _uriConverter(fileUri)
|
|
7607
7607
|
}))
|
|
7608
7608
|
};
|
|
@@ -9853,9 +9853,9 @@ var require_features = __commonJS({
|
|
|
9853
9853
|
}
|
|
9854
9854
|
return false;
|
|
9855
9855
|
}
|
|
9856
|
-
constructor(client,
|
|
9856
|
+
constructor(client, event2, type, middleware, createParams, textDocument, selectorFilter) {
|
|
9857
9857
|
super(client);
|
|
9858
|
-
this._event =
|
|
9858
|
+
this._event = event2;
|
|
9859
9859
|
this._type = type;
|
|
9860
9860
|
this._middleware = middleware;
|
|
9861
9861
|
this._createParams = createParams;
|
|
@@ -10148,12 +10148,12 @@ var require_commonjs = __commonJS({
|
|
|
10148
10148
|
}
|
|
10149
10149
|
});
|
|
10150
10150
|
|
|
10151
|
-
// ../../node_modules/.pnpm/brace-expansion@5.0.
|
|
10151
|
+
// ../../node_modules/.pnpm/brace-expansion@5.0.11/node_modules/brace-expansion/dist/commonjs/index.js
|
|
10152
10152
|
var require_commonjs2 = __commonJS({
|
|
10153
|
-
"../../node_modules/.pnpm/brace-expansion@5.0.
|
|
10153
|
+
"../../node_modules/.pnpm/brace-expansion@5.0.11/node_modules/brace-expansion/dist/commonjs/index.js"(exports2) {
|
|
10154
10154
|
"use strict";
|
|
10155
10155
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
10156
|
-
exports2.EXPANSION_MAX_LENGTH = exports2.EXPANSION_MAX = void 0;
|
|
10156
|
+
exports2.EXPANSION_MAX_DEPTH = exports2.EXPANSION_MAX_LENGTH = exports2.EXPANSION_MAX = void 0;
|
|
10157
10157
|
exports2.expand = expand;
|
|
10158
10158
|
var balanced_match_1 = require_commonjs();
|
|
10159
10159
|
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
@@ -10173,6 +10173,7 @@ var require_commonjs2 = __commonJS({
|
|
|
10173
10173
|
var periodPattern = /\\\./g;
|
|
10174
10174
|
exports2.EXPANSION_MAX = 1e5;
|
|
10175
10175
|
exports2.EXPANSION_MAX_LENGTH = 4e6;
|
|
10176
|
+
exports2.EXPANSION_MAX_DEPTH = 1e3;
|
|
10176
10177
|
function numeric(str) {
|
|
10177
10178
|
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
10178
10179
|
}
|
|
@@ -10182,36 +10183,44 @@ var require_commonjs2 = __commonJS({
|
|
|
10182
10183
|
function unescapeBraces(str) {
|
|
10183
10184
|
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
|
10184
10185
|
}
|
|
10185
|
-
function
|
|
10186
|
-
|
|
10187
|
-
|
|
10186
|
+
function pushAll(target, items) {
|
|
10187
|
+
for (let i = 0; i < items.length; i++) {
|
|
10188
|
+
target.push(items[i]);
|
|
10188
10189
|
}
|
|
10190
|
+
}
|
|
10191
|
+
function parseCommaParts(str) {
|
|
10189
10192
|
const parts = [];
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
;
|
|
10200
|
-
p
|
|
10201
|
-
p
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10193
|
+
let carry = "";
|
|
10194
|
+
for (; ; ) {
|
|
10195
|
+
const m = (0, balanced_match_1.balanced)("{", "}", str);
|
|
10196
|
+
if (!m) {
|
|
10197
|
+
const tail = str.split(",");
|
|
10198
|
+
tail[0] = carry + tail[0];
|
|
10199
|
+
pushAll(parts, tail);
|
|
10200
|
+
return parts;
|
|
10201
|
+
}
|
|
10202
|
+
const { pre, body, post } = m;
|
|
10203
|
+
const p = pre.split(",");
|
|
10204
|
+
p[0] = carry + p[0];
|
|
10205
|
+
p[p.length - 1] += "{" + body + "}";
|
|
10206
|
+
if (!post.length) {
|
|
10207
|
+
pushAll(parts, p);
|
|
10208
|
+
return parts;
|
|
10209
|
+
}
|
|
10210
|
+
carry = p.pop();
|
|
10211
|
+
pushAll(parts, p);
|
|
10212
|
+
str = post;
|
|
10213
|
+
}
|
|
10205
10214
|
}
|
|
10206
10215
|
function expand(str, options = {}) {
|
|
10207
10216
|
if (!str) {
|
|
10208
10217
|
return [];
|
|
10209
10218
|
}
|
|
10210
|
-
const { max = exports2.EXPANSION_MAX, maxLength = exports2.EXPANSION_MAX_LENGTH } = options;
|
|
10219
|
+
const { max = exports2.EXPANSION_MAX, maxLength = exports2.EXPANSION_MAX_LENGTH, maxDepth = exports2.EXPANSION_MAX_DEPTH } = options;
|
|
10211
10220
|
if (str.slice(0, 2) === "{}") {
|
|
10212
10221
|
str = "\\{\\}" + str.slice(2);
|
|
10213
10222
|
}
|
|
10214
|
-
return expand_(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
|
|
10223
|
+
return expand_(escapeBraces(str), max, maxLength, maxDepth, 0, true).map(unescapeBraces);
|
|
10215
10224
|
}
|
|
10216
10225
|
function embrace(str) {
|
|
10217
10226
|
return "{" + str + "}";
|
|
@@ -10289,7 +10298,10 @@ var require_commonjs2 = __commonJS({
|
|
|
10289
10298
|
}
|
|
10290
10299
|
return N;
|
|
10291
10300
|
}
|
|
10292
|
-
function expand_(str, max, maxLength, isTop) {
|
|
10301
|
+
function expand_(str, max, maxLength, maxDepth, depth, isTop) {
|
|
10302
|
+
if (depth > maxDepth) {
|
|
10303
|
+
return [str];
|
|
10304
|
+
}
|
|
10293
10305
|
let acc = [""];
|
|
10294
10306
|
let dropEmpties = false;
|
|
10295
10307
|
let firstGroup = true;
|
|
@@ -10329,7 +10341,7 @@ var require_commonjs2 = __commonJS({
|
|
|
10329
10341
|
} else {
|
|
10330
10342
|
let n = parseCommaParts(m.body);
|
|
10331
10343
|
if (n.length === 1 && n[0] !== void 0) {
|
|
10332
|
-
n = expand_(n[0], max, maxLength, false).map(embrace);
|
|
10344
|
+
n = expand_(n[0], max, maxLength, maxDepth, depth + 1, false).map(embrace);
|
|
10333
10345
|
if (n.length === 1) {
|
|
10334
10346
|
acc = combine(acc, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length);
|
|
10335
10347
|
if (!m.post.length)
|
|
@@ -10347,7 +10359,7 @@ var require_commonjs2 = __commonJS({
|
|
|
10347
10359
|
values = [];
|
|
10348
10360
|
let valuesLength = 0;
|
|
10349
10361
|
outer: for (let j = 0; j < n.length; j++) {
|
|
10350
|
-
const expanded = expand_(n[j], max, maxLength, false);
|
|
10362
|
+
const expanded = expand_(n[j], max, maxLength, maxDepth, depth + 1, false);
|
|
10351
10363
|
for (let k = 0; k < expanded.length; k++) {
|
|
10352
10364
|
const v = expanded[k];
|
|
10353
10365
|
if (dropsEmpties && !v)
|
|
@@ -11262,11 +11274,11 @@ var require_commonjs3 = __commonJS({
|
|
|
11262
11274
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
11263
11275
|
};
|
|
11264
11276
|
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
11265
|
-
var
|
|
11277
|
+
var path8 = {
|
|
11266
11278
|
win32: { sep: "\\" },
|
|
11267
11279
|
posix: { sep: "/" }
|
|
11268
11280
|
};
|
|
11269
|
-
exports2.sep = defaultPlatform === "win32" ?
|
|
11281
|
+
exports2.sep = defaultPlatform === "win32" ? path8.win32.sep : path8.posix.sep;
|
|
11270
11282
|
exports2.minimatch.sep = exports2.sep;
|
|
11271
11283
|
exports2.GLOBSTAR = Symbol("globstar **");
|
|
11272
11284
|
exports2.minimatch.GLOBSTAR = exports2.GLOBSTAR;
|
|
@@ -12709,8 +12721,8 @@ var require_diagnostic = __commonJS({
|
|
|
12709
12721
|
}
|
|
12710
12722
|
}));
|
|
12711
12723
|
const openFeature = client.getFeature(vscode_languageserver_protocol_1.DidOpenTextDocumentNotification.method);
|
|
12712
|
-
disposables.push(openFeature.onNotificationSent((
|
|
12713
|
-
const textDocument =
|
|
12724
|
+
disposables.push(openFeature.onNotificationSent((event2) => {
|
|
12725
|
+
const textDocument = event2.textDocument;
|
|
12714
12726
|
if (this.diagnosticRequestor.knowsSameVersion(PullState.document, textDocument)) {
|
|
12715
12727
|
return;
|
|
12716
12728
|
}
|
|
@@ -12721,8 +12733,8 @@ var require_diagnostic = __commonJS({
|
|
|
12721
12733
|
}
|
|
12722
12734
|
}));
|
|
12723
12735
|
const notebookFeature = client.getFeature(vscode_languageserver_protocol_1.NotebookDocumentSyncRegistrationType.method);
|
|
12724
|
-
disposables.push(notebookFeature.onOpenNotificationSent((
|
|
12725
|
-
for (const cell of
|
|
12736
|
+
disposables.push(notebookFeature.onOpenNotificationSent((event2) => {
|
|
12737
|
+
for (const cell of event2.getCells()) {
|
|
12726
12738
|
if (matchesCell(cell)) {
|
|
12727
12739
|
this.diagnosticRequestor.pull(cell.document, () => {
|
|
12728
12740
|
addToBackgroundIfNeeded(cell.document);
|
|
@@ -12780,17 +12792,17 @@ var require_diagnostic = __commonJS({
|
|
|
12780
12792
|
}
|
|
12781
12793
|
if (diagnosticPullOptions.onChange === true) {
|
|
12782
12794
|
const changeFeature = client.getFeature(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.method);
|
|
12783
|
-
disposables.push(changeFeature.onNotificationSent(async (
|
|
12784
|
-
const textDocument =
|
|
12795
|
+
disposables.push(changeFeature.onNotificationSent(async (event2) => {
|
|
12796
|
+
const textDocument = event2.textDocument;
|
|
12785
12797
|
if (considerDocument(textDocument, DiagnosticPullMode.onType)) {
|
|
12786
12798
|
this.diagnosticRequestor.pull(textDocument, () => {
|
|
12787
12799
|
this.backgroundScheduler.trigger();
|
|
12788
12800
|
});
|
|
12789
12801
|
}
|
|
12790
12802
|
}));
|
|
12791
|
-
disposables.push(notebookFeature.onChangeNotificationSent(async (
|
|
12792
|
-
const textEvents =
|
|
12793
|
-
const changedCells = textEvents.map((c) =>
|
|
12803
|
+
disposables.push(notebookFeature.onChangeNotificationSent(async (event2) => {
|
|
12804
|
+
const textEvents = event2.cells?.textContent || [];
|
|
12805
|
+
const changedCells = textEvents.map((c) => event2.notebook.getCells().find((cell) => cell.document.uri.toString() === c.document.uri.toString()));
|
|
12794
12806
|
for (const cell of changedCells) {
|
|
12795
12807
|
if (cell && matchesCell(cell)) {
|
|
12796
12808
|
this.diagnosticRequestor.pull(cell.document, () => {
|
|
@@ -12798,11 +12810,11 @@ var require_diagnostic = __commonJS({
|
|
|
12798
12810
|
});
|
|
12799
12811
|
}
|
|
12800
12812
|
}
|
|
12801
|
-
const closedCells =
|
|
12813
|
+
const closedCells = event2.cells?.structure?.didClose || [];
|
|
12802
12814
|
for (const cell of closedCells) {
|
|
12803
12815
|
this.diagnosticRequestor.forgetDocument(cell.document);
|
|
12804
12816
|
}
|
|
12805
|
-
const openedCells =
|
|
12817
|
+
const openedCells = event2.cells?.structure?.didOpen || [];
|
|
12806
12818
|
for (const cell of openedCells) {
|
|
12807
12819
|
if (matchesCell(cell)) {
|
|
12808
12820
|
this.diagnosticRequestor.pull(cell.document, () => {
|
|
@@ -12814,14 +12826,14 @@ var require_diagnostic = __commonJS({
|
|
|
12814
12826
|
}
|
|
12815
12827
|
if (diagnosticPullOptions.onSave === true) {
|
|
12816
12828
|
const saveFeature = client.getFeature(vscode_languageserver_protocol_1.DidSaveTextDocumentNotification.method);
|
|
12817
|
-
disposables.push(saveFeature.onNotificationSent((
|
|
12818
|
-
const textDocument =
|
|
12829
|
+
disposables.push(saveFeature.onNotificationSent((event2) => {
|
|
12830
|
+
const textDocument = event2.textDocument;
|
|
12819
12831
|
if (considerDocument(textDocument, DiagnosticPullMode.onSave)) {
|
|
12820
|
-
this.diagnosticRequestor.pull(
|
|
12832
|
+
this.diagnosticRequestor.pull(event2.textDocument);
|
|
12821
12833
|
}
|
|
12822
12834
|
}));
|
|
12823
|
-
disposables.push(notebookFeature.onSaveNotificationSent((
|
|
12824
|
-
for (const cell of
|
|
12835
|
+
disposables.push(notebookFeature.onSaveNotificationSent((event2) => {
|
|
12836
|
+
for (const cell of event2.getCells()) {
|
|
12825
12837
|
if (matchesCell(cell)) {
|
|
12826
12838
|
this.diagnosticRequestor.pull(cell.document);
|
|
12827
12839
|
}
|
|
@@ -12829,11 +12841,11 @@ var require_diagnostic = __commonJS({
|
|
|
12829
12841
|
}));
|
|
12830
12842
|
}
|
|
12831
12843
|
const closeFeature = client.getFeature(vscode_languageserver_protocol_1.DidCloseTextDocumentNotification.method);
|
|
12832
|
-
disposables.push(closeFeature.onAboutToSendNotification((
|
|
12833
|
-
this.cleanUpDocument(
|
|
12844
|
+
disposables.push(closeFeature.onAboutToSendNotification((event2) => {
|
|
12845
|
+
this.cleanUpDocument(event2.textDocument);
|
|
12834
12846
|
}));
|
|
12835
|
-
disposables.push(notebookFeature.onCloseNotificationSent((
|
|
12836
|
-
for (const cell of
|
|
12847
|
+
disposables.push(notebookFeature.onCloseNotificationSent((event2) => {
|
|
12848
|
+
for (const cell of event2.getCells()) {
|
|
12837
12849
|
this.cleanUpDocument(cell.document);
|
|
12838
12850
|
}
|
|
12839
12851
|
}));
|
|
@@ -13053,19 +13065,19 @@ var require_notebook = __commonJS({
|
|
|
13053
13065
|
return result;
|
|
13054
13066
|
}
|
|
13055
13067
|
}
|
|
13056
|
-
function asTextContentChange(
|
|
13057
|
-
const params = base.asChangeTextDocumentParams(
|
|
13068
|
+
function asTextContentChange(event2, base) {
|
|
13069
|
+
const params = base.asChangeTextDocumentParams(event2, event2.document.uri, event2.document.version);
|
|
13058
13070
|
return { document: params.textDocument, changes: params.contentChanges };
|
|
13059
13071
|
}
|
|
13060
13072
|
c2p2.asTextContentChange = asTextContentChange;
|
|
13061
|
-
function asNotebookDocumentChangeEvent(
|
|
13073
|
+
function asNotebookDocumentChangeEvent(event2, base) {
|
|
13062
13074
|
const result = /* @__PURE__ */ Object.create(null);
|
|
13063
|
-
if (
|
|
13064
|
-
result.metadata = Converter2.c2p.asMetadata(
|
|
13075
|
+
if (event2.metadata) {
|
|
13076
|
+
result.metadata = Converter2.c2p.asMetadata(event2.metadata);
|
|
13065
13077
|
}
|
|
13066
|
-
if (
|
|
13078
|
+
if (event2.cells !== void 0) {
|
|
13067
13079
|
const cells = /* @__PURE__ */ Object.create(null);
|
|
13068
|
-
const changedCells =
|
|
13080
|
+
const changedCells = event2.cells;
|
|
13069
13081
|
if (changedCells.structure) {
|
|
13070
13082
|
cells.structure = {
|
|
13071
13083
|
array: {
|
|
@@ -13081,7 +13093,7 @@ var require_notebook = __commonJS({
|
|
|
13081
13093
|
cells.data = changedCells.data.map((cell) => Converter2.c2p.asNotebookCell(cell, base));
|
|
13082
13094
|
}
|
|
13083
13095
|
if (changedCells.textContent !== void 0) {
|
|
13084
|
-
cells.textContent = changedCells.textContent.map((
|
|
13096
|
+
cells.textContent = changedCells.textContent.map((event3) => Converter2.c2p.asTextContentChange(event3, base));
|
|
13085
13097
|
}
|
|
13086
13098
|
if (Object.keys(cells).length > 0) {
|
|
13087
13099
|
result.cells = cells;
|
|
@@ -13284,7 +13296,7 @@ var require_notebook = __commonJS({
|
|
|
13284
13296
|
this.notebookDidOpen.add(notebookDocument.uri.toString());
|
|
13285
13297
|
this.didOpen(notebookDocument);
|
|
13286
13298
|
}
|
|
13287
|
-
vscode.workspace.onDidChangeNotebookDocument((
|
|
13299
|
+
vscode.workspace.onDidChangeNotebookDocument((event2) => this.didChangeNotebookDocument(event2), void 0, this.disposables);
|
|
13288
13300
|
if (this.options.save === true) {
|
|
13289
13301
|
vscode.workspace.onDidSaveNotebookDocument((notebookDocument) => this.didSave(notebookDocument), void 0, this.disposables);
|
|
13290
13302
|
}
|
|
@@ -13334,9 +13346,9 @@ var require_notebook = __commonJS({
|
|
|
13334
13346
|
if (cellMatches) {
|
|
13335
13347
|
const matchingCells = this.mergeCells(notebookDocument, syncInfo, [cell]);
|
|
13336
13348
|
if (matchingCells !== void 0) {
|
|
13337
|
-
const
|
|
13338
|
-
if (
|
|
13339
|
-
this.doSendChange(
|
|
13349
|
+
const event2 = this.asNotebookDocumentChangeEvent(notebookDocument, void 0, syncInfo, matchingCells);
|
|
13350
|
+
if (event2 !== void 0) {
|
|
13351
|
+
this.doSendChange(event2, matchingCells).catch(() => {
|
|
13340
13352
|
});
|
|
13341
13353
|
}
|
|
13342
13354
|
}
|
|
@@ -13348,8 +13360,8 @@ var require_notebook = __commonJS({
|
|
|
13348
13360
|
}
|
|
13349
13361
|
}
|
|
13350
13362
|
}
|
|
13351
|
-
didChangeNotebookCellTextDocument(notebookDocument, cell,
|
|
13352
|
-
if (vscode.languages.match(this.selector,
|
|
13363
|
+
didChangeNotebookCellTextDocument(notebookDocument, cell, event2) {
|
|
13364
|
+
if (vscode.languages.match(this.selector, event2.document) === 0) {
|
|
13353
13365
|
return;
|
|
13354
13366
|
}
|
|
13355
13367
|
const syncInfo = this.getSyncInfo(notebookDocument);
|
|
@@ -13358,7 +13370,7 @@ var require_notebook = __commonJS({
|
|
|
13358
13370
|
}
|
|
13359
13371
|
this.doSendChange({
|
|
13360
13372
|
notebook: notebookDocument,
|
|
13361
|
-
cells: { textContent: [
|
|
13373
|
+
cells: { textContent: [event2] }
|
|
13362
13374
|
}, syncInfo.cells).catch(() => {
|
|
13363
13375
|
});
|
|
13364
13376
|
}
|
|
@@ -13401,9 +13413,9 @@ var require_notebook = __commonJS({
|
|
|
13401
13413
|
matchingCells = syncInfo.cells.slice();
|
|
13402
13414
|
}
|
|
13403
13415
|
if (matchingCells !== void 0) {
|
|
13404
|
-
const
|
|
13405
|
-
if (
|
|
13406
|
-
this.doSendChange(
|
|
13416
|
+
const event2 = this.asNotebookDocumentChangeEvent(notebookDocument, void 0, syncInfo, matchingCells);
|
|
13417
|
+
if (event2 !== void 0) {
|
|
13418
|
+
this.doSendChange(event2, matchingCells).catch(() => {
|
|
13407
13419
|
});
|
|
13408
13420
|
}
|
|
13409
13421
|
} else {
|
|
@@ -13419,11 +13431,11 @@ var require_notebook = __commonJS({
|
|
|
13419
13431
|
});
|
|
13420
13432
|
}
|
|
13421
13433
|
}
|
|
13422
|
-
didChangeNotebookDocument(
|
|
13423
|
-
const notebookDocument =
|
|
13434
|
+
didChangeNotebookDocument(event2) {
|
|
13435
|
+
const notebookDocument = event2.notebook;
|
|
13424
13436
|
const syncInfo = this.getSyncInfo(notebookDocument);
|
|
13425
13437
|
if (syncInfo === void 0) {
|
|
13426
|
-
if (
|
|
13438
|
+
if (event2.contentChanges.length === 0) {
|
|
13427
13439
|
return;
|
|
13428
13440
|
}
|
|
13429
13441
|
const cells = this.getMatchingCells(notebookDocument);
|
|
@@ -13432,12 +13444,12 @@ var require_notebook = __commonJS({
|
|
|
13432
13444
|
}
|
|
13433
13445
|
this.didOpen(notebookDocument, cells, syncInfo);
|
|
13434
13446
|
} else {
|
|
13435
|
-
const cells = this.getMatchingCellsFromEvent(notebookDocument, syncInfo,
|
|
13447
|
+
const cells = this.getMatchingCellsFromEvent(notebookDocument, syncInfo, event2);
|
|
13436
13448
|
if (cells === void 0) {
|
|
13437
13449
|
this.didClose(notebookDocument, syncInfo);
|
|
13438
13450
|
return;
|
|
13439
13451
|
}
|
|
13440
|
-
const newEvent = this.asNotebookDocumentChangeEvent(
|
|
13452
|
+
const newEvent = this.asNotebookDocumentChangeEvent(event2.notebook, event2, syncInfo, cells);
|
|
13441
13453
|
if (newEvent !== void 0) {
|
|
13442
13454
|
this.doSendChange(newEvent, cells).catch(() => {
|
|
13443
13455
|
});
|
|
@@ -13489,31 +13501,31 @@ var require_notebook = __commonJS({
|
|
|
13489
13501
|
this.notebookSyncInfo.set(notebookDocument.uri.toString(), SyncInfo.create(cells));
|
|
13490
13502
|
return middleware?.didOpen !== void 0 ? middleware.didOpen(notebookDocument, cells, send) : send(notebookDocument, cells);
|
|
13491
13503
|
}
|
|
13492
|
-
async sendDidChangeNotebookDocument(
|
|
13493
|
-
const cells = this.getMatchingCellsFromSyncInfo(
|
|
13504
|
+
async sendDidChangeNotebookDocument(event2) {
|
|
13505
|
+
const cells = this.getMatchingCellsFromSyncInfo(event2.notebook);
|
|
13494
13506
|
if (cells === void 0) {
|
|
13495
|
-
throw new Error(`Received changed event for un-synced notebook ${
|
|
13507
|
+
throw new Error(`Received changed event for un-synced notebook ${event2.notebook.uri.toString()}`);
|
|
13496
13508
|
}
|
|
13497
|
-
return this.doSendChange(
|
|
13509
|
+
return this.doSendChange(event2, cells);
|
|
13498
13510
|
}
|
|
13499
|
-
async doSendChange(
|
|
13500
|
-
const send = async (
|
|
13511
|
+
async doSendChange(event2, cells) {
|
|
13512
|
+
const send = async (event3) => {
|
|
13501
13513
|
try {
|
|
13502
13514
|
await this.client.sendNotification(proto.DidChangeNotebookDocumentNotification.type, {
|
|
13503
|
-
notebookDocument: Converter.c2p.asVersionedNotebookDocumentIdentifier(
|
|
13504
|
-
change: Converter.c2p.asNotebookDocumentChangeEvent(
|
|
13515
|
+
notebookDocument: Converter.c2p.asVersionedNotebookDocumentIdentifier(event3.notebook, this.client.code2ProtocolConverter),
|
|
13516
|
+
change: Converter.c2p.asNotebookDocumentChangeEvent(event3, this.client.code2ProtocolConverter)
|
|
13505
13517
|
});
|
|
13506
|
-
this.onChangeNotificationSent.fire(
|
|
13518
|
+
this.onChangeNotificationSent.fire(event3);
|
|
13507
13519
|
} catch (error) {
|
|
13508
13520
|
this.client.error("Sending DidChangeNotebookDocumentNotification failed", error);
|
|
13509
13521
|
throw error;
|
|
13510
13522
|
}
|
|
13511
13523
|
};
|
|
13512
13524
|
const middleware = this.client.middleware?.notebooks;
|
|
13513
|
-
if (
|
|
13514
|
-
this.notebookSyncInfo.set(
|
|
13525
|
+
if (event2.cells?.structure !== void 0) {
|
|
13526
|
+
this.notebookSyncInfo.set(event2.notebook.uri.toString(), SyncInfo.create(cells));
|
|
13515
13527
|
}
|
|
13516
|
-
return middleware?.didChange !== void 0 ? middleware?.didChange(
|
|
13528
|
+
return middleware?.didChange !== void 0 ? middleware?.didChange(event2, send) : send(event2);
|
|
13517
13529
|
}
|
|
13518
13530
|
async sendDidSaveNotebookDocument(notebookDocument) {
|
|
13519
13531
|
return this.doSendSave(notebookDocument);
|
|
@@ -13561,21 +13573,21 @@ var require_notebook = __commonJS({
|
|
|
13561
13573
|
const syncInfo = this.getSyncInfo(notebookDocument);
|
|
13562
13574
|
return syncInfo?.cells;
|
|
13563
13575
|
}
|
|
13564
|
-
asNotebookDocumentChangeEvent(notebook,
|
|
13565
|
-
if (
|
|
13576
|
+
asNotebookDocumentChangeEvent(notebook, event2, syncInfo, matchingCells) {
|
|
13577
|
+
if (event2 !== void 0 && event2.notebook !== notebook) {
|
|
13566
13578
|
throw new Error("Notebook must be identical");
|
|
13567
13579
|
}
|
|
13568
13580
|
const result = {
|
|
13569
13581
|
notebook
|
|
13570
13582
|
};
|
|
13571
|
-
if (
|
|
13572
|
-
result.metadata = Converter.c2p.asMetadata(
|
|
13583
|
+
if (event2?.metadata !== void 0) {
|
|
13584
|
+
result.metadata = Converter.c2p.asMetadata(event2.metadata);
|
|
13573
13585
|
}
|
|
13574
13586
|
let matchingCellsSet;
|
|
13575
|
-
if (
|
|
13587
|
+
if (event2?.cellChanges !== void 0 && event2.cellChanges.length > 0) {
|
|
13576
13588
|
const data = [];
|
|
13577
13589
|
matchingCellsSet = new Set(matchingCells.map((cell) => cell.document.uri.toString()));
|
|
13578
|
-
for (const cellChange of
|
|
13590
|
+
for (const cellChange of event2.cellChanges) {
|
|
13579
13591
|
if (matchingCellsSet.has(cellChange.cell.document.uri.toString()) && (cellChange.executionSummary !== void 0 || cellChange.metadata !== void 0)) {
|
|
13580
13592
|
data.push(cellChange.cell);
|
|
13581
13593
|
}
|
|
@@ -13585,7 +13597,7 @@ var require_notebook = __commonJS({
|
|
|
13585
13597
|
result.cells.data = data;
|
|
13586
13598
|
}
|
|
13587
13599
|
}
|
|
13588
|
-
if ((
|
|
13600
|
+
if ((event2?.contentChanges !== void 0 && event2.contentChanges.length > 0 || event2 === void 0) && syncInfo !== void 0 && matchingCells !== void 0) {
|
|
13589
13601
|
const oldCells = syncInfo.cells;
|
|
13590
13602
|
const newCells = matchingCells;
|
|
13591
13603
|
const diff = $NotebookCell.computeDiff(oldCells, newCells, false);
|
|
@@ -13632,7 +13644,7 @@ var require_notebook = __commonJS({
|
|
|
13632
13644
|
}
|
|
13633
13645
|
return void 0;
|
|
13634
13646
|
}
|
|
13635
|
-
getMatchingCellsFromEvent(notebookDocument, syncInfo,
|
|
13647
|
+
getMatchingCellsFromEvent(notebookDocument, syncInfo, event2) {
|
|
13636
13648
|
if (this.options.notebookSelector === void 0) {
|
|
13637
13649
|
return void 0;
|
|
13638
13650
|
}
|
|
@@ -13646,12 +13658,12 @@ var require_notebook = __commonJS({
|
|
|
13646
13658
|
if (selector === void 0) {
|
|
13647
13659
|
return void 0;
|
|
13648
13660
|
}
|
|
13649
|
-
if ((
|
|
13661
|
+
if ((event2.cellChanges === void 0 || event2.cellChanges.length === 0) && (event2.contentChanges === void 0 || event2.contentChanges.length === 0)) {
|
|
13650
13662
|
return syncInfo.cells;
|
|
13651
13663
|
}
|
|
13652
13664
|
let cells;
|
|
13653
|
-
if (
|
|
13654
|
-
const changedCells =
|
|
13665
|
+
if (event2.cellChanges !== void 0 && event2.cellChanges.length > 0) {
|
|
13666
|
+
const changedCells = event2.cellChanges.map((item) => item.cell);
|
|
13655
13667
|
const filtered = this.filterCells(notebookDocument, changedCells, selector.cells);
|
|
13656
13668
|
if (filtered.length !== changedCells.length) {
|
|
13657
13669
|
cells = new Set(syncInfo.uris);
|
|
@@ -13663,11 +13675,11 @@ var require_notebook = __commonJS({
|
|
|
13663
13675
|
}
|
|
13664
13676
|
}
|
|
13665
13677
|
}
|
|
13666
|
-
if (
|
|
13678
|
+
if (event2.contentChanges !== void 0 && event2.contentChanges.length > 0) {
|
|
13667
13679
|
if (cells === void 0) {
|
|
13668
13680
|
cells = new Set(syncInfo.uris);
|
|
13669
13681
|
}
|
|
13670
|
-
for (const item of
|
|
13682
|
+
for (const item of event2.contentChanges) {
|
|
13671
13683
|
for (const cell of item.removedCells) {
|
|
13672
13684
|
cells.delete(cell.document.uri.toString());
|
|
13673
13685
|
}
|
|
@@ -13681,8 +13693,8 @@ var require_notebook = __commonJS({
|
|
|
13681
13693
|
return syncInfo.cells;
|
|
13682
13694
|
}
|
|
13683
13695
|
const result = [];
|
|
13684
|
-
const
|
|
13685
|
-
for (const cell of
|
|
13696
|
+
const current2 = notebookDocument.getCells();
|
|
13697
|
+
for (const cell of current2) {
|
|
13686
13698
|
if (cells.has(cell.document.uri.toString())) {
|
|
13687
13699
|
result.push(cell);
|
|
13688
13700
|
}
|
|
@@ -13756,11 +13768,11 @@ var require_notebook = __commonJS({
|
|
|
13756
13768
|
}
|
|
13757
13769
|
}
|
|
13758
13770
|
});
|
|
13759
|
-
vscode.workspace.onDidChangeTextDocument((
|
|
13760
|
-
if (
|
|
13771
|
+
vscode.workspace.onDidChangeTextDocument((event2) => {
|
|
13772
|
+
if (event2.contentChanges.length === 0) {
|
|
13761
13773
|
return;
|
|
13762
13774
|
}
|
|
13763
|
-
const textDocument =
|
|
13775
|
+
const textDocument = event2.document;
|
|
13764
13776
|
if (textDocument.uri.scheme !== _NotebookDocumentSyncFeature.CellScheme) {
|
|
13765
13777
|
return;
|
|
13766
13778
|
}
|
|
@@ -13770,7 +13782,7 @@ var require_notebook = __commonJS({
|
|
|
13770
13782
|
}
|
|
13771
13783
|
for (const provider of this.registrations.values()) {
|
|
13772
13784
|
if (provider instanceof NotebookDocumentSyncFeatureProvider) {
|
|
13773
|
-
provider.didChangeNotebookCellTextDocument(notebookDocument, cell,
|
|
13785
|
+
provider.didChangeNotebookCellTextDocument(notebookDocument, cell, event2);
|
|
13774
13786
|
}
|
|
13775
13787
|
}
|
|
13776
13788
|
});
|
|
@@ -14050,8 +14062,8 @@ var require_configuration = __commonJS({
|
|
|
14050
14062
|
}
|
|
14051
14063
|
}
|
|
14052
14064
|
register(data) {
|
|
14053
|
-
const disposable = vscode_1.workspace.onDidChangeConfiguration((
|
|
14054
|
-
this.onDidChangeConfiguration(data.registerOptions.section,
|
|
14065
|
+
const disposable = vscode_1.workspace.onDidChangeConfiguration((event2) => {
|
|
14066
|
+
this.onDidChangeConfiguration(data.registerOptions.section, event2);
|
|
14055
14067
|
});
|
|
14056
14068
|
this._listeners.set(data.id, disposable);
|
|
14057
14069
|
if (data.registerOptions.section !== void 0) {
|
|
@@ -14072,7 +14084,7 @@ var require_configuration = __commonJS({
|
|
|
14072
14084
|
this._listeners.clear();
|
|
14073
14085
|
this.isCleared = true;
|
|
14074
14086
|
}
|
|
14075
|
-
onDidChangeConfiguration(configurationSection,
|
|
14087
|
+
onDidChangeConfiguration(configurationSection, event2) {
|
|
14076
14088
|
if (this.isCleared) {
|
|
14077
14089
|
return;
|
|
14078
14090
|
}
|
|
@@ -14082,8 +14094,8 @@ var require_configuration = __commonJS({
|
|
|
14082
14094
|
} else {
|
|
14083
14095
|
sections = configurationSection;
|
|
14084
14096
|
}
|
|
14085
|
-
if (sections !== void 0 &&
|
|
14086
|
-
const affected = sections.some((section) =>
|
|
14097
|
+
if (sections !== void 0 && event2 !== void 0) {
|
|
14098
|
+
const affected = sections.some((section) => event2.affectsConfiguration(section));
|
|
14087
14099
|
if (!affected) {
|
|
14088
14100
|
return;
|
|
14089
14101
|
}
|
|
@@ -14101,17 +14113,17 @@ var require_configuration = __commonJS({
|
|
|
14101
14113
|
});
|
|
14102
14114
|
}
|
|
14103
14115
|
extractSettingsInformation(keys) {
|
|
14104
|
-
function ensurePath(config,
|
|
14105
|
-
let
|
|
14106
|
-
for (let i = 0; i <
|
|
14107
|
-
let obj =
|
|
14116
|
+
function ensurePath(config, path8) {
|
|
14117
|
+
let current2 = config;
|
|
14118
|
+
for (let i = 0; i < path8.length - 1; i++) {
|
|
14119
|
+
let obj = current2[path8[i]];
|
|
14108
14120
|
if (!obj) {
|
|
14109
14121
|
obj = /* @__PURE__ */ Object.create(null);
|
|
14110
|
-
|
|
14122
|
+
current2[path8[i]] = obj;
|
|
14111
14123
|
}
|
|
14112
|
-
|
|
14124
|
+
current2 = obj;
|
|
14113
14125
|
}
|
|
14114
|
-
return
|
|
14126
|
+
return current2;
|
|
14115
14127
|
}
|
|
14116
14128
|
const resource = this._client.clientOptions.workspaceFolder ? this._client.clientOptions.workspaceFolder.uri : void 0;
|
|
14117
14129
|
const result = /* @__PURE__ */ Object.create(null);
|
|
@@ -14125,8 +14137,8 @@ var require_configuration = __commonJS({
|
|
|
14125
14137
|
config = vscode_1.workspace.getConfiguration(void 0, resource).get(key);
|
|
14126
14138
|
}
|
|
14127
14139
|
if (config) {
|
|
14128
|
-
const
|
|
14129
|
-
ensurePath(result,
|
|
14140
|
+
const path8 = keys[i].split(".");
|
|
14141
|
+
ensurePath(result, path8)[path8[path8.length - 1]] = toJSONObject(config);
|
|
14130
14142
|
}
|
|
14131
14143
|
}
|
|
14132
14144
|
return result;
|
|
@@ -14339,12 +14351,12 @@ var init_main2 = __esm({
|
|
|
14339
14351
|
get lineCount() {
|
|
14340
14352
|
return this.getLineOffsets().length;
|
|
14341
14353
|
}
|
|
14342
|
-
static isIncremental(
|
|
14343
|
-
const candidate =
|
|
14354
|
+
static isIncremental(event2) {
|
|
14355
|
+
const candidate = event2;
|
|
14344
14356
|
return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range !== void 0 && (candidate.rangeLength === void 0 || typeof candidate.rangeLength === "number");
|
|
14345
14357
|
}
|
|
14346
|
-
static isFull(
|
|
14347
|
-
const candidate =
|
|
14358
|
+
static isFull(event2) {
|
|
14359
|
+
const candidate = event2;
|
|
14348
14360
|
return candidate !== void 0 && candidate !== null && typeof candidate.text === "string" && candidate.range === void 0 && candidate.rangeLength === void 0;
|
|
14349
14361
|
}
|
|
14350
14362
|
};
|
|
@@ -14689,31 +14701,31 @@ var require_textSynchronization = __commonJS({
|
|
|
14689
14701
|
yield data.documentSelector;
|
|
14690
14702
|
}
|
|
14691
14703
|
}
|
|
14692
|
-
async callback(
|
|
14693
|
-
if (
|
|
14704
|
+
async callback(event2) {
|
|
14705
|
+
if (event2.contentChanges.length === 0) {
|
|
14694
14706
|
return;
|
|
14695
14707
|
}
|
|
14696
|
-
const uri =
|
|
14697
|
-
const version =
|
|
14708
|
+
const uri = event2.document.uri;
|
|
14709
|
+
const version = event2.document.version;
|
|
14698
14710
|
const promises = [];
|
|
14699
14711
|
for (const changeData of this._changeData.values()) {
|
|
14700
|
-
if (vscode_1.languages.match(changeData.documentSelector,
|
|
14712
|
+
if (vscode_1.languages.match(changeData.documentSelector, event2.document) > 0 && !this._client.hasDedicatedTextSynchronizationFeature(event2.document)) {
|
|
14701
14713
|
const middleware = this._client.middleware;
|
|
14702
14714
|
if (changeData.syncKind === vscode_languageserver_protocol_1.TextDocumentSyncKind.Incremental) {
|
|
14703
|
-
const didChange = async (
|
|
14704
|
-
const params = this._client.code2ProtocolConverter.asChangeTextDocumentParams(
|
|
14705
|
-
this.aboutToSendNotification(
|
|
14715
|
+
const didChange = async (event3) => {
|
|
14716
|
+
const params = this._client.code2ProtocolConverter.asChangeTextDocumentParams(event3, uri, version);
|
|
14717
|
+
this.aboutToSendNotification(event3.document, vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, params);
|
|
14706
14718
|
await this._client.sendNotification(vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, params);
|
|
14707
|
-
this.notificationSent(
|
|
14719
|
+
this.notificationSent(event3.document, vscode_languageserver_protocol_1.DidChangeTextDocumentNotification.type, params);
|
|
14708
14720
|
};
|
|
14709
|
-
promises.push(middleware.didChange ? middleware.didChange(
|
|
14721
|
+
promises.push(middleware.didChange ? middleware.didChange(event2, (event3) => didChange(event3)) : didChange(event2));
|
|
14710
14722
|
} else if (changeData.syncKind === vscode_languageserver_protocol_1.TextDocumentSyncKind.Full) {
|
|
14711
|
-
const didChange = async (
|
|
14712
|
-
const eventUri =
|
|
14713
|
-
this._pendingTextDocumentChanges.set(eventUri,
|
|
14723
|
+
const didChange = async (event3) => {
|
|
14724
|
+
const eventUri = event3.document.uri.toString();
|
|
14725
|
+
this._pendingTextDocumentChanges.set(eventUri, event3.document);
|
|
14714
14726
|
this._onPendingChangeAdded.fire();
|
|
14715
14727
|
};
|
|
14716
|
-
promises.push(middleware.didChange ? middleware.didChange(
|
|
14728
|
+
promises.push(middleware.didChange ? middleware.didChange(event2, (event3) => didChange(event3)) : didChange(event2));
|
|
14717
14729
|
}
|
|
14718
14730
|
}
|
|
14719
14731
|
}
|
|
@@ -14778,8 +14790,8 @@ var require_textSynchronization = __commonJS({
|
|
|
14778
14790
|
for (const changeData of this._changeData.values()) {
|
|
14779
14791
|
if (vscode_1.languages.match(changeData.documentSelector, document) > 0) {
|
|
14780
14792
|
return {
|
|
14781
|
-
send: (
|
|
14782
|
-
return this.callback(
|
|
14793
|
+
send: (event2) => {
|
|
14794
|
+
return this.callback(event2);
|
|
14783
14795
|
}
|
|
14784
14796
|
};
|
|
14785
14797
|
}
|
|
@@ -14805,7 +14817,7 @@ var require_textSynchronization = __commonJS({
|
|
|
14805
14817
|
exports2.DidChangeTextDocumentFeature = DidChangeTextDocumentFeature;
|
|
14806
14818
|
var WillSaveFeature = class extends features_1.TextDocumentEventFeature {
|
|
14807
14819
|
constructor(client) {
|
|
14808
|
-
super(client, vscode_1.workspace.onWillSaveTextDocument, vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type, () => client.middleware.willSave, (willSaveEvent) => client.code2ProtocolConverter.asWillSaveTextDocumentParams(willSaveEvent), (
|
|
14820
|
+
super(client, vscode_1.workspace.onWillSaveTextDocument, vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type, () => client.middleware.willSave, (willSaveEvent) => client.code2ProtocolConverter.asWillSaveTextDocumentParams(willSaveEvent), (event2) => event2.document, (selectors, willSaveEvent) => features_1.TextDocumentEventFeature.textDocumentFilter(selectors, willSaveEvent.document));
|
|
14809
14821
|
}
|
|
14810
14822
|
get registrationType() {
|
|
14811
14823
|
return vscode_languageserver_protocol_1.WillSaveTextDocumentNotification.type;
|
|
@@ -14863,16 +14875,16 @@ var require_textSynchronization = __commonJS({
|
|
|
14863
14875
|
}
|
|
14864
14876
|
this._selectors.set(data.id, this._client.protocol2CodeConverter.asDocumentSelector(data.registerOptions.documentSelector));
|
|
14865
14877
|
}
|
|
14866
|
-
callback(
|
|
14867
|
-
if (features_1.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(),
|
|
14878
|
+
callback(event2) {
|
|
14879
|
+
if (features_1.TextDocumentEventFeature.textDocumentFilter(this._selectors.values(), event2.document) && !this._client.hasDedicatedTextSynchronizationFeature(event2.document)) {
|
|
14868
14880
|
const middleware = this._client.middleware;
|
|
14869
|
-
const willSaveWaitUntil = (
|
|
14870
|
-
return this._client.sendRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(
|
|
14881
|
+
const willSaveWaitUntil = (event3) => {
|
|
14882
|
+
return this._client.sendRequest(vscode_languageserver_protocol_1.WillSaveTextDocumentWaitUntilRequest.type, this._client.code2ProtocolConverter.asWillSaveTextDocumentParams(event3)).then(async (edits) => {
|
|
14871
14883
|
const vEdits = await this._client.protocol2CodeConverter.asTextEdits(edits);
|
|
14872
14884
|
return vEdits === void 0 ? [] : vEdits;
|
|
14873
14885
|
});
|
|
14874
14886
|
};
|
|
14875
|
-
|
|
14887
|
+
event2.waitUntil(middleware.willSaveWaitUntil ? middleware.willSaveWaitUntil(event2, willSaveWaitUntil) : willSaveWaitUntil(event2));
|
|
14876
14888
|
}
|
|
14877
14889
|
}
|
|
14878
14890
|
unregister(id) {
|
|
@@ -17925,12 +17937,12 @@ var require_workspaceFolder = __commonJS({
|
|
|
17925
17937
|
register(data) {
|
|
17926
17938
|
const id = data.id;
|
|
17927
17939
|
const client = this._client;
|
|
17928
|
-
const disposable = vscode_1.workspace.onDidChangeWorkspaceFolders((
|
|
17929
|
-
const didChangeWorkspaceFolders = (
|
|
17930
|
-
return this.doSendEvent(
|
|
17940
|
+
const disposable = vscode_1.workspace.onDidChangeWorkspaceFolders((event2) => {
|
|
17941
|
+
const didChangeWorkspaceFolders = (event3) => {
|
|
17942
|
+
return this.doSendEvent(event3.added, event3.removed);
|
|
17931
17943
|
};
|
|
17932
17944
|
const middleware = client.middleware.workspace;
|
|
17933
|
-
const promise = middleware && middleware.didChangeWorkspaceFolders ? middleware.didChangeWorkspaceFolders(
|
|
17945
|
+
const promise = middleware && middleware.didChangeWorkspaceFolders ? middleware.didChangeWorkspaceFolders(event2, didChangeWorkspaceFolders) : didChangeWorkspaceFolders(event2);
|
|
17934
17946
|
promise.catch((error) => {
|
|
17935
17947
|
this._client.error(`Sending notification ${vscode_languageserver_protocol_1.DidChangeWorkspaceFoldersNotification.type.method} failed`, error);
|
|
17936
17948
|
});
|
|
@@ -18032,9 +18044,9 @@ var require_fileOperations = __commonJS({
|
|
|
18032
18044
|
// This property must stay private. Otherwise the type `minimatch.IMinimatch` becomes public and as a consequence we would need to
|
|
18033
18045
|
// ship the d.ts files for minimatch to make the compiler happy when compiling against the vscode-languageclient library
|
|
18034
18046
|
_filters;
|
|
18035
|
-
constructor(client,
|
|
18047
|
+
constructor(client, event2, registrationType, clientCapability, serverCapability) {
|
|
18036
18048
|
this._client = client;
|
|
18037
|
-
this._event =
|
|
18049
|
+
this._event = event2;
|
|
18038
18050
|
this._registrationType = registrationType;
|
|
18039
18051
|
this._clientCapability = clientCapability;
|
|
18040
18052
|
this._serverCapability = serverCapability;
|
|
@@ -18098,16 +18110,16 @@ var require_fileOperations = __commonJS({
|
|
|
18098
18110
|
getFileType(uri) {
|
|
18099
18111
|
return _FileOperationFeature.getFileType(uri);
|
|
18100
18112
|
}
|
|
18101
|
-
async filter(
|
|
18102
|
-
const fileMatches = await Promise.all(
|
|
18113
|
+
async filter(event2, prop) {
|
|
18114
|
+
const fileMatches = await Promise.all(event2.files.map(async (item) => {
|
|
18103
18115
|
const uri = prop(item);
|
|
18104
|
-
const
|
|
18116
|
+
const path8 = uri.fsPath.replace(/\\/g, "/");
|
|
18105
18117
|
for (const filters of this._filters.values()) {
|
|
18106
18118
|
for (const filter of filters) {
|
|
18107
18119
|
if (filter.scheme !== void 0 && filter.scheme !== uri.scheme) {
|
|
18108
18120
|
continue;
|
|
18109
18121
|
}
|
|
18110
|
-
if (filter.matcher.match(
|
|
18122
|
+
if (filter.matcher.match(path8)) {
|
|
18111
18123
|
if (filter.kind === void 0) {
|
|
18112
18124
|
return true;
|
|
18113
18125
|
}
|
|
@@ -18121,7 +18133,7 @@ var require_fileOperations = __commonJS({
|
|
|
18121
18133
|
}
|
|
18122
18134
|
} else if (filter.kind === proto.FileOperationPatternKind.folder) {
|
|
18123
18135
|
const fileType = await _FileOperationFeature.getFileType(uri);
|
|
18124
|
-
if (fileType === code.FileType.Directory && filter.matcher.match(`${
|
|
18136
|
+
if (fileType === code.FileType.Directory && filter.matcher.match(`${path8}/`)) {
|
|
18125
18137
|
return true;
|
|
18126
18138
|
}
|
|
18127
18139
|
}
|
|
@@ -18129,8 +18141,8 @@ var require_fileOperations = __commonJS({
|
|
|
18129
18141
|
}
|
|
18130
18142
|
return false;
|
|
18131
18143
|
}));
|
|
18132
|
-
const files =
|
|
18133
|
-
return { ...
|
|
18144
|
+
const files = event2.files.filter((_, index) => fileMatches[index]);
|
|
18145
|
+
return { ...event2, files };
|
|
18134
18146
|
}
|
|
18135
18147
|
static async getFileType(uri) {
|
|
18136
18148
|
try {
|
|
@@ -18151,8 +18163,8 @@ var require_fileOperations = __commonJS({
|
|
|
18151
18163
|
_notificationType;
|
|
18152
18164
|
_accessUri;
|
|
18153
18165
|
_createParams;
|
|
18154
|
-
constructor(client,
|
|
18155
|
-
super(client,
|
|
18166
|
+
constructor(client, event2, notificationType, clientCapability, serverCapability, accessUri, createParams) {
|
|
18167
|
+
super(client, event2, notificationType, clientCapability, serverCapability);
|
|
18156
18168
|
this._notificationType = notificationType;
|
|
18157
18169
|
this._accessUri = accessUri;
|
|
18158
18170
|
this._createParams = createParams;
|
|
@@ -18160,8 +18172,8 @@ var require_fileOperations = __commonJS({
|
|
|
18160
18172
|
async send(originalEvent) {
|
|
18161
18173
|
const filteredEvent = await this.filter(originalEvent, this._accessUri);
|
|
18162
18174
|
if (filteredEvent.files.length) {
|
|
18163
|
-
const next = async (
|
|
18164
|
-
return this._client.sendNotification(this._notificationType, this._createParams(
|
|
18175
|
+
const next = async (event2) => {
|
|
18176
|
+
return this._client.sendNotification(this._notificationType, this._createParams(event2));
|
|
18165
18177
|
};
|
|
18166
18178
|
return this.doSend(filteredEvent, next);
|
|
18167
18179
|
}
|
|
@@ -18181,8 +18193,8 @@ var require_fileOperations = __commonJS({
|
|
|
18181
18193
|
}
|
|
18182
18194
|
return type;
|
|
18183
18195
|
}
|
|
18184
|
-
async cacheFileTypes(
|
|
18185
|
-
await this.filter(
|
|
18196
|
+
async cacheFileTypes(event2, prop) {
|
|
18197
|
+
await this.filter(event2, prop);
|
|
18186
18198
|
}
|
|
18187
18199
|
clearFileTypeCache() {
|
|
18188
18200
|
this._fsPathFileTypes.clear();
|
|
@@ -18206,9 +18218,9 @@ var require_fileOperations = __commonJS({
|
|
|
18206
18218
|
constructor(client) {
|
|
18207
18219
|
super(client, code.workspace.onDidCreateFiles, proto.DidCreateFilesNotification.type, "didCreate", "didCreate", (i) => i, client.code2ProtocolConverter.asDidCreateFilesParams);
|
|
18208
18220
|
}
|
|
18209
|
-
doSend(
|
|
18221
|
+
doSend(event2, next) {
|
|
18210
18222
|
const middleware = this._client.middleware.workspace;
|
|
18211
|
-
return middleware?.didCreateFiles ? middleware.didCreateFiles(
|
|
18223
|
+
return middleware?.didCreateFiles ? middleware.didCreateFiles(event2, next) : next(event2);
|
|
18212
18224
|
}
|
|
18213
18225
|
};
|
|
18214
18226
|
exports2.DidCreateFilesFeature = DidCreateFilesFeature;
|
|
@@ -18225,10 +18237,10 @@ var require_fileOperations = __commonJS({
|
|
|
18225
18237
|
willRename(e) {
|
|
18226
18238
|
e.waitUntil(this.cacheFileTypes(e, (i) => i.oldUri));
|
|
18227
18239
|
}
|
|
18228
|
-
doSend(
|
|
18240
|
+
doSend(event2, next) {
|
|
18229
18241
|
this.clearFileTypeCache();
|
|
18230
18242
|
const middleware = this._client.middleware.workspace;
|
|
18231
|
-
return middleware?.didRenameFiles ? middleware.didRenameFiles(
|
|
18243
|
+
return middleware?.didRenameFiles ? middleware.didRenameFiles(event2, next) : next(event2);
|
|
18232
18244
|
}
|
|
18233
18245
|
};
|
|
18234
18246
|
exports2.DidRenameFilesFeature = DidRenameFilesFeature;
|
|
@@ -18245,10 +18257,10 @@ var require_fileOperations = __commonJS({
|
|
|
18245
18257
|
willDelete(e) {
|
|
18246
18258
|
e.waitUntil(this.cacheFileTypes(e, (i) => i));
|
|
18247
18259
|
}
|
|
18248
|
-
doSend(
|
|
18260
|
+
doSend(event2, next) {
|
|
18249
18261
|
this.clearFileTypeCache();
|
|
18250
18262
|
const middleware = this._client.middleware.workspace;
|
|
18251
|
-
return middleware?.didDeleteFiles ? middleware.didDeleteFiles(
|
|
18263
|
+
return middleware?.didDeleteFiles ? middleware.didDeleteFiles(event2, next) : next(event2);
|
|
18252
18264
|
}
|
|
18253
18265
|
};
|
|
18254
18266
|
exports2.DidDeleteFilesFeature = DidDeleteFilesFeature;
|
|
@@ -18256,8 +18268,8 @@ var require_fileOperations = __commonJS({
|
|
|
18256
18268
|
_requestType;
|
|
18257
18269
|
_accessUri;
|
|
18258
18270
|
_createParams;
|
|
18259
|
-
constructor(client,
|
|
18260
|
-
super(client,
|
|
18271
|
+
constructor(client, event2, requestType, clientCapability, serverCapability, accessUri, createParams) {
|
|
18272
|
+
super(client, event2, requestType, clientCapability, serverCapability);
|
|
18261
18273
|
this._requestType = requestType;
|
|
18262
18274
|
this._accessUri = accessUri;
|
|
18263
18275
|
this._createParams = createParams;
|
|
@@ -18269,8 +18281,8 @@ var require_fileOperations = __commonJS({
|
|
|
18269
18281
|
async waitUntil(originalEvent) {
|
|
18270
18282
|
const filteredEvent = await this.filter(originalEvent, this._accessUri);
|
|
18271
18283
|
if (filteredEvent.files.length) {
|
|
18272
|
-
const next = (
|
|
18273
|
-
return this._client.sendRequest(this._requestType, this._createParams(
|
|
18284
|
+
const next = (event2) => {
|
|
18285
|
+
return this._client.sendRequest(this._requestType, this._createParams(event2), event2.token).then(this._client.protocol2CodeConverter.asWorkspaceEdit);
|
|
18274
18286
|
};
|
|
18275
18287
|
return this.doSend(filteredEvent, next);
|
|
18276
18288
|
} else {
|
|
@@ -18282,9 +18294,9 @@ var require_fileOperations = __commonJS({
|
|
|
18282
18294
|
constructor(client) {
|
|
18283
18295
|
super(client, code.workspace.onWillCreateFiles, proto.WillCreateFilesRequest.type, "willCreate", "willCreate", (i) => i, client.code2ProtocolConverter.asWillCreateFilesParams);
|
|
18284
18296
|
}
|
|
18285
|
-
doSend(
|
|
18297
|
+
doSend(event2, next) {
|
|
18286
18298
|
const middleware = this._client.middleware.workspace;
|
|
18287
|
-
return middleware?.willCreateFiles ? middleware.willCreateFiles(
|
|
18299
|
+
return middleware?.willCreateFiles ? middleware.willCreateFiles(event2, next) : next(event2);
|
|
18288
18300
|
}
|
|
18289
18301
|
};
|
|
18290
18302
|
exports2.WillCreateFilesFeature = WillCreateFilesFeature;
|
|
@@ -18292,9 +18304,9 @@ var require_fileOperations = __commonJS({
|
|
|
18292
18304
|
constructor(client) {
|
|
18293
18305
|
super(client, code.workspace.onWillRenameFiles, proto.WillRenameFilesRequest.type, "willRename", "willRename", (i) => i.oldUri, client.code2ProtocolConverter.asWillRenameFilesParams);
|
|
18294
18306
|
}
|
|
18295
|
-
doSend(
|
|
18307
|
+
doSend(event2, next) {
|
|
18296
18308
|
const middleware = this._client.middleware.workspace;
|
|
18297
|
-
return middleware?.willRenameFiles ? middleware.willRenameFiles(
|
|
18309
|
+
return middleware?.willRenameFiles ? middleware.willRenameFiles(event2, next) : next(event2);
|
|
18298
18310
|
}
|
|
18299
18311
|
};
|
|
18300
18312
|
exports2.WillRenameFilesFeature = WillRenameFilesFeature;
|
|
@@ -18302,9 +18314,9 @@ var require_fileOperations = __commonJS({
|
|
|
18302
18314
|
constructor(client) {
|
|
18303
18315
|
super(client, code.workspace.onWillDeleteFiles, proto.WillDeleteFilesRequest.type, "willDelete", "willDelete", (i) => i, client.code2ProtocolConverter.asWillDeleteFilesParams);
|
|
18304
18316
|
}
|
|
18305
|
-
doSend(
|
|
18317
|
+
doSend(event2, next) {
|
|
18306
18318
|
const middleware = this._client.middleware.workspace;
|
|
18307
|
-
return middleware?.willDeleteFiles ? middleware.willDeleteFiles(
|
|
18319
|
+
return middleware?.willDeleteFiles ? middleware.willDeleteFiles(event2, next) : next(event2);
|
|
18308
18320
|
}
|
|
18309
18321
|
};
|
|
18310
18322
|
exports2.WillDeleteFilesFeature = WillDeleteFilesFeature;
|
|
@@ -18920,8 +18932,8 @@ var require_client = __commonJS({
|
|
|
18920
18932
|
this._onOpen.fire(toFire);
|
|
18921
18933
|
}
|
|
18922
18934
|
};
|
|
18923
|
-
this.disposables.push(vscode_1.window.tabGroups.onDidChangeTabs((
|
|
18924
|
-
if (
|
|
18935
|
+
this.disposables.push(vscode_1.window.tabGroups.onDidChangeTabs((event2) => {
|
|
18936
|
+
if (event2.closed.length === 0 && event2.opened.length === 0) {
|
|
18925
18937
|
return;
|
|
18926
18938
|
}
|
|
18927
18939
|
updateVisibleDocuments();
|
|
@@ -19861,10 +19873,10 @@ ${this.data2String(data)}` : message;
|
|
|
19861
19873
|
this._outputChannel = void 0;
|
|
19862
19874
|
}
|
|
19863
19875
|
}
|
|
19864
|
-
notifyFileEvent(
|
|
19876
|
+
notifyFileEvent(event2) {
|
|
19865
19877
|
const client = this;
|
|
19866
|
-
async function didChangeWatchedFile(
|
|
19867
|
-
client._fileEvents.push(
|
|
19878
|
+
async function didChangeWatchedFile(event3) {
|
|
19879
|
+
client._fileEvents.push(event3);
|
|
19868
19880
|
return client._fileEventDelayer.trigger(async () => {
|
|
19869
19881
|
const fileEvents = client._fileEvents;
|
|
19870
19882
|
client._fileEvents = [];
|
|
@@ -19877,7 +19889,7 @@ ${this.data2String(data)}` : message;
|
|
|
19877
19889
|
});
|
|
19878
19890
|
}
|
|
19879
19891
|
const workSpaceMiddleware = this.clientOptions.middleware?.workspace;
|
|
19880
|
-
(workSpaceMiddleware?.didChangeWatchedFile ? workSpaceMiddleware.didChangeWatchedFile(
|
|
19892
|
+
(workSpaceMiddleware?.didChangeWatchedFile ? workSpaceMiddleware.didChangeWatchedFile(event2, didChangeWatchedFile) : didChangeWatchedFile(event2)).catch((error) => {
|
|
19881
19893
|
client.error(`Notifying file events failed.`, error);
|
|
19882
19894
|
});
|
|
19883
19895
|
}
|
|
@@ -20135,7 +20147,7 @@ ${error.message}`, void 0, handlerResult.handled === true ? false : "force");
|
|
|
20135
20147
|
this.registerFeature(new textSynchronization_1.WillSaveWaitUntilFeature(this));
|
|
20136
20148
|
this.registerFeature(new textSynchronization_1.DidSaveTextDocumentFeature(this));
|
|
20137
20149
|
this.registerFeature(new textSynchronization_1.DidCloseTextDocumentFeature(this, this._syncedDocuments, pendingFullTextDocumentChanges));
|
|
20138
|
-
this.registerFeature(new fileSystemWatcher_1.FileSystemWatcherFeature(this, (
|
|
20150
|
+
this.registerFeature(new fileSystemWatcher_1.FileSystemWatcherFeature(this, (event2) => this.notifyFileEvent(event2)));
|
|
20139
20151
|
this.registerFeature(new completion_1.CompletionItemFeature(this));
|
|
20140
20152
|
this.registerFeature(new hover_1.HoverFeature(this));
|
|
20141
20153
|
this.registerFeature(new signatureHelp_1.SignatureHelpFeature(this));
|
|
@@ -20769,9 +20781,9 @@ var require_main = __commonJS({
|
|
|
20769
20781
|
exports2.createMessageConnection = createMessageConnection;
|
|
20770
20782
|
var ril_1 = __importDefault(require_ril());
|
|
20771
20783
|
ril_1.default.install();
|
|
20772
|
-
var
|
|
20784
|
+
var path8 = __importStar(require("path"));
|
|
20773
20785
|
var os = __importStar(require("os"));
|
|
20774
|
-
var
|
|
20786
|
+
var fs4 = __importStar(require("fs"));
|
|
20775
20787
|
var crypto_1 = require("crypto");
|
|
20776
20788
|
var net_1 = require("net");
|
|
20777
20789
|
var api_1 = require_api();
|
|
@@ -20912,7 +20924,7 @@ var require_main = __commonJS({
|
|
|
20912
20924
|
}
|
|
20913
20925
|
let randomLength = 32;
|
|
20914
20926
|
const fixedLength = "/lsp-.sock".length;
|
|
20915
|
-
const tmpDir =
|
|
20927
|
+
const tmpDir = fs4.realpathSync(XDG_RUNTIME_DIR ?? os.tmpdir());
|
|
20916
20928
|
const limit = safeIpcPathLengths.get(process.platform);
|
|
20917
20929
|
if (limit !== void 0) {
|
|
20918
20930
|
randomLength = Math.min(limit - tmpDir.length - fixedLength, randomLength);
|
|
@@ -20921,7 +20933,7 @@ var require_main = __commonJS({
|
|
|
20921
20933
|
throw new Error(`Unable to generate a random pipe name with ${randomLength} characters.`);
|
|
20922
20934
|
}
|
|
20923
20935
|
const randomSuffix = (0, crypto_1.randomBytes)(Math.floor(randomLength / 2)).toString("hex");
|
|
20924
|
-
return
|
|
20936
|
+
return path8.join(tmpDir, `lsp-${randomSuffix}.sock`);
|
|
20925
20937
|
}
|
|
20926
20938
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
20927
20939
|
let connectResolve;
|
|
@@ -22281,8 +22293,8 @@ var require_main3 = __commonJS({
|
|
|
22281
22293
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
22282
22294
|
exports2.SettingMonitor = exports2.LanguageClient = exports2.TransportKind = void 0;
|
|
22283
22295
|
var cp = __importStar(require("child_process"));
|
|
22284
|
-
var
|
|
22285
|
-
var
|
|
22296
|
+
var fs4 = __importStar(require("fs"));
|
|
22297
|
+
var path8 = __importStar(require("path"));
|
|
22286
22298
|
var readline = __importStar(require("readline"));
|
|
22287
22299
|
var vscode_1 = require("vscode");
|
|
22288
22300
|
var Is2 = __importStar(require_is());
|
|
@@ -22727,19 +22739,19 @@ var require_main3 = __commonJS({
|
|
|
22727
22739
|
});
|
|
22728
22740
|
}
|
|
22729
22741
|
_getRuntimePath(runtime, serverWorkingDirectory) {
|
|
22730
|
-
if (
|
|
22742
|
+
if (path8.isAbsolute(runtime)) {
|
|
22731
22743
|
return runtime;
|
|
22732
22744
|
}
|
|
22733
22745
|
const mainRootPath = this._mainGetRootPath();
|
|
22734
22746
|
if (mainRootPath !== void 0) {
|
|
22735
|
-
const result =
|
|
22736
|
-
if (
|
|
22747
|
+
const result = path8.join(mainRootPath, runtime);
|
|
22748
|
+
if (fs4.existsSync(result)) {
|
|
22737
22749
|
return result;
|
|
22738
22750
|
}
|
|
22739
22751
|
}
|
|
22740
22752
|
if (serverWorkingDirectory !== void 0) {
|
|
22741
|
-
const result =
|
|
22742
|
-
if (
|
|
22753
|
+
const result = path8.join(serverWorkingDirectory, runtime);
|
|
22754
|
+
if (fs4.existsSync(result)) {
|
|
22743
22755
|
return result;
|
|
22744
22756
|
}
|
|
22745
22757
|
}
|
|
@@ -22763,7 +22775,7 @@ var require_main3 = __commonJS({
|
|
|
22763
22775
|
}
|
|
22764
22776
|
if (cwd) {
|
|
22765
22777
|
return new Promise((s) => {
|
|
22766
|
-
|
|
22778
|
+
fs4.lstat(cwd, (err, stats) => {
|
|
22767
22779
|
s(!err && stats.isDirectory() ? cwd : void 0);
|
|
22768
22780
|
});
|
|
22769
22781
|
});
|
|
@@ -22824,7 +22836,7 @@ __export(extension_exports, {
|
|
|
22824
22836
|
deactivate: () => deactivate
|
|
22825
22837
|
});
|
|
22826
22838
|
module.exports = __toCommonJS(extension_exports);
|
|
22827
|
-
var
|
|
22839
|
+
var path7 = __toESM(require("node:path"));
|
|
22828
22840
|
var import_vscode = require("vscode");
|
|
22829
22841
|
var import_node = __toESM(require_main3());
|
|
22830
22842
|
|
|
@@ -22852,25 +22864,32 @@ function collectWorkspaceEditChanges(value) {
|
|
|
22852
22864
|
}
|
|
22853
22865
|
return out;
|
|
22854
22866
|
}
|
|
22855
|
-
function commandArgumentsContainDirtyURI(args, dirtyURIs) {
|
|
22856
|
-
return args.some(
|
|
22867
|
+
function commandArgumentsContainDirtyURI(args, dirtyURIs, canonicalize = keepSpelling) {
|
|
22868
|
+
return args.some(
|
|
22869
|
+
(value) => valueContainsDirtyURI(value, dirtyURIs, canonicalize)
|
|
22870
|
+
);
|
|
22857
22871
|
}
|
|
22858
|
-
function workspaceEditChangesTouchDirtyURI(edits, dirtyURIs) {
|
|
22859
|
-
return edits.some((edit) => dirtyURIs.has(edit.uri));
|
|
22872
|
+
function workspaceEditChangesTouchDirtyURI(edits, dirtyURIs, canonicalize = keepSpelling) {
|
|
22873
|
+
return edits.some((edit) => dirtyURIs.has(canonicalize(edit.uri)));
|
|
22860
22874
|
}
|
|
22861
22875
|
function shouldApplyCommandWorkspaceEdit(command, commandPrefix) {
|
|
22862
22876
|
return commandPrefix !== "" && command.startsWith(commandPrefix);
|
|
22863
22877
|
}
|
|
22864
|
-
function
|
|
22878
|
+
function keepSpelling(uri) {
|
|
22879
|
+
return uri;
|
|
22880
|
+
}
|
|
22881
|
+
function valueContainsDirtyURI(value, dirtyURIs, canonicalize) {
|
|
22865
22882
|
if (typeof value === "string") {
|
|
22866
|
-
return dirtyURIs.has(value);
|
|
22883
|
+
return dirtyURIs.has(canonicalize(value));
|
|
22867
22884
|
}
|
|
22868
22885
|
if (Array.isArray(value)) {
|
|
22869
|
-
return value.some(
|
|
22886
|
+
return value.some(
|
|
22887
|
+
(item) => valueContainsDirtyURI(item, dirtyURIs, canonicalize)
|
|
22888
|
+
);
|
|
22870
22889
|
}
|
|
22871
22890
|
if (value && typeof value === "object") {
|
|
22872
22891
|
return Object.values(value).some(
|
|
22873
|
-
(item) => valueContainsDirtyURI(item, dirtyURIs)
|
|
22892
|
+
(item) => valueContainsDirtyURI(item, dirtyURIs, canonicalize)
|
|
22874
22893
|
);
|
|
22875
22894
|
}
|
|
22876
22895
|
return false;
|
|
@@ -22921,22 +22940,464 @@ function createExpectedServerRestartHandler(fallback, restart) {
|
|
|
22921
22940
|
};
|
|
22922
22941
|
}
|
|
22923
22942
|
|
|
22943
|
+
// src/findClientEntryByRoot.ts
|
|
22944
|
+
function findClientEntryByRoot(entries, byKey, root2, rootKey2) {
|
|
22945
|
+
for (const entry of entries) {
|
|
22946
|
+
if (entry.root === root2) {
|
|
22947
|
+
return entry;
|
|
22948
|
+
}
|
|
22949
|
+
}
|
|
22950
|
+
return byKey.get(rootKey2(root2));
|
|
22951
|
+
}
|
|
22952
|
+
|
|
22953
|
+
// src/resolveWithDirectoryMemo.ts
|
|
22954
|
+
function resolveWithDirectoryMemo(key, memo, resolve2) {
|
|
22955
|
+
if (memo.has(key)) {
|
|
22956
|
+
return memo.get(key);
|
|
22957
|
+
}
|
|
22958
|
+
const value = resolve2();
|
|
22959
|
+
memo.set(key, value);
|
|
22960
|
+
return value;
|
|
22961
|
+
}
|
|
22962
|
+
|
|
22924
22963
|
// src/serverResolution.ts
|
|
22925
|
-
var
|
|
22926
|
-
var
|
|
22964
|
+
var import_node_crypto2 = require("node:crypto");
|
|
22965
|
+
var import_node_fs3 = __toESM(require("node:fs"));
|
|
22927
22966
|
var import_node_module = require("node:module");
|
|
22928
|
-
var
|
|
22967
|
+
var import_node_path6 = __toESM(require("node:path"));
|
|
22929
22968
|
|
|
22930
|
-
// ../ttsc/src/internal/
|
|
22969
|
+
// ../ttsc/src/internal/pathIdentity/createFilesystemPathIdentityContext.ts
|
|
22931
22970
|
var import_node_child_process = __toESM(require("node:child_process"));
|
|
22971
|
+
var import_node_fs2 = __toESM(require("node:fs"));
|
|
22972
|
+
var import_node_path4 = __toESM(require("node:path"));
|
|
22973
|
+
|
|
22974
|
+
// ../ttsc/src/internal/E2ETrace.ts
|
|
22975
|
+
var import_node_crypto = __toESM(require("node:crypto"));
|
|
22976
|
+
var import_node_events = require("node:events");
|
|
22932
22977
|
var import_node_fs = __toESM(require("node:fs"));
|
|
22933
22978
|
var import_node_path = __toESM(require("node:path"));
|
|
22979
|
+
var E2ETrace;
|
|
22980
|
+
((E2ETrace2) => {
|
|
22981
|
+
function runtimeCleanup(directory, runtimeCacheDir, origin = "ttsx-runtime-cleanup") {
|
|
22982
|
+
const selected = process.env.TTSC_E2E_TRACE;
|
|
22983
|
+
if (!selected) return void 0;
|
|
22984
|
+
try {
|
|
22985
|
+
if (!admit(selected)) return void 0;
|
|
22986
|
+
const token = {
|
|
22987
|
+
invocation: String(++ordinal),
|
|
22988
|
+
argv: [...process.argv],
|
|
22989
|
+
cwd: process.cwd(),
|
|
22990
|
+
lower: (/* @__PURE__ */ new Date()).toISOString(),
|
|
22991
|
+
origin,
|
|
22992
|
+
argv0: null
|
|
22993
|
+
};
|
|
22994
|
+
const record = (phase, ownership, error, ownerObservation) => {
|
|
22995
|
+
try {
|
|
22996
|
+
const detail = error !== null && typeof error === "object" ? error : void 0;
|
|
22997
|
+
event(token, "runtime-cleanup", process.pid, {
|
|
22998
|
+
phase,
|
|
22999
|
+
directory,
|
|
23000
|
+
runtimeCacheDir,
|
|
23001
|
+
ownership,
|
|
23002
|
+
ownerObservation,
|
|
23003
|
+
errorName: detail && typeof detail.name === "string" ? detail.name : void 0,
|
|
23004
|
+
errorCode: detail && typeof detail.code === "string" ? detail.code : void 0,
|
|
23005
|
+
errorMessage: detail && typeof detail.message === "string" ? detail.message : void 0,
|
|
23006
|
+
origin: token.origin
|
|
23007
|
+
});
|
|
23008
|
+
} catch {
|
|
23009
|
+
failed = true;
|
|
23010
|
+
}
|
|
23011
|
+
};
|
|
23012
|
+
record("attempt");
|
|
23013
|
+
return record;
|
|
23014
|
+
} catch {
|
|
23015
|
+
failed = true;
|
|
23016
|
+
return void 0;
|
|
23017
|
+
}
|
|
23018
|
+
}
|
|
23019
|
+
E2ETrace2.runtimeCleanup = runtimeCleanup;
|
|
23020
|
+
function capabilityResolution(phase, data) {
|
|
23021
|
+
const selected = process.env.TTSC_E2E_TRACE;
|
|
23022
|
+
if (!selected) return;
|
|
23023
|
+
try {
|
|
23024
|
+
if (!admit(selected)) return;
|
|
23025
|
+
const token = {
|
|
23026
|
+
invocation: String(++ordinal),
|
|
23027
|
+
argv: [...process.argv],
|
|
23028
|
+
cwd: process.cwd(),
|
|
23029
|
+
lower: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23030
|
+
origin: "ttsc-capability-resolution",
|
|
23031
|
+
argv0: null
|
|
23032
|
+
};
|
|
23033
|
+
event(token, "capability-resolution", process.pid, {
|
|
23034
|
+
...data,
|
|
23035
|
+
phase,
|
|
23036
|
+
origin: token.origin
|
|
23037
|
+
});
|
|
23038
|
+
} catch {
|
|
23039
|
+
failed = true;
|
|
23040
|
+
}
|
|
23041
|
+
}
|
|
23042
|
+
E2ETrace2.capabilityResolution = capabilityResolution;
|
|
23043
|
+
function watchShutdown(phase, data) {
|
|
23044
|
+
const selected = process.env.TTSC_E2E_TRACE;
|
|
23045
|
+
if (!selected) return;
|
|
23046
|
+
try {
|
|
23047
|
+
if (!admit(selected)) return;
|
|
23048
|
+
const token = {
|
|
23049
|
+
invocation: String(++ordinal),
|
|
23050
|
+
argv: [...process.argv],
|
|
23051
|
+
cwd: process.cwd(),
|
|
23052
|
+
lower: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23053
|
+
origin: "ttsc-watch-shutdown",
|
|
23054
|
+
argv0: null
|
|
23055
|
+
};
|
|
23056
|
+
event(token, "watch-shutdown-phase", process.pid, {
|
|
23057
|
+
...data,
|
|
23058
|
+
phase,
|
|
23059
|
+
origin: token.origin
|
|
23060
|
+
});
|
|
23061
|
+
} catch {
|
|
23062
|
+
failed = true;
|
|
23063
|
+
}
|
|
23064
|
+
}
|
|
23065
|
+
E2ETrace2.watchShutdown = watchShutdown;
|
|
23066
|
+
function runtimePreparation(source, filename, selectedFormat, origin, emitAttribution) {
|
|
23067
|
+
const selected = process.env.TTSC_E2E_TRACE;
|
|
23068
|
+
if (!selected) return;
|
|
23069
|
+
try {
|
|
23070
|
+
if (!admit(selected)) return;
|
|
23071
|
+
const token = {
|
|
23072
|
+
invocation: String(++ordinal),
|
|
23073
|
+
argv: [...process.argv],
|
|
23074
|
+
cwd: process.cwd(),
|
|
23075
|
+
lower: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23076
|
+
origin,
|
|
23077
|
+
argv0: null
|
|
23078
|
+
};
|
|
23079
|
+
if (emitAttribution?.nativeBuildFailure !== void 0) {
|
|
23080
|
+
const { nativeBuildFailure, ...coordinates } = emitAttribution;
|
|
23081
|
+
event(token, "runtime-source-preparation-failed", process.pid, {
|
|
23082
|
+
origin,
|
|
23083
|
+
filename,
|
|
23084
|
+
selectedFormat,
|
|
23085
|
+
emitAttribution: coordinates,
|
|
23086
|
+
status: nativeBuildFailure.status,
|
|
23087
|
+
stdout: payload(
|
|
23088
|
+
token,
|
|
23089
|
+
"runtime-build-stdout",
|
|
23090
|
+
nativeBuildFailure.stdout
|
|
23091
|
+
),
|
|
23092
|
+
stderr: payload(
|
|
23093
|
+
token,
|
|
23094
|
+
"runtime-build-stderr",
|
|
23095
|
+
nativeBuildFailure.stderr
|
|
23096
|
+
),
|
|
23097
|
+
representation: "returned-build-envelope-without-project-emit"
|
|
23098
|
+
});
|
|
23099
|
+
return;
|
|
23100
|
+
}
|
|
23101
|
+
if (source.length > PAYLOAD_LIMIT / 2) {
|
|
23102
|
+
integrity(token, "payload-budget-exceeded");
|
|
23103
|
+
return;
|
|
23104
|
+
}
|
|
23105
|
+
const sourcePayload = payload(
|
|
23106
|
+
token,
|
|
23107
|
+
"runtime-source",
|
|
23108
|
+
Buffer.from(source, "utf16le")
|
|
23109
|
+
);
|
|
23110
|
+
event(token, "runtime-source-preparation", process.pid, {
|
|
23111
|
+
origin,
|
|
23112
|
+
filename,
|
|
23113
|
+
selectedFormat,
|
|
23114
|
+
source: sourcePayload,
|
|
23115
|
+
emitAttribution: emitAttribution ?? null,
|
|
23116
|
+
sourceEncoding: "utf16le",
|
|
23117
|
+
sourceCodeUnits: source.length,
|
|
23118
|
+
representation: "consumed-javascript-string"
|
|
23119
|
+
});
|
|
23120
|
+
} catch {
|
|
23121
|
+
failed = true;
|
|
23122
|
+
}
|
|
23123
|
+
}
|
|
23124
|
+
E2ETrace2.runtimePreparation = runtimePreparation;
|
|
23125
|
+
function asynchronous(token, child) {
|
|
23126
|
+
if (token === void 0 || failed) return;
|
|
23127
|
+
const upper = (/* @__PURE__ */ new Date()).toISOString();
|
|
23128
|
+
const observe = (kind, data) => {
|
|
23129
|
+
try {
|
|
23130
|
+
event(token, kind, child.pid ?? null, data, upper);
|
|
23131
|
+
} catch {
|
|
23132
|
+
failed = true;
|
|
23133
|
+
}
|
|
23134
|
+
};
|
|
23135
|
+
const onSpawn = () => observe("process-start", { origin: token.origin, started: true });
|
|
23136
|
+
const onExit = (status, signal) => observe("process-exit", {
|
|
23137
|
+
origin: token.origin,
|
|
23138
|
+
status,
|
|
23139
|
+
signal,
|
|
23140
|
+
exitObserved: true
|
|
23141
|
+
});
|
|
23142
|
+
const onError = (error) => observe("process-result", {
|
|
23143
|
+
origin: token.origin,
|
|
23144
|
+
started: child.pid !== void 0,
|
|
23145
|
+
outcome: "async-error",
|
|
23146
|
+
error: { name: error.name, message: error.message }
|
|
23147
|
+
});
|
|
23148
|
+
const onClose = (status, signal) => {
|
|
23149
|
+
child.removeListener("spawn", onSpawn);
|
|
23150
|
+
child.removeListener("exit", onExit);
|
|
23151
|
+
child.removeListener(import_node_events.errorMonitor, onError);
|
|
23152
|
+
observe("process-close", { origin: token.origin, status, signal });
|
|
23153
|
+
};
|
|
23154
|
+
child.once("spawn", onSpawn);
|
|
23155
|
+
child.once("exit", onExit);
|
|
23156
|
+
child.once(import_node_events.errorMonitor, onError);
|
|
23157
|
+
child.once("close", onClose);
|
|
23158
|
+
}
|
|
23159
|
+
E2ETrace2.asynchronous = asynchronous;
|
|
23160
|
+
function synchronous(command, args, options, origin, operation, coordinatorRoot = process.env.TTSC_E2E_TRACE) {
|
|
23161
|
+
const token = begin(command, args, options, origin, coordinatorRoot);
|
|
23162
|
+
const returned = operation();
|
|
23163
|
+
result(token, returned);
|
|
23164
|
+
return returned;
|
|
23165
|
+
}
|
|
23166
|
+
E2ETrace2.synchronous = synchronous;
|
|
23167
|
+
function begin(command, args, options, origin, coordinatorRoot = process.env.TTSC_E2E_TRACE) {
|
|
23168
|
+
if (!coordinatorRoot) return void 0;
|
|
23169
|
+
try {
|
|
23170
|
+
if (!admit(coordinatorRoot)) return void 0;
|
|
23171
|
+
const token = {
|
|
23172
|
+
invocation: String(++ordinal),
|
|
23173
|
+
argv: [command, ...args],
|
|
23174
|
+
cwd: options.cwd === void 0 ? null : String(options.cwd),
|
|
23175
|
+
lower: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23176
|
+
origin,
|
|
23177
|
+
argv0: options.argv0 ?? null
|
|
23178
|
+
};
|
|
23179
|
+
event(token, "process-attempt", null, {
|
|
23180
|
+
origin,
|
|
23181
|
+
cwdInherited: options.cwd === void 0,
|
|
23182
|
+
argv0: token.argv0
|
|
23183
|
+
});
|
|
23184
|
+
return token;
|
|
23185
|
+
} catch {
|
|
23186
|
+
failed = true;
|
|
23187
|
+
return void 0;
|
|
23188
|
+
}
|
|
23189
|
+
}
|
|
23190
|
+
E2ETrace2.begin = begin;
|
|
23191
|
+
function result(token, returned) {
|
|
23192
|
+
if (token === void 0 || failed) return;
|
|
23193
|
+
const upper = (/* @__PURE__ */ new Date()).toISOString();
|
|
23194
|
+
try {
|
|
23195
|
+
const error = returned.error;
|
|
23196
|
+
const stdout = payload(token, "stdout", returned.stdout);
|
|
23197
|
+
const stderr = payload(token, "stderr", returned.stderr);
|
|
23198
|
+
event(
|
|
23199
|
+
token,
|
|
23200
|
+
"process-result",
|
|
23201
|
+
returned.pid > 0 ? returned.pid : null,
|
|
23202
|
+
{
|
|
23203
|
+
origin: token.origin,
|
|
23204
|
+
started: returned.pid > 0,
|
|
23205
|
+
exitObserved: returned.status !== null || returned.signal !== null,
|
|
23206
|
+
status: returned.status,
|
|
23207
|
+
signal: returned.signal,
|
|
23208
|
+
error: error === void 0 ? null : {
|
|
23209
|
+
name: error.name,
|
|
23210
|
+
message: error.message,
|
|
23211
|
+
code: error.code,
|
|
23212
|
+
errno: error.errno,
|
|
23213
|
+
syscall: error.syscall
|
|
23214
|
+
},
|
|
23215
|
+
stdout,
|
|
23216
|
+
stderr
|
|
23217
|
+
},
|
|
23218
|
+
upper
|
|
23219
|
+
);
|
|
23220
|
+
} catch {
|
|
23221
|
+
failed = true;
|
|
23222
|
+
}
|
|
23223
|
+
}
|
|
23224
|
+
E2ETrace2.result = result;
|
|
23225
|
+
})(E2ETrace || (E2ETrace = {}));
|
|
23226
|
+
var WRITER_LIMIT = 256 * 1024 * 1024;
|
|
23227
|
+
var PAYLOAD_LIMIT = 64 * 1024 * 1024;
|
|
23228
|
+
var FAILURE_RESERVE = 1024 * 1024;
|
|
23229
|
+
var root;
|
|
23230
|
+
var instance;
|
|
23231
|
+
var ordinal = 0;
|
|
23232
|
+
var sequence = 0;
|
|
23233
|
+
var bytes = 0;
|
|
23234
|
+
var failed = false;
|
|
23235
|
+
function admit(selected) {
|
|
23236
|
+
if (failed) return false;
|
|
23237
|
+
if (root !== void 0) return true;
|
|
23238
|
+
if (!import_node_path.default.isAbsolute(selected)) return false;
|
|
23239
|
+
instance = import_node_crypto.default.randomBytes(16).toString("hex");
|
|
23240
|
+
root = selected;
|
|
23241
|
+
return true;
|
|
23242
|
+
}
|
|
23243
|
+
function append(value) {
|
|
23244
|
+
const fd = import_node_fs.default.openSync(
|
|
23245
|
+
import_node_path.default.join(root, `${process.pid}-${instance}.jsonl`),
|
|
23246
|
+
"a",
|
|
23247
|
+
384
|
|
23248
|
+
);
|
|
23249
|
+
try {
|
|
23250
|
+
let offset = 0;
|
|
23251
|
+
while (offset < value.length) {
|
|
23252
|
+
const written = import_node_fs.default.writeSync(fd, value, offset, value.length - offset);
|
|
23253
|
+
if (written <= 0) throw new Error("trace short write");
|
|
23254
|
+
offset += written;
|
|
23255
|
+
bytes += written;
|
|
23256
|
+
}
|
|
23257
|
+
} finally {
|
|
23258
|
+
import_node_fs.default.closeSync(fd);
|
|
23259
|
+
}
|
|
23260
|
+
}
|
|
23261
|
+
function event(token, kind, pid, data, upper) {
|
|
23262
|
+
if (failed) return;
|
|
23263
|
+
const record = {
|
|
23264
|
+
schema: 1,
|
|
23265
|
+
event: kind,
|
|
23266
|
+
writerPid: process.pid,
|
|
23267
|
+
instance,
|
|
23268
|
+
sequence: ++sequence,
|
|
23269
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23270
|
+
invocation: `${instance}:${token.invocation}`,
|
|
23271
|
+
pid,
|
|
23272
|
+
argv: token.argv,
|
|
23273
|
+
cwd: token.cwd,
|
|
23274
|
+
startLowerBound: token.lower,
|
|
23275
|
+
startUpperBound: upper,
|
|
23276
|
+
data: { writerRuntime: process.version, ...data }
|
|
23277
|
+
};
|
|
23278
|
+
const encoded = Buffer.from(JSON.stringify(record) + "\n");
|
|
23279
|
+
if (bytes + encoded.length > WRITER_LIMIT - FAILURE_RESERVE) {
|
|
23280
|
+
integrity(token, "writer-budget-exceeded");
|
|
23281
|
+
return;
|
|
23282
|
+
}
|
|
23283
|
+
try {
|
|
23284
|
+
append(encoded);
|
|
23285
|
+
} catch {
|
|
23286
|
+
integrity(token, "sink-io-failed");
|
|
23287
|
+
}
|
|
23288
|
+
}
|
|
23289
|
+
function payload(token, label, value) {
|
|
23290
|
+
if (value === null || value === void 0 || failed) return null;
|
|
23291
|
+
if (typeof value === "string") {
|
|
23292
|
+
if (Buffer.byteLength(value) > PAYLOAD_LIMIT) {
|
|
23293
|
+
integrity(token, "payload-budget-exceeded");
|
|
23294
|
+
return null;
|
|
23295
|
+
}
|
|
23296
|
+
return { text: value, representation: "returned-string" };
|
|
23297
|
+
}
|
|
23298
|
+
const content = value;
|
|
23299
|
+
if (content.length > PAYLOAD_LIMIT || bytes + content.length > WRITER_LIMIT - FAILURE_RESERVE) {
|
|
23300
|
+
integrity(token, "payload-budget-exceeded");
|
|
23301
|
+
return null;
|
|
23302
|
+
}
|
|
23303
|
+
const filename = `${process.pid}-${instance}-${token.invocation}-${label}.bin`;
|
|
23304
|
+
try {
|
|
23305
|
+
import_node_fs.default.writeFileSync(import_node_path.default.join(root, filename), content, {
|
|
23306
|
+
flag: "wx",
|
|
23307
|
+
mode: 384
|
|
23308
|
+
});
|
|
23309
|
+
bytes += content.length;
|
|
23310
|
+
return { path: filename, bytes: content.length };
|
|
23311
|
+
} catch {
|
|
23312
|
+
bytes += content.length;
|
|
23313
|
+
integrity(token, "payload-io-failed");
|
|
23314
|
+
return null;
|
|
23315
|
+
}
|
|
23316
|
+
}
|
|
23317
|
+
function integrity(token, reason) {
|
|
23318
|
+
failed = true;
|
|
23319
|
+
try {
|
|
23320
|
+
const encoded = Buffer.from(
|
|
23321
|
+
"\n" + JSON.stringify({
|
|
23322
|
+
schema: 1,
|
|
23323
|
+
event: "integrity-failure",
|
|
23324
|
+
writerPid: process.pid,
|
|
23325
|
+
instance,
|
|
23326
|
+
sequence: ++sequence,
|
|
23327
|
+
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
23328
|
+
invocation: `${instance}:${token.invocation}`,
|
|
23329
|
+
pid: null,
|
|
23330
|
+
argv: [],
|
|
23331
|
+
cwd: null,
|
|
23332
|
+
data: { outcome: reason, writerRuntime: process.version }
|
|
23333
|
+
}) + "\n"
|
|
23334
|
+
);
|
|
23335
|
+
if (bytes + encoded.length <= WRITER_LIMIT) append(encoded);
|
|
23336
|
+
} catch {
|
|
23337
|
+
}
|
|
23338
|
+
}
|
|
22934
23339
|
|
|
22935
|
-
// ../ttsc/src/internal/
|
|
23340
|
+
// ../ttsc/src/internal/OwnedSynchronousProcess.ts
|
|
23341
|
+
var OwnedSynchronousProcess;
|
|
23342
|
+
((OwnedSynchronousProcess2) => {
|
|
23343
|
+
function run(scope, callback) {
|
|
23344
|
+
const previous = current;
|
|
23345
|
+
current = scope;
|
|
23346
|
+
try {
|
|
23347
|
+
checkpoint();
|
|
23348
|
+
const result = callback();
|
|
23349
|
+
checkpoint();
|
|
23350
|
+
return result;
|
|
23351
|
+
} finally {
|
|
23352
|
+
current = previous;
|
|
23353
|
+
}
|
|
23354
|
+
}
|
|
23355
|
+
OwnedSynchronousProcess2.run = run;
|
|
23356
|
+
function checkpoint() {
|
|
23357
|
+
if (cancelled())
|
|
23358
|
+
throw new DOMException("ttsc: operation cancelled", "AbortError");
|
|
23359
|
+
}
|
|
23360
|
+
OwnedSynchronousProcess2.checkpoint = checkpoint;
|
|
23361
|
+
function cancelled() {
|
|
23362
|
+
return current !== void 0 && Atomics.load(new Int32Array(current.cancel), 0) !== 0;
|
|
23363
|
+
}
|
|
23364
|
+
OwnedSynchronousProcess2.cancelled = cancelled;
|
|
23365
|
+
function sleep(milliseconds) {
|
|
23366
|
+
checkpoint();
|
|
23367
|
+
const state = new Int32Array(current?.cancel ?? new SharedArrayBuffer(4));
|
|
23368
|
+
Atomics.wait(state, 0, 0, milliseconds);
|
|
23369
|
+
checkpoint();
|
|
23370
|
+
}
|
|
23371
|
+
OwnedSynchronousProcess2.sleep = sleep;
|
|
23372
|
+
function launch(command, args, options) {
|
|
23373
|
+
if (current?.launch === void 0) return void 0;
|
|
23374
|
+
checkpoint();
|
|
23375
|
+
const result = current.launch(command, args, options);
|
|
23376
|
+
checkpoint();
|
|
23377
|
+
return result;
|
|
23378
|
+
}
|
|
23379
|
+
OwnedSynchronousProcess2.launch = launch;
|
|
23380
|
+
function track(retirement) {
|
|
23381
|
+
if (current?.retirements === void 0) return false;
|
|
23382
|
+
current.retirements.add(retirement);
|
|
23383
|
+
void retirement.catch(() => void 0);
|
|
23384
|
+
return true;
|
|
23385
|
+
}
|
|
23386
|
+
OwnedSynchronousProcess2.track = track;
|
|
23387
|
+
function reportFailure(error) {
|
|
23388
|
+
current?.failures?.push(error);
|
|
23389
|
+
}
|
|
23390
|
+
OwnedSynchronousProcess2.reportFailure = reportFailure;
|
|
23391
|
+
})(OwnedSynchronousProcess || (OwnedSynchronousProcess = {}));
|
|
23392
|
+
var current;
|
|
23393
|
+
|
|
23394
|
+
// ../ttsc/src/internal/parseWindowsDirectoryCaseSensitivity.ts
|
|
22936
23395
|
function parseWindowsDirectoryCaseSensitivity(directoryOutput, volumeOutput, volumeRoot) {
|
|
22937
23396
|
const text = directoryOutput.toString("utf8");
|
|
22938
|
-
|
|
22939
|
-
|
|
23397
|
+
const english = /^Case sensitive attribute on directory [^\r\n]+ is (enabled|disabled)\.$/iu.exec(
|
|
23398
|
+
text.trimEnd()
|
|
23399
|
+
);
|
|
23400
|
+
if (english !== null) return english[1].toLowerCase() === "enabled";
|
|
22940
23401
|
if (volumeOutput === void 0) return void 0;
|
|
22941
23402
|
const encodedRoot = Buffer.from(volumeRoot, "utf8");
|
|
22942
23403
|
const rootOffset = volumeOutput.lastIndexOf(encodedRoot);
|
|
@@ -22948,22 +23409,55 @@ function parseWindowsDirectoryCaseSensitivity(directoryOutput, volumeOutput, vol
|
|
|
22948
23409
|
return !directoryOutput.subarray(directoryOutput.length - disabledSuffix.length).equals(disabledSuffix);
|
|
22949
23410
|
}
|
|
22950
23411
|
|
|
22951
|
-
// ../ttsc/src/internal/
|
|
23412
|
+
// ../ttsc/src/internal/pathIdentity/isFilesystemPathIdentityWithin.ts
|
|
23413
|
+
var import_node_path2 = __toESM(require("node:path"));
|
|
23414
|
+
function isFilesystemPathIdentityWithin(root2, candidate, platform = process.platform) {
|
|
23415
|
+
if (candidate === root2) return true;
|
|
23416
|
+
const separator = platform === "win32" ? import_node_path2.default.win32.sep : import_node_path2.default.posix.sep;
|
|
23417
|
+
return candidate.startsWith(
|
|
23418
|
+
root2.endsWith(separator) ? root2 : `${root2}${separator}`
|
|
23419
|
+
);
|
|
23420
|
+
}
|
|
23421
|
+
|
|
23422
|
+
// ../ttsc/src/internal/pathIdentity/resolveFilesystemPath.ts
|
|
23423
|
+
var import_node_path3 = __toESM(require("node:path"));
|
|
23424
|
+
function resolveFilesystemPath(location, platform = process.platform) {
|
|
23425
|
+
const pathApi = platform === "win32" ? import_node_path3.default.win32 : import_node_path3.default.posix;
|
|
23426
|
+
if (platform !== "win32") {
|
|
23427
|
+
return pathApi.resolve(location);
|
|
23428
|
+
}
|
|
23429
|
+
const normalized = location.replaceAll("/", "\\");
|
|
23430
|
+
if (normalized.toLowerCase().startsWith("\\\\?\\unc\\")) {
|
|
23431
|
+
return pathApi.resolve(`\\\\${normalized.slice(8)}`);
|
|
23432
|
+
}
|
|
23433
|
+
if (normalized.startsWith("\\\\?\\") && /^[A-Za-z]:\\/.test(normalized.slice(4))) {
|
|
23434
|
+
return pathApi.resolve(normalized.slice(4));
|
|
23435
|
+
}
|
|
23436
|
+
return pathApi.resolve(normalized);
|
|
23437
|
+
}
|
|
23438
|
+
|
|
23439
|
+
// ../ttsc/src/internal/pathIdentity/createFilesystemPathIdentityContext.ts
|
|
22952
23440
|
function createFilesystemPathIdentityContext(operations = {}) {
|
|
22953
23441
|
const identities = /* @__PURE__ */ new Map();
|
|
22954
23442
|
const realpaths = /* @__PURE__ */ new Map();
|
|
22955
23443
|
const sensitivities = /* @__PURE__ */ new Map();
|
|
22956
23444
|
const platform = operations.platform ?? process.platform;
|
|
22957
|
-
const pathApi = platform === "win32" ?
|
|
23445
|
+
const pathApi = platform === "win32" ? import_node_path4.default.win32 : import_node_path4.default.posix;
|
|
22958
23446
|
const throwOnRealpathError = operations.throwOnRealpathError ?? true;
|
|
22959
23447
|
const realpath = operations.realpath ?? physicalRealpath;
|
|
22960
|
-
const lstat = operations.lstat ??
|
|
22961
|
-
const readdir = operations.readdir ??
|
|
22962
|
-
const caseSensitive = operations.caseSensitive ?? ((directory) =>
|
|
22963
|
-
|
|
22964
|
-
|
|
22965
|
-
|
|
22966
|
-
|
|
23448
|
+
const lstat = operations.lstat ?? import_node_fs2.default.lstatSync;
|
|
23449
|
+
const readdir = operations.readdir ?? import_node_fs2.default.readdirSync;
|
|
23450
|
+
const caseSensitive = operations.caseSensitive ?? ((directory) => {
|
|
23451
|
+
try {
|
|
23452
|
+
return filesystemDirectoryIsCaseSensitive(directory, platform, {
|
|
23453
|
+
lstat,
|
|
23454
|
+
readdir,
|
|
23455
|
+
realpath
|
|
23456
|
+
});
|
|
23457
|
+
} catch {
|
|
23458
|
+
return void 0;
|
|
23459
|
+
}
|
|
23460
|
+
});
|
|
22967
23461
|
const resolve2 = (location) => {
|
|
22968
23462
|
const normalized = resolveFilesystemPath(location, platform);
|
|
22969
23463
|
const cached = identities.get(normalized);
|
|
@@ -22979,8 +23473,9 @@ function createFilesystemPathIdentityContext(operations = {}) {
|
|
|
22979
23473
|
throwOnRealpathError
|
|
22980
23474
|
);
|
|
22981
23475
|
if (physical !== void 0) {
|
|
23476
|
+
missing.reverse();
|
|
22982
23477
|
const sensitive = missing.length === 0 ? true : cachedCaseSensitivity(sensitivities, caseSensitive, physical);
|
|
22983
|
-
const suffix = sensitive
|
|
23478
|
+
const suffix = sensitive === false ? missing.map(foldAsciiCase) : missing;
|
|
22984
23479
|
const canonical = pathApi.resolve(physical, ...suffix);
|
|
22985
23480
|
const identity = {
|
|
22986
23481
|
key: filesystemPathIdentityKey(canonical, platform),
|
|
@@ -23001,7 +23496,7 @@ function createFilesystemPathIdentityContext(operations = {}) {
|
|
|
23001
23496
|
);
|
|
23002
23497
|
const identity = {
|
|
23003
23498
|
key: filesystemPathIdentityKey(
|
|
23004
|
-
sensitive ? normalized : normalized
|
|
23499
|
+
sensitive === false ? foldAsciiCase(normalized) : normalized,
|
|
23005
23500
|
platform
|
|
23006
23501
|
),
|
|
23007
23502
|
path: normalized
|
|
@@ -23012,49 +23507,71 @@ function createFilesystemPathIdentityContext(operations = {}) {
|
|
|
23012
23507
|
});
|
|
23013
23508
|
return identity;
|
|
23014
23509
|
}
|
|
23015
|
-
missing.
|
|
23510
|
+
missing.push(pathApi.basename(existing));
|
|
23016
23511
|
existing = parent;
|
|
23017
23512
|
}
|
|
23018
23513
|
};
|
|
23514
|
+
const directoryCaseSensitive = (directory) => {
|
|
23515
|
+
const normalized = resolveFilesystemPath(directory, platform);
|
|
23516
|
+
resolve2(normalized);
|
|
23517
|
+
return cachedCaseSensitivity(
|
|
23518
|
+
sensitivities,
|
|
23519
|
+
caseSensitive,
|
|
23520
|
+
identities.get(normalized).ancestor
|
|
23521
|
+
);
|
|
23522
|
+
};
|
|
23523
|
+
const lexicalParts = (location) => {
|
|
23524
|
+
const normalized = resolveFilesystemPath(location, platform);
|
|
23525
|
+
const root2 = pathApi.parse(normalized).root;
|
|
23526
|
+
return {
|
|
23527
|
+
root: root2,
|
|
23528
|
+
segments: normalized.slice(root2.length).split(pathApi.sep).filter(Boolean)
|
|
23529
|
+
};
|
|
23530
|
+
};
|
|
23531
|
+
const lexicalRelation = (root2, candidate, within) => {
|
|
23532
|
+
const parent = lexicalParts(root2);
|
|
23533
|
+
const child = lexicalParts(candidate);
|
|
23534
|
+
if (filesystemPathIdentityKey(parent.root, platform) !== filesystemPathIdentityKey(child.root, platform) || (within ? parent.segments.length > child.segments.length : parent.segments.length !== child.segments.length))
|
|
23535
|
+
return false;
|
|
23536
|
+
let directory = parent.root;
|
|
23537
|
+
for (let index = 0; index < parent.segments.length; index++) {
|
|
23538
|
+
const expected = parent.segments[index];
|
|
23539
|
+
const actual = child.segments[index];
|
|
23540
|
+
if (expected !== actual) {
|
|
23541
|
+
if (/^[\x00-\x7f]*$/.test(expected) && /^[\x00-\x7f]*$/.test(actual)) {
|
|
23542
|
+
if (directoryCaseSensitive(directory) === true || foldAsciiCase(expected) !== foldAsciiCase(actual))
|
|
23543
|
+
return false;
|
|
23544
|
+
}
|
|
23545
|
+
}
|
|
23546
|
+
directory = pathApi.join(directory, expected);
|
|
23547
|
+
}
|
|
23548
|
+
return true;
|
|
23549
|
+
};
|
|
23019
23550
|
return {
|
|
23020
|
-
caseSensitive:
|
|
23021
|
-
|
|
23022
|
-
resolve2(
|
|
23023
|
-
return cachedCaseSensitivity(
|
|
23024
|
-
sensitivities,
|
|
23025
|
-
caseSensitive,
|
|
23026
|
-
identities.get(normalized).ancestor
|
|
23027
|
-
);
|
|
23028
|
-
},
|
|
23029
|
-
isWithin: (root, candidate) => isFilesystemPathIdentityWithin(
|
|
23030
|
-
resolve2(root).key,
|
|
23551
|
+
caseSensitive: directoryCaseSensitive,
|
|
23552
|
+
isWithin: (root2, candidate) => isFilesystemPathIdentityWithin(
|
|
23553
|
+
resolve2(root2).key,
|
|
23031
23554
|
resolve2(candidate).key,
|
|
23032
23555
|
platform
|
|
23033
23556
|
),
|
|
23557
|
+
lexicalKey: (location) => {
|
|
23558
|
+
const lexical = lexicalParts(location);
|
|
23559
|
+
let parent = lexical.root;
|
|
23560
|
+
const segments = lexical.segments.map((segment) => {
|
|
23561
|
+
const key = directoryCaseSensitive(parent) === false ? foldAsciiCase(segment) : segment;
|
|
23562
|
+
parent = pathApi.join(parent, segment);
|
|
23563
|
+
return key;
|
|
23564
|
+
});
|
|
23565
|
+
return pathApi.join(
|
|
23566
|
+
filesystemPathIdentityKey(lexical.root, platform),
|
|
23567
|
+
...segments
|
|
23568
|
+
);
|
|
23569
|
+
},
|
|
23570
|
+
lexicalMatches: (left, right) => lexicalRelation(left, right, false),
|
|
23571
|
+
lexicalIsWithin: (root2, candidate) => lexicalRelation(root2, candidate, true),
|
|
23034
23572
|
resolve: resolve2
|
|
23035
23573
|
};
|
|
23036
23574
|
}
|
|
23037
|
-
function isFilesystemPathIdentityWithin(root, candidate, platform = process.platform) {
|
|
23038
|
-
if (candidate === root) return true;
|
|
23039
|
-
const separator = platform === "win32" ? import_node_path.default.win32.sep : import_node_path.default.posix.sep;
|
|
23040
|
-
return candidate.startsWith(
|
|
23041
|
-
root.endsWith(separator) ? root : `${root}${separator}`
|
|
23042
|
-
);
|
|
23043
|
-
}
|
|
23044
|
-
function resolveFilesystemPath(location, platform = process.platform) {
|
|
23045
|
-
const pathApi = platform === "win32" ? import_node_path.default.win32 : import_node_path.default.posix;
|
|
23046
|
-
if (platform !== "win32") {
|
|
23047
|
-
return pathApi.resolve(location);
|
|
23048
|
-
}
|
|
23049
|
-
const normalized = location.replaceAll("/", "\\");
|
|
23050
|
-
if (normalized.toLowerCase().startsWith("\\\\?\\unc\\")) {
|
|
23051
|
-
return pathApi.resolve(`\\\\${normalized.slice(8)}`);
|
|
23052
|
-
}
|
|
23053
|
-
if (normalized.startsWith("\\\\?\\") && /^[A-Za-z]:\\/.test(normalized.slice(4))) {
|
|
23054
|
-
return pathApi.resolve(normalized.slice(4));
|
|
23055
|
-
}
|
|
23056
|
-
return pathApi.resolve(normalized);
|
|
23057
|
-
}
|
|
23058
23575
|
function cachedRealpath(cache, realpath, location, platform, throwOnRealpathError) {
|
|
23059
23576
|
const cached = cache.get(location);
|
|
23060
23577
|
if (cached !== void 0) return cached.found ? cached.path : void 0;
|
|
@@ -23071,74 +23588,98 @@ function cachedRealpath(cache, realpath, location, platform, throwOnRealpathErro
|
|
|
23071
23588
|
}
|
|
23072
23589
|
}
|
|
23073
23590
|
function cachedCaseSensitivity(cache, caseSensitive, directory) {
|
|
23074
|
-
|
|
23075
|
-
if (cached !== void 0) return cached;
|
|
23591
|
+
if (cache.has(directory)) return cache.get(directory);
|
|
23076
23592
|
const sensitive = caseSensitive(directory);
|
|
23077
23593
|
cache.set(directory, sensitive);
|
|
23078
23594
|
return sensitive;
|
|
23079
23595
|
}
|
|
23080
23596
|
function physicalRealpath(location) {
|
|
23081
|
-
return
|
|
23597
|
+
return import_node_fs2.default.realpathSync.native?.(location) ?? import_node_fs2.default.realpathSync(location);
|
|
23082
23598
|
}
|
|
23083
23599
|
function filesystemDirectoryIsCaseSensitive(directory, platform, operations) {
|
|
23084
|
-
const pathApi = platform === "win32" ?
|
|
23600
|
+
const pathApi = platform === "win32" ? import_node_path4.default.win32 : import_node_path4.default.posix;
|
|
23085
23601
|
let entries;
|
|
23086
23602
|
try {
|
|
23087
23603
|
entries = operations.readdir(directory);
|
|
23088
23604
|
} catch {
|
|
23089
|
-
return
|
|
23605
|
+
return void 0;
|
|
23090
23606
|
}
|
|
23091
23607
|
const foldedNames = /* @__PURE__ */ new Map();
|
|
23092
23608
|
for (const name of entries) {
|
|
23093
|
-
const folded = name
|
|
23609
|
+
const folded = foldAsciiCase(name);
|
|
23094
23610
|
const previous = foldedNames.get(folded);
|
|
23095
23611
|
if (previous !== void 0 && previous !== name) return true;
|
|
23096
23612
|
foldedNames.set(folded, name);
|
|
23097
23613
|
}
|
|
23098
|
-
let rejectedAlternate = false;
|
|
23099
23614
|
for (const name of entries) {
|
|
23100
23615
|
const alternate = alternateCase(name);
|
|
23101
23616
|
if (alternate === name) continue;
|
|
23102
23617
|
try {
|
|
23103
23618
|
operations.lstat(pathApi.join(directory, alternate));
|
|
23104
|
-
return false;
|
|
23105
23619
|
} catch (error) {
|
|
23106
23620
|
if (isMissingFilesystemEntry(error)) {
|
|
23107
|
-
|
|
23621
|
+
try {
|
|
23622
|
+
operations.lstat(pathApi.join(directory, name));
|
|
23623
|
+
return true;
|
|
23624
|
+
} catch (originalError) {
|
|
23625
|
+
if (isMissingFilesystemEntry(originalError) === false)
|
|
23626
|
+
throw originalError;
|
|
23627
|
+
}
|
|
23108
23628
|
continue;
|
|
23109
23629
|
}
|
|
23110
23630
|
throw error;
|
|
23111
23631
|
}
|
|
23632
|
+
try {
|
|
23633
|
+
const actual = resolveFilesystemPath(
|
|
23634
|
+
operations.realpath(pathApi.join(directory, name)),
|
|
23635
|
+
platform
|
|
23636
|
+
);
|
|
23637
|
+
const alias = resolveFilesystemPath(
|
|
23638
|
+
operations.realpath(pathApi.join(directory, alternate)),
|
|
23639
|
+
platform
|
|
23640
|
+
);
|
|
23641
|
+
return actual !== alias;
|
|
23642
|
+
} catch (error) {
|
|
23643
|
+
if (isMissingFilesystemEntry(error) === false) throw error;
|
|
23644
|
+
}
|
|
23112
23645
|
}
|
|
23113
|
-
if (rejectedAlternate) return true;
|
|
23114
23646
|
if (platform === "darwin") {
|
|
23115
|
-
let
|
|
23647
|
+
let current2 = resolveFilesystemPath(directory, platform);
|
|
23116
23648
|
while (true) {
|
|
23117
|
-
const parent = pathApi.dirname(
|
|
23118
|
-
if (parent ===
|
|
23119
|
-
|
|
23649
|
+
const parent = pathApi.dirname(current2);
|
|
23650
|
+
if (parent === current2) break;
|
|
23651
|
+
if (operations.lstat(current2).dev !== operations.lstat(parent).dev)
|
|
23652
|
+
return void 0;
|
|
23653
|
+
const name = pathApi.basename(current2);
|
|
23120
23654
|
const alternate = alternateCase(name);
|
|
23121
23655
|
if (alternate !== name) {
|
|
23122
23656
|
try {
|
|
23123
|
-
|
|
23124
|
-
|
|
23657
|
+
const actual = resolveFilesystemPath(
|
|
23658
|
+
operations.realpath(current2),
|
|
23659
|
+
platform
|
|
23660
|
+
);
|
|
23661
|
+
const alias = resolveFilesystemPath(
|
|
23662
|
+
operations.realpath(pathApi.join(parent, alternate)),
|
|
23663
|
+
platform
|
|
23664
|
+
);
|
|
23665
|
+
return actual !== alias;
|
|
23125
23666
|
} catch (error) {
|
|
23126
23667
|
if (isMissingFilesystemEntry(error) === false) throw error;
|
|
23127
23668
|
}
|
|
23128
23669
|
}
|
|
23129
|
-
|
|
23670
|
+
current2 = parent;
|
|
23130
23671
|
}
|
|
23131
|
-
return
|
|
23672
|
+
return void 0;
|
|
23132
23673
|
}
|
|
23133
|
-
if (platform !== "win32") return
|
|
23674
|
+
if (platform !== "win32") return void 0;
|
|
23134
23675
|
const queried = queryWindowsDirectoryCaseSensitivity(directory);
|
|
23135
23676
|
if (queried !== void 0) return queried;
|
|
23136
|
-
return
|
|
23677
|
+
return void 0;
|
|
23137
23678
|
}
|
|
23138
23679
|
function queryWindowsDirectoryCaseSensitivity(directory) {
|
|
23139
23680
|
const result = queryWindowsDirectoryCaseSensitivityBytes(directory);
|
|
23140
23681
|
if (result === void 0) return void 0;
|
|
23141
|
-
const volumeRoot =
|
|
23682
|
+
const volumeRoot = import_node_path4.default.win32.parse(directory).root;
|
|
23142
23683
|
const direct = parseWindowsDirectoryCaseSensitivity(
|
|
23143
23684
|
result,
|
|
23144
23685
|
void 0,
|
|
@@ -23149,20 +23690,22 @@ function queryWindowsDirectoryCaseSensitivity(directory) {
|
|
|
23149
23690
|
return parseWindowsDirectoryCaseSensitivity(result, volume, volumeRoot);
|
|
23150
23691
|
}
|
|
23151
23692
|
function queryWindowsDirectoryCaseSensitivityBytes(directory) {
|
|
23152
|
-
const
|
|
23693
|
+
const args = ["file", "queryCaseSensitiveInfo", directory];
|
|
23694
|
+
const result = E2ETrace.synchronous(
|
|
23153
23695
|
"fsutil.exe",
|
|
23154
|
-
|
|
23155
|
-
{
|
|
23696
|
+
args,
|
|
23697
|
+
{},
|
|
23698
|
+
"path-case-probe",
|
|
23699
|
+
() => OwnedSynchronousProcess.launch("fsutil.exe", args, {
|
|
23700
|
+
windowsHide: true
|
|
23701
|
+
}) ?? import_node_child_process.default.spawnSync("fsutil.exe", args, { windowsHide: true })
|
|
23156
23702
|
);
|
|
23157
23703
|
return result.error === void 0 && result.status === 0 && Buffer.isBuffer(result.stdout) ? result.stdout : void 0;
|
|
23158
23704
|
}
|
|
23159
|
-
function unprovenCaseSensitivity(platform) {
|
|
23160
|
-
return platform !== "win32" && platform !== "darwin";
|
|
23161
|
-
}
|
|
23162
23705
|
function filesystemPathIdentityKey(location, platform) {
|
|
23163
23706
|
if (platform !== "win32") return location;
|
|
23164
|
-
const
|
|
23165
|
-
return `${
|
|
23707
|
+
const root2 = import_node_path4.default.win32.parse(location).root;
|
|
23708
|
+
return `${root2.toLowerCase()}${location.slice(root2.length)}`;
|
|
23166
23709
|
}
|
|
23167
23710
|
function alternateCase(value) {
|
|
23168
23711
|
return value.replace(
|
|
@@ -23170,10 +23713,68 @@ function alternateCase(value) {
|
|
|
23170
23713
|
(character) => character === character.toLowerCase() ? character.toUpperCase() : character.toLowerCase()
|
|
23171
23714
|
);
|
|
23172
23715
|
}
|
|
23716
|
+
function foldAsciiCase(value) {
|
|
23717
|
+
return value.replace(/[A-Z]/g, (character) => character.toLowerCase());
|
|
23718
|
+
}
|
|
23173
23719
|
function isMissingFilesystemEntry(error) {
|
|
23174
23720
|
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
23175
23721
|
}
|
|
23176
23722
|
|
|
23723
|
+
// src/clientRootPlanning.ts
|
|
23724
|
+
var import_node_path5 = __toESM(require("node:path"));
|
|
23725
|
+
function filterCandidatesByPhysicalRoots(candidates, identities, platform) {
|
|
23726
|
+
const sorted = candidates.map((candidate) => ({
|
|
23727
|
+
candidate,
|
|
23728
|
+
depth: pathDepth(identities.resolve(candidate.cwd).path, platform)
|
|
23729
|
+
})).sort((left, right) => right.depth - left.depth);
|
|
23730
|
+
const selected = [];
|
|
23731
|
+
for (const { candidate } of sorted) {
|
|
23732
|
+
if (selected.some((entry) => identities.isWithin(candidate.cwd, entry.cwd))) {
|
|
23733
|
+
continue;
|
|
23734
|
+
}
|
|
23735
|
+
selected.push(candidate);
|
|
23736
|
+
}
|
|
23737
|
+
const survivors = new Set(selected);
|
|
23738
|
+
return candidates.filter((candidate) => survivors.delete(candidate));
|
|
23739
|
+
}
|
|
23740
|
+
function planRootsByPhysicalIdentity(roots, preferredRoot, identities, platform) {
|
|
23741
|
+
const unique = /* @__PURE__ */ new Map();
|
|
23742
|
+
for (const root2 of roots) {
|
|
23743
|
+
const key = identities.resolve(root2).key;
|
|
23744
|
+
if (!unique.has(key)) unique.set(key, root2);
|
|
23745
|
+
}
|
|
23746
|
+
const preferredKey = preferredRoot ? identities.resolve(preferredRoot).key : void 0;
|
|
23747
|
+
const ordered = [];
|
|
23748
|
+
if (preferredKey && unique.has(preferredKey)) {
|
|
23749
|
+
ordered.push(unique.get(preferredKey));
|
|
23750
|
+
unique.delete(preferredKey);
|
|
23751
|
+
}
|
|
23752
|
+
const byDepth = [...unique.entries()].map(([key, root2]) => ({
|
|
23753
|
+
depth: pathDepth(identities.resolve(root2).path, platform),
|
|
23754
|
+
key,
|
|
23755
|
+
root: root2
|
|
23756
|
+
})).sort(
|
|
23757
|
+
(left, right) => right.depth - left.depth || left.key.localeCompare(right.key)
|
|
23758
|
+
);
|
|
23759
|
+
for (const { root: root2 } of byDepth) {
|
|
23760
|
+
ordered.push(root2);
|
|
23761
|
+
}
|
|
23762
|
+
const selected = [];
|
|
23763
|
+
for (const root2 of ordered) {
|
|
23764
|
+
if (selected.some(
|
|
23765
|
+
(entry) => identities.isWithin(entry, root2) || identities.isWithin(root2, entry)
|
|
23766
|
+
)) {
|
|
23767
|
+
continue;
|
|
23768
|
+
}
|
|
23769
|
+
selected.push(root2);
|
|
23770
|
+
}
|
|
23771
|
+
return selected;
|
|
23772
|
+
}
|
|
23773
|
+
function pathDepth(value, platform) {
|
|
23774
|
+
const pathApi = platform === "win32" ? import_node_path5.default.win32 : import_node_path5.default.posix;
|
|
23775
|
+
return pathApi.resolve(value).split(pathApi.sep).filter(Boolean).length;
|
|
23776
|
+
}
|
|
23777
|
+
|
|
23177
23778
|
// src/serverResolution.ts
|
|
23178
23779
|
function createServerRootPathIdentityContext(platform = process.platform, operations = {}) {
|
|
23179
23780
|
return createFilesystemPathIdentityContext({
|
|
@@ -23187,30 +23788,34 @@ var WRAPPED_COMMAND_IDS = ["ttsc.lint.fixAll", "ttsc.format.document"];
|
|
|
23187
23788
|
function resolveTtscServerLauncher(resolveFrom) {
|
|
23188
23789
|
try {
|
|
23189
23790
|
const requireFromBase = (0, import_node_module.createRequire)(
|
|
23190
|
-
|
|
23791
|
+
import_node_path6.default.join(resolveFrom, "__ttsc_vscode_resolve__.cjs")
|
|
23191
23792
|
);
|
|
23192
23793
|
const packageJson = requireFromBase.resolve("ttsc/package.json");
|
|
23193
|
-
const packageRoot =
|
|
23194
|
-
const manifest = JSON.parse(
|
|
23195
|
-
const bin = typeof manifest.bin?.ttscserver === "string" ? manifest.bin.ttscserver :
|
|
23196
|
-
const launcher =
|
|
23197
|
-
return
|
|
23794
|
+
const packageRoot = import_node_path6.default.dirname(packageJson);
|
|
23795
|
+
const manifest = JSON.parse(import_node_fs3.default.readFileSync(packageJson, "utf8"));
|
|
23796
|
+
const bin = typeof manifest.bin?.ttscserver === "string" ? manifest.bin.ttscserver : import_node_path6.default.join("lib", "launcher", "ttscserver.js");
|
|
23797
|
+
const launcher = import_node_path6.default.resolve(packageRoot, bin);
|
|
23798
|
+
return import_node_fs3.default.existsSync(launcher) ? launcher : void 0;
|
|
23198
23799
|
} catch {
|
|
23199
23800
|
return void 0;
|
|
23200
23801
|
}
|
|
23201
23802
|
}
|
|
23202
23803
|
function findProjectConfig(start, stopAt) {
|
|
23203
|
-
let dir =
|
|
23204
|
-
const boundary = stopAt ?
|
|
23804
|
+
let dir = import_node_path6.default.resolve(start);
|
|
23805
|
+
const boundary = stopAt ? import_node_path6.default.resolve(stopAt) : void 0;
|
|
23806
|
+
const identities = boundary ? createServerRootPathIdentityContext() : void 0;
|
|
23205
23807
|
for (; ; ) {
|
|
23808
|
+
if (boundary && !identities.isWithin(boundary, dir)) {
|
|
23809
|
+
return void 0;
|
|
23810
|
+
}
|
|
23206
23811
|
const config = projectConfigIn(dir);
|
|
23207
23812
|
if (config) {
|
|
23208
23813
|
return config;
|
|
23209
23814
|
}
|
|
23210
|
-
if (boundary && dir === boundary) {
|
|
23815
|
+
if (boundary && identities.resolve(dir).key === identities.resolve(boundary).key) {
|
|
23211
23816
|
return void 0;
|
|
23212
23817
|
}
|
|
23213
|
-
const parent =
|
|
23818
|
+
const parent = import_node_path6.default.dirname(dir);
|
|
23214
23819
|
if (parent === dir) {
|
|
23215
23820
|
return void 0;
|
|
23216
23821
|
}
|
|
@@ -23227,19 +23832,19 @@ function createResolutionCandidates(input) {
|
|
|
23227
23832
|
candidates.push(candidate);
|
|
23228
23833
|
};
|
|
23229
23834
|
if (input.activeFile) {
|
|
23230
|
-
const resolveFrom =
|
|
23835
|
+
const resolveFrom = import_node_path6.default.dirname(input.activeFile);
|
|
23231
23836
|
const tsconfig = findProjectConfig(resolveFrom, input.activeWorkspaceRoot);
|
|
23232
23837
|
push({
|
|
23233
|
-
cwd: tsconfig ?
|
|
23838
|
+
cwd: tsconfig ? import_node_path6.default.dirname(tsconfig) : input.activeWorkspaceRoot ?? resolveFrom,
|
|
23234
23839
|
resolveFrom,
|
|
23235
23840
|
tsconfig
|
|
23236
23841
|
});
|
|
23237
23842
|
}
|
|
23238
|
-
for (const
|
|
23239
|
-
const tsconfig = findProjectConfig(
|
|
23843
|
+
for (const root2 of input.workspaceRoots ?? []) {
|
|
23844
|
+
const tsconfig = findProjectConfig(root2, root2);
|
|
23240
23845
|
push({
|
|
23241
|
-
cwd: tsconfig ?
|
|
23242
|
-
resolveFrom:
|
|
23846
|
+
cwd: tsconfig ? import_node_path6.default.dirname(tsconfig) : root2,
|
|
23847
|
+
resolveFrom: root2,
|
|
23243
23848
|
tsconfig
|
|
23244
23849
|
});
|
|
23245
23850
|
}
|
|
@@ -23280,87 +23885,49 @@ function createServerExecutable(launcher, candidate, platform = process.platform
|
|
|
23280
23885
|
} : options
|
|
23281
23886
|
};
|
|
23282
23887
|
}
|
|
23283
|
-
function createDocumentSelectorPattern(ctor,
|
|
23284
|
-
return new ctor(
|
|
23888
|
+
function createDocumentSelectorPattern(ctor, root2) {
|
|
23889
|
+
return new ctor(root2, "**/*");
|
|
23285
23890
|
}
|
|
23286
|
-
function executeCommandIDPrefix(
|
|
23287
|
-
const key = (0,
|
|
23891
|
+
function executeCommandIDPrefix(root2) {
|
|
23892
|
+
const key = (0, import_node_crypto2.createHash)("sha256").update(rootKey(root2)).digest("hex").slice(0, 16);
|
|
23288
23893
|
return `ttsc.vscode.${key}.`;
|
|
23289
23894
|
}
|
|
23290
23895
|
function filterNonOverlappingCandidates(candidates) {
|
|
23291
23896
|
const identities = createServerRootPathIdentityContext();
|
|
23292
|
-
|
|
23293
|
-
|
|
23294
|
-
|
|
23295
|
-
|
|
23296
|
-
for (const candidate of sorted) {
|
|
23297
|
-
if (selected.some(
|
|
23298
|
-
(entry) => isPathInsideRoot(
|
|
23299
|
-
entry.cwd,
|
|
23300
|
-
candidate.cwd,
|
|
23301
|
-
process.platform,
|
|
23302
|
-
identities
|
|
23303
|
-
)
|
|
23304
|
-
)) {
|
|
23305
|
-
continue;
|
|
23306
|
-
}
|
|
23307
|
-
selected.push(candidate);
|
|
23308
|
-
}
|
|
23309
|
-
return selected.sort(
|
|
23310
|
-
(left, right) => candidates.indexOf(left) - candidates.indexOf(right)
|
|
23897
|
+
return filterCandidatesByPhysicalRoots(
|
|
23898
|
+
candidates,
|
|
23899
|
+
identities,
|
|
23900
|
+
process.platform
|
|
23311
23901
|
);
|
|
23312
23902
|
}
|
|
23313
23903
|
function planNonOverlappingClientRoots(roots, preferredRoot, platform = process.platform, identities = createServerRootPathIdentityContext(
|
|
23314
23904
|
platform
|
|
23315
23905
|
)) {
|
|
23316
|
-
|
|
23317
|
-
|
|
23318
|
-
|
|
23319
|
-
|
|
23320
|
-
|
|
23321
|
-
}
|
|
23322
|
-
}
|
|
23323
|
-
const preferredKey = preferredRoot ? rootKey(preferredRoot, platform, identities) : void 0;
|
|
23324
|
-
const ordered = [];
|
|
23325
|
-
if (preferredKey && unique.has(preferredKey)) {
|
|
23326
|
-
ordered.push(unique.get(preferredKey));
|
|
23327
|
-
unique.delete(preferredKey);
|
|
23328
|
-
}
|
|
23329
|
-
ordered.push(
|
|
23330
|
-
...[...unique.values()].sort((left, right) => {
|
|
23331
|
-
const depth = pathDepth(right, platform) - pathDepth(left, platform);
|
|
23332
|
-
return depth || rootKey(left, platform, identities).localeCompare(
|
|
23333
|
-
rootKey(right, platform, identities)
|
|
23334
|
-
);
|
|
23335
|
-
})
|
|
23906
|
+
return planRootsByPhysicalIdentity(
|
|
23907
|
+
roots,
|
|
23908
|
+
preferredRoot,
|
|
23909
|
+
identities,
|
|
23910
|
+
platform
|
|
23336
23911
|
);
|
|
23337
|
-
const selected = [];
|
|
23338
|
-
for (const root of ordered) {
|
|
23339
|
-
if (selected.some((entry) => rootsOverlap(entry, root, platform, identities))) {
|
|
23340
|
-
continue;
|
|
23341
|
-
}
|
|
23342
|
-
selected.push(root);
|
|
23343
|
-
}
|
|
23344
|
-
return selected;
|
|
23345
23912
|
}
|
|
23346
23913
|
function selectDeepestRootForPath(file, roots, platform = process.platform, identities = createServerRootPathIdentityContext(
|
|
23347
23914
|
platform
|
|
23348
23915
|
)) {
|
|
23349
23916
|
let selected;
|
|
23350
|
-
for (const
|
|
23351
|
-
if (!isPathInsideRoot(file,
|
|
23917
|
+
for (const root2 of roots) {
|
|
23918
|
+
if (!isPathInsideRoot(file, root2, platform, identities)) {
|
|
23352
23919
|
continue;
|
|
23353
23920
|
}
|
|
23354
|
-
if (!selected || rootKey(
|
|
23355
|
-
selected =
|
|
23921
|
+
if (!selected || rootKey(root2, platform, identities).length > rootKey(selected, platform, identities).length) {
|
|
23922
|
+
selected = root2;
|
|
23356
23923
|
}
|
|
23357
23924
|
}
|
|
23358
23925
|
return selected;
|
|
23359
23926
|
}
|
|
23360
|
-
function isPathInsideRoot(file,
|
|
23927
|
+
function isPathInsideRoot(file, root2, platform = process.platform, identities = createServerRootPathIdentityContext(
|
|
23361
23928
|
platform
|
|
23362
23929
|
)) {
|
|
23363
|
-
return identities.isWithin(
|
|
23930
|
+
return identities.isWithin(root2, file);
|
|
23364
23931
|
}
|
|
23365
23932
|
function rootsOverlap(left, right, platform = process.platform, identities = createServerRootPathIdentityContext(
|
|
23366
23933
|
platform
|
|
@@ -23371,39 +23938,44 @@ function rootsToStopForTarget(roots, target, platform = process.platform, identi
|
|
|
23371
23938
|
platform
|
|
23372
23939
|
)) {
|
|
23373
23940
|
return roots.filter(
|
|
23374
|
-
(
|
|
23941
|
+
(root2) => rootsOverlap(root2, target, platform, identities)
|
|
23375
23942
|
);
|
|
23376
23943
|
}
|
|
23377
23944
|
function rootsToStopForPlan(roots, plannedRoots, platform = process.platform, identities = createServerRootPathIdentityContext(
|
|
23378
23945
|
platform
|
|
23379
23946
|
)) {
|
|
23380
23947
|
const plannedKeys = new Set(
|
|
23381
|
-
plannedRoots.map((
|
|
23948
|
+
plannedRoots.map((root2) => rootKey(root2, platform, identities))
|
|
23382
23949
|
);
|
|
23383
23950
|
return roots.filter(
|
|
23384
|
-
(
|
|
23951
|
+
(root2) => !plannedKeys.has(rootKey(root2, platform, identities))
|
|
23385
23952
|
);
|
|
23386
23953
|
}
|
|
23387
23954
|
function rootsInsideRemovedWorkspace(roots, removedRoot, platform = process.platform, identities = createServerRootPathIdentityContext(
|
|
23388
23955
|
platform
|
|
23389
23956
|
)) {
|
|
23390
23957
|
return roots.filter(
|
|
23391
|
-
(
|
|
23958
|
+
(root2) => isPathInsideRoot(root2, removedRoot, platform, identities)
|
|
23392
23959
|
);
|
|
23393
23960
|
}
|
|
23394
|
-
function rootKey(
|
|
23961
|
+
function rootKey(root2, platform = process.platform, identities = createServerRootPathIdentityContext(
|
|
23395
23962
|
platform
|
|
23396
23963
|
)) {
|
|
23397
|
-
return identities.resolve(
|
|
23398
|
-
}
|
|
23399
|
-
function pathDepth(value, platform) {
|
|
23400
|
-
const pathApi = platform === "win32" ? import_node_path2.default.win32 : import_node_path2.default;
|
|
23401
|
-
return pathApi.resolve(value).split(platform === "win32" ? import_node_path2.default.win32.sep : import_node_path2.default.sep).filter(Boolean).length;
|
|
23964
|
+
return identities.resolve(root2).key;
|
|
23402
23965
|
}
|
|
23403
23966
|
function projectConfigIn(dir) {
|
|
23404
23967
|
try {
|
|
23405
|
-
const
|
|
23406
|
-
|
|
23968
|
+
const matches = import_node_fs3.default.readdirSync(dir).filter((name) => PROJECT_CONFIG_PATTERN.test(name)).sort(compareProjectConfigNames);
|
|
23969
|
+
for (const name of matches) {
|
|
23970
|
+
const candidate = import_node_path6.default.join(dir, name);
|
|
23971
|
+
try {
|
|
23972
|
+
if (import_node_fs3.default.statSync(candidate).isFile()) {
|
|
23973
|
+
return candidate;
|
|
23974
|
+
}
|
|
23975
|
+
} catch {
|
|
23976
|
+
}
|
|
23977
|
+
}
|
|
23978
|
+
return void 0;
|
|
23407
23979
|
} catch {
|
|
23408
23980
|
return void 0;
|
|
23409
23981
|
}
|
|
@@ -23418,10 +23990,10 @@ function compareProjectConfigNames(left, right) {
|
|
|
23418
23990
|
return priority(left) - priority(right) || left.localeCompare(right);
|
|
23419
23991
|
}
|
|
23420
23992
|
function isJavaScriptLauncher(launcher) {
|
|
23421
|
-
return [".js", ".cjs", ".mjs"].includes(
|
|
23993
|
+
return [".js", ".cjs", ".mjs"].includes(import_node_path6.default.extname(launcher));
|
|
23422
23994
|
}
|
|
23423
23995
|
function isWindowsCommandLauncher(launcher) {
|
|
23424
|
-
return [".cmd", ".bat"].includes(
|
|
23996
|
+
return [".cmd", ".bat"].includes(import_node_path6.default.extname(launcher).toLowerCase());
|
|
23425
23997
|
}
|
|
23426
23998
|
function createWindowsCommandShim(args) {
|
|
23427
23999
|
const prefix = "TTSC_VSCODE_COMMAND_SHIM_ARG_";
|
|
@@ -23442,23 +24014,23 @@ function quoteWindowsArg(arg) {
|
|
|
23442
24014
|
function resolveTsgoBinary(base) {
|
|
23443
24015
|
try {
|
|
23444
24016
|
const requireFromBase = (0, import_node_module.createRequire)(
|
|
23445
|
-
|
|
24017
|
+
import_node_path6.default.join(base, "__ttsc_vscode_resolve__.cjs")
|
|
23446
24018
|
);
|
|
23447
24019
|
const packageJson = requireFromBase.resolve("typescript/package.json");
|
|
23448
|
-
const packageRoot =
|
|
24020
|
+
const packageRoot = import_node_path6.default.dirname(packageJson);
|
|
23449
24021
|
const requireFromTsgo = (0, import_node_module.createRequire)(
|
|
23450
|
-
|
|
24022
|
+
import_node_path6.default.join(packageRoot, "__ttsc_vscode_resolve__.cjs")
|
|
23451
24023
|
);
|
|
23452
24024
|
const platformPackage = `@typescript/typescript-${process.platform}-${process.arch}`;
|
|
23453
24025
|
const platformPackageJson = requireFromTsgo.resolve(
|
|
23454
24026
|
`${platformPackage}/package.json`
|
|
23455
24027
|
);
|
|
23456
|
-
const binary =
|
|
23457
|
-
|
|
24028
|
+
const binary = import_node_path6.default.join(
|
|
24029
|
+
import_node_path6.default.dirname(platformPackageJson),
|
|
23458
24030
|
"lib",
|
|
23459
24031
|
process.platform === "win32" ? "tsc.exe" : "tsc"
|
|
23460
24032
|
);
|
|
23461
|
-
return
|
|
24033
|
+
return import_node_fs3.default.existsSync(binary) ? binary : void 0;
|
|
23462
24034
|
} catch {
|
|
23463
24035
|
return void 0;
|
|
23464
24036
|
}
|
|
@@ -23524,10 +24096,11 @@ function createServerLaunchSpecs(candidates) {
|
|
|
23524
24096
|
}
|
|
23525
24097
|
seen.add(key);
|
|
23526
24098
|
specs.push({
|
|
24099
|
+
candidate,
|
|
23527
24100
|
cwd: candidate.cwd,
|
|
23528
24101
|
id: key,
|
|
23529
|
-
|
|
23530
|
-
|
|
24102
|
+
launcher,
|
|
24103
|
+
name: `ttsc (${path7.basename(candidate.cwd)})`,
|
|
23531
24104
|
workspaceFolder: workspaceFolderFor(candidate.cwd, specs.length)
|
|
23532
24105
|
});
|
|
23533
24106
|
}
|
|
@@ -23537,7 +24110,7 @@ function resolveConfiguredServerPath(configuredPath, cwd) {
|
|
|
23537
24110
|
if (!configuredPath) {
|
|
23538
24111
|
return void 0;
|
|
23539
24112
|
}
|
|
23540
|
-
if (
|
|
24113
|
+
if (path7.isAbsolute(configuredPath)) {
|
|
23541
24114
|
return configuredPath;
|
|
23542
24115
|
}
|
|
23543
24116
|
const key = `${rootKey(cwd)}\0${configuredPath}`;
|
|
@@ -23549,29 +24122,36 @@ function resolveConfiguredServerPath(configuredPath, cwd) {
|
|
|
23549
24122
|
}
|
|
23550
24123
|
return void 0;
|
|
23551
24124
|
}
|
|
23552
|
-
function resolveServerLaunchSpecForUri(uri) {
|
|
24125
|
+
function resolveServerLaunchSpecForUri(uri, memo = /* @__PURE__ */ new Map()) {
|
|
23553
24126
|
if (uri.scheme !== "file") return void 0;
|
|
23554
24127
|
const folder = import_vscode.workspace.getWorkspaceFolder(uri);
|
|
23555
|
-
const
|
|
23556
|
-
|
|
23557
|
-
|
|
23558
|
-
|
|
23559
|
-
|
|
24128
|
+
const activeWorkspaceRoot = folder?.uri.scheme === "file" ? folder.uri.fsPath : void 0;
|
|
24129
|
+
const memoKey = `${path7.dirname(uri.fsPath)}\0${activeWorkspaceRoot ?? ""}`;
|
|
24130
|
+
return resolveWithDirectoryMemo(
|
|
24131
|
+
memoKey,
|
|
24132
|
+
memo,
|
|
24133
|
+
() => createServerLaunchSpecs(
|
|
24134
|
+
createResolutionCandidates({
|
|
24135
|
+
activeFile: uri.fsPath,
|
|
24136
|
+
activeWorkspaceRoot
|
|
24137
|
+
})
|
|
24138
|
+
)[0]
|
|
24139
|
+
);
|
|
23560
24140
|
}
|
|
23561
24141
|
function createServerOptions(launcher, candidate) {
|
|
23562
24142
|
return createServerExecutable(launcher, candidate);
|
|
23563
24143
|
}
|
|
23564
|
-
function workspaceFolderFor(
|
|
24144
|
+
function workspaceFolderFor(root2, index) {
|
|
23565
24145
|
const folder = import_vscode.workspace.workspaceFolders?.find(
|
|
23566
|
-
(candidate) => candidate.uri.scheme === "file" &&
|
|
24146
|
+
(candidate) => candidate.uri.scheme === "file" && path7.resolve(candidate.uri.fsPath) === path7.resolve(root2)
|
|
23567
24147
|
);
|
|
23568
24148
|
if (folder) {
|
|
23569
24149
|
return folder;
|
|
23570
24150
|
}
|
|
23571
24151
|
return {
|
|
23572
24152
|
index,
|
|
23573
|
-
name:
|
|
23574
|
-
uri: import_vscode.Uri.file(
|
|
24153
|
+
name: path7.basename(root2),
|
|
24154
|
+
uri: import_vscode.Uri.file(root2)
|
|
23575
24155
|
};
|
|
23576
24156
|
}
|
|
23577
24157
|
function collectResolutionCandidates() {
|
|
@@ -23585,7 +24165,7 @@ function collectResolutionCandidates() {
|
|
|
23585
24165
|
workspaceRoots
|
|
23586
24166
|
});
|
|
23587
24167
|
}
|
|
23588
|
-
function buildClientOptions(traceChannel, spec) {
|
|
24168
|
+
function buildClientOptions(traceChannel, spec, watcher) {
|
|
23589
24169
|
const pattern = createDocumentSelectorPattern(
|
|
23590
24170
|
import_vscode.RelativePattern,
|
|
23591
24171
|
spec.cwd
|
|
@@ -23599,9 +24179,7 @@ function buildClientOptions(traceChannel, spec) {
|
|
|
23599
24179
|
{ scheme: "file", language: "javascriptreact", pattern }
|
|
23600
24180
|
],
|
|
23601
24181
|
synchronize: {
|
|
23602
|
-
fileEvents:
|
|
23603
|
-
new import_vscode.RelativePattern(spec.cwd, "**/{tsconfig,jsconfig}*.json")
|
|
23604
|
-
),
|
|
24182
|
+
fileEvents: watcher,
|
|
23605
24183
|
configurationSection: "ttsc"
|
|
23606
24184
|
},
|
|
23607
24185
|
middleware: {
|
|
@@ -23687,7 +24265,11 @@ async function applyCommandWorkspaceEdit(command, result, args) {
|
|
|
23687
24265
|
if (!changes) {
|
|
23688
24266
|
return;
|
|
23689
24267
|
}
|
|
23690
|
-
if (commandArgumentsContainDirtyDocument(args) || workspaceEditChangesTouchDirtyURI(
|
|
24268
|
+
if (commandArgumentsContainDirtyDocument(args) || workspaceEditChangesTouchDirtyURI(
|
|
24269
|
+
changes,
|
|
24270
|
+
dirtyDocumentURIs(),
|
|
24271
|
+
canonicalDocumentURI
|
|
24272
|
+
)) {
|
|
23691
24273
|
showDiskBackedCommandWarning();
|
|
23692
24274
|
return;
|
|
23693
24275
|
}
|
|
@@ -23716,7 +24298,21 @@ function workspaceEditFromChanges(changes) {
|
|
|
23716
24298
|
return edit;
|
|
23717
24299
|
}
|
|
23718
24300
|
function commandArgumentsContainDirtyDocument(args) {
|
|
23719
|
-
return commandArgumentsContainDirtyURI(
|
|
24301
|
+
return commandArgumentsContainDirtyURI(
|
|
24302
|
+
args,
|
|
24303
|
+
dirtyDocumentURIs(),
|
|
24304
|
+
canonicalDocumentURI
|
|
24305
|
+
);
|
|
24306
|
+
}
|
|
24307
|
+
function canonicalDocumentURI(value) {
|
|
24308
|
+
if (!/^file:/i.test(value)) {
|
|
24309
|
+
return value;
|
|
24310
|
+
}
|
|
24311
|
+
try {
|
|
24312
|
+
return import_vscode.Uri.parse(value, true).toString();
|
|
24313
|
+
} catch {
|
|
24314
|
+
return value;
|
|
24315
|
+
}
|
|
23720
24316
|
}
|
|
23721
24317
|
function dirtyDocumentURIs() {
|
|
23722
24318
|
return new Set(
|
|
@@ -23733,17 +24329,22 @@ function resolveCommandTarget(uriArg) {
|
|
|
23733
24329
|
return uriArg;
|
|
23734
24330
|
}
|
|
23735
24331
|
if (typeof uriArg === "string") {
|
|
23736
|
-
return
|
|
24332
|
+
return path7.isAbsolute(uriArg) ? import_vscode.Uri.file(uriArg) : import_vscode.Uri.parse(uriArg);
|
|
23737
24333
|
}
|
|
23738
24334
|
return import_vscode.window.activeTextEditor?.document.uri;
|
|
23739
24335
|
}
|
|
23740
24336
|
function clientEntryForUri(uri) {
|
|
23741
24337
|
if (uri.scheme !== "file") return void 0;
|
|
23742
|
-
const
|
|
23743
|
-
|
|
23744
|
-
|
|
24338
|
+
const root2 = selectDeepestRootForPath(uri.fsPath, clientRoots());
|
|
24339
|
+
return root2 ? findClientEntry(root2) : void 0;
|
|
24340
|
+
}
|
|
24341
|
+
function findClientEntry(root2) {
|
|
24342
|
+
return findClientEntryByRoot(
|
|
24343
|
+
clients.values(),
|
|
24344
|
+
clients,
|
|
24345
|
+
root2,
|
|
24346
|
+
(value) => rootKey(value)
|
|
23745
24347
|
);
|
|
23746
|
-
return root ? clients.get(rootKey(root)) : void 0;
|
|
23747
24348
|
}
|
|
23748
24349
|
async function ensureClientForUri(uri, traceChannel) {
|
|
23749
24350
|
await enqueueClientReconciliation(async () => {
|
|
@@ -23763,22 +24364,22 @@ async function reconcileClientsForDocuments(documents, traceChannel, fallbackSpe
|
|
|
23763
24364
|
specs.set(spec.id, spec);
|
|
23764
24365
|
}
|
|
23765
24366
|
};
|
|
23766
|
-
|
|
23767
|
-
|
|
23768
|
-
|
|
24367
|
+
const memo = /* @__PURE__ */ new Map();
|
|
24368
|
+
const activeSpec = activeUri ? resolveServerLaunchSpecForUri(activeUri, memo) : void 0;
|
|
24369
|
+
pushSpec(activeSpec);
|
|
23769
24370
|
for (const document of orderedDocuments) {
|
|
23770
|
-
pushSpec(resolveServerLaunchSpecForUri(document.uri));
|
|
24371
|
+
pushSpec(resolveServerLaunchSpecForUri(document.uri, memo));
|
|
23771
24372
|
}
|
|
23772
24373
|
for (const spec of fallbackSpecs) {
|
|
23773
24374
|
pushSpec(spec);
|
|
23774
24375
|
}
|
|
23775
24376
|
const plannedRoots = planNonOverlappingClientRoots(
|
|
23776
24377
|
[...specs.values()].map((spec) => spec.cwd),
|
|
23777
|
-
|
|
24378
|
+
activeSpec?.cwd
|
|
23778
24379
|
);
|
|
23779
24380
|
await stopClientRoots(rootsToStopForPlan(clientRoots(), plannedRoots));
|
|
23780
|
-
for (const
|
|
23781
|
-
const spec = specs.get(rootKey(
|
|
24381
|
+
for (const root2 of plannedRoots) {
|
|
24382
|
+
const spec = specs.get(rootKey(root2));
|
|
23782
24383
|
if (spec && !clients.has(spec.id)) {
|
|
23783
24384
|
await startClient(spec, traceChannel);
|
|
23784
24385
|
}
|
|
@@ -23803,7 +24404,7 @@ function documentsOutsideRoots(documents, roots) {
|
|
|
23803
24404
|
return [...documents];
|
|
23804
24405
|
}
|
|
23805
24406
|
return documents.filter(
|
|
23806
|
-
(document) => document.uri.scheme !== "file" || !roots.some((
|
|
24407
|
+
(document) => document.uri.scheme !== "file" || !roots.some((root2) => isPathInsideRoot(document.uri.fsPath, root2))
|
|
23807
24408
|
);
|
|
23808
24409
|
}
|
|
23809
24410
|
function clientRoots() {
|
|
@@ -23811,7 +24412,7 @@ function clientRoots() {
|
|
|
23811
24412
|
}
|
|
23812
24413
|
async function stopClientRoots(roots) {
|
|
23813
24414
|
const results = await Promise.allSettled(
|
|
23814
|
-
roots.map((
|
|
24415
|
+
roots.map((root2) => stopClientRoot(root2))
|
|
23815
24416
|
);
|
|
23816
24417
|
for (const result of results) {
|
|
23817
24418
|
if (result.status === "rejected") {
|
|
@@ -23821,14 +24422,17 @@ async function stopClientRoots(roots) {
|
|
|
23821
24422
|
}
|
|
23822
24423
|
}
|
|
23823
24424
|
}
|
|
23824
|
-
async function stopClientRoot(
|
|
23825
|
-
const
|
|
23826
|
-
const entry = clients.get(key);
|
|
24425
|
+
async function stopClientRoot(root2) {
|
|
24426
|
+
const entry = findClientEntry(root2);
|
|
23827
24427
|
if (!entry) {
|
|
23828
24428
|
return;
|
|
23829
24429
|
}
|
|
23830
|
-
clients.delete(
|
|
23831
|
-
|
|
24430
|
+
clients.delete(entry.id);
|
|
24431
|
+
try {
|
|
24432
|
+
await entry.client.stop();
|
|
24433
|
+
} finally {
|
|
24434
|
+
entry.watcher.dispose();
|
|
24435
|
+
}
|
|
23832
24436
|
}
|
|
23833
24437
|
function isSupportedDocument(document) {
|
|
23834
24438
|
return document.uri.scheme === "file" && ["typescript", "typescriptreact", "javascript", "javascriptreact"].includes(
|
|
@@ -23836,32 +24440,48 @@ function isSupportedDocument(document) {
|
|
|
23836
24440
|
);
|
|
23837
24441
|
}
|
|
23838
24442
|
async function startClient(spec, traceChannel) {
|
|
23839
|
-
const
|
|
23840
|
-
"
|
|
23841
|
-
spec.name,
|
|
23842
|
-
spec.serverOptions,
|
|
23843
|
-
buildClientOptions(traceChannel, spec)
|
|
24443
|
+
const watcher = import_vscode.workspace.createFileSystemWatcher(
|
|
24444
|
+
new import_vscode.RelativePattern(spec.cwd, "**/{tsconfig,jsconfig}*.json")
|
|
23844
24445
|
);
|
|
23845
|
-
client.onNotification(METHOD_PLUGIN_SELECTION_CHANGED, () => {
|
|
23846
|
-
client.expectPluginSelectionRestart();
|
|
23847
|
-
});
|
|
23848
|
-
const ready = client.start().catch((error) => {
|
|
23849
|
-
if (clients.get(spec.id)?.client === client) {
|
|
23850
|
-
clients.delete(spec.id);
|
|
23851
|
-
}
|
|
23852
|
-
import_vscode.window.showErrorMessage(
|
|
23853
|
-
`ttsc: failed to start language server for ${spec.cwd} \u2014 ${error}`
|
|
23854
|
-
);
|
|
23855
|
-
throw error;
|
|
23856
|
-
});
|
|
23857
|
-
clients.set(spec.id, { client, ready, root: spec.cwd });
|
|
23858
24446
|
try {
|
|
23859
|
-
|
|
24447
|
+
const client = new TtscLanguageClient(
|
|
24448
|
+
"ttsc",
|
|
24449
|
+
spec.name,
|
|
24450
|
+
createServerOptions(spec.launcher, spec.candidate),
|
|
24451
|
+
buildClientOptions(traceChannel, spec, watcher)
|
|
24452
|
+
);
|
|
24453
|
+
client.onNotification(METHOD_PLUGIN_SELECTION_CHANGED, () => {
|
|
24454
|
+
client.expectPluginSelectionRestart();
|
|
24455
|
+
});
|
|
24456
|
+
const ready = client.start().catch((error) => {
|
|
24457
|
+
if (clients.get(spec.id)?.client === client) {
|
|
24458
|
+
clients.delete(spec.id);
|
|
24459
|
+
}
|
|
24460
|
+
watcher.dispose();
|
|
24461
|
+
import_vscode.window.showErrorMessage(
|
|
24462
|
+
`ttsc: failed to start language server for ${spec.cwd} \u2014 ${error}`
|
|
24463
|
+
);
|
|
24464
|
+
throw error;
|
|
24465
|
+
});
|
|
24466
|
+
clients.set(spec.id, {
|
|
24467
|
+
client,
|
|
24468
|
+
id: spec.id,
|
|
24469
|
+
ready,
|
|
24470
|
+
root: spec.cwd,
|
|
24471
|
+
watcher
|
|
24472
|
+
});
|
|
24473
|
+
try {
|
|
24474
|
+
await ready;
|
|
24475
|
+
} catch (error) {
|
|
24476
|
+
}
|
|
23860
24477
|
} catch (error) {
|
|
24478
|
+
watcher.dispose();
|
|
24479
|
+
throw error;
|
|
23861
24480
|
}
|
|
23862
24481
|
}
|
|
23863
24482
|
async function activate(context) {
|
|
23864
24483
|
deactivating = false;
|
|
24484
|
+
warnedRelativeServerPaths.clear();
|
|
23865
24485
|
const specs = resolveServerLaunchSpecs();
|
|
23866
24486
|
if (specs.length === 0) {
|
|
23867
24487
|
import_vscode.window.showErrorMessage(
|
|
@@ -23930,18 +24550,21 @@ async function activate(context) {
|
|
|
23930
24550
|
)
|
|
23931
24551
|
);
|
|
23932
24552
|
}),
|
|
23933
|
-
import_vscode.workspace.onDidChangeWorkspaceFolders((
|
|
24553
|
+
import_vscode.workspace.onDidChangeWorkspaceFolders((event2) => {
|
|
23934
24554
|
void enqueueClientReconciliation(async () => {
|
|
23935
|
-
const removedFolders =
|
|
24555
|
+
const removedFolders = event2.removed.filter((folder) => folder.uri.scheme === "file").map((folder) => folder.uri.fsPath);
|
|
23936
24556
|
const removedRoots = [];
|
|
23937
|
-
for (const folder of
|
|
24557
|
+
for (const folder of event2.removed) {
|
|
23938
24558
|
if (folder.uri.scheme !== "file") continue;
|
|
23939
|
-
|
|
23940
|
-
|
|
23941
|
-
|
|
24559
|
+
for (const root2 of rootsInsideRemovedWorkspace(
|
|
24560
|
+
clientRoots(),
|
|
24561
|
+
folder.uri.fsPath
|
|
24562
|
+
)) {
|
|
24563
|
+
removedRoots.push(root2);
|
|
24564
|
+
}
|
|
23942
24565
|
}
|
|
23943
24566
|
await stopClientRoots(removedRoots);
|
|
23944
|
-
const addedRoots =
|
|
24567
|
+
const addedRoots = event2.added.filter((folder) => folder.uri.scheme === "file").map((folder) => folder.uri.fsPath);
|
|
23945
24568
|
const addedSpecs = createServerLaunchSpecs(
|
|
23946
24569
|
createResolutionCandidates({ workspaceRoots: addedRoots })
|
|
23947
24570
|
);
|
|
@@ -23952,10 +24575,11 @@ async function activate(context) {
|
|
|
23952
24575
|
);
|
|
23953
24576
|
});
|
|
23954
24577
|
}),
|
|
23955
|
-
import_vscode.workspace.onDidChangeConfiguration((
|
|
23956
|
-
if (!
|
|
24578
|
+
import_vscode.workspace.onDidChangeConfiguration((event2) => {
|
|
24579
|
+
if (!event2.affectsConfiguration("ttsc.serverPath")) {
|
|
23957
24580
|
return;
|
|
23958
24581
|
}
|
|
24582
|
+
warnedRelativeServerPaths.clear();
|
|
23959
24583
|
void enqueueClientReconciliation(async () => {
|
|
23960
24584
|
const active = import_vscode.window.activeTextEditor?.document;
|
|
23961
24585
|
const activeUri = active && isSupportedDocument(active) ? active.uri : void 0;
|
|
@@ -23976,9 +24600,13 @@ async function activate(context) {
|
|
|
23976
24600
|
async function deactivate() {
|
|
23977
24601
|
deactivating = true;
|
|
23978
24602
|
const teardown = reconcileQueue.then(async () => {
|
|
23979
|
-
const stopping = [...clients.values()].map(
|
|
23980
|
-
|
|
23981
|
-
|
|
24603
|
+
const stopping = [...clients.values()].map(async (entry) => {
|
|
24604
|
+
try {
|
|
24605
|
+
await entry.client.stop();
|
|
24606
|
+
} finally {
|
|
24607
|
+
entry.watcher.dispose();
|
|
24608
|
+
}
|
|
24609
|
+
});
|
|
23982
24610
|
clients.clear();
|
|
23983
24611
|
const results = await Promise.allSettled(stopping);
|
|
23984
24612
|
for (const result of results) {
|
|
@@ -23990,6 +24618,7 @@ async function deactivate() {
|
|
|
23990
24618
|
}
|
|
23991
24619
|
}).finally(() => {
|
|
23992
24620
|
sharedTraceChannel = void 0;
|
|
24621
|
+
warnedRelativeServerPaths.clear();
|
|
23993
24622
|
});
|
|
23994
24623
|
reconcileQueue = teardown.catch(() => {
|
|
23995
24624
|
});
|