pi-lens 4.4.5 → 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 +120 -0
- package/README.md +37 -1
- package/config/biome/core.jsonc +3 -3
- package/dist/{chunk-6XSESGWD.js → chunk-24BILSZW.js} +2 -2
- package/dist/{chunk-YXDCRUKQ.js → chunk-2PHMIAKO.js} +4 -4
- package/dist/{chunk-EN5AM7PX.js → chunk-2TF6RXWB.js} +10 -10
- package/dist/{chunk-XI34NWDI.js → chunk-3F6BMY53.js} +1 -1
- package/dist/{chunk-VUAVE3QC.js → chunk-3FRLWYBG.js} +36 -36
- package/dist/{chunk-THEXI2QO.js → chunk-3K2F6UDZ.js} +42 -42
- package/dist/{chunk-ZPJM7DID.js → chunk-3YY7IXIL.js} +3 -3
- package/dist/chunk-46TNM7XZ.js +88 -0
- package/dist/{chunk-TL2TCJYL.js → chunk-4L36HG27.js} +14 -14
- package/dist/{chunk-UCVMSOXF.js → chunk-4LM3VAZH.js} +2 -2
- package/dist/{chunk-AI3GP74G.js → chunk-4LOE5R5P.js} +15 -15
- package/dist/{chunk-AHWA4AKM.js → chunk-4YHYPW2G.js} +32 -9
- package/dist/{chunk-VITFDI3O.js → chunk-4ZYJHQMB.js} +12 -12
- package/dist/{chunk-KCBRHV5E.js → chunk-6IR3ZYIB.js} +3 -3
- package/dist/chunk-72OKUXSD.js +31 -0
- package/dist/{chunk-RCHO5W7M.js → chunk-75GAYVNO.js} +13 -12
- package/dist/{chunk-2SDHYHHO.js → chunk-7E2563GA.js} +13 -13
- package/dist/chunk-7GLOLOSH.js +57 -0
- package/dist/{chunk-CG5V25HX.js → chunk-ABPKUVA4.js} +1 -1
- package/dist/chunk-AKUUMGD5.js +26 -0
- package/dist/chunk-ASUXV767.js +22 -0
- package/dist/{chunk-Q42LJANT.js → chunk-AWDSEDER.js} +2 -2
- package/dist/{chunk-Y2TPADJR.js → chunk-BZARLRJW.js} +9 -9
- package/dist/{chunk-YKVDBNPO.js → chunk-CB4WHS4H.js} +3 -3
- package/dist/{chunk-YXGRRORB.js → chunk-CCV2EU7T.js} +13 -13
- package/dist/{chunk-PJXNTPB2.js → chunk-CE6VMBCB.js} +21 -21
- package/dist/{chunk-KPVLQHCZ.js → chunk-CPSR3AVL.js} +2 -2
- package/dist/chunk-CTADOKYM.js +25 -0
- package/dist/{chunk-CPZ5JJW6.js → chunk-DH5JPM3K.js} +4 -4
- package/dist/{chunk-4FHUGDKU.js → chunk-DPGEAHZT.js} +5 -5
- package/dist/{chunk-SNEUMLM7.js → chunk-DQZFQSR5.js} +4 -4
- package/dist/{chunk-RG3MXTRI.js → chunk-E7HJ56Y7.js} +7 -7
- package/dist/{chunk-YSDPVDFC.js → chunk-EAOK7MIZ.js} +3 -3
- package/dist/{chunk-PP2A5V2T.js → chunk-EKWX4WD3.js} +7 -7
- package/dist/{chunk-2LDMXL2M.js → chunk-F5Z6URKM.js} +2 -2
- package/dist/{chunk-72J27ICO.js → chunk-F6X3YJWD.js} +2 -2
- package/dist/{chunk-ELZRSR5N.js → chunk-F7K5IBZG.js} +41 -39
- package/dist/{chunk-EX4EXBW7.js → chunk-FB5SCCPT.js} +15 -15
- package/dist/{chunk-SJHC3BCZ.js → chunk-FZKFVUEC.js} +518 -233
- package/dist/{chunk-UVY4TOJH.js → chunk-GNSIWBAT.js} +3 -3
- package/dist/{chunk-EXVXBSGN.js → chunk-H7OR7DFZ.js} +20 -18
- package/dist/{chunk-NLIVE7L6.js → chunk-HO6LWE2E.js} +1 -1
- package/dist/{chunk-X3UTCXAA.js → chunk-HR3OJ3TH.js} +12 -12
- package/dist/{chunk-HYVXA3BB.js → chunk-HWDAVBFU.js} +23 -23
- package/dist/{chunk-ZSUX7KEM.js → chunk-J6JP25XU.js} +2 -2
- package/dist/{chunk-T4NGVFYI.js → chunk-JJ2RRESP.js} +8 -5
- package/dist/{chunk-RU34BA4D.js → chunk-JMEKXFOL.js} +34 -34
- package/dist/{chunk-IL7K66ZQ.js → chunk-KDX35VXP.js} +74 -18
- package/dist/{chunk-EDMLIW6W.js → chunk-KKCK636N.js} +12 -12
- package/dist/{chunk-KJJAVH3X.js → chunk-KPPJTH44.js} +6 -5
- package/dist/{chunk-5LRUKYFA.js → chunk-KW5JQPO5.js} +2 -2
- package/dist/{chunk-N3PLNNCW.js → chunk-KXF5R4UN.js} +1 -1
- package/dist/{chunk-YWNO5Q4R.js → chunk-L3CMBQMH.js} +17 -17
- package/dist/{chunk-YWWG4AQA.js → chunk-L5JYIU47.js} +24 -25
- package/dist/{chunk-K2GUZ4DN.js → chunk-LBLBAFG3.js} +4 -4
- package/dist/{chunk-APFJKOP6.js → chunk-LLS45EWB.js} +10 -2
- package/dist/{chunk-MKPCELNI.js → chunk-LS3QJRUB.js} +13 -13
- package/dist/chunk-LSC3VADM.js +23 -0
- package/dist/{chunk-F7BO6FWH.js → chunk-LUBPZN36.js} +11 -11
- package/dist/{chunk-ASRAO7KG.js → chunk-LV4UMYVH.js} +27 -27
- package/dist/{chunk-COOUUC5W.js → chunk-MB6PXBUA.js} +6 -6
- package/dist/{chunk-3WCEHYOI.js → chunk-MNJIXFX4.js} +1 -1
- package/dist/{chunk-FEDWAYDS.js → chunk-MPKRJBPK.js} +35 -15
- package/dist/{chunk-Q4BKKOVC.js → chunk-N5WSK2K7.js} +8 -8
- package/dist/{chunk-K4SZB56V.js → chunk-NA7SEXHE.js} +12 -8
- package/dist/{chunk-UL5SXQVX.js → chunk-O4BJFESU.js} +1 -1
- package/dist/{chunk-LMCTHJ2H.js → chunk-OE5ZBP7F.js} +18 -18
- package/dist/{chunk-NFNVDDGB.js → chunk-OSTKYB55.js} +1 -1
- package/dist/{chunk-27VWVB23.js → chunk-OXOI55RU.js} +10 -10
- package/dist/{chunk-7IYC4ENJ.js → chunk-PKES3ISE.js} +2 -2
- package/dist/{chunk-EWXXLS26.js → chunk-PQJFG24Z.js} +82 -12
- package/dist/{chunk-3SNDVPOR.js → chunk-PR6PO3ES.js} +8 -8
- package/dist/{chunk-63NMUNYP.js → chunk-PUZ3E2J4.js} +6 -6
- package/dist/{chunk-DS2USX5G.js → chunk-QHSNL7B2.js} +11 -11
- package/dist/{chunk-UO66IMVP.js → chunk-QOE342SU.js} +2 -2
- package/dist/{chunk-7ZS7MC24.js → chunk-R5MOQM2H.js} +107 -40
- package/dist/{chunk-JWOVP5BL.js → chunk-RC2Z6K47.js} +6 -6
- package/dist/{chunk-GLW3YDZZ.js → chunk-RORGS5II.js} +9 -9
- package/dist/{chunk-Y5KTA2OB.js → chunk-RQS4QQSD.js} +2 -2
- package/dist/{chunk-KFXCL4OV.js → chunk-RRV3FNNM.js} +22 -23
- package/dist/{chunk-GYRZ72R4.js → chunk-RZOXUSPC.js} +2 -2
- package/dist/chunk-SHLDT3OI.js +27 -0
- package/dist/{chunk-IEBJF3PN.js → chunk-SNDXCFRS.js} +15 -13
- package/dist/{chunk-XHLK33VM.js → chunk-T7A2HK2B.js} +16 -16
- package/dist/{chunk-WUY4BZEP.js → chunk-TIQJPRDD.js} +106 -50
- package/dist/{chunk-2FYKETQJ.js → chunk-U2SDMG7C.js} +5 -5
- package/dist/{chunk-EIKRZ32J.js → chunk-U5HPROLA.js} +2 -2
- package/dist/{chunk-2Y6OJRSI.js → chunk-U6VN4NVL.js} +3 -3
- package/dist/{chunk-OZNCKLOX.js → chunk-U7BD2QL7.js} +12 -12
- package/dist/chunk-UF7RTZSO.js +27 -0
- package/dist/{chunk-XHDBJODR.js → chunk-URCQWAQ4.js} +21 -21
- package/dist/{chunk-7FLRUH6B.js → chunk-V63BC55Q.js} +1 -1
- package/dist/{chunk-TVZRLTG6.js → chunk-VSFLRN5Y.js} +1 -1
- package/dist/{chunk-OMJ3OFBJ.js → chunk-VUZWQ7UG.js} +6 -6
- package/dist/chunk-W4WP2ERB.js +30 -0
- package/dist/{chunk-G224FADB.js → chunk-WDBICWH3.js} +1 -1
- package/dist/{chunk-4ODSZ35Z.js → chunk-WGRJOXED.js} +121 -155
- package/dist/{chunk-FWZRGGGY.js → chunk-WME2OQST.js} +39 -4
- package/dist/{chunk-MEFLGBCS.js → chunk-XT2HTCJ5.js} +3 -3
- package/dist/{chunk-VIDEKABZ.js → chunk-Y7F7IEE3.js} +55 -23
- package/dist/chunk-YES5CACN.js +73 -0
- package/dist/{chunk-ZAPSUBLU.js → chunk-YHC2O2WO.js} +7 -7
- package/dist/{chunk-GTDSYEA2.js → chunk-YISME6ON.js} +1 -1
- package/dist/{chunk-TPYYEDP5.js → chunk-YVHBNSME.js} +48 -29
- package/dist/{chunk-XWFIHYCH.js → chunk-Z2XAOKHK.js} +2 -2
- package/dist/{chunk-QT66NEYN.js → chunk-ZE3KXHS7.js} +3 -3
- package/dist/{chunk-S55TEC7I.js → chunk-ZGSJDWQU.js} +2 -2
- package/dist/{chunk-4U7GDSZQ.js → chunk-ZJTT47IG.js} +2 -2
- package/dist/{chunk-KX56K73G.js → chunk-ZKXQKGWZ.js} +2 -2
- package/dist/{chunk-5DKE4HGX.js → chunk-ZMAUPOMG.js} +34 -34
- package/dist/index.js +2446 -1303
- package/dist/mcp/analyze-cli.js +10 -10
- package/dist/mcp/cli.js +42 -42
- package/dist/mcp/server.js +724 -472
- package/dist/mcp/worker.js +61 -61
- package/dist/probes/installer.js +19 -19
- package/docs/agent-tools.md +39 -10
- package/docs/configuration.md +3 -1
- package/docs/defect-shapes.md +752 -0
- 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/caches-stores.md +30 -0
- package/docs/invariants/dispatch-runners.md +164 -0
- package/docs/invariants/git-guard-host.md +87 -0
- package/docs/invariants/language-config.md +31 -0
- package/docs/invariants/lsp-trust-exec.md +292 -0
- package/docs/invariants/paths-os.md +59 -0
- package/docs/invariants/session-telemetry.md +114 -0
- package/docs/lsp-capability-matrix.md +89 -45
- package/docs/lsp-idle-eviction.md +3 -5
- package/docs/pi-lens-fixer.md +10 -2
- package/docs/pi-lens-merge-policy.md +17 -12
- package/docs/pi-lens-monitor.md +2 -2
- package/docs/pi-lens-orchestration.md +41 -0
- package/docs/pi-lens-release.md +20 -0
- package/docs/pi-lens-retro.md +3 -2
- package/docs/pi-lens-reviewer.md +6 -6
- package/docs/pi-lens-subagent.md +9 -6
- 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 +3 -2
- package/dist/chunk-22Y2BM7H.js +0 -23
- package/dist/chunk-44X7VIKR.js +0 -73
- package/dist/chunk-54NIOJJZ.js +0 -25
- package/dist/chunk-7WWQAW5P.js +0 -30
- package/dist/chunk-EA2ZRG44.js +0 -27
- package/dist/chunk-EKNWOL2I.js +0 -27
- package/dist/chunk-G5UCJFT7.js +0 -26
- package/dist/chunk-N5FBM25N.js +0 -22
- package/dist/chunk-P5XUGPIX.js +0 -31
- package/dist/chunk-PKOXJIVT.js +0 -88
- package/dist/chunk-RG7OODGM.js +0 -57
|
@@ -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,24 +38,24 @@ 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,
|
|
55
55
|
getOwnedLspService,
|
|
56
56
|
peekOwnedLspService,
|
|
57
57
|
resetOwnedLspService
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-F5Z6URKM.js";
|
|
59
59
|
import {
|
|
60
60
|
collectForwardImportMtimes,
|
|
61
61
|
exceedsLspSyncLimits,
|
|
@@ -69,15 +69,15 @@ 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
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-TIQJPRDD.js";
|
|
76
76
|
import {
|
|
77
77
|
EXTENSION_TO_LSP_ID,
|
|
78
78
|
lspLanguageId,
|
|
79
79
|
resolveFilenameLanguage
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-YISME6ON.js";
|
|
81
81
|
import {
|
|
82
82
|
HOOK_WALL_BUDGET_MS
|
|
83
83
|
} from "./chunk-CKEQFGLT.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,34 +125,34 @@ 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";
|
|
131
132
|
import {
|
|
132
133
|
SPECIAL_FILENAMES,
|
|
133
134
|
getLanguageId
|
|
134
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-RZOXUSPC.js";
|
|
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
|
-
} from "./chunk-
|
|
155
|
+
} from "./chunk-KXF5R4UN.js";
|
|
155
156
|
import {
|
|
156
157
|
freshnessFromMtime
|
|
157
158
|
} from "./chunk-S26LC76R.js";
|
|
@@ -159,7 +160,7 @@ import {
|
|
|
159
160
|
logLatency,
|
|
160
161
|
phaseFinished,
|
|
161
162
|
phaseStarted
|
|
162
|
-
} from "./chunk-
|
|
163
|
+
} from "./chunk-Z2XAOKHK.js";
|
|
163
164
|
import {
|
|
164
165
|
createNdjsonLogger,
|
|
165
166
|
getGlobalPiLensLogDir,
|
|
@@ -167,7 +168,7 @@ import {
|
|
|
167
168
|
getProcessSingleton,
|
|
168
169
|
isTestMode,
|
|
169
170
|
nextModuleEvaluationOrdinal
|
|
170
|
-
} from "./chunk-
|
|
171
|
+
} from "./chunk-VSFLRN5Y.js";
|
|
171
172
|
import {
|
|
172
173
|
BoundedFifoMap,
|
|
173
174
|
BoundedLruCache,
|
|
@@ -175,16 +176,19 @@ import {
|
|
|
175
176
|
isAtOrAboveHomeDir,
|
|
176
177
|
isUnderDir,
|
|
177
178
|
isWindowsPath,
|
|
179
|
+
kernelPathIdentityAsync,
|
|
178
180
|
minimatch,
|
|
179
181
|
normalizeEphemeralMapKey,
|
|
180
182
|
normalizeFilePath,
|
|
181
183
|
normalizeMapKey,
|
|
182
184
|
pathsEqual,
|
|
185
|
+
realpathOrResolve,
|
|
186
|
+
realpathOrResolveAsync,
|
|
183
187
|
toPosix,
|
|
184
188
|
toProjectRelativePath,
|
|
185
189
|
uriToDiskPath,
|
|
186
190
|
uriToPath
|
|
187
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-PQJFG24Z.js";
|
|
188
192
|
import {
|
|
189
193
|
__commonJS,
|
|
190
194
|
__require,
|
|
@@ -1407,8 +1411,8 @@ var require_semaphore = __commonJS({
|
|
|
1407
1411
|
this._waiting = [];
|
|
1408
1412
|
}
|
|
1409
1413
|
lock(thunk) {
|
|
1410
|
-
return new Promise((
|
|
1411
|
-
this._waiting.push({ thunk, resolve:
|
|
1414
|
+
return new Promise((resolve8, reject) => {
|
|
1415
|
+
this._waiting.push({ thunk, resolve: resolve8, reject });
|
|
1412
1416
|
this.runNext();
|
|
1413
1417
|
});
|
|
1414
1418
|
}
|
|
@@ -3034,9 +3038,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
3034
3038
|
if (typeof cancellationStrategy.sender.enableCancellation === "function") {
|
|
3035
3039
|
cancellationStrategy.sender.enableCancellation(requestMessage);
|
|
3036
3040
|
}
|
|
3037
|
-
return new Promise(async (
|
|
3041
|
+
return new Promise(async (resolve8, reject) => {
|
|
3038
3042
|
const resolveWithCleanup = (r) => {
|
|
3039
|
-
|
|
3043
|
+
resolve8(r);
|
|
3040
3044
|
cancellationStrategy.sender.cleanup(id);
|
|
3041
3045
|
disposable?.dispose();
|
|
3042
3046
|
};
|
|
@@ -3465,10 +3469,10 @@ var require_ril = __commonJS({
|
|
|
3465
3469
|
return api_1.Disposable.create(() => this.stream.off("end", listener));
|
|
3466
3470
|
}
|
|
3467
3471
|
write(data, encoding) {
|
|
3468
|
-
return new Promise((
|
|
3472
|
+
return new Promise((resolve8, reject) => {
|
|
3469
3473
|
const callback = (error) => {
|
|
3470
3474
|
if (error === void 0 || error === null) {
|
|
3471
|
-
|
|
3475
|
+
resolve8();
|
|
3472
3476
|
} else {
|
|
3473
3477
|
reject(error);
|
|
3474
3478
|
}
|
|
@@ -3605,7 +3609,7 @@ var require_main = __commonJS({
|
|
|
3605
3609
|
var ril_1 = __importDefault(require_ril());
|
|
3606
3610
|
ril_1.default.install();
|
|
3607
3611
|
var path18 = __importStar(__require("path"));
|
|
3608
|
-
var
|
|
3612
|
+
var os3 = __importStar(__require("os"));
|
|
3609
3613
|
var fs14 = __importStar(__require("fs"));
|
|
3610
3614
|
var crypto_1 = __require("crypto");
|
|
3611
3615
|
var net_1 = __require("net");
|
|
@@ -3747,7 +3751,7 @@ var require_main = __commonJS({
|
|
|
3747
3751
|
}
|
|
3748
3752
|
let randomLength = 32;
|
|
3749
3753
|
const fixedLength = "/lsp-.sock".length;
|
|
3750
|
-
const tmpDir = fs14.realpathSync(XDG_RUNTIME_DIR ??
|
|
3754
|
+
const tmpDir = fs14.realpathSync(XDG_RUNTIME_DIR ?? os3.tmpdir());
|
|
3751
3755
|
const limit = safeIpcPathLengths.get(process.platform);
|
|
3752
3756
|
if (limit !== void 0) {
|
|
3753
3757
|
randomLength = Math.min(limit - tmpDir.length - fixedLength, randomLength);
|
|
@@ -3760,10 +3764,10 @@ var require_main = __commonJS({
|
|
|
3760
3764
|
}
|
|
3761
3765
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
3762
3766
|
let connectResolve;
|
|
3763
|
-
const connected = new Promise((
|
|
3764
|
-
connectResolve =
|
|
3767
|
+
const connected = new Promise((resolve8, _reject) => {
|
|
3768
|
+
connectResolve = resolve8;
|
|
3765
3769
|
});
|
|
3766
|
-
return new Promise((
|
|
3770
|
+
return new Promise((resolve8, reject) => {
|
|
3767
3771
|
const server = (0, net_1.createServer)((socket) => {
|
|
3768
3772
|
server.close();
|
|
3769
3773
|
connectResolve([
|
|
@@ -3774,7 +3778,7 @@ var require_main = __commonJS({
|
|
|
3774
3778
|
server.on("error", reject);
|
|
3775
3779
|
server.listen(pipeName, () => {
|
|
3776
3780
|
server.removeListener("error", reject);
|
|
3777
|
-
|
|
3781
|
+
resolve8({
|
|
3778
3782
|
onConnected: () => {
|
|
3779
3783
|
return connected;
|
|
3780
3784
|
}
|
|
@@ -3791,10 +3795,10 @@ var require_main = __commonJS({
|
|
|
3791
3795
|
}
|
|
3792
3796
|
function createClientSocketTransport(port, encoding = "utf-8") {
|
|
3793
3797
|
let connectResolve;
|
|
3794
|
-
const connected = new Promise((
|
|
3795
|
-
connectResolve =
|
|
3798
|
+
const connected = new Promise((resolve8, _reject) => {
|
|
3799
|
+
connectResolve = resolve8;
|
|
3796
3800
|
});
|
|
3797
|
-
return new Promise((
|
|
3801
|
+
return new Promise((resolve8, reject) => {
|
|
3798
3802
|
const server = (0, net_1.createServer)((socket) => {
|
|
3799
3803
|
server.close();
|
|
3800
3804
|
connectResolve([
|
|
@@ -3811,7 +3815,7 @@ var require_main = __commonJS({
|
|
|
3811
3815
|
return;
|
|
3812
3816
|
}
|
|
3813
3817
|
const boundPort = address.port;
|
|
3814
|
-
|
|
3818
|
+
resolve8({
|
|
3815
3819
|
port: () => boundPort,
|
|
3816
3820
|
onConnected: () => {
|
|
3817
3821
|
return connected;
|
|
@@ -3855,9 +3859,84 @@ var CASCADE_DIAGNOSTICS_TTL_MS = 24e4;
|
|
|
3855
3859
|
// dist/clients/lsp/index.js
|
|
3856
3860
|
import * as nodeFs2 from "node:fs";
|
|
3857
3861
|
import fs13 from "node:fs/promises";
|
|
3862
|
+
import os2 from "node:os";
|
|
3858
3863
|
import path17 from "node:path";
|
|
3859
3864
|
import { pathToFileURL as pathToFileURL3, URL as URL3 } from "node:url";
|
|
3860
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
|
+
|
|
3861
3940
|
// dist/clients/lsp/workspace-diagnostics-session.js
|
|
3862
3941
|
var _sessionStartedAt = Date.now();
|
|
3863
3942
|
function resetWorkspaceDiagnosticsCacheSession(startedAt = Date.now()) {
|
|
@@ -3885,6 +3964,9 @@ function noteWorkspaceFileCreated(serverId, root, paths, at = Date.now()) {
|
|
|
3885
3964
|
}
|
|
3886
3965
|
}
|
|
3887
3966
|
}
|
|
3967
|
+
function noteWorkspaceFilesChangedOnDisk(root, paths, at = Date.now()) {
|
|
3968
|
+
noteWorkspaceFileCreated("", root, paths, at);
|
|
3969
|
+
}
|
|
3888
3970
|
function workspaceFileCreatedAtFor(fromServer, holds, counts = () => true) {
|
|
3889
3971
|
let latest = _allFilesChangedAt;
|
|
3890
3972
|
for (const creation of _fileCreations.values()) {
|
|
@@ -3952,7 +4034,7 @@ async function importTargetsToAnnounce(cwd, importers, onScope) {
|
|
|
3952
4034
|
reason: `resolved the imports of ${CREATED_IMPORT_SCAN_MAX_FILES} of ${importers.length} files in one diagnostics call`
|
|
3953
4035
|
});
|
|
3954
4036
|
}
|
|
3955
|
-
const { extractForwardImports } = await import("./chunk-
|
|
4037
|
+
const { extractForwardImports } = await import("./chunk-URCQWAQ4.js");
|
|
3956
4038
|
const targets = /* @__PURE__ */ new Set();
|
|
3957
4039
|
const reexports = /* @__PURE__ */ new Map();
|
|
3958
4040
|
let resolved2 = 0;
|
|
@@ -4396,18 +4478,50 @@ var AUXILIARY_LSP_PROFILES = [
|
|
|
4396
4478
|
// A misspelling is a documentation/quality defect — not security or
|
|
4397
4479
|
// correctness. "style" is the closest taxonomy class.
|
|
4398
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
|
+
}
|
|
4399
4504
|
}
|
|
4400
4505
|
];
|
|
4506
|
+
function isOptInAuxiliaryServerId(serverId) {
|
|
4507
|
+
return AUXILIARY_LSP_PROFILES.some((p) => p.serverId === serverId && !p.enabledByDefault);
|
|
4508
|
+
}
|
|
4401
4509
|
function enabledAuxiliaryLspServerIds(getFlag) {
|
|
4402
4510
|
if (shouldDegradeAuxiliaryLsp() || isSubagentSession())
|
|
4403
4511
|
return [];
|
|
4404
4512
|
return AUXILIARY_LSP_PROFILES.flatMap((p) => isEnabledByConfiguration(p, getFlag) ? [p.serverId] : []);
|
|
4405
4513
|
}
|
|
4406
4514
|
function configDisabledAuxiliaryLspServerIds(getFlag) {
|
|
4407
|
-
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] : []));
|
|
4408
4519
|
}
|
|
4409
4520
|
function isEnabledByConfiguration(profile, getFlag) {
|
|
4410
|
-
|
|
4521
|
+
if (!profile.enabledByDefault) {
|
|
4522
|
+
return profile.optInFlag !== void 0 && getFlag(profile.optInFlag) === true;
|
|
4523
|
+
}
|
|
4524
|
+
return !(profile.killSwitchFlag && getFlag(profile.killSwitchFlag) === true);
|
|
4411
4525
|
}
|
|
4412
4526
|
var profileForSourceCache = /* @__PURE__ */ new Map();
|
|
4413
4527
|
function findAuxiliaryProfileForSource(source) {
|
|
@@ -4424,6 +4538,16 @@ function isAuxiliaryDiagnosticSuppressed(d, content) {
|
|
|
4424
4538
|
const profile = findAuxiliaryProfileForSource(d.source);
|
|
4425
4539
|
return Boolean(profile?.isSuppressed?.(d, content));
|
|
4426
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
|
+
}
|
|
4427
4551
|
function applyAuxiliarySuppressions(diagnostics, content, opts) {
|
|
4428
4552
|
const { filePath, scanRoot } = opts ?? {};
|
|
4429
4553
|
const ruleIgnores = filePath && scanRoot ? loadRuleIgnorePatterns(scanRoot) : void 0;
|
|
@@ -4717,9 +4841,12 @@ var DocumentDriftTracker = class {
|
|
|
4717
4841
|
return SKIPPED;
|
|
4718
4842
|
}
|
|
4719
4843
|
}
|
|
4720
|
-
|
|
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));
|
|
4721
4848
|
}
|
|
4722
|
-
async runSweep(deps, now) {
|
|
4849
|
+
async runSweep(deps, now, full = false) {
|
|
4723
4850
|
this.lastSweepAt = now();
|
|
4724
4851
|
const stat3 = deps.stat ?? defaultStat;
|
|
4725
4852
|
const read = deps.read ?? defaultRead;
|
|
@@ -4728,8 +4855,10 @@ var DocumentDriftTracker = class {
|
|
|
4728
4855
|
const tracked = keys.length;
|
|
4729
4856
|
if (this.cursor >= tracked)
|
|
4730
4857
|
this.cursor = 0;
|
|
4858
|
+
const checkBatch = full ? tracked : DRIFT_CHECK_BATCH;
|
|
4859
|
+
const resyncBatch = full ? Number.POSITIVE_INFINITY : DRIFT_RESYNC_BATCH;
|
|
4731
4860
|
const window = [];
|
|
4732
|
-
for (let i = 0; i < Math.min(
|
|
4861
|
+
for (let i = 0; i < Math.min(checkBatch, tracked); i++) {
|
|
4733
4862
|
window.push(keys[(this.cursor + i) % tracked]);
|
|
4734
4863
|
}
|
|
4735
4864
|
this.cursor = tracked === 0 ? 0 : (this.cursor + window.length) % tracked;
|
|
@@ -4810,7 +4939,7 @@ var DocumentDriftTracker = class {
|
|
|
4810
4939
|
for (const key of queued) {
|
|
4811
4940
|
if (!this.pendingResync.has(key))
|
|
4812
4941
|
continue;
|
|
4813
|
-
if (resynced >=
|
|
4942
|
+
if (resynced >= resyncBatch) {
|
|
4814
4943
|
deferred += 1;
|
|
4815
4944
|
queuedDispositions.set(key, "deferred");
|
|
4816
4945
|
deps.onDrift?.({
|
|
@@ -4866,7 +4995,7 @@ var DocumentDriftTracker = class {
|
|
|
4866
4995
|
if (resyncedKeys.has(key))
|
|
4867
4996
|
continue;
|
|
4868
4997
|
const driftAgeMs = Math.max(0, now() - record2.syncedAt);
|
|
4869
|
-
if (resynced >=
|
|
4998
|
+
if (resynced >= resyncBatch) {
|
|
4870
4999
|
deferred += 1;
|
|
4871
5000
|
deps.onDrift?.({
|
|
4872
5001
|
filePath: key,
|
|
@@ -5072,8 +5201,6 @@ function resetPendingAuxiliaryCoverage() {
|
|
|
5072
5201
|
import * as path7 from "node:path";
|
|
5073
5202
|
|
|
5074
5203
|
// dist/clients/file-mutation-queue.js
|
|
5075
|
-
import { realpath } from "node:fs/promises";
|
|
5076
|
-
import { resolve as resolve2 } from "node:path";
|
|
5077
5204
|
var loadHostSdk;
|
|
5078
5205
|
var hostQueue;
|
|
5079
5206
|
var hostSessionManager;
|
|
@@ -5109,13 +5236,10 @@ function withHostFileMutationQueue(filePath, fn) {
|
|
|
5109
5236
|
const loader = loadHostSdk;
|
|
5110
5237
|
if (!loader)
|
|
5111
5238
|
return fn();
|
|
5112
|
-
return resolveHostQueue(loader).then((queue) => queue ?
|
|
5239
|
+
return resolveHostQueue(loader).then((queue) => queue ? realpathOrResolveAsync(filePath).then((key) => queue(key, fn)) : fn());
|
|
5113
5240
|
}
|
|
5114
5241
|
async function withHostFileMutationQueues(filePaths, fn) {
|
|
5115
|
-
const keys = await Promise.all(filePaths.map((filePath) =>
|
|
5116
|
-
const resolvedPath = resolve2(filePath);
|
|
5117
|
-
return realpath(resolvedPath).catch(() => resolvedPath);
|
|
5118
|
-
}));
|
|
5242
|
+
const keys = await Promise.all(filePaths.map((filePath) => realpathOrResolveAsync(filePath)));
|
|
5119
5243
|
return [...new Set(keys)].sort(compareOrdinal).reduceRight((inner, key) => () => withHostFileMutationQueue(key, inner), fn)();
|
|
5120
5244
|
}
|
|
5121
5245
|
|
|
@@ -5453,6 +5577,8 @@ var Scope = class {
|
|
|
5453
5577
|
retiredReason;
|
|
5454
5578
|
/** The scope's store cells, by key (#3612); see {@link scopeCell}. */
|
|
5455
5579
|
cells = /* @__PURE__ */ new Map();
|
|
5580
|
+
/** The lookup keys {@link bindSessionId} bound to this scope. */
|
|
5581
|
+
boundKeys = /* @__PURE__ */ new Set();
|
|
5456
5582
|
// The stale-write record keeps its `runtime-session:<subject>` subject.
|
|
5457
5583
|
life = createGenerationSource("runtime-session");
|
|
5458
5584
|
branch = createGenerationSource("session-branch");
|
|
@@ -5477,6 +5603,7 @@ var Scope = class {
|
|
|
5477
5603
|
return;
|
|
5478
5604
|
this.retiredReason = reason ?? "shutdown";
|
|
5479
5605
|
this.life.bump();
|
|
5606
|
+
unbindScope(this);
|
|
5480
5607
|
}
|
|
5481
5608
|
moveBranch() {
|
|
5482
5609
|
this.branch.bump();
|
|
@@ -5537,6 +5664,34 @@ function logScopeTransition(scope, args) {
|
|
|
5537
5664
|
}
|
|
5538
5665
|
});
|
|
5539
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
|
+
}
|
|
5540
5695
|
var sessionStores = /* @__PURE__ */ new Map();
|
|
5541
5696
|
function defineSessionStore(spec) {
|
|
5542
5697
|
if (sessionStores.has(spec.name))
|
|
@@ -6927,6 +7082,15 @@ Re-read the relevant section, then retry the edit using the current line range/c
|
|
|
6927
7082
|
moveBranch(this.scope);
|
|
6928
7083
|
return result;
|
|
6929
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
|
+
}
|
|
6930
7094
|
/** The epoch a deferred writer captures before it awaits (#3521). */
|
|
6931
7095
|
get currentBranchEpoch() {
|
|
6932
7096
|
return this.scope.branchEpoch();
|
|
@@ -7526,9 +7690,11 @@ function getOpaqueBaselineStore() {
|
|
|
7526
7690
|
return created;
|
|
7527
7691
|
}
|
|
7528
7692
|
var gitRepoMemo = /* @__PURE__ */ new Map();
|
|
7693
|
+
var overCapRootMemo = new BoundedFifoMap(16);
|
|
7529
7694
|
function resetOpaqueMutationState() {
|
|
7530
7695
|
getOpaqueBaselineStore().takeAllForTest();
|
|
7531
7696
|
gitRepoMemo.clear();
|
|
7697
|
+
overCapRootMemo.clear();
|
|
7532
7698
|
gitToplevelMemo.clear();
|
|
7533
7699
|
headRecords.clear();
|
|
7534
7700
|
headLooks.clear();
|
|
@@ -7893,6 +8059,8 @@ function bookkeepLspMutation(context, files2, fileDetails) {
|
|
|
7893
8059
|
source: context.source,
|
|
7894
8060
|
cwd: context.cwd,
|
|
7895
8061
|
changedRange: detail.range,
|
|
8062
|
+
// #4943: the issuing activation's change-log row.
|
|
8063
|
+
sessionId: context.sessionId,
|
|
7896
8064
|
onAppendError: (err) => context.dbg?.(`lsp mutation project change append failed for ${filePath}: ${err}`)
|
|
7897
8065
|
});
|
|
7898
8066
|
if (sessionLive && context.cacheManager) {
|
|
@@ -8144,11 +8312,27 @@ function createDiskBindingCache() {
|
|
|
8144
8312
|
};
|
|
8145
8313
|
}
|
|
8146
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
|
+
|
|
8147
8328
|
// dist/clients/lsp/grouping.js
|
|
8329
|
+
function aggregateServersForFile(filePath) {
|
|
8330
|
+
return getServersForFileWithConfig(filePath).flatMap((s) => isOptInAuxiliaryServerId(s.id) ? [] : [s]);
|
|
8331
|
+
}
|
|
8148
8332
|
function groupFilesByPrimaryServer(files2) {
|
|
8149
8333
|
const byServer = /* @__PURE__ */ new Map();
|
|
8150
8334
|
for (const filePath of files2) {
|
|
8151
|
-
const servers =
|
|
8335
|
+
const servers = aggregateServersForFile(filePath);
|
|
8152
8336
|
const primary = servers[0]?.id ?? "none";
|
|
8153
8337
|
const group = byServer.get(primary);
|
|
8154
8338
|
const fallbackFamilyHeads = /* @__PURE__ */ new Map();
|
|
@@ -8317,7 +8501,7 @@ function resyncDocumentOnPastEof(filePath) {
|
|
|
8317
8501
|
void (async () => {
|
|
8318
8502
|
try {
|
|
8319
8503
|
const [{ getOwnedLspService: getOwnedLspService2 }, content] = await Promise.all([
|
|
8320
|
-
import("./chunk-
|
|
8504
|
+
import("./chunk-2PHMIAKO.js"),
|
|
8321
8505
|
fs7.promises.readFile(filePath, "utf-8")
|
|
8322
8506
|
]);
|
|
8323
8507
|
await getOwnedLspService2().openFile(filePath, content, { preserveDiagnostics: false });
|
|
@@ -9296,14 +9480,14 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
|
|
|
9296
9480
|
const languageCount = promises3.length - auxIndices.size;
|
|
9297
9481
|
let languageRemaining = languageCount;
|
|
9298
9482
|
let auxGraceStarted = false;
|
|
9299
|
-
return new Promise((
|
|
9483
|
+
return new Promise((resolve8) => {
|
|
9300
9484
|
const timeout = setTimeout(() => {
|
|
9301
9485
|
completed = true;
|
|
9302
9486
|
if (graceTimer)
|
|
9303
9487
|
clearTimeout(graceTimer);
|
|
9304
9488
|
if (auxGraceTimer)
|
|
9305
9489
|
clearTimeout(auxGraceTimer);
|
|
9306
|
-
|
|
9490
|
+
resolve8(results.filter((r) => r !== void 0));
|
|
9307
9491
|
}, options.timeoutMs);
|
|
9308
9492
|
const finalize = () => {
|
|
9309
9493
|
if (completed)
|
|
@@ -9314,7 +9498,7 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
|
|
|
9314
9498
|
clearTimeout(graceTimer);
|
|
9315
9499
|
if (auxGraceTimer)
|
|
9316
9500
|
clearTimeout(auxGraceTimer);
|
|
9317
|
-
|
|
9501
|
+
resolve8(results.filter((r) => r !== void 0));
|
|
9318
9502
|
};
|
|
9319
9503
|
const startAuxGrace = () => {
|
|
9320
9504
|
if (auxGraceStarted || completed)
|
|
@@ -9374,7 +9558,7 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
|
|
|
9374
9558
|
|
|
9375
9559
|
// dist/clients/lsp/edits.js
|
|
9376
9560
|
import fs10 from "node:fs/promises";
|
|
9377
|
-
import { readFileSync as readFileSync8, realpathSync
|
|
9561
|
+
import { readFileSync as readFileSync8, realpathSync, statSync as statSync8 } from "node:fs";
|
|
9378
9562
|
import path10 from "node:path";
|
|
9379
9563
|
import { URL as URL2 } from "node:url";
|
|
9380
9564
|
|
|
@@ -9401,80 +9585,6 @@ function convertCharacterOffset(encoding, lineText, utf16Character) {
|
|
|
9401
9585
|
return [...prefix].length;
|
|
9402
9586
|
}
|
|
9403
9587
|
|
|
9404
|
-
// dist/clients/lsp/watch-queue.js
|
|
9405
|
-
var WATCH_DEBOUNCE_MS = 100;
|
|
9406
|
-
var FILE_CREATED = 1;
|
|
9407
|
-
var FILE_CHANGED = 2;
|
|
9408
|
-
var FILE_DELETED = 3;
|
|
9409
|
-
var WATCH_BIRTH_MARGIN_MS = 100;
|
|
9410
|
-
function watchedTypeForOpen(birthtimeMs, clientStartedAtMs = Number.POSITIVE_INFINITY) {
|
|
9411
|
-
return birthtimeMs >= clientStartedAtMs - WATCH_BIRTH_MARGIN_MS ? FILE_CREATED : FILE_CHANGED;
|
|
9412
|
-
}
|
|
9413
|
-
var WatchedFilesQueue = class {
|
|
9414
|
-
flushFn;
|
|
9415
|
-
debounceMs;
|
|
9416
|
-
onCreated;
|
|
9417
|
-
// uri → latest FileChangeType. A Map collapses repeated events for the same
|
|
9418
|
-
// URI (last-type-wins, except Created is never downgraded to Changed inside
|
|
9419
|
-
// one window — #4320) while preserving first-seen insertion order.
|
|
9420
|
-
pending = /* @__PURE__ */ new Map();
|
|
9421
|
-
timer = null;
|
|
9422
|
-
constructor(flushFn, debounceMs = WATCH_DEBOUNCE_MS, onCreated) {
|
|
9423
|
-
this.flushFn = flushFn;
|
|
9424
|
-
this.debounceMs = debounceMs;
|
|
9425
|
-
this.onCreated = onCreated;
|
|
9426
|
-
}
|
|
9427
|
-
/** Queue a change; arms the debounce timer if not already pending. */
|
|
9428
|
-
enqueue(uri, type) {
|
|
9429
|
-
const held = this.pending.get(uri);
|
|
9430
|
-
this.pending.set(uri, held === FILE_CREATED && type === FILE_CHANGED ? FILE_CREATED : type);
|
|
9431
|
-
if (this.timer)
|
|
9432
|
-
return;
|
|
9433
|
-
this.timer = setTimeout(() => this.flush(), this.debounceMs);
|
|
9434
|
-
this.timer.unref?.();
|
|
9435
|
-
}
|
|
9436
|
-
/** Emit all queued changes as one notification (no-op when empty). */
|
|
9437
|
-
flush() {
|
|
9438
|
-
if (this.timer) {
|
|
9439
|
-
clearTimeout(this.timer);
|
|
9440
|
-
this.timer = null;
|
|
9441
|
-
}
|
|
9442
|
-
if (this.pending.size === 0)
|
|
9443
|
-
return;
|
|
9444
|
-
const changes = [...this.pending.entries()].map(([uri, type]) => ({ uri, type }));
|
|
9445
|
-
this.pending.clear();
|
|
9446
|
-
this.flushFn(changes);
|
|
9447
|
-
const created = changes.flatMap((change) => change.type === FILE_CREATED ? [change.uri] : []);
|
|
9448
|
-
if (created.length > 0)
|
|
9449
|
-
this.onCreated?.(created);
|
|
9450
|
-
}
|
|
9451
|
-
/**
|
|
9452
|
-
* #4320: send now when a Created is waiting, so a read that follows is
|
|
9453
|
-
* answered by a server that has heard of the new path. Leaves a queue of
|
|
9454
|
-
* edits alone to coalesce as usual.
|
|
9455
|
-
*/
|
|
9456
|
-
flushIfCreated() {
|
|
9457
|
-
for (const type of this.pending.values()) {
|
|
9458
|
-
if (type === FILE_CREATED) {
|
|
9459
|
-
this.flush();
|
|
9460
|
-
return;
|
|
9461
|
-
}
|
|
9462
|
-
}
|
|
9463
|
-
}
|
|
9464
|
-
/** Drop the timer + any queued changes without emitting (client teardown). */
|
|
9465
|
-
cancel() {
|
|
9466
|
-
if (this.timer) {
|
|
9467
|
-
clearTimeout(this.timer);
|
|
9468
|
-
this.timer = null;
|
|
9469
|
-
}
|
|
9470
|
-
this.pending.clear();
|
|
9471
|
-
}
|
|
9472
|
-
/** Number of distinct URIs currently queued (for tests/introspection). */
|
|
9473
|
-
get size() {
|
|
9474
|
-
return this.pending.size;
|
|
9475
|
-
}
|
|
9476
|
-
};
|
|
9477
|
-
|
|
9478
9588
|
// dist/clients/lsp/edits.js
|
|
9479
9589
|
var StaleWorkspaceEditContentError = class extends Error {
|
|
9480
9590
|
};
|
|
@@ -9867,7 +9977,7 @@ function captureRenameExpectedContent(edit, cwd, requestedAtMs, readTrackedSend,
|
|
|
9867
9977
|
let targetRealPath;
|
|
9868
9978
|
if (target !== void 0) {
|
|
9869
9979
|
try {
|
|
9870
|
-
targetRealPath =
|
|
9980
|
+
targetRealPath = realpathSync.native(target.filePath);
|
|
9871
9981
|
} catch {
|
|
9872
9982
|
targetRealPath = void 0;
|
|
9873
9983
|
}
|
|
@@ -9877,7 +9987,7 @@ function captureRenameExpectedContent(edit, cwd, requestedAtMs, readTrackedSend,
|
|
|
9877
9987
|
let content;
|
|
9878
9988
|
let mtimeMs;
|
|
9879
9989
|
try {
|
|
9880
|
-
realPath =
|
|
9990
|
+
realPath = realpathSync.native(diskPath);
|
|
9881
9991
|
content = readFileSync8(realPath, "utf-8");
|
|
9882
9992
|
mtimeMs = statSync8(realPath).mtimeMs;
|
|
9883
9993
|
} catch {
|
|
@@ -10109,27 +10219,14 @@ async function assertParentIsUsable(filePath, stateFor) {
|
|
|
10109
10219
|
current = parent;
|
|
10110
10220
|
}
|
|
10111
10221
|
}
|
|
10112
|
-
async function
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
const resolved2 = await fs10.realpath(current);
|
|
10118
|
-
return path10.join(resolved2, ...tail.reverse());
|
|
10119
|
-
} catch (err) {
|
|
10120
|
-
const code = err.code;
|
|
10121
|
-
if (code !== "ENOENT" && code !== "ENOTDIR")
|
|
10122
|
-
throw err;
|
|
10123
|
-
const parent = path10.dirname(current);
|
|
10124
|
-
if (parent === current)
|
|
10125
|
-
throw err;
|
|
10126
|
-
tail.push(path10.basename(current));
|
|
10127
|
-
current = parent;
|
|
10128
|
-
}
|
|
10129
|
-
}
|
|
10222
|
+
async function requireKernelIdentity(filePath, subject) {
|
|
10223
|
+
const identity = await kernelPathIdentityAsync(filePath);
|
|
10224
|
+
if (identity === void 0 || !identity.kernelConfirmed)
|
|
10225
|
+
throw new Error(`workspace edit path identity is unresolvable: ${subject}`);
|
|
10226
|
+
return identity.identity;
|
|
10130
10227
|
}
|
|
10131
10228
|
async function createWorkspaceUriConfiner(cwd) {
|
|
10132
|
-
const root = await
|
|
10229
|
+
const root = await requireKernelIdentity(cwd, cwd);
|
|
10133
10230
|
return async (uri) => {
|
|
10134
10231
|
let filePath = "";
|
|
10135
10232
|
try {
|
|
@@ -10142,7 +10239,7 @@ async function createWorkspaceUriConfiner(cwd) {
|
|
|
10142
10239
|
}
|
|
10143
10240
|
if (!path10.isAbsolute(filePath))
|
|
10144
10241
|
throw new Error(`workspace edit path escapes workspace: ${uri}`);
|
|
10145
|
-
const resolved2 = await
|
|
10242
|
+
const resolved2 = await requireKernelIdentity(filePath, uri);
|
|
10146
10243
|
if (!isUnderDir(resolved2, root))
|
|
10147
10244
|
throw new Error(`workspace edit path escapes workspace: ${uri}`);
|
|
10148
10245
|
return filePath;
|
|
@@ -10216,7 +10313,7 @@ async function preflightWorkspaceEdit(planned, cwd, options) {
|
|
|
10216
10313
|
if (!physicalPath)
|
|
10217
10314
|
throw new Error(`text edit target does not exist: ${filePath}`);
|
|
10218
10315
|
const content = await fs10.readFile(physicalPath, "utf-8");
|
|
10219
|
-
const expected = options.expectedContent?.get(await
|
|
10316
|
+
const expected = options.expectedContent?.get(await realpathOrResolveAsync(physicalPath));
|
|
10220
10317
|
if (expected !== void 0 && expected !== content) {
|
|
10221
10318
|
refuseStaleWorkspaceEdit(filePath, "the file changed after the edit was computed from it");
|
|
10222
10319
|
}
|
|
@@ -11409,8 +11506,8 @@ async function killProcessTree(proc, pid, options = {}) {
|
|
|
11409
11506
|
proc.unref?.();
|
|
11410
11507
|
return;
|
|
11411
11508
|
}
|
|
11412
|
-
await new Promise((
|
|
11413
|
-
killer.once("close", () =>
|
|
11509
|
+
await new Promise((resolve8) => {
|
|
11510
|
+
killer.once("close", () => resolve8());
|
|
11414
11511
|
killer.once("error", (err) => {
|
|
11415
11512
|
logLatency({
|
|
11416
11513
|
type: "phase",
|
|
@@ -11419,7 +11516,7 @@ async function killProcessTree(proc, pid, options = {}) {
|
|
|
11419
11516
|
durationMs: 0,
|
|
11420
11517
|
metadata: { pid, platform: "win32", taskkillError: String(err) }
|
|
11421
11518
|
});
|
|
11422
|
-
|
|
11519
|
+
resolve8();
|
|
11423
11520
|
});
|
|
11424
11521
|
});
|
|
11425
11522
|
} catch (err) {
|
|
@@ -11477,18 +11574,18 @@ async function killProcessTree(proc, pid, options = {}) {
|
|
|
11477
11574
|
proc.unref?.();
|
|
11478
11575
|
return;
|
|
11479
11576
|
}
|
|
11480
|
-
const exitedInTime = await new Promise((
|
|
11577
|
+
const exitedInTime = await new Promise((resolve8) => {
|
|
11481
11578
|
if (proc.exitCode != null || proc.signalCode != null) {
|
|
11482
|
-
|
|
11579
|
+
resolve8(true);
|
|
11483
11580
|
return;
|
|
11484
11581
|
}
|
|
11485
11582
|
const onExit = () => {
|
|
11486
11583
|
clearTimeout(timer);
|
|
11487
|
-
|
|
11584
|
+
resolve8(true);
|
|
11488
11585
|
};
|
|
11489
11586
|
const timer = setTimeout(() => {
|
|
11490
11587
|
proc.off?.("exit", onExit);
|
|
11491
|
-
|
|
11588
|
+
resolve8(false);
|
|
11492
11589
|
}, 1500);
|
|
11493
11590
|
proc.once?.("exit", onExit);
|
|
11494
11591
|
});
|
|
@@ -12132,7 +12229,8 @@ function setupIncomingHandlers(state4, initialization, onDiagnosticsPublished) {
|
|
|
12132
12229
|
emptyFirstPublish: strategy.emptyFirstPublish,
|
|
12133
12230
|
// `pubVersion`, the `[lsp-pub]` trace's own field name for the
|
|
12134
12231
|
// publish's LSP document version — not a lifecycle identity, and
|
|
12135
|
-
// not the retired glossary spelling (
|
|
12232
|
+
// not the retired glossary spelling (docs/defect-shapes.md "session, turn or
|
|
12233
|
+
// generation lifecycle").
|
|
12136
12234
|
pubVersion: docVersion ?? "push-unversioned"
|
|
12137
12235
|
}
|
|
12138
12236
|
});
|
|
@@ -12760,7 +12858,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
|
|
|
12760
12858
|
const retryBudgetMs = strategy.pullRetryBudgetMs > 0 ? Math.min(timeoutMs, strategy.pullRetryBudgetMs) : 0;
|
|
12761
12859
|
const startedAt = Date.now();
|
|
12762
12860
|
while (outcome.status !== "found" && Date.now() - startedAt < retryBudgetMs) {
|
|
12763
|
-
await new Promise((
|
|
12861
|
+
await new Promise((resolve8) => setTimeout(resolve8, PULL_DIAGNOSTICS_RETRY_INTERVAL_MS));
|
|
12764
12862
|
outcome = await clientRequestPullDiagnostics(state4, filePath, Math.max(0, retryBudgetMs - (Date.now() - startedAt)));
|
|
12765
12863
|
if (outcome.status === "clean")
|
|
12766
12864
|
sawClean = true;
|
|
@@ -12782,7 +12880,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
|
|
|
12782
12880
|
return;
|
|
12783
12881
|
}
|
|
12784
12882
|
const answerStored = () => hasFreshDiagnostics() && !isVersionStale() && (state4.pushDiagnostics.has(normalizedPath) || state4.documentPullDiagnostics.has(normalizedPath));
|
|
12785
|
-
return new Promise((
|
|
12883
|
+
return new Promise((resolve8) => {
|
|
12786
12884
|
let debounceTimer;
|
|
12787
12885
|
let settleDeferred = storedAnswerSettles();
|
|
12788
12886
|
const finish = () => {
|
|
@@ -12791,7 +12889,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
|
|
|
12791
12889
|
state4.diagnosticEmitter.off("diagnostics", onDiagnostics);
|
|
12792
12890
|
state4.diagnosticEmitter.off(PENDING_RECEIPT_DROPPED, onReceiptDropped);
|
|
12793
12891
|
clearTimeout(timeout);
|
|
12794
|
-
|
|
12892
|
+
resolve8();
|
|
12795
12893
|
};
|
|
12796
12894
|
const onDiagnostics = (fp) => {
|
|
12797
12895
|
if (normalizeMapKey(fp) !== normalizedPath)
|
|
@@ -13030,9 +13128,9 @@ function enqueueDocumentNotify(state4, normalizedPath, run, saved = false, readS
|
|
|
13030
13128
|
queue = { running: false, active: void 0 };
|
|
13031
13129
|
state4.notifyChangeQueues.set(normalizedPath, queue);
|
|
13032
13130
|
}
|
|
13033
|
-
return new Promise((
|
|
13131
|
+
return new Promise((resolve8, reject) => {
|
|
13034
13132
|
if (queue.closing && !close) {
|
|
13035
|
-
|
|
13133
|
+
resolve8(false);
|
|
13036
13134
|
return;
|
|
13037
13135
|
}
|
|
13038
13136
|
const previous = queue?.pending;
|
|
@@ -13046,7 +13144,7 @@ function enqueueDocumentNotify(state4, normalizedPath, run, saved = false, readS
|
|
|
13046
13144
|
const before = (a, b) => a !== void 0 && b !== void 0 && a < b;
|
|
13047
13145
|
const stale = previous !== void 0 && (saveOnly || before(readStamp, previous.readStamp) || before(readStamp, lastSent));
|
|
13048
13146
|
const heldStamp = before(previous?.readStamp, lastSent) ? void 0 : previous?.readStamp;
|
|
13049
|
-
waiters.push({ resolve:
|
|
13147
|
+
waiters.push({ resolve: resolve8, reject, stale });
|
|
13050
13148
|
queue.pending = {
|
|
13051
13149
|
run: stale ? previous.run : run,
|
|
13052
13150
|
saveOnly: stale ? previous.saveOnly : saveOnly,
|
|
@@ -14278,8 +14376,8 @@ async function safeSendRequest(connection, method, params, signal, settlement, r
|
|
|
14278
14376
|
if (signal) {
|
|
14279
14377
|
tokenSource = new import_node.CancellationTokenSource();
|
|
14280
14378
|
if (releaseOnAbort) {
|
|
14281
|
-
released = new Promise((
|
|
14282
|
-
release = () =>
|
|
14379
|
+
released = new Promise((resolve8) => {
|
|
14380
|
+
release = () => resolve8(RELEASED_ON_ABORT);
|
|
14283
14381
|
});
|
|
14284
14382
|
}
|
|
14285
14383
|
onAbort = () => {
|
|
@@ -14839,8 +14937,8 @@ var ClientRegistry = class {
|
|
|
14839
14937
|
async withClientSpawnGate(operation) {
|
|
14840
14938
|
const previous = this.clientSpawnGate;
|
|
14841
14939
|
let release;
|
|
14842
|
-
this.clientSpawnGate = new Promise((
|
|
14843
|
-
release =
|
|
14940
|
+
this.clientSpawnGate = new Promise((resolve8) => {
|
|
14941
|
+
release = resolve8;
|
|
14844
14942
|
});
|
|
14845
14943
|
await previous;
|
|
14846
14944
|
try {
|
|
@@ -16040,7 +16138,7 @@ function createLazyImport(load) {
|
|
|
16040
16138
|
}
|
|
16041
16139
|
|
|
16042
16140
|
// dist/clients/lsp-lazy.js
|
|
16043
|
-
var lazyLsp = createLazyImport(() => import("./chunk-
|
|
16141
|
+
var lazyLsp = createLazyImport(() => import("./chunk-YES5CACN.js"));
|
|
16044
16142
|
function warmLspService() {
|
|
16045
16143
|
return lazyLsp.get();
|
|
16046
16144
|
}
|
|
@@ -16313,7 +16411,7 @@ function getMaxWorkspaceDiagnosticFiles() {
|
|
|
16313
16411
|
}
|
|
16314
16412
|
async function collectWorkspaceDiagnosticFiles(root, maxFiles = getMaxWorkspaceDiagnosticFiles(), signal, homeDir) {
|
|
16315
16413
|
const files2 = [];
|
|
16316
|
-
if (isAtOrAboveHomeDir(root, homeDir))
|
|
16414
|
+
if (isAtOrAboveHomeDir(realpathOrResolve(root), realpathOrResolve(homeDir ?? os2.homedir())))
|
|
16317
16415
|
return files2;
|
|
16318
16416
|
const ignoreMatcher = getProjectIgnoreMatcher(root);
|
|
16319
16417
|
await ignoreMatcher.ensureTrackedIndex();
|
|
@@ -16357,7 +16455,16 @@ async function collectWorkspaceDiagnosticFiles(root, maxFiles = getMaxWorkspaceD
|
|
|
16357
16455
|
}
|
|
16358
16456
|
var LSPService = class _LSPService {
|
|
16359
16457
|
static MAX_SIBLING_ANNOUNCEMENTS = 1024;
|
|
16458
|
+
static MAX_UNHELD_STAMPS = 4096;
|
|
16360
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);
|
|
16361
16468
|
/** Content hashes already announced to a sibling root in this service. */
|
|
16362
16469
|
siblingAnnouncementHashes = new BoundedFifoMap(_LSPService.MAX_SIBLING_ANNOUNCEMENTS);
|
|
16363
16470
|
/**
|
|
@@ -16620,7 +16727,7 @@ var LSPService = class _LSPService {
|
|
|
16620
16727
|
return Promise.resolve();
|
|
16621
16728
|
}
|
|
16622
16729
|
this.announceCreatedFiles([filePath]);
|
|
16623
|
-
return Promise.all(
|
|
16730
|
+
return Promise.all(this.serversWithLiveReaderRoots(filePath).map((server) => this.clientRegistry.resolveServerRoot(server, filePath).then((root) => {
|
|
16624
16731
|
if (!root)
|
|
16625
16732
|
return false;
|
|
16626
16733
|
const ownKey = `${server.id}:${normalizeMapKey(root)}`;
|
|
@@ -16629,6 +16736,26 @@ var LSPService = class _LSPService {
|
|
|
16629
16736
|
this.siblingAnnouncementHashes.set(normalizedPath, contentHash2);
|
|
16630
16737
|
});
|
|
16631
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
|
+
}
|
|
16632
16759
|
notifyLiveClientsForServer(serverId, filePath, type, ownKey, includeOwn) {
|
|
16633
16760
|
let notified = false;
|
|
16634
16761
|
const prefix = `${serverId}:`;
|
|
@@ -17354,8 +17481,8 @@ var LSPService = class _LSPService {
|
|
|
17354
17481
|
return { outstandingMs: 0 };
|
|
17355
17482
|
}
|
|
17356
17483
|
let resolveSettled;
|
|
17357
|
-
const settled = new Promise((
|
|
17358
|
-
resolveSettled =
|
|
17484
|
+
const settled = new Promise((resolve8) => {
|
|
17485
|
+
resolveSettled = resolve8;
|
|
17359
17486
|
});
|
|
17360
17487
|
const token = {
|
|
17361
17488
|
startedAt: Date.now(),
|
|
@@ -17444,7 +17571,8 @@ var LSPService = class _LSPService {
|
|
|
17444
17571
|
const attached = new Set(spawned.map((entry) => entry.info.id));
|
|
17445
17572
|
const brokenSkippedServerIds = [];
|
|
17446
17573
|
const policySkippedServerIds = [];
|
|
17447
|
-
|
|
17574
|
+
const candidates = enabledAuxiliaries ? getServersForFileWithConfig(filePath) : aggregateServersForFile(filePath);
|
|
17575
|
+
for (const server of candidates) {
|
|
17448
17576
|
if (!isAuxiliary(server))
|
|
17449
17577
|
continue;
|
|
17450
17578
|
if (attached.has(server.id))
|
|
@@ -17568,8 +17696,8 @@ var LSPService = class _LSPService {
|
|
|
17568
17696
|
const effectiveMaxWaitMs = hardCapMs !== void 0 ? serverBaseMs > 0 ? Math.min(serverBaseMs, hardCapMs) : hardCapMs : serverBaseMs;
|
|
17569
17697
|
let knownSlowResolve;
|
|
17570
17698
|
const knownSlowSentinel = /* @__PURE__ */ Symbol("lsp-client-wait-known-slow");
|
|
17571
|
-
const knownSlow = new Promise((
|
|
17572
|
-
knownSlowResolve = () =>
|
|
17699
|
+
const knownSlow = new Promise((resolve8) => {
|
|
17700
|
+
knownSlowResolve = () => resolve8(knownSlowSentinel);
|
|
17573
17701
|
});
|
|
17574
17702
|
const noteSpawnInFlight = (serverId) => {
|
|
17575
17703
|
const knownDurationMs = getSuccessfulLspSpawnDurationMs(serverId);
|
|
@@ -17660,8 +17788,8 @@ var LSPService = class _LSPService {
|
|
|
17660
17788
|
waitResult = await Promise.race([
|
|
17661
17789
|
withBudget(),
|
|
17662
17790
|
knownSlow,
|
|
17663
|
-
new Promise((
|
|
17664
|
-
waitTimer = setTimeout(() =>
|
|
17791
|
+
new Promise((resolve8) => {
|
|
17792
|
+
waitTimer = setTimeout(() => resolve8(timeoutSentinel), effectiveMaxWaitMs);
|
|
17665
17793
|
})
|
|
17666
17794
|
]);
|
|
17667
17795
|
} finally {
|
|
@@ -17744,15 +17872,15 @@ var LSPService = class _LSPService {
|
|
|
17744
17872
|
* aggregate diagnostics pass must not launch them beside a working preferred
|
|
17745
17873
|
* server merely because it requested `clientScope: "all"`.
|
|
17746
17874
|
*/
|
|
17747
|
-
async getClientsForFile(filePath, excludeServerIds, resolvedRoots, auxiliaryRoots) {
|
|
17748
|
-
const allServers =
|
|
17875
|
+
async getClientsForFile(filePath, excludeServerIds, resolvedRoots, auxiliaryRoots, syncOnly = false) {
|
|
17876
|
+
const allServers = syncOnly ? this.serversWithLiveReaderRoots(filePath) : aggregateServersForFile(filePath);
|
|
17749
17877
|
const servers = excludeServerIds && excludeServerIds.size > 0 ? allServers.filter((s) => !excludeServerIds.has(s.id)) : allServers;
|
|
17750
17878
|
if (servers.length === 0)
|
|
17751
17879
|
return { clients: [], serverCountAttempted: 0 };
|
|
17752
17880
|
const rootedServers = (await Promise.all(servers.map(async (server) => ({
|
|
17753
17881
|
server,
|
|
17754
17882
|
root: await this.clientRegistry.resolveServerRoot(server, filePath)
|
|
17755
|
-
})))).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));
|
|
17756
17884
|
for (const { server, root } of rootedServers)
|
|
17757
17885
|
if (isAuxiliary(server))
|
|
17758
17886
|
auxiliaryRoots?.set(server.id, normalizeMapKey(root));
|
|
@@ -17806,7 +17934,7 @@ var LSPService = class _LSPService {
|
|
|
17806
17934
|
async getWarmClientForFile(filePath) {
|
|
17807
17935
|
if (this.checkDestroyed())
|
|
17808
17936
|
return void 0;
|
|
17809
|
-
const servers =
|
|
17937
|
+
const servers = this.serversWithLiveReaderRoots(filePath);
|
|
17810
17938
|
const missed = [];
|
|
17811
17939
|
for (const server of servers) {
|
|
17812
17940
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
@@ -17928,7 +18056,7 @@ var LSPService = class _LSPService {
|
|
|
17928
18056
|
async notifyExternalFileChange(filePath, type) {
|
|
17929
18057
|
if (this.checkDestroyed())
|
|
17930
18058
|
return;
|
|
17931
|
-
for (const server of
|
|
18059
|
+
for (const server of this.serversWithLiveReaderRoots(filePath)) {
|
|
17932
18060
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
17933
18061
|
if (!root)
|
|
17934
18062
|
continue;
|
|
@@ -17947,13 +18075,43 @@ var LSPService = class _LSPService {
|
|
|
17947
18075
|
notifyOutOfBandFileChanges(changes) {
|
|
17948
18076
|
if (this.checkDestroyed() || changes.length === 0)
|
|
17949
18077
|
return;
|
|
17950
|
-
for (const { filePath, type } of changes)
|
|
17951
|
-
|
|
17952
|
-
|
|
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
|
+
}
|
|
17953
18087
|
for (const client of this.state.clients.values())
|
|
17954
18088
|
if (client.isAlive())
|
|
17955
18089
|
client.notify.flushWatched?.();
|
|
17956
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
|
+
}
|
|
17957
18115
|
/**
|
|
17958
18116
|
* #4476: restart the live primary clients whose root overlaps `root` after
|
|
17959
18117
|
* a dependency install there (see `ClientRegistry.restartPrimaryClientsUnder`).
|
|
@@ -17985,12 +18143,20 @@ var LSPService = class _LSPService {
|
|
|
17985
18143
|
* workspace sweep (which looks every file up before it touches any), is
|
|
17986
18144
|
* answered from cache, or by a server that has not heard of the module yet.
|
|
17987
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).
|
|
17988
18153
|
*/
|
|
17989
|
-
announceCreatedFiles(filePaths) {
|
|
18154
|
+
announceCreatedFiles(filePaths, importTargets = []) {
|
|
17990
18155
|
if (this.checkDestroyed() || this.state.clients.size === 0)
|
|
17991
18156
|
return;
|
|
18157
|
+
this.sendUnheldChanges(importTargets);
|
|
17992
18158
|
const byServer = /* @__PURE__ */ new Map();
|
|
17993
|
-
for (const filePath of filePaths) {
|
|
18159
|
+
for (const filePath of [...filePaths, ...importTargets]) {
|
|
17994
18160
|
let stat3;
|
|
17995
18161
|
try {
|
|
17996
18162
|
stat3 = nodeFs2.statSync(filePath);
|
|
@@ -18010,6 +18176,112 @@ var LSPService = class _LSPService {
|
|
|
18010
18176
|
client.notify.announceCreated(entries);
|
|
18011
18177
|
}
|
|
18012
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
|
+
}
|
|
18013
18285
|
/**
|
|
18014
18286
|
* #4493 r2: push the disk bytes of `filePaths` to the PRIMARY servers that
|
|
18015
18287
|
* already hold them, and to no auxiliary. A HEAD move's resync runs this
|
|
@@ -18128,7 +18400,7 @@ var LSPService = class _LSPService {
|
|
|
18128
18400
|
const changed = /* @__PURE__ */ new Map();
|
|
18129
18401
|
for (const changedPath of changedPaths) {
|
|
18130
18402
|
const resolved2 = path17.resolve(changedPath);
|
|
18131
|
-
for (const server of
|
|
18403
|
+
for (const server of this.serversWithLiveReaderRoots(resolved2)) {
|
|
18132
18404
|
const root = await this.clientRegistry.resolveServerRoot(server, resolved2);
|
|
18133
18405
|
if (!root)
|
|
18134
18406
|
continue;
|
|
@@ -18204,6 +18476,8 @@ var LSPService = class _LSPService {
|
|
|
18204
18476
|
return void 0;
|
|
18205
18477
|
return this.documentDrift.sweep({
|
|
18206
18478
|
resync: async (filePath, content, _driftAgeMs, readStamp, saved) => {
|
|
18479
|
+
if (exceedsLspSyncLimits(content).tooLarge)
|
|
18480
|
+
return false;
|
|
18207
18481
|
await this.touchFile(filePath, content, {
|
|
18208
18482
|
diagnostics: "none",
|
|
18209
18483
|
source: "drift_resync",
|
|
@@ -18275,7 +18549,7 @@ var LSPService = class _LSPService {
|
|
|
18275
18549
|
*/
|
|
18276
18550
|
async serverIdsNotHoldingDocument(filePath) {
|
|
18277
18551
|
const exclude = /* @__PURE__ */ new Set();
|
|
18278
|
-
for (const server of
|
|
18552
|
+
for (const server of this.serversWithLiveReaderRoots(filePath)) {
|
|
18279
18553
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
18280
18554
|
const existing = root ? this.state.clients.get(`${server.id}:${normalizeMapKey(root)}`) : void 0;
|
|
18281
18555
|
if (existing?.isAlive() && documentIsOpenOn(existing, filePath))
|
|
@@ -18391,7 +18665,7 @@ var LSPService = class _LSPService {
|
|
|
18391
18665
|
let spawned;
|
|
18392
18666
|
let serverCountAttempted;
|
|
18393
18667
|
if (useAllClients) {
|
|
18394
|
-
const result = await this.getClientsForFile(filePath, options.excludeServerIds, resolvedPrimaryRoots, attemptedAuxiliaryRoots);
|
|
18668
|
+
const result = await this.getClientsForFile(filePath, options.excludeServerIds, resolvedPrimaryRoots, attemptedAuxiliaryRoots, diagnosticsMode === "none");
|
|
18395
18669
|
spawned = result.clients;
|
|
18396
18670
|
serverCountAttempted = result.serverCountAttempted;
|
|
18397
18671
|
} else if (clientScope === "with-auxiliary") {
|
|
@@ -18818,8 +19092,8 @@ var LSPService = class _LSPService {
|
|
|
18818
19092
|
let shared = this.firstContactWaits.get(entry.info.id);
|
|
18819
19093
|
if (!shared) {
|
|
18820
19094
|
let removeShutdownListener;
|
|
18821
|
-
const shutdown = new Promise((
|
|
18822
|
-
const onShutdown = () =>
|
|
19095
|
+
const shutdown = new Promise((resolve8) => {
|
|
19096
|
+
const onShutdown = () => resolve8("shutdown");
|
|
18823
19097
|
if (this.shutdownController.signal.aborted) {
|
|
18824
19098
|
onShutdown();
|
|
18825
19099
|
return;
|
|
@@ -18906,8 +19180,8 @@ var LSPService = class _LSPService {
|
|
|
18906
19180
|
};
|
|
18907
19181
|
}
|
|
18908
19182
|
let timer;
|
|
18909
|
-
const timeout = new Promise((
|
|
18910
|
-
timer = setTimeout(() =>
|
|
19183
|
+
const timeout = new Promise((resolve8) => {
|
|
19184
|
+
timer = setTimeout(() => resolve8(false), budgetMs);
|
|
18911
19185
|
if (typeof timer === "object" && "unref" in timer) {
|
|
18912
19186
|
timer.unref?.();
|
|
18913
19187
|
}
|
|
@@ -19005,8 +19279,8 @@ var LSPService = class _LSPService {
|
|
|
19005
19279
|
const graceMs = readTsserverSyncGraceMs();
|
|
19006
19280
|
const primaryClient = spawned[0].client;
|
|
19007
19281
|
const syncRacer = (async () => {
|
|
19008
|
-
await new Promise((
|
|
19009
|
-
const timer = setTimeout(
|
|
19282
|
+
await new Promise((resolve8) => {
|
|
19283
|
+
const timer = setTimeout(resolve8, graceMs);
|
|
19010
19284
|
timer.unref?.();
|
|
19011
19285
|
});
|
|
19012
19286
|
const publishedAt = primaryClient.getAllDiagnostics?.().get(normalizedPath)?.ts;
|
|
@@ -19538,7 +19812,7 @@ var LSPService = class _LSPService {
|
|
|
19538
19812
|
return void 0;
|
|
19539
19813
|
if (this.clientRegistry.analysisRootModeForFile(filePath) === "adopted")
|
|
19540
19814
|
return void 0;
|
|
19541
|
-
const candidates = await Promise.all(
|
|
19815
|
+
const candidates = await Promise.all(this.serversWithLiveReaderRoots(filePath).map((server) => server.root(filePath)));
|
|
19542
19816
|
return candidates.find((candidate) => Boolean(candidate));
|
|
19543
19817
|
}
|
|
19544
19818
|
/**
|
|
@@ -19623,12 +19897,18 @@ var LSPService = class _LSPService {
|
|
|
19623
19897
|
return [];
|
|
19624
19898
|
}
|
|
19625
19899
|
const startedAt = Date.now();
|
|
19626
|
-
const candidateServerIds =
|
|
19900
|
+
const candidateServerIds = aggregateServersForFile(filePath).flatMap((s) => excludeServerIds?.has(s.id) ? [] : [s.id]);
|
|
19627
19901
|
const resolvedPrimaryRoots = /* @__PURE__ */ new Map();
|
|
19628
19902
|
const { clients: spawned, serverCountAttempted } = await this.getClientsForFile(filePath, excludeServerIds, resolvedPrimaryRoots);
|
|
19629
19903
|
if (spawned.length === 0) {
|
|
19630
19904
|
const stored = this.lastKnownDiagnostics.get(normalizedPath);
|
|
19631
|
-
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;
|
|
19632
19912
|
const failureKind2 = stale?.length ? "no_clients_stale" : "no_clients";
|
|
19633
19913
|
const unanswered2 = unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath);
|
|
19634
19914
|
const unavailablePrimaryServerIds2 = unanswered2.serverIds;
|
|
@@ -20057,7 +20337,7 @@ var LSPService = class _LSPService {
|
|
|
20057
20337
|
if (this.checkDestroyed()) {
|
|
20058
20338
|
return { executed: false, reason: "lsp service destroyed" };
|
|
20059
20339
|
}
|
|
20060
|
-
for (const server of
|
|
20340
|
+
for (const server of this.serversWithLiveReaderRoots(filePath)) {
|
|
20061
20341
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
20062
20342
|
if (!root)
|
|
20063
20343
|
continue;
|
|
@@ -20138,7 +20418,7 @@ var LSPService = class _LSPService {
|
|
|
20138
20418
|
return [];
|
|
20139
20419
|
const snapshots = [];
|
|
20140
20420
|
if (filePath) {
|
|
20141
|
-
const servers =
|
|
20421
|
+
const servers = this.serversWithLiveReaderRoots(filePath);
|
|
20142
20422
|
for (const server of servers) {
|
|
20143
20423
|
const root = await this.clientRegistry.resolveServerRoot(server, filePath);
|
|
20144
20424
|
if (!root)
|
|
@@ -20721,12 +21001,12 @@ var LSPService = class _LSPService {
|
|
|
20721
21001
|
ms: timeoutMs,
|
|
20722
21002
|
onTimeout: "undefined"
|
|
20723
21003
|
}),
|
|
20724
|
-
new Promise((
|
|
21004
|
+
new Promise((resolve8) => {
|
|
20725
21005
|
if (options.signal.aborted) {
|
|
20726
|
-
|
|
21006
|
+
resolve8();
|
|
20727
21007
|
return;
|
|
20728
21008
|
}
|
|
20729
|
-
options.signal.addEventListener("abort", () =>
|
|
21009
|
+
options.signal.addEventListener("abort", () => resolve8(), {
|
|
20730
21010
|
once: true
|
|
20731
21011
|
});
|
|
20732
21012
|
})
|
|
@@ -20755,10 +21035,10 @@ var LSPService = class _LSPService {
|
|
|
20755
21035
|
if (failedServerIds.length > 0 && !options.signal?.aborted) {
|
|
20756
21036
|
const backoffMs = warmupRetryBackoffMs();
|
|
20757
21037
|
if (backoffMs > 0) {
|
|
20758
|
-
await new Promise((
|
|
20759
|
-
const timer = setTimeout(
|
|
21038
|
+
await new Promise((resolve8) => {
|
|
21039
|
+
const timer = setTimeout(resolve8, backoffMs);
|
|
20760
21040
|
timer.unref?.();
|
|
20761
|
-
options.signal?.addEventListener("abort", () =>
|
|
21041
|
+
options.signal?.addEventListener("abort", () => resolve8(), {
|
|
20762
21042
|
once: true
|
|
20763
21043
|
});
|
|
20764
21044
|
});
|
|
@@ -20793,6 +21073,10 @@ var LSPService = class _LSPService {
|
|
|
20793
21073
|
async runWorkspaceDiagnosticsSwept(cwd, options = {}) {
|
|
20794
21074
|
const startedAt = Date.now();
|
|
20795
21075
|
const root = path17.resolve(cwd);
|
|
21076
|
+
const sweepExcludedServerIds = /* @__PURE__ */ new Set([
|
|
21077
|
+
...WORKSPACE_SWEEP_EXCLUDED_SERVER_IDS,
|
|
21078
|
+
...options.excludeServerIds ?? []
|
|
21079
|
+
]);
|
|
20796
21080
|
const { signal } = options;
|
|
20797
21081
|
void this.sweepDocumentDrift().catch(() => {
|
|
20798
21082
|
});
|
|
@@ -20808,7 +21092,7 @@ var LSPService = class _LSPService {
|
|
|
20808
21092
|
let lastHeartbeat = Date.now();
|
|
20809
21093
|
const workspaceDiagnosticsCacheCtx = createWorkspaceDiagnosticsCacheContext(root);
|
|
20810
21094
|
const workspaceSweepScopeKey = buildScopeKey("all", [
|
|
20811
|
-
...
|
|
21095
|
+
...sweepExcludedServerIds
|
|
20812
21096
|
]);
|
|
20813
21097
|
const touchScopedOpenDependencies = async (filePath) => {
|
|
20814
21098
|
if (options.files === void 0)
|
|
@@ -20841,11 +21125,7 @@ var LSPService = class _LSPService {
|
|
|
20841
21125
|
}));
|
|
20842
21126
|
return !capped;
|
|
20843
21127
|
};
|
|
20844
|
-
this.announceCreatedFiles([
|
|
20845
|
-
...files2,
|
|
20846
|
-
...goPackageFilesToAnnounce(files2),
|
|
20847
|
-
...await importTargetsToAnnounce(root, files2.filter((filePath) => !workspaceDiagnosticsCacheCtx.servesClean(filePath, workspaceSweepScopeKey)), (filePath, scope) => workspaceDiagnosticsCacheCtx.noteImportScope(filePath, scope))
|
|
20848
|
-
]);
|
|
21128
|
+
this.announceCreatedFiles([...files2, ...goPackageFilesToAnnounce(files2)], await importTargetsToAnnounce(root, files2.filter((filePath) => !workspaceDiagnosticsCacheCtx.servesClean(filePath, workspaceSweepScopeKey)), (filePath, scope) => workspaceDiagnosticsCacheCtx.noteImportScope(filePath, scope)));
|
|
20849
21129
|
const cachedResults = [];
|
|
20850
21130
|
const filesToTouch = [];
|
|
20851
21131
|
const writeIndexByPath = /* @__PURE__ */ new Map();
|
|
@@ -20926,7 +21206,7 @@ var LSPService = class _LSPService {
|
|
|
20926
21206
|
contentCache.set(filePath, content);
|
|
20927
21207
|
const languageId = getLanguageId2(filePath) ?? "plaintext";
|
|
20928
21208
|
const preOpenAttempt = withDeadline((async () => {
|
|
20929
|
-
const { clients } = await this.getClientsForFile(filePath,
|
|
21209
|
+
const { clients } = await this.getClientsForFile(filePath, sweepExcludedServerIds);
|
|
20930
21210
|
for (const entry of clients) {
|
|
20931
21211
|
let auxKey;
|
|
20932
21212
|
if (isAuxiliary(entry.info)) {
|
|
@@ -20946,12 +21226,12 @@ var LSPService = class _LSPService {
|
|
|
20946
21226
|
})(), { ms: perFileMs, onTimeout: "undefined" });
|
|
20947
21227
|
await (signal ? Promise.race([
|
|
20948
21228
|
preOpenAttempt,
|
|
20949
|
-
new Promise((
|
|
21229
|
+
new Promise((resolve8) => {
|
|
20950
21230
|
if (signal.aborted) {
|
|
20951
|
-
|
|
21231
|
+
resolve8();
|
|
20952
21232
|
return;
|
|
20953
21233
|
}
|
|
20954
|
-
signal.addEventListener("abort", () =>
|
|
21234
|
+
signal.addEventListener("abort", () => resolve8(), {
|
|
20955
21235
|
once: true
|
|
20956
21236
|
});
|
|
20957
21237
|
})
|
|
@@ -20984,7 +21264,8 @@ var LSPService = class _LSPService {
|
|
|
20984
21264
|
if (attached && !attached.available) {
|
|
20985
21265
|
await this.ensureWarmForSweep(filePath, { signal });
|
|
20986
21266
|
}
|
|
20987
|
-
const
|
|
21267
|
+
const answer = attached?.available ? dropExcludedServers(attached.response, sweepExcludedServerIds) : void 0;
|
|
21268
|
+
const touchResult = answer ? {
|
|
20988
21269
|
// #4645: the incumbent's membership answer, applied on receipt
|
|
20989
21270
|
// through the owner's rule. This sweep records its rows into
|
|
20990
21271
|
// the workspace cache, and an attached process has no live
|
|
@@ -20992,11 +21273,11 @@ var LSPService = class _LSPService {
|
|
|
20992
21273
|
// rows: the form the batch cache stores (`replayable()`). The
|
|
20993
21274
|
// environment rule still runs at render, against the install
|
|
20994
21275
|
// state of that render.
|
|
20995
|
-
diags:
|
|
21276
|
+
diags: answer.projectIdentity === void 0 ? answer.diagnostics : await demoteInferredProjectDiagnostics(answer.diagnostics, {
|
|
20996
21277
|
filePath,
|
|
20997
21278
|
cwd,
|
|
20998
21279
|
identityCache: /* @__PURE__ */ new Map([
|
|
20999
|
-
[filePath,
|
|
21280
|
+
[filePath, answer.projectIdentity]
|
|
21000
21281
|
])
|
|
21001
21282
|
}),
|
|
21002
21283
|
// #1470: the incumbent's coverage gap crosses the socket as an
|
|
@@ -21004,8 +21285,8 @@ var LSPService = class _LSPService {
|
|
|
21004
21285
|
// reads. Dropping it here would let a partially covered
|
|
21005
21286
|
// incumbent answer be persisted as a confirmed sweep result —
|
|
21006
21287
|
// the same false clean this change closes on the local route.
|
|
21007
|
-
...
|
|
21008
|
-
unconfirmedServerIds:
|
|
21288
|
+
...answer.unconfirmedServerIds !== void 0 && {
|
|
21289
|
+
unconfirmedServerIds: answer.unconfirmedServerIds
|
|
21009
21290
|
}
|
|
21010
21291
|
} : await withDeadline(this.touchFile(filePath, content, {
|
|
21011
21292
|
diagnostics: "document",
|
|
@@ -21016,7 +21297,7 @@ var LSPService = class _LSPService {
|
|
|
21016
21297
|
// `opengrep-client.ts` CLI extractor (one project-wide scan,
|
|
21017
21298
|
// cached, read via extractors.ts) instead — see the
|
|
21018
21299
|
// `excludeServerIds` doc on `LSPTouchFileOptions`.
|
|
21019
|
-
excludeServerIds:
|
|
21300
|
+
excludeServerIds: sweepExcludedServerIds,
|
|
21020
21301
|
// #645: lets a workspaceIndexing server (marksman) pay its
|
|
21021
21302
|
// full wait budget only once across this whole sweep.
|
|
21022
21303
|
sweepIndexGate
|
|
@@ -21603,9 +21884,12 @@ export {
|
|
|
21603
21884
|
calculateRuleComplexity,
|
|
21604
21885
|
buildEffectiveAstGrepCatalog,
|
|
21605
21886
|
isRuleIgnoredForPath,
|
|
21887
|
+
isOptInAuxiliaryServerId,
|
|
21606
21888
|
enabledAuxiliaryLspServerIds,
|
|
21607
21889
|
configDisabledAuxiliaryLspServerIds,
|
|
21890
|
+
enabledOptInAuxiliaryLspServerIds,
|
|
21608
21891
|
findAuxiliaryProfileForSource,
|
|
21892
|
+
dropExcludedServers,
|
|
21609
21893
|
applyAuxiliarySuppressions,
|
|
21610
21894
|
retagAuxiliaryDiagnostics,
|
|
21611
21895
|
armDeferredLspWork,
|
|
@@ -21628,6 +21912,7 @@ export {
|
|
|
21628
21912
|
beginScope,
|
|
21629
21913
|
retireScope,
|
|
21630
21914
|
nextOrderTurn,
|
|
21915
|
+
sessionCell,
|
|
21631
21916
|
scopeCell,
|
|
21632
21917
|
lineContentHash,
|
|
21633
21918
|
ReadGuard,
|