pi-lens 4.4.8 → 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 +178 -0
- package/README.md +2 -1
- package/config/dependency-cruiser-eager-allowlist.json +1 -1
- package/dist/{chunk-3O5EII3W.js → chunk-2VZ3VN3N.js} +2 -2
- package/dist/{chunk-SDFKOLSF.js → chunk-3HTZDY3C.js} +8 -6
- package/dist/{chunk-A5GRLYPZ.js → chunk-3NPWO5UO.js} +7 -13
- package/dist/{chunk-AGGUWKRK.js → chunk-47UCC4MM.js} +1 -1
- package/dist/chunk-4ENEJHF4.js +198 -0
- package/dist/{chunk-WXUDRAG6.js → chunk-5GEYJJHG.js} +10 -12
- package/dist/{chunk-HHR7WGCI.js → chunk-5YSEQHJN.js} +3 -3
- package/dist/{chunk-L3CLUGDY.js → chunk-6GPB3JLL.js} +3 -3
- package/dist/{chunk-5F3XF3SX.js → chunk-7R5GZIA6.js} +6 -6
- package/dist/{chunk-CUDD35TW.js → chunk-7UTSNTWM.js} +4 -4
- package/dist/{chunk-DYRZGUMA.js → chunk-7YTRG6YW.js} +2 -2
- package/dist/{chunk-JZRP4DGP.js → chunk-AACN5GNE.js} +2 -2
- package/dist/{chunk-7ANZ7XDD.js → chunk-ACRJ2GZ5.js} +2 -2
- package/dist/{chunk-6FIRFP6A.js → chunk-C3YRO3EU.js} +10 -12
- package/dist/{chunk-GMROJJRN.js → chunk-CB7PEVOJ.js} +9 -1
- package/dist/{chunk-BBET6HD6.js → chunk-CDFJF5YD.js} +1 -1
- package/dist/{chunk-NSPVR3FN.js → chunk-CJS6WE66.js} +17 -19
- package/dist/{chunk-6YUNI7B5.js → chunk-CM6BDY4E.js} +14 -60
- package/dist/{chunk-G5GV2Q7K.js → chunk-CZCAZVTD.js} +16 -2
- package/dist/chunk-DGKFWQK4.js +23 -0
- package/dist/{chunk-VOP4PJKA.js → chunk-E65WJVI5.js} +7 -9
- package/dist/{chunk-TV6RXRYH.js → chunk-EKNYSXFB.js} +8 -10
- package/dist/{chunk-4LL2VRNY.js → chunk-EY6LY2HO.js} +16 -18
- package/dist/{chunk-MC6VB2E5.js → chunk-F6BEQWAK.js} +17 -5
- package/dist/{chunk-R2QQC33W.js → chunk-FGNSESAC.js} +12 -14
- package/dist/{chunk-OC7VWJBZ.js → chunk-FRUBVFXV.js} +35 -37
- package/dist/{chunk-7CGIDRIK.js → chunk-G22UNQID.js} +14 -16
- package/dist/{chunk-L4NEVZ4T.js → chunk-GQTQUNCG.js} +25 -27
- package/dist/{chunk-ZKLTNLAW.js → chunk-H3BVMK47.js} +6 -6
- package/dist/chunk-H6FLQ5NW.js +28 -0
- package/dist/{chunk-2ZE3AUJQ.js → chunk-HEA3EM23.js} +13 -15
- package/dist/{chunk-CZL44WFN.js → chunk-HSOBIN22.js} +2 -2
- package/dist/{chunk-PKSUMEPT.js → chunk-HYSKJMZK.js} +3 -3
- package/dist/{chunk-VN3L2JWZ.js → chunk-IICERRFF.js} +5 -5
- package/dist/{chunk-O4N5BQ3T.js → chunk-IILEH3ZC.js} +8 -10
- package/dist/{chunk-WC6WRNQT.js → chunk-J3Q2NYJR.js} +2 -2
- package/dist/{chunk-SFLHSL5R.js → chunk-JUZ67QZQ.js} +18 -7
- package/dist/chunk-KR5VGMVT.js +25 -0
- package/dist/{chunk-UHHLR2VY.js → chunk-KV6GQOGN.js} +38 -41
- package/dist/{chunk-HUAM7QG3.js → chunk-KXMJLOZF.js} +25 -23
- package/dist/{chunk-BUZIQDFS.js → chunk-L4Y3ROKQ.js} +3 -3
- package/dist/{chunk-JBP7KESM.js → chunk-L6WBJGQS.js} +1 -1
- package/dist/{chunk-35WKJWO5.js → chunk-L7O774U7.js} +14 -14
- package/dist/{chunk-BOPDQ7AZ.js → chunk-LAHHGNAY.js} +19 -21
- package/dist/{chunk-RGGH6M34.js → chunk-LT62P654.js} +1 -1
- package/dist/{chunk-5T5A6YAJ.js → chunk-LWOM6LVS.js} +33 -34
- package/dist/{chunk-JYLOYTZD.js → chunk-MKPDIAZH.js} +5 -1
- package/dist/{chunk-CM73PPGD.js → chunk-MN635QYA.js} +3 -4
- package/dist/{chunk-BQG2QFVO.js → chunk-MQ4PPCJB.js} +21 -29
- package/dist/{chunk-HXFUTMX2.js → chunk-MRLH4MYU.js} +2 -2
- package/dist/{chunk-XOMGO63G.js → chunk-N56BNAA6.js} +19 -21
- package/dist/{chunk-7MAD5ZAY.js → chunk-N5CEGQPG.js} +14 -16
- package/dist/{chunk-ZFORSIED.js → chunk-NCLO6E6N.js} +13 -33
- package/dist/{chunk-SQC7K3SP.js → chunk-NL5LSKVD.js} +2 -2
- package/dist/{chunk-I22THIHI.js → chunk-NMUSOZ2D.js} +10 -12
- package/dist/{chunk-4NBWFYWW.js → chunk-NOWH2VA2.js} +8 -33
- package/dist/{chunk-NM2NWH55.js → chunk-NUSXS6YB.js} +6 -5
- package/dist/{chunk-OZWXLJMX.js → chunk-OSEKJEUU.js} +2 -2
- package/dist/{chunk-2BKUFQKR.js → chunk-OUYAUXAT.js} +405 -181
- package/dist/{chunk-JPRDTY5S.js → chunk-PBZNYHMM.js} +8 -10
- package/dist/{chunk-JE6HKLC7.js → chunk-PIIUNJIT.js} +2 -4
- package/dist/{chunk-ZZDIOAAJ.js → chunk-PRHYIA6X.js} +6 -6
- package/dist/{chunk-4W52ZKZX.js → chunk-PXQ45SGD.js} +2 -2
- package/dist/chunk-Q6JQKWPK.js +25 -0
- package/dist/{chunk-PIQQM32Y.js → chunk-QB7T2PHK.js} +2 -2
- package/dist/{chunk-HKIL6DCL.js → chunk-QGITU23N.js} +1 -1
- package/dist/chunk-QJJKOHLH.js +57 -0
- package/dist/{chunk-6LJOJ6EO.js → chunk-QP33NKYC.js} +14 -16
- package/dist/{chunk-DIWK3LBC.js → chunk-QVBOXT3L.js} +8 -10
- package/dist/{chunk-IYVYZQRL.js → chunk-RNJFRXEN.js} +5 -7
- package/dist/{chunk-G6JKM4O7.js → chunk-RNXOWDM6.js} +10 -10
- package/dist/{chunk-5RNB4HVK.js → chunk-RTFMDIKV.js} +1 -1
- package/dist/{chunk-XWIME22V.js → chunk-SIQHOB6P.js} +11 -13
- package/dist/{chunk-T2S3FNNJ.js → chunk-SLSMJPEF.js} +41 -42
- package/dist/chunk-T5QSLSMM.js +50 -0
- package/dist/chunk-TGQDAG4B.js +88 -0
- package/dist/{chunk-6GMGEKQN.js → chunk-THYHUIDR.js} +39 -12
- package/dist/{chunk-WMDUT4KH.js → chunk-TMNUTMT5.js} +72 -89
- package/dist/{chunk-7TNILKGY.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-FRLAUP2B.js → chunk-UXTQ3QPD.js} +4 -4
- package/dist/{chunk-4QG55RRC.js → chunk-V2WDBOLZ.js} +10 -12
- package/dist/{chunk-FHEV6T4L.js → chunk-V67D6TMU.js} +8 -10
- package/dist/{chunk-VLQ7UKZH.js → chunk-VCRVNLE7.js} +135 -2
- package/dist/{chunk-KZ4ALBCH.js → chunk-VO4JFPTV.js} +2 -2
- package/dist/{chunk-GIRBSBGL.js → chunk-VWLSU3XV.js} +3 -3
- package/dist/{chunk-2453RRJ2.js → chunk-W5E72HJA.js} +59 -22
- package/dist/{chunk-VPLBLWFO.js → chunk-W7TY6HYX.js} +1 -1
- package/dist/{chunk-SP4TFY5F.js → chunk-WSSLVMDA.js} +11 -13
- package/dist/{chunk-PPKECBPP.js → chunk-WTB4GKMH.js} +10 -1
- package/dist/{chunk-X35S7HSB.js → chunk-X5BJ3G2P.js} +41 -30
- package/dist/{chunk-X66YJ2SS.js → chunk-XKFO2SZV.js} +33 -34
- package/dist/{chunk-OWTG6UMO.js → chunk-XLAI7UYY.js} +75 -22
- package/dist/{chunk-4B2YFN4U.js → chunk-XO756WE5.js} +45 -33
- package/dist/{chunk-VOXTCULR.js → chunk-XVB3Q2PG.js} +2 -4
- package/dist/{chunk-XYLC35E4.js → chunk-YOXCCJDF.js} +517 -308
- package/dist/{chunk-O2ARHQKF.js → chunk-ZCQBNPRH.js} +2 -2
- package/dist/chunk-ZD4KVFXI.js +234 -0
- package/dist/{chunk-LSFXZLPW.js → chunk-ZDMFGACN.js} +184 -235
- package/dist/{chunk-4BKU7PV3.js → chunk-ZMMHHXSW.js} +1 -1
- package/dist/{chunk-OY7WZI7Q.js → chunk-ZPM7ZIFL.js} +6 -6
- package/dist/{chunk-R4QWJQ2H.js → chunk-ZVCDHYWZ.js} +9 -11
- package/dist/{chunk-RZG472YW.js → chunk-ZZN74OGD.js} +83 -46
- package/dist/{chunk-BHWW6FAX.js → chunk-ZZSJAR76.js} +37 -19
- package/dist/index.js +4910 -4218
- package/dist/mcp/analyze-cli.js +12 -17
- package/dist/mcp/cli.js +41 -42
- package/dist/mcp/server.js +1451 -648
- package/dist/mcp/worker.js +59 -60
- package/dist/probes/installer.js +17 -19
- package/docs/agent-tools.md +40 -8
- package/docs/analysisall.md +1 -1
- package/docs/ci-bot-pr-checks.md +7 -5
- package/docs/configuration.md +51 -9
- package/docs/defect-shapes.md +52 -3
- package/docs/environment-variables.md +18 -1
- package/docs/features.md +12 -5
- package/docs/globalconfig.md +11 -3
- package/docs/invariants/lsp-trust-exec.md +9 -2
- package/docs/invariants/session-telemetry.md +2 -2
- package/docs/language-coverage.md +1 -0
- package/docs/lsp-capability-matrix.md +57 -35
- 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 +11 -1
- package/docs/pi-lens-investigator.md +3 -0
- package/docs/pi-lens-merge-policy.md +15 -7
- package/docs/pi-lens-reviewer.md +1 -1
- package/docs/pi-lens-subagent.md +13 -0
- package/docs/public-api-stability.md +39 -5
- package/docs/release-qa-baseline.md +7 -4
- package/docs/schema/pi-lens-config-v1.json +11 -2
- package/docs/servercapabilities.md +3 -1
- package/docs/settings.md +2 -2
- package/docs/word-index.md +3 -2
- package/package.json +8 -3
- 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/scripts/download-grammars.js +3 -2
- package/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
- package/dist/chunk-2TS4GLOJ.js +0 -31
- package/dist/chunk-3JAHQBSY.js +0 -27
- package/dist/chunk-447YZL4S.js +0 -25
- package/dist/chunk-565VRUP4.js +0 -136
- package/dist/chunk-57X2CDRX.js +0 -49
- package/dist/chunk-GGYOZWHW.js +0 -27
- package/dist/chunk-IE5D3RA5.js +0 -58
- package/dist/chunk-LPYTPNOJ.js +0 -22
- package/dist/chunk-OFNMHPBT.js +0 -89
- package/dist/chunk-U3AS2FR6.js +0 -106
- package/dist/chunk-W3BGKBBK.js +0 -27
- package/dist/chunk-WQV6BI4Q.js +0 -48
- package/dist/chunk-YHGYAEFH.js +0 -443
- package/dist/chunk-ZONZ6YY3.js +0 -74
- package/dist/chunk-ZSM35JF4.js +0 -30
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
resolveOpengrepConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7YTRG6YW.js";
|
|
5
5
|
import {
|
|
6
6
|
PYTHON_COMPILE_VERDICT_SERVER_ID,
|
|
7
7
|
augmentPythonEnvironment,
|
|
8
8
|
detectPythonEnvironment,
|
|
9
9
|
pythonEnvironmentToolCandidates
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-V67D6TMU.js";
|
|
11
|
+
import {
|
|
12
|
+
scannerReportParentDir
|
|
13
|
+
} from "./chunk-LT62P654.js";
|
|
11
14
|
import {
|
|
12
15
|
hasCargoWorkspaceTable,
|
|
13
16
|
readCargoWorkspaceExclude,
|
|
14
17
|
readCargoWorkspaceMembers,
|
|
15
18
|
readTextFileOrUndefined
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-J3Q2NYJR.js";
|
|
17
20
|
import {
|
|
18
21
|
getUserRuleRoot,
|
|
19
22
|
ruleCorpusFingerprintForCycle
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5YSEQHJN.js";
|
|
21
24
|
import {
|
|
22
25
|
load,
|
|
23
26
|
resolvePackagePath
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-QGITU23N.js";
|
|
25
28
|
import {
|
|
26
29
|
extensionsForLanguage
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WTB4GKMH.js";
|
|
28
31
|
import {
|
|
29
32
|
HOOK_WALL_BUDGET_MS
|
|
30
33
|
} from "./chunk-CKEQFGLT.js";
|
|
31
34
|
import {
|
|
32
35
|
bounded
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-MKPDIAZH.js";
|
|
34
37
|
import {
|
|
35
38
|
ensureTool,
|
|
36
39
|
findManagedToolBinary,
|
|
@@ -40,25 +43,25 @@ import {
|
|
|
40
43
|
isZizmorAuditTarget,
|
|
41
44
|
logSessionStart,
|
|
42
45
|
resolveZizmorGitHubToken
|
|
43
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-MQ4PPCJB.js";
|
|
44
47
|
import {
|
|
45
48
|
resolveToolCwd
|
|
46
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-RNJFRXEN.js";
|
|
47
50
|
import {
|
|
48
51
|
commandSearchReachesProject,
|
|
49
52
|
findGlobalBinary,
|
|
50
53
|
isProjectLocalBinPath
|
|
51
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-E65WJVI5.js";
|
|
52
55
|
import {
|
|
53
56
|
classifyProbeFailure,
|
|
54
57
|
createAvailabilityLatch,
|
|
55
58
|
describeInstallAttempt,
|
|
56
59
|
logAvailabilityDecision,
|
|
57
60
|
startHostStallSampler
|
|
58
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-AACN5GNE.js";
|
|
59
62
|
import {
|
|
60
63
|
readDirEntriesSafeAsync
|
|
61
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-ZCQBNPRH.js";
|
|
62
65
|
import {
|
|
63
66
|
OWNER_TAG_ENV,
|
|
64
67
|
SpawnFailureError,
|
|
@@ -87,14 +90,16 @@ import {
|
|
|
87
90
|
safeSpawnAsync,
|
|
88
91
|
statIsFile,
|
|
89
92
|
trustScopedEnvironment
|
|
90
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-TMNUTMT5.js";
|
|
91
94
|
import {
|
|
92
95
|
DOTNET_CSHARP_ROOT_MARKERS,
|
|
93
96
|
DOTNET_FSHARP_ROOT_MARKERS,
|
|
94
97
|
KIND_EXTENSIONS,
|
|
95
98
|
LEAN_ROOT_MARKERS
|
|
96
|
-
} from "./chunk-
|
|
99
|
+
} from "./chunk-CZCAZVTD.js";
|
|
97
100
|
import {
|
|
101
|
+
boundedKeyLabel,
|
|
102
|
+
finalizeRecords,
|
|
98
103
|
isRepoTier,
|
|
99
104
|
lspSectionOf,
|
|
100
105
|
migrationSubject,
|
|
@@ -103,7 +108,7 @@ import {
|
|
|
103
108
|
reportPiLensConfigRecords,
|
|
104
109
|
resolvePiLensConfig,
|
|
105
110
|
summarizeConfigResolution
|
|
106
|
-
} from "./chunk-
|
|
111
|
+
} from "./chunk-X5BJ3G2P.js";
|
|
107
112
|
import {
|
|
108
113
|
FRESHNESS_CADENCE_MS,
|
|
109
114
|
LSP_NAMESPACE_KEY,
|
|
@@ -114,31 +119,28 @@ import {
|
|
|
114
119
|
getDirectoryMarkers,
|
|
115
120
|
getPiLensGlobalConfigPath,
|
|
116
121
|
unknownDirMtimeRecords
|
|
117
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-NL5LSKVD.js";
|
|
118
123
|
import {
|
|
119
124
|
getProjectTrustGeneration,
|
|
120
125
|
getProjectTrustState
|
|
121
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-PIIUNJIT.js";
|
|
122
127
|
import {
|
|
123
128
|
getDegradationLedgerGeneration,
|
|
124
129
|
incrementDegradationCount,
|
|
130
|
+
logExtension,
|
|
125
131
|
recordDegradationOnce
|
|
126
|
-
} from "./chunk-
|
|
127
|
-
import {
|
|
128
|
-
logExtension
|
|
129
|
-
} from "./chunk-WQV6BI4Q.js";
|
|
132
|
+
} from "./chunk-W5E72HJA.js";
|
|
130
133
|
import {
|
|
131
134
|
claimPhaseOncePerSession,
|
|
132
135
|
currentSessionRecordId,
|
|
133
|
-
logLatency,
|
|
134
|
-
releasePhaseClaim
|
|
135
|
-
} from "./chunk-565VRUP4.js";
|
|
136
|
-
import {
|
|
137
136
|
getGlobalPiLensLogDir,
|
|
138
137
|
getProcessSingleton,
|
|
138
|
+
isLspInstallDisabled,
|
|
139
139
|
isTestMode,
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
logLatency,
|
|
141
|
+
redactSecrets,
|
|
142
|
+
releasePhaseClaim
|
|
143
|
+
} from "./chunk-VCRVNLE7.js";
|
|
142
144
|
import {
|
|
143
145
|
STAGE_TMP_PATTERN
|
|
144
146
|
} from "./chunk-LJDODBBZ.js";
|
|
@@ -164,7 +166,7 @@ import {
|
|
|
164
166
|
toPosix,
|
|
165
167
|
toProjectRelativePath,
|
|
166
168
|
walkUpDirs
|
|
167
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-CB7PEVOJ.js";
|
|
168
170
|
|
|
169
171
|
// dist/clients/analysis-root.js
|
|
170
172
|
import * as fs from "node:fs";
|
|
@@ -312,29 +314,91 @@ function registeredServers(config, catalog) {
|
|
|
312
314
|
// dist/clients/lsp/server.js
|
|
313
315
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, statSync as statSync4 } from "node:fs";
|
|
314
316
|
import { access, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
315
|
-
import
|
|
316
|
-
import
|
|
317
|
+
import os6 from "node:os";
|
|
318
|
+
import path8 from "node:path";
|
|
317
319
|
|
|
318
|
-
// dist/clients/
|
|
319
|
-
import { createHash } from "node:crypto";
|
|
320
|
+
// dist/clients/shell-dialect.js
|
|
320
321
|
import * as fs2 from "node:fs";
|
|
321
|
-
import * as os2 from "node:os";
|
|
322
322
|
import * as path2 from "node:path";
|
|
323
|
+
var SHELLCHECK_SUPPORTED_DIALECTS = [
|
|
324
|
+
"sh",
|
|
325
|
+
"bash",
|
|
326
|
+
"dash",
|
|
327
|
+
"ksh",
|
|
328
|
+
"busybox"
|
|
329
|
+
];
|
|
330
|
+
function isShellcheckDialectSupported(dialect) {
|
|
331
|
+
return SHELLCHECK_SUPPORTED_DIALECTS.includes(dialect);
|
|
332
|
+
}
|
|
333
|
+
function isZshDialect(dialect) {
|
|
334
|
+
return dialect === "zsh";
|
|
335
|
+
}
|
|
336
|
+
var SHEBANG_REGEXP = /^#!(.+)/;
|
|
337
|
+
var SHEBANG_INTERPRETER_REGEXP = /^[/](?:[^ /]+[/])*(?:env +(?:-S +)?)?([^ /]+)/;
|
|
338
|
+
var SHELLCHECK_SHELL_OR_EMPTY_REGEXP = /^\s*(?:#\s*shellcheck\s+(?:\S+\s+)*shell=(\w+)|#|$)/;
|
|
339
|
+
var DIALECT_SNIFF_BYTES = 4096;
|
|
340
|
+
function parseShebang(content) {
|
|
341
|
+
const match = SHEBANG_REGEXP.exec(content);
|
|
342
|
+
if (!match || !match[1])
|
|
343
|
+
return null;
|
|
344
|
+
const interpreter = SHEBANG_INTERPRETER_REGEXP.exec(match[1].trim());
|
|
345
|
+
if (!interpreter || !interpreter[1])
|
|
346
|
+
return null;
|
|
347
|
+
return interpreter[1].trim();
|
|
348
|
+
}
|
|
349
|
+
function parseShellDirective(content) {
|
|
350
|
+
for (const line of content.split("\n")) {
|
|
351
|
+
const match = SHELLCHECK_SHELL_OR_EMPTY_REGEXP.exec(line);
|
|
352
|
+
if (match === null)
|
|
353
|
+
break;
|
|
354
|
+
if (match[1])
|
|
355
|
+
return match[1].trim();
|
|
356
|
+
}
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
function resolveShellFileDialect(filePath) {
|
|
360
|
+
let content;
|
|
361
|
+
try {
|
|
362
|
+
const fd = fs2.openSync(filePath, "r");
|
|
363
|
+
try {
|
|
364
|
+
const head = Buffer.alloc(DIALECT_SNIFF_BYTES);
|
|
365
|
+
const bytesRead = fs2.readSync(fd, head, 0, DIALECT_SNIFF_BYTES, 0);
|
|
366
|
+
content = head.subarray(0, bytesRead).toString("utf8");
|
|
367
|
+
} finally {
|
|
368
|
+
fs2.closeSync(fd);
|
|
369
|
+
}
|
|
370
|
+
} catch {
|
|
371
|
+
return { shebang: null, directive: null, dialect: "bash" };
|
|
372
|
+
}
|
|
373
|
+
const directive = parseShellDirective(content);
|
|
374
|
+
const shebang = parseShebang(content);
|
|
375
|
+
const parsed = directive ?? shebang ?? (path2.extname(filePath).toLowerCase() === ".zsh" ? "zsh" : null);
|
|
376
|
+
return {
|
|
377
|
+
shebang,
|
|
378
|
+
directive,
|
|
379
|
+
dialect: parsed ?? "bash"
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// dist/clients/sgconfig.js
|
|
384
|
+
import { createHash } from "node:crypto";
|
|
385
|
+
import * as fs3 from "node:fs";
|
|
386
|
+
import * as path3 from "node:path";
|
|
323
387
|
var SGCONFIG_NAMES = ["sgconfig.yml", "sgconfig.yaml"];
|
|
324
388
|
function findLocalSgconfig(startDir) {
|
|
325
389
|
return findLocalToolConfig(startDir, SGCONFIG_NAMES);
|
|
326
390
|
}
|
|
327
391
|
function getAstGrepRuleSources(projectRoot = process.cwd()) {
|
|
328
|
-
const root =
|
|
392
|
+
const root = path3.resolve(projectRoot || process.cwd());
|
|
329
393
|
const packageRoot = resolvePackagePath(import.meta.url);
|
|
330
394
|
const candidates = [];
|
|
331
395
|
if (realpathOrResolve(root) !== realpathOrResolve(packageRoot)) {
|
|
332
396
|
candidates.push({
|
|
333
|
-
dir:
|
|
397
|
+
dir: path3.join(root, "rules", "ast-grep-rules", "rules"),
|
|
334
398
|
origin: "project",
|
|
335
399
|
tier: "primary"
|
|
336
400
|
}, {
|
|
337
|
-
dir:
|
|
401
|
+
dir: path3.join(root, "rules", "ast-grep-rules", "coderabbit", "rules"),
|
|
338
402
|
origin: "project",
|
|
339
403
|
tier: "secondary"
|
|
340
404
|
});
|
|
@@ -342,27 +406,27 @@ function getAstGrepRuleSources(projectRoot = process.cwd()) {
|
|
|
342
406
|
const userRoot = getUserRuleRoot();
|
|
343
407
|
if (realpathOrResolve(userRoot) !== realpathOrResolve(root)) {
|
|
344
408
|
candidates.push({
|
|
345
|
-
dir:
|
|
409
|
+
dir: path3.join(userRoot, "ast-grep-rules", "rules"),
|
|
346
410
|
origin: "user",
|
|
347
411
|
tier: "primary"
|
|
348
412
|
}, {
|
|
349
|
-
dir:
|
|
413
|
+
dir: path3.join(userRoot, "ast-grep-rules", "coderabbit", "rules"),
|
|
350
414
|
origin: "user",
|
|
351
415
|
tier: "secondary"
|
|
352
416
|
});
|
|
353
417
|
}
|
|
354
418
|
candidates.push({
|
|
355
|
-
dir:
|
|
419
|
+
dir: path3.join(packageRoot, "rules", "ast-grep-rules", "rules"),
|
|
356
420
|
origin: "bundled",
|
|
357
421
|
tier: "primary"
|
|
358
422
|
}, {
|
|
359
|
-
dir:
|
|
423
|
+
dir: path3.join(packageRoot, "rules", "ast-grep-rules", "coderabbit", "rules"),
|
|
360
424
|
origin: "bundled",
|
|
361
425
|
tier: "secondary"
|
|
362
426
|
});
|
|
363
427
|
const seen = /* @__PURE__ */ new Set();
|
|
364
428
|
return candidates.filter((source) => {
|
|
365
|
-
if (!
|
|
429
|
+
if (!fs3.existsSync(source.dir))
|
|
366
430
|
return false;
|
|
367
431
|
const key = realpathOrResolve(source.dir);
|
|
368
432
|
if (seen.has(key))
|
|
@@ -375,12 +439,12 @@ function findYamlFiles(dir) {
|
|
|
375
439
|
const files = [];
|
|
376
440
|
let entries;
|
|
377
441
|
try {
|
|
378
|
-
entries =
|
|
442
|
+
entries = fs3.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
379
443
|
} catch {
|
|
380
444
|
return files;
|
|
381
445
|
}
|
|
382
446
|
for (const entry of entries) {
|
|
383
|
-
const full =
|
|
447
|
+
const full = path3.join(dir, entry.name);
|
|
384
448
|
if (entry.isDirectory()) {
|
|
385
449
|
files.push(...findYamlFiles(full));
|
|
386
450
|
} else if (entry.isFile() && /\.ya?ml$/i.test(entry.name)) {
|
|
@@ -422,12 +486,12 @@ function snapshotRuleSource(source) {
|
|
|
422
486
|
const hash = createHash("sha256");
|
|
423
487
|
const files = [];
|
|
424
488
|
for (const file of findYamlFiles(source.dir)) {
|
|
425
|
-
const relativePath =
|
|
489
|
+
const relativePath = path3.relative(source.dir, file);
|
|
426
490
|
hash.update(relativePath);
|
|
427
491
|
hash.update("\0");
|
|
428
492
|
let content;
|
|
429
493
|
try {
|
|
430
|
-
content =
|
|
494
|
+
content = fs3.readFileSync(file, "utf8");
|
|
431
495
|
} catch {
|
|
432
496
|
hash.update("missing");
|
|
433
497
|
hash.update("\0");
|
|
@@ -465,12 +529,12 @@ function sourceFingerprint(sources) {
|
|
|
465
529
|
return hash.digest("hex");
|
|
466
530
|
}
|
|
467
531
|
function getAstGrepRuleFingerprint(projectRoot = process.cwd(), options = {}) {
|
|
468
|
-
const root =
|
|
532
|
+
const root = path3.resolve(projectRoot || process.cwd());
|
|
469
533
|
return ruleCorpusFingerprintForCycle("ast-grep", root, (fingerprintRoot) => sourceFingerprint(getAstGrepRuleSources(fingerprintRoot).map(snapshotRuleSource)), options.force);
|
|
470
534
|
}
|
|
471
535
|
function materializeMergedRuleDir(sources, mergedDir) {
|
|
472
|
-
|
|
473
|
-
|
|
536
|
+
fs3.rmSync(mergedDir, { recursive: true, force: true });
|
|
537
|
+
fs3.mkdirSync(mergedDir, { recursive: true });
|
|
474
538
|
const claimedByEarlierSource = /* @__PURE__ */ new Set();
|
|
475
539
|
for (const [sourceIndex, source] of sources.entries()) {
|
|
476
540
|
const claimedThisSource = /* @__PURE__ */ new Set();
|
|
@@ -485,11 +549,11 @@ function materializeMergedRuleDir(sources, mergedDir) {
|
|
|
485
549
|
});
|
|
486
550
|
if (survivingDocuments.length === 0)
|
|
487
551
|
continue;
|
|
488
|
-
const destination =
|
|
552
|
+
const destination = path3.join(mergedDir, `source${sourceIndex}-${String(fileIndex).padStart(5, "0")}.yml`);
|
|
489
553
|
if (survivingDocuments.length === file.documents.length) {
|
|
490
|
-
|
|
554
|
+
fs3.copyFileSync(file.file, destination);
|
|
491
555
|
} else {
|
|
492
|
-
|
|
556
|
+
fs3.writeFileSync(destination, `${survivingDocuments.map((document) => document.raw.trim()).join("\n---\n")}
|
|
493
557
|
`);
|
|
494
558
|
}
|
|
495
559
|
}
|
|
@@ -502,20 +566,20 @@ function rootArtifactKey(root) {
|
|
|
502
566
|
return createHash("sha256").update(root).digest("hex").slice(0, 12);
|
|
503
567
|
}
|
|
504
568
|
function resolveBaselineSgconfig(projectRoot = process.cwd()) {
|
|
505
|
-
const root = realpathOrResolve(
|
|
569
|
+
const root = realpathOrResolve(path3.resolve(projectRoot || process.cwd()));
|
|
506
570
|
const fingerprint = getAstGrepRuleFingerprint(root, { force: true });
|
|
507
571
|
const cached = cachedBaselines.get(root);
|
|
508
|
-
if (cached?.fingerprint === fingerprint &&
|
|
572
|
+
if (cached?.fingerprint === fingerprint && fs3.existsSync(cached.path) && fs3.existsSync(cached.mergedDir)) {
|
|
509
573
|
return cached.path;
|
|
510
574
|
}
|
|
511
575
|
const sources = getAstGrepRuleSources(root).map(snapshotRuleSource);
|
|
512
576
|
if (sources.length === 0)
|
|
513
577
|
return void 0;
|
|
514
|
-
const dir =
|
|
515
|
-
|
|
578
|
+
const dir = path3.join(scannerReportParentDir(), "pi-lens-ast-grep");
|
|
579
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
516
580
|
const artifactKey = rootArtifactKey(root);
|
|
517
|
-
const file =
|
|
518
|
-
const mergedDir =
|
|
581
|
+
const file = path3.join(dir, `baseline-${process.pid}-${artifactKey}.sgconfig.yml`);
|
|
582
|
+
const mergedDir = path3.join(dir, `baseline-${process.pid}-${artifactKey}.rules`);
|
|
519
583
|
const protectedArtifacts = /* @__PURE__ */ new Set([file, mergedDir]);
|
|
520
584
|
for (const baseline of cachedBaselines.values()) {
|
|
521
585
|
protectedArtifacts.add(baseline.path);
|
|
@@ -523,8 +587,8 @@ function resolveBaselineSgconfig(projectRoot = process.cwd()) {
|
|
|
523
587
|
}
|
|
524
588
|
cleanupStaleBaselines(dir, protectedArtifacts);
|
|
525
589
|
materializeMergedRuleDir(sources, mergedDir);
|
|
526
|
-
const ruleDirForYaml = mergedDir.split(
|
|
527
|
-
|
|
590
|
+
const ruleDirForYaml = mergedDir.split(path3.sep).join("/");
|
|
591
|
+
fs3.writeFileSync(file, `ruleDirs:
|
|
528
592
|
- ${JSON.stringify(ruleDirForYaml)}
|
|
529
593
|
`);
|
|
530
594
|
cachedBaselines.set(root, { fingerprint, path: file, mergedDir });
|
|
@@ -535,7 +599,7 @@ var SG_BASELINE_RETAINED_ENTRIES = 24;
|
|
|
535
599
|
function enforceBaselineEntryCap(dir, keep) {
|
|
536
600
|
let names;
|
|
537
601
|
try {
|
|
538
|
-
names =
|
|
602
|
+
names = fs3.readdirSync(dir);
|
|
539
603
|
} catch {
|
|
540
604
|
return;
|
|
541
605
|
}
|
|
@@ -545,13 +609,13 @@ function enforceBaselineEntryCap(dir, keep) {
|
|
|
545
609
|
const isMergedDir = /^baseline-\d+(?:-[a-f0-9]+)?\.rules$/.test(name);
|
|
546
610
|
if (!isConfig && !isMergedDir)
|
|
547
611
|
continue;
|
|
548
|
-
const full =
|
|
612
|
+
const full = path3.join(dir, name);
|
|
549
613
|
if (keep.has(full))
|
|
550
614
|
continue;
|
|
551
615
|
try {
|
|
552
616
|
candidates.push({
|
|
553
617
|
full,
|
|
554
|
-
mtimeMs:
|
|
618
|
+
mtimeMs: fs3.statSync(full).mtimeMs,
|
|
555
619
|
recursive: isMergedDir
|
|
556
620
|
});
|
|
557
621
|
} catch {
|
|
@@ -564,7 +628,7 @@ function enforceBaselineEntryCap(dir, keep) {
|
|
|
564
628
|
let evicted = 0;
|
|
565
629
|
for (const candidate of candidates.slice(0, over)) {
|
|
566
630
|
try {
|
|
567
|
-
|
|
631
|
+
fs3.rmSync(candidate.full, {
|
|
568
632
|
recursive: candidate.recursive,
|
|
569
633
|
force: true
|
|
570
634
|
});
|
|
@@ -588,18 +652,18 @@ function enforceBaselineEntryCap(dir, keep) {
|
|
|
588
652
|
function cleanupStaleBaselines(dir, keep) {
|
|
589
653
|
try {
|
|
590
654
|
const cutoff = Date.now() - 7 * 24 * 60 * 60 * 1e3;
|
|
591
|
-
for (const name of
|
|
655
|
+
for (const name of fs3.readdirSync(dir)) {
|
|
592
656
|
const isConfig = /^baseline(?:-\d+(?:-[a-f0-9]+)?)?\.sgconfig\.yml$/.test(name);
|
|
593
657
|
const isMergedDir = /^baseline-\d+(?:-[a-f0-9]+)?\.rules$/.test(name);
|
|
594
658
|
if (!isConfig && !isMergedDir)
|
|
595
659
|
continue;
|
|
596
|
-
const full =
|
|
660
|
+
const full = path3.join(dir, name);
|
|
597
661
|
if (keep.has(full))
|
|
598
662
|
continue;
|
|
599
663
|
try {
|
|
600
|
-
const stat2 =
|
|
664
|
+
const stat2 = fs3.statSync(full);
|
|
601
665
|
if (stat2.mtimeMs < cutoff) {
|
|
602
|
-
|
|
666
|
+
fs3.rmSync(full, { recursive: stat2.isDirectory(), force: true });
|
|
603
667
|
}
|
|
604
668
|
} catch {
|
|
605
669
|
}
|
|
@@ -660,8 +724,8 @@ function serverTraits(declaration) {
|
|
|
660
724
|
}
|
|
661
725
|
|
|
662
726
|
// dist/clients/lsp/config.js
|
|
663
|
-
import * as
|
|
664
|
-
import
|
|
727
|
+
import * as os3 from "node:os";
|
|
728
|
+
import path5 from "node:path";
|
|
665
729
|
|
|
666
730
|
// dist/clients/dispatch/known-runner-ids.js
|
|
667
731
|
var knownRunnerIds = /* @__PURE__ */ new Set();
|
|
@@ -678,12 +742,12 @@ function isKnownRunnerId(id) {
|
|
|
678
742
|
// dist/clients/lsp/launch.js
|
|
679
743
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
680
744
|
import { spawn as nodeSpawn } from "node:child_process";
|
|
681
|
-
import
|
|
682
|
-
import
|
|
683
|
-
import
|
|
745
|
+
import fs5 from "node:fs";
|
|
746
|
+
import os2 from "node:os";
|
|
747
|
+
import path4 from "node:path";
|
|
684
748
|
|
|
685
749
|
// dist/clients/lsp/ruby-drive-dirs.js
|
|
686
|
-
import * as
|
|
750
|
+
import * as fs4 from "node:fs";
|
|
687
751
|
var RUBY_VERSION_DIR = /^ruby\d/i;
|
|
688
752
|
var rubyDirNamesCache = new BoundedLruCache(16);
|
|
689
753
|
function rubyDriveKey(driveRoot) {
|
|
@@ -699,7 +763,7 @@ function getRubyVersionDirNamesSync(driveRoot) {
|
|
|
699
763
|
return cached;
|
|
700
764
|
let names;
|
|
701
765
|
try {
|
|
702
|
-
names = filterRubyDirNames(
|
|
766
|
+
names = filterRubyDirNames(fs4.readdirSync(driveRoot));
|
|
703
767
|
} catch {
|
|
704
768
|
names = [];
|
|
705
769
|
}
|
|
@@ -713,7 +777,7 @@ async function getRubyVersionDirNamesAsync(driveRoot) {
|
|
|
713
777
|
return cached;
|
|
714
778
|
let names;
|
|
715
779
|
try {
|
|
716
|
-
names = filterRubyDirNames(await
|
|
780
|
+
names = filterRubyDirNames(await fs4.promises.readdir(driveRoot));
|
|
717
781
|
} catch {
|
|
718
782
|
names = [];
|
|
719
783
|
}
|
|
@@ -730,9 +794,9 @@ function computeNeedsShell(resolvedCommand) {
|
|
|
730
794
|
var DEFAULT_STARTUP_FAILURE_WINDOW_MS = 50;
|
|
731
795
|
var WINDOWS_NAV_STARTUP_FAILURE_WINDOW_MS = 500;
|
|
732
796
|
var SESSIONSTART_LOG_DIR = getGlobalPiLensLogDir();
|
|
733
|
-
var SESSIONSTART_LOG =
|
|
734
|
-
var PI_LENS_BIN_DIR =
|
|
735
|
-
var PI_LENS_TOOLS_BIN_DIR =
|
|
797
|
+
var SESSIONSTART_LOG = path4.join(SESSIONSTART_LOG_DIR, "sessionstart.log");
|
|
798
|
+
var PI_LENS_BIN_DIR = path4.join(getGlobalPiLensDir(), "bin");
|
|
799
|
+
var PI_LENS_TOOLS_BIN_DIR = path4.join(getGlobalPiLensDir(), "tools", "node_modules", ".bin");
|
|
736
800
|
function logSessionStart2(msg) {
|
|
737
801
|
if (isTestMode()) {
|
|
738
802
|
return;
|
|
@@ -740,8 +804,8 @@ function logSessionStart2(msg) {
|
|
|
740
804
|
const line = redactSecrets(`[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg}
|
|
741
805
|
`);
|
|
742
806
|
try {
|
|
743
|
-
|
|
744
|
-
|
|
807
|
+
fs5.mkdirSync(SESSIONSTART_LOG_DIR, { recursive: true });
|
|
808
|
+
fs5.appendFileSync(SESSIONSTART_LOG, line);
|
|
745
809
|
} catch {
|
|
746
810
|
}
|
|
747
811
|
}
|
|
@@ -761,8 +825,8 @@ function splitPathEntries(value, delimiter) {
|
|
|
761
825
|
}
|
|
762
826
|
function normalizePathEntry(entry, platform) {
|
|
763
827
|
if (platform !== "win32")
|
|
764
|
-
return
|
|
765
|
-
return
|
|
828
|
+
return path4.posix.normalize(entry);
|
|
829
|
+
return path4.win32.normalize(entry).toLowerCase();
|
|
766
830
|
}
|
|
767
831
|
function combinePathValuesForPlatform(values, platform = process.platform) {
|
|
768
832
|
const unique = [];
|
|
@@ -805,34 +869,34 @@ function getLiveWindowsPath() {
|
|
|
805
869
|
}
|
|
806
870
|
async function buildAugmentedPath(basePath) {
|
|
807
871
|
const candidates = [];
|
|
808
|
-
const nodeDir =
|
|
872
|
+
const nodeDir = path4.dirname(process.execPath);
|
|
809
873
|
if (nodeDir) {
|
|
810
874
|
candidates.push(nodeDir);
|
|
811
875
|
}
|
|
812
876
|
if (isWindows) {
|
|
813
|
-
const home =
|
|
814
|
-
const driveRoot =
|
|
815
|
-
candidates.push(
|
|
816
|
-
candidates.push(
|
|
817
|
-
candidates.push(
|
|
877
|
+
const home = os2.homedir();
|
|
878
|
+
const driveRoot = path4.parse(home).root;
|
|
879
|
+
candidates.push(path4.join(home, ".cargo", "bin"));
|
|
880
|
+
candidates.push(path4.join(home, "go", "bin"));
|
|
881
|
+
candidates.push(path4.join(home, ".dotnet", "tools"));
|
|
818
882
|
candidates.push(PI_LENS_BIN_DIR);
|
|
819
883
|
candidates.push(PI_LENS_TOOLS_BIN_DIR);
|
|
820
|
-
candidates.push(
|
|
821
|
-
candidates.push(
|
|
884
|
+
candidates.push(path4.join(driveRoot, "Program Files", "Go", "bin"));
|
|
885
|
+
candidates.push(path4.join(driveRoot, "Go", "bin"));
|
|
822
886
|
for (const entry of await getRubyVersionDirNamesAsync(driveRoot)) {
|
|
823
|
-
candidates.push(
|
|
887
|
+
candidates.push(path4.join(driveRoot, entry, "bin"));
|
|
824
888
|
}
|
|
825
889
|
}
|
|
826
890
|
const effectiveBase = isWindows ? combinePathValuesForPlatform([basePath, getLiveWindowsPath()]) : basePath;
|
|
827
891
|
const existing = /* @__PURE__ */ new Set();
|
|
828
|
-
for (const entry of splitPathEntries(effectiveBase,
|
|
892
|
+
for (const entry of splitPathEntries(effectiveBase, path4.delimiter)) {
|
|
829
893
|
if (!entry)
|
|
830
894
|
continue;
|
|
831
895
|
existing.add(normalizePathEntry(entry, process.platform));
|
|
832
896
|
}
|
|
833
897
|
const toAppend = [];
|
|
834
898
|
for (const candidate of candidates) {
|
|
835
|
-
if (!candidate || !
|
|
899
|
+
if (!candidate || !fs5.existsSync(candidate))
|
|
836
900
|
continue;
|
|
837
901
|
const normalized = normalizePathEntry(candidate, process.platform);
|
|
838
902
|
if (existing.has(normalized))
|
|
@@ -843,18 +907,18 @@ async function buildAugmentedPath(basePath) {
|
|
|
843
907
|
if (toAppend.length === 0)
|
|
844
908
|
return basePath ?? "";
|
|
845
909
|
if (!basePath)
|
|
846
|
-
return toAppend.join(
|
|
847
|
-
return `${basePath}${
|
|
910
|
+
return toAppend.join(path4.delimiter);
|
|
911
|
+
return `${basePath}${path4.delimiter}${toAppend.join(path4.delimiter)}`;
|
|
848
912
|
}
|
|
849
913
|
function isCmdShimValid(cmdPath) {
|
|
850
914
|
try {
|
|
851
|
-
const content =
|
|
915
|
+
const content = fs5.readFileSync(cmdPath, "utf-8");
|
|
852
916
|
const match = content.match(/"%~dp0[/\\]\.\.[/\\]((?:[\w./@-]|\\)+\.(?:mjs|cjs|js))"/i);
|
|
853
917
|
if (!match)
|
|
854
918
|
return true;
|
|
855
|
-
const relPath = match[1].replace(/[/\\]/g,
|
|
856
|
-
const target =
|
|
857
|
-
return
|
|
919
|
+
const relPath = match[1].replace(/[/\\]/g, path4.sep);
|
|
920
|
+
const target = path4.resolve(path4.dirname(cmdPath), "..", relPath);
|
|
921
|
+
return fs5.existsSync(target);
|
|
858
922
|
} catch {
|
|
859
923
|
return true;
|
|
860
924
|
}
|
|
@@ -879,16 +943,16 @@ function isMissingWindowsStartupCommand(spawnCommand, presence) {
|
|
|
879
943
|
}
|
|
880
944
|
function bypassPs1OnWindows(ps1Path, args) {
|
|
881
945
|
const cmdPath = `${ps1Path.slice(0, -4)}.cmd`;
|
|
882
|
-
if (
|
|
946
|
+
if (fs5.existsSync(cmdPath)) {
|
|
883
947
|
return { command: cmdPath, args, needsShell: true };
|
|
884
948
|
}
|
|
885
949
|
try {
|
|
886
|
-
const content =
|
|
950
|
+
const content = fs5.readFileSync(ps1Path, "utf-8");
|
|
887
951
|
const match = content.match(/"\$basedir[/\\]\.\.[/\\]((?:[\w./@-]|\\)+\.(?:mjs|cjs|js))"/i);
|
|
888
952
|
if (match) {
|
|
889
|
-
const relPath = match[1].replace(/[/\\]/g,
|
|
890
|
-
const jsPath =
|
|
891
|
-
if (
|
|
953
|
+
const relPath = match[1].replace(/[/\\]/g, path4.sep);
|
|
954
|
+
const jsPath = path4.resolve(path4.dirname(ps1Path), "..", relPath);
|
|
955
|
+
if (fs5.existsSync(jsPath)) {
|
|
892
956
|
return {
|
|
893
957
|
command: process.execPath,
|
|
894
958
|
args: [jsPath, ...args],
|
|
@@ -913,7 +977,7 @@ function withLspProjectCodePermission(allowed, spawn) {
|
|
|
913
977
|
var unknownProjectLocalNoticeGeneration = -1;
|
|
914
978
|
function recordUntrustedLspExecution(request, trust) {
|
|
915
979
|
const generation = getDegradationLedgerGeneration();
|
|
916
|
-
const subject = request.kind === "project-code-server" ? `project-code-server:g${generation}:${request.serverId}:${request.root}` : `project-local-binary:g${generation}:${
|
|
980
|
+
const subject = request.kind === "project-code-server" ? `project-code-server:g${generation}:${request.serverId}:${request.root}` : `project-local-binary:g${generation}:${path4.basename(request.command)}`;
|
|
917
981
|
const metadata = request.kind === "project-code-server" ? {
|
|
918
982
|
field: request.kind,
|
|
919
983
|
serverId: request.serverId,
|
|
@@ -1094,9 +1158,9 @@ async function launchLSP(command, args = [], options = {}) {
|
|
|
1094
1158
|
delete env[OWNER_TAG_ENV];
|
|
1095
1159
|
else
|
|
1096
1160
|
env[OWNER_TAG_ENV] = ownerTag;
|
|
1097
|
-
const isBareCommand = !isFullyQualified(command) && !command.includes(
|
|
1098
|
-
const isRelativePath = !isFullyQualified(command) && (command.includes(
|
|
1099
|
-
const explicitCommand = isRelativePath ?
|
|
1161
|
+
const isBareCommand = !isFullyQualified(command) && !command.includes(path4.sep) && !command.includes("/");
|
|
1162
|
+
const isRelativePath = !isFullyQualified(command) && (command.includes(path4.sep) || command.includes("/"));
|
|
1163
|
+
const explicitCommand = isRelativePath ? path4.resolve(cwd, command) : command;
|
|
1100
1164
|
const scannedCommandPath = isBareCommand ? findBinaryOnPath(command, env, cwd) : void 0;
|
|
1101
1165
|
const resolvedCommand = scannedCommandPath ?? explicitCommand;
|
|
1102
1166
|
let needsShell = computeNeedsShell(resolvedCommand);
|
|
@@ -1252,7 +1316,7 @@ function asRecord(value) {
|
|
|
1252
1316
|
}
|
|
1253
1317
|
var CONFIG_RESOLVED_PHASE = "config_resolved";
|
|
1254
1318
|
function configResolutionKey(cwd) {
|
|
1255
|
-
return normalizeFilePath(
|
|
1319
|
+
return normalizeFilePath(path5.resolve(normalizeFilePath(cwd)));
|
|
1256
1320
|
}
|
|
1257
1321
|
function publishConfigResolutionPending(cwd) {
|
|
1258
1322
|
logSessionStart(`session_start config_resolution_pending session=${currentSessionRecordId()} root=${configResolutionKey(cwd)}`);
|
|
@@ -1282,7 +1346,7 @@ function recordConfigResolved(cwd, resolution, lspConfig, homeDir, resolveMs) {
|
|
|
1282
1346
|
});
|
|
1283
1347
|
logSessionStart(`config resolved documents=${summary.documents.length} legacy=${legacyDocuments} records=${summary.recordCount} deniedServers=${deniedServers} resolveMs=${resolveMs} session=${sessionId} root=${root}`);
|
|
1284
1348
|
}
|
|
1285
|
-
async function loadLSPConfig(cwd, homeDir =
|
|
1349
|
+
async function loadLSPConfig(cwd, homeDir = os3.homedir(), options = {}) {
|
|
1286
1350
|
const reporting = options.report !== false;
|
|
1287
1351
|
publishConfigResolutionPending(cwd);
|
|
1288
1352
|
const resolveStartedAt = Date.now();
|
|
@@ -1306,8 +1370,8 @@ async function loadLSPConfig(cwd, homeDir = os4.homedir(), options = {}) {
|
|
|
1306
1370
|
// contents are pi-lens settings. An LSP-scoped file still reports here.
|
|
1307
1371
|
...reporting ? { onReadError: reportConfigReadFailure } : {}
|
|
1308
1372
|
});
|
|
1309
|
-
const
|
|
1310
|
-
const config = lspConfigOf(resolution.value,
|
|
1373
|
+
const configProblems = newLspConfigProblems();
|
|
1374
|
+
const config = lspConfigOf(resolution.value, configProblems);
|
|
1311
1375
|
Object.defineProperty(config, "__provenance", {
|
|
1312
1376
|
value: resolution.provenance,
|
|
1313
1377
|
enumerable: false
|
|
@@ -1315,15 +1379,16 @@ async function loadLSPConfig(cwd, homeDir = os4.homedir(), options = {}) {
|
|
|
1315
1379
|
if (reporting) {
|
|
1316
1380
|
reportPiLensConfigRecords([
|
|
1317
1381
|
...resolution.records,
|
|
1318
|
-
...coversClaimRecords(resolution,
|
|
1382
|
+
...coversClaimRecords(resolution, configProblems),
|
|
1383
|
+
...disabledServerRecords(resolution, configProblems)
|
|
1319
1384
|
]);
|
|
1320
1385
|
}
|
|
1321
|
-
recordCoversUnvalidated(resolution,
|
|
1386
|
+
recordCoversUnvalidated(resolution, configProblems);
|
|
1322
1387
|
recordConfigResolved(cwd, resolution, config, homeDir, Date.now() - resolveStartedAt);
|
|
1323
1388
|
return config;
|
|
1324
1389
|
}
|
|
1325
|
-
function
|
|
1326
|
-
return { refusals: [], unvalidated: [] };
|
|
1390
|
+
function newLspConfigProblems() {
|
|
1391
|
+
return { refusals: [], unvalidated: [], unknownDisabled: [] };
|
|
1327
1392
|
}
|
|
1328
1393
|
function coversPointer(serverId) {
|
|
1329
1394
|
return `/${LSP_NAMESPACE_KEY}/servers/${serverId}/covers`;
|
|
@@ -1358,6 +1423,21 @@ function coversClaimRecords(resolution, problems) {
|
|
|
1358
1423
|
};
|
|
1359
1424
|
});
|
|
1360
1425
|
}
|
|
1426
|
+
function disabledServerRecords(resolution, problems) {
|
|
1427
|
+
const records = problems.unknownDisabled.map(({ id, index }) => {
|
|
1428
|
+
const pointer = `/${LSP_NAMESPACE_KEY}/disabledServers/${index}`;
|
|
1429
|
+
const { file, tier } = coversClaimSource(resolution, pointer);
|
|
1430
|
+
return {
|
|
1431
|
+
code: "PILENS_CFG_0005",
|
|
1432
|
+
file,
|
|
1433
|
+
key: pointer,
|
|
1434
|
+
subject: migrationSubject(file, pointer),
|
|
1435
|
+
reason: `lsp.disabledServers entry "${boundedKeyLabel(id)}" is not a recognized LSP server id; dropped`,
|
|
1436
|
+
...tier ? { tier } : {}
|
|
1437
|
+
};
|
|
1438
|
+
});
|
|
1439
|
+
return finalizeRecords(records, records.at(-1));
|
|
1440
|
+
}
|
|
1361
1441
|
function keptTail(keptCount) {
|
|
1362
1442
|
return keptCount > 0 ? "registers with the remaining covers claim" : "registers with no covers claim";
|
|
1363
1443
|
}
|
|
@@ -1409,6 +1489,21 @@ function customServerSpecsOf(value) {
|
|
|
1409
1489
|
const servers = asRecord(lspSectionOf(value).servers);
|
|
1410
1490
|
return servers ? coversValidatedServers(servers) : {};
|
|
1411
1491
|
}
|
|
1492
|
+
function knownDisabledServerIds(members, declared, problems) {
|
|
1493
|
+
const kept = [];
|
|
1494
|
+
members.forEach((member, index) => {
|
|
1495
|
+
if (typeof member !== "string") {
|
|
1496
|
+
kept.push(member);
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
if (getServerById(member) !== void 0 || declared !== void 0 && Object.hasOwn(declared, member)) {
|
|
1500
|
+
kept.push(member);
|
|
1501
|
+
return;
|
|
1502
|
+
}
|
|
1503
|
+
problems?.unknownDisabled.push({ id: member, index });
|
|
1504
|
+
});
|
|
1505
|
+
return kept;
|
|
1506
|
+
}
|
|
1412
1507
|
function lspConfigOf(value, problems, provenance) {
|
|
1413
1508
|
const section = lspSectionOf(value);
|
|
1414
1509
|
const config = {};
|
|
@@ -1420,7 +1515,7 @@ function lspConfigOf(value, problems, provenance) {
|
|
|
1420
1515
|
config.serverOverrides = serverOverrides;
|
|
1421
1516
|
}
|
|
1422
1517
|
if (Array.isArray(section.disabledServers)) {
|
|
1423
|
-
config.disabledServers = section.disabledServers;
|
|
1518
|
+
config.disabledServers = knownDisabledServerIds(section.disabledServers, servers, problems);
|
|
1424
1519
|
}
|
|
1425
1520
|
if (Array.isArray(section.warmFiles)) {
|
|
1426
1521
|
config.warmFiles = section.warmFiles;
|
|
@@ -1498,7 +1593,7 @@ var EMPTY_CONFIG = {
|
|
|
1498
1593
|
};
|
|
1499
1594
|
var configInFlight = /* @__PURE__ */ new Map();
|
|
1500
1595
|
function normalizeWorkspacePath(cwd) {
|
|
1501
|
-
return
|
|
1596
|
+
return path5.resolve(cwd);
|
|
1502
1597
|
}
|
|
1503
1598
|
var unknownTrustNoticeGeneration = -1;
|
|
1504
1599
|
var serversForFileOverride;
|
|
@@ -1519,11 +1614,12 @@ function sourceFor(provenance, key) {
|
|
|
1519
1614
|
function executableAllowed(provenance, trust) {
|
|
1520
1615
|
return !provenance || !isRepoTier(provenance.tier) || trust === "trusted";
|
|
1521
1616
|
}
|
|
1522
|
-
function registryDecision(id, field, provenance, trust, allowed) {
|
|
1617
|
+
function registryDecision(id, section, field, provenance, trust, allowed) {
|
|
1523
1618
|
if (allowed || !provenance || !isRepoTier(provenance.tier))
|
|
1524
1619
|
return;
|
|
1525
1620
|
const subject = `${id}:${field}:${provenance.tier}`;
|
|
1526
|
-
const
|
|
1621
|
+
const outcome = section === "servers" ? `the ${id} entry is not applied for this project` : `the project's ${id} override is not applied`;
|
|
1622
|
+
const reason = `project LSP ${field} refused for ${id}: pi project trust is ${trust}; ${outcome}`;
|
|
1527
1623
|
recordDegradationOnce({
|
|
1528
1624
|
kind: "lsp-registry-decision",
|
|
1529
1625
|
subject,
|
|
@@ -1543,6 +1639,70 @@ function registryDecision(id, field, provenance, trust, allowed) {
|
|
|
1543
1639
|
}
|
|
1544
1640
|
}
|
|
1545
1641
|
}
|
|
1642
|
+
var REPO_TIER_SERVER_FIELDS = {
|
|
1643
|
+
name: {
|
|
1644
|
+
admit: true,
|
|
1645
|
+
why: "Display label only: it selects nothing and reaches no argv, environment, working directory or initialization option."
|
|
1646
|
+
},
|
|
1647
|
+
extensions: {
|
|
1648
|
+
admit: false,
|
|
1649
|
+
why: "Routing: decides which repo files start the user's server (a repo could send `.env` to it, or unroute it with `[]`)."
|
|
1650
|
+
},
|
|
1651
|
+
command: {
|
|
1652
|
+
admit: false,
|
|
1653
|
+
why: "Launch: the program and, for the array form, the leading argv."
|
|
1654
|
+
},
|
|
1655
|
+
args: {
|
|
1656
|
+
admit: false,
|
|
1657
|
+
why: "Launch: appended to the child's argv (customServerLaunch)."
|
|
1658
|
+
},
|
|
1659
|
+
rootMarkers: {
|
|
1660
|
+
admit: false,
|
|
1661
|
+
why: "Launch: chooses the root, and the root is the child's working directory (spawn(root) hands it to launchLSP as cwd)."
|
|
1662
|
+
},
|
|
1663
|
+
env: {
|
|
1664
|
+
admit: false,
|
|
1665
|
+
why: "Launch: merged into the child's environment."
|
|
1666
|
+
},
|
|
1667
|
+
initializationOptions: {
|
|
1668
|
+
admit: false,
|
|
1669
|
+
why: "Launch: sent to the server in the initialize request."
|
|
1670
|
+
},
|
|
1671
|
+
covers: {
|
|
1672
|
+
admit: false,
|
|
1673
|
+
why: "Changes which analysis runs: a covered runner defers to the server, so a repo could silence a runner the user kept."
|
|
1674
|
+
}
|
|
1675
|
+
};
|
|
1676
|
+
var REPO_TIER_OVERRIDE_FIELDS = {
|
|
1677
|
+
command: {
|
|
1678
|
+
admit: false,
|
|
1679
|
+
why: "Launch: replaces the catalog server's binary and argv."
|
|
1680
|
+
},
|
|
1681
|
+
env: {
|
|
1682
|
+
admit: false,
|
|
1683
|
+
why: "Launch: merged into the child's environment."
|
|
1684
|
+
},
|
|
1685
|
+
initializationOptions: {
|
|
1686
|
+
admit: false,
|
|
1687
|
+
why: "Launch: sent to the server in the initialize request."
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
function refusedRepoFields(id, section, entry, table, provenance, trust, labelOf) {
|
|
1691
|
+
const refused = /* @__PURE__ */ new Set();
|
|
1692
|
+
if (!entry || typeof entry !== "object")
|
|
1693
|
+
return refused;
|
|
1694
|
+
for (const key of Object.keys(entry)) {
|
|
1695
|
+
const named = Object.hasOwn(table, key);
|
|
1696
|
+
if (named && table[key]?.admit)
|
|
1697
|
+
continue;
|
|
1698
|
+
const source = sourceFor(provenance, `/lsp/${section}/${id}/${key}`);
|
|
1699
|
+
const allowed = executableAllowed(source, trust);
|
|
1700
|
+
registryDecision(id, section, named ? labelOf(key) : "unrecognized field", source, trust, allowed);
|
|
1701
|
+
if (!allowed)
|
|
1702
|
+
refused.add(key);
|
|
1703
|
+
}
|
|
1704
|
+
return refused;
|
|
1705
|
+
}
|
|
1546
1706
|
function getConfigForFile(filePath) {
|
|
1547
1707
|
return sessionRootConfigForFile(filePath) ?? EMPTY_CONFIG;
|
|
1548
1708
|
}
|
|
@@ -1646,6 +1806,10 @@ var OVERRIDE_COPY_TRAITS = {
|
|
|
1646
1806
|
keep: false,
|
|
1647
1807
|
why: "Reset: marks config-supplied rows; catalog rows never declare it."
|
|
1648
1808
|
},
|
|
1809
|
+
echoesOwnNotice: {
|
|
1810
|
+
keep: false,
|
|
1811
|
+
why: "Reset: the hold drops an empty publish on the catalog binary's measured recompile echo; on another binary it could keep an error the server really cleared."
|
|
1812
|
+
},
|
|
1649
1813
|
command: {
|
|
1650
1814
|
keep: false,
|
|
1651
1815
|
why: "Reset: the custom-row command token; the override's command lives in its spawn."
|
|
@@ -1678,49 +1842,41 @@ function compileLspRegistry(config, provenance = /* @__PURE__ */ new Map()) {
|
|
|
1678
1842
|
const disabledServerIds = new Set(config.disabledServers ?? []);
|
|
1679
1843
|
if (config.servers) {
|
|
1680
1844
|
for (const [id, serverConfig] of Object.entries(config.servers)) {
|
|
1681
|
-
const
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
if (!
|
|
1845
|
+
const refused = refusedRepoFields(id, "servers", serverConfig, REPO_TIER_SERVER_FIELDS, provenance, trust, (key) => key);
|
|
1846
|
+
if (refused.size > 0)
|
|
1847
|
+
continue;
|
|
1848
|
+
if (!Array.isArray(serverConfig.extensions))
|
|
1685
1849
|
continue;
|
|
1686
|
-
const envSource = sourceFor(provenance, `/lsp/servers/${id}/env`);
|
|
1687
|
-
const initSource = sourceFor(provenance, `/lsp/servers/${id}/initializationOptions`);
|
|
1688
|
-
const envAllowed = executableAllowed(envSource, trust);
|
|
1689
|
-
const initAllowed = executableAllowed(initSource, trust);
|
|
1690
|
-
registryDecision(id, "env", envSource, trust, envAllowed);
|
|
1691
|
-
registryDecision(id, "initializationOptions", initSource, trust, initAllowed);
|
|
1692
|
-
const admitted = { ...serverConfig };
|
|
1693
|
-
if (!envAllowed)
|
|
1694
|
-
delete admitted.env;
|
|
1695
|
-
if (!initAllowed)
|
|
1696
|
-
delete admitted.initializationOptions;
|
|
1697
1850
|
try {
|
|
1698
|
-
const server = createCustomServer(
|
|
1851
|
+
const server = createCustomServer({ ...serverConfig }, id);
|
|
1699
1852
|
customServers.push({ ...server, trustAllowed: true });
|
|
1700
1853
|
} catch {
|
|
1701
1854
|
}
|
|
1702
1855
|
}
|
|
1703
1856
|
}
|
|
1704
1857
|
const serverOverrides = /* @__PURE__ */ new Map();
|
|
1858
|
+
let globalOverrides;
|
|
1705
1859
|
if (config.serverOverrides) {
|
|
1706
|
-
for (const [id,
|
|
1707
|
-
if (
|
|
1860
|
+
for (const [id, merged] of Object.entries(config.serverOverrides)) {
|
|
1861
|
+
if (merged && typeof merged === "object" && !Array.isArray(merged)) {
|
|
1862
|
+
const refused = refusedRepoFields(id, "serverOverrides", merged, REPO_TIER_OVERRIDE_FIELDS, provenance, trust, (key) => key === "command" || key === "env" ? `${key} override` : key);
|
|
1863
|
+
let entry = merged;
|
|
1864
|
+
if (refused.size > 0) {
|
|
1865
|
+
globalOverrides ??= lspConfigOf(resolvePiLensConfig({
|
|
1866
|
+
globalDir: getGlobalPiLensDir(),
|
|
1867
|
+
globalConfigPath: getPiLensGlobalConfigPath()
|
|
1868
|
+
}).value).serverOverrides ?? {};
|
|
1869
|
+
entry = Object.hasOwn(globalOverrides, id) ? globalOverrides[id] : void 0;
|
|
1870
|
+
}
|
|
1871
|
+
if (!entry)
|
|
1872
|
+
continue;
|
|
1708
1873
|
const initOpts = entry.initializationOptions;
|
|
1709
1874
|
const command = entry.command;
|
|
1710
|
-
const commandSource = sourceFor(provenance, `/lsp/serverOverrides/${id}/command`);
|
|
1711
|
-
const envSource = sourceFor(provenance, `/lsp/serverOverrides/${id}/env`);
|
|
1712
|
-
const initSource = sourceFor(provenance, `/lsp/serverOverrides/${id}/initializationOptions`);
|
|
1713
|
-
const commandAllowed = executableAllowed(commandSource, trust);
|
|
1714
|
-
const envAllowed = executableAllowed(envSource, trust);
|
|
1715
|
-
const overrideInitAllowed = executableAllowed(initSource, trust);
|
|
1716
|
-
registryDecision(id, "command override", commandSource, trust, commandAllowed);
|
|
1717
|
-
registryDecision(id, "env override", envSource, trust, envAllowed);
|
|
1718
|
-
registryDecision(id, "initializationOptions", initSource, trust, overrideInitAllowed);
|
|
1719
1875
|
if (command !== void 0 || entry.env !== void 0 || initOpts !== void 0 && typeof initOpts === "object" && initOpts !== null && !Array.isArray(initOpts)) {
|
|
1720
1876
|
serverOverrides.set(id, {
|
|
1721
|
-
...
|
|
1722
|
-
...
|
|
1723
|
-
...
|
|
1877
|
+
...initOpts !== void 0 ? { initializationOptions: initOpts } : {},
|
|
1878
|
+
...command !== void 0 ? { command } : {},
|
|
1879
|
+
...entry.env ? { env: entry.env } : {}
|
|
1724
1880
|
});
|
|
1725
1881
|
}
|
|
1726
1882
|
}
|
|
@@ -1767,7 +1923,7 @@ async function initLSPConfig(cwd) {
|
|
|
1767
1923
|
if (existing)
|
|
1768
1924
|
return existing;
|
|
1769
1925
|
const promise = (async () => {
|
|
1770
|
-
const config = registerLSPConfig(await loadLSPConfig(cwd,
|
|
1926
|
+
const config = registerLSPConfig(await loadLSPConfig(cwd, os3.homedir()));
|
|
1771
1927
|
forgetConfigResolvedClaims(setSessionRootConfig(normalizedCwd, config));
|
|
1772
1928
|
})();
|
|
1773
1929
|
configInFlight.set(normalizedCwd, promise);
|
|
@@ -2357,32 +2513,32 @@ function classifyCascadeWaitTier(lspService, filePath, snapshots) {
|
|
|
2357
2513
|
}
|
|
2358
2514
|
|
|
2359
2515
|
// dist/clients/lsp/lombok.js
|
|
2360
|
-
import * as
|
|
2361
|
-
import * as
|
|
2362
|
-
import * as
|
|
2516
|
+
import * as fs6 from "node:fs";
|
|
2517
|
+
import * as os4 from "node:os";
|
|
2518
|
+
import * as path6 from "node:path";
|
|
2363
2519
|
var LOMBOK_ENV_KEYS = ["PI_LENS_LOMBOK_JAR", "LOMBOK_JAR"];
|
|
2364
2520
|
var LOMBOK_PROJECT_FILES = [
|
|
2365
2521
|
"lombok.config",
|
|
2366
2522
|
"pom.xml",
|
|
2367
2523
|
"build.gradle",
|
|
2368
2524
|
"build.gradle.kts",
|
|
2369
|
-
|
|
2525
|
+
path6.join("gradle", "libs.versions.toml")
|
|
2370
2526
|
];
|
|
2371
2527
|
function fileExists(filePath) {
|
|
2372
2528
|
if (!filePath)
|
|
2373
2529
|
return false;
|
|
2374
2530
|
try {
|
|
2375
|
-
return
|
|
2531
|
+
return fs6.statSync(filePath).isFile();
|
|
2376
2532
|
} catch {
|
|
2377
2533
|
return false;
|
|
2378
2534
|
}
|
|
2379
2535
|
}
|
|
2380
2536
|
function readTextIfSmall(filePath, maxBytes = 512 * 1024) {
|
|
2381
2537
|
try {
|
|
2382
|
-
const stat2 =
|
|
2538
|
+
const stat2 = fs6.statSync(filePath);
|
|
2383
2539
|
if (!stat2.isFile() || stat2.size > maxBytes)
|
|
2384
2540
|
return "";
|
|
2385
|
-
return
|
|
2541
|
+
return fs6.readFileSync(filePath, "utf-8");
|
|
2386
2542
|
} catch {
|
|
2387
2543
|
return "";
|
|
2388
2544
|
}
|
|
@@ -2391,13 +2547,13 @@ function containsLombokDependency(text) {
|
|
|
2391
2547
|
return /\borg\.projectlombok\b/i.test(text) || /<artifactId>\s*lombok\s*<\/artifactId>/i.test(text) || /\b(annotationProcessor|compileOnly|testCompileOnly|testAnnotationProcessor)\b[^\n]*\blombok\b/i.test(text);
|
|
2392
2548
|
}
|
|
2393
2549
|
function hasLombokProject(root) {
|
|
2394
|
-
const lombokConfig =
|
|
2550
|
+
const lombokConfig = path6.join(root, "lombok.config");
|
|
2395
2551
|
if (fileExists(lombokConfig))
|
|
2396
2552
|
return true;
|
|
2397
2553
|
for (const name of LOMBOK_PROJECT_FILES) {
|
|
2398
2554
|
if (name === "lombok.config")
|
|
2399
2555
|
continue;
|
|
2400
|
-
const text = readTextIfSmall(
|
|
2556
|
+
const text = readTextIfSmall(path6.join(root, name));
|
|
2401
2557
|
if (text && containsLombokDependency(text))
|
|
2402
2558
|
return true;
|
|
2403
2559
|
}
|
|
@@ -2407,23 +2563,23 @@ function envJarCandidate(env) {
|
|
|
2407
2563
|
for (const key of LOMBOK_ENV_KEYS) {
|
|
2408
2564
|
const value = env[key]?.trim();
|
|
2409
2565
|
if (fileExists(value))
|
|
2410
|
-
return
|
|
2566
|
+
return path6.resolve(value);
|
|
2411
2567
|
}
|
|
2412
2568
|
return void 0;
|
|
2413
2569
|
}
|
|
2414
2570
|
function localJarCandidates(root) {
|
|
2415
2571
|
return [
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2572
|
+
path6.join(root, "lombok.jar"),
|
|
2573
|
+
path6.join(root, ".lombok", "lombok.jar"),
|
|
2574
|
+
path6.join(root, "lib", "lombok.jar"),
|
|
2575
|
+
path6.join(root, "libs", "lombok.jar")
|
|
2420
2576
|
];
|
|
2421
2577
|
}
|
|
2422
2578
|
function newestExistingJar(candidates) {
|
|
2423
2579
|
let best;
|
|
2424
2580
|
for (const candidate of candidates) {
|
|
2425
2581
|
try {
|
|
2426
|
-
const stat2 =
|
|
2582
|
+
const stat2 = fs6.statSync(candidate);
|
|
2427
2583
|
if (!stat2.isFile())
|
|
2428
2584
|
continue;
|
|
2429
2585
|
if (!best || stat2.mtimeMs > best.mtimeMs) {
|
|
@@ -2434,35 +2590,35 @@ function newestExistingJar(candidates) {
|
|
|
2434
2590
|
}
|
|
2435
2591
|
return best?.filePath;
|
|
2436
2592
|
}
|
|
2437
|
-
function mavenLocalLombokJar(home =
|
|
2438
|
-
const base =
|
|
2593
|
+
function mavenLocalLombokJar(home = os4.homedir()) {
|
|
2594
|
+
const base = path6.join(home, ".m2", "repository", "org", "projectlombok", "lombok");
|
|
2439
2595
|
let versions = [];
|
|
2440
2596
|
try {
|
|
2441
|
-
versions =
|
|
2597
|
+
versions = fs6.readdirSync(base);
|
|
2442
2598
|
} catch {
|
|
2443
2599
|
return void 0;
|
|
2444
2600
|
}
|
|
2445
|
-
return newestExistingJar(versions.map((version) =>
|
|
2601
|
+
return newestExistingJar(versions.map((version) => path6.join(base, version, `lombok-${version}.jar`)));
|
|
2446
2602
|
}
|
|
2447
|
-
function gradleCacheLombokJar(home =
|
|
2448
|
-
const base =
|
|
2603
|
+
function gradleCacheLombokJar(home = os4.homedir()) {
|
|
2604
|
+
const base = path6.join(home, ".gradle", "caches", "modules-2", "files-2.1", "org.projectlombok", "lombok");
|
|
2449
2605
|
const candidates = [];
|
|
2450
2606
|
let versions = [];
|
|
2451
2607
|
try {
|
|
2452
|
-
versions =
|
|
2608
|
+
versions = fs6.readdirSync(base);
|
|
2453
2609
|
} catch {
|
|
2454
2610
|
return void 0;
|
|
2455
2611
|
}
|
|
2456
2612
|
for (const version of versions) {
|
|
2457
|
-
const versionDir =
|
|
2613
|
+
const versionDir = path6.join(base, version);
|
|
2458
2614
|
let hashes = [];
|
|
2459
2615
|
try {
|
|
2460
|
-
hashes =
|
|
2616
|
+
hashes = fs6.readdirSync(versionDir);
|
|
2461
2617
|
} catch {
|
|
2462
2618
|
continue;
|
|
2463
2619
|
}
|
|
2464
2620
|
for (const hash of hashes) {
|
|
2465
|
-
candidates.push(
|
|
2621
|
+
candidates.push(path6.join(versionDir, hash, `lombok-${version}.jar`));
|
|
2466
2622
|
}
|
|
2467
2623
|
}
|
|
2468
2624
|
return newestExistingJar(candidates);
|
|
@@ -2494,16 +2650,16 @@ function createLombokJdtlsArgs(root, baseEnv = process.env) {
|
|
|
2494
2650
|
|
|
2495
2651
|
// dist/clients/lsp/jvm-runtime.js
|
|
2496
2652
|
import { existsSync as existsSync2, readdirSync as readdirSync4 } from "node:fs";
|
|
2497
|
-
import
|
|
2498
|
-
import
|
|
2653
|
+
import os5 from "node:os";
|
|
2654
|
+
import path7 from "node:path";
|
|
2499
2655
|
var JAVA_EXE = process.platform === "win32" ? "java.exe" : "java";
|
|
2500
2656
|
var JAVA_PROBE_TIMEOUT_MS = 5e3;
|
|
2501
2657
|
var MIN_JAVA_MAJOR = 17;
|
|
2502
2658
|
function jdkHomeFrom(dir) {
|
|
2503
|
-
if (existsSync2(
|
|
2659
|
+
if (existsSync2(path7.join(dir, "bin", JAVA_EXE)))
|
|
2504
2660
|
return dir;
|
|
2505
|
-
const macHome =
|
|
2506
|
-
if (existsSync2(
|
|
2661
|
+
const macHome = path7.join(dir, "Contents", "Home");
|
|
2662
|
+
if (existsSync2(path7.join(macHome, "bin", JAVA_EXE)))
|
|
2507
2663
|
return macHome;
|
|
2508
2664
|
return void 0;
|
|
2509
2665
|
}
|
|
@@ -2516,34 +2672,34 @@ function parseMajorVersion(name) {
|
|
|
2516
2672
|
}
|
|
2517
2673
|
function childDirs(base) {
|
|
2518
2674
|
try {
|
|
2519
|
-
return readdirSync4(base, { withFileTypes: true }).filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) =>
|
|
2675
|
+
return readdirSync4(base, { withFileTypes: true }).filter((e) => e.isDirectory() || e.isSymbolicLink()).map((e) => path7.join(base, e.name));
|
|
2520
2676
|
} catch {
|
|
2521
2677
|
return [];
|
|
2522
2678
|
}
|
|
2523
2679
|
}
|
|
2524
2680
|
function candidateRoots() {
|
|
2525
|
-
const home =
|
|
2681
|
+
const home = os5.homedir();
|
|
2526
2682
|
const roots = [];
|
|
2527
|
-
roots.push(
|
|
2528
|
-
roots.push(
|
|
2683
|
+
roots.push(path7.join(home, ".jdks"));
|
|
2684
|
+
roots.push(path7.join(getGlobalPiLensDir(), "tools"));
|
|
2529
2685
|
if (process.platform === "win32") {
|
|
2530
2686
|
const progFiles = [
|
|
2531
2687
|
process.env.ProgramFiles,
|
|
2532
2688
|
process.env["ProgramFiles(x86)"],
|
|
2533
2689
|
process.env.ProgramW6432,
|
|
2534
|
-
|
|
2690
|
+
path7.join(process.env.LOCALAPPDATA ?? path7.join(home, "AppData", "Local"), "Programs")
|
|
2535
2691
|
].filter((p) => Boolean(p));
|
|
2536
2692
|
for (const base of progFiles) {
|
|
2537
|
-
roots.push(
|
|
2538
|
-
roots.push(
|
|
2539
|
-
roots.push(
|
|
2540
|
-
roots.push(
|
|
2541
|
-
roots.push(
|
|
2542
|
-
roots.push(
|
|
2693
|
+
roots.push(path7.join(base, "Eclipse Adoptium"));
|
|
2694
|
+
roots.push(path7.join(base, "Java"));
|
|
2695
|
+
roots.push(path7.join(base, "Microsoft"));
|
|
2696
|
+
roots.push(path7.join(base, "Zulu"));
|
|
2697
|
+
roots.push(path7.join(base, "Amazon Corretto"));
|
|
2698
|
+
roots.push(path7.join(base, "BellSoft"));
|
|
2543
2699
|
}
|
|
2544
2700
|
} else if (process.platform === "darwin") {
|
|
2545
2701
|
roots.push("/Library/Java/JavaVirtualMachines");
|
|
2546
|
-
roots.push(
|
|
2702
|
+
roots.push(path7.join(home, "Library", "Java", "JavaVirtualMachines"));
|
|
2547
2703
|
roots.push("/opt/homebrew/opt");
|
|
2548
2704
|
roots.push("/usr/local/opt");
|
|
2549
2705
|
} else {
|
|
@@ -2567,7 +2723,7 @@ function discoverJdkHome(roots = candidateRoots(), javaHome = process.env.JAVA_H
|
|
|
2567
2723
|
continue;
|
|
2568
2724
|
found.push({
|
|
2569
2725
|
home: resolved,
|
|
2570
|
-
major: parseMajorVersion(
|
|
2726
|
+
major: parseMajorVersion(path7.basename(dir))
|
|
2571
2727
|
});
|
|
2572
2728
|
}
|
|
2573
2729
|
}
|
|
@@ -2670,12 +2826,12 @@ async function resolveJavaRuntimeEnv() {
|
|
|
2670
2826
|
}
|
|
2671
2827
|
const home = discoverJdkHome();
|
|
2672
2828
|
if (home) {
|
|
2673
|
-
const binDir =
|
|
2829
|
+
const binDir = path7.join(home, "bin");
|
|
2674
2830
|
const currentPath = process.env.PATH ?? process.env.Path ?? "";
|
|
2675
2831
|
_cachedEnv = {
|
|
2676
2832
|
value: {
|
|
2677
2833
|
JAVA_HOME: home,
|
|
2678
|
-
PATH: binDir +
|
|
2834
|
+
PATH: binDir + path7.delimiter + currentPath
|
|
2679
2835
|
},
|
|
2680
2836
|
trustGeneration
|
|
2681
2837
|
};
|
|
@@ -2734,7 +2890,7 @@ async function resolveLspServerCwd(server, filePath, sessionCwd, onRootFailure,
|
|
|
2734
2890
|
rootFailed = true;
|
|
2735
2891
|
onRootFailure?.(reason);
|
|
2736
2892
|
}
|
|
2737
|
-
const isFileDirFallback = serverRoot !== void 0 && rootMarkers?.length &&
|
|
2893
|
+
const isFileDirFallback = serverRoot !== void 0 && rootMarkers?.length && path8.resolve(serverRoot) === path8.resolve(path8.dirname(filePath));
|
|
2738
2894
|
if (!serverRoot || isFileDirFallback) {
|
|
2739
2895
|
const probedMarker = onRootFallback && !rootFailed && rootMarkers?.length ? resolveToolCwd("lsp", server.id, filePath, {
|
|
2740
2896
|
cwd: sessionCwd,
|
|
@@ -2743,7 +2899,7 @@ async function resolveLspServerCwd(server, filePath, sessionCwd, onRootFailure,
|
|
|
2743
2899
|
}).marker : void 0;
|
|
2744
2900
|
const refusedMarker = probedMarker !== void 0 && rootMarkers?.includes(probedMarker) ? probedMarker : void 0;
|
|
2745
2901
|
const fallbackCwd = rootMarkers?.length ? resolveToolCwd("lsp", server.id, filePath, {
|
|
2746
|
-
cwd:
|
|
2902
|
+
cwd: path8.dirname(path8.resolve(filePath)),
|
|
2747
2903
|
rootMarkers
|
|
2748
2904
|
}) : void 0;
|
|
2749
2905
|
if (!serverRoot) {
|
|
@@ -2826,17 +2982,17 @@ var PYTHON_EXTENSIONS = new Set(extensionsForLanguage("python"));
|
|
|
2826
2982
|
var loggedRootCeilingClamps = /* @__PURE__ */ new Set();
|
|
2827
2983
|
var posixCaseInsensitiveByPath = /* @__PURE__ */ new Map();
|
|
2828
2984
|
function posixFilesystemIsCaseInsensitive(root) {
|
|
2829
|
-
const resolved =
|
|
2985
|
+
const resolved = path8.resolve(root);
|
|
2830
2986
|
const cached = posixCaseInsensitiveByPath.get(resolved);
|
|
2831
2987
|
if (cached !== void 0)
|
|
2832
2988
|
return cached;
|
|
2833
2989
|
if (!existsSync3(resolved)) {
|
|
2834
2990
|
return false;
|
|
2835
2991
|
}
|
|
2836
|
-
const name =
|
|
2992
|
+
const name = path8.basename(resolved);
|
|
2837
2993
|
const alternate = name.toLowerCase() === name ? name.toUpperCase() : name.toLowerCase();
|
|
2838
2994
|
let insensitive = false;
|
|
2839
|
-
const alternatePath =
|
|
2995
|
+
const alternatePath = path8.join(path8.dirname(resolved), alternate);
|
|
2840
2996
|
if (alternate !== name && existsSync3(alternatePath)) {
|
|
2841
2997
|
try {
|
|
2842
2998
|
const actual = statSync4(resolved);
|
|
@@ -2854,7 +3010,7 @@ function resetLSPCaseSensitivityState() {
|
|
|
2854
3010
|
}
|
|
2855
3011
|
function isSameOrWithin(ancestor, candidate, deps = {}) {
|
|
2856
3012
|
const windowsShaped = isWindowsPath(ancestor) || isWindowsPath(candidate);
|
|
2857
|
-
const pathApi = windowsShaped ?
|
|
3013
|
+
const pathApi = windowsShaped ? path8.win32 : path8;
|
|
2858
3014
|
const resolvedAncestor = pathApi.resolve(ancestor);
|
|
2859
3015
|
const resolvedCandidate = pathApi.resolve(candidate);
|
|
2860
3016
|
let caseInsensitive = false;
|
|
@@ -2878,7 +3034,7 @@ function isSameOrWithin(ancestor, candidate, deps = {}) {
|
|
|
2878
3034
|
}
|
|
2879
3035
|
function enforceLspRootCeiling(root, sessionCwd, filePath) {
|
|
2880
3036
|
const windowsShaped = isWindowsPath(root) || isWindowsPath(sessionCwd);
|
|
2881
|
-
const pathApi = windowsShaped ?
|
|
3037
|
+
const pathApi = windowsShaped ? path8.win32 : path8;
|
|
2882
3038
|
const resolvedRoot = pathApi.resolve(root);
|
|
2883
3039
|
const resolvedCwd = pathApi.resolve(sessionCwd);
|
|
2884
3040
|
if (filePath && !isSameOrWithin(resolvedCwd, pathApi.resolve(filePath))) {
|
|
@@ -2905,8 +3061,8 @@ async function hasProjectBoundaryMarker(dir, server) {
|
|
|
2905
3061
|
return false;
|
|
2906
3062
|
}
|
|
2907
3063
|
function pathSegments(dir) {
|
|
2908
|
-
const parsed =
|
|
2909
|
-
return
|
|
3064
|
+
const parsed = path8.parse(path8.resolve(dir));
|
|
3065
|
+
return path8.relative(parsed.root, path8.resolve(dir)).split(path8.sep).filter(Boolean).map((segment) => segment.toLowerCase());
|
|
2910
3066
|
}
|
|
2911
3067
|
function hasFixtureConvention(dir) {
|
|
2912
3068
|
const segments = pathSegments(dir);
|
|
@@ -2937,7 +3093,7 @@ async function findGitBoundary(dir, memo) {
|
|
|
2937
3093
|
return found;
|
|
2938
3094
|
}
|
|
2939
3095
|
async function isExcludedLspRoot(dir, gitBoundaries) {
|
|
2940
|
-
const candidate =
|
|
3096
|
+
const candidate = path8.resolve(dir);
|
|
2941
3097
|
if (hasFixtureConvention(candidate) || hasAtomicStageSegment(candidate))
|
|
2942
3098
|
return true;
|
|
2943
3099
|
const gitRoot = await findGitBoundary(candidate, gitBoundaries);
|
|
@@ -2948,8 +3104,8 @@ async function isExcludedLspRoot(dir, gitBoundaries) {
|
|
|
2948
3104
|
return isPathIgnoredByProject(candidate, gitRoot, true);
|
|
2949
3105
|
}
|
|
2950
3106
|
async function nearestNonExcludedFallbackRoot(candidate, stopDir) {
|
|
2951
|
-
const startDir =
|
|
2952
|
-
const fsRoot =
|
|
3107
|
+
const startDir = path8.resolve(candidate);
|
|
3108
|
+
const fsRoot = path8.parse(startDir).root;
|
|
2953
3109
|
let nearestAllowed;
|
|
2954
3110
|
const gitBoundaries = /* @__PURE__ */ new Map();
|
|
2955
3111
|
for (const current of walkUpDirs(startDir, { spelling: true })) {
|
|
@@ -2967,9 +3123,6 @@ async function nearestNonExcludedFallbackRoot(candidate, stopDir) {
|
|
|
2967
3123
|
return nearestAllowed ?? startDir;
|
|
2968
3124
|
return nearestAllowed ?? fsRoot;
|
|
2969
3125
|
}
|
|
2970
|
-
function isLspInstallDisabled() {
|
|
2971
|
-
return process.env.PI_LENS_DISABLE_LSP_INSTALL === "1";
|
|
2972
|
-
}
|
|
2973
3126
|
function canInstall(allowInstall) {
|
|
2974
3127
|
return allowInstall !== false && !isLspInstallDisabled();
|
|
2975
3128
|
}
|
|
@@ -3004,7 +3157,7 @@ async function installEvidenceForLaunch(toolId, installed, attempt) {
|
|
|
3004
3157
|
const confirmedManagedPath = await findManagedToolBinary(toolId);
|
|
3005
3158
|
return {
|
|
3006
3159
|
...evidence,
|
|
3007
|
-
binary:
|
|
3160
|
+
binary: path8.basename(installed),
|
|
3008
3161
|
...confirmedManagedPath !== void 0 && pathsEqual(confirmedManagedPath, installed) && {
|
|
3009
3162
|
source: "managed-dir"
|
|
3010
3163
|
}
|
|
@@ -3057,7 +3210,7 @@ function markDirectLspCommandUnavailable(command) {
|
|
|
3057
3210
|
directLspCommandUnavailableUntil.set(command, Date.now() + DIRECT_LSP_NEGATIVE_TTL_MS);
|
|
3058
3211
|
directLspCommandSkipLoggedUntil.delete(command);
|
|
3059
3212
|
}
|
|
3060
|
-
var PI_LENS_BIN_DIR2 =
|
|
3213
|
+
var PI_LENS_BIN_DIR2 = path8.join(getGlobalPiLensDir(), "bin");
|
|
3061
3214
|
async function resolveAndLaunch(spec, allowInstall) {
|
|
3062
3215
|
const generation = lspLaunchAvailabilityGeneration.capture();
|
|
3063
3216
|
const toolLabel = spec.managedToolId ?? spec.candidates[spec.candidates.length - 1] ?? "unknown";
|
|
@@ -3122,7 +3275,7 @@ async function resolveAndLaunch(spec, allowInstall) {
|
|
|
3122
3275
|
producer: "lsp-launch",
|
|
3123
3276
|
classifiedBy: "probe",
|
|
3124
3277
|
evidence: {
|
|
3125
|
-
binary:
|
|
3278
|
+
binary: path8.basename(managedCandidate),
|
|
3126
3279
|
source: "managed-dir",
|
|
3127
3280
|
correctsLatchedRow: false
|
|
3128
3281
|
}
|
|
@@ -3428,7 +3581,7 @@ async function resolveAndLaunchTreeBinary(spec, allowInstall) {
|
|
|
3428
3581
|
return void 0;
|
|
3429
3582
|
}
|
|
3430
3583
|
const suffix = process.platform === "win32" ? ".exe" : "";
|
|
3431
|
-
const binPath =
|
|
3584
|
+
const binPath = path8.join(bundleDir, ...spec.binRelPath.split("/")) + suffix;
|
|
3432
3585
|
try {
|
|
3433
3586
|
const proc = await launchLSP(binPath, spec.args, {
|
|
3434
3587
|
cwd: spec.cwd,
|
|
@@ -3443,7 +3596,7 @@ async function resolveAndLaunchTreeBinary(spec, allowInstall) {
|
|
|
3443
3596
|
}
|
|
3444
3597
|
}
|
|
3445
3598
|
function nodeBinLocalCandidates(root, baseName) {
|
|
3446
|
-
const localBase =
|
|
3599
|
+
const localBase = path8.join(root, "node_modules", ".bin", baseName);
|
|
3447
3600
|
if (process.platform === "win32") {
|
|
3448
3601
|
return [`${localBase}.cmd`, `${localBase}.exe`];
|
|
3449
3602
|
}
|
|
@@ -3453,7 +3606,7 @@ function nodeBinCandidates(root, baseName) {
|
|
|
3453
3606
|
return [...nodeBinLocalCandidates(root, baseName), baseName];
|
|
3454
3607
|
}
|
|
3455
3608
|
function piAgentExtensionsRootKey(file) {
|
|
3456
|
-
const dirKey = normalizeEphemeralMapKey(
|
|
3609
|
+
const dirKey = normalizeEphemeralMapKey(path8.dirname(path8.resolve(file)));
|
|
3457
3610
|
const marker = "/.pi/agent/extensions";
|
|
3458
3611
|
const index = dirKey.indexOf(marker);
|
|
3459
3612
|
if (index === -1)
|
|
@@ -3461,26 +3614,26 @@ function piAgentExtensionsRootKey(file) {
|
|
|
3461
3614
|
return dirKey.slice(0, index + marker.length);
|
|
3462
3615
|
}
|
|
3463
3616
|
function IgnoreHomeRoot(primary) {
|
|
3464
|
-
const homeKey = normalizeEphemeralMapKey(realpathOrResolve(
|
|
3617
|
+
const homeKey = normalizeEphemeralMapKey(realpathOrResolve(os6.homedir()));
|
|
3465
3618
|
return withRootMarkers(async (file) => {
|
|
3466
3619
|
const root = await primary(file);
|
|
3467
3620
|
if (!root)
|
|
3468
3621
|
return void 0;
|
|
3469
|
-
return normalizeEphemeralMapKey(
|
|
3622
|
+
return normalizeEphemeralMapKey(path8.resolve(root)) === homeKey ? void 0 : root;
|
|
3470
3623
|
}, primary.rootMarkers ?? []);
|
|
3471
3624
|
}
|
|
3472
3625
|
function rubyBinCandidates(baseName) {
|
|
3473
3626
|
const candidates = [];
|
|
3474
|
-
const home =
|
|
3627
|
+
const home = os6.homedir();
|
|
3475
3628
|
const isWin = process.platform === "win32";
|
|
3476
3629
|
const ext = isWin ? ".bat" : "";
|
|
3477
|
-
candidates.push(
|
|
3478
|
-
candidates.push(
|
|
3630
|
+
candidates.push(path8.join(home, ".local", "share", "mise", "installs", "ruby", "bin", `${baseName}${ext}`));
|
|
3631
|
+
candidates.push(path8.join(home, ".asdf", "installs", "ruby", "bin", `${baseName}${ext}`));
|
|
3479
3632
|
if (isWin) {
|
|
3480
|
-
const driveRoot =
|
|
3633
|
+
const driveRoot = path8.parse(home).root;
|
|
3481
3634
|
for (const entry of getRubyVersionDirNamesSync(driveRoot)) {
|
|
3482
|
-
candidates.push(
|
|
3483
|
-
candidates.push(
|
|
3635
|
+
candidates.push(path8.join(driveRoot, entry, "bin", `${baseName}.bat`));
|
|
3636
|
+
candidates.push(path8.join(driveRoot, entry, "bin", baseName));
|
|
3484
3637
|
}
|
|
3485
3638
|
}
|
|
3486
3639
|
return candidates;
|
|
@@ -3537,13 +3690,13 @@ function PriorityRoot(markerGroups, excludePatterns, stopDir) {
|
|
|
3537
3690
|
}, markerGroups.flat());
|
|
3538
3691
|
}
|
|
3539
3692
|
var FileDirRoot = async (file) => {
|
|
3540
|
-
const candidate =
|
|
3693
|
+
const candidate = path8.resolve(path8.dirname(file));
|
|
3541
3694
|
return nearestNonExcludedFallbackRoot(candidate, piAgentExtensionsRootKey(file));
|
|
3542
3695
|
};
|
|
3543
3696
|
function declinesLooseFileRoot(server, root) {
|
|
3544
3697
|
if (server.looseFileRoot !== "decline")
|
|
3545
3698
|
return false;
|
|
3546
|
-
return isAtOrAboveHomeDir(realpathOrResolve(root), realpathOrResolve(
|
|
3699
|
+
return isAtOrAboveHomeDir(realpathOrResolve(root), realpathOrResolve(os6.homedir()));
|
|
3547
3700
|
}
|
|
3548
3701
|
var PROJECT_FILE_SEARCH_MAX_DIRS = 128;
|
|
3549
3702
|
async function declinesProjectlessRoot(server, root) {
|
|
@@ -3563,7 +3716,7 @@ async function declinesProjectlessRoot(server, root) {
|
|
|
3563
3716
|
if (visited + queue.length + 1 >= PROJECT_FILE_SEARCH_MAX_DIRS)
|
|
3564
3717
|
break;
|
|
3565
3718
|
if (entry.isDirectory() && !isExcludedDirName(entry.name)) {
|
|
3566
|
-
queue.push(
|
|
3719
|
+
queue.push(path8.join(dir, entry.name));
|
|
3567
3720
|
}
|
|
3568
3721
|
}
|
|
3569
3722
|
}
|
|
@@ -3588,16 +3741,16 @@ function markerProbeDir(dir, pattern) {
|
|
|
3588
3741
|
const normalized = toPosix(pattern);
|
|
3589
3742
|
const slash = normalized.lastIndexOf("/");
|
|
3590
3743
|
const parentPattern = slash >= 0 ? normalized.slice(0, slash) : "";
|
|
3591
|
-
return parentPattern ?
|
|
3744
|
+
return parentPattern ? path8.join(dir, ...parentPattern.split("/").filter(Boolean)) : dir;
|
|
3592
3745
|
}
|
|
3593
3746
|
async function markerExists(dir, pattern) {
|
|
3594
3747
|
if (!pattern.includes("*")) {
|
|
3595
3748
|
try {
|
|
3596
|
-
await stat(
|
|
3749
|
+
await stat(path8.join(dir, pattern));
|
|
3597
3750
|
return true;
|
|
3598
3751
|
} catch (err) {
|
|
3599
3752
|
if (isPermissionFsError(err)) {
|
|
3600
|
-
logSessionStart(`lsp root marker skipped: permission error stat ${
|
|
3753
|
+
logSessionStart(`lsp root marker skipped: permission error stat ${path8.join(dir, pattern)}`);
|
|
3601
3754
|
}
|
|
3602
3755
|
return false;
|
|
3603
3756
|
}
|
|
@@ -3634,7 +3787,7 @@ function NearestRoot(includePatterns, excludePatterns, stopDir) {
|
|
|
3634
3787
|
}
|
|
3635
3788
|
return withRootMarkers(async (file) => {
|
|
3636
3789
|
const identity = realpathOrResolve(file);
|
|
3637
|
-
const startDir =
|
|
3790
|
+
const startDir = path8.dirname(identity);
|
|
3638
3791
|
const dirKey = normalizeEphemeralMapKey(startDir);
|
|
3639
3792
|
const cached = cache.get(dirKey);
|
|
3640
3793
|
if (cached !== void 0 && Date.now() - cached.walkedAt < FRESHNESS_CADENCE_MS && await bounded(dirMtimesStillFreshAsync(cached.probedDirs), rootMtimeBound("lsp-root-memo-freshness")) === true)
|
|
@@ -3645,10 +3798,10 @@ function NearestRoot(includePatterns, excludePatterns, stopDir) {
|
|
|
3645
3798
|
const probedDirs = [];
|
|
3646
3799
|
const walkedAt = Date.now();
|
|
3647
3800
|
const promise = (async () => {
|
|
3648
|
-
const fsRoot =
|
|
3801
|
+
const fsRoot = path8.parse(startDir).root;
|
|
3649
3802
|
const stop = stopDir ? realpathOrResolve(stopDir) : fsRoot;
|
|
3650
3803
|
for (const currentDir of walkUpDirs(startDir)) {
|
|
3651
|
-
if (stop !== fsRoot && currentDir.startsWith(stop +
|
|
3804
|
+
if (stop !== fsRoot && currentDir.startsWith(stop + path8.sep) === false && currentDir !== stop) {
|
|
3652
3805
|
break;
|
|
3653
3806
|
}
|
|
3654
3807
|
const stepDirs = [
|
|
@@ -3669,7 +3822,7 @@ function NearestRoot(includePatterns, excludePatterns, stopDir) {
|
|
|
3669
3822
|
continue;
|
|
3670
3823
|
}
|
|
3671
3824
|
for (const pattern of includePatterns) {
|
|
3672
|
-
if (await markerExists(currentDir, pattern) && (pattern !== ".git" || currentDir !== realpathOrResolve(
|
|
3825
|
+
if (await markerExists(currentDir, pattern) && (pattern !== ".git" || currentDir !== realpathOrResolve(os6.tmpdir())) && !await isExcludedLspRoot(currentDir)) {
|
|
3673
3826
|
return enforceLspRootCeiling(currentDir, process.cwd(), identity);
|
|
3674
3827
|
}
|
|
3675
3828
|
}
|
|
@@ -3716,15 +3869,15 @@ async function findAncestorFile(startDir, ...relativeSegments) {
|
|
|
3716
3869
|
return findAncestorFileAmong(startDir, [relativeSegments]);
|
|
3717
3870
|
}
|
|
3718
3871
|
async function findAncestorFileAmong(startDir, candidateSegmentLists) {
|
|
3719
|
-
const
|
|
3720
|
-
const home = realpathOrResolve(
|
|
3872
|
+
const fs7 = await import("node:fs/promises");
|
|
3873
|
+
const home = realpathOrResolve(os6.homedir());
|
|
3721
3874
|
for (const currentDir of walkUpDirs(startDir, { spelling: true })) {
|
|
3722
3875
|
if (isAtOrAboveHomeDir(realpathOrResolve(currentDir), home))
|
|
3723
3876
|
break;
|
|
3724
3877
|
for (const segments of candidateSegmentLists) {
|
|
3725
|
-
const candidate =
|
|
3878
|
+
const candidate = path8.join(currentDir, ...segments);
|
|
3726
3879
|
try {
|
|
3727
|
-
await
|
|
3880
|
+
await fs7.access(candidate);
|
|
3728
3881
|
return candidate;
|
|
3729
3882
|
} catch {
|
|
3730
3883
|
}
|
|
@@ -3741,21 +3894,21 @@ function resetClassicTsRepairGuard() {
|
|
|
3741
3894
|
classicTsRepairState().attempted = false;
|
|
3742
3895
|
}
|
|
3743
3896
|
function typescriptDirsForTsc(tscPath) {
|
|
3744
|
-
const binDir =
|
|
3897
|
+
const binDir = path8.dirname(tscPath);
|
|
3745
3898
|
return [
|
|
3746
|
-
|
|
3747
|
-
|
|
3899
|
+
path8.join(binDir, "..", "typescript"),
|
|
3900
|
+
path8.join(binDir, "..", "..", "typescript"),
|
|
3748
3901
|
// Windows npm-global: `<prefix>/tsc.cmd` beside `<prefix>/node_modules`.
|
|
3749
|
-
|
|
3902
|
+
path8.join(binDir, "node_modules", "typescript")
|
|
3750
3903
|
];
|
|
3751
3904
|
}
|
|
3752
3905
|
async function typescriptVersionForTsc(tscPath) {
|
|
3753
|
-
if (!
|
|
3906
|
+
if (!path8.isAbsolute(tscPath))
|
|
3754
3907
|
return void 0;
|
|
3755
3908
|
for (const dir of typescriptDirsForTsc(tscPath)) {
|
|
3756
3909
|
let manifest;
|
|
3757
3910
|
try {
|
|
3758
|
-
manifest = await readFile(
|
|
3911
|
+
manifest = await readFile(path8.join(dir, "package.json"), "utf8");
|
|
3759
3912
|
} catch {
|
|
3760
3913
|
continue;
|
|
3761
3914
|
}
|
|
@@ -3785,20 +3938,20 @@ async function hasTypescriptPackageDir(tscPath) {
|
|
|
3785
3938
|
return false;
|
|
3786
3939
|
}
|
|
3787
3940
|
async function absoluteCommandPath(command) {
|
|
3788
|
-
if (!command ||
|
|
3941
|
+
if (!command || path8.isAbsolute(command))
|
|
3789
3942
|
return command;
|
|
3790
3943
|
const found = await findCommandAsync(command);
|
|
3791
3944
|
return found ? realpath(found).catch(() => void 0) : void 0;
|
|
3792
3945
|
}
|
|
3793
3946
|
async function findTsserverPath(root, allowInstall, options) {
|
|
3794
|
-
const
|
|
3795
|
-
const projectRoots = await Promise.all([root, options?.sessionRoot ?? process.cwd(), process.cwd()].map((dir) =>
|
|
3947
|
+
const fs7 = await import("node:fs/promises");
|
|
3948
|
+
const projectRoots = await Promise.all([root, options?.sessionRoot ?? process.cwd(), process.cwd()].map((dir) => fs7.realpath(dir).catch(() => path8.resolve(dir))));
|
|
3796
3949
|
const admitCandidate = async (candidate, projectSupplied) => {
|
|
3797
3950
|
try {
|
|
3798
|
-
const real = await
|
|
3799
|
-
if (
|
|
3951
|
+
const real = await fs7.realpath(candidate);
|
|
3952
|
+
if (path8.basename(real) !== "tsserver.js" || !(await fs7.stat(real)).isFile())
|
|
3800
3953
|
return void 0;
|
|
3801
|
-
const manifest = JSON.parse(await
|
|
3954
|
+
const manifest = JSON.parse(await fs7.readFile(path8.join(path8.dirname(real), "..", "package.json"), "utf8"));
|
|
3802
3955
|
if (typeof manifest?.version !== "string" || !manifest.version)
|
|
3803
3956
|
return void 0;
|
|
3804
3957
|
return admitProjectSuppliedTsserver(real, options?.sessionRoot ?? process.cwd(), projectSupplied || projectRoots.some((dir) => isUnderDir(real, dir)), options?.projectCodeAllowed);
|
|
@@ -3812,9 +3965,9 @@ async function findTsserverPath(root, allowInstall, options) {
|
|
|
3812
3965
|
if (admittedAncestor)
|
|
3813
3966
|
return admittedAncestor;
|
|
3814
3967
|
}
|
|
3815
|
-
const cwdCandidate =
|
|
3968
|
+
const cwdCandidate = path8.join(process.cwd(), "node_modules", "typescript", "lib", "tsserver.js");
|
|
3816
3969
|
try {
|
|
3817
|
-
await
|
|
3970
|
+
await fs7.access(cwdCandidate);
|
|
3818
3971
|
const admittedCwd = await admitCandidate(cwdCandidate, false);
|
|
3819
3972
|
if (admittedCwd)
|
|
3820
3973
|
return admittedCwd;
|
|
@@ -3824,7 +3977,7 @@ async function findTsserverPath(root, allowInstall, options) {
|
|
|
3824
3977
|
if (!tscPath)
|
|
3825
3978
|
return void 0;
|
|
3826
3979
|
for (const dir of typescriptDirsForTsc(tscPath)) {
|
|
3827
|
-
const candidate =
|
|
3980
|
+
const candidate = path8.join(dir, "lib", "tsserver.js");
|
|
3828
3981
|
try {
|
|
3829
3982
|
const admitted = await admitCandidate(candidate, false);
|
|
3830
3983
|
if (admitted)
|
|
@@ -3853,12 +4006,12 @@ async function findTsserverPath(root, allowInstall, options) {
|
|
|
3853
4006
|
return tsserverForTsc(repairedTsc);
|
|
3854
4007
|
}
|
|
3855
4008
|
async function findNativeTypeScriptLsp(root) {
|
|
3856
|
-
const home = realpathOrResolve(
|
|
4009
|
+
const home = realpathOrResolve(os6.homedir());
|
|
3857
4010
|
for (const currentDir of walkUpDirs(root, { spelling: true })) {
|
|
3858
4011
|
if (isAtOrAboveHomeDir(realpathOrResolve(currentDir), home))
|
|
3859
4012
|
break;
|
|
3860
|
-
const typescriptDir =
|
|
3861
|
-
const packageJsonPath =
|
|
4013
|
+
const typescriptDir = path8.join(currentDir, "node_modules", "typescript");
|
|
4014
|
+
const packageJsonPath = path8.join(typescriptDir, "package.json");
|
|
3862
4015
|
let packageJsonText;
|
|
3863
4016
|
try {
|
|
3864
4017
|
packageJsonText = await readFile(packageJsonPath, "utf8");
|
|
@@ -3888,7 +4041,7 @@ async function findNativeTypeScriptLsp(root) {
|
|
|
3888
4041
|
const major = /^\d+$/.test(majorText) ? Number(majorText) : Number.NaN;
|
|
3889
4042
|
if (!Number.isFinite(major) || major < 7)
|
|
3890
4043
|
return void 0;
|
|
3891
|
-
const localTsc =
|
|
4044
|
+
const localTsc = path8.join(currentDir, "node_modules", ".bin", "tsc");
|
|
3892
4045
|
const candidates = process.platform === "win32" ? [`${localTsc}.cmd`, `${localTsc}.exe`, localTsc] : [localTsc];
|
|
3893
4046
|
for (const command of candidates) {
|
|
3894
4047
|
try {
|
|
@@ -3896,7 +4049,7 @@ async function findNativeTypeScriptLsp(root) {
|
|
|
3896
4049
|
return {
|
|
3897
4050
|
command,
|
|
3898
4051
|
version,
|
|
3899
|
-
nodeModulesDir:
|
|
4052
|
+
nodeModulesDir: path8.join(currentDir, "node_modules")
|
|
3900
4053
|
};
|
|
3901
4054
|
} catch {
|
|
3902
4055
|
}
|
|
@@ -3908,14 +4061,14 @@ async function findNativeTypeScriptLsp(root) {
|
|
|
3908
4061
|
async function findEffectTsgoLsp(nodeModulesDir) {
|
|
3909
4062
|
let release;
|
|
3910
4063
|
try {
|
|
3911
|
-
const manifest = JSON.parse(await readFile(
|
|
4064
|
+
const manifest = JSON.parse(await readFile(path8.join(nodeModulesDir, "@effect", "tsgo", "package.json"), "utf8"));
|
|
3912
4065
|
release = typeof manifest === "object" && manifest !== null && "version" in manifest ? manifest.version : void 0;
|
|
3913
4066
|
} catch {
|
|
3914
4067
|
return void 0;
|
|
3915
4068
|
}
|
|
3916
4069
|
if (typeof release !== "string" || !release)
|
|
3917
4070
|
return void 0;
|
|
3918
|
-
const localBin =
|
|
4071
|
+
const localBin = path8.join(nodeModulesDir, ".bin", "effect-tsgo");
|
|
3919
4072
|
const candidates = process.platform === "win32" ? [`${localBin}.cmd`, `${localBin}.exe`, localBin] : [localBin];
|
|
3920
4073
|
for (const command of candidates) {
|
|
3921
4074
|
try {
|
|
@@ -3927,17 +4080,17 @@ async function findEffectTsgoLsp(nodeModulesDir) {
|
|
|
3927
4080
|
return void 0;
|
|
3928
4081
|
}
|
|
3929
4082
|
function dotnetToolCandidates(tool) {
|
|
3930
|
-
const home =
|
|
4083
|
+
const home = os6.homedir();
|
|
3931
4084
|
return [
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
4085
|
+
path8.join(PI_LENS_BIN_DIR2, `${tool}.exe`),
|
|
4086
|
+
path8.join(PI_LENS_BIN_DIR2, tool),
|
|
4087
|
+
path8.join(home, ".dotnet", "tools", `${tool}.exe`),
|
|
4088
|
+
path8.join(home, ".dotnet", "tools", tool),
|
|
3936
4089
|
tool
|
|
3937
4090
|
].filter(Boolean);
|
|
3938
4091
|
}
|
|
3939
4092
|
function binExeVariants(dir, tool) {
|
|
3940
|
-
const variants = process.platform === "win32" ? [
|
|
4093
|
+
const variants = process.platform === "win32" ? [path8.join(dir, `${tool}.exe`), path8.join(dir, tool)] : [path8.join(dir, tool)];
|
|
3941
4094
|
const admitted = [];
|
|
3942
4095
|
for (const candidate of variants) {
|
|
3943
4096
|
if (existsSync3(candidate) && isUntrustedProjectPath(candidate)) {
|
|
@@ -3949,12 +4102,12 @@ function binExeVariants(dir, tool) {
|
|
|
3949
4102
|
return admitted;
|
|
3950
4103
|
}
|
|
3951
4104
|
function goBinCandidates(tool) {
|
|
3952
|
-
const gopath = process.env.GOPATH?.split(
|
|
3953
|
-
return [tool, ...binExeVariants(
|
|
4105
|
+
const gopath = process.env.GOPATH?.split(path8.delimiter)[0] || path8.join(os6.homedir(), "go");
|
|
4106
|
+
return [tool, ...binExeVariants(path8.join(gopath, "bin"), tool)];
|
|
3954
4107
|
}
|
|
3955
4108
|
function cargoBinCandidates(tool) {
|
|
3956
|
-
const cargoHome = process.env.CARGO_HOME ||
|
|
3957
|
-
return [tool, ...binExeVariants(
|
|
4109
|
+
const cargoHome = process.env.CARGO_HOME || path8.join(os6.homedir(), ".cargo");
|
|
4110
|
+
return [tool, ...binExeVariants(path8.join(cargoHome, "bin"), tool)];
|
|
3958
4111
|
}
|
|
3959
4112
|
async function tryGemInstall(gem) {
|
|
3960
4113
|
const { join: join4 } = await import("node:path");
|
|
@@ -3992,7 +4145,7 @@ var TS_TOOLING_MARKERS = [
|
|
|
3992
4145
|
];
|
|
3993
4146
|
var TS_FAMILY_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
3994
4147
|
function isTsFamilyFile(file) {
|
|
3995
|
-
return TS_FAMILY_EXTENSIONS.has(
|
|
4148
|
+
return TS_FAMILY_EXTENSIONS.has(path8.extname(file).toLowerCase());
|
|
3996
4149
|
}
|
|
3997
4150
|
function tsConfigMarkersForFile(file) {
|
|
3998
4151
|
return isTsFamilyFile(file) ? ["tsconfig.json"] : TS_CONFIG_MARKERS;
|
|
@@ -4016,36 +4169,36 @@ async function findExtensionBoundedRoot(file, extensionRootKey) {
|
|
|
4016
4169
|
const identity = realpathOrResolve(file);
|
|
4017
4170
|
const insideBoundary = isUnderDir(identity, extensionRootKey);
|
|
4018
4171
|
const boundaryKey = insideBoundary ? normalizeEphemeralMapKey(realpathOrResolve(extensionRootKey)) : extensionRootKey;
|
|
4019
|
-
const start =
|
|
4172
|
+
const start = path8.dirname(insideBoundary ? identity : path8.resolve(file));
|
|
4020
4173
|
const configMarkers = tsConfigMarkersForFile(file);
|
|
4021
4174
|
for (const currentDir of walkUpDirs(start, { spelling: true })) {
|
|
4022
4175
|
for (const pattern of configMarkers) {
|
|
4023
4176
|
try {
|
|
4024
|
-
await stat(
|
|
4177
|
+
await stat(path8.join(currentDir, pattern));
|
|
4025
4178
|
return currentDir;
|
|
4026
4179
|
} catch {
|
|
4027
4180
|
}
|
|
4028
4181
|
}
|
|
4029
4182
|
for (const pattern of TS_TOOLING_MARKERS) {
|
|
4030
4183
|
try {
|
|
4031
|
-
await stat(
|
|
4184
|
+
await stat(path8.join(currentDir, pattern));
|
|
4032
4185
|
return currentDir;
|
|
4033
4186
|
} catch {
|
|
4034
4187
|
}
|
|
4035
4188
|
}
|
|
4036
|
-
const currentKey = normalizeEphemeralMapKey(
|
|
4189
|
+
const currentKey = normalizeEphemeralMapKey(path8.resolve(currentDir));
|
|
4037
4190
|
if (currentKey === boundaryKey)
|
|
4038
4191
|
return void 0;
|
|
4039
4192
|
}
|
|
4040
4193
|
return void 0;
|
|
4041
4194
|
}
|
|
4042
4195
|
async function hasAgentLevelProjectMarker(extensionRootKey) {
|
|
4043
|
-
const agentDir =
|
|
4196
|
+
const agentDir = path8.dirname(extensionRootKey);
|
|
4044
4197
|
if (!agentDir || agentDir === extensionRootKey)
|
|
4045
4198
|
return false;
|
|
4046
4199
|
for (const pattern of [...TS_CONFIG_MARKERS, ...TS_TOOLING_MARKERS]) {
|
|
4047
4200
|
try {
|
|
4048
|
-
await stat(
|
|
4201
|
+
await stat(path8.join(agentDir, pattern));
|
|
4049
4202
|
return true;
|
|
4050
4203
|
} catch {
|
|
4051
4204
|
}
|
|
@@ -4263,13 +4416,13 @@ var PythonServer = {
|
|
|
4263
4416
|
if (!pyrightPath)
|
|
4264
4417
|
return void 0;
|
|
4265
4418
|
source = "managed";
|
|
4266
|
-
const binDir =
|
|
4419
|
+
const binDir = path8.dirname(pyrightPath);
|
|
4267
4420
|
const isWindows2 = process.platform === "win32";
|
|
4268
4421
|
const managedCandidates = isWindows2 ? [
|
|
4269
|
-
|
|
4270
|
-
|
|
4422
|
+
path8.join(binDir, "pyright-langserver.cmd"),
|
|
4423
|
+
path8.join(binDir, "pyright-langserver"),
|
|
4271
4424
|
"pyright-langserver"
|
|
4272
|
-
] : [
|
|
4425
|
+
] : [path8.join(binDir, "pyright-langserver"), "pyright-langserver"];
|
|
4273
4426
|
const resolved = await resolveAndLaunch({ candidates: managedCandidates, args: ["--stdio"], cwd: root, env }, false);
|
|
4274
4427
|
if (!resolved)
|
|
4275
4428
|
return void 0;
|
|
@@ -4374,7 +4527,7 @@ function cargoWorkspaceDeclaresMember(workspaceContent, parentDir, childDir) {
|
|
|
4374
4527
|
return readCargoWorkspaceMembers(workspaceContent).some(matches);
|
|
4375
4528
|
}
|
|
4376
4529
|
function sessionHoistCeiling(sessionCwd, file) {
|
|
4377
|
-
return isSameOrWithin(
|
|
4530
|
+
return isSameOrWithin(path8.resolve(sessionCwd), path8.resolve(file)) ? path8.resolve(sessionCwd) : void 0;
|
|
4378
4531
|
}
|
|
4379
4532
|
function RustWorkspaceRoot() {
|
|
4380
4533
|
const crateRoot = createRootDetector(["Cargo.toml", "Cargo.lock"]);
|
|
@@ -4384,14 +4537,14 @@ function RustWorkspaceRoot() {
|
|
|
4384
4537
|
return void 0;
|
|
4385
4538
|
const sessionCwd = process.cwd();
|
|
4386
4539
|
const stop = sessionHoistCeiling(sessionCwd, file);
|
|
4387
|
-
const fsRoot =
|
|
4540
|
+
const fsRoot = path8.parse(root).root;
|
|
4388
4541
|
for (const current of walkUpDirs(root, { spelling: true })) {
|
|
4389
4542
|
if (stop !== void 0 && current === stop)
|
|
4390
4543
|
break;
|
|
4391
|
-
const parent =
|
|
4544
|
+
const parent = path8.dirname(current);
|
|
4392
4545
|
if (parent === current || parent === fsRoot)
|
|
4393
4546
|
break;
|
|
4394
|
-
const parentCargoPath =
|
|
4547
|
+
const parentCargoPath = path8.join(parent, "Cargo.toml");
|
|
4395
4548
|
const parentCargoContent = await readTextFileOrUndefined(parentCargoPath);
|
|
4396
4549
|
if (parentCargoContent !== void 0 && hasCargoWorkspaceTable(parentCargoContent)) {
|
|
4397
4550
|
if (cargoWorkspaceDeclaresMember(parentCargoContent, parent, root)) {
|
|
@@ -4418,9 +4571,9 @@ async function declaresMavenModule(parentDir, parentPomPath, childDir) {
|
|
|
4418
4571
|
const modulesBlock = content.match(/<modules>([\s\S]*?)<\/modules>/);
|
|
4419
4572
|
if (!modulesBlock)
|
|
4420
4573
|
return false;
|
|
4421
|
-
const resolvedChild =
|
|
4574
|
+
const resolvedChild = path8.resolve(childDir);
|
|
4422
4575
|
for (const match of modulesBlock[1].matchAll(/<module>\s*([^<]+?)\s*<\/module>/g)) {
|
|
4423
|
-
if (pathsEqual(
|
|
4576
|
+
if (pathsEqual(path8.resolve(parentDir, match[1]), resolvedChild))
|
|
4424
4577
|
return true;
|
|
4425
4578
|
}
|
|
4426
4579
|
return false;
|
|
@@ -4443,16 +4596,16 @@ function JavaWorkspaceRoot() {
|
|
|
4443
4596
|
const sessionCwd = process.cwd();
|
|
4444
4597
|
const stop = sessionHoistCeiling(sessionCwd, file);
|
|
4445
4598
|
let lastHop = root;
|
|
4446
|
-
const fsRoot =
|
|
4599
|
+
const fsRoot = path8.parse(root).root;
|
|
4447
4600
|
for (const current of walkUpDirs(root, { spelling: true })) {
|
|
4448
4601
|
if (stop !== void 0 && current === stop)
|
|
4449
4602
|
break;
|
|
4450
|
-
const parent =
|
|
4603
|
+
const parent = path8.dirname(current);
|
|
4451
4604
|
if (parent === current || parent === fsRoot)
|
|
4452
4605
|
break;
|
|
4453
4606
|
if (!await markerExists(parent, "pom.xml"))
|
|
4454
4607
|
continue;
|
|
4455
|
-
const parentPom =
|
|
4608
|
+
const parentPom = path8.join(parent, "pom.xml");
|
|
4456
4609
|
if (!await declaresMavenModule(parent, parentPom, lastHop))
|
|
4457
4610
|
break;
|
|
4458
4611
|
lastHop = parent;
|
|
@@ -4555,17 +4708,17 @@ var PHPServer = {
|
|
|
4555
4708
|
return {
|
|
4556
4709
|
...result,
|
|
4557
4710
|
initialization: {
|
|
4558
|
-
storagePath:
|
|
4711
|
+
storagePath: path8.join(getGlobalPiLensDir(), "intelephense")
|
|
4559
4712
|
}
|
|
4560
4713
|
};
|
|
4561
4714
|
}
|
|
4562
4715
|
};
|
|
4563
4716
|
function buildPsesArgs(bundleDir) {
|
|
4564
|
-
const script =
|
|
4565
|
-
const sessionDir =
|
|
4717
|
+
const script = path8.join(bundleDir, "PowerShellEditorServices", "Start-EditorServices.ps1");
|
|
4718
|
+
const sessionDir = path8.join(getGlobalPiLensDir(), "pses", `${process.pid}-${Date.now()}`);
|
|
4566
4719
|
mkdirSync2(sessionDir, { recursive: true });
|
|
4567
|
-
const logPath =
|
|
4568
|
-
const sessionDetailsPath =
|
|
4720
|
+
const logPath = path8.join(sessionDir, "pses.log");
|
|
4721
|
+
const sessionDetailsPath = path8.join(sessionDir, "session.json");
|
|
4569
4722
|
return [
|
|
4570
4723
|
"-NoLogo",
|
|
4571
4724
|
"-NoProfile",
|
|
@@ -4712,6 +4865,51 @@ var KotlinServer = {
|
|
|
4712
4865
|
}, options?.allowInstall);
|
|
4713
4866
|
}
|
|
4714
4867
|
};
|
|
4868
|
+
var GROOVY_LANGUAGE_SERVER_JAR_ENV = "GROOVY_LANGUAGE_SERVER_JAR";
|
|
4869
|
+
var GroovyServer = {
|
|
4870
|
+
id: "groovy",
|
|
4871
|
+
idleEviction: "unmeasured",
|
|
4872
|
+
role: "language",
|
|
4873
|
+
name: "Groovy Language Server",
|
|
4874
|
+
// The server imports the project through the Gradle Tooling API, which
|
|
4875
|
+
// evaluates the project's build scripts.
|
|
4876
|
+
executesProjectCode: true,
|
|
4877
|
+
// The server recompiles an open document from disk on pi-lens's own
|
|
4878
|
+
// first-open watched-files notice and publishes an empty set that erases
|
|
4879
|
+
// the error it just published (#5131).
|
|
4880
|
+
echoesOwnNotice: true,
|
|
4881
|
+
extensions: [".groovy", ".gvy", ".gy", ".gsh"],
|
|
4882
|
+
root: RootWithFallback(createRootDetector(["build.gradle", "settings.gradle"])),
|
|
4883
|
+
async spawn(root, options) {
|
|
4884
|
+
const env = await resolveJavaRuntimeEnv();
|
|
4885
|
+
const viaLauncher = await resolveAndLaunch({
|
|
4886
|
+
candidates: ["groovy-language-server"],
|
|
4887
|
+
args: [],
|
|
4888
|
+
cwd: root,
|
|
4889
|
+
...env ? { env } : {}
|
|
4890
|
+
}, options?.allowInstall);
|
|
4891
|
+
if (viaLauncher)
|
|
4892
|
+
return viaLauncher;
|
|
4893
|
+
const jar = process.env[GROOVY_LANGUAGE_SERVER_JAR_ENV];
|
|
4894
|
+
const resolvedJar = jar ? path8.resolve(jar) : void 0;
|
|
4895
|
+
const jarIsFile = resolvedJar ? statSync4(resolvedJar, { throwIfNoEntry: false })?.isFile() ?? false : false;
|
|
4896
|
+
if (resolvedJar && jarIsFile) {
|
|
4897
|
+
try {
|
|
4898
|
+
const proc = await launchLSP("java", ["-jar", resolvedJar], {
|
|
4899
|
+
cwd: root,
|
|
4900
|
+
...env ? { env } : {}
|
|
4901
|
+
});
|
|
4902
|
+
return { process: proc, source: "direct" };
|
|
4903
|
+
} catch (err) {
|
|
4904
|
+
logSessionStart(`lsp launch groovy: java -jar ${jar} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
4905
|
+
if (!hasSpawnFailureKind(err, "tool-not-found"))
|
|
4906
|
+
throw err;
|
|
4907
|
+
}
|
|
4908
|
+
}
|
|
4909
|
+
logSessionStart(`lsp launch groovy: not installed (no groovy-language-server on PATH; ${GROOVY_LANGUAGE_SERVER_JAR_ENV}=${jar ? `${jar} (${jarIsFile ? "java not found" : "no such file"})` : "unset"}). Run ./gradlew build in GroovyLanguageServer/groovy-language-server, then set ${GROOVY_LANGUAGE_SERVER_JAR_ENV} to build/libs/groovy-language-server-all.jar`);
|
|
4910
|
+
return void 0;
|
|
4911
|
+
}
|
|
4912
|
+
};
|
|
4715
4913
|
var LeanServer = createInteractiveServer({
|
|
4716
4914
|
id: "lean",
|
|
4717
4915
|
name: "Lean 4 Language Server",
|
|
@@ -4982,6 +5180,12 @@ var BashServer = {
|
|
|
4982
5180
|
// installed; when it is not, the shellcheck runner's dialect gate keeps
|
|
4983
5181
|
// zsh quiet instead of falling back to a zsh-illiterate analyzer.
|
|
4984
5182
|
extensions: [".bash", ".sh"],
|
|
5183
|
+
// #3969 also needs the content gate: .sh/.bash may declare zsh. Only zsh is
|
|
5184
|
+
// excluded; every other dialect keeps its pre-#3969 selection (#3968 AC1).
|
|
5185
|
+
// This reads up to 4 KB of the file from disk on each candidate lookup.
|
|
5186
|
+
pathFilter(filePath) {
|
|
5187
|
+
return !isZshDialect(resolveShellFileDialect(filePath).dialect);
|
|
5188
|
+
},
|
|
4985
5189
|
root: FileDirRoot,
|
|
4986
5190
|
// #2194 bounded the installer's own verification at 20s; the dispatch
|
|
4987
5191
|
// touch's client-wait floor stayed at the shared 5s default, so a cold
|
|
@@ -5227,8 +5431,8 @@ var VueServer = {
|
|
|
5227
5431
|
initializeTimeoutMs: 3e4,
|
|
5228
5432
|
async spawn(root, options) {
|
|
5229
5433
|
const tsserverPath = await findTsserverPath(root, options?.allowInstall, options);
|
|
5230
|
-
const hasPackageJson = existsSync3(
|
|
5231
|
-
const hasNodeModules = existsSync3(
|
|
5434
|
+
const hasPackageJson = existsSync3(path8.join(root, "package.json"));
|
|
5435
|
+
const hasNodeModules = existsSync3(path8.join(root, "node_modules"));
|
|
5232
5436
|
if (hasPackageJson && !hasNodeModules) {
|
|
5233
5437
|
logSessionStart(`lsp vue: node_modules missing in ${root} \u2014 Vue navigation may be limited. Run: npm install (or pnpm/yarn install) in this project.`);
|
|
5234
5438
|
}
|
|
@@ -5243,7 +5447,7 @@ var VueServer = {
|
|
|
5243
5447
|
return {
|
|
5244
5448
|
process: proc.process,
|
|
5245
5449
|
source: proc.source,
|
|
5246
|
-
initialization: tsserverPath ? { typescript: { tsdk:
|
|
5450
|
+
initialization: tsserverPath ? { typescript: { tsdk: path8.dirname(tsserverPath) } } : void 0
|
|
5247
5451
|
};
|
|
5248
5452
|
}
|
|
5249
5453
|
};
|
|
@@ -5285,7 +5489,7 @@ var SvelteServer = {
|
|
|
5285
5489
|
return {
|
|
5286
5490
|
process: proc.process,
|
|
5287
5491
|
source: proc.source,
|
|
5288
|
-
initialization: tsserverPath ? { typescript: { tsdk:
|
|
5492
|
+
initialization: tsserverPath ? { typescript: { tsdk: path8.dirname(tsserverPath) } } : void 0
|
|
5289
5493
|
};
|
|
5290
5494
|
}
|
|
5291
5495
|
};
|
|
@@ -5563,6 +5767,7 @@ var LSP_SERVERS = [
|
|
|
5563
5767
|
FSharpServer,
|
|
5564
5768
|
JavaServer,
|
|
5565
5769
|
KotlinServer,
|
|
5770
|
+
GroovyServer,
|
|
5566
5771
|
LeanServer,
|
|
5567
5772
|
SwiftServer,
|
|
5568
5773
|
DartServer,
|
|
@@ -5609,7 +5814,7 @@ function getServerById(id) {
|
|
|
5609
5814
|
}
|
|
5610
5815
|
|
|
5611
5816
|
// dist/clients/lsp/session-roots.js
|
|
5612
|
-
import
|
|
5817
|
+
import path9 from "node:path";
|
|
5613
5818
|
var SESSION_ROOT_CAP = 128;
|
|
5614
5819
|
var sessionRoots = new BoundedFifoMap(SESSION_ROOT_CAP);
|
|
5615
5820
|
function noteEvictedRoots(evicted) {
|
|
@@ -5624,21 +5829,21 @@ function noteEvictedRoots(evicted) {
|
|
|
5624
5829
|
return roots;
|
|
5625
5830
|
}
|
|
5626
5831
|
function registerSessionRoot(cwd) {
|
|
5627
|
-
const root =
|
|
5832
|
+
const root = path9.resolve(cwd);
|
|
5628
5833
|
if (sessionRoots.has(root))
|
|
5629
5834
|
return [];
|
|
5630
5835
|
return noteEvictedRoots(sessionRoots.set(root, void 0));
|
|
5631
5836
|
}
|
|
5632
5837
|
function setSessionRootConfig(cwd, config) {
|
|
5633
|
-
return noteEvictedRoots(sessionRoots.set(
|
|
5838
|
+
return noteEvictedRoots(sessionRoots.set(path9.resolve(cwd), config));
|
|
5634
5839
|
}
|
|
5635
5840
|
function isSameOrChildPath(filePath, candidateRoot) {
|
|
5636
5841
|
if (filePath === candidateRoot)
|
|
5637
5842
|
return true;
|
|
5638
|
-
return filePath.startsWith(`${candidateRoot}${
|
|
5843
|
+
return filePath.startsWith(`${candidateRoot}${path9.sep}`);
|
|
5639
5844
|
}
|
|
5640
5845
|
function sessionRootConfigForFile(filePath) {
|
|
5641
|
-
const resolvedFilePath =
|
|
5846
|
+
const resolvedFilePath = path9.resolve(filePath);
|
|
5642
5847
|
let bestMatch;
|
|
5643
5848
|
for (const [root, config] of sessionRoots) {
|
|
5644
5849
|
if (config === void 0)
|
|
@@ -5665,16 +5870,16 @@ function disabledPrimaries(filePath) {
|
|
|
5665
5870
|
};
|
|
5666
5871
|
}
|
|
5667
5872
|
function isSessionRootRegistered(cwd) {
|
|
5668
|
-
return sessionRoots.has(
|
|
5873
|
+
return sessionRoots.has(path9.resolve(cwd));
|
|
5669
5874
|
}
|
|
5670
5875
|
function shouldInitializeSessionRoot(cwd, readyRoots) {
|
|
5671
|
-
const normalized =
|
|
5876
|
+
const normalized = path9.resolve(cwd);
|
|
5672
5877
|
return !readyRoots.has(normalized) || !isSessionRootRegistered(normalized);
|
|
5673
5878
|
}
|
|
5674
5879
|
function isOutsideAllSessionRoots(filePath) {
|
|
5675
5880
|
if (sessionRoots.size === 0)
|
|
5676
5881
|
return false;
|
|
5677
|
-
const resolved =
|
|
5882
|
+
const resolved = path9.resolve(filePath);
|
|
5678
5883
|
for (const root of sessionRoots.keys()) {
|
|
5679
5884
|
if (isSameOrWithin(root, resolved))
|
|
5680
5885
|
return false;
|
|
@@ -5701,6 +5906,8 @@ export {
|
|
|
5701
5906
|
BUILTIN_SERVER_RUNNER_COVERS,
|
|
5702
5907
|
isAuxiliary,
|
|
5703
5908
|
serverTraits,
|
|
5909
|
+
isShellcheckDialectSupported,
|
|
5910
|
+
resolveShellFileDialect,
|
|
5704
5911
|
getStrategy,
|
|
5705
5912
|
classifyServerWaitTier,
|
|
5706
5913
|
classifyCascadeWaitTier,
|
|
@@ -5723,6 +5930,8 @@ export {
|
|
|
5723
5930
|
isOutsideAllSessionRoots,
|
|
5724
5931
|
getSessionRootsForTelemetry,
|
|
5725
5932
|
loadLSPConfig,
|
|
5933
|
+
newLspConfigProblems,
|
|
5934
|
+
disabledServerRecords,
|
|
5726
5935
|
customServerSpecsOf,
|
|
5727
5936
|
lspConfigOf,
|
|
5728
5937
|
registerLSPConfig,
|