pi-lens 4.4.6 → 4.4.7
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/CHANGELOG.md +83 -0
- package/README.md +5 -1
- package/dist/{chunk-JL6CXUMW.js → chunk-24BILSZW.js} +1 -1
- package/dist/{chunk-S67UJDGQ.js → chunk-2TF6RXWB.js} +5 -5
- package/dist/{chunk-ARD426WI.js → chunk-3F6BMY53.js} +1 -1
- package/dist/{chunk-5ZR3APIM.js → chunk-3FRLWYBG.js} +26 -26
- package/dist/{chunk-T7FTXGS3.js → chunk-3K2F6UDZ.js} +30 -30
- package/dist/{chunk-HK6JVFZC.js → chunk-3YY7IXIL.js} +2 -2
- package/dist/chunk-46TNM7XZ.js +88 -0
- package/dist/{chunk-4AVZ3TG7.js → chunk-4L36HG27.js} +8 -8
- package/dist/{chunk-PO45POGF.js → chunk-4LM3VAZH.js} +1 -1
- package/dist/{chunk-UN4TEBWN.js → chunk-4LOE5R5P.js} +9 -9
- package/dist/{chunk-KLQVC3XC.js → chunk-4YHYPW2G.js} +30 -7
- package/dist/{chunk-W5LGKNET.js → chunk-4ZYJHQMB.js} +6 -6
- package/dist/{chunk-W2V54OCL.js → chunk-6IR3ZYIB.js} +2 -2
- package/dist/{chunk-FJIVKLPH.js → chunk-72OKUXSD.js} +10 -10
- package/dist/{chunk-7RQXA5GG.js → chunk-75GAYVNO.js} +10 -9
- package/dist/{chunk-V3APN3DY.js → chunk-7E2563GA.js} +12 -12
- package/dist/{chunk-4WX4CTUE.js → chunk-7GLOLOSH.js} +25 -25
- package/dist/{chunk-BWYQUPOS.js → chunk-ABPKUVA4.js} +1 -1
- package/dist/{chunk-IPDG45G5.js → chunk-AKUUMGD5.js} +9 -9
- package/dist/{chunk-Q6D6VMI4.js → chunk-ASUXV767.js} +6 -6
- package/dist/{chunk-BM5GS6ZH.js → chunk-AWDSEDER.js} +2 -2
- package/dist/{chunk-MA77RSFN.js → chunk-BZARLRJW.js} +4 -4
- package/dist/{chunk-EVDGNG4F.js → chunk-CB4WHS4H.js} +3 -3
- package/dist/{chunk-FA5LDARD.js → chunk-CCV2EU7T.js} +7 -7
- package/dist/{chunk-U6OC3QEM.js → chunk-CE6VMBCB.js} +15 -15
- package/dist/{chunk-AMXIUN2R.js → chunk-CPSR3AVL.js} +2 -2
- package/dist/{chunk-SXGD4ANG.js → chunk-CTADOKYM.js} +7 -7
- package/dist/{chunk-63RIVFQI.js → chunk-DH5JPM3K.js} +1 -1
- package/dist/{chunk-MT6BVNFW.js → chunk-DPGEAHZT.js} +3 -3
- package/dist/{chunk-4PCQCU47.js → chunk-DQZFQSR5.js} +2 -2
- package/dist/{chunk-BHUWL2Y3.js → chunk-E7HJ56Y7.js} +5 -5
- package/dist/{chunk-DQXSPYRI.js → chunk-EAOK7MIZ.js} +2 -2
- package/dist/{chunk-2RLWJO5K.js → chunk-EKWX4WD3.js} +3 -3
- package/dist/{chunk-WIZWZR4C.js → chunk-F7K5IBZG.js} +30 -28
- package/dist/{chunk-VQH24FIP.js → chunk-FB5SCCPT.js} +9 -9
- package/dist/{chunk-GZE7WOI4.js → chunk-FZKFVUEC.js} +438 -140
- package/dist/{chunk-TIYGSODX.js → chunk-H7OR7DFZ.js} +15 -13
- package/dist/{chunk-CJYKEW2L.js → chunk-HO6LWE2E.js} +1 -1
- package/dist/{chunk-YSBHPOY6.js → chunk-HR3OJ3TH.js} +8 -8
- package/dist/{chunk-CFRQMBGP.js → chunk-HWDAVBFU.js} +14 -14
- package/dist/{chunk-2X4VLOCC.js → chunk-JJ2RRESP.js} +8 -5
- package/dist/{chunk-YBSONGSZ.js → chunk-JMEKXFOL.js} +24 -24
- package/dist/{chunk-MKVZQUEG.js → chunk-KDX35VXP.js} +69 -13
- package/dist/{chunk-75SY4F24.js → chunk-KKCK636N.js} +7 -7
- package/dist/{chunk-OLAWH5UQ.js → chunk-KPPJTH44.js} +2 -1
- package/dist/{chunk-5APMQ2IJ.js → chunk-KW5JQPO5.js} +1 -1
- package/dist/{chunk-SCIUNBPF.js → chunk-L3CMBQMH.js} +11 -11
- package/dist/{chunk-GAACZY6R.js → chunk-L5JYIU47.js} +7 -7
- package/dist/{chunk-2DDDCJDL.js → chunk-LBLBAFG3.js} +3 -3
- package/dist/{chunk-NNKXDXXS.js → chunk-LLS45EWB.js} +8 -0
- package/dist/{chunk-WQOIR3QY.js → chunk-LS3QJRUB.js} +7 -7
- package/dist/{chunk-XCUHKYCQ.js → chunk-LSC3VADM.js} +6 -6
- package/dist/{chunk-GMTFDAOK.js → chunk-LUBPZN36.js} +6 -6
- package/dist/{chunk-DMSLNKF7.js → chunk-LV4UMYVH.js} +19 -19
- package/dist/{chunk-XAIT2YGS.js → chunk-MB6PXBUA.js} +2 -2
- package/dist/{chunk-AE37FEGH.js → chunk-MNJIXFX4.js} +1 -1
- package/dist/{chunk-OJLTLYHB.js → chunk-MPKRJBPK.js} +30 -10
- package/dist/{chunk-QGSTQH4D.js → chunk-N5WSK2K7.js} +6 -6
- package/dist/{chunk-Z7IGUAXL.js → chunk-NA7SEXHE.js} +10 -6
- package/dist/{chunk-UHGF5UT5.js → chunk-O4BJFESU.js} +1 -1
- package/dist/{chunk-UCGQT677.js → chunk-OE5ZBP7F.js} +10 -10
- package/dist/{chunk-KSR7RGQY.js → chunk-OXOI55RU.js} +4 -4
- package/dist/{chunk-NDMCVUYK.js → chunk-PR6PO3ES.js} +2 -2
- package/dist/{chunk-NIU2IPC5.js → chunk-PUZ3E2J4.js} +3 -3
- package/dist/{chunk-2DMLM3ZO.js → chunk-QHSNL7B2.js} +8 -8
- package/dist/{chunk-ZYNI26MI.js → chunk-QOE342SU.js} +1 -1
- package/dist/{chunk-3WEPUD2V.js → chunk-R5MOQM2H.js} +98 -31
- package/dist/{chunk-PPIBVH4R.js → chunk-RC2Z6K47.js} +4 -4
- package/dist/{chunk-LEJOJDXL.js → chunk-RORGS5II.js} +4 -4
- package/dist/{chunk-K2YGBXOA.js → chunk-RQS4QQSD.js} +1 -1
- package/dist/{chunk-XQCSWV2G.js → chunk-RRV3FNNM.js} +10 -10
- package/dist/{chunk-GTAI2J6U.js → chunk-SHLDT3OI.js} +8 -8
- package/dist/{chunk-VPBIMOAQ.js → chunk-SNDXCFRS.js} +11 -9
- package/dist/{chunk-Q4FCYCRE.js → chunk-T7A2HK2B.js} +10 -10
- package/dist/{chunk-MN7MHUXQ.js → chunk-U5HPROLA.js} +1 -1
- package/dist/{chunk-ZUUI3ZSA.js → chunk-U6VN4NVL.js} +1 -1
- package/dist/{chunk-W5R5SABV.js → chunk-U7BD2QL7.js} +6 -6
- package/dist/{chunk-P4QNXS6I.js → chunk-UF7RTZSO.js} +8 -8
- package/dist/{chunk-A3YNG5KP.js → chunk-URCQWAQ4.js} +11 -11
- package/dist/{chunk-FFL3A2VP.js → chunk-VUZWQ7UG.js} +4 -4
- package/dist/{chunk-YRD4ISED.js → chunk-W4WP2ERB.js} +10 -10
- package/dist/{chunk-OOU2WZZE.js → chunk-WDBICWH3.js} +1 -1
- package/dist/{chunk-BI5LAQ3Y.js → chunk-WGRJOXED.js} +114 -148
- package/dist/{chunk-ZQ6NZZTB.js → chunk-WME2OQST.js} +33 -0
- package/dist/{chunk-DC4CFXM5.js → chunk-XT2HTCJ5.js} +1 -1
- package/dist/{chunk-SJJYRZB4.js → chunk-Y7F7IEE3.js} +55 -23
- package/dist/{chunk-2F47TQOA.js → chunk-YES5CACN.js} +29 -29
- package/dist/{chunk-H7HTEQUZ.js → chunk-YHC2O2WO.js} +7 -7
- package/dist/{chunk-Q3UZHW6N.js → chunk-YVHBNSME.js} +6 -10
- package/dist/{chunk-3MYEA7QD.js → chunk-ZE3KXHS7.js} +2 -2
- package/dist/{chunk-VG5JS5SW.js → chunk-ZGSJDWQU.js} +2 -2
- package/dist/{chunk-5CV5ITZF.js → chunk-ZJTT47IG.js} +1 -1
- package/dist/{chunk-Q4EMRFNA.js → chunk-ZMAUPOMG.js} +24 -24
- package/dist/index.js +1925 -944
- package/dist/mcp/analyze-cli.js +6 -6
- package/dist/mcp/cli.js +30 -30
- package/dist/mcp/server.js +707 -455
- package/dist/mcp/worker.js +48 -48
- package/dist/probes/installer.js +13 -13
- package/docs/agent-tools.md +11 -3
- package/docs/defect-shapes.md +15 -1
- package/docs/dependencies.md +1 -0
- package/docs/environment-variables.md +14 -0
- package/docs/features.md +11 -1
- package/docs/globalconfig.md +12 -1
- package/docs/invariants/git-guard-host.md +34 -0
- package/docs/invariants/lsp-trust-exec.md +6 -0
- package/docs/invariants/session-telemetry.md +42 -2
- package/docs/lsp-capability-matrix.md +89 -45
- package/docs/lsp-idle-eviction.md +3 -5
- package/docs/pi-lens-fixer.md +8 -1
- package/docs/pi-lens-merge-policy.md +7 -4
- package/docs/pi-lens-subagent.md +7 -4
- package/docs/schema/pi-lens-config-v1.json +23 -0
- package/docs/servercapabilities.md +1 -1
- package/docs/settings.md +5 -0
- package/docs/usage.md +5 -0
- package/package.json +1 -1
- package/dist/chunk-G2B7F6ZU.js +0 -88
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
normalizeMessage,
|
|
8
8
|
sanitizeCorrelationId,
|
|
9
9
|
stableFindingId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-XT2HTCJ5.js";
|
|
11
11
|
import {
|
|
12
12
|
mapWithConcurrency
|
|
13
13
|
} from "./chunk-XIMYZ3JA.js";
|
|
@@ -38,17 +38,17 @@ import {
|
|
|
38
38
|
resolveLspServerCwd,
|
|
39
39
|
serverTraits,
|
|
40
40
|
withLspProjectCodePermission
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-R5MOQM2H.js";
|
|
42
42
|
import {
|
|
43
43
|
findLocalOpengrepConfig
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-24BILSZW.js";
|
|
45
45
|
import {
|
|
46
46
|
emitBounded
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-PR6PO3ES.js";
|
|
48
48
|
import {
|
|
49
49
|
loadProjectSnapshot,
|
|
50
50
|
readJsonCache
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-RC2Z6K47.js";
|
|
52
52
|
import {
|
|
53
53
|
acquireWorkspaceSweepHold,
|
|
54
54
|
configureLspServiceLifecycle,
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
lineTextAt,
|
|
70
70
|
pathBirthtimeMs,
|
|
71
71
|
scanDocumentContent
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-MPKRJBPK.js";
|
|
73
73
|
import {
|
|
74
74
|
js_yaml_default
|
|
75
75
|
} from "./chunk-TIQJPRDD.js";
|
|
@@ -85,28 +85,29 @@ import {
|
|
|
85
85
|
bounded,
|
|
86
86
|
withDeadline,
|
|
87
87
|
withTimeout
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-HO6LWE2E.js";
|
|
89
89
|
import {
|
|
90
90
|
diagnosticsIpcPathForCwd,
|
|
91
91
|
requestWarmCodeActions,
|
|
92
92
|
requestWarmDiagnostics
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-AWDSEDER.js";
|
|
94
94
|
import {
|
|
95
95
|
CONTENT_HASH_MAX_BYTES,
|
|
96
96
|
hashContentBytes,
|
|
97
|
-
hashFileBytes
|
|
98
|
-
|
|
97
|
+
hashFileBytes,
|
|
98
|
+
stampContentBytes
|
|
99
|
+
} from "./chunk-LLS45EWB.js";
|
|
99
100
|
import {
|
|
100
101
|
findLocalZizmorConfig,
|
|
101
102
|
logSessionStart
|
|
102
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-KDX35VXP.js";
|
|
103
104
|
import {
|
|
104
105
|
findLocalBinUpwards,
|
|
105
106
|
isProjectLocalBinPath
|
|
106
|
-
} from "./chunk-
|
|
107
|
+
} from "./chunk-NA7SEXHE.js";
|
|
107
108
|
import {
|
|
108
109
|
getLspCapableKinds
|
|
109
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-PUZ3E2J4.js";
|
|
110
111
|
import {
|
|
111
112
|
createGenerationMap,
|
|
112
113
|
createGenerationSource,
|
|
@@ -124,7 +125,7 @@ import {
|
|
|
124
125
|
removeLspChild,
|
|
125
126
|
sampleProcessTreeCpuPercent,
|
|
126
127
|
selectLivePeerInstances
|
|
127
|
-
} from "./chunk-
|
|
128
|
+
} from "./chunk-YVHBNSME.js";
|
|
128
129
|
import {
|
|
129
130
|
createSingleFlight
|
|
130
131
|
} from "./chunk-AWQWXSW4.js";
|
|
@@ -135,20 +136,20 @@ import {
|
|
|
135
136
|
import {
|
|
136
137
|
PathKeyedMap,
|
|
137
138
|
detectFileRole
|
|
138
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-KPPJTH44.js";
|
|
139
140
|
import {
|
|
140
141
|
assertInstallAllowed,
|
|
141
142
|
isLspSpawnAllowedByTrust,
|
|
142
143
|
projectTrustDenialReason,
|
|
143
144
|
writeFileAtomic
|
|
144
|
-
} from "./chunk-
|
|
145
|
+
} from "./chunk-U5HPROLA.js";
|
|
145
146
|
import {
|
|
146
147
|
compareOrdinal,
|
|
147
148
|
incrementDegradationCount,
|
|
148
149
|
recordDegradation,
|
|
149
150
|
recordDegradationOnce,
|
|
150
151
|
truncateForLedger
|
|
151
|
-
} from "./chunk-
|
|
152
|
+
} from "./chunk-WME2OQST.js";
|
|
152
153
|
import {
|
|
153
154
|
logExtension
|
|
154
155
|
} from "./chunk-KXF5R4UN.js";
|
|
@@ -181,6 +182,7 @@ import {
|
|
|
181
182
|
normalizeFilePath,
|
|
182
183
|
normalizeMapKey,
|
|
183
184
|
pathsEqual,
|
|
185
|
+
realpathOrResolve,
|
|
184
186
|
realpathOrResolveAsync,
|
|
185
187
|
toPosix,
|
|
186
188
|
toProjectRelativePath,
|
|
@@ -3607,7 +3609,7 @@ var require_main = __commonJS({
|
|
|
3607
3609
|
var ril_1 = __importDefault(require_ril());
|
|
3608
3610
|
ril_1.default.install();
|
|
3609
3611
|
var path18 = __importStar(__require("path"));
|
|
3610
|
-
var
|
|
3612
|
+
var os3 = __importStar(__require("os"));
|
|
3611
3613
|
var fs14 = __importStar(__require("fs"));
|
|
3612
3614
|
var crypto_1 = __require("crypto");
|
|
3613
3615
|
var net_1 = __require("net");
|
|
@@ -3749,7 +3751,7 @@ var require_main = __commonJS({
|
|
|
3749
3751
|
}
|
|
3750
3752
|
let randomLength = 32;
|
|
3751
3753
|
const fixedLength = "/lsp-.sock".length;
|
|
3752
|
-
const tmpDir = fs14.realpathSync(XDG_RUNTIME_DIR ??
|
|
3754
|
+
const tmpDir = fs14.realpathSync(XDG_RUNTIME_DIR ?? os3.tmpdir());
|
|
3753
3755
|
const limit = safeIpcPathLengths.get(process.platform);
|
|
3754
3756
|
if (limit !== void 0) {
|
|
3755
3757
|
randomLength = Math.min(limit - tmpDir.length - fixedLength, randomLength);
|
|
@@ -3857,9 +3859,84 @@ var CASCADE_DIAGNOSTICS_TTL_MS = 24e4;
|
|
|
3857
3859
|
// dist/clients/lsp/index.js
|
|
3858
3860
|
import * as nodeFs2 from "node:fs";
|
|
3859
3861
|
import fs13 from "node:fs/promises";
|
|
3862
|
+
import os2 from "node:os";
|
|
3860
3863
|
import path17 from "node:path";
|
|
3861
3864
|
import { pathToFileURL as pathToFileURL3, URL as URL3 } from "node:url";
|
|
3862
3865
|
|
|
3866
|
+
// dist/clients/lsp/watch-queue.js
|
|
3867
|
+
var WATCH_DEBOUNCE_MS = 100;
|
|
3868
|
+
var FILE_CREATED = 1;
|
|
3869
|
+
var FILE_CHANGED = 2;
|
|
3870
|
+
var FILE_DELETED = 3;
|
|
3871
|
+
var WATCH_BIRTH_MARGIN_MS = 100;
|
|
3872
|
+
function watchedTypeForOpen(birthtimeMs, clientStartedAtMs = Number.POSITIVE_INFINITY) {
|
|
3873
|
+
return birthtimeMs >= clientStartedAtMs - WATCH_BIRTH_MARGIN_MS ? FILE_CREATED : FILE_CHANGED;
|
|
3874
|
+
}
|
|
3875
|
+
var WatchedFilesQueue = class {
|
|
3876
|
+
flushFn;
|
|
3877
|
+
debounceMs;
|
|
3878
|
+
onCreated;
|
|
3879
|
+
// uri → latest FileChangeType. A Map collapses repeated events for the same
|
|
3880
|
+
// URI (last-type-wins, except Created is never downgraded to Changed inside
|
|
3881
|
+
// one window — #4320) while preserving first-seen insertion order.
|
|
3882
|
+
pending = /* @__PURE__ */ new Map();
|
|
3883
|
+
timer = null;
|
|
3884
|
+
constructor(flushFn, debounceMs = WATCH_DEBOUNCE_MS, onCreated) {
|
|
3885
|
+
this.flushFn = flushFn;
|
|
3886
|
+
this.debounceMs = debounceMs;
|
|
3887
|
+
this.onCreated = onCreated;
|
|
3888
|
+
}
|
|
3889
|
+
/** Queue a change; arms the debounce timer if not already pending. */
|
|
3890
|
+
enqueue(uri, type) {
|
|
3891
|
+
const held = this.pending.get(uri);
|
|
3892
|
+
this.pending.set(uri, held === FILE_CREATED && type === FILE_CHANGED ? FILE_CREATED : type);
|
|
3893
|
+
if (this.timer)
|
|
3894
|
+
return;
|
|
3895
|
+
this.timer = setTimeout(() => this.flush(), this.debounceMs);
|
|
3896
|
+
this.timer.unref?.();
|
|
3897
|
+
}
|
|
3898
|
+
/** Emit all queued changes as one notification (no-op when empty). */
|
|
3899
|
+
flush() {
|
|
3900
|
+
if (this.timer) {
|
|
3901
|
+
clearTimeout(this.timer);
|
|
3902
|
+
this.timer = null;
|
|
3903
|
+
}
|
|
3904
|
+
if (this.pending.size === 0)
|
|
3905
|
+
return;
|
|
3906
|
+
const changes = [...this.pending.entries()].map(([uri, type]) => ({ uri, type }));
|
|
3907
|
+
this.pending.clear();
|
|
3908
|
+
this.flushFn(changes);
|
|
3909
|
+
const created = changes.flatMap((change) => change.type === FILE_CREATED ? [change.uri] : []);
|
|
3910
|
+
if (created.length > 0)
|
|
3911
|
+
this.onCreated?.(created);
|
|
3912
|
+
}
|
|
3913
|
+
/**
|
|
3914
|
+
* #4320: send now when a Created is waiting, so a read that follows is
|
|
3915
|
+
* answered by a server that has heard of the new path. Leaves a queue of
|
|
3916
|
+
* edits alone to coalesce as usual.
|
|
3917
|
+
*/
|
|
3918
|
+
flushIfCreated() {
|
|
3919
|
+
for (const type of this.pending.values()) {
|
|
3920
|
+
if (type === FILE_CREATED) {
|
|
3921
|
+
this.flush();
|
|
3922
|
+
return;
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
}
|
|
3926
|
+
/** Drop the timer + any queued changes without emitting (client teardown). */
|
|
3927
|
+
cancel() {
|
|
3928
|
+
if (this.timer) {
|
|
3929
|
+
clearTimeout(this.timer);
|
|
3930
|
+
this.timer = null;
|
|
3931
|
+
}
|
|
3932
|
+
this.pending.clear();
|
|
3933
|
+
}
|
|
3934
|
+
/** Number of distinct URIs currently queued (for tests/introspection). */
|
|
3935
|
+
get size() {
|
|
3936
|
+
return this.pending.size;
|
|
3937
|
+
}
|
|
3938
|
+
};
|
|
3939
|
+
|
|
3863
3940
|
// dist/clients/lsp/workspace-diagnostics-session.js
|
|
3864
3941
|
var _sessionStartedAt = Date.now();
|
|
3865
3942
|
function resetWorkspaceDiagnosticsCacheSession(startedAt = Date.now()) {
|
|
@@ -3887,6 +3964,9 @@ function noteWorkspaceFileCreated(serverId, root, paths, at = Date.now()) {
|
|
|
3887
3964
|
}
|
|
3888
3965
|
}
|
|
3889
3966
|
}
|
|
3967
|
+
function noteWorkspaceFilesChangedOnDisk(root, paths, at = Date.now()) {
|
|
3968
|
+
noteWorkspaceFileCreated("", root, paths, at);
|
|
3969
|
+
}
|
|
3890
3970
|
function workspaceFileCreatedAtFor(fromServer, holds, counts = () => true) {
|
|
3891
3971
|
let latest = _allFilesChangedAt;
|
|
3892
3972
|
for (const creation of _fileCreations.values()) {
|
|
@@ -3954,7 +4034,7 @@ async function importTargetsToAnnounce(cwd, importers, onScope) {
|
|
|
3954
4034
|
reason: `resolved the imports of ${CREATED_IMPORT_SCAN_MAX_FILES} of ${importers.length} files in one diagnostics call`
|
|
3955
4035
|
});
|
|
3956
4036
|
}
|
|
3957
|
-
const { extractForwardImports } = await import("./chunk-
|
|
4037
|
+
const { extractForwardImports } = await import("./chunk-URCQWAQ4.js");
|
|
3958
4038
|
const targets = /* @__PURE__ */ new Set();
|
|
3959
4039
|
const reexports = /* @__PURE__ */ new Map();
|
|
3960
4040
|
let resolved2 = 0;
|
|
@@ -4398,18 +4478,50 @@ var AUXILIARY_LSP_PROFILES = [
|
|
|
4398
4478
|
// A misspelling is a documentation/quality defect — not security or
|
|
4399
4479
|
// correctness. "style" is the closest taxonomy class.
|
|
4400
4480
|
defectClass: () => "style"
|
|
4481
|
+
},
|
|
4482
|
+
{
|
|
4483
|
+
serverId: "fallow",
|
|
4484
|
+
tool: "fallow",
|
|
4485
|
+
// fallow-lsp tags its LSP diagnostics `source: "fallow"`.
|
|
4486
|
+
sourceMatch: /fallow/i,
|
|
4487
|
+
// #4929: opt-in. Off unless `--lens-fallow` / `fallow.enabled=true` is set;
|
|
4488
|
+
// it overlaps knip, jscpd and madge, which keep running either way.
|
|
4489
|
+
enabledByDefault: false,
|
|
4490
|
+
optInFlag: "lens-fallow",
|
|
4491
|
+
// Advisory in this cut: no `allowBlocking`, so even an ERROR-severity
|
|
4492
|
+
// finding stays a warning. fallow publishes unused-code findings as LSP
|
|
4493
|
+
// HINT (severity 4, the editor's greyed-out tag), which the generic
|
|
4494
|
+
// conversion would render as no semantic at all.
|
|
4495
|
+
semantic: () => "warning",
|
|
4496
|
+
defectClass: (d) => {
|
|
4497
|
+
const code = String(d.code ?? "");
|
|
4498
|
+
if (code.startsWith("unused-"))
|
|
4499
|
+
return "unused-value";
|
|
4500
|
+
if (/^(security-|tainted-sink|dangerous-html|client-server-leak)/.test(code))
|
|
4501
|
+
return "safety";
|
|
4502
|
+
return void 0;
|
|
4503
|
+
}
|
|
4401
4504
|
}
|
|
4402
4505
|
];
|
|
4506
|
+
function isOptInAuxiliaryServerId(serverId) {
|
|
4507
|
+
return AUXILIARY_LSP_PROFILES.some((p) => p.serverId === serverId && !p.enabledByDefault);
|
|
4508
|
+
}
|
|
4403
4509
|
function enabledAuxiliaryLspServerIds(getFlag) {
|
|
4404
4510
|
if (shouldDegradeAuxiliaryLsp() || isSubagentSession())
|
|
4405
4511
|
return [];
|
|
4406
4512
|
return AUXILIARY_LSP_PROFILES.flatMap((p) => isEnabledByConfiguration(p, getFlag) ? [p.serverId] : []);
|
|
4407
4513
|
}
|
|
4408
4514
|
function configDisabledAuxiliaryLspServerIds(getFlag) {
|
|
4409
|
-
return new Set(AUXILIARY_LSP_PROFILES.flatMap((p) => isEnabledByConfiguration(p, getFlag) ? [] : [
|
|
4515
|
+
return new Set(AUXILIARY_LSP_PROFILES.flatMap((p) => p.enabledByDefault && !isEnabledByConfiguration(p, getFlag) ? [p.serverId] : []));
|
|
4516
|
+
}
|
|
4517
|
+
function enabledOptInAuxiliaryLspServerIds(getFlag) {
|
|
4518
|
+
return new Set(AUXILIARY_LSP_PROFILES.flatMap((p) => !p.enabledByDefault && isEnabledByConfiguration(p, getFlag) ? [p.serverId] : []));
|
|
4410
4519
|
}
|
|
4411
4520
|
function isEnabledByConfiguration(profile, getFlag) {
|
|
4412
|
-
|
|
4521
|
+
if (!profile.enabledByDefault) {
|
|
4522
|
+
return profile.optInFlag !== void 0 && getFlag(profile.optInFlag) === true;
|
|
4523
|
+
}
|
|
4524
|
+
return !(profile.killSwitchFlag && getFlag(profile.killSwitchFlag) === true);
|
|
4413
4525
|
}
|
|
4414
4526
|
var profileForSourceCache = /* @__PURE__ */ new Map();
|
|
4415
4527
|
function findAuxiliaryProfileForSource(source) {
|
|
@@ -4426,6 +4538,16 @@ function isAuxiliaryDiagnosticSuppressed(d, content) {
|
|
|
4426
4538
|
const profile = findAuxiliaryProfileForSource(d.source);
|
|
4427
4539
|
return Boolean(profile?.isSuppressed?.(d, content));
|
|
4428
4540
|
}
|
|
4541
|
+
function dropExcludedServers(answer, excludeServerIds) {
|
|
4542
|
+
const kept = (serverId) => !excludeServerIds?.has(serverId ?? "");
|
|
4543
|
+
return {
|
|
4544
|
+
...answer,
|
|
4545
|
+
diagnostics: answer.diagnostics.filter((d) => kept(d.serverId ?? findAuxiliaryProfileForSource(d.source)?.serverId)),
|
|
4546
|
+
...answer.unconfirmedServerIds !== void 0 && {
|
|
4547
|
+
unconfirmedServerIds: answer.unconfirmedServerIds.filter(kept)
|
|
4548
|
+
}
|
|
4549
|
+
};
|
|
4550
|
+
}
|
|
4429
4551
|
function applyAuxiliarySuppressions(diagnostics, content, opts) {
|
|
4430
4552
|
const { filePath, scanRoot } = opts ?? {};
|
|
4431
4553
|
const ruleIgnores = filePath && scanRoot ? loadRuleIgnorePatterns(scanRoot) : void 0;
|
|
@@ -4719,9 +4841,12 @@ var DocumentDriftTracker = class {
|
|
|
4719
4841
|
return SKIPPED;
|
|
4720
4842
|
}
|
|
4721
4843
|
}
|
|
4722
|
-
|
|
4844
|
+
const full = options.full === true;
|
|
4845
|
+
if (full && this.flight.has(SWEEP_KEY))
|
|
4846
|
+
await this.flight.run(SWEEP_KEY, () => this.runSweep(deps, now));
|
|
4847
|
+
return this.flight.run(SWEEP_KEY, () => this.runSweep(deps, now, full));
|
|
4723
4848
|
}
|
|
4724
|
-
async runSweep(deps, now) {
|
|
4849
|
+
async runSweep(deps, now, full = false) {
|
|
4725
4850
|
this.lastSweepAt = now();
|
|
4726
4851
|
const stat3 = deps.stat ?? defaultStat;
|
|
4727
4852
|
const read = deps.read ?? defaultRead;
|
|
@@ -4730,8 +4855,10 @@ var DocumentDriftTracker = class {
|
|
|
4730
4855
|
const tracked = keys.length;
|
|
4731
4856
|
if (this.cursor >= tracked)
|
|
4732
4857
|
this.cursor = 0;
|
|
4858
|
+
const checkBatch = full ? tracked : DRIFT_CHECK_BATCH;
|
|
4859
|
+
const resyncBatch = full ? Number.POSITIVE_INFINITY : DRIFT_RESYNC_BATCH;
|
|
4733
4860
|
const window = [];
|
|
4734
|
-
for (let i = 0; i < Math.min(
|
|
4861
|
+
for (let i = 0; i < Math.min(checkBatch, tracked); i++) {
|
|
4735
4862
|
window.push(keys[(this.cursor + i) % tracked]);
|
|
4736
4863
|
}
|
|
4737
4864
|
this.cursor = tracked === 0 ? 0 : (this.cursor + window.length) % tracked;
|
|
@@ -4812,7 +4939,7 @@ var DocumentDriftTracker = class {
|
|
|
4812
4939
|
for (const key of queued) {
|
|
4813
4940
|
if (!this.pendingResync.has(key))
|
|
4814
4941
|
continue;
|
|
4815
|
-
if (resynced >=
|
|
4942
|
+
if (resynced >= resyncBatch) {
|
|
4816
4943
|
deferred += 1;
|
|
4817
4944
|
queuedDispositions.set(key, "deferred");
|
|
4818
4945
|
deps.onDrift?.({
|
|
@@ -4868,7 +4995,7 @@ var DocumentDriftTracker = class {
|
|
|
4868
4995
|
if (resyncedKeys.has(key))
|
|
4869
4996
|
continue;
|
|
4870
4997
|
const driftAgeMs = Math.max(0, now() - record2.syncedAt);
|
|
4871
|
-
if (resynced >=
|
|
4998
|
+
if (resynced >= resyncBatch) {
|
|
4872
4999
|
deferred += 1;
|
|
4873
5000
|
deps.onDrift?.({
|
|
4874
5001
|
filePath: key,
|
|
@@ -5450,6 +5577,8 @@ var Scope = class {
|
|
|
5450
5577
|
retiredReason;
|
|
5451
5578
|
/** The scope's store cells, by key (#3612); see {@link scopeCell}. */
|
|
5452
5579
|
cells = /* @__PURE__ */ new Map();
|
|
5580
|
+
/** The lookup keys {@link bindSessionId} bound to this scope. */
|
|
5581
|
+
boundKeys = /* @__PURE__ */ new Set();
|
|
5453
5582
|
// The stale-write record keeps its `runtime-session:<subject>` subject.
|
|
5454
5583
|
life = createGenerationSource("runtime-session");
|
|
5455
5584
|
branch = createGenerationSource("session-branch");
|
|
@@ -5474,6 +5603,7 @@ var Scope = class {
|
|
|
5474
5603
|
return;
|
|
5475
5604
|
this.retiredReason = reason ?? "shutdown";
|
|
5476
5605
|
this.life.bump();
|
|
5606
|
+
unbindScope(this);
|
|
5477
5607
|
}
|
|
5478
5608
|
moveBranch() {
|
|
5479
5609
|
this.branch.bump();
|
|
@@ -5534,6 +5664,34 @@ function logScopeTransition(scope, args) {
|
|
|
5534
5664
|
}
|
|
5535
5665
|
});
|
|
5536
5666
|
}
|
|
5667
|
+
var SESSION_INDEX_FAMILY = "session-scope.session-index";
|
|
5668
|
+
var SESSION_INDEX_VERSION = 1;
|
|
5669
|
+
function sessionIndex() {
|
|
5670
|
+
return getProcessSingleton(SESSION_INDEX_FAMILY, SESSION_INDEX_VERSION, () => ({ byKey: /* @__PURE__ */ new Map() }));
|
|
5671
|
+
}
|
|
5672
|
+
function unbindScope(scope) {
|
|
5673
|
+
const own = scope;
|
|
5674
|
+
const { byKey } = sessionIndex();
|
|
5675
|
+
for (const key of own.boundKeys)
|
|
5676
|
+
if (byKey.get(key) === own)
|
|
5677
|
+
byKey.delete(key);
|
|
5678
|
+
own.boundKeys.clear();
|
|
5679
|
+
}
|
|
5680
|
+
function scopeOfSession(key) {
|
|
5681
|
+
return sessionIndex().byKey.get(key);
|
|
5682
|
+
}
|
|
5683
|
+
function sessionCell(key, cellKey, init) {
|
|
5684
|
+
const scope = scopeOfSession(key);
|
|
5685
|
+
if (scope)
|
|
5686
|
+
return scopeCell(scope, cellKey, init);
|
|
5687
|
+
if (init)
|
|
5688
|
+
incrementDegradationCount({
|
|
5689
|
+
kind: "session-scope-lookup-missed",
|
|
5690
|
+
subject: cellKey,
|
|
5691
|
+
reason: `a ${cellKey} write named a session with no live scope, so it was dropped instead of held with no owner to retire it`
|
|
5692
|
+
});
|
|
5693
|
+
return void 0;
|
|
5694
|
+
}
|
|
5537
5695
|
var sessionStores = /* @__PURE__ */ new Map();
|
|
5538
5696
|
function defineSessionStore(spec) {
|
|
5539
5697
|
if (sessionStores.has(spec.name))
|
|
@@ -6924,6 +7082,15 @@ Re-read the relevant section, then retry the edit using the current line range/c
|
|
|
6924
7082
|
moveBranch(this.scope);
|
|
6925
7083
|
return result;
|
|
6926
7084
|
}
|
|
7085
|
+
/**
|
|
7086
|
+
* #4942 review F8: drop this guard's own {@link FileTime} bucket, which
|
|
7087
|
+
* lives in a process-global map keyed by session id and outlives the
|
|
7088
|
+
* guard object. Called when the owning session is forgotten. Unlike
|
|
7089
|
+
* {@link retainBranch} it leaves the shared branch epoch alone.
|
|
7090
|
+
*/
|
|
7091
|
+
releaseFileTime() {
|
|
7092
|
+
this.fileTime.clear();
|
|
7093
|
+
}
|
|
6927
7094
|
/** The epoch a deferred writer captures before it awaits (#3521). */
|
|
6928
7095
|
get currentBranchEpoch() {
|
|
6929
7096
|
return this.scope.branchEpoch();
|
|
@@ -7892,6 +8059,8 @@ function bookkeepLspMutation(context, files2, fileDetails) {
|
|
|
7892
8059
|
source: context.source,
|
|
7893
8060
|
cwd: context.cwd,
|
|
7894
8061
|
changedRange: detail.range,
|
|
8062
|
+
// #4943: the issuing activation's change-log row.
|
|
8063
|
+
sessionId: context.sessionId,
|
|
7895
8064
|
onAppendError: (err) => context.dbg?.(`lsp mutation project change append failed for ${filePath}: ${err}`)
|
|
7896
8065
|
});
|
|
7897
8066
|
if (sessionLive && context.cacheManager) {
|
|
@@ -8143,11 +8312,27 @@ function createDiskBindingCache() {
|
|
|
8143
8312
|
};
|
|
8144
8313
|
}
|
|
8145
8314
|
|
|
8315
|
+
// dist/clients/lsp/server-config-files.js
|
|
8316
|
+
import { basename } from "node:path";
|
|
8317
|
+
var CONFIG_FILE_SERVERS = /* @__PURE__ */ new Map([
|
|
8318
|
+
["pyrightconfig.json", ["python"]],
|
|
8319
|
+
["pyproject.toml", ["python"]]
|
|
8320
|
+
]);
|
|
8321
|
+
var SERVER_CONFIG_FILE_NAMES = [
|
|
8322
|
+
...CONFIG_FILE_SERVERS.keys()
|
|
8323
|
+
];
|
|
8324
|
+
function serverIdsForConfigFile(filePath) {
|
|
8325
|
+
return CONFIG_FILE_SERVERS.get(basename(filePath));
|
|
8326
|
+
}
|
|
8327
|
+
|
|
8146
8328
|
// dist/clients/lsp/grouping.js
|
|
8329
|
+
function aggregateServersForFile(filePath) {
|
|
8330
|
+
return getServersForFileWithConfig(filePath).flatMap((s) => isOptInAuxiliaryServerId(s.id) ? [] : [s]);
|
|
8331
|
+
}
|
|
8147
8332
|
function groupFilesByPrimaryServer(files2) {
|
|
8148
8333
|
const byServer = /* @__PURE__ */ new Map();
|
|
8149
8334
|
for (const filePath of files2) {
|
|
8150
|
-
const servers =
|
|
8335
|
+
const servers = aggregateServersForFile(filePath);
|
|
8151
8336
|
const primary = servers[0]?.id ?? "none";
|
|
8152
8337
|
const group = byServer.get(primary);
|
|
8153
8338
|
const fallbackFamilyHeads = /* @__PURE__ */ new Map();
|
|
@@ -9373,7 +9558,7 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
|
|
|
9373
9558
|
|
|
9374
9559
|
// dist/clients/lsp/edits.js
|
|
9375
9560
|
import fs10 from "node:fs/promises";
|
|
9376
|
-
import { readFileSync as readFileSync8, realpathSync
|
|
9561
|
+
import { readFileSync as readFileSync8, realpathSync, statSync as statSync8 } from "node:fs";
|
|
9377
9562
|
import path10 from "node:path";
|
|
9378
9563
|
import { URL as URL2 } from "node:url";
|
|
9379
9564
|
|
|
@@ -9400,80 +9585,6 @@ function convertCharacterOffset(encoding, lineText, utf16Character) {
|
|
|
9400
9585
|
return [...prefix].length;
|
|
9401
9586
|
}
|
|
9402
9587
|
|
|
9403
|
-
// dist/clients/lsp/watch-queue.js
|
|
9404
|
-
var WATCH_DEBOUNCE_MS = 100;
|
|
9405
|
-
var FILE_CREATED = 1;
|
|
9406
|
-
var FILE_CHANGED = 2;
|
|
9407
|
-
var FILE_DELETED = 3;
|
|
9408
|
-
var WATCH_BIRTH_MARGIN_MS = 100;
|
|
9409
|
-
function watchedTypeForOpen(birthtimeMs, clientStartedAtMs = Number.POSITIVE_INFINITY) {
|
|
9410
|
-
return birthtimeMs >= clientStartedAtMs - WATCH_BIRTH_MARGIN_MS ? FILE_CREATED : FILE_CHANGED;
|
|
9411
|
-
}
|
|
9412
|
-
var WatchedFilesQueue = class {
|
|
9413
|
-
flushFn;
|
|
9414
|
-
debounceMs;
|
|
9415
|
-
onCreated;
|
|
9416
|
-
// uri → latest FileChangeType. A Map collapses repeated events for the same
|
|
9417
|
-
// URI (last-type-wins, except Created is never downgraded to Changed inside
|
|
9418
|
-
// one window — #4320) while preserving first-seen insertion order.
|
|
9419
|
-
pending = /* @__PURE__ */ new Map();
|
|
9420
|
-
timer = null;
|
|
9421
|
-
constructor(flushFn, debounceMs = WATCH_DEBOUNCE_MS, onCreated) {
|
|
9422
|
-
this.flushFn = flushFn;
|
|
9423
|
-
this.debounceMs = debounceMs;
|
|
9424
|
-
this.onCreated = onCreated;
|
|
9425
|
-
}
|
|
9426
|
-
/** Queue a change; arms the debounce timer if not already pending. */
|
|
9427
|
-
enqueue(uri, type) {
|
|
9428
|
-
const held = this.pending.get(uri);
|
|
9429
|
-
this.pending.set(uri, held === FILE_CREATED && type === FILE_CHANGED ? FILE_CREATED : type);
|
|
9430
|
-
if (this.timer)
|
|
9431
|
-
return;
|
|
9432
|
-
this.timer = setTimeout(() => this.flush(), this.debounceMs);
|
|
9433
|
-
this.timer.unref?.();
|
|
9434
|
-
}
|
|
9435
|
-
/** Emit all queued changes as one notification (no-op when empty). */
|
|
9436
|
-
flush() {
|
|
9437
|
-
if (this.timer) {
|
|
9438
|
-
clearTimeout(this.timer);
|
|
9439
|
-
this.timer = null;
|
|
9440
|
-
}
|
|
9441
|
-
if (this.pending.size === 0)
|
|
9442
|
-
return;
|
|
9443
|
-
const changes = [...this.pending.entries()].map(([uri, type]) => ({ uri, type }));
|
|
9444
|
-
this.pending.clear();
|
|
9445
|
-
this.flushFn(changes);
|
|
9446
|
-
const created = changes.flatMap((change) => change.type === FILE_CREATED ? [change.uri] : []);
|
|
9447
|
-
if (created.length > 0)
|
|
9448
|
-
this.onCreated?.(created);
|
|
9449
|
-
}
|
|
9450
|
-
/**
|
|
9451
|
-
* #4320: send now when a Created is waiting, so a read that follows is
|
|
9452
|
-
* answered by a server that has heard of the new path. Leaves a queue of
|
|
9453
|
-
* edits alone to coalesce as usual.
|
|
9454
|
-
*/
|
|
9455
|
-
flushIfCreated() {
|
|
9456
|
-
for (const type of this.pending.values()) {
|
|
9457
|
-
if (type === FILE_CREATED) {
|
|
9458
|
-
this.flush();
|
|
9459
|
-
return;
|
|
9460
|
-
}
|
|
9461
|
-
}
|
|
9462
|
-
}
|
|
9463
|
-
/** Drop the timer + any queued changes without emitting (client teardown). */
|
|
9464
|
-
cancel() {
|
|
9465
|
-
if (this.timer) {
|
|
9466
|
-
clearTimeout(this.timer);
|
|
9467
|
-
this.timer = null;
|
|
9468
|
-
}
|
|
9469
|
-
this.pending.clear();
|
|
9470
|
-
}
|
|
9471
|
-
/** Number of distinct URIs currently queued (for tests/introspection). */
|
|
9472
|
-
get size() {
|
|
9473
|
-
return this.pending.size;
|
|
9474
|
-
}
|
|
9475
|
-
};
|
|
9476
|
-
|
|
9477
9588
|
// dist/clients/lsp/edits.js
|
|
9478
9589
|
var StaleWorkspaceEditContentError = class extends Error {
|
|
9479
9590
|
};
|
|
@@ -9866,7 +9977,7 @@ function captureRenameExpectedContent(edit, cwd, requestedAtMs, readTrackedSend,
|
|
|
9866
9977
|
let targetRealPath;
|
|
9867
9978
|
if (target !== void 0) {
|
|
9868
9979
|
try {
|
|
9869
|
-
targetRealPath =
|
|
9980
|
+
targetRealPath = realpathSync.native(target.filePath);
|
|
9870
9981
|
} catch {
|
|
9871
9982
|
targetRealPath = void 0;
|
|
9872
9983
|
}
|
|
@@ -9876,7 +9987,7 @@ function captureRenameExpectedContent(edit, cwd, requestedAtMs, readTrackedSend,
|
|
|
9876
9987
|
let content;
|
|
9877
9988
|
let mtimeMs;
|
|
9878
9989
|
try {
|
|
9879
|
-
realPath =
|
|
9990
|
+
realPath = realpathSync.native(diskPath);
|
|
9880
9991
|
content = readFileSync8(realPath, "utf-8");
|
|
9881
9992
|
mtimeMs = statSync8(realPath).mtimeMs;
|
|
9882
9993
|
} catch {
|
|
@@ -16027,7 +16138,7 @@ function createLazyImport(load) {
|
|
|
16027
16138
|
}
|
|
16028
16139
|
|
|
16029
16140
|
// dist/clients/lsp-lazy.js
|
|
16030
|
-
var lazyLsp = createLazyImport(() => import("./chunk-
|
|
16141
|
+
var lazyLsp = createLazyImport(() => import("./chunk-YES5CACN.js"));
|
|
16031
16142
|
function warmLspService() {
|
|
16032
16143
|
return lazyLsp.get();
|
|
16033
16144
|
}
|
|
@@ -16300,7 +16411,7 @@ function getMaxWorkspaceDiagnosticFiles() {
|
|
|
16300
16411
|
}
|
|
16301
16412
|
async function collectWorkspaceDiagnosticFiles(root, maxFiles = getMaxWorkspaceDiagnosticFiles(), signal, homeDir) {
|
|
16302
16413
|
const files2 = [];
|
|
16303
|
-
if (isAtOrAboveHomeDir(root, homeDir))
|
|
16414
|
+
if (isAtOrAboveHomeDir(realpathOrResolve(root), realpathOrResolve(homeDir ?? os2.homedir())))
|
|
16304
16415
|
return files2;
|
|
16305
16416
|
const ignoreMatcher = getProjectIgnoreMatcher(root);
|
|
16306
16417
|
await ignoreMatcher.ensureTrackedIndex();
|
|
@@ -16344,7 +16455,16 @@ async function collectWorkspaceDiagnosticFiles(root, maxFiles = getMaxWorkspaceD
|
|
|
16344
16455
|
}
|
|
16345
16456
|
var LSPService = class _LSPService {
|
|
16346
16457
|
static MAX_SIBLING_ANNOUNCEMENTS = 1024;
|
|
16458
|
+
static MAX_UNHELD_STAMPS = 4096;
|
|
16347
16459
|
state;
|
|
16460
|
+
/**
|
|
16461
|
+
* #4532 gap 13: per path no live client holds open, the content stamp it
|
|
16462
|
+
* had when this service last brought its live servers' view up to date.
|
|
16463
|
+
* Two writers, one meaning: the check (`unheldBytesMoved`) and every
|
|
16464
|
+
* watched-files event this service sends (`noteUnheldSent`). Dropped with
|
|
16465
|
+
* the service; an evicted path is read as one seen for the first time.
|
|
16466
|
+
*/
|
|
16467
|
+
unheldStamps = new BoundedFifoMap(_LSPService.MAX_UNHELD_STAMPS);
|
|
16348
16468
|
/** Content hashes already announced to a sibling root in this service. */
|
|
16349
16469
|
siblingAnnouncementHashes = new BoundedFifoMap(_LSPService.MAX_SIBLING_ANNOUNCEMENTS);
|
|
16350
16470
|
/**
|
|
@@ -16607,7 +16727,7 @@ var LSPService = class _LSPService {
|
|
|
16607
16727
|
return Promise.resolve();
|
|
16608
16728
|
}
|
|
16609
16729
|
this.announceCreatedFiles([filePath]);
|
|
16610
|
-
return Promise.all(
|
|
16730
|
+
return Promise.all(this.serversWithLiveReaderRoots(filePath).map((server) => this.clientRegistry.resolveServerRoot(server, filePath).then((root) => {
|
|
16611
16731
|
if (!root)
|
|
16612
16732
|
return false;
|
|
16613
16733
|
const ownKey = `${server.id}:${normalizeMapKey(root)}`;
|
|
@@ -16616,6 +16736,26 @@ var LSPService = class _LSPService {
|
|
|
16616
16736
|
this.siblingAnnouncementHashes.set(normalizedPath, contentHash2);
|
|
16617
16737
|
});
|
|
16618
16738
|
}
|
|
16739
|
+
/**
|
|
16740
|
+
* #4956 F1: the servers a per-file reader that acts only on LIVE clients (or
|
|
16741
|
+
* on a root decision a session already made) walks. An opt-in auxiliary
|
|
16742
|
+
* (`enabledByDefault: false`) joins every JS/TS candidate list whether or not
|
|
16743
|
+
* the operator turned it on, and each reader below resolves a root per
|
|
16744
|
+
* server (a `NearestRoot` walk; negatives are never cached), so a server
|
|
16745
|
+
* nobody started would add that walk to every touch of every file. It is
|
|
16746
|
+
* walked only while this service holds a client for it, which is the only
|
|
16747
|
+
* state in which these readers can find anything to act on.
|
|
16748
|
+
*/
|
|
16749
|
+
serversWithLiveReaderRoots(filePath) {
|
|
16750
|
+
return getServersForFileWithConfig(filePath).flatMap((server) => !isOptInAuxiliaryServerId(server.id) || this.holdsClientForServer(server.id) ? [server] : []);
|
|
16751
|
+
}
|
|
16752
|
+
holdsClientForServer(serverId) {
|
|
16753
|
+
const prefix = `${serverId}:`;
|
|
16754
|
+
for (const key of this.state.clients.keys())
|
|
16755
|
+
if (key.startsWith(prefix))
|
|
16756
|
+
return true;
|
|
16757
|
+
return false;
|
|
16758
|
+
}
|
|
16619
16759
|
notifyLiveClientsForServer(serverId, filePath, type, ownKey, includeOwn) {
|
|
16620
16760
|
let notified = false;
|
|
16621
16761
|
const prefix = `${serverId}:`;
|
|
@@ -17431,7 +17571,8 @@ var LSPService = class _LSPService {
|
|
|
17431
17571
|
const attached = new Set(spawned.map((entry) => entry.info.id));
|
|
17432
17572
|
const brokenSkippedServerIds = [];
|
|
17433
17573
|
const policySkippedServerIds = [];
|
|
17434
|
-
|
|
17574
|
+
const candidates = enabledAuxiliaries ? getServersForFileWithConfig(filePath) : aggregateServersForFile(filePath);
|
|
17575
|
+
for (const server of candidates) {
|
|
17435
17576
|
if (!isAuxiliary(server))
|
|
17436
17577
|
continue;
|
|
17437
17578
|
if (attached.has(server.id))
|
|
@@ -17731,15 +17872,15 @@ var LSPService = class _LSPService {
|
|
|
17731
17872
|
* aggregate diagnostics pass must not launch them beside a working preferred
|
|
17732
17873
|
* server merely because it requested `clientScope: "all"`.
|
|
17733
17874
|
*/
|
|
17734
|
-
async getClientsForFile(filePath, excludeServerIds, resolvedRoots, auxiliaryRoots) {
|
|
17735
|
-
const allServers =
|
|
17875
|
+
async getClientsForFile(filePath, excludeServerIds, resolvedRoots, auxiliaryRoots, syncOnly = false) {
|
|
17876
|
+
const allServers = syncOnly ? this.serversWithLiveReaderRoots(filePath) : aggregateServersForFile(filePath);
|
|
17736
17877
|
const servers = excludeServerIds && excludeServerIds.size > 0 ? allServers.filter((s) => !excludeServerIds.has(s.id)) : allServers;
|
|
17737
17878
|
if (servers.length === 0)
|
|
17738
17879
|
return { clients: [], serverCountAttempted: 0 };
|
|
17739
17880
|
const rootedServers = (await Promise.all(servers.map(async (server) => ({
|
|
17740
17881
|
server,
|
|
17741
17882
|
root: await this.clientRegistry.resolveServerRoot(server, filePath)
|
|
17742
|
-
})))).filter((entry) => entry.root !== void 0);
|
|
17883
|
+
})))).filter((entry) => entry.root !== void 0 && (!isOptInAuxiliaryServerId(entry.server.id) || this.state.clients.get(`${entry.server.id}:${normalizeMapKey(entry.root)}`)?.isAlive() === true));
|
|
17743
17884
|
for (const { server, root } of rootedServers)
|
|
17744
17885
|
if (isAuxiliary(server))
|
|
17745
17886
|
auxiliaryRoots?.set(server.id, normalizeMapKey(root));
|
|
@@ -17793,7 +17934,7 @@ var LSPService = class _LSPService {
|
|
|
17793
17934
|
async getWarmClientForFile(filePath) {
|
|
17794
17935
|
if (this.checkDestroyed())
|
|
17795
17936
|
return void 0;
|
|
17796
|
-
const servers =
|
|
17937
|
+
const servers = this.serversWithLiveReaderRoots(filePath);
|
|
17797
17938
|
const missed = [];
|
|
17798
17939
|
for (const server of servers) {
|
|
17799
17940
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
@@ -17915,7 +18056,7 @@ var LSPService = class _LSPService {
|
|
|
17915
18056
|
async notifyExternalFileChange(filePath, type) {
|
|
17916
18057
|
if (this.checkDestroyed())
|
|
17917
18058
|
return;
|
|
17918
|
-
for (const server of
|
|
18059
|
+
for (const server of this.serversWithLiveReaderRoots(filePath)) {
|
|
17919
18060
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
17920
18061
|
if (!root)
|
|
17921
18062
|
continue;
|
|
@@ -17934,13 +18075,43 @@ var LSPService = class _LSPService {
|
|
|
17934
18075
|
notifyOutOfBandFileChanges(changes) {
|
|
17935
18076
|
if (this.checkDestroyed() || changes.length === 0)
|
|
17936
18077
|
return;
|
|
17937
|
-
for (const { filePath, type } of changes)
|
|
17938
|
-
|
|
17939
|
-
|
|
18078
|
+
for (const { filePath, type } of changes) {
|
|
18079
|
+
const serverIds = /* @__PURE__ */ new Set([
|
|
18080
|
+
...serverIdsForConfigFile(filePath) ?? [],
|
|
18081
|
+
...getServersForFileWithConfig(filePath).map((server) => server.id)
|
|
18082
|
+
]);
|
|
18083
|
+
for (const serverId of serverIds)
|
|
18084
|
+
this.notifyLiveClientsForServer(serverId, filePath, type, "", true);
|
|
18085
|
+
this.noteUnheldSent(filePath);
|
|
18086
|
+
}
|
|
17940
18087
|
for (const client of this.state.clients.values())
|
|
17941
18088
|
if (client.isAlive())
|
|
17942
18089
|
client.notify.flushWatched?.();
|
|
17943
18090
|
}
|
|
18091
|
+
/**
|
|
18092
|
+
* #4532 gap 13: an event sent for `filePath` brought its live servers' view
|
|
18093
|
+
* up to date, so its {@link unheldStamps} record moves to the stat now (the
|
|
18094
|
+
* bytes hash is kept when the stat is the one already recorded), or goes
|
|
18095
|
+
* with the file (a Deleted event, or a path that cannot be statted). Without this, a sender that announces after it notifies
|
|
18096
|
+
* (#4742's head-move phase) had each path sent twice.
|
|
18097
|
+
*/
|
|
18098
|
+
noteUnheldSent(filePath) {
|
|
18099
|
+
const key = normalizeMapKey(filePath);
|
|
18100
|
+
let stat3;
|
|
18101
|
+
try {
|
|
18102
|
+
stat3 = nodeFs2.statSync(filePath, { throwIfNoEntry: false });
|
|
18103
|
+
} catch {
|
|
18104
|
+
stat3 = void 0;
|
|
18105
|
+
}
|
|
18106
|
+
if (stat3 === void 0) {
|
|
18107
|
+
this.unheldStamps.delete(key);
|
|
18108
|
+
return;
|
|
18109
|
+
}
|
|
18110
|
+
const seen = this.unheldStamps.get(key);
|
|
18111
|
+
if (seen?.size === stat3.size && seen.mtimeMs === stat3.mtimeMs)
|
|
18112
|
+
return;
|
|
18113
|
+
this.unheldStamps.set(key, { size: stat3.size, mtimeMs: stat3.mtimeMs });
|
|
18114
|
+
}
|
|
17944
18115
|
/**
|
|
17945
18116
|
* #4476: restart the live primary clients whose root overlaps `root` after
|
|
17946
18117
|
* a dependency install there (see `ClientRegistry.restartPrimaryClientsUnder`).
|
|
@@ -17972,12 +18143,20 @@ var LSPService = class _LSPService {
|
|
|
17972
18143
|
* workspace sweep (which looks every file up before it touches any), is
|
|
17973
18144
|
* answered from cache, or by a server that has not heard of the module yet.
|
|
17974
18145
|
* Each client decides which entries are new to it (`watchedTypeForExisting`).
|
|
18146
|
+
*
|
|
18147
|
+
* #4532 gap 13: `importTargets`, the files the caller's targets import
|
|
18148
|
+
* directly (`importTargetsToAnnounce`), are announced too, and first each
|
|
18149
|
+
* one whose bytes moved since its servers last saw them goes out as Changed
|
|
18150
|
+
* (`sendUnheldChanges`), so a module changed outside pi is re-read before
|
|
18151
|
+
* the importer's answer. Only import targets are checked: a sweep's own
|
|
18152
|
+
* file list (up to 5000) would churn the check's record (#4926 review F2).
|
|
17975
18153
|
*/
|
|
17976
|
-
announceCreatedFiles(filePaths) {
|
|
18154
|
+
announceCreatedFiles(filePaths, importTargets = []) {
|
|
17977
18155
|
if (this.checkDestroyed() || this.state.clients.size === 0)
|
|
17978
18156
|
return;
|
|
18157
|
+
this.sendUnheldChanges(importTargets);
|
|
17979
18158
|
const byServer = /* @__PURE__ */ new Map();
|
|
17980
|
-
for (const filePath of filePaths) {
|
|
18159
|
+
for (const filePath of [...filePaths, ...importTargets]) {
|
|
17981
18160
|
let stat3;
|
|
17982
18161
|
try {
|
|
17983
18162
|
stat3 = nodeFs2.statSync(filePath);
|
|
@@ -17997,6 +18176,112 @@ var LSPService = class _LSPService {
|
|
|
17997
18176
|
client.notify.announceCreated(entries);
|
|
17998
18177
|
}
|
|
17999
18178
|
}
|
|
18179
|
+
/**
|
|
18180
|
+
* #4532 gap 13: send Changed, now, for each of `filePaths` that no live
|
|
18181
|
+
* client holds open and whose bytes moved since its live servers last saw
|
|
18182
|
+
* them ({@link unheldBytesMoved}), before the caller's read. Each such path
|
|
18183
|
+
* is also noted as changed on disk under the root of every live client of
|
|
18184
|
+
* its servers, the record #4476 writes for a change seen on disk: a cached
|
|
18185
|
+
* answer whose dependency scope holds the path is refused, and a touch
|
|
18186
|
+
* debounced before the change pushes again.
|
|
18187
|
+
*/
|
|
18188
|
+
sendUnheldChanges(filePaths) {
|
|
18189
|
+
const changed = [];
|
|
18190
|
+
const at = Date.now();
|
|
18191
|
+
for (const filePath of filePaths) {
|
|
18192
|
+
let stat3;
|
|
18193
|
+
try {
|
|
18194
|
+
stat3 = nodeFs2.statSync(filePath);
|
|
18195
|
+
} catch {
|
|
18196
|
+
continue;
|
|
18197
|
+
}
|
|
18198
|
+
const servers = getServersForFileWithConfig(filePath);
|
|
18199
|
+
if (!this.unheldBytesMoved(filePath, stat3, servers))
|
|
18200
|
+
continue;
|
|
18201
|
+
changed.push({ filePath, type: FILE_CHANGED });
|
|
18202
|
+
for (const client of this.liveClientsOf(servers, filePath))
|
|
18203
|
+
noteWorkspaceFilesChangedOnDisk(client.root, [normalizeMapKey(filePath)], at);
|
|
18204
|
+
}
|
|
18205
|
+
if (changed.length === 0)
|
|
18206
|
+
return;
|
|
18207
|
+
this.notifyOutOfBandFileChanges(changed);
|
|
18208
|
+
logLatency({
|
|
18209
|
+
type: "phase",
|
|
18210
|
+
phase: "lsp_unheld_dependency_changed",
|
|
18211
|
+
filePath: changed[0]?.filePath ?? "",
|
|
18212
|
+
durationMs: Date.now() - at,
|
|
18213
|
+
result: `changed:${changed.length}`,
|
|
18214
|
+
metadata: {
|
|
18215
|
+
changed: changed.length,
|
|
18216
|
+
paths: changed.slice(0, 5).map((change) => change.filePath)
|
|
18217
|
+
}
|
|
18218
|
+
});
|
|
18219
|
+
}
|
|
18220
|
+
/**
|
|
18221
|
+
* #4532 gap 13: whether `filePath`, which no live client holds open, has
|
|
18222
|
+
* bytes a live server of its may not have read. A server keeps the bytes of
|
|
18223
|
+
* a closed module it read for an importer and re-reads them only when a
|
|
18224
|
+
* watched-files event names the file (pyright 1.1.414, measured), so a
|
|
18225
|
+
* module changed outside pi left its importer's answer stale for the
|
|
18226
|
+
* server's life, on the first call and every call after it.
|
|
18227
|
+
*
|
|
18228
|
+
* The record ({@link unheldStamps}) is the content stamp the path had when
|
|
18229
|
+
* this service last brought its live servers' view up to date. An equal
|
|
18230
|
+
* stat is unchanged; a moved stat is read and compared by its bytes, so a
|
|
18231
|
+
* rewrite of the same bytes sends nothing. A path seen for the first time
|
|
18232
|
+
* has no record to compare, so its bytes take the client-start rule a
|
|
18233
|
+
* birth takes ({@link watchedTypeForOpen}, #4320): bytes written at or
|
|
18234
|
+
* after a live server of the path started (less the margin) may be newer
|
|
18235
|
+
* than the bytes that server read, and older ones are what it read. A path every
|
|
18236
|
+
* live client holds is skipped: the open-document sync keeps those views
|
|
18237
|
+
* current. One that some client reads closed is compared and sent, and a
|
|
18238
|
+
* holder's copy of the event is redundant, since its open document wins.
|
|
18239
|
+
*/
|
|
18240
|
+
unheldBytesMoved(filePath, stat3, servers) {
|
|
18241
|
+
const live = this.liveClientsOf(servers, filePath);
|
|
18242
|
+
if (live.every((client) => client.holds))
|
|
18243
|
+
return false;
|
|
18244
|
+
const key = normalizeMapKey(filePath);
|
|
18245
|
+
const seen = this.unheldStamps.get(key);
|
|
18246
|
+
if (seen?.size === stat3.size && seen.mtimeMs === stat3.mtimeMs)
|
|
18247
|
+
return false;
|
|
18248
|
+
let stamp = { size: stat3.size, mtimeMs: stat3.mtimeMs };
|
|
18249
|
+
if (stat3.size <= CONTENT_HASH_MAX_BYTES) {
|
|
18250
|
+
try {
|
|
18251
|
+
stamp = stampContentBytes(nodeFs2.readFileSync(filePath), stat3.mtimeMs);
|
|
18252
|
+
} catch (cause) {
|
|
18253
|
+
recordDegradationOnce({
|
|
18254
|
+
kind: "lsp-unheld-dependency-unreadable",
|
|
18255
|
+
subject: key,
|
|
18256
|
+
reason: `could not read a closed module to compare its bytes; a change of its stat is sent as a change: ${cause instanceof Error ? cause.message : String(cause)}`
|
|
18257
|
+
});
|
|
18258
|
+
}
|
|
18259
|
+
}
|
|
18260
|
+
this.unheldStamps.set(key, stamp);
|
|
18261
|
+
if (seen === void 0)
|
|
18262
|
+
return live.some((client) => watchedTypeForOpen(stat3.mtimeMs, client.launchedAt) === FILE_CREATED);
|
|
18263
|
+
return seen.sha256 === void 0 || seen.sha256 !== stamp.sha256;
|
|
18264
|
+
}
|
|
18265
|
+
/**
|
|
18266
|
+
* The live clients of `servers`, each with its root, the launch epoch from
|
|
18267
|
+
* which that server could read a project file, and whether it holds
|
|
18268
|
+
* `filePath` open.
|
|
18269
|
+
*/
|
|
18270
|
+
liveClientsOf(servers, filePath) {
|
|
18271
|
+
const live = [];
|
|
18272
|
+
for (const [key, client] of this.state.clients) {
|
|
18273
|
+
if (!client.isAlive())
|
|
18274
|
+
continue;
|
|
18275
|
+
if (!servers.some((server) => key.startsWith(`${server.id}:`)))
|
|
18276
|
+
continue;
|
|
18277
|
+
live.push({
|
|
18278
|
+
root: client.root,
|
|
18279
|
+
launchedAt: this.clientRegistry.clientLaunchStartedAt.get(key) ?? 0,
|
|
18280
|
+
holds: documentIsOpenOn(client, filePath)
|
|
18281
|
+
});
|
|
18282
|
+
}
|
|
18283
|
+
return live;
|
|
18284
|
+
}
|
|
18000
18285
|
/**
|
|
18001
18286
|
* #4493 r2: push the disk bytes of `filePaths` to the PRIMARY servers that
|
|
18002
18287
|
* already hold them, and to no auxiliary. A HEAD move's resync runs this
|
|
@@ -18115,7 +18400,7 @@ var LSPService = class _LSPService {
|
|
|
18115
18400
|
const changed = /* @__PURE__ */ new Map();
|
|
18116
18401
|
for (const changedPath of changedPaths) {
|
|
18117
18402
|
const resolved2 = path17.resolve(changedPath);
|
|
18118
|
-
for (const server of
|
|
18403
|
+
for (const server of this.serversWithLiveReaderRoots(resolved2)) {
|
|
18119
18404
|
const root = await this.clientRegistry.resolveServerRoot(server, resolved2);
|
|
18120
18405
|
if (!root)
|
|
18121
18406
|
continue;
|
|
@@ -18191,6 +18476,8 @@ var LSPService = class _LSPService {
|
|
|
18191
18476
|
return void 0;
|
|
18192
18477
|
return this.documentDrift.sweep({
|
|
18193
18478
|
resync: async (filePath, content, _driftAgeMs, readStamp, saved) => {
|
|
18479
|
+
if (exceedsLspSyncLimits(content).tooLarge)
|
|
18480
|
+
return false;
|
|
18194
18481
|
await this.touchFile(filePath, content, {
|
|
18195
18482
|
diagnostics: "none",
|
|
18196
18483
|
source: "drift_resync",
|
|
@@ -18262,7 +18549,7 @@ var LSPService = class _LSPService {
|
|
|
18262
18549
|
*/
|
|
18263
18550
|
async serverIdsNotHoldingDocument(filePath) {
|
|
18264
18551
|
const exclude = /* @__PURE__ */ new Set();
|
|
18265
|
-
for (const server of
|
|
18552
|
+
for (const server of this.serversWithLiveReaderRoots(filePath)) {
|
|
18266
18553
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
18267
18554
|
const existing = root ? this.state.clients.get(`${server.id}:${normalizeMapKey(root)}`) : void 0;
|
|
18268
18555
|
if (existing?.isAlive() && documentIsOpenOn(existing, filePath))
|
|
@@ -18378,7 +18665,7 @@ var LSPService = class _LSPService {
|
|
|
18378
18665
|
let spawned;
|
|
18379
18666
|
let serverCountAttempted;
|
|
18380
18667
|
if (useAllClients) {
|
|
18381
|
-
const result = await this.getClientsForFile(filePath, options.excludeServerIds, resolvedPrimaryRoots, attemptedAuxiliaryRoots);
|
|
18668
|
+
const result = await this.getClientsForFile(filePath, options.excludeServerIds, resolvedPrimaryRoots, attemptedAuxiliaryRoots, diagnosticsMode === "none");
|
|
18382
18669
|
spawned = result.clients;
|
|
18383
18670
|
serverCountAttempted = result.serverCountAttempted;
|
|
18384
18671
|
} else if (clientScope === "with-auxiliary") {
|
|
@@ -19525,7 +19812,7 @@ var LSPService = class _LSPService {
|
|
|
19525
19812
|
return void 0;
|
|
19526
19813
|
if (this.clientRegistry.analysisRootModeForFile(filePath) === "adopted")
|
|
19527
19814
|
return void 0;
|
|
19528
|
-
const candidates = await Promise.all(
|
|
19815
|
+
const candidates = await Promise.all(this.serversWithLiveReaderRoots(filePath).map((server) => server.root(filePath)));
|
|
19529
19816
|
return candidates.find((candidate) => Boolean(candidate));
|
|
19530
19817
|
}
|
|
19531
19818
|
/**
|
|
@@ -19610,12 +19897,18 @@ var LSPService = class _LSPService {
|
|
|
19610
19897
|
return [];
|
|
19611
19898
|
}
|
|
19612
19899
|
const startedAt = Date.now();
|
|
19613
|
-
const candidateServerIds =
|
|
19900
|
+
const candidateServerIds = aggregateServersForFile(filePath).flatMap((s) => excludeServerIds?.has(s.id) ? [] : [s.id]);
|
|
19614
19901
|
const resolvedPrimaryRoots = /* @__PURE__ */ new Map();
|
|
19615
19902
|
const { clients: spawned, serverCountAttempted } = await this.getClientsForFile(filePath, excludeServerIds, resolvedPrimaryRoots);
|
|
19616
19903
|
if (spawned.length === 0) {
|
|
19617
19904
|
const stored = this.lastKnownDiagnostics.get(normalizedPath);
|
|
19618
|
-
const
|
|
19905
|
+
const notCandidates = /* @__PURE__ */ new Set();
|
|
19906
|
+
for (const d of stored ?? []) {
|
|
19907
|
+
const id = d.serverId ?? findAuxiliaryProfileForSource(d.source)?.serverId;
|
|
19908
|
+
if (id && !candidateServerIds.includes(id))
|
|
19909
|
+
notCandidates.add(id);
|
|
19910
|
+
}
|
|
19911
|
+
const stale = stored && dropExcludedServers({ diagnostics: stored }, notCandidates).diagnostics;
|
|
19619
19912
|
const failureKind2 = stale?.length ? "no_clients_stale" : "no_clients";
|
|
19620
19913
|
const unanswered2 = unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath);
|
|
19621
19914
|
const unavailablePrimaryServerIds2 = unanswered2.serverIds;
|
|
@@ -20044,7 +20337,7 @@ var LSPService = class _LSPService {
|
|
|
20044
20337
|
if (this.checkDestroyed()) {
|
|
20045
20338
|
return { executed: false, reason: "lsp service destroyed" };
|
|
20046
20339
|
}
|
|
20047
|
-
for (const server of
|
|
20340
|
+
for (const server of this.serversWithLiveReaderRoots(filePath)) {
|
|
20048
20341
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
20049
20342
|
if (!root)
|
|
20050
20343
|
continue;
|
|
@@ -20125,7 +20418,7 @@ var LSPService = class _LSPService {
|
|
|
20125
20418
|
return [];
|
|
20126
20419
|
const snapshots = [];
|
|
20127
20420
|
if (filePath) {
|
|
20128
|
-
const servers =
|
|
20421
|
+
const servers = this.serversWithLiveReaderRoots(filePath);
|
|
20129
20422
|
for (const server of servers) {
|
|
20130
20423
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
20131
20424
|
if (!root)
|
|
@@ -20780,6 +21073,10 @@ var LSPService = class _LSPService {
|
|
|
20780
21073
|
async runWorkspaceDiagnosticsSwept(cwd, options = {}) {
|
|
20781
21074
|
const startedAt = Date.now();
|
|
20782
21075
|
const root = path17.resolve(cwd);
|
|
21076
|
+
const sweepExcludedServerIds = /* @__PURE__ */ new Set([
|
|
21077
|
+
...WORKSPACE_SWEEP_EXCLUDED_SERVER_IDS,
|
|
21078
|
+
...options.excludeServerIds ?? []
|
|
21079
|
+
]);
|
|
20783
21080
|
const { signal } = options;
|
|
20784
21081
|
void this.sweepDocumentDrift().catch(() => {
|
|
20785
21082
|
});
|
|
@@ -20795,7 +21092,7 @@ var LSPService = class _LSPService {
|
|
|
20795
21092
|
let lastHeartbeat = Date.now();
|
|
20796
21093
|
const workspaceDiagnosticsCacheCtx = createWorkspaceDiagnosticsCacheContext(root);
|
|
20797
21094
|
const workspaceSweepScopeKey = buildScopeKey("all", [
|
|
20798
|
-
...
|
|
21095
|
+
...sweepExcludedServerIds
|
|
20799
21096
|
]);
|
|
20800
21097
|
const touchScopedOpenDependencies = async (filePath) => {
|
|
20801
21098
|
if (options.files === void 0)
|
|
@@ -20828,11 +21125,7 @@ var LSPService = class _LSPService {
|
|
|
20828
21125
|
}));
|
|
20829
21126
|
return !capped;
|
|
20830
21127
|
};
|
|
20831
|
-
this.announceCreatedFiles([
|
|
20832
|
-
...files2,
|
|
20833
|
-
...goPackageFilesToAnnounce(files2),
|
|
20834
|
-
...await importTargetsToAnnounce(root, files2.filter((filePath) => !workspaceDiagnosticsCacheCtx.servesClean(filePath, workspaceSweepScopeKey)), (filePath, scope) => workspaceDiagnosticsCacheCtx.noteImportScope(filePath, scope))
|
|
20835
|
-
]);
|
|
21128
|
+
this.announceCreatedFiles([...files2, ...goPackageFilesToAnnounce(files2)], await importTargetsToAnnounce(root, files2.filter((filePath) => !workspaceDiagnosticsCacheCtx.servesClean(filePath, workspaceSweepScopeKey)), (filePath, scope) => workspaceDiagnosticsCacheCtx.noteImportScope(filePath, scope)));
|
|
20836
21129
|
const cachedResults = [];
|
|
20837
21130
|
const filesToTouch = [];
|
|
20838
21131
|
const writeIndexByPath = /* @__PURE__ */ new Map();
|
|
@@ -20913,7 +21206,7 @@ var LSPService = class _LSPService {
|
|
|
20913
21206
|
contentCache.set(filePath, content);
|
|
20914
21207
|
const languageId = getLanguageId2(filePath) ?? "plaintext";
|
|
20915
21208
|
const preOpenAttempt = withDeadline((async () => {
|
|
20916
|
-
const { clients } = await this.getClientsForFile(filePath,
|
|
21209
|
+
const { clients } = await this.getClientsForFile(filePath, sweepExcludedServerIds);
|
|
20917
21210
|
for (const entry of clients) {
|
|
20918
21211
|
let auxKey;
|
|
20919
21212
|
if (isAuxiliary(entry.info)) {
|
|
@@ -20971,7 +21264,8 @@ var LSPService = class _LSPService {
|
|
|
20971
21264
|
if (attached && !attached.available) {
|
|
20972
21265
|
await this.ensureWarmForSweep(filePath, { signal });
|
|
20973
21266
|
}
|
|
20974
|
-
const
|
|
21267
|
+
const answer = attached?.available ? dropExcludedServers(attached.response, sweepExcludedServerIds) : void 0;
|
|
21268
|
+
const touchResult = answer ? {
|
|
20975
21269
|
// #4645: the incumbent's membership answer, applied on receipt
|
|
20976
21270
|
// through the owner's rule. This sweep records its rows into
|
|
20977
21271
|
// the workspace cache, and an attached process has no live
|
|
@@ -20979,11 +21273,11 @@ var LSPService = class _LSPService {
|
|
|
20979
21273
|
// rows: the form the batch cache stores (`replayable()`). The
|
|
20980
21274
|
// environment rule still runs at render, against the install
|
|
20981
21275
|
// state of that render.
|
|
20982
|
-
diags:
|
|
21276
|
+
diags: answer.projectIdentity === void 0 ? answer.diagnostics : await demoteInferredProjectDiagnostics(answer.diagnostics, {
|
|
20983
21277
|
filePath,
|
|
20984
21278
|
cwd,
|
|
20985
21279
|
identityCache: /* @__PURE__ */ new Map([
|
|
20986
|
-
[filePath,
|
|
21280
|
+
[filePath, answer.projectIdentity]
|
|
20987
21281
|
])
|
|
20988
21282
|
}),
|
|
20989
21283
|
// #1470: the incumbent's coverage gap crosses the socket as an
|
|
@@ -20991,8 +21285,8 @@ var LSPService = class _LSPService {
|
|
|
20991
21285
|
// reads. Dropping it here would let a partially covered
|
|
20992
21286
|
// incumbent answer be persisted as a confirmed sweep result —
|
|
20993
21287
|
// the same false clean this change closes on the local route.
|
|
20994
|
-
...
|
|
20995
|
-
unconfirmedServerIds:
|
|
21288
|
+
...answer.unconfirmedServerIds !== void 0 && {
|
|
21289
|
+
unconfirmedServerIds: answer.unconfirmedServerIds
|
|
20996
21290
|
}
|
|
20997
21291
|
} : await withDeadline(this.touchFile(filePath, content, {
|
|
20998
21292
|
diagnostics: "document",
|
|
@@ -21003,7 +21297,7 @@ var LSPService = class _LSPService {
|
|
|
21003
21297
|
// `opengrep-client.ts` CLI extractor (one project-wide scan,
|
|
21004
21298
|
// cached, read via extractors.ts) instead — see the
|
|
21005
21299
|
// `excludeServerIds` doc on `LSPTouchFileOptions`.
|
|
21006
|
-
excludeServerIds:
|
|
21300
|
+
excludeServerIds: sweepExcludedServerIds,
|
|
21007
21301
|
// #645: lets a workspaceIndexing server (marksman) pay its
|
|
21008
21302
|
// full wait budget only once across this whole sweep.
|
|
21009
21303
|
sweepIndexGate
|
|
@@ -21590,9 +21884,12 @@ export {
|
|
|
21590
21884
|
calculateRuleComplexity,
|
|
21591
21885
|
buildEffectiveAstGrepCatalog,
|
|
21592
21886
|
isRuleIgnoredForPath,
|
|
21887
|
+
isOptInAuxiliaryServerId,
|
|
21593
21888
|
enabledAuxiliaryLspServerIds,
|
|
21594
21889
|
configDisabledAuxiliaryLspServerIds,
|
|
21890
|
+
enabledOptInAuxiliaryLspServerIds,
|
|
21595
21891
|
findAuxiliaryProfileForSource,
|
|
21892
|
+
dropExcludedServers,
|
|
21596
21893
|
applyAuxiliarySuppressions,
|
|
21597
21894
|
retagAuxiliaryDiagnostics,
|
|
21598
21895
|
armDeferredLspWork,
|
|
@@ -21615,6 +21912,7 @@ export {
|
|
|
21615
21912
|
beginScope,
|
|
21616
21913
|
retireScope,
|
|
21617
21914
|
nextOrderTurn,
|
|
21915
|
+
sessionCell,
|
|
21618
21916
|
scopeCell,
|
|
21619
21917
|
lineContentHash,
|
|
21620
21918
|
ReadGuard,
|