pi-lens 4.4.7 → 4.4.9
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-USER.md +31 -0
- package/CHANGELOG.md +327 -0
- package/README.md +13 -2
- package/config/dependency-cruiser-eager-allowlist.json +1 -1
- package/config/markdownlint/run-no-fix.mjs +36 -0
- package/dist/{chunk-4LM3VAZH.js → chunk-2VZ3VN3N.js} +2 -2
- package/dist/{chunk-PUZ3E2J4.js → chunk-3HTZDY3C.js} +8 -6
- package/dist/{chunk-RORGS5II.js → chunk-3NPWO5UO.js} +7 -13
- package/dist/{chunk-MNJIXFX4.js → chunk-47UCC4MM.js} +1 -1
- package/dist/chunk-4ENEJHF4.js +198 -0
- package/dist/chunk-5GEYJJHG.js +22 -0
- package/dist/{chunk-U6VN4NVL.js → chunk-5YSEQHJN.js} +3 -3
- package/dist/{chunk-6IR3ZYIB.js → chunk-6GPB3JLL.js} +3 -3
- package/dist/{chunk-MB6PXBUA.js → chunk-7R5GZIA6.js} +7 -15
- package/dist/{chunk-DH5JPM3K.js → chunk-7UTSNTWM.js} +10 -9
- package/dist/{chunk-24BILSZW.js → chunk-7YTRG6YW.js} +2 -2
- package/dist/{chunk-KW5JQPO5.js → chunk-AACN5GNE.js} +2 -2
- package/dist/{chunk-PKES3ISE.js → chunk-ACRJ2GZ5.js} +2 -2
- package/dist/{chunk-4ZYJHQMB.js → chunk-C3YRO3EU.js} +10 -12
- package/dist/{chunk-PQJFG24Z.js → chunk-CB7PEVOJ.js} +1300 -946
- package/dist/{chunk-ABPKUVA4.js → chunk-CDFJF5YD.js} +1 -1
- package/dist/{chunk-T7A2HK2B.js → chunk-CJS6WE66.js} +17 -18
- package/dist/{chunk-3YY7IXIL.js → chunk-CM6BDY4E.js} +14 -60
- package/dist/{chunk-RZOXUSPC.js → chunk-CZCAZVTD.js} +16 -2
- package/dist/chunk-DGKFWQK4.js +23 -0
- package/dist/{chunk-NA7SEXHE.js → chunk-E65WJVI5.js} +7 -9
- package/dist/{chunk-2TF6RXWB.js → chunk-EKNYSXFB.js} +8 -10
- package/dist/{chunk-RRV3FNNM.js → chunk-EY6LY2HO.js} +27 -30
- package/dist/{chunk-LBLBAFG3.js → chunk-F6BEQWAK.js} +17 -5
- package/dist/{chunk-4L36HG27.js → chunk-FGNSESAC.js} +12 -14
- package/dist/{chunk-3FRLWYBG.js → chunk-FRUBVFXV.js} +39 -42
- package/dist/{chunk-FB5SCCPT.js → chunk-G22UNQID.js} +14 -15
- package/dist/{chunk-LV4UMYVH.js → chunk-GQTQUNCG.js} +26 -27
- package/dist/{chunk-E7HJ56Y7.js → chunk-H3BVMK47.js} +64 -73
- package/dist/chunk-H6FLQ5NW.js +28 -0
- package/dist/{chunk-QHSNL7B2.js → chunk-HEA3EM23.js} +15 -19
- package/dist/{chunk-AWDSEDER.js → chunk-HSOBIN22.js} +2 -2
- package/dist/{chunk-EAOK7MIZ.js → chunk-HYSKJMZK.js} +17 -4
- package/dist/{chunk-VUZWQ7UG.js → chunk-IICERRFF.js} +46 -72
- package/dist/{chunk-OXOI55RU.js → chunk-IILEH3ZC.js} +8 -10
- package/dist/{chunk-ZKXQKGWZ.js → chunk-J3Q2NYJR.js} +4 -3
- package/dist/{chunk-YHC2O2WO.js → chunk-JUZ67QZQ.js} +20 -9
- package/dist/chunk-KR5VGMVT.js +25 -0
- package/dist/{chunk-F7K5IBZG.js → chunk-KV6GQOGN.js} +41 -44
- package/dist/{chunk-SNDXCFRS.js → chunk-KXMJLOZF.js} +25 -23
- package/dist/{chunk-CB4WHS4H.js → chunk-L4Y3ROKQ.js} +3 -3
- package/dist/{chunk-3F6BMY53.js → chunk-L6WBJGQS.js} +1 -1
- package/dist/{chunk-MPKRJBPK.js → chunk-L7O774U7.js} +30 -32
- package/dist/{chunk-URCQWAQ4.js → chunk-LAHHGNAY.js} +21 -21
- package/dist/{chunk-V63BC55Q.js → chunk-LT62P654.js} +1 -1
- package/dist/{chunk-ZMAUPOMG.js → chunk-LWOM6LVS.js} +34 -34
- package/dist/{chunk-HO6LWE2E.js → chunk-MKPDIAZH.js} +21 -1
- package/dist/{chunk-2PHMIAKO.js → chunk-MN635QYA.js} +3 -4
- package/dist/{chunk-KDX35VXP.js → chunk-MQ4PPCJB.js} +166 -149
- package/dist/{chunk-QOE342SU.js → chunk-MRLH4MYU.js} +2 -2
- package/dist/{chunk-CE6VMBCB.js → chunk-N56BNAA6.js} +20 -21
- package/dist/{chunk-L3CMBQMH.js → chunk-N5CEGQPG.js} +14 -17
- package/dist/{chunk-7E2563GA.js → chunk-NCLO6E6N.js} +13 -33
- package/dist/{chunk-J6JP25XU.js → chunk-NL5LSKVD.js} +4 -3
- package/dist/{chunk-U7BD2QL7.js → chunk-NMUSOZ2D.js} +10 -12
- package/dist/{chunk-BZARLRJW.js → chunk-NOWH2VA2.js} +8 -33
- package/dist/{chunk-U2SDMG7C.js → chunk-NUSXS6YB.js} +6 -5
- package/dist/{chunk-ZJTT47IG.js → chunk-OSEKJEUU.js} +2 -2
- package/dist/{chunk-FZKFVUEC.js → chunk-OUYAUXAT.js} +647 -355
- package/dist/{chunk-ZE3KXHS7.js → chunk-PBZNYHMM.js} +84 -4
- package/dist/{chunk-U5HPROLA.js → chunk-PIIUNJIT.js} +2 -4
- package/dist/chunk-PKLB2XJL.js +8 -0
- package/dist/{chunk-RC2Z6K47.js → chunk-PRHYIA6X.js} +15 -6
- package/dist/{chunk-RQS4QQSD.js → chunk-PXQ45SGD.js} +2 -2
- package/dist/chunk-Q6JQKWPK.js +25 -0
- package/dist/{chunk-F6X3YJWD.js → chunk-QB7T2PHK.js} +2 -2
- package/dist/{chunk-TIQJPRDD.js → chunk-QGITU23N.js} +3 -2
- package/dist/chunk-QJJKOHLH.js +57 -0
- package/dist/{chunk-4LOE5R5P.js → chunk-QP33NKYC.js} +18 -15
- package/dist/{chunk-N5WSK2K7.js → chunk-QVBOXT3L.js} +12 -17
- package/dist/{chunk-DPGEAHZT.js → chunk-RNJFRXEN.js} +10 -18
- package/dist/{chunk-EKWX4WD3.js → chunk-RNXOWDM6.js} +10 -10
- package/dist/{chunk-O4BJFESU.js → chunk-RTFMDIKV.js} +1 -1
- package/dist/{chunk-LS3QJRUB.js → chunk-SIQHOB6P.js} +11 -13
- package/dist/{chunk-3K2F6UDZ.js → chunk-SLSMJPEF.js} +43 -42
- package/dist/chunk-T5QSLSMM.js +50 -0
- package/dist/chunk-TGQDAG4B.js +88 -0
- package/dist/{chunk-4YHYPW2G.js → chunk-THYHUIDR.js} +44 -13
- package/dist/{chunk-YVHBNSME.js → chunk-TMNUTMT5.js} +1099 -1100
- package/dist/{chunk-WDBICWH3.js → chunk-TOE2RRCS.js} +1 -1
- package/dist/chunk-TYHPVE5H.js +25 -0
- package/dist/chunk-UAKO2M6B.js +73 -0
- package/dist/chunk-UC5AXW5Z.js +20 -0
- package/dist/chunk-UTJP6WOS.js +28 -0
- package/dist/{chunk-DQZFQSR5.js → chunk-UXTQ3QPD.js} +4 -4
- package/dist/chunk-UYXV5NIS.js +20 -0
- package/dist/{chunk-KKCK636N.js → chunk-V2WDBOLZ.js} +10 -12
- package/dist/{chunk-PR6PO3ES.js → chunk-V67D6TMU.js} +22 -20
- package/dist/{chunk-VSFLRN5Y.js → chunk-VCRVNLE7.js} +135 -2
- package/dist/{chunk-CPSR3AVL.js → chunk-VO4JFPTV.js} +2 -2
- package/dist/{chunk-XT2HTCJ5.js → chunk-VWLSU3XV.js} +6 -5
- package/dist/{chunk-WME2OQST.js → chunk-W5E72HJA.js} +66 -24
- package/dist/{chunk-LLS45EWB.js → chunk-W7TY6HYX.js} +6 -8
- package/dist/{chunk-CCV2EU7T.js → chunk-WSSLVMDA.js} +12 -13
- package/dist/{chunk-YISME6ON.js → chunk-WTB4GKMH.js} +10 -1
- package/dist/{chunk-KPPJTH44.js → chunk-X5BJ3G2P.js} +64 -35
- package/dist/{chunk-JMEKXFOL.js → chunk-XKFO2SZV.js} +39 -34
- package/dist/{chunk-HR3OJ3TH.js → chunk-XLAI7UYY.js} +84 -31
- package/dist/{chunk-H7OR7DFZ.js → chunk-XO756WE5.js} +53 -37
- package/dist/{chunk-F5Z6URKM.js → chunk-XVB3Q2PG.js} +2 -4
- package/dist/{chunk-R5MOQM2H.js → chunk-YOXCCJDF.js} +607 -366
- package/dist/{chunk-ZGSJDWQU.js → chunk-ZCQBNPRH.js} +2 -2
- package/dist/chunk-ZD4KVFXI.js +234 -0
- package/dist/{chunk-WGRJOXED.js → chunk-ZDMFGACN.js} +1295 -966
- package/dist/{chunk-OSTKYB55.js → chunk-ZMMHHXSW.js} +1 -1
- package/dist/{chunk-75GAYVNO.js → chunk-ZPM7ZIFL.js} +6 -6
- package/dist/{chunk-LUBPZN36.js → chunk-ZVCDHYWZ.js} +9 -11
- package/dist/{chunk-Y7F7IEE3.js → chunk-ZZN74OGD.js} +102 -7
- package/dist/{chunk-L5JYIU47.js → chunk-ZZSJAR76.js} +39 -20
- package/dist/index.js +10933 -8644
- package/dist/mcp/analyze-cli.js +12 -17
- package/dist/mcp/cli.js +43 -42
- package/dist/mcp/server.js +3073 -1147
- package/dist/mcp/worker.js +61 -61
- package/dist/probes/installer.js +18 -19
- package/docs/adr/0003-git-guard-latch-writer.md +11 -6
- package/docs/agent-tools.md +58 -16
- package/docs/alignment-families.md +29 -0
- package/docs/analysisall.md +1 -1
- package/docs/ast-grep_rules_catalog.md +6 -4
- package/docs/ci-bot-pr-checks.md +128 -0
- package/docs/configuration.md +150 -12
- package/docs/defect-shapes.md +107 -15
- package/docs/engineering-principles.md +27 -2
- package/docs/environment-variables.md +18 -1
- package/docs/features.md +14 -7
- package/docs/globalconfig.md +11 -3
- package/docs/invariants/git-guard-host.md +7 -3
- package/docs/invariants/language-config.md +15 -4
- package/docs/invariants/lsp-trust-exec.md +25 -4
- package/docs/invariants/paths-os.md +4 -2
- package/docs/invariants/session-telemetry.md +2 -2
- package/docs/language-coverage.md +1 -0
- package/docs/lsp-capability-matrix.md +167 -65
- package/docs/lsp-idle-eviction.md +4 -1
- package/docs/merge-queue-rollout.md +10 -8
- package/docs/module-report-read-symbol.md +34 -23
- package/docs/pi-lens-fixer.md +34 -17
- package/docs/pi-lens-investigator.md +3 -0
- package/docs/pi-lens-merge-policy.md +34 -17
- package/docs/pi-lens-monitor.md +9 -0
- package/docs/pi-lens-orchestration.md +4 -1
- package/docs/pi-lens-reviewer.md +6 -6
- package/docs/pi-lens-subagent.md +19 -3
- package/docs/public-api-stability.md +57 -7
- package/docs/release-qa-baseline.md +7 -4
- package/docs/schema/pi-lens-config-v1.json +21 -2
- package/docs/servercapabilities.md +3 -1
- package/docs/settings.md +11 -7
- package/docs/word-index.md +20 -7
- package/package.json +11 -4
- package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
- package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
- package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
- package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
- package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
- package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
- package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
- package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
- package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
- package/scripts/download-grammars.js +3 -2
- package/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
- package/dist/chunk-46TNM7XZ.js +0 -88
- package/dist/chunk-72OKUXSD.js +0 -31
- package/dist/chunk-7GLOLOSH.js +0 -57
- package/dist/chunk-AKUUMGD5.js +0 -26
- package/dist/chunk-ASUXV767.js +0 -22
- package/dist/chunk-CTADOKYM.js +0 -25
- package/dist/chunk-GNSIWBAT.js +0 -106
- package/dist/chunk-HWDAVBFU.js +0 -49
- package/dist/chunk-JJ2RRESP.js +0 -58
- package/dist/chunk-KXF5R4UN.js +0 -48
- package/dist/chunk-LSC3VADM.js +0 -23
- package/dist/chunk-OE5ZBP7F.js +0 -443
- package/dist/chunk-SHLDT3OI.js +0 -27
- package/dist/chunk-UF7RTZSO.js +0 -27
- package/dist/chunk-W4WP2ERB.js +0 -30
- package/dist/chunk-YES5CACN.js +0 -73
- package/dist/chunk-Z2XAOKHK.js +0 -136
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
normalizeMessage,
|
|
8
8
|
sanitizeCorrelationId,
|
|
9
9
|
stableFindingId
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VWLSU3XV.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-YOXCCJDF.js";
|
|
42
42
|
import {
|
|
43
43
|
findLocalOpengrepConfig
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-7YTRG6YW.js";
|
|
45
45
|
import {
|
|
46
46
|
emitBounded
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-V67D6TMU.js";
|
|
48
48
|
import {
|
|
49
49
|
loadProjectSnapshot,
|
|
50
50
|
readJsonCache
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-PRHYIA6X.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-XVB3Q2PG.js";
|
|
59
59
|
import {
|
|
60
60
|
collectForwardImportMtimes,
|
|
61
61
|
exceedsLspSyncLimits,
|
|
@@ -69,45 +69,46 @@ import {
|
|
|
69
69
|
lineTextAt,
|
|
70
70
|
pathBirthtimeMs,
|
|
71
71
|
scanDocumentContent
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-L7O774U7.js";
|
|
73
73
|
import {
|
|
74
74
|
js_yaml_default
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-QGITU23N.js";
|
|
76
76
|
import {
|
|
77
77
|
EXTENSION_TO_LSP_ID,
|
|
78
78
|
lspLanguageId,
|
|
79
79
|
resolveFilenameLanguage
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-WTB4GKMH.js";
|
|
81
81
|
import {
|
|
82
82
|
HOOK_WALL_BUDGET_MS
|
|
83
83
|
} from "./chunk-CKEQFGLT.js";
|
|
84
|
-
import {
|
|
85
|
-
bounded,
|
|
86
|
-
withDeadline,
|
|
87
|
-
withTimeout
|
|
88
|
-
} from "./chunk-HO6LWE2E.js";
|
|
89
84
|
import {
|
|
90
85
|
diagnosticsIpcPathForCwd,
|
|
91
86
|
requestWarmCodeActions,
|
|
92
87
|
requestWarmDiagnostics
|
|
93
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-HSOBIN22.js";
|
|
94
89
|
import {
|
|
95
90
|
CONTENT_HASH_MAX_BYTES,
|
|
96
91
|
hashContentBytes,
|
|
97
92
|
hashFileBytes,
|
|
98
93
|
stampContentBytes
|
|
99
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-W7TY6HYX.js";
|
|
95
|
+
import {
|
|
96
|
+
bounded,
|
|
97
|
+
untilAborted,
|
|
98
|
+
withDeadline,
|
|
99
|
+
withTimeout
|
|
100
|
+
} from "./chunk-MKPDIAZH.js";
|
|
100
101
|
import {
|
|
101
102
|
findLocalZizmorConfig,
|
|
102
103
|
logSessionStart
|
|
103
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-MQ4PPCJB.js";
|
|
104
105
|
import {
|
|
105
106
|
findLocalBinUpwards,
|
|
106
107
|
isProjectLocalBinPath
|
|
107
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-E65WJVI5.js";
|
|
108
109
|
import {
|
|
109
110
|
getLspCapableKinds
|
|
110
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-3HTZDY3C.js";
|
|
111
112
|
import {
|
|
112
113
|
createGenerationMap,
|
|
113
114
|
createGenerationSource,
|
|
@@ -124,51 +125,49 @@ import {
|
|
|
124
125
|
releaseOwnChildPid,
|
|
125
126
|
removeLspChild,
|
|
126
127
|
sampleProcessTreeCpuPercent,
|
|
127
|
-
selectLivePeerInstances
|
|
128
|
-
|
|
128
|
+
selectLivePeerInstances,
|
|
129
|
+
windowsExe
|
|
130
|
+
} from "./chunk-TMNUTMT5.js";
|
|
129
131
|
import {
|
|
130
132
|
createSingleFlight
|
|
131
133
|
} from "./chunk-AWQWXSW4.js";
|
|
132
134
|
import {
|
|
133
135
|
SPECIAL_FILENAMES,
|
|
134
136
|
getLanguageId
|
|
135
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-CZCAZVTD.js";
|
|
136
138
|
import {
|
|
137
139
|
PathKeyedMap,
|
|
138
140
|
detectFileRole
|
|
139
|
-
} from "./chunk-
|
|
141
|
+
} from "./chunk-X5BJ3G2P.js";
|
|
140
142
|
import {
|
|
141
143
|
assertInstallAllowed,
|
|
142
144
|
isLspSpawnAllowedByTrust,
|
|
143
145
|
projectTrustDenialReason,
|
|
144
146
|
writeFileAtomic
|
|
145
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-PIIUNJIT.js";
|
|
146
148
|
import {
|
|
147
149
|
compareOrdinal,
|
|
148
150
|
incrementDegradationCount,
|
|
151
|
+
logExtension,
|
|
149
152
|
recordDegradation,
|
|
150
153
|
recordDegradationOnce,
|
|
151
154
|
truncateForLedger
|
|
152
|
-
} from "./chunk-
|
|
153
|
-
import {
|
|
154
|
-
logExtension
|
|
155
|
-
} from "./chunk-KXF5R4UN.js";
|
|
155
|
+
} from "./chunk-W5E72HJA.js";
|
|
156
156
|
import {
|
|
157
157
|
freshnessFromMtime
|
|
158
158
|
} from "./chunk-S26LC76R.js";
|
|
159
|
-
import {
|
|
160
|
-
logLatency,
|
|
161
|
-
phaseFinished,
|
|
162
|
-
phaseStarted
|
|
163
|
-
} from "./chunk-Z2XAOKHK.js";
|
|
164
159
|
import {
|
|
165
160
|
createNdjsonLogger,
|
|
166
161
|
getGlobalPiLensLogDir,
|
|
167
162
|
getMaxLogSizeMB,
|
|
168
163
|
getProcessSingleton,
|
|
164
|
+
isLspInstallDisabled,
|
|
169
165
|
isTestMode,
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
logLatency,
|
|
167
|
+
nextModuleEvaluationOrdinal,
|
|
168
|
+
phaseFinished,
|
|
169
|
+
phaseStarted
|
|
170
|
+
} from "./chunk-VCRVNLE7.js";
|
|
172
171
|
import {
|
|
173
172
|
BoundedFifoMap,
|
|
174
173
|
BoundedLruCache,
|
|
@@ -176,6 +175,7 @@ import {
|
|
|
176
175
|
isAtOrAboveHomeDir,
|
|
177
176
|
isUnderDir,
|
|
178
177
|
isWindowsPath,
|
|
178
|
+
isWithinForm,
|
|
179
179
|
kernelPathIdentityAsync,
|
|
180
180
|
minimatch,
|
|
181
181
|
normalizeEphemeralMapKey,
|
|
@@ -184,11 +184,13 @@ import {
|
|
|
184
184
|
pathsEqual,
|
|
185
185
|
realpathOrResolve,
|
|
186
186
|
realpathOrResolveAsync,
|
|
187
|
+
relativeInside,
|
|
187
188
|
toPosix,
|
|
188
189
|
toProjectRelativePath,
|
|
189
190
|
uriToDiskPath,
|
|
190
|
-
uriToPath
|
|
191
|
-
|
|
191
|
+
uriToPath,
|
|
192
|
+
walkUpDirs
|
|
193
|
+
} from "./chunk-CB7PEVOJ.js";
|
|
192
194
|
import {
|
|
193
195
|
__commonJS,
|
|
194
196
|
__require,
|
|
@@ -1411,8 +1413,8 @@ var require_semaphore = __commonJS({
|
|
|
1411
1413
|
this._waiting = [];
|
|
1412
1414
|
}
|
|
1413
1415
|
lock(thunk) {
|
|
1414
|
-
return new Promise((
|
|
1415
|
-
this._waiting.push({ thunk, resolve:
|
|
1416
|
+
return new Promise((resolve7, reject) => {
|
|
1417
|
+
this._waiting.push({ thunk, resolve: resolve7, reject });
|
|
1416
1418
|
this.runNext();
|
|
1417
1419
|
});
|
|
1418
1420
|
}
|
|
@@ -2403,10 +2405,11 @@ var require_connection = __commonJS({
|
|
|
2403
2405
|
} finally {
|
|
2404
2406
|
if (result instanceof Promise) {
|
|
2405
2407
|
result.then(() => {
|
|
2406
|
-
inFlight--;
|
|
2407
|
-
triggerMessageQueue();
|
|
2408
2408
|
}).catch((error) => {
|
|
2409
2409
|
logger.error(`Processing message queue failed: ${error.toString()}`);
|
|
2410
|
+
}).finally(() => {
|
|
2411
|
+
inFlight--;
|
|
2412
|
+
triggerMessageQueue();
|
|
2410
2413
|
});
|
|
2411
2414
|
} else {
|
|
2412
2415
|
inFlight--;
|
|
@@ -3038,9 +3041,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
3038
3041
|
if (typeof cancellationStrategy.sender.enableCancellation === "function") {
|
|
3039
3042
|
cancellationStrategy.sender.enableCancellation(requestMessage);
|
|
3040
3043
|
}
|
|
3041
|
-
return new Promise(async (
|
|
3044
|
+
return new Promise(async (resolve7, reject) => {
|
|
3042
3045
|
const resolveWithCleanup = (r) => {
|
|
3043
|
-
|
|
3046
|
+
resolve7(r);
|
|
3044
3047
|
cancellationStrategy.sender.cleanup(id);
|
|
3045
3048
|
disposable?.dispose();
|
|
3046
3049
|
};
|
|
@@ -3399,6 +3402,7 @@ var require_ril = __commonJS({
|
|
|
3399
3402
|
"use strict";
|
|
3400
3403
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3401
3404
|
var util_1 = __require("util");
|
|
3405
|
+
var crypto_1 = __require("crypto");
|
|
3402
3406
|
var api_1 = require_api();
|
|
3403
3407
|
var MessageBuffer = class _MessageBuffer extends api_1.AbstractMessageBuffer {
|
|
3404
3408
|
static emptyBuffer = Buffer.allocUnsafe(0);
|
|
@@ -3422,7 +3426,7 @@ var require_ril = __commonJS({
|
|
|
3422
3426
|
if (length === void 0) {
|
|
3423
3427
|
return buffer instanceof Buffer ? buffer : Buffer.from(buffer);
|
|
3424
3428
|
} else {
|
|
3425
|
-
return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer
|
|
3429
|
+
return buffer instanceof Buffer ? buffer.slice(0, length) : Buffer.from(buffer.subarray(0, length));
|
|
3426
3430
|
}
|
|
3427
3431
|
}
|
|
3428
3432
|
allocNative(length) {
|
|
@@ -3469,10 +3473,10 @@ var require_ril = __commonJS({
|
|
|
3469
3473
|
return api_1.Disposable.create(() => this.stream.off("end", listener));
|
|
3470
3474
|
}
|
|
3471
3475
|
write(data, encoding) {
|
|
3472
|
-
return new Promise((
|
|
3476
|
+
return new Promise((resolve7, reject) => {
|
|
3473
3477
|
const callback = (error) => {
|
|
3474
3478
|
if (error === void 0 || error === null) {
|
|
3475
|
-
|
|
3479
|
+
resolve7();
|
|
3476
3480
|
} else {
|
|
3477
3481
|
reject(error);
|
|
3478
3482
|
}
|
|
@@ -3489,6 +3493,9 @@ var require_ril = __commonJS({
|
|
|
3489
3493
|
}
|
|
3490
3494
|
};
|
|
3491
3495
|
var _ril = Object.freeze({
|
|
3496
|
+
crypto: Object.freeze({
|
|
3497
|
+
randomUUID: () => (0, crypto_1.randomUUID)()
|
|
3498
|
+
}),
|
|
3492
3499
|
messageBuffer: Object.freeze({
|
|
3493
3500
|
create: (encoding) => new MessageBuffer(encoding)
|
|
3494
3501
|
}),
|
|
@@ -3639,7 +3646,7 @@ var require_main = __commonJS({
|
|
|
3639
3646
|
this.errorCount = 0;
|
|
3640
3647
|
const eventEmitter = this.process;
|
|
3641
3648
|
eventEmitter.on("error", (error) => this.fireError(error));
|
|
3642
|
-
eventEmitter.on("close", () => this.fireClose);
|
|
3649
|
+
eventEmitter.on("close", () => this.fireClose());
|
|
3643
3650
|
}
|
|
3644
3651
|
write(msg) {
|
|
3645
3652
|
try {
|
|
@@ -3672,7 +3679,7 @@ var require_main = __commonJS({
|
|
|
3672
3679
|
constructor(port) {
|
|
3673
3680
|
super();
|
|
3674
3681
|
this.onData = new api_1.Emitter();
|
|
3675
|
-
port.on("close", () => this.fireClose);
|
|
3682
|
+
port.on("close", () => this.fireClose());
|
|
3676
3683
|
port.on("error", (error) => this.fireError(error));
|
|
3677
3684
|
port.on("message", (message) => {
|
|
3678
3685
|
this.onData.fire(message);
|
|
@@ -3764,10 +3771,10 @@ var require_main = __commonJS({
|
|
|
3764
3771
|
}
|
|
3765
3772
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
3766
3773
|
let connectResolve;
|
|
3767
|
-
const connected = new Promise((
|
|
3768
|
-
connectResolve =
|
|
3774
|
+
const connected = new Promise((resolve7, _reject) => {
|
|
3775
|
+
connectResolve = resolve7;
|
|
3769
3776
|
});
|
|
3770
|
-
return new Promise((
|
|
3777
|
+
return new Promise((resolve7, reject) => {
|
|
3771
3778
|
const server = (0, net_1.createServer)((socket) => {
|
|
3772
3779
|
server.close();
|
|
3773
3780
|
connectResolve([
|
|
@@ -3778,9 +3785,12 @@ var require_main = __commonJS({
|
|
|
3778
3785
|
server.on("error", reject);
|
|
3779
3786
|
server.listen(pipeName, () => {
|
|
3780
3787
|
server.removeListener("error", reject);
|
|
3781
|
-
|
|
3788
|
+
resolve7({
|
|
3782
3789
|
onConnected: () => {
|
|
3783
3790
|
return connected;
|
|
3791
|
+
},
|
|
3792
|
+
close: () => {
|
|
3793
|
+
server.close();
|
|
3784
3794
|
}
|
|
3785
3795
|
});
|
|
3786
3796
|
});
|
|
@@ -3795,10 +3805,10 @@ var require_main = __commonJS({
|
|
|
3795
3805
|
}
|
|
3796
3806
|
function createClientSocketTransport(port, encoding = "utf-8") {
|
|
3797
3807
|
let connectResolve;
|
|
3798
|
-
const connected = new Promise((
|
|
3799
|
-
connectResolve =
|
|
3808
|
+
const connected = new Promise((resolve7, _reject) => {
|
|
3809
|
+
connectResolve = resolve7;
|
|
3800
3810
|
});
|
|
3801
|
-
return new Promise((
|
|
3811
|
+
return new Promise((resolve7, reject) => {
|
|
3802
3812
|
const server = (0, net_1.createServer)((socket) => {
|
|
3803
3813
|
server.close();
|
|
3804
3814
|
connectResolve([
|
|
@@ -3815,10 +3825,13 @@ var require_main = __commonJS({
|
|
|
3815
3825
|
return;
|
|
3816
3826
|
}
|
|
3817
3827
|
const boundPort = address.port;
|
|
3818
|
-
|
|
3828
|
+
resolve7({
|
|
3819
3829
|
port: () => boundPort,
|
|
3820
3830
|
onConnected: () => {
|
|
3821
3831
|
return connected;
|
|
3832
|
+
},
|
|
3833
|
+
close: () => {
|
|
3834
|
+
server.close();
|
|
3822
3835
|
}
|
|
3823
3836
|
});
|
|
3824
3837
|
});
|
|
@@ -3967,6 +3980,9 @@ function noteWorkspaceFileCreated(serverId, root, paths, at = Date.now()) {
|
|
|
3967
3980
|
function noteWorkspaceFilesChangedOnDisk(root, paths, at = Date.now()) {
|
|
3968
3981
|
noteWorkspaceFileCreated("", root, paths, at);
|
|
3969
3982
|
}
|
|
3983
|
+
function noteWorkspaceDependenciesChanged(at = Date.now()) {
|
|
3984
|
+
_allFilesChangedAt = Math.max(_allFilesChangedAt, at);
|
|
3985
|
+
}
|
|
3970
3986
|
function workspaceFileCreatedAtFor(fromServer, holds, counts = () => true) {
|
|
3971
3987
|
let latest = _allFilesChangedAt;
|
|
3972
3988
|
for (const creation of _fileCreations.values()) {
|
|
@@ -4034,7 +4050,7 @@ async function importTargetsToAnnounce(cwd, importers, onScope) {
|
|
|
4034
4050
|
reason: `resolved the imports of ${CREATED_IMPORT_SCAN_MAX_FILES} of ${importers.length} files in one diagnostics call`
|
|
4035
4051
|
});
|
|
4036
4052
|
}
|
|
4037
|
-
const { extractForwardImports } = await import("./chunk-
|
|
4053
|
+
const { extractForwardImports } = await import("./chunk-LAHHGNAY.js");
|
|
4038
4054
|
const targets = /* @__PURE__ */ new Set();
|
|
4039
4055
|
const reexports = /* @__PURE__ */ new Map();
|
|
4040
4056
|
let resolved2 = 0;
|
|
@@ -4349,10 +4365,10 @@ function isRuleIgnoredForPath(filePath, root, patterns) {
|
|
|
4349
4365
|
if (!patterns || patterns.length === 0)
|
|
4350
4366
|
return false;
|
|
4351
4367
|
const pathApi = isWindowsPath(root) || isWindowsPath(filePath) ? path3.win32 : path3.posix;
|
|
4352
|
-
const
|
|
4353
|
-
const outsideRoot =
|
|
4354
|
-
const displayPath = toPosix(outsideRoot ? filePath :
|
|
4355
|
-
return patterns.some((pattern) => (!outsideRoot || !pattern
|
|
4368
|
+
const relative2 = relativeInside(root, filePath, pathApi);
|
|
4369
|
+
const outsideRoot = relative2 === void 0;
|
|
4370
|
+
const displayPath = toPosix(outsideRoot ? filePath : relative2);
|
|
4371
|
+
return patterns.some((pattern) => (!outsideRoot || !toPosix(pattern).endsWith("/**")) && minimatch(displayPath, pattern, { dot: true }));
|
|
4356
4372
|
}
|
|
4357
4373
|
function loadRuleIgnorePatterns(root) {
|
|
4358
4374
|
const patterns = /* @__PURE__ */ new Map();
|
|
@@ -5302,14 +5318,79 @@ function restoreLineEndings(text, ending) {
|
|
|
5302
5318
|
|
|
5303
5319
|
// dist/clients/partial-edit-apply.js
|
|
5304
5320
|
import { createHash as createHash3 } from "node:crypto";
|
|
5305
|
-
import * as
|
|
5321
|
+
import * as fs3 from "node:fs";
|
|
5322
|
+
var MAX_APPLIED_RECORDS_PER_FILE = 8;
|
|
5323
|
+
var MAX_APPLIED_RECORD_FILES = 64;
|
|
5324
|
+
function editPairDigest(oldText, newText) {
|
|
5325
|
+
return createHash3("sha256").update(JSON.stringify([oldText, newText ?? ""]), "utf8").digest("hex");
|
|
5326
|
+
}
|
|
5327
|
+
var PartialApplyRecordStore = class {
|
|
5328
|
+
// Bounded on the PathKeyedMap itself (#2442): the file axis used to
|
|
5329
|
+
// hand-roll `keys().next().value` here, which also evicted an unrelated
|
|
5330
|
+
// file when a path ALREADY in the map was re-recorded at capacity.
|
|
5331
|
+
files = new PathKeyedMap(normalizeMapKey, MAX_APPLIED_RECORD_FILES);
|
|
5332
|
+
find(filePath, oldText, newText) {
|
|
5333
|
+
if (!oldText)
|
|
5334
|
+
return void 0;
|
|
5335
|
+
const pairDigest = editPairDigest(oldText, newText);
|
|
5336
|
+
const records = this.files.get(filePath) ?? [];
|
|
5337
|
+
return records.find((r) => r.pairDigest === pairDigest);
|
|
5338
|
+
}
|
|
5339
|
+
record(filePath, oldText, newText, contentHash2) {
|
|
5340
|
+
if (!oldText)
|
|
5341
|
+
return;
|
|
5342
|
+
const pairDigest = editPairDigest(oldText, newText);
|
|
5343
|
+
const records = this.files.get(filePath) ?? [];
|
|
5344
|
+
const existing = records.findIndex((r) => r.pairDigest === pairDigest);
|
|
5345
|
+
if (existing >= 0)
|
|
5346
|
+
records.splice(existing, 1);
|
|
5347
|
+
const entry = {
|
|
5348
|
+
pairDigest,
|
|
5349
|
+
contentHash: contentHash2 ?? hashFile(filePath),
|
|
5350
|
+
appliedAtMs: Date.now()
|
|
5351
|
+
};
|
|
5352
|
+
if (records.length >= MAX_APPLIED_RECORDS_PER_FILE)
|
|
5353
|
+
records.shift();
|
|
5354
|
+
records.push(entry);
|
|
5355
|
+
this.files.set(filePath, records);
|
|
5356
|
+
}
|
|
5357
|
+
/**
|
|
5358
|
+
* Stamps the post-afterWrite file hash onto an existing record so a later
|
|
5359
|
+
* identical retry against the formatter-rewritten file is still recognized as
|
|
5360
|
+
* already-applied (#2402). No-op when the pair was never recorded.
|
|
5361
|
+
*/
|
|
5362
|
+
noteAfterWriteHash(filePath, oldText, newText, afterWriteContentHash) {
|
|
5363
|
+
if (!oldText)
|
|
5364
|
+
return;
|
|
5365
|
+
const pairDigest = editPairDigest(oldText, newText);
|
|
5366
|
+
const record2 = this.files.get(filePath)?.find((r) => r.pairDigest === pairDigest);
|
|
5367
|
+
if (record2)
|
|
5368
|
+
record2.afterWriteContentHash = afterWriteContentHash;
|
|
5369
|
+
}
|
|
5370
|
+
clear() {
|
|
5371
|
+
this.files.clear();
|
|
5372
|
+
}
|
|
5373
|
+
get fileCount() {
|
|
5374
|
+
return this.files.size;
|
|
5375
|
+
}
|
|
5376
|
+
};
|
|
5377
|
+
function hashFile(filePath) {
|
|
5378
|
+
try {
|
|
5379
|
+
return createHash3("sha256").update(fs3.readFileSync(filePath)).digest("hex");
|
|
5380
|
+
} catch {
|
|
5381
|
+
return void 0;
|
|
5382
|
+
}
|
|
5383
|
+
}
|
|
5384
|
+
|
|
5385
|
+
// dist/clients/read-guard.js
|
|
5386
|
+
import { constants as bufferConstants } from "node:buffer";
|
|
5387
|
+
import * as fs5 from "node:fs";
|
|
5306
5388
|
|
|
5307
5389
|
// dist/clients/file-time.js
|
|
5308
|
-
import * as
|
|
5390
|
+
import * as fs4 from "node:fs";
|
|
5309
5391
|
import * as path4 from "node:path";
|
|
5310
5392
|
var globalState = {
|
|
5311
|
-
reads: /* @__PURE__ */ new Map()
|
|
5312
|
-
locks: /* @__PURE__ */ new Map()
|
|
5393
|
+
reads: /* @__PURE__ */ new Map()
|
|
5313
5394
|
};
|
|
5314
5395
|
var FileTime = class {
|
|
5315
5396
|
sessionID;
|
|
@@ -5372,25 +5453,6 @@ Please read the file again before modifying it.`, absolutePath, "modified");
|
|
|
5372
5453
|
const current = createStamp(absolutePath);
|
|
5373
5454
|
return current.mtime !== recorded.mtime || current.ctime !== recorded.ctime || current.size !== recorded.size;
|
|
5374
5455
|
}
|
|
5375
|
-
/**
|
|
5376
|
-
* Acquire exclusive lock on file
|
|
5377
|
-
* Prevents concurrent modifications to same file
|
|
5378
|
-
*/
|
|
5379
|
-
async withLock(filePath, fn) {
|
|
5380
|
-
const absolutePath = path4.resolve(filePath);
|
|
5381
|
-
while (globalState.locks.has(absolutePath)) {
|
|
5382
|
-
const existing = globalState.locks.get(absolutePath);
|
|
5383
|
-
if (existing)
|
|
5384
|
-
await existing;
|
|
5385
|
-
}
|
|
5386
|
-
const lockPromise = fn().finally(() => {
|
|
5387
|
-
globalState.locks.delete(absolutePath);
|
|
5388
|
-
});
|
|
5389
|
-
globalState.locks.set(absolutePath, lockPromise.then(() => {
|
|
5390
|
-
}, () => {
|
|
5391
|
-
}));
|
|
5392
|
-
return lockPromise;
|
|
5393
|
-
}
|
|
5394
5456
|
/**
|
|
5395
5457
|
* Clear all tracked files for this session
|
|
5396
5458
|
*/
|
|
@@ -5418,7 +5480,7 @@ var FileTimeError = class extends Error {
|
|
|
5418
5480
|
};
|
|
5419
5481
|
function createStamp(filePath) {
|
|
5420
5482
|
try {
|
|
5421
|
-
const stats =
|
|
5483
|
+
const stats = fs4.statSync(filePath);
|
|
5422
5484
|
return {
|
|
5423
5485
|
readAt: /* @__PURE__ */ new Date(),
|
|
5424
5486
|
mtime: stats.mtime.getTime(),
|
|
@@ -5439,78 +5501,8 @@ function createFileTime(sessionID) {
|
|
|
5439
5501
|
}
|
|
5440
5502
|
function clearAllSessions() {
|
|
5441
5503
|
globalState.reads.clear();
|
|
5442
|
-
globalState.locks.clear();
|
|
5443
|
-
}
|
|
5444
|
-
|
|
5445
|
-
// dist/clients/partial-edit-apply.js
|
|
5446
|
-
var MAX_APPLIED_RECORDS_PER_FILE = 8;
|
|
5447
|
-
var MAX_APPLIED_RECORD_FILES = 64;
|
|
5448
|
-
function editPairDigest(oldText, newText) {
|
|
5449
|
-
return createHash3("sha256").update(JSON.stringify([oldText, newText ?? ""]), "utf8").digest("hex");
|
|
5450
|
-
}
|
|
5451
|
-
var PartialApplyRecordStore = class {
|
|
5452
|
-
// Bounded on the PathKeyedMap itself (#2442): the file axis used to
|
|
5453
|
-
// hand-roll `keys().next().value` here, which also evicted an unrelated
|
|
5454
|
-
// file when a path ALREADY in the map was re-recorded at capacity.
|
|
5455
|
-
files = new PathKeyedMap(normalizeMapKey, MAX_APPLIED_RECORD_FILES);
|
|
5456
|
-
find(filePath, oldText, newText) {
|
|
5457
|
-
if (!oldText)
|
|
5458
|
-
return void 0;
|
|
5459
|
-
const pairDigest = editPairDigest(oldText, newText);
|
|
5460
|
-
const records = this.files.get(filePath) ?? [];
|
|
5461
|
-
return records.find((r) => r.pairDigest === pairDigest);
|
|
5462
|
-
}
|
|
5463
|
-
record(filePath, oldText, newText, contentHash2) {
|
|
5464
|
-
if (!oldText)
|
|
5465
|
-
return;
|
|
5466
|
-
const pairDigest = editPairDigest(oldText, newText);
|
|
5467
|
-
const records = this.files.get(filePath) ?? [];
|
|
5468
|
-
const existing = records.findIndex((r) => r.pairDigest === pairDigest);
|
|
5469
|
-
if (existing >= 0)
|
|
5470
|
-
records.splice(existing, 1);
|
|
5471
|
-
const entry = {
|
|
5472
|
-
pairDigest,
|
|
5473
|
-
contentHash: contentHash2 ?? hashFile(filePath),
|
|
5474
|
-
appliedAtMs: Date.now()
|
|
5475
|
-
};
|
|
5476
|
-
if (records.length >= MAX_APPLIED_RECORDS_PER_FILE)
|
|
5477
|
-
records.shift();
|
|
5478
|
-
records.push(entry);
|
|
5479
|
-
this.files.set(filePath, records);
|
|
5480
|
-
}
|
|
5481
|
-
/**
|
|
5482
|
-
* Stamps the post-afterWrite file hash onto an existing record so a later
|
|
5483
|
-
* identical retry against the formatter-rewritten file is still recognized as
|
|
5484
|
-
* already-applied (#2402). No-op when the pair was never recorded.
|
|
5485
|
-
*/
|
|
5486
|
-
noteAfterWriteHash(filePath, oldText, newText, afterWriteContentHash) {
|
|
5487
|
-
if (!oldText)
|
|
5488
|
-
return;
|
|
5489
|
-
const pairDigest = editPairDigest(oldText, newText);
|
|
5490
|
-
const record2 = this.files.get(filePath)?.find((r) => r.pairDigest === pairDigest);
|
|
5491
|
-
if (record2)
|
|
5492
|
-
record2.afterWriteContentHash = afterWriteContentHash;
|
|
5493
|
-
}
|
|
5494
|
-
clear() {
|
|
5495
|
-
this.files.clear();
|
|
5496
|
-
}
|
|
5497
|
-
get fileCount() {
|
|
5498
|
-
return this.files.size;
|
|
5499
|
-
}
|
|
5500
|
-
};
|
|
5501
|
-
var fileLock = createFileTime("partial-edit-apply");
|
|
5502
|
-
function hashFile(filePath) {
|
|
5503
|
-
try {
|
|
5504
|
-
return createHash3("sha256").update(fs4.readFileSync(filePath)).digest("hex");
|
|
5505
|
-
} catch {
|
|
5506
|
-
return void 0;
|
|
5507
|
-
}
|
|
5508
5504
|
}
|
|
5509
5505
|
|
|
5510
|
-
// dist/clients/read-guard.js
|
|
5511
|
-
import { constants as bufferConstants } from "node:buffer";
|
|
5512
|
-
import * as fs5 from "node:fs";
|
|
5513
|
-
|
|
5514
5506
|
// dist/clients/eval-timestamp.js
|
|
5515
5507
|
import { performance as performance2 } from "node:perf_hooks";
|
|
5516
5508
|
var PI_LENS_EVAL_STARTED_MS = performance2.now();
|
|
@@ -7777,7 +7769,10 @@ function getProcessBridge(key, version) {
|
|
|
7777
7769
|
return candidate;
|
|
7778
7770
|
}
|
|
7779
7771
|
|
|
7780
|
-
// dist/clients/
|
|
7772
|
+
// dist/clients/recent-touches.js
|
|
7773
|
+
var RECENT_TOUCHES_FRESHNESS_MS = 15 * 60 * 1e3;
|
|
7774
|
+
|
|
7775
|
+
// dist/clients/live-bus-emitter.js
|
|
7781
7776
|
import * as path6 from "node:path";
|
|
7782
7777
|
var BUS_EVENTS_LOG_FILE = path6.join(getGlobalPiLensLogDir(), "bus-events.log");
|
|
7783
7778
|
var writer = createNdjsonLogger({
|
|
@@ -7803,11 +7798,6 @@ function logBusEvent(entry) {
|
|
|
7803
7798
|
}
|
|
7804
7799
|
writer.log({ ts: (/* @__PURE__ */ new Date()).toISOString(), ...entry });
|
|
7805
7800
|
}
|
|
7806
|
-
|
|
7807
|
-
// dist/clients/recent-touches.js
|
|
7808
|
-
var RECENT_TOUCHES_FRESHNESS_MS = 15 * 60 * 1e3;
|
|
7809
|
-
|
|
7810
|
-
// dist/clients/live-bus-emitter.js
|
|
7811
7801
|
var STALE_CTX_MESSAGE = "This extension ctx is stale after session replacement";
|
|
7812
7802
|
function recordStaleBusFailure(subject, error) {
|
|
7813
7803
|
const reason = String(error);
|
|
@@ -7858,12 +7848,110 @@ function resolveLiveBusEmitter(liveEmitter4, entry) {
|
|
|
7858
7848
|
}
|
|
7859
7849
|
return resolution;
|
|
7860
7850
|
}
|
|
7851
|
+
function createBusPublisher(liveEmitter4, options) {
|
|
7852
|
+
let failureLogged = false;
|
|
7853
|
+
let unwiredLogged = false;
|
|
7854
|
+
let disabledLogged = false;
|
|
7855
|
+
return {
|
|
7856
|
+
publish(call) {
|
|
7857
|
+
const { event } = call;
|
|
7858
|
+
let normalized;
|
|
7859
|
+
const cwd = () => {
|
|
7860
|
+
normalized ??= normalizeFilePath(call.cwd);
|
|
7861
|
+
return normalized;
|
|
7862
|
+
};
|
|
7863
|
+
const extra = call.extra ?? {};
|
|
7864
|
+
if (call.enabled === false) {
|
|
7865
|
+
if (!disabledLogged) {
|
|
7866
|
+
disabledLogged = true;
|
|
7867
|
+
logBusEvent({
|
|
7868
|
+
event,
|
|
7869
|
+
outcome: "skipped_disabled",
|
|
7870
|
+
cwd: cwd(),
|
|
7871
|
+
...extra
|
|
7872
|
+
});
|
|
7873
|
+
}
|
|
7874
|
+
return;
|
|
7875
|
+
}
|
|
7876
|
+
call.whenEnabled?.();
|
|
7877
|
+
const resolution = resolveLiveBusEmitter(liveEmitter4, () => ({
|
|
7878
|
+
event,
|
|
7879
|
+
cwd: cwd(),
|
|
7880
|
+
...extra
|
|
7881
|
+
}));
|
|
7882
|
+
if (resolution.outcome === "stale-session")
|
|
7883
|
+
return;
|
|
7884
|
+
if (resolution.outcome === "unwired") {
|
|
7885
|
+
if (!unwiredLogged) {
|
|
7886
|
+
unwiredLogged = true;
|
|
7887
|
+
if (options.onUnwired)
|
|
7888
|
+
options.onUnwired(event);
|
|
7889
|
+
else {
|
|
7890
|
+
logBusEvent({
|
|
7891
|
+
event,
|
|
7892
|
+
outcome: "skipped_unwired",
|
|
7893
|
+
cwd: cwd(),
|
|
7894
|
+
...extra
|
|
7895
|
+
});
|
|
7896
|
+
}
|
|
7897
|
+
}
|
|
7898
|
+
return;
|
|
7899
|
+
}
|
|
7900
|
+
try {
|
|
7901
|
+
const payload = call.build(cwd());
|
|
7902
|
+
resolution.emit(event, payload);
|
|
7903
|
+
failureLogged = false;
|
|
7904
|
+
logBusEvent({
|
|
7905
|
+
event,
|
|
7906
|
+
outcome: "emitted",
|
|
7907
|
+
cwd: cwd(),
|
|
7908
|
+
...extra,
|
|
7909
|
+
...call.emittedFields?.(payload)
|
|
7910
|
+
});
|
|
7911
|
+
} catch (err) {
|
|
7912
|
+
logBusEvent({
|
|
7913
|
+
event,
|
|
7914
|
+
outcome: "emit_failed",
|
|
7915
|
+
cwd: cwd(),
|
|
7916
|
+
...extra,
|
|
7917
|
+
error: String(err),
|
|
7918
|
+
ctxSource: resolution.ctxSource
|
|
7919
|
+
});
|
|
7920
|
+
if (!failureLogged) {
|
|
7921
|
+
failureLogged = true;
|
|
7922
|
+
recordStaleBusFailure(event, err);
|
|
7923
|
+
call.dbg?.(`${options.module}: ${event} emit failed (further failures suppressed): ${err}`);
|
|
7924
|
+
}
|
|
7925
|
+
}
|
|
7926
|
+
},
|
|
7927
|
+
reset() {
|
|
7928
|
+
failureLogged = false;
|
|
7929
|
+
unwiredLogged = false;
|
|
7930
|
+
disabledLogged = false;
|
|
7931
|
+
}
|
|
7932
|
+
};
|
|
7933
|
+
}
|
|
7861
7934
|
|
|
7862
7935
|
// dist/clients/bus-publish.js
|
|
7863
7936
|
var liveEmitter = createLiveBusEmitter();
|
|
7937
|
+
var publisher = createBusPublisher(liveEmitter, {
|
|
7938
|
+
module: "bus-publish"
|
|
7939
|
+
});
|
|
7864
7940
|
|
|
7865
7941
|
// dist/clients/format-events-publish.js
|
|
7866
7942
|
var liveEmitter2 = createLiveBusEmitter();
|
|
7943
|
+
var queuedPublisher = createBusPublisher(liveEmitter2, {
|
|
7944
|
+
module: "format-events-publish"
|
|
7945
|
+
});
|
|
7946
|
+
var startPublisher = createBusPublisher(liveEmitter2, {
|
|
7947
|
+
module: "format-events-publish"
|
|
7948
|
+
});
|
|
7949
|
+
var donePublisher = createBusPublisher(liveEmitter2, {
|
|
7950
|
+
module: "format-events-publish"
|
|
7951
|
+
});
|
|
7952
|
+
var autofixStartPublisher = createBusPublisher(liveEmitter2, {
|
|
7953
|
+
module: "format-events-publish"
|
|
7954
|
+
});
|
|
7867
7955
|
|
|
7868
7956
|
// dist/clients/mutation-bridge.js
|
|
7869
7957
|
var MUTATION_BRIDGE_KEY = /* @__PURE__ */ Symbol.for("pi-lens:mutation-bridge");
|
|
@@ -7981,6 +8069,7 @@ function bookkeepLspMutation(context, files2, fileDetails) {
|
|
|
7981
8069
|
context.dbg?.(`lsp mutation not recordable, skipping ${filePath}`);
|
|
7982
8070
|
continue;
|
|
7983
8071
|
}
|
|
8072
|
+
let accepted = true;
|
|
7984
8073
|
if (sessionLive && context.readGuard) {
|
|
7985
8074
|
try {
|
|
7986
8075
|
context.readGuard.recordWritten(filePath, {
|
|
@@ -8002,6 +8091,7 @@ function bookkeepLspMutation(context, files2, fileDetails) {
|
|
|
8002
8091
|
if (useBridgeFallback) {
|
|
8003
8092
|
const bridge = getMutationBridge();
|
|
8004
8093
|
if (!bridge) {
|
|
8094
|
+
accepted = false;
|
|
8005
8095
|
recordDegradationOnce({
|
|
8006
8096
|
kind: "lsp-mutation-bridge-unmounted",
|
|
8007
8097
|
subject: "lsp-mutation:no-bridge",
|
|
@@ -8046,9 +8136,11 @@ function bookkeepLspMutation(context, files2, fileDetails) {
|
|
|
8046
8136
|
}
|
|
8047
8137
|
});
|
|
8048
8138
|
if (!recorded) {
|
|
8139
|
+
accepted = false;
|
|
8049
8140
|
context.dbg?.(`lsp mutation bridge dropped ${filePath} (recordMutation() returned false \u2014 see the mutation_bridge debug output for the reason: malformed entry, out-of-scope path, or a bookkeeping error)`);
|
|
8050
8141
|
}
|
|
8051
8142
|
} catch (err) {
|
|
8143
|
+
accepted = false;
|
|
8052
8144
|
context.dbg?.(`lsp mutation bridge fallback failed for ${filePath}: ${err}`);
|
|
8053
8145
|
}
|
|
8054
8146
|
}
|
|
@@ -8100,6 +8192,8 @@ function bookkeepLspMutation(context, files2, fileDetails) {
|
|
|
8100
8192
|
context.recordAutofix(filePath);
|
|
8101
8193
|
}
|
|
8102
8194
|
}
|
|
8195
|
+
if (accepted && context.acceptedFiles && !context.acceptedFiles.includes(filePath))
|
|
8196
|
+
context.acceptedFiles.push(filePath);
|
|
8103
8197
|
}
|
|
8104
8198
|
if (context.publishFilesTouched && files2.length > 0) {
|
|
8105
8199
|
context.publishFilesTouched(files2);
|
|
@@ -8273,6 +8367,17 @@ function composeBoundToCurrentDisk(values) {
|
|
|
8273
8367
|
}
|
|
8274
8368
|
return true;
|
|
8275
8369
|
}
|
|
8370
|
+
function warmAnswerBinding(answer) {
|
|
8371
|
+
const wire = answer.binding;
|
|
8372
|
+
const fields = typeof wire === "object" && wire !== null ? wire : {};
|
|
8373
|
+
const verdict = fields.boundToCurrentDisk;
|
|
8374
|
+
return {
|
|
8375
|
+
...typeof fields.contentHash === "string" && {
|
|
8376
|
+
contentHash: fields.contentHash
|
|
8377
|
+
},
|
|
8378
|
+
boundToCurrentDisk: verdict === true || verdict === false || verdict === "unknown" ? verdict : false
|
|
8379
|
+
};
|
|
8380
|
+
}
|
|
8276
8381
|
function bindingStateLabel(value) {
|
|
8277
8382
|
if (value === true)
|
|
8278
8383
|
return "bound";
|
|
@@ -8280,6 +8385,9 @@ function bindingStateLabel(value) {
|
|
|
8280
8385
|
return "mismatch";
|
|
8281
8386
|
return "unknown";
|
|
8282
8387
|
}
|
|
8388
|
+
function readBoundToCurrentDisk(rawDiags) {
|
|
8389
|
+
return rawDiags?.binding?.boundToCurrentDisk;
|
|
8390
|
+
}
|
|
8283
8391
|
var DISK_BINDING_MEMO_MAX = 4096;
|
|
8284
8392
|
function createDiskBindingCache() {
|
|
8285
8393
|
const diskHashByPath = new PathKeyedMap(normalizeEphemeralMapKey);
|
|
@@ -8325,6 +8433,25 @@ function serverIdsForConfigFile(filePath) {
|
|
|
8325
8433
|
return CONFIG_FILE_SERVERS.get(basename(filePath));
|
|
8326
8434
|
}
|
|
8327
8435
|
|
|
8436
|
+
// dist/clients/lsp/request-timeout-error.js
|
|
8437
|
+
var timeoutBrand = /* @__PURE__ */ Symbol.for("pi-lens.LspRequestTimeoutError");
|
|
8438
|
+
var LspRequestTimeoutError = class extends Error {
|
|
8439
|
+
[timeoutBrand] = true;
|
|
8440
|
+
method;
|
|
8441
|
+
timeoutMs;
|
|
8442
|
+
elapsedMs;
|
|
8443
|
+
constructor(method, timeoutMs, elapsedMs) {
|
|
8444
|
+
super(`LSP request timed out: ${method} after ${elapsedMs}ms`);
|
|
8445
|
+
this.name = "LspRequestTimeoutError";
|
|
8446
|
+
this.method = method;
|
|
8447
|
+
this.timeoutMs = timeoutMs;
|
|
8448
|
+
this.elapsedMs = elapsedMs;
|
|
8449
|
+
}
|
|
8450
|
+
};
|
|
8451
|
+
function isLspRequestTimeoutError(err) {
|
|
8452
|
+
return err?.[timeoutBrand] === true;
|
|
8453
|
+
}
|
|
8454
|
+
|
|
8328
8455
|
// dist/clients/lsp/grouping.js
|
|
8329
8456
|
function aggregateServersForFile(filePath) {
|
|
8330
8457
|
return getServersForFileWithConfig(filePath).flatMap((s) => isOptInAuxiliaryServerId(s.id) ? [] : [s]);
|
|
@@ -8501,7 +8628,7 @@ function resyncDocumentOnPastEof(filePath) {
|
|
|
8501
8628
|
void (async () => {
|
|
8502
8629
|
try {
|
|
8503
8630
|
const [{ getOwnedLspService: getOwnedLspService2 }, content] = await Promise.all([
|
|
8504
|
-
import("./chunk-
|
|
8631
|
+
import("./chunk-MN635QYA.js"),
|
|
8505
8632
|
fs7.promises.readFile(filePath, "utf-8")
|
|
8506
8633
|
]);
|
|
8507
8634
|
await getOwnedLspService2().openFile(filePath, content, { preserveDiagnostics: false });
|
|
@@ -8556,6 +8683,48 @@ var WriteOrderingGuard = class {
|
|
|
8556
8683
|
}
|
|
8557
8684
|
};
|
|
8558
8685
|
|
|
8686
|
+
// dist/clients/inline-blocker-fields.js
|
|
8687
|
+
function inlineBlockerSourceOf(diagnostic) {
|
|
8688
|
+
return diagnostic.tool?.trim() || "unknown";
|
|
8689
|
+
}
|
|
8690
|
+
function inlineBlockerSources(blockers) {
|
|
8691
|
+
return [...new Set(blockers.map(inlineBlockerSourceOf))];
|
|
8692
|
+
}
|
|
8693
|
+
function inlineBlockerLines(blockers, filePath) {
|
|
8694
|
+
return inlineBlockerPlaces(blockers, filePath).map((place) => place.line);
|
|
8695
|
+
}
|
|
8696
|
+
function isCrossFileBlocker(d, filePath) {
|
|
8697
|
+
return !!d.filePath && normalizeEphemeralMapKey(d.filePath) !== normalizeEphemeralMapKey(filePath);
|
|
8698
|
+
}
|
|
8699
|
+
function inlineBlockerPlacement(blockers, filePath) {
|
|
8700
|
+
const places = [];
|
|
8701
|
+
let movedLine = 0;
|
|
8702
|
+
for (const d of blockers) {
|
|
8703
|
+
if (isCrossFileBlocker(d, filePath))
|
|
8704
|
+
continue;
|
|
8705
|
+
if (typeof d.line !== "number")
|
|
8706
|
+
continue;
|
|
8707
|
+
if (d.positionStale) {
|
|
8708
|
+
movedLine += 1;
|
|
8709
|
+
continue;
|
|
8710
|
+
}
|
|
8711
|
+
places.push({
|
|
8712
|
+
line: d.line,
|
|
8713
|
+
rule: d.rule?.trim() || inlineBlockerSourceOf(d)
|
|
8714
|
+
});
|
|
8715
|
+
}
|
|
8716
|
+
return {
|
|
8717
|
+
places,
|
|
8718
|
+
unplaced: {
|
|
8719
|
+
movedLine,
|
|
8720
|
+
noLineInThisFile: blockers.length - places.length - movedLine
|
|
8721
|
+
}
|
|
8722
|
+
};
|
|
8723
|
+
}
|
|
8724
|
+
function inlineBlockerPlaces(blockers, filePath) {
|
|
8725
|
+
return inlineBlockerPlacement(blockers, filePath).places;
|
|
8726
|
+
}
|
|
8727
|
+
|
|
8559
8728
|
// dist/clients/diagnostic-dispositions.js
|
|
8560
8729
|
import * as fs8 from "node:fs";
|
|
8561
8730
|
import * as path9 from "node:path";
|
|
@@ -8574,6 +8743,9 @@ var writer2 = createNdjsonLogger({
|
|
|
8574
8743
|
|
|
8575
8744
|
// dist/clients/disposition-publish.js
|
|
8576
8745
|
var liveEmitter3 = createLiveBusEmitter();
|
|
8746
|
+
var publisher2 = createBusPublisher(liveEmitter3, {
|
|
8747
|
+
module: "disposition-publish"
|
|
8748
|
+
});
|
|
8577
8749
|
|
|
8578
8750
|
// dist/clients/diagnostic-dispositions.js
|
|
8579
8751
|
var deferredByCwd = /* @__PURE__ */ new Map();
|
|
@@ -8937,6 +9109,9 @@ function exportWidgetState() {
|
|
|
8937
9109
|
allDiagnostics: rec.allDiagnostics,
|
|
8938
9110
|
diagnosticCounts: rec.diagnosticCounts,
|
|
8939
9111
|
hasFinalDiagnosticsSnapshot: rec.hasFinalDiagnosticsSnapshot,
|
|
9112
|
+
...rec.uncheckedReason !== void 0 && {
|
|
9113
|
+
uncheckedReason: rec.uncheckedReason
|
|
9114
|
+
},
|
|
8940
9115
|
touchedAt: rec.touchedAt
|
|
8941
9116
|
}))
|
|
8942
9117
|
};
|
|
@@ -8970,6 +9145,9 @@ function importWidgetState(state4) {
|
|
|
8970
9145
|
allDiagnostics: migratedAllDiagnostics,
|
|
8971
9146
|
diagnosticCounts: countDiagnostics(migratedAllDiagnostics),
|
|
8972
9147
|
hasFinalDiagnosticsSnapshot: f.hasFinalDiagnosticsSnapshot ?? false,
|
|
9148
|
+
...typeof f.uncheckedReason === "string" && {
|
|
9149
|
+
uncheckedReason: f.uncheckedReason
|
|
9150
|
+
},
|
|
8973
9151
|
touchedAt: recordTouchedAt
|
|
8974
9152
|
});
|
|
8975
9153
|
}
|
|
@@ -9023,7 +9201,7 @@ function widgetDiagnosticUri(filePath, line, column) {
|
|
|
9023
9201
|
const base = pathToFileURL(filePath).href;
|
|
9024
9202
|
return line != null ? `${base}#L${line}${column != null ? `:${column}` : ""}` : base;
|
|
9025
9203
|
}
|
|
9026
|
-
function recordDiagnostics(filePath, diagnostics, writeIndex, observedAt) {
|
|
9204
|
+
function recordDiagnostics(filePath, diagnostics, writeIndex, observedAt, unchecked) {
|
|
9027
9205
|
const key = fileMapKey(filePath);
|
|
9028
9206
|
if (!diagnosticsWriteGuard.shouldWrite(key, writeIndex))
|
|
9029
9207
|
return false;
|
|
@@ -9031,6 +9209,10 @@ function recordDiagnostics(filePath, diagnostics, writeIndex, observedAt) {
|
|
|
9031
9209
|
const observedTs = observedAt ?? Date.now();
|
|
9032
9210
|
const rec = getOrCreate(filePath, key);
|
|
9033
9211
|
commitDiagnostics(rec, filePath, normalizeDiagnostics(filePath, diagnostics, observedTs), observedTs, key);
|
|
9212
|
+
if (unchecked === void 0)
|
|
9213
|
+
delete rec.uncheckedReason;
|
|
9214
|
+
else
|
|
9215
|
+
rec.uncheckedReason = unchecked;
|
|
9034
9216
|
return true;
|
|
9035
9217
|
}
|
|
9036
9218
|
function normalizeDiagnostics(filePath, diagnostics, observedTs) {
|
|
@@ -9045,7 +9227,8 @@ function normalizeDiagnostics(filePath, diagnostics, observedTs) {
|
|
|
9045
9227
|
rule,
|
|
9046
9228
|
tool: d.tool,
|
|
9047
9229
|
uri: widgetDiagnosticUri(filePath, d.line, d.column),
|
|
9048
|
-
observedAt: observedTs
|
|
9230
|
+
observedAt: observedTs,
|
|
9231
|
+
...d.filePath !== void 0 && isCrossFileBlocker(d, filePath) ? { citedFile: d.filePath } : {}
|
|
9049
9232
|
};
|
|
9050
9233
|
});
|
|
9051
9234
|
}
|
|
@@ -9191,7 +9374,8 @@ function reconcileCorrelatedScanDiagnostics(filePath, diagnostics, writeIndex, o
|
|
|
9191
9374
|
...diagnostic,
|
|
9192
9375
|
observedAt: diagnostic.observedAt ?? observedTs
|
|
9193
9376
|
}));
|
|
9194
|
-
|
|
9377
|
+
const rec = getOrCreate(filePath, key);
|
|
9378
|
+
commitDiagnostics(rec, filePath, correlated, observedTs, key);
|
|
9195
9379
|
}
|
|
9196
9380
|
async function reconcileStaleWidgetFiles(onStaleFile) {
|
|
9197
9381
|
const entries = [...files.entries()];
|
|
@@ -9404,6 +9588,28 @@ function getFileDiagnostics(filePath) {
|
|
|
9404
9588
|
applyPastEofGate(rec);
|
|
9405
9589
|
return rec.allDiagnostics.map((d) => ({ ...d }));
|
|
9406
9590
|
}
|
|
9591
|
+
function citedRowKey(row) {
|
|
9592
|
+
return JSON.stringify([
|
|
9593
|
+
normalizeEphemeralMapKey(row.citedFile ?? ""),
|
|
9594
|
+
row.line ?? null,
|
|
9595
|
+
findingIdentity(row)
|
|
9596
|
+
]);
|
|
9597
|
+
}
|
|
9598
|
+
function retireWidgetCitedRows(filePath, retired) {
|
|
9599
|
+
const rec = files.get(fileMapKey(filePath));
|
|
9600
|
+
if (!rec)
|
|
9601
|
+
return 0;
|
|
9602
|
+
const gone = new Set(normalizeDiagnostics(filePath, retired, 0).flatMap((row) => row.citedFile === void 0 ? [] : [citedRowKey(row)]));
|
|
9603
|
+
const kept = rec.allDiagnostics.filter((row) => !gone.has(citedRowKey(row)));
|
|
9604
|
+
const dropped = rec.allDiagnostics.length - kept.length;
|
|
9605
|
+
if (dropped === 0)
|
|
9606
|
+
return 0;
|
|
9607
|
+
rec.allDiagnostics = kept;
|
|
9608
|
+
rec.diagnostics = capStoredDiagnostics(kept);
|
|
9609
|
+
rec.diagnosticCounts = countDiagnostics(kept);
|
|
9610
|
+
requestRender();
|
|
9611
|
+
return dropped;
|
|
9612
|
+
}
|
|
9407
9613
|
function recordLsp(serverId, root, status, durationMs) {
|
|
9408
9614
|
const normalizedRoot = normalizeMapKey(root);
|
|
9409
9615
|
const key = `${serverId}@${normalizedRoot}`;
|
|
@@ -9480,14 +9686,14 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
|
|
|
9480
9686
|
const languageCount = promises3.length - auxIndices.size;
|
|
9481
9687
|
let languageRemaining = languageCount;
|
|
9482
9688
|
let auxGraceStarted = false;
|
|
9483
|
-
return new Promise((
|
|
9689
|
+
return new Promise((resolve7) => {
|
|
9484
9690
|
const timeout = setTimeout(() => {
|
|
9485
9691
|
completed = true;
|
|
9486
9692
|
if (graceTimer)
|
|
9487
9693
|
clearTimeout(graceTimer);
|
|
9488
9694
|
if (auxGraceTimer)
|
|
9489
9695
|
clearTimeout(auxGraceTimer);
|
|
9490
|
-
|
|
9696
|
+
resolve7(results.filter((r) => r !== void 0));
|
|
9491
9697
|
}, options.timeoutMs);
|
|
9492
9698
|
const finalize = () => {
|
|
9493
9699
|
if (completed)
|
|
@@ -9498,7 +9704,7 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
|
|
|
9498
9704
|
clearTimeout(graceTimer);
|
|
9499
9705
|
if (auxGraceTimer)
|
|
9500
9706
|
clearTimeout(auxGraceTimer);
|
|
9501
|
-
|
|
9707
|
+
resolve7(results.filter((r) => r !== void 0));
|
|
9502
9708
|
};
|
|
9503
9709
|
const startAuxGrace = () => {
|
|
9504
9710
|
if (auxGraceStarted || completed)
|
|
@@ -9558,7 +9764,7 @@ async function raceToCompletion(promises3, shouldComplete, options = { timeoutMs
|
|
|
9558
9764
|
|
|
9559
9765
|
// dist/clients/lsp/edits.js
|
|
9560
9766
|
import fs10 from "node:fs/promises";
|
|
9561
|
-
import { readFileSync as readFileSync8, realpathSync, statSync as
|
|
9767
|
+
import { readFileSync as readFileSync8, realpathSync, statSync as statSync7 } from "node:fs";
|
|
9562
9768
|
import path10 from "node:path";
|
|
9563
9769
|
import { URL as URL2 } from "node:url";
|
|
9564
9770
|
|
|
@@ -9989,7 +10195,7 @@ function captureRenameExpectedContent(edit, cwd, requestedAtMs, readTrackedSend,
|
|
|
9989
10195
|
try {
|
|
9990
10196
|
realPath = realpathSync.native(diskPath);
|
|
9991
10197
|
content = readFileSync8(realPath, "utf-8");
|
|
9992
|
-
mtimeMs =
|
|
10198
|
+
mtimeMs = statSync7(realPath).mtimeMs;
|
|
9993
10199
|
} catch {
|
|
9994
10200
|
continue;
|
|
9995
10201
|
}
|
|
@@ -10154,7 +10360,7 @@ function planWorkspaceEdit(edit, trackOrigins = false) {
|
|
|
10154
10360
|
}
|
|
10155
10361
|
function relativeToCwd(filePath, cwd) {
|
|
10156
10362
|
const rel = path10.relative(cwd, filePath) || path10.basename(filePath);
|
|
10157
|
-
return rel
|
|
10363
|
+
return toPosix(rel);
|
|
10158
10364
|
}
|
|
10159
10365
|
var IMPORT_RELEVANT_LINE = /^\s*import\b|^\s*export\s[^;]*\bfrom\s|\bfrom\s+['"]/;
|
|
10160
10366
|
function importsSignature(text) {
|
|
@@ -10205,19 +10411,17 @@ async function isSameFsEntry(a, b) {
|
|
|
10205
10411
|
return Boolean(statA && statB && isSameFsIdentity(statA, statB));
|
|
10206
10412
|
}
|
|
10207
10413
|
async function assertParentIsUsable(filePath, stateFor) {
|
|
10208
|
-
|
|
10209
|
-
|
|
10414
|
+
for (const current of walkUpDirs(path10.dirname(filePath), {
|
|
10415
|
+
spelling: true
|
|
10416
|
+
})) {
|
|
10210
10417
|
const known = await stateFor(current);
|
|
10211
10418
|
if (known.exists) {
|
|
10212
10419
|
if (!known.directory)
|
|
10213
10420
|
throw new Error(`resource parent is not a directory: ${current}`);
|
|
10214
10421
|
return;
|
|
10215
10422
|
}
|
|
10216
|
-
const parent = path10.dirname(current);
|
|
10217
|
-
if (parent === current)
|
|
10218
|
-
throw new Error(`resource parent does not exist: ${filePath}`);
|
|
10219
|
-
current = parent;
|
|
10220
10423
|
}
|
|
10424
|
+
throw new Error(`resource parent does not exist: ${filePath}`);
|
|
10221
10425
|
}
|
|
10222
10426
|
async function requireKernelIdentity(filePath, subject) {
|
|
10223
10427
|
const identity = await kernelPathIdentityAsync(filePath);
|
|
@@ -10369,7 +10573,7 @@ async function preflightWorkspaceEdit(planned, cwd, options) {
|
|
|
10369
10573
|
const newPath = await confine(op.newUri);
|
|
10370
10574
|
const oldDisk = uriToDiskPath(op.oldUri);
|
|
10371
10575
|
const newDisk = uriToDiskPath(op.newUri);
|
|
10372
|
-
if (path10.resolve(oldDisk)
|
|
10576
|
+
if (toPosix(path10.resolve(oldDisk)) === toPosix(path10.resolve(newDisk))) {
|
|
10373
10577
|
throw new Error("rename source and destination must differ");
|
|
10374
10578
|
}
|
|
10375
10579
|
const source = await stateFor(oldPath);
|
|
@@ -10956,21 +11160,14 @@ function clearWorkspaceDiagnosticsCacheAtAndAbove(cwd, ceiling = process.cwd())
|
|
|
10956
11160
|
const root = path12.resolve(cwd);
|
|
10957
11161
|
const workspaceRoot = path12.resolve(ceiling);
|
|
10958
11162
|
clearWorkspaceDiagnosticsCache(root);
|
|
10959
|
-
|
|
10960
|
-
if (relative3.startsWith(".." + path12.sep) || relative3 === ".." || path12.isAbsolute(relative3)) {
|
|
11163
|
+
if (relativeInside(workspaceRoot, root) === void 0)
|
|
10961
11164
|
return;
|
|
10962
|
-
}
|
|
10963
11165
|
if (normalizeMapKey(root) === normalizeMapKey(workspaceRoot))
|
|
10964
11166
|
return;
|
|
10965
|
-
|
|
10966
|
-
while (true) {
|
|
11167
|
+
for (const ancestor of walkUpDirs(path12.dirname(root), { spelling: true })) {
|
|
10967
11168
|
clearWorkspaceDiagnosticsCache(ancestor);
|
|
10968
11169
|
if (normalizeMapKey(ancestor) === normalizeMapKey(workspaceRoot))
|
|
10969
11170
|
return;
|
|
10970
|
-
const parent = path12.dirname(ancestor);
|
|
10971
|
-
if (parent === ancestor)
|
|
10972
|
-
return;
|
|
10973
|
-
ancestor = parent;
|
|
10974
11171
|
}
|
|
10975
11172
|
}
|
|
10976
11173
|
var _cacheEpochs = createGenerationMap("workspace-diagnostics-cache", {
|
|
@@ -11494,7 +11691,7 @@ async function killProcessTree(proc, pid, options = {}) {
|
|
|
11494
11691
|
return;
|
|
11495
11692
|
}
|
|
11496
11693
|
try {
|
|
11497
|
-
const taskkill =
|
|
11694
|
+
const taskkill = windowsExe("taskkill.exe");
|
|
11498
11695
|
const killer = nodeSpawn(taskkill, ["/F", "/T", "/PID", String(pid)], {
|
|
11499
11696
|
shell: false,
|
|
11500
11697
|
windowsHide: true,
|
|
@@ -11506,8 +11703,8 @@ async function killProcessTree(proc, pid, options = {}) {
|
|
|
11506
11703
|
proc.unref?.();
|
|
11507
11704
|
return;
|
|
11508
11705
|
}
|
|
11509
|
-
await new Promise((
|
|
11510
|
-
killer.once("close", () =>
|
|
11706
|
+
await new Promise((resolve7) => {
|
|
11707
|
+
killer.once("close", () => resolve7());
|
|
11511
11708
|
killer.once("error", (err) => {
|
|
11512
11709
|
logLatency({
|
|
11513
11710
|
type: "phase",
|
|
@@ -11516,7 +11713,7 @@ async function killProcessTree(proc, pid, options = {}) {
|
|
|
11516
11713
|
durationMs: 0,
|
|
11517
11714
|
metadata: { pid, platform: "win32", taskkillError: String(err) }
|
|
11518
11715
|
});
|
|
11519
|
-
|
|
11716
|
+
resolve7();
|
|
11520
11717
|
});
|
|
11521
11718
|
});
|
|
11522
11719
|
} catch (err) {
|
|
@@ -11574,18 +11771,18 @@ async function killProcessTree(proc, pid, options = {}) {
|
|
|
11574
11771
|
proc.unref?.();
|
|
11575
11772
|
return;
|
|
11576
11773
|
}
|
|
11577
|
-
const exitedInTime = await new Promise((
|
|
11774
|
+
const exitedInTime = await new Promise((resolve7) => {
|
|
11578
11775
|
if (proc.exitCode != null || proc.signalCode != null) {
|
|
11579
|
-
|
|
11776
|
+
resolve7(true);
|
|
11580
11777
|
return;
|
|
11581
11778
|
}
|
|
11582
11779
|
const onExit = () => {
|
|
11583
11780
|
clearTimeout(timer);
|
|
11584
|
-
|
|
11781
|
+
resolve7(true);
|
|
11585
11782
|
};
|
|
11586
11783
|
const timer = setTimeout(() => {
|
|
11587
11784
|
proc.off?.("exit", onExit);
|
|
11588
|
-
|
|
11785
|
+
resolve7(false);
|
|
11589
11786
|
}, 1500);
|
|
11590
11787
|
proc.once?.("exit", onExit);
|
|
11591
11788
|
});
|
|
@@ -11775,7 +11972,49 @@ function publicationCountsForPath(state4, normalizedPath) {
|
|
|
11775
11972
|
function diagnosticsVersionForPath(state4, normalizedPath) {
|
|
11776
11973
|
return state4.diagnosticsVersionsByPath?.get(normalizedPath) ?? 0;
|
|
11777
11974
|
}
|
|
11975
|
+
function diagnosticsPublishedAtForPath(state4, normalizedPath) {
|
|
11976
|
+
const ts = Math.max(state4.pushDiagnosticTimestamps?.get(normalizedPath) ?? 0, state4.documentPullDiagnosticTimestamps?.get(normalizedPath) ?? 0);
|
|
11977
|
+
return ts > 0 ? ts : void 0;
|
|
11978
|
+
}
|
|
11778
11979
|
var PENDING_RECEIPT_DROPPED = "pending-receipt-dropped";
|
|
11980
|
+
function noteOwnNoticeQueued(state4, normalizedPath, uri, sentVersion) {
|
|
11981
|
+
(state4.ownNoticeEchoes ??= /* @__PURE__ */ new Map()).set(normalizedPath, {
|
|
11982
|
+
uri,
|
|
11983
|
+
sentVersion,
|
|
11984
|
+
flushed: false,
|
|
11985
|
+
sawNonEmpty: false
|
|
11986
|
+
});
|
|
11987
|
+
}
|
|
11988
|
+
function noteOwnNoticeFlushed(state4, changes) {
|
|
11989
|
+
const echoes = state4.ownNoticeEchoes;
|
|
11990
|
+
if (!echoes)
|
|
11991
|
+
return;
|
|
11992
|
+
for (const [normalizedPath, echo] of echoes) {
|
|
11993
|
+
if (!echo.flushed && changes.length === 1 && changes[0]?.uri === echo.uri)
|
|
11994
|
+
echo.flushed = true;
|
|
11995
|
+
else
|
|
11996
|
+
echoes.delete(normalizedPath);
|
|
11997
|
+
}
|
|
11998
|
+
}
|
|
11999
|
+
function holdEmptyEchoOfOwnNotice(state4, normalizedPath, diagnosticCount, docVersion) {
|
|
12000
|
+
const echo = state4.ownNoticeEchoes?.get(normalizedPath);
|
|
12001
|
+
if (!echo || docVersion !== void 0 || echo.sentVersion !== state4.documentVersions.get(normalizedPath))
|
|
12002
|
+
return false;
|
|
12003
|
+
if (diagnosticCount > 0) {
|
|
12004
|
+
echo.sawNonEmpty = true;
|
|
12005
|
+
return false;
|
|
12006
|
+
}
|
|
12007
|
+
if (!echo.flushed || !echo.sawNonEmpty)
|
|
12008
|
+
return false;
|
|
12009
|
+
state4.ownNoticeEchoes?.delete(normalizedPath);
|
|
12010
|
+
countPublication(state4, normalizedPath);
|
|
12011
|
+
incrementDegradationCount({
|
|
12012
|
+
kind: "lsp-watched-echo-held",
|
|
12013
|
+
subject: state4.serverId,
|
|
12014
|
+
reason: "an empty version-less publish followed the client's own watched-files notice for a document the server had already reported on"
|
|
12015
|
+
});
|
|
12016
|
+
return true;
|
|
12017
|
+
}
|
|
11779
12018
|
function clearDiagnosticsForPath(state4, normalizedPath) {
|
|
11780
12019
|
const legacy = state4;
|
|
11781
12020
|
state4.pushDiagnostics?.delete(normalizedPath);
|
|
@@ -11790,6 +12029,7 @@ function clearDiagnosticsForPath(state4, normalizedPath) {
|
|
|
11790
12029
|
state4.documentPullDiagnosticTimestamps?.delete(normalizedPath);
|
|
11791
12030
|
state4.diagnosticDocVersions?.delete(normalizedPath);
|
|
11792
12031
|
state4.nonEmptyAnswerPhases?.delete(normalizedPath);
|
|
12032
|
+
state4.ownNoticeEchoes?.delete(normalizedPath);
|
|
11793
12033
|
state4.diagnosticBindings?.delete(normalizedPath);
|
|
11794
12034
|
state4.diagnosticsVersionsByPath?.delete(normalizedPath);
|
|
11795
12035
|
for (const key of pullSourceKeysForPath(state4, normalizedPath)) {
|
|
@@ -12149,6 +12389,9 @@ function setupIncomingHandlers(state4, initialization, onDiagnosticsPublished) {
|
|
|
12149
12389
|
}
|
|
12150
12390
|
return;
|
|
12151
12391
|
}
|
|
12392
|
+
if (holdEmptyEchoOfOwnNotice(state4, normalizedPath, newDiags.length, docVersion)) {
|
|
12393
|
+
return;
|
|
12394
|
+
}
|
|
12152
12395
|
if (PUB_DEBUG) {
|
|
12153
12396
|
logExtension({
|
|
12154
12397
|
subsystem: "lsp-pub",
|
|
@@ -12851,45 +13094,46 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
|
|
|
12851
13094
|
let outcome = await clientRequestPullDiagnostics(state4, filePath, timeoutMs);
|
|
12852
13095
|
if (outcome.status === "found") {
|
|
12853
13096
|
logTypeScriptPullSettle(state4, normalizedPath, Date.now() - pullSettleStartedAt, pullSettleSource);
|
|
12854
|
-
return;
|
|
13097
|
+
return "answered";
|
|
12855
13098
|
}
|
|
12856
13099
|
let sawClean = outcome.status === "clean";
|
|
12857
13100
|
const strategy = getStrategy(state4.serverId, state4.launchVariant);
|
|
12858
13101
|
const retryBudgetMs = strategy.pullRetryBudgetMs > 0 ? Math.min(timeoutMs, strategy.pullRetryBudgetMs) : 0;
|
|
12859
13102
|
const startedAt = Date.now();
|
|
12860
13103
|
while (outcome.status !== "found" && Date.now() - startedAt < retryBudgetMs) {
|
|
12861
|
-
await new Promise((
|
|
13104
|
+
await new Promise((resolve7) => setTimeout(resolve7, PULL_DIAGNOSTICS_RETRY_INTERVAL_MS));
|
|
12862
13105
|
outcome = await clientRequestPullDiagnostics(state4, filePath, Math.max(0, retryBudgetMs - (Date.now() - startedAt)));
|
|
12863
13106
|
if (outcome.status === "clean")
|
|
12864
13107
|
sawClean = true;
|
|
12865
13108
|
}
|
|
12866
13109
|
if (options.pullOnly) {
|
|
12867
|
-
|
|
13110
|
+
const answered = outcome.status === "found" || sawClean;
|
|
13111
|
+
if (answered) {
|
|
12868
13112
|
logTypeScriptPullSettle(state4, normalizedPath, Date.now() - pullSettleStartedAt, pullSettleSource);
|
|
12869
13113
|
}
|
|
12870
|
-
return;
|
|
13114
|
+
return answered ? "answered" : "deadline-expired";
|
|
12871
13115
|
}
|
|
12872
13116
|
if (outcome.status === "found" || sawClean) {
|
|
12873
13117
|
logTypeScriptPullSettle(state4, normalizedPath, Date.now() - pullSettleStartedAt, pullSettleSource);
|
|
12874
|
-
return;
|
|
13118
|
+
return "answered";
|
|
12875
13119
|
}
|
|
12876
13120
|
}
|
|
12877
13121
|
const laterReceiptPending = () => state4.pendingDiagnostics.has(normalizedPath);
|
|
12878
13122
|
const storedAnswerSettles = () => hasFreshDiagnostics() && !isVersionStale() && getMergedDiagnosticsForPath(state4, normalizedPath).length > 0;
|
|
12879
13123
|
if (storedAnswerSettles() && !laterReceiptPending()) {
|
|
12880
|
-
return;
|
|
13124
|
+
return "answered";
|
|
12881
13125
|
}
|
|
12882
13126
|
const answerStored = () => hasFreshDiagnostics() && !isVersionStale() && (state4.pushDiagnostics.has(normalizedPath) || state4.documentPullDiagnostics.has(normalizedPath));
|
|
12883
|
-
return new Promise((
|
|
13127
|
+
return new Promise((resolve7) => {
|
|
12884
13128
|
let debounceTimer;
|
|
12885
13129
|
let settleDeferred = storedAnswerSettles();
|
|
12886
|
-
const finish = () => {
|
|
13130
|
+
const finish = (outcome = "answered") => {
|
|
12887
13131
|
if (debounceTimer)
|
|
12888
13132
|
clearTimeout(debounceTimer);
|
|
12889
13133
|
state4.diagnosticEmitter.off("diagnostics", onDiagnostics);
|
|
12890
13134
|
state4.diagnosticEmitter.off(PENDING_RECEIPT_DROPPED, onReceiptDropped);
|
|
12891
13135
|
clearTimeout(timeout);
|
|
12892
|
-
|
|
13136
|
+
resolve7(outcome);
|
|
12893
13137
|
};
|
|
12894
13138
|
const onDiagnostics = (fp) => {
|
|
12895
13139
|
if (normalizeMapKey(fp) !== normalizedPath)
|
|
@@ -12921,7 +13165,7 @@ async function clientWaitForDiagnostics(state4, filePath, timeoutMs, options = {
|
|
|
12921
13165
|
};
|
|
12922
13166
|
state4.diagnosticEmitter.on("diagnostics", onDiagnostics);
|
|
12923
13167
|
state4.diagnosticEmitter.on(PENDING_RECEIPT_DROPPED, onReceiptDropped);
|
|
12924
|
-
const timeout = setTimeout(finish, timeoutMs);
|
|
13168
|
+
const timeout = setTimeout(() => finish(answerStored() ? "answered" : "deadline-expired"), timeoutMs);
|
|
12925
13169
|
});
|
|
12926
13170
|
}
|
|
12927
13171
|
function handleNotifyExternalChange(state4, filePath, type) {
|
|
@@ -13097,6 +13341,8 @@ async function handleNotifyOpenOnce(state4, filePath, content, languageId, prese
|
|
|
13097
13341
|
});
|
|
13098
13342
|
}
|
|
13099
13343
|
enqueueWatchedChange(state4, normalizedPath, uri, watchedType, onDisk);
|
|
13344
|
+
if (state4.holdsOwnNoticeEcho)
|
|
13345
|
+
noteOwnNoticeQueued(state4, normalizedPath, uri, 0);
|
|
13100
13346
|
}
|
|
13101
13347
|
if (!isClientAlive(state4))
|
|
13102
13348
|
return false;
|
|
@@ -13128,9 +13374,9 @@ function enqueueDocumentNotify(state4, normalizedPath, run, saved = false, readS
|
|
|
13128
13374
|
queue = { running: false, active: void 0 };
|
|
13129
13375
|
state4.notifyChangeQueues.set(normalizedPath, queue);
|
|
13130
13376
|
}
|
|
13131
|
-
return new Promise((
|
|
13377
|
+
return new Promise((resolve7, reject) => {
|
|
13132
13378
|
if (queue.closing && !close) {
|
|
13133
|
-
|
|
13379
|
+
resolve7(false);
|
|
13134
13380
|
return;
|
|
13135
13381
|
}
|
|
13136
13382
|
const previous = queue?.pending;
|
|
@@ -13144,7 +13390,7 @@ function enqueueDocumentNotify(state4, normalizedPath, run, saved = false, readS
|
|
|
13144
13390
|
const before = (a, b) => a !== void 0 && b !== void 0 && a < b;
|
|
13145
13391
|
const stale = previous !== void 0 && (saveOnly || before(readStamp, previous.readStamp) || before(readStamp, lastSent));
|
|
13146
13392
|
const heldStamp = before(previous?.readStamp, lastSent) ? void 0 : previous?.readStamp;
|
|
13147
|
-
waiters.push({ resolve:
|
|
13393
|
+
waiters.push({ resolve: resolve7, reject, stale });
|
|
13148
13394
|
queue.pending = {
|
|
13149
13395
|
run: stale ? previous.run : run,
|
|
13150
13396
|
saveOnly: stale ? previous.saveOnly : saveOnly,
|
|
@@ -13212,9 +13458,19 @@ function handleNotifySave(state4, filePath, onlyIfOwed = false) {
|
|
|
13212
13458
|
const normalizedPath = normalizeMapKey(filePath);
|
|
13213
13459
|
return enqueueDocumentNotify(state4, normalizedPath, (_count, _saved, debtOnly) => sendDidSaveForHeldDocument(state4, normalizedPath, debtOnly), true, void 0, false, true, onlyIfOwed);
|
|
13214
13460
|
}
|
|
13461
|
+
function toWireDocument(state4, content, contentHash2) {
|
|
13462
|
+
if (state4.serverId !== "powershell" || content.charCodeAt(0) !== 65279) {
|
|
13463
|
+
return { text: content, contentHash: contentHash2 };
|
|
13464
|
+
}
|
|
13465
|
+
return {
|
|
13466
|
+
text: ` ${content.slice(1)}`,
|
|
13467
|
+
contentHash: contentHash2 ?? hashDiagnosticContent(content)
|
|
13468
|
+
};
|
|
13469
|
+
}
|
|
13215
13470
|
function handleNotifyOpen(state4, filePath, content, languageId, preserveDiagnostics = false, silent = false, saved = false, readStamp, contentHash2) {
|
|
13216
13471
|
const normalizedPath = normalizeMapKey(filePath);
|
|
13217
|
-
|
|
13472
|
+
const wire = toWireDocument(state4, content, contentHash2);
|
|
13473
|
+
return enqueueDocumentNotify(state4, normalizedPath, (coalescedCount, queuedSaved) => handleNotifyOpenOnce(state4, filePath, wire.text, languageId, preserveDiagnostics, silent, coalescedCount, queuedSaved, wire.contentHash), saved, readStamp);
|
|
13218
13474
|
}
|
|
13219
13475
|
async function handleNotifyChangeOnce(state4, filePath, content, normalizedPath, coalescedCount = 0, saved = false, contentHash2) {
|
|
13220
13476
|
if (!isClientAlive(state4))
|
|
@@ -13258,7 +13514,8 @@ async function handleNotifyChangeOnce(state4, filePath, content, normalizedPath,
|
|
|
13258
13514
|
}
|
|
13259
13515
|
function handleNotifyChange(state4, filePath, content, contentHash2) {
|
|
13260
13516
|
const normalizedPath = normalizeMapKey(filePath);
|
|
13261
|
-
|
|
13517
|
+
const wire = toWireDocument(state4, content, contentHash2);
|
|
13518
|
+
return enqueueDocumentNotify(state4, normalizedPath, (coalescedCount, queuedSaved) => handleNotifyChangeOnce(state4, filePath, wire.text, normalizedPath, coalescedCount, queuedSaved, wire.contentHash));
|
|
13262
13519
|
}
|
|
13263
13520
|
async function closedAndGone(state4, filePath, normalizedPath) {
|
|
13264
13521
|
if (!state4.closedDocuments?.has(normalizedPath))
|
|
@@ -13449,10 +13706,10 @@ async function navRequest(state4, method, params, staleCheckPath, timeoutMs = NA
|
|
|
13449
13706
|
scope: normalizedPath,
|
|
13450
13707
|
requestStartedAt
|
|
13451
13708
|
});
|
|
13452
|
-
|
|
13709
|
+
throw new LspRequestTimeoutError(method, timeoutMs, Date.now() - requestStartedAt);
|
|
13453
13710
|
}
|
|
13454
13711
|
if (err instanceof Error && err.message.startsWith("Timeout after")) {
|
|
13455
|
-
|
|
13712
|
+
throw new LspRequestTimeoutError(method, timeoutMs, Date.now() - requestStartedAt);
|
|
13456
13713
|
}
|
|
13457
13714
|
throw err;
|
|
13458
13715
|
});
|
|
@@ -13722,7 +13979,7 @@ function hasNotifyInFlightFor(state4, filePath) {
|
|
|
13722
13979
|
}
|
|
13723
13980
|
async function createLSPClient(options) {
|
|
13724
13981
|
installCrashGuard();
|
|
13725
|
-
const { serverId, process: lspProcess, root, sessionCwd, initialization, initializeTimeoutMs = INITIALIZE_TIMEOUT_MS, launchVariant, settingsSection, role, onDiagnosticsPublished } = options;
|
|
13982
|
+
const { serverId, process: lspProcess, root, sessionCwd, initialization, initializeTimeoutMs = INITIALIZE_TIMEOUT_MS, launchVariant, settingsSection, role, custom, echoesOwnNotice, onDiagnosticsPublished } = options;
|
|
13726
13983
|
void recordLspChild({
|
|
13727
13984
|
pid: lspProcess.pid,
|
|
13728
13985
|
serverId,
|
|
@@ -13789,7 +14046,9 @@ async function createLSPClient(options) {
|
|
|
13789
14046
|
lspProcess.stdin.on("error", streamErrorHandler("stdin"));
|
|
13790
14047
|
lspProcess.stdout.on("error", streamErrorHandler("stdout"));
|
|
13791
14048
|
lspProcess.stderr.on("error", streamErrorHandler("stderr"));
|
|
13792
|
-
const
|
|
14049
|
+
const reader = new import_node.StreamMessageReader(lspProcess.stdout);
|
|
14050
|
+
reader.partialMessageTimeout = 0;
|
|
14051
|
+
const connection = (0, import_node.createMessageConnection)(reader, new import_node.StreamMessageWriter(lspProcess.stdin));
|
|
13793
14052
|
const diagnosticEmitter = new EventEmitter();
|
|
13794
14053
|
diagnosticEmitter.setMaxListeners(50);
|
|
13795
14054
|
const state4 = {
|
|
@@ -13835,6 +14094,9 @@ async function createLSPClient(options) {
|
|
|
13835
14094
|
// #4764: the declared role, so a config-load failure gates only an
|
|
13836
14095
|
// auxiliary scanner's empty publications.
|
|
13837
14096
|
...role !== void 0 && { serverRole: role },
|
|
14097
|
+
// #5131 round 2: the echo hold reads a config-declared server, or a
|
|
14098
|
+
// built-in row that declares `echoesOwnNotice`.
|
|
14099
|
+
holdsOwnNoticeEcho: custom === true || echoesOwnNotice === true,
|
|
13838
14100
|
// #3310: one-shot, per client session.
|
|
13839
14101
|
emptyFirstPublishHoldSpent: false,
|
|
13840
14102
|
rulesGeneration: 0,
|
|
@@ -13870,6 +14132,7 @@ async function createLSPClient(options) {
|
|
|
13870
14132
|
(changes) => {
|
|
13871
14133
|
if (!isClientAlive(state4))
|
|
13872
14134
|
return;
|
|
14135
|
+
noteOwnNoticeFlushed(state4, changes);
|
|
13873
14136
|
void safeSendNotification(state4.connection, "workspace/didChangeWatchedFiles", { changes });
|
|
13874
14137
|
},
|
|
13875
14138
|
void 0,
|
|
@@ -14026,6 +14289,9 @@ async function createLSPClient(options) {
|
|
|
14026
14289
|
getDiagnosticsVersionForPath(filePath) {
|
|
14027
14290
|
return diagnosticsVersionForPath(state4, normalizeMapKey(filePath));
|
|
14028
14291
|
},
|
|
14292
|
+
getDiagnosticsPublishedAt(filePath) {
|
|
14293
|
+
return diagnosticsPublishedAtForPath(state4, normalizeMapKey(filePath));
|
|
14294
|
+
},
|
|
14029
14295
|
getPublicationCountsForPath(filePath) {
|
|
14030
14296
|
return publicationCountsForPath(state4, normalizeMapKey(filePath));
|
|
14031
14297
|
},
|
|
@@ -14038,7 +14304,7 @@ async function createLSPClient(options) {
|
|
|
14038
14304
|
for (const key of keys) {
|
|
14039
14305
|
result.set(key, {
|
|
14040
14306
|
diags: getMergedDiagnosticsForPath(state4, key),
|
|
14041
|
-
ts:
|
|
14307
|
+
ts: diagnosticsPublishedAtForPath(state4, key) ?? 0,
|
|
14042
14308
|
binding: state4.diagnosticBindings.get(key)
|
|
14043
14309
|
});
|
|
14044
14310
|
}
|
|
@@ -14060,7 +14326,7 @@ async function createLSPClient(options) {
|
|
|
14060
14326
|
]);
|
|
14061
14327
|
for (const key of keys) {
|
|
14062
14328
|
const diags = getMergedDiagnosticsForPath(state4, key);
|
|
14063
|
-
const ts =
|
|
14329
|
+
const ts = diagnosticsPublishedAtForPath(state4, key) ?? 0;
|
|
14064
14330
|
if (!predicate(key, ts, diags))
|
|
14065
14331
|
continue;
|
|
14066
14332
|
clearDiagnosticsForPath(state4, key);
|
|
@@ -14376,8 +14642,8 @@ async function safeSendRequest(connection, method, params, signal, settlement, r
|
|
|
14376
14642
|
if (signal) {
|
|
14377
14643
|
tokenSource = new import_node.CancellationTokenSource();
|
|
14378
14644
|
if (releaseOnAbort) {
|
|
14379
|
-
released = new Promise((
|
|
14380
|
-
release = () =>
|
|
14645
|
+
released = new Promise((resolve7) => {
|
|
14646
|
+
release = () => resolve7(RELEASED_ON_ABORT);
|
|
14381
14647
|
});
|
|
14382
14648
|
}
|
|
14383
14649
|
onAbort = () => {
|
|
@@ -14601,7 +14867,7 @@ function fileOperationUriCandidates(uri) {
|
|
|
14601
14867
|
return [];
|
|
14602
14868
|
let uriPath;
|
|
14603
14869
|
try {
|
|
14604
|
-
uriPath = decodeURIComponent(parsed.pathname)
|
|
14870
|
+
uriPath = toPosix(decodeURIComponent(parsed.pathname));
|
|
14605
14871
|
} catch {
|
|
14606
14872
|
return [];
|
|
14607
14873
|
}
|
|
@@ -14712,8 +14978,6 @@ var ClientRegistry = class {
|
|
|
14712
14978
|
hooks;
|
|
14713
14979
|
sessionCwd;
|
|
14714
14980
|
workspaceProbeLogged = /* @__PURE__ */ new Set();
|
|
14715
|
-
/** Per-service immutable root-boundary verdicts; root detectors cache hits too. */
|
|
14716
|
-
projectBoundaryCache = /* @__PURE__ */ new Map();
|
|
14717
14981
|
/** Foreign roots are recorded once per normalized root for this service/session. */
|
|
14718
14982
|
warmStartLogged = /* @__PURE__ */ new Set();
|
|
14719
14983
|
optionalFailureLogged = /* @__PURE__ */ new Set();
|
|
@@ -14913,32 +15177,23 @@ var ClientRegistry = class {
|
|
|
14913
15177
|
if (!key.startsWith(prefix))
|
|
14914
15178
|
continue;
|
|
14915
15179
|
const ancestorKey = key.slice(prefix.length);
|
|
14916
|
-
|
|
14917
|
-
const relative3 = pathApi.relative(ancestorKey, rootKey);
|
|
14918
|
-
if (relative3 === "" || relative3.startsWith("..") || pathApi.isAbsolute(relative3)) {
|
|
15180
|
+
if (ancestorKey === rootKey || !isWithinForm(rootKey, ancestorKey))
|
|
14919
15181
|
continue;
|
|
14920
|
-
}
|
|
14921
15182
|
if (!nearestAncestor || ancestorKey.length > nearestAncestor.length) {
|
|
14922
15183
|
nearestAncestor = ancestorKey;
|
|
14923
15184
|
}
|
|
14924
15185
|
}
|
|
14925
15186
|
if (!nearestAncestor)
|
|
14926
15187
|
return root;
|
|
14927
|
-
|
|
14928
|
-
let boundary = this.projectBoundaryCache.get(boundaryKey);
|
|
14929
|
-
if (!boundary) {
|
|
14930
|
-
boundary = hasProjectBoundaryMarker(root, server);
|
|
14931
|
-
this.projectBoundaryCache.set(boundaryKey, boundary);
|
|
14932
|
-
}
|
|
14933
|
-
if (await boundary)
|
|
15188
|
+
if (await hasProjectBoundaryMarker(root, server))
|
|
14934
15189
|
return root;
|
|
14935
15190
|
return this.clients.get(`${server.id}:${nearestAncestor}`)?.root ?? nearestAncestor;
|
|
14936
15191
|
}
|
|
14937
15192
|
async withClientSpawnGate(operation) {
|
|
14938
15193
|
const previous = this.clientSpawnGate;
|
|
14939
15194
|
let release;
|
|
14940
|
-
this.clientSpawnGate = new Promise((
|
|
14941
|
-
release =
|
|
15195
|
+
this.clientSpawnGate = new Promise((resolve7) => {
|
|
15196
|
+
release = resolve7;
|
|
14942
15197
|
});
|
|
14943
15198
|
await previous;
|
|
14944
15199
|
try {
|
|
@@ -15400,7 +15655,7 @@ var ClientRegistry = class {
|
|
|
15400
15655
|
shouldAllowInstall(serverId) {
|
|
15401
15656
|
if (!assertInstallAllowed(`lsp install: ${serverId}`))
|
|
15402
15657
|
return false;
|
|
15403
|
-
return
|
|
15658
|
+
return !isLspInstallDisabled();
|
|
15404
15659
|
}
|
|
15405
15660
|
/**
|
|
15406
15661
|
* Internal: spawn a client for a server/root combination
|
|
@@ -15489,6 +15744,10 @@ var ClientRegistry = class {
|
|
|
15489
15744
|
// #4764: the declared role travels with the client, so a failed server
|
|
15490
15745
|
// config can gate an auxiliary scanner's empty publications only.
|
|
15491
15746
|
role: server.role,
|
|
15747
|
+
// #5131 round 2: the config-declared flag gates the echo hold; a
|
|
15748
|
+
// built-in row with the same behaviour declares `echoesOwnNotice`.
|
|
15749
|
+
custom: server.custom,
|
|
15750
|
+
echoesOwnNotice: server.echoesOwnNotice,
|
|
15492
15751
|
onDiagnosticsPublished: (serverId) => {
|
|
15493
15752
|
this.hooks.noteDiagnosticsPublished(serverId);
|
|
15494
15753
|
}
|
|
@@ -15858,8 +16117,9 @@ function admitPackageName(names, name) {
|
|
|
15858
16117
|
}
|
|
15859
16118
|
function declaredPackageNames(startDir) {
|
|
15860
16119
|
const names = /* @__PURE__ */ new Set();
|
|
15861
|
-
|
|
15862
|
-
|
|
16120
|
+
for (const dir of walkUpDirs(startDir, {
|
|
16121
|
+
maxDepth: ENV_NODE_MODULES_WALK_MAX_LEVELS
|
|
16122
|
+
})) {
|
|
15863
16123
|
try {
|
|
15864
16124
|
const manifest = JSON.parse(fs12.readFileSync(path15.join(dir, "package.json"), "utf8"));
|
|
15865
16125
|
for (const field of DECLARING_FIELDS) {
|
|
@@ -15878,10 +16138,6 @@ function declaredPackageNames(startDir) {
|
|
|
15878
16138
|
}
|
|
15879
16139
|
} catch {
|
|
15880
16140
|
}
|
|
15881
|
-
const parent = path15.dirname(dir);
|
|
15882
|
-
if (parent === dir)
|
|
15883
|
-
break;
|
|
15884
|
-
dir = parent;
|
|
15885
16141
|
}
|
|
15886
16142
|
return names;
|
|
15887
16143
|
}
|
|
@@ -15907,8 +16163,11 @@ function environmentGapKind(diagnostic) {
|
|
|
15907
16163
|
return name !== void 0 && NODE_GLOBALS.has(name) ? { code } : void 0;
|
|
15908
16164
|
}
|
|
15909
16165
|
function hasResolvableNodeModules(startDir, stat3 = (candidate) => fs12.statSync(candidate)) {
|
|
15910
|
-
let
|
|
15911
|
-
for (
|
|
16166
|
+
let last;
|
|
16167
|
+
for (const dir of walkUpDirs(startDir, {
|
|
16168
|
+
maxDepth: ENV_NODE_MODULES_WALK_MAX_LEVELS
|
|
16169
|
+
})) {
|
|
16170
|
+
last = dir;
|
|
15912
16171
|
try {
|
|
15913
16172
|
stat3(path15.join(dir, "node_modules"));
|
|
15914
16173
|
return true;
|
|
@@ -15917,12 +16176,8 @@ function hasResolvableNodeModules(startDir, stat3 = (candidate) => fs12.statSync
|
|
|
15917
16176
|
return true;
|
|
15918
16177
|
}
|
|
15919
16178
|
}
|
|
15920
|
-
const parent = path15.dirname(dir);
|
|
15921
|
-
if (parent === dir)
|
|
15922
|
-
return false;
|
|
15923
|
-
dir = parent;
|
|
15924
16179
|
}
|
|
15925
|
-
return
|
|
16180
|
+
return last === void 0 || path15.dirname(last) !== last;
|
|
15926
16181
|
}
|
|
15927
16182
|
function demoteEnvironmentGapDiagnostics(diagnostics, options) {
|
|
15928
16183
|
const candidates = /* @__PURE__ */ new Map();
|
|
@@ -15933,7 +16188,7 @@ function demoteEnvironmentGapDiagnostics(diagnostics, options) {
|
|
|
15933
16188
|
}
|
|
15934
16189
|
if (candidates.size === 0)
|
|
15935
16190
|
return diagnostics;
|
|
15936
|
-
const startDir = options.startDir ?? path15.dirname(options.filePath);
|
|
16191
|
+
const startDir = options.startDir ?? path15.dirname(realpathOrResolve(options.filePath));
|
|
15937
16192
|
if (hasResolvableNodeModules(startDir, options.stat))
|
|
15938
16193
|
return diagnostics;
|
|
15939
16194
|
let declared;
|
|
@@ -16000,13 +16255,13 @@ function isTsProjectFile(filePath) {
|
|
|
16000
16255
|
return TS_PROJECT_EXTENSIONS.has(path16.extname(filePath).toLowerCase());
|
|
16001
16256
|
}
|
|
16002
16257
|
function suggestTsconfigInclude(filePath, cwd) {
|
|
16003
|
-
const
|
|
16004
|
-
if (path16.posix.isAbsolute(
|
|
16005
|
-
const dir =
|
|
16006
|
-
return dir ? `${dir}/**` :
|
|
16258
|
+
const relative2 = toProjectRelativePath(filePath, cwd);
|
|
16259
|
+
if (path16.posix.isAbsolute(relative2) || /^[A-Za-z]:/.test(relative2)) {
|
|
16260
|
+
const dir = relative2.slice(0, relative2.lastIndexOf("/"));
|
|
16261
|
+
return dir ? `${dir}/**` : relative2;
|
|
16007
16262
|
}
|
|
16008
|
-
const segments =
|
|
16009
|
-
return segments.length > 1 ? `${segments[0]}/**` :
|
|
16263
|
+
const segments = relative2.split("/").filter(Boolean);
|
|
16264
|
+
return segments.length > 1 ? `${segments[0]}/**` : relative2;
|
|
16010
16265
|
}
|
|
16011
16266
|
function inferredProjectNotice(filePath, cwd) {
|
|
16012
16267
|
return `[${INFERRED_PROJECT_MARKER}; add ${suggestTsconfigInclude(filePath, cwd)} to a tsconfig for authoritative checking]`;
|
|
@@ -16138,7 +16393,7 @@ function createLazyImport(load) {
|
|
|
16138
16393
|
}
|
|
16139
16394
|
|
|
16140
16395
|
// dist/clients/lsp-lazy.js
|
|
16141
|
-
var lazyLsp = createLazyImport(() => import("./chunk-
|
|
16396
|
+
var lazyLsp = createLazyImport(() => import("./chunk-UAKO2M6B.js"));
|
|
16142
16397
|
function warmLspService() {
|
|
16143
16398
|
return lazyLsp.get();
|
|
16144
16399
|
}
|
|
@@ -16321,12 +16576,23 @@ var DIAGNOSTICS_SEMANTIC_SETTLE_THRESHOLD_MS = Math.max(0, Number.parseInt(proce
|
|
|
16321
16576
|
var DIAGNOSTICS_SEMANTIC_SETTLE_WAIT_MS = Math.max(0, Number.parseInt(process.env.PI_LENS_LSP_DIAGNOSTICS_SEMANTIC_SETTLE_MS ?? "400", 10) || 400);
|
|
16322
16577
|
var EARLY_UNBLOCK_GRACE_MS = Math.max(0, Number.parseInt(process.env.PI_LENS_LSP_EARLY_UNBLOCK_GRACE_MS ?? "400", 10) || 400);
|
|
16323
16578
|
function unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath) {
|
|
16324
|
-
if (spawned.some((entry) => !isAuxiliary(entry.info)))
|
|
16325
|
-
return { serverIds: [], disabledServerIds: [], cause: "unstarted" };
|
|
16326
16579
|
const { disabledServerIds, fallbackServerIds } = disabledPrimaries(filePath);
|
|
16327
|
-
const
|
|
16328
|
-
|
|
16329
|
-
|
|
16580
|
+
const standIns = new Set(fallbackServerIds);
|
|
16581
|
+
const acquired = /* @__PURE__ */ new Set();
|
|
16582
|
+
for (const entry of spawned) {
|
|
16583
|
+
if (isAuxiliary(entry.info))
|
|
16584
|
+
continue;
|
|
16585
|
+
if (entry.info.fallbackFor === void 0 || standIns.has(entry.info.id))
|
|
16586
|
+
return { serverIds: [], disabledServerIds: [], cause: "unstarted" };
|
|
16587
|
+
acquired.add(entry.info.id);
|
|
16588
|
+
}
|
|
16589
|
+
const missing = /* @__PURE__ */ new Set();
|
|
16590
|
+
for (const id of resolvedPrimaryRoots.keys())
|
|
16591
|
+
if (!acquired.has(id))
|
|
16592
|
+
missing.add(id);
|
|
16593
|
+
for (const id of disabledServerIds)
|
|
16594
|
+
missing.add(id);
|
|
16595
|
+
const serverIds = [...missing];
|
|
16330
16596
|
return {
|
|
16331
16597
|
serverIds,
|
|
16332
16598
|
disabledServerIds,
|
|
@@ -16439,11 +16705,11 @@ async function collectWorkspaceDiagnosticFiles(root, maxFiles = getMaxWorkspaceD
|
|
|
16439
16705
|
continue;
|
|
16440
16706
|
await walk(full);
|
|
16441
16707
|
} else if (
|
|
16442
|
-
// #1974: the getServersForFileWithConfig lookup (an
|
|
16443
|
-
//
|
|
16444
|
-
//
|
|
16445
|
-
//
|
|
16446
|
-
// walkers fixed for #1974.
|
|
16708
|
+
// #1974: the getServersForFileWithConfig lookup (an extension match
|
|
16709
|
+
// against the registered LSP servers; Bash's pathFilter also reads up
|
|
16710
|
+
// to 4 KB of the file from disk) still gates first, ahead of
|
|
16711
|
+
// isIgnored's per-call minimatch pattern compile — the same
|
|
16712
|
+
// order-independent shape as the four walkers fixed for #1974.
|
|
16447
16713
|
entry.isFile() && getServersForFileWithConfig(full).length > 0 && !ignoreMatcher.isIgnored(full, false)
|
|
16448
16714
|
) {
|
|
16449
16715
|
files2.push(full);
|
|
@@ -16470,7 +16736,7 @@ var LSPService = class _LSPService {
|
|
|
16470
16736
|
/**
|
|
16471
16737
|
* One first-contact diagnostic wait per custom server in this service
|
|
16472
16738
|
* generation. Concurrent touches share the probe; a hook cutoff never arms
|
|
16473
|
-
* the
|
|
16739
|
+
* the diagnostics-unsupported latch, so the next touch can try again.
|
|
16474
16740
|
*/
|
|
16475
16741
|
firstContactWaits = /* @__PURE__ */ new Map();
|
|
16476
16742
|
/** Session-scoped adaptive demotion for budget-hitting auxiliaries. */
|
|
@@ -16649,6 +16915,7 @@ var LSPService = class _LSPService {
|
|
|
16649
16915
|
},
|
|
16650
16916
|
noteDiagnosticsPublished: (serverId) => {
|
|
16651
16917
|
this.state.diagnosticsPublished.add(serverId);
|
|
16918
|
+
this.state.diagnosticsUnsupported.delete(serverId);
|
|
16652
16919
|
}
|
|
16653
16920
|
}, generationHandoff, sessionCwd);
|
|
16654
16921
|
this.state = {
|
|
@@ -16663,6 +16930,25 @@ var LSPService = class _LSPService {
|
|
|
16663
16930
|
diagnosticsUnsupported: /* @__PURE__ */ new Set()
|
|
16664
16931
|
};
|
|
16665
16932
|
}
|
|
16933
|
+
/**
|
|
16934
|
+
* Latch a custom push-only server diagnostics-unsupported after silence
|
|
16935
|
+
* through its first-contact wait. The one writer of the latch, so `published`
|
|
16936
|
+
* implies `!unsupported` holds at the add as well as at the publish (#5128):
|
|
16937
|
+
* a publish for another file that landed during this file's wait proves the
|
|
16938
|
+
* server pushes, so the silence is a timeout and no latch is set. Returns
|
|
16939
|
+
* whether the server is now latched.
|
|
16940
|
+
*/
|
|
16941
|
+
latchDiagnosticsUnsupported(serverId) {
|
|
16942
|
+
if (this.state.diagnosticsPublished.has(serverId))
|
|
16943
|
+
return false;
|
|
16944
|
+
this.state.diagnosticsUnsupported.add(serverId);
|
|
16945
|
+
recordDegradationOnce({
|
|
16946
|
+
kind: "lsp-diagnostics-unsupported",
|
|
16947
|
+
subject: serverId,
|
|
16948
|
+
reason: "custom server has no pull provider and no publish evidence after first contact wait"
|
|
16949
|
+
});
|
|
16950
|
+
return true;
|
|
16951
|
+
}
|
|
16666
16952
|
isAuxiliaryWaitDemoted(serverId, root) {
|
|
16667
16953
|
return this.demotedAuxiliaryServerIds.has(`${serverId}:${normalizeMapKey(root ?? "")}`);
|
|
16668
16954
|
}
|
|
@@ -17481,8 +17767,8 @@ var LSPService = class _LSPService {
|
|
|
17481
17767
|
return { outstandingMs: 0 };
|
|
17482
17768
|
}
|
|
17483
17769
|
let resolveSettled;
|
|
17484
|
-
const settled = new Promise((
|
|
17485
|
-
resolveSettled =
|
|
17770
|
+
const settled = new Promise((resolve7) => {
|
|
17771
|
+
resolveSettled = resolve7;
|
|
17486
17772
|
});
|
|
17487
17773
|
const token = {
|
|
17488
17774
|
startedAt: Date.now(),
|
|
@@ -17696,8 +17982,8 @@ var LSPService = class _LSPService {
|
|
|
17696
17982
|
const effectiveMaxWaitMs = hardCapMs !== void 0 ? serverBaseMs > 0 ? Math.min(serverBaseMs, hardCapMs) : hardCapMs : serverBaseMs;
|
|
17697
17983
|
let knownSlowResolve;
|
|
17698
17984
|
const knownSlowSentinel = /* @__PURE__ */ Symbol("lsp-client-wait-known-slow");
|
|
17699
|
-
const knownSlow = new Promise((
|
|
17700
|
-
knownSlowResolve = () =>
|
|
17985
|
+
const knownSlow = new Promise((resolve7) => {
|
|
17986
|
+
knownSlowResolve = () => resolve7(knownSlowSentinel);
|
|
17701
17987
|
});
|
|
17702
17988
|
const noteSpawnInFlight = (serverId) => {
|
|
17703
17989
|
const knownDurationMs = getSuccessfulLspSpawnDurationMs(serverId);
|
|
@@ -17788,8 +18074,8 @@ var LSPService = class _LSPService {
|
|
|
17788
18074
|
waitResult = await Promise.race([
|
|
17789
18075
|
withBudget(),
|
|
17790
18076
|
knownSlow,
|
|
17791
|
-
new Promise((
|
|
17792
|
-
waitTimer = setTimeout(() =>
|
|
18077
|
+
new Promise((resolve7) => {
|
|
18078
|
+
waitTimer = setTimeout(() => resolve7(timeoutSentinel), effectiveMaxWaitMs);
|
|
17793
18079
|
})
|
|
17794
18080
|
]);
|
|
17795
18081
|
} finally {
|
|
@@ -19091,41 +19377,17 @@ var LSPService = class _LSPService {
|
|
|
19091
19377
|
return waitForDiagnostics().catch(() => void 0);
|
|
19092
19378
|
let shared = this.firstContactWaits.get(entry.info.id);
|
|
19093
19379
|
if (!shared) {
|
|
19094
|
-
|
|
19095
|
-
const
|
|
19096
|
-
const onShutdown = () => resolve8("shutdown");
|
|
19097
|
-
if (this.shutdownController.signal.aborted) {
|
|
19098
|
-
onShutdown();
|
|
19099
|
-
return;
|
|
19100
|
-
}
|
|
19101
|
-
this.shutdownController.signal.addEventListener("abort", onShutdown, {
|
|
19102
|
-
once: true
|
|
19103
|
-
});
|
|
19104
|
-
removeShutdownListener = () => this.shutdownController.signal.removeEventListener("abort", onShutdown);
|
|
19105
|
-
});
|
|
19106
|
-
const probe = Promise.race([
|
|
19107
|
-
waitForDiagnostics().then(() => "completed", () => "errored"),
|
|
19108
|
-
shutdown
|
|
19109
|
-
]);
|
|
19110
|
-
const completed = withDeadline(probe, {
|
|
19111
|
-
ms: serverTimeout,
|
|
19112
|
-
onTimeout: "undefined"
|
|
19113
|
-
});
|
|
19380
|
+
const probe = waitForDiagnostics().then(() => "completed", () => "errored");
|
|
19381
|
+
const completed = withDeadline(untilAborted(probe, this.shutdownController.signal, "shutdown"), { ms: serverTimeout, onTimeout: "undefined" });
|
|
19114
19382
|
shared = completed.then((outcome) => {
|
|
19115
19383
|
if (outcome === "errored" || outcome === "shutdown") {
|
|
19116
19384
|
return "errored";
|
|
19117
19385
|
}
|
|
19118
19386
|
if (answeredForThisTouch(entry))
|
|
19119
19387
|
return "answered";
|
|
19120
|
-
this.
|
|
19121
|
-
recordDegradationOnce({
|
|
19122
|
-
kind: "lsp-diagnostics-unsupported",
|
|
19123
|
-
subject: entry.info.id,
|
|
19124
|
-
reason: "custom server has no pull provider and no publish evidence after first contact wait"
|
|
19125
|
-
});
|
|
19388
|
+
this.latchDiagnosticsUnsupported(entry.info.id);
|
|
19126
19389
|
return "silent";
|
|
19127
19390
|
}).catch(() => "errored").finally(() => {
|
|
19128
|
-
removeShutdownListener?.();
|
|
19129
19391
|
if (this.firstContactWaits.get(entry.info.id) === shared) {
|
|
19130
19392
|
this.firstContactWaits.delete(entry.info.id);
|
|
19131
19393
|
}
|
|
@@ -19180,8 +19442,8 @@ var LSPService = class _LSPService {
|
|
|
19180
19442
|
};
|
|
19181
19443
|
}
|
|
19182
19444
|
let timer;
|
|
19183
|
-
const timeout = new Promise((
|
|
19184
|
-
timer = setTimeout(() =>
|
|
19445
|
+
const timeout = new Promise((resolve7) => {
|
|
19446
|
+
timer = setTimeout(() => resolve7(false), budgetMs);
|
|
19185
19447
|
if (typeof timer === "object" && "unref" in timer) {
|
|
19186
19448
|
timer.unref?.();
|
|
19187
19449
|
}
|
|
@@ -19279,8 +19541,8 @@ var LSPService = class _LSPService {
|
|
|
19279
19541
|
const graceMs = readTsserverSyncGraceMs();
|
|
19280
19542
|
const primaryClient = spawned[0].client;
|
|
19281
19543
|
const syncRacer = (async () => {
|
|
19282
|
-
await new Promise((
|
|
19283
|
-
const timer = setTimeout(
|
|
19544
|
+
await new Promise((resolve7) => {
|
|
19545
|
+
const timer = setTimeout(resolve7, graceMs);
|
|
19284
19546
|
timer.unref?.();
|
|
19285
19547
|
});
|
|
19286
19548
|
const publishedAt = primaryClient.getAllDiagnostics?.().get(normalizedPath)?.ts;
|
|
@@ -19316,13 +19578,9 @@ var LSPService = class _LSPService {
|
|
|
19316
19578
|
const entry = spawned.find((candidate) => candidate.info.id === serverId);
|
|
19317
19579
|
if (!entry || answeredForThisTouch(entry))
|
|
19318
19580
|
continue;
|
|
19319
|
-
this.
|
|
19581
|
+
if (!this.latchDiagnosticsUnsupported(serverId))
|
|
19582
|
+
continue;
|
|
19320
19583
|
diagnosticsUnsupportedServerIds.push(serverId);
|
|
19321
|
-
recordDegradationOnce({
|
|
19322
|
-
kind: "lsp-diagnostics-unsupported",
|
|
19323
|
-
subject: serverId,
|
|
19324
|
-
reason: "custom server has no pull provider and no publish evidence after first contact wait"
|
|
19325
|
-
});
|
|
19326
19584
|
}
|
|
19327
19585
|
for (const entry of spawned) {
|
|
19328
19586
|
if (entry.info.custom === true && this.state.diagnosticsUnsupported.has(entry.info.id)) {
|
|
@@ -19469,6 +19727,13 @@ var LSPService = class _LSPService {
|
|
|
19469
19727
|
...uncoveredDeferredServerIds,
|
|
19470
19728
|
...staleWriteAuxiliaryServerIds
|
|
19471
19729
|
]);
|
|
19730
|
+
const answerAtMerge = options.collectDiagnostics ? new Map(spawned.map((entry) => [
|
|
19731
|
+
entry.client,
|
|
19732
|
+
{
|
|
19733
|
+
pathVersion: readPathVersion(entry.client),
|
|
19734
|
+
publishedAt: entry.client.getDiagnosticsPublishedAt?.(filePath)
|
|
19735
|
+
}
|
|
19736
|
+
])) : void 0;
|
|
19472
19737
|
let collected = options.collectDiagnostics ? tsserverSyncConfirmed !== void 0 ? mergeLspDiagnostics(attributeDiagnostics(spawned[0]?.info.id ?? "unknown", tsserverSyncConfirmed)) : mergeLspDiagnostics([
|
|
19473
19738
|
// #1459: a DEFERRED server's cache still holds the PREVIOUS
|
|
19474
19739
|
// content's findings — the resync that would have cleared it never
|
|
@@ -19694,6 +19959,27 @@ var LSPService = class _LSPService {
|
|
|
19694
19959
|
);
|
|
19695
19960
|
result.binding = binding;
|
|
19696
19961
|
}
|
|
19962
|
+
if (collected !== void 0 && !syncConfirmed) {
|
|
19963
|
+
let reusedAnswer;
|
|
19964
|
+
for (const entry of spawned) {
|
|
19965
|
+
if (isAuxiliary(entry.info))
|
|
19966
|
+
continue;
|
|
19967
|
+
if (notifyWriteTimedOutServerIds.includes(entry.info.id))
|
|
19968
|
+
continue;
|
|
19969
|
+
const versionBeforeTouch = diagnosticBaselines.get(entry.client);
|
|
19970
|
+
const merged = answerAtMerge?.get(entry.client);
|
|
19971
|
+
if (versionBeforeTouch !== void 0 && merged?.pathVersion !== void 0 && merged.pathVersion > versionBeforeTouch)
|
|
19972
|
+
continue;
|
|
19973
|
+
const publishedAt = merged?.publishedAt;
|
|
19974
|
+
if (publishedAt === void 0)
|
|
19975
|
+
continue;
|
|
19976
|
+
if (reusedAnswer === void 0 || publishedAt < reusedAnswer.publishedAt) {
|
|
19977
|
+
reusedAnswer = { serverId: entry.info.id, publishedAt };
|
|
19978
|
+
}
|
|
19979
|
+
}
|
|
19980
|
+
if (reusedAnswer)
|
|
19981
|
+
result.reusedAnswer = reusedAnswer;
|
|
19982
|
+
}
|
|
19697
19983
|
const lateDeliveryPending = unconfirmedServerIds.filter((serverId) => (lateDeliveryServerIds ?? []).includes(serverId));
|
|
19698
19984
|
if (lateDeliveryPending.length > 0) {
|
|
19699
19985
|
result.deferredServerIds = lateDeliveryPending;
|
|
@@ -19953,14 +20239,15 @@ var LSPService = class _LSPService {
|
|
|
19953
20239
|
const waitStart = Date.now();
|
|
19954
20240
|
const launchVariant = entry.client.getLaunchVariant?.();
|
|
19955
20241
|
const strategy = getStrategy(entry.info.id, launchVariant);
|
|
19956
|
-
await entry.client.waitForDiagnostics(filePath, strategy.aggregateWaitMs);
|
|
20242
|
+
let outcome = await entry.client.waitForDiagnostics(filePath, strategy.aggregateWaitMs);
|
|
19957
20243
|
let diagnostics = entry.client.getDiagnostics(filePath);
|
|
19958
20244
|
const firstWaitMs = Date.now() - waitStart;
|
|
19959
20245
|
if (strategy.expectSemanticSecondPush && diagnostics.length === 0 && firstWaitMs < DIAGNOSTICS_SEMANTIC_SETTLE_THRESHOLD_MS) {
|
|
19960
|
-
await entry.client.waitForDiagnostics(filePath, DIAGNOSTICS_SEMANTIC_SETTLE_WAIT_MS);
|
|
20246
|
+
outcome = await entry.client.waitForDiagnostics(filePath, DIAGNOSTICS_SEMANTIC_SETTLE_WAIT_MS);
|
|
19961
20247
|
diagnostics = entry.client.getDiagnostics(filePath);
|
|
19962
20248
|
}
|
|
19963
20249
|
return {
|
|
20250
|
+
answered: outcome === "answered" || diagnostics.length > 0,
|
|
19964
20251
|
serverId: entry.info.id,
|
|
19965
20252
|
launchVariant,
|
|
19966
20253
|
waitMs: Date.now() - waitStart,
|
|
@@ -19989,6 +20276,7 @@ var LSPService = class _LSPService {
|
|
|
19989
20276
|
const perServerFull = spawned.map((entry) => {
|
|
19990
20277
|
const found = perServer.find((r) => r.serverId === entry.info.id);
|
|
19991
20278
|
return found ?? {
|
|
20279
|
+
answered: false,
|
|
19992
20280
|
serverId: entry.info.id,
|
|
19993
20281
|
launchVariant: entry.client.getLaunchVariant?.(),
|
|
19994
20282
|
waitMs: getStrategy(entry.info.id, entry.client.getLaunchVariant?.()).aggregateWaitMs,
|
|
@@ -19998,7 +20286,10 @@ var LSPService = class _LSPService {
|
|
|
19998
20286
|
});
|
|
19999
20287
|
const merged = [];
|
|
20000
20288
|
const seen = /* @__PURE__ */ new Set();
|
|
20289
|
+
let answeredCount = 0;
|
|
20001
20290
|
for (const entry of perServerFull) {
|
|
20291
|
+
if (entry.answered)
|
|
20292
|
+
answeredCount++;
|
|
20002
20293
|
for (const diagnostic of entry.diagnostics) {
|
|
20003
20294
|
const key = [
|
|
20004
20295
|
diagnostic.range.start.line,
|
|
@@ -20013,12 +20304,15 @@ var LSPService = class _LSPService {
|
|
|
20013
20304
|
}
|
|
20014
20305
|
const rawCount = perServerFull.reduce((sum, entry) => sum + entry.diagnosticCount, 0);
|
|
20015
20306
|
const serversWithDiagnostics = perServerFull.filter((entry) => entry.diagnosticCount > 0).length;
|
|
20016
|
-
const failureKind = merged.length === 0 ? "ok_empty" : "success";
|
|
20017
20307
|
const unanswered = unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath);
|
|
20018
20308
|
const unavailablePrimaryServerIds = unanswered.serverIds;
|
|
20309
|
+
const timedOut = answeredCount === 0;
|
|
20310
|
+
const partialTimeout = answeredCount > 0 && answeredCount < spawned.length;
|
|
20311
|
+
const failureKind = timedOut ? "timeout" : merged.length === 0 ? "ok_empty" : "success";
|
|
20019
20312
|
this.lastDiagnosticsHealth.set(normalizedPath, {
|
|
20020
20313
|
health: failureKind === "success" ? "ok" : "ok_empty",
|
|
20021
20314
|
failureKind,
|
|
20315
|
+
partialTimeout,
|
|
20022
20316
|
serverCountAttempted,
|
|
20023
20317
|
serverCountReady: perServerFull.length,
|
|
20024
20318
|
candidateServerIds,
|
|
@@ -20047,6 +20341,7 @@ var LSPService = class _LSPService {
|
|
|
20047
20341
|
earlyUnblockedCount,
|
|
20048
20342
|
diagnosticsMode,
|
|
20049
20343
|
failureKind,
|
|
20344
|
+
partialTimeout,
|
|
20050
20345
|
health: failureKind === "success" ? "ok" : "ok_empty",
|
|
20051
20346
|
servers: perServerFull.map((entry) => ({
|
|
20052
20347
|
id: entry.serverId,
|
|
@@ -20061,7 +20356,7 @@ var LSPService = class _LSPService {
|
|
|
20061
20356
|
});
|
|
20062
20357
|
if (merged.length > 0) {
|
|
20063
20358
|
this.lastKnownDiagnostics.set(normalizedPath, merged);
|
|
20064
|
-
} else {
|
|
20359
|
+
} else if (!timedOut && !partialTimeout) {
|
|
20065
20360
|
this.lastKnownDiagnostics.delete(normalizedPath);
|
|
20066
20361
|
}
|
|
20067
20362
|
this.lastKnownContentHash.delete(normalizedPath);
|
|
@@ -20528,6 +20823,8 @@ var LSPService = class _LSPService {
|
|
|
20528
20823
|
const priorityServerIds = getServersForFileWithConfig(oldFilePath).map((server) => server.id);
|
|
20529
20824
|
const activeClients = this.activeClientsForCwd(cwd, priorityServerIds);
|
|
20530
20825
|
const willRenameFailures = [];
|
|
20826
|
+
let firstTimeout;
|
|
20827
|
+
let allWillRenameTimedOut = true;
|
|
20531
20828
|
const didRenameFailures = [];
|
|
20532
20829
|
const willRenameClients = activeClients.filter(({ serverId, client }) => {
|
|
20533
20830
|
if (client.getOperationSupport().willRenameFiles === true)
|
|
@@ -20549,6 +20846,11 @@ var LSPService = class _LSPService {
|
|
|
20549
20846
|
failed: false
|
|
20550
20847
|
};
|
|
20551
20848
|
} catch (err) {
|
|
20849
|
+
const timeout = isLspRequestTimeoutError(err) ? err : void 0;
|
|
20850
|
+
if (timeout && !firstTimeout)
|
|
20851
|
+
firstTimeout = timeout;
|
|
20852
|
+
if (!timeout)
|
|
20853
|
+
allWillRenameTimedOut = false;
|
|
20552
20854
|
willRenameFailures.push({
|
|
20553
20855
|
serverId,
|
|
20554
20856
|
error: err instanceof Error ? err.message : String(err)
|
|
@@ -20558,6 +20860,8 @@ var LSPService = class _LSPService {
|
|
|
20558
20860
|
}));
|
|
20559
20861
|
const successfulWillResults = willResults.filter((result) => !result.failed);
|
|
20560
20862
|
if (willRenameClients.length > 0 && successfulWillResults.length === 0) {
|
|
20863
|
+
if (firstTimeout && allWillRenameTimedOut)
|
|
20864
|
+
throw firstTimeout;
|
|
20561
20865
|
throw new Error(`workspace/willRenameFiles failed for all active LSP servers: ${willRenameFailures.map((failure) => `${failure.serverId}: ${failure.error}`).join("; ")}`);
|
|
20562
20866
|
}
|
|
20563
20867
|
const merged = mergeWorkspaceTextEditsByPriority(successfulWillResults);
|
|
@@ -20685,8 +20989,8 @@ var LSPService = class _LSPService {
|
|
|
20685
20989
|
}
|
|
20686
20990
|
throw err;
|
|
20687
20991
|
}
|
|
20688
|
-
const relOld = path17.relative(cwd, oldFilePath)
|
|
20689
|
-
const relNew = path17.relative(cwd, newFilePath)
|
|
20992
|
+
const relOld = toPosix(path17.relative(cwd, oldFilePath)) || path17.basename(oldFilePath);
|
|
20993
|
+
const relNew = toPosix(path17.relative(cwd, newFilePath)) || path17.basename(newFilePath);
|
|
20690
20994
|
const renameDescription = `Renamed ${relOld} \u2192 ${relNew}`;
|
|
20691
20995
|
await Promise.all(activeClients.map(async ({ clientKey, serverId, client }) => {
|
|
20692
20996
|
if (client.getOperationSupport().didRenameFiles !== true) {
|
|
@@ -20996,24 +21300,10 @@ var LSPService = class _LSPService {
|
|
|
20996
21300
|
// `warmupAttempt` doc on `LSPTouchFileOptions`.
|
|
20997
21301
|
warmupAttempt: attempt
|
|
20998
21302
|
});
|
|
20999
|
-
await (
|
|
21000
|
-
withDeadline(warmupAttempt, {
|
|
21001
|
-
ms: timeoutMs,
|
|
21002
|
-
onTimeout: "undefined"
|
|
21003
|
-
}),
|
|
21004
|
-
new Promise((resolve8) => {
|
|
21005
|
-
if (options.signal.aborted) {
|
|
21006
|
-
resolve8();
|
|
21007
|
-
return;
|
|
21008
|
-
}
|
|
21009
|
-
options.signal.addEventListener("abort", () => resolve8(), {
|
|
21010
|
-
once: true
|
|
21011
|
-
});
|
|
21012
|
-
})
|
|
21013
|
-
]) : withDeadline(warmupAttempt, {
|
|
21303
|
+
await untilAborted(withDeadline(warmupAttempt, {
|
|
21014
21304
|
ms: timeoutMs,
|
|
21015
21305
|
onTimeout: "undefined"
|
|
21016
|
-
}));
|
|
21306
|
+
}), options.signal);
|
|
21017
21307
|
const coldServerIds = stillColdServerIds();
|
|
21018
21308
|
logLatency({
|
|
21019
21309
|
type: "phase",
|
|
@@ -21035,13 +21325,10 @@ var LSPService = class _LSPService {
|
|
|
21035
21325
|
if (failedServerIds.length > 0 && !options.signal?.aborted) {
|
|
21036
21326
|
const backoffMs = warmupRetryBackoffMs();
|
|
21037
21327
|
if (backoffMs > 0) {
|
|
21038
|
-
await new Promise((
|
|
21039
|
-
const timer = setTimeout(
|
|
21328
|
+
await untilAborted(new Promise((resolve7) => {
|
|
21329
|
+
const timer = setTimeout(resolve7, backoffMs);
|
|
21040
21330
|
timer.unref?.();
|
|
21041
|
-
|
|
21042
|
-
once: true
|
|
21043
|
-
});
|
|
21044
|
-
});
|
|
21331
|
+
}), options.signal);
|
|
21045
21332
|
}
|
|
21046
21333
|
if (!options.signal?.aborted) {
|
|
21047
21334
|
await runWarmupTouch(2);
|
|
@@ -21224,18 +21511,7 @@ var LSPService = class _LSPService {
|
|
|
21224
21511
|
}
|
|
21225
21512
|
}
|
|
21226
21513
|
})(), { ms: perFileMs, onTimeout: "undefined" });
|
|
21227
|
-
await (signal
|
|
21228
|
-
preOpenAttempt,
|
|
21229
|
-
new Promise((resolve8) => {
|
|
21230
|
-
if (signal.aborted) {
|
|
21231
|
-
resolve8();
|
|
21232
|
-
return;
|
|
21233
|
-
}
|
|
21234
|
-
signal.addEventListener("abort", () => resolve8(), {
|
|
21235
|
-
once: true
|
|
21236
|
-
});
|
|
21237
|
-
})
|
|
21238
|
-
]) : preOpenAttempt);
|
|
21514
|
+
await untilAborted(preOpenAttempt, signal);
|
|
21239
21515
|
}
|
|
21240
21516
|
};
|
|
21241
21517
|
const markServiceDestroyed = (remainingFiles) => {
|
|
@@ -21287,7 +21563,10 @@ var LSPService = class _LSPService {
|
|
|
21287
21563
|
// the same false clean this change closes on the local route.
|
|
21288
21564
|
...answer.unconfirmedServerIds !== void 0 && {
|
|
21289
21565
|
unconfirmedServerIds: answer.unconfirmedServerIds
|
|
21290
|
-
}
|
|
21566
|
+
},
|
|
21567
|
+
// #5030: the incumbent's content binding, read below as a local
|
|
21568
|
+
// touch's is. An incumbent that sends none reads as not current.
|
|
21569
|
+
binding: warmAnswerBinding(answer)
|
|
21291
21570
|
} : await withDeadline(this.touchFile(filePath, content, {
|
|
21292
21571
|
diagnostics: "document",
|
|
21293
21572
|
collectDiagnostics: true,
|
|
@@ -21504,6 +21783,9 @@ var LSPService = class _LSPService {
|
|
|
21504
21783
|
if (result.error || result.timedOut || (result.unconfirmedServerIds?.length ?? 0) > 0 || scannedAt === void 0) {
|
|
21505
21784
|
continue;
|
|
21506
21785
|
}
|
|
21786
|
+
if (result.boundToCurrentDisk === false && result.contentHash === void 0) {
|
|
21787
|
+
continue;
|
|
21788
|
+
}
|
|
21507
21789
|
if (pullAnsweredFiles.has(result.filePath) && result.contentHash === void 0) {
|
|
21508
21790
|
workspaceDiagnosticsCacheCtx.forget(result.filePath);
|
|
21509
21791
|
continue;
|
|
@@ -21872,6 +22154,8 @@ async function hasAuxiliaryLspPublishedForRoot(serverId, filePath) {
|
|
|
21872
22154
|
|
|
21873
22155
|
export {
|
|
21874
22156
|
resetWorkspaceDiagnosticsCacheSession,
|
|
22157
|
+
noteWorkspaceFilesChangedOnDisk,
|
|
22158
|
+
noteWorkspaceDependenciesChanged,
|
|
21875
22159
|
importTargetsToAnnounce,
|
|
21876
22160
|
goPackageFilesToAnnounce,
|
|
21877
22161
|
getLspBudgetIdleTimeoutMs,
|
|
@@ -21906,8 +22190,8 @@ export {
|
|
|
21906
22190
|
drainPendingAuxCapEvictedCount,
|
|
21907
22191
|
recordNapiFallbackCoverage,
|
|
21908
22192
|
resetPendingAuxiliaryCoverage,
|
|
21909
|
-
clearAllSessions,
|
|
21910
22193
|
PartialApplyRecordStore,
|
|
22194
|
+
clearAllSessions,
|
|
21911
22195
|
getActiveSessionId,
|
|
21912
22196
|
beginScope,
|
|
21913
22197
|
retireScope,
|
|
@@ -21918,10 +22202,8 @@ export {
|
|
|
21918
22202
|
ReadGuard,
|
|
21919
22203
|
resetOpaqueMutationState,
|
|
21920
22204
|
resetObservedMutationNet,
|
|
21921
|
-
logBusEvent,
|
|
21922
|
-
recordStaleBusFailure,
|
|
21923
22205
|
createLiveBusEmitter,
|
|
21924
|
-
|
|
22206
|
+
createBusPublisher,
|
|
21925
22207
|
getMutationBridge,
|
|
21926
22208
|
resetLspMutationNoBridgeDbgLatch,
|
|
21927
22209
|
newLspMutationCorrelationId,
|
|
@@ -21932,6 +22214,11 @@ export {
|
|
|
21932
22214
|
touchCoverageGap,
|
|
21933
22215
|
touchCompletedConfirmationPolicy,
|
|
21934
22216
|
hashDiagnosticContent,
|
|
22217
|
+
warmAnswerBinding,
|
|
22218
|
+
readBoundToCurrentDisk,
|
|
22219
|
+
SERVER_CONFIG_FILE_NAMES,
|
|
22220
|
+
LspRequestTimeoutError,
|
|
22221
|
+
isLspRequestTimeoutError,
|
|
21935
22222
|
groupFilesByPrimaryServer,
|
|
21936
22223
|
runPerServerGroups,
|
|
21937
22224
|
STALE_LINE_MARKER,
|
|
@@ -21941,6 +22228,10 @@ export {
|
|
|
21941
22228
|
Text,
|
|
21942
22229
|
writeOrderToken,
|
|
21943
22230
|
WriteOrderingGuard,
|
|
22231
|
+
inlineBlockerSourceOf,
|
|
22232
|
+
inlineBlockerSources,
|
|
22233
|
+
inlineBlockerLines,
|
|
22234
|
+
isCrossFileBlocker,
|
|
21944
22235
|
anchorsForDiagnostic,
|
|
21945
22236
|
hasAnyDispositionMarks,
|
|
21946
22237
|
hasStrictDispositionMarks,
|
|
@@ -21967,6 +22258,7 @@ export {
|
|
|
21967
22258
|
getFileDiagnosticSummaries,
|
|
21968
22259
|
getSuppressedDiagnostics,
|
|
21969
22260
|
countRetainedSuppressedRows,
|
|
22261
|
+
retireWidgetCitedRows,
|
|
21970
22262
|
captureRenameExpectedContent,
|
|
21971
22263
|
summarizeWorkspaceEdit,
|
|
21972
22264
|
applyWorkspaceEdit,
|