pi-lens 4.4.7 → 4.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-USER.md +31 -0
- package/CHANGELOG.md +327 -0
- package/README.md +13 -2
- package/config/dependency-cruiser-eager-allowlist.json +1 -1
- package/config/markdownlint/run-no-fix.mjs +36 -0
- package/dist/{chunk-4LM3VAZH.js → chunk-2VZ3VN3N.js} +2 -2
- package/dist/{chunk-PUZ3E2J4.js → chunk-3HTZDY3C.js} +8 -6
- package/dist/{chunk-RORGS5II.js → chunk-3NPWO5UO.js} +7 -13
- package/dist/{chunk-MNJIXFX4.js → chunk-47UCC4MM.js} +1 -1
- package/dist/chunk-4ENEJHF4.js +198 -0
- package/dist/chunk-5GEYJJHG.js +22 -0
- package/dist/{chunk-U6VN4NVL.js → chunk-5YSEQHJN.js} +3 -3
- package/dist/{chunk-6IR3ZYIB.js → chunk-6GPB3JLL.js} +3 -3
- package/dist/{chunk-MB6PXBUA.js → chunk-7R5GZIA6.js} +7 -15
- package/dist/{chunk-DH5JPM3K.js → chunk-7UTSNTWM.js} +10 -9
- package/dist/{chunk-24BILSZW.js → chunk-7YTRG6YW.js} +2 -2
- package/dist/{chunk-KW5JQPO5.js → chunk-AACN5GNE.js} +2 -2
- package/dist/{chunk-PKES3ISE.js → chunk-ACRJ2GZ5.js} +2 -2
- package/dist/{chunk-4ZYJHQMB.js → chunk-C3YRO3EU.js} +10 -12
- package/dist/{chunk-PQJFG24Z.js → chunk-CB7PEVOJ.js} +1300 -946
- package/dist/{chunk-ABPKUVA4.js → chunk-CDFJF5YD.js} +1 -1
- package/dist/{chunk-T7A2HK2B.js → chunk-CJS6WE66.js} +17 -18
- package/dist/{chunk-3YY7IXIL.js → chunk-CM6BDY4E.js} +14 -60
- package/dist/{chunk-RZOXUSPC.js → chunk-CZCAZVTD.js} +16 -2
- package/dist/chunk-DGKFWQK4.js +23 -0
- package/dist/{chunk-NA7SEXHE.js → chunk-E65WJVI5.js} +7 -9
- package/dist/{chunk-2TF6RXWB.js → chunk-EKNYSXFB.js} +8 -10
- package/dist/{chunk-RRV3FNNM.js → chunk-EY6LY2HO.js} +27 -30
- package/dist/{chunk-LBLBAFG3.js → chunk-F6BEQWAK.js} +17 -5
- package/dist/{chunk-4L36HG27.js → chunk-FGNSESAC.js} +12 -14
- package/dist/{chunk-3FRLWYBG.js → chunk-FRUBVFXV.js} +39 -42
- package/dist/{chunk-FB5SCCPT.js → chunk-G22UNQID.js} +14 -15
- package/dist/{chunk-LV4UMYVH.js → chunk-GQTQUNCG.js} +26 -27
- package/dist/{chunk-E7HJ56Y7.js → chunk-H3BVMK47.js} +64 -73
- package/dist/chunk-H6FLQ5NW.js +28 -0
- package/dist/{chunk-QHSNL7B2.js → chunk-HEA3EM23.js} +15 -19
- package/dist/{chunk-AWDSEDER.js → chunk-HSOBIN22.js} +2 -2
- package/dist/{chunk-EAOK7MIZ.js → chunk-HYSKJMZK.js} +17 -4
- package/dist/{chunk-VUZWQ7UG.js → chunk-IICERRFF.js} +46 -72
- package/dist/{chunk-OXOI55RU.js → chunk-IILEH3ZC.js} +8 -10
- package/dist/{chunk-ZKXQKGWZ.js → chunk-J3Q2NYJR.js} +4 -3
- package/dist/{chunk-YHC2O2WO.js → chunk-JUZ67QZQ.js} +20 -9
- package/dist/chunk-KR5VGMVT.js +25 -0
- package/dist/{chunk-F7K5IBZG.js → chunk-KV6GQOGN.js} +41 -44
- package/dist/{chunk-SNDXCFRS.js → chunk-KXMJLOZF.js} +25 -23
- package/dist/{chunk-CB4WHS4H.js → chunk-L4Y3ROKQ.js} +3 -3
- package/dist/{chunk-3F6BMY53.js → chunk-L6WBJGQS.js} +1 -1
- package/dist/{chunk-MPKRJBPK.js → chunk-L7O774U7.js} +30 -32
- package/dist/{chunk-URCQWAQ4.js → chunk-LAHHGNAY.js} +21 -21
- package/dist/{chunk-V63BC55Q.js → chunk-LT62P654.js} +1 -1
- package/dist/{chunk-ZMAUPOMG.js → chunk-LWOM6LVS.js} +34 -34
- package/dist/{chunk-HO6LWE2E.js → chunk-MKPDIAZH.js} +21 -1
- package/dist/{chunk-2PHMIAKO.js → chunk-MN635QYA.js} +3 -4
- package/dist/{chunk-KDX35VXP.js → chunk-MQ4PPCJB.js} +166 -149
- package/dist/{chunk-QOE342SU.js → chunk-MRLH4MYU.js} +2 -2
- package/dist/{chunk-CE6VMBCB.js → chunk-N56BNAA6.js} +20 -21
- package/dist/{chunk-L3CMBQMH.js → chunk-N5CEGQPG.js} +14 -17
- package/dist/{chunk-7E2563GA.js → chunk-NCLO6E6N.js} +13 -33
- package/dist/{chunk-J6JP25XU.js → chunk-NL5LSKVD.js} +4 -3
- package/dist/{chunk-U7BD2QL7.js → chunk-NMUSOZ2D.js} +10 -12
- package/dist/{chunk-BZARLRJW.js → chunk-NOWH2VA2.js} +8 -33
- package/dist/{chunk-U2SDMG7C.js → chunk-NUSXS6YB.js} +6 -5
- package/dist/{chunk-ZJTT47IG.js → chunk-OSEKJEUU.js} +2 -2
- package/dist/{chunk-FZKFVUEC.js → chunk-OUYAUXAT.js} +647 -355
- package/dist/{chunk-ZE3KXHS7.js → chunk-PBZNYHMM.js} +84 -4
- package/dist/{chunk-U5HPROLA.js → chunk-PIIUNJIT.js} +2 -4
- package/dist/chunk-PKLB2XJL.js +8 -0
- package/dist/{chunk-RC2Z6K47.js → chunk-PRHYIA6X.js} +15 -6
- package/dist/{chunk-RQS4QQSD.js → chunk-PXQ45SGD.js} +2 -2
- package/dist/chunk-Q6JQKWPK.js +25 -0
- package/dist/{chunk-F6X3YJWD.js → chunk-QB7T2PHK.js} +2 -2
- package/dist/{chunk-TIQJPRDD.js → chunk-QGITU23N.js} +3 -2
- package/dist/chunk-QJJKOHLH.js +57 -0
- package/dist/{chunk-4LOE5R5P.js → chunk-QP33NKYC.js} +18 -15
- package/dist/{chunk-N5WSK2K7.js → chunk-QVBOXT3L.js} +12 -17
- package/dist/{chunk-DPGEAHZT.js → chunk-RNJFRXEN.js} +10 -18
- package/dist/{chunk-EKWX4WD3.js → chunk-RNXOWDM6.js} +10 -10
- package/dist/{chunk-O4BJFESU.js → chunk-RTFMDIKV.js} +1 -1
- package/dist/{chunk-LS3QJRUB.js → chunk-SIQHOB6P.js} +11 -13
- package/dist/{chunk-3K2F6UDZ.js → chunk-SLSMJPEF.js} +43 -42
- package/dist/chunk-T5QSLSMM.js +50 -0
- package/dist/chunk-TGQDAG4B.js +88 -0
- package/dist/{chunk-4YHYPW2G.js → chunk-THYHUIDR.js} +44 -13
- package/dist/{chunk-YVHBNSME.js → chunk-TMNUTMT5.js} +1099 -1100
- package/dist/{chunk-WDBICWH3.js → chunk-TOE2RRCS.js} +1 -1
- package/dist/chunk-TYHPVE5H.js +25 -0
- package/dist/chunk-UAKO2M6B.js +73 -0
- package/dist/chunk-UC5AXW5Z.js +20 -0
- package/dist/chunk-UTJP6WOS.js +28 -0
- package/dist/{chunk-DQZFQSR5.js → chunk-UXTQ3QPD.js} +4 -4
- package/dist/chunk-UYXV5NIS.js +20 -0
- package/dist/{chunk-KKCK636N.js → chunk-V2WDBOLZ.js} +10 -12
- package/dist/{chunk-PR6PO3ES.js → chunk-V67D6TMU.js} +22 -20
- package/dist/{chunk-VSFLRN5Y.js → chunk-VCRVNLE7.js} +135 -2
- package/dist/{chunk-CPSR3AVL.js → chunk-VO4JFPTV.js} +2 -2
- package/dist/{chunk-XT2HTCJ5.js → chunk-VWLSU3XV.js} +6 -5
- package/dist/{chunk-WME2OQST.js → chunk-W5E72HJA.js} +66 -24
- package/dist/{chunk-LLS45EWB.js → chunk-W7TY6HYX.js} +6 -8
- package/dist/{chunk-CCV2EU7T.js → chunk-WSSLVMDA.js} +12 -13
- package/dist/{chunk-YISME6ON.js → chunk-WTB4GKMH.js} +10 -1
- package/dist/{chunk-KPPJTH44.js → chunk-X5BJ3G2P.js} +64 -35
- package/dist/{chunk-JMEKXFOL.js → chunk-XKFO2SZV.js} +39 -34
- package/dist/{chunk-HR3OJ3TH.js → chunk-XLAI7UYY.js} +84 -31
- package/dist/{chunk-H7OR7DFZ.js → chunk-XO756WE5.js} +53 -37
- package/dist/{chunk-F5Z6URKM.js → chunk-XVB3Q2PG.js} +2 -4
- package/dist/{chunk-R5MOQM2H.js → chunk-YOXCCJDF.js} +607 -366
- package/dist/{chunk-ZGSJDWQU.js → chunk-ZCQBNPRH.js} +2 -2
- package/dist/chunk-ZD4KVFXI.js +234 -0
- package/dist/{chunk-WGRJOXED.js → chunk-ZDMFGACN.js} +1295 -966
- package/dist/{chunk-OSTKYB55.js → chunk-ZMMHHXSW.js} +1 -1
- package/dist/{chunk-75GAYVNO.js → chunk-ZPM7ZIFL.js} +6 -6
- package/dist/{chunk-LUBPZN36.js → chunk-ZVCDHYWZ.js} +9 -11
- package/dist/{chunk-Y7F7IEE3.js → chunk-ZZN74OGD.js} +102 -7
- package/dist/{chunk-L5JYIU47.js → chunk-ZZSJAR76.js} +39 -20
- package/dist/index.js +10933 -8644
- package/dist/mcp/analyze-cli.js +12 -17
- package/dist/mcp/cli.js +43 -42
- package/dist/mcp/server.js +3073 -1147
- package/dist/mcp/worker.js +61 -61
- package/dist/probes/installer.js +18 -19
- package/docs/adr/0003-git-guard-latch-writer.md +11 -6
- package/docs/agent-tools.md +58 -16
- package/docs/alignment-families.md +29 -0
- package/docs/analysisall.md +1 -1
- package/docs/ast-grep_rules_catalog.md +6 -4
- package/docs/ci-bot-pr-checks.md +128 -0
- package/docs/configuration.md +150 -12
- package/docs/defect-shapes.md +107 -15
- package/docs/engineering-principles.md +27 -2
- package/docs/environment-variables.md +18 -1
- package/docs/features.md +14 -7
- package/docs/globalconfig.md +11 -3
- package/docs/invariants/git-guard-host.md +7 -3
- package/docs/invariants/language-config.md +15 -4
- package/docs/invariants/lsp-trust-exec.md +25 -4
- package/docs/invariants/paths-os.md +4 -2
- package/docs/invariants/session-telemetry.md +2 -2
- package/docs/language-coverage.md +1 -0
- package/docs/lsp-capability-matrix.md +167 -65
- package/docs/lsp-idle-eviction.md +4 -1
- package/docs/merge-queue-rollout.md +10 -8
- package/docs/module-report-read-symbol.md +34 -23
- package/docs/pi-lens-fixer.md +34 -17
- package/docs/pi-lens-investigator.md +3 -0
- package/docs/pi-lens-merge-policy.md +34 -17
- package/docs/pi-lens-monitor.md +9 -0
- package/docs/pi-lens-orchestration.md +4 -1
- package/docs/pi-lens-reviewer.md +6 -6
- package/docs/pi-lens-subagent.md +19 -3
- package/docs/public-api-stability.md +57 -7
- package/docs/release-qa-baseline.md +7 -4
- package/docs/schema/pi-lens-config-v1.json +21 -2
- package/docs/servercapabilities.md +3 -1
- package/docs/settings.md +11 -7
- package/docs/word-index.md +20 -7
- package/package.json +11 -4
- package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
- package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
- package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
- package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
- package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
- package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
- package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
- package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
- package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
- package/scripts/download-grammars.js +3 -2
- package/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
- package/dist/chunk-46TNM7XZ.js +0 -88
- package/dist/chunk-72OKUXSD.js +0 -31
- package/dist/chunk-7GLOLOSH.js +0 -57
- package/dist/chunk-AKUUMGD5.js +0 -26
- package/dist/chunk-ASUXV767.js +0 -22
- package/dist/chunk-CTADOKYM.js +0 -25
- package/dist/chunk-GNSIWBAT.js +0 -106
- package/dist/chunk-HWDAVBFU.js +0 -49
- package/dist/chunk-JJ2RRESP.js +0 -58
- package/dist/chunk-KXF5R4UN.js +0 -48
- package/dist/chunk-LSC3VADM.js +0 -23
- package/dist/chunk-OE5ZBP7F.js +0 -443
- package/dist/chunk-SHLDT3OI.js +0 -27
- package/dist/chunk-UF7RTZSO.js +0 -27
- package/dist/chunk-W4WP2ERB.js +0 -30
- package/dist/chunk-YES5CACN.js +0 -73
- package/dist/chunk-Z2XAOKHK.js +0 -136
|
@@ -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,40 +108,39 @@ 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,
|
|
115
|
+
PROJECT_CONFIG_LOCATIONS,
|
|
110
116
|
dirMtimeIsRacy,
|
|
111
117
|
dirMtimeRecordsAsync,
|
|
112
118
|
dirMtimesStillFreshAsync,
|
|
119
|
+
getDirectoryMarkers,
|
|
113
120
|
getPiLensGlobalConfigPath,
|
|
114
121
|
unknownDirMtimeRecords
|
|
115
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-NL5LSKVD.js";
|
|
116
123
|
import {
|
|
117
124
|
getProjectTrustGeneration,
|
|
118
125
|
getProjectTrustState
|
|
119
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-PIIUNJIT.js";
|
|
120
127
|
import {
|
|
121
128
|
getDegradationLedgerGeneration,
|
|
122
129
|
incrementDegradationCount,
|
|
130
|
+
logExtension,
|
|
123
131
|
recordDegradationOnce
|
|
124
|
-
} from "./chunk-
|
|
125
|
-
import {
|
|
126
|
-
logExtension
|
|
127
|
-
} from "./chunk-KXF5R4UN.js";
|
|
132
|
+
} from "./chunk-W5E72HJA.js";
|
|
128
133
|
import {
|
|
129
134
|
claimPhaseOncePerSession,
|
|
130
135
|
currentSessionRecordId,
|
|
131
|
-
logLatency,
|
|
132
|
-
releasePhaseClaim
|
|
133
|
-
} from "./chunk-Z2XAOKHK.js";
|
|
134
|
-
import {
|
|
135
136
|
getGlobalPiLensLogDir,
|
|
136
137
|
getProcessSingleton,
|
|
138
|
+
isLspInstallDisabled,
|
|
137
139
|
isTestMode,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
logLatency,
|
|
141
|
+
redactSecrets,
|
|
142
|
+
releasePhaseClaim
|
|
143
|
+
} from "./chunk-VCRVNLE7.js";
|
|
140
144
|
import {
|
|
141
145
|
STAGE_TMP_PATTERN
|
|
142
146
|
} from "./chunk-LJDODBBZ.js";
|
|
@@ -146,19 +150,23 @@ import {
|
|
|
146
150
|
CARGO_WORKSPACE_MEMBER_DIALECT,
|
|
147
151
|
direntsHaveMarkerGlobMatch,
|
|
148
152
|
findLocalToolConfig,
|
|
153
|
+
isAbsoluteFilePath,
|
|
149
154
|
isAtOrAboveHomeDir,
|
|
150
155
|
isFullyQualified,
|
|
151
156
|
isUnderDir,
|
|
152
157
|
isVendorPath,
|
|
153
158
|
isWindowsPath,
|
|
159
|
+
isWithinForm,
|
|
154
160
|
matchesWorkspaceMemberPattern,
|
|
155
161
|
normalizeEphemeralMapKey,
|
|
156
162
|
normalizeFilePath,
|
|
157
163
|
normalizeMapKey,
|
|
158
164
|
pathsEqual,
|
|
159
165
|
realpathOrResolve,
|
|
160
|
-
toPosix
|
|
161
|
-
|
|
166
|
+
toPosix,
|
|
167
|
+
toProjectRelativePath,
|
|
168
|
+
walkUpDirs
|
|
169
|
+
} from "./chunk-CB7PEVOJ.js";
|
|
162
170
|
|
|
163
171
|
// dist/clients/analysis-root.js
|
|
164
172
|
import * as fs from "node:fs";
|
|
@@ -187,14 +195,11 @@ function hasProjectMarker(dir) {
|
|
|
187
195
|
});
|
|
188
196
|
}
|
|
189
197
|
function nearestProjectRoot(filePath) {
|
|
190
|
-
|
|
191
|
-
const filesystemRoot = nodePath.parse(dir).root;
|
|
192
|
-
while (dir !== filesystemRoot) {
|
|
198
|
+
for (const dir of walkUpDirs(nodePath.dirname(filePath))) {
|
|
193
199
|
if (hasProjectMarker(dir))
|
|
194
200
|
return dir;
|
|
195
|
-
dir = nodePath.dirname(dir);
|
|
196
201
|
}
|
|
197
|
-
return
|
|
202
|
+
return void 0;
|
|
198
203
|
}
|
|
199
204
|
function resolveAnalysisRootPath(filePath, sessionRoot, homeDirOverride) {
|
|
200
205
|
const resolved = realpathOrResolve(filePath);
|
|
@@ -244,6 +249,39 @@ function resolveAnalysisRoot(filePath, sessionRoot, homeDirOverride) {
|
|
|
244
249
|
function canWriteAnalysisRoot(mode) {
|
|
245
250
|
return mode === "session" || mode === "linked-worktree";
|
|
246
251
|
}
|
|
252
|
+
function resolveSessionConfigRoot(filePath, sessionRoot, homeDirOverride) {
|
|
253
|
+
const { mode, root } = classifyAnalysisRoot(filePath, sessionRoot, homeDirOverride);
|
|
254
|
+
if (root === void 0 || mode === "adopted" || mode === "none")
|
|
255
|
+
return { register: void 0, mode };
|
|
256
|
+
return {
|
|
257
|
+
register: configRootOnFileSpelling(filePath, root) ?? root,
|
|
258
|
+
mode
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function configRootOnFileSpelling(filePath, root) {
|
|
262
|
+
let entry;
|
|
263
|
+
for (const dir of walkUpDirs(nodePath.dirname(nodePath.resolve(filePath)), {
|
|
264
|
+
spelling: true
|
|
265
|
+
})) {
|
|
266
|
+
if (!isUnderDir(dir, root))
|
|
267
|
+
return entry;
|
|
268
|
+
if (holdsProjectConfig(dir))
|
|
269
|
+
return dir;
|
|
270
|
+
entry = dir;
|
|
271
|
+
}
|
|
272
|
+
return entry;
|
|
273
|
+
}
|
|
274
|
+
function holdsProjectConfig(dir) {
|
|
275
|
+
return PROJECT_CONFIG_LOCATIONS.some((location) => {
|
|
276
|
+
let at = dir;
|
|
277
|
+
for (const segment of location.relativePath.split("/")) {
|
|
278
|
+
if (!getDirectoryMarkers(at).entryNames.has(segment))
|
|
279
|
+
return false;
|
|
280
|
+
at = nodePath.join(at, segment);
|
|
281
|
+
}
|
|
282
|
+
return true;
|
|
283
|
+
});
|
|
284
|
+
}
|
|
247
285
|
|
|
248
286
|
// dist/clients/lsp/file-server-match.js
|
|
249
287
|
import path from "node:path";
|
|
@@ -276,29 +314,91 @@ function registeredServers(config, catalog) {
|
|
|
276
314
|
// dist/clients/lsp/server.js
|
|
277
315
|
import { existsSync as existsSync3, mkdirSync as mkdirSync2, statSync as statSync4 } from "node:fs";
|
|
278
316
|
import { access, readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
279
|
-
import
|
|
280
|
-
import
|
|
317
|
+
import os6 from "node:os";
|
|
318
|
+
import path8 from "node:path";
|
|
281
319
|
|
|
282
|
-
// dist/clients/
|
|
283
|
-
import { createHash } from "node:crypto";
|
|
320
|
+
// dist/clients/shell-dialect.js
|
|
284
321
|
import * as fs2 from "node:fs";
|
|
285
|
-
import * as os2 from "node:os";
|
|
286
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";
|
|
287
387
|
var SGCONFIG_NAMES = ["sgconfig.yml", "sgconfig.yaml"];
|
|
288
388
|
function findLocalSgconfig(startDir) {
|
|
289
389
|
return findLocalToolConfig(startDir, SGCONFIG_NAMES);
|
|
290
390
|
}
|
|
291
391
|
function getAstGrepRuleSources(projectRoot = process.cwd()) {
|
|
292
|
-
const root =
|
|
392
|
+
const root = path3.resolve(projectRoot || process.cwd());
|
|
293
393
|
const packageRoot = resolvePackagePath(import.meta.url);
|
|
294
394
|
const candidates = [];
|
|
295
395
|
if (realpathOrResolve(root) !== realpathOrResolve(packageRoot)) {
|
|
296
396
|
candidates.push({
|
|
297
|
-
dir:
|
|
397
|
+
dir: path3.join(root, "rules", "ast-grep-rules", "rules"),
|
|
298
398
|
origin: "project",
|
|
299
399
|
tier: "primary"
|
|
300
400
|
}, {
|
|
301
|
-
dir:
|
|
401
|
+
dir: path3.join(root, "rules", "ast-grep-rules", "coderabbit", "rules"),
|
|
302
402
|
origin: "project",
|
|
303
403
|
tier: "secondary"
|
|
304
404
|
});
|
|
@@ -306,27 +406,27 @@ function getAstGrepRuleSources(projectRoot = process.cwd()) {
|
|
|
306
406
|
const userRoot = getUserRuleRoot();
|
|
307
407
|
if (realpathOrResolve(userRoot) !== realpathOrResolve(root)) {
|
|
308
408
|
candidates.push({
|
|
309
|
-
dir:
|
|
409
|
+
dir: path3.join(userRoot, "ast-grep-rules", "rules"),
|
|
310
410
|
origin: "user",
|
|
311
411
|
tier: "primary"
|
|
312
412
|
}, {
|
|
313
|
-
dir:
|
|
413
|
+
dir: path3.join(userRoot, "ast-grep-rules", "coderabbit", "rules"),
|
|
314
414
|
origin: "user",
|
|
315
415
|
tier: "secondary"
|
|
316
416
|
});
|
|
317
417
|
}
|
|
318
418
|
candidates.push({
|
|
319
|
-
dir:
|
|
419
|
+
dir: path3.join(packageRoot, "rules", "ast-grep-rules", "rules"),
|
|
320
420
|
origin: "bundled",
|
|
321
421
|
tier: "primary"
|
|
322
422
|
}, {
|
|
323
|
-
dir:
|
|
423
|
+
dir: path3.join(packageRoot, "rules", "ast-grep-rules", "coderabbit", "rules"),
|
|
324
424
|
origin: "bundled",
|
|
325
425
|
tier: "secondary"
|
|
326
426
|
});
|
|
327
427
|
const seen = /* @__PURE__ */ new Set();
|
|
328
428
|
return candidates.filter((source) => {
|
|
329
|
-
if (!
|
|
429
|
+
if (!fs3.existsSync(source.dir))
|
|
330
430
|
return false;
|
|
331
431
|
const key = realpathOrResolve(source.dir);
|
|
332
432
|
if (seen.has(key))
|
|
@@ -339,12 +439,12 @@ function findYamlFiles(dir) {
|
|
|
339
439
|
const files = [];
|
|
340
440
|
let entries;
|
|
341
441
|
try {
|
|
342
|
-
entries =
|
|
442
|
+
entries = fs3.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
343
443
|
} catch {
|
|
344
444
|
return files;
|
|
345
445
|
}
|
|
346
446
|
for (const entry of entries) {
|
|
347
|
-
const full =
|
|
447
|
+
const full = path3.join(dir, entry.name);
|
|
348
448
|
if (entry.isDirectory()) {
|
|
349
449
|
files.push(...findYamlFiles(full));
|
|
350
450
|
} else if (entry.isFile() && /\.ya?ml$/i.test(entry.name)) {
|
|
@@ -386,12 +486,12 @@ function snapshotRuleSource(source) {
|
|
|
386
486
|
const hash = createHash("sha256");
|
|
387
487
|
const files = [];
|
|
388
488
|
for (const file of findYamlFiles(source.dir)) {
|
|
389
|
-
const relativePath =
|
|
489
|
+
const relativePath = path3.relative(source.dir, file);
|
|
390
490
|
hash.update(relativePath);
|
|
391
491
|
hash.update("\0");
|
|
392
492
|
let content;
|
|
393
493
|
try {
|
|
394
|
-
content =
|
|
494
|
+
content = fs3.readFileSync(file, "utf8");
|
|
395
495
|
} catch {
|
|
396
496
|
hash.update("missing");
|
|
397
497
|
hash.update("\0");
|
|
@@ -429,12 +529,12 @@ function sourceFingerprint(sources) {
|
|
|
429
529
|
return hash.digest("hex");
|
|
430
530
|
}
|
|
431
531
|
function getAstGrepRuleFingerprint(projectRoot = process.cwd(), options = {}) {
|
|
432
|
-
const root =
|
|
532
|
+
const root = path3.resolve(projectRoot || process.cwd());
|
|
433
533
|
return ruleCorpusFingerprintForCycle("ast-grep", root, (fingerprintRoot) => sourceFingerprint(getAstGrepRuleSources(fingerprintRoot).map(snapshotRuleSource)), options.force);
|
|
434
534
|
}
|
|
435
535
|
function materializeMergedRuleDir(sources, mergedDir) {
|
|
436
|
-
|
|
437
|
-
|
|
536
|
+
fs3.rmSync(mergedDir, { recursive: true, force: true });
|
|
537
|
+
fs3.mkdirSync(mergedDir, { recursive: true });
|
|
438
538
|
const claimedByEarlierSource = /* @__PURE__ */ new Set();
|
|
439
539
|
for (const [sourceIndex, source] of sources.entries()) {
|
|
440
540
|
const claimedThisSource = /* @__PURE__ */ new Set();
|
|
@@ -449,11 +549,11 @@ function materializeMergedRuleDir(sources, mergedDir) {
|
|
|
449
549
|
});
|
|
450
550
|
if (survivingDocuments.length === 0)
|
|
451
551
|
continue;
|
|
452
|
-
const destination =
|
|
552
|
+
const destination = path3.join(mergedDir, `source${sourceIndex}-${String(fileIndex).padStart(5, "0")}.yml`);
|
|
453
553
|
if (survivingDocuments.length === file.documents.length) {
|
|
454
|
-
|
|
554
|
+
fs3.copyFileSync(file.file, destination);
|
|
455
555
|
} else {
|
|
456
|
-
|
|
556
|
+
fs3.writeFileSync(destination, `${survivingDocuments.map((document) => document.raw.trim()).join("\n---\n")}
|
|
457
557
|
`);
|
|
458
558
|
}
|
|
459
559
|
}
|
|
@@ -466,20 +566,20 @@ function rootArtifactKey(root) {
|
|
|
466
566
|
return createHash("sha256").update(root).digest("hex").slice(0, 12);
|
|
467
567
|
}
|
|
468
568
|
function resolveBaselineSgconfig(projectRoot = process.cwd()) {
|
|
469
|
-
const root = realpathOrResolve(
|
|
569
|
+
const root = realpathOrResolve(path3.resolve(projectRoot || process.cwd()));
|
|
470
570
|
const fingerprint = getAstGrepRuleFingerprint(root, { force: true });
|
|
471
571
|
const cached = cachedBaselines.get(root);
|
|
472
|
-
if (cached?.fingerprint === fingerprint &&
|
|
572
|
+
if (cached?.fingerprint === fingerprint && fs3.existsSync(cached.path) && fs3.existsSync(cached.mergedDir)) {
|
|
473
573
|
return cached.path;
|
|
474
574
|
}
|
|
475
575
|
const sources = getAstGrepRuleSources(root).map(snapshotRuleSource);
|
|
476
576
|
if (sources.length === 0)
|
|
477
577
|
return void 0;
|
|
478
|
-
const dir =
|
|
479
|
-
|
|
578
|
+
const dir = path3.join(scannerReportParentDir(), "pi-lens-ast-grep");
|
|
579
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
480
580
|
const artifactKey = rootArtifactKey(root);
|
|
481
|
-
const file =
|
|
482
|
-
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`);
|
|
483
583
|
const protectedArtifacts = /* @__PURE__ */ new Set([file, mergedDir]);
|
|
484
584
|
for (const baseline of cachedBaselines.values()) {
|
|
485
585
|
protectedArtifacts.add(baseline.path);
|
|
@@ -487,8 +587,8 @@ function resolveBaselineSgconfig(projectRoot = process.cwd()) {
|
|
|
487
587
|
}
|
|
488
588
|
cleanupStaleBaselines(dir, protectedArtifacts);
|
|
489
589
|
materializeMergedRuleDir(sources, mergedDir);
|
|
490
|
-
const ruleDirForYaml = mergedDir.split(
|
|
491
|
-
|
|
590
|
+
const ruleDirForYaml = mergedDir.split(path3.sep).join("/");
|
|
591
|
+
fs3.writeFileSync(file, `ruleDirs:
|
|
492
592
|
- ${JSON.stringify(ruleDirForYaml)}
|
|
493
593
|
`);
|
|
494
594
|
cachedBaselines.set(root, { fingerprint, path: file, mergedDir });
|
|
@@ -499,7 +599,7 @@ var SG_BASELINE_RETAINED_ENTRIES = 24;
|
|
|
499
599
|
function enforceBaselineEntryCap(dir, keep) {
|
|
500
600
|
let names;
|
|
501
601
|
try {
|
|
502
|
-
names =
|
|
602
|
+
names = fs3.readdirSync(dir);
|
|
503
603
|
} catch {
|
|
504
604
|
return;
|
|
505
605
|
}
|
|
@@ -509,13 +609,13 @@ function enforceBaselineEntryCap(dir, keep) {
|
|
|
509
609
|
const isMergedDir = /^baseline-\d+(?:-[a-f0-9]+)?\.rules$/.test(name);
|
|
510
610
|
if (!isConfig && !isMergedDir)
|
|
511
611
|
continue;
|
|
512
|
-
const full =
|
|
612
|
+
const full = path3.join(dir, name);
|
|
513
613
|
if (keep.has(full))
|
|
514
614
|
continue;
|
|
515
615
|
try {
|
|
516
616
|
candidates.push({
|
|
517
617
|
full,
|
|
518
|
-
mtimeMs:
|
|
618
|
+
mtimeMs: fs3.statSync(full).mtimeMs,
|
|
519
619
|
recursive: isMergedDir
|
|
520
620
|
});
|
|
521
621
|
} catch {
|
|
@@ -528,7 +628,7 @@ function enforceBaselineEntryCap(dir, keep) {
|
|
|
528
628
|
let evicted = 0;
|
|
529
629
|
for (const candidate of candidates.slice(0, over)) {
|
|
530
630
|
try {
|
|
531
|
-
|
|
631
|
+
fs3.rmSync(candidate.full, {
|
|
532
632
|
recursive: candidate.recursive,
|
|
533
633
|
force: true
|
|
534
634
|
});
|
|
@@ -552,18 +652,18 @@ function enforceBaselineEntryCap(dir, keep) {
|
|
|
552
652
|
function cleanupStaleBaselines(dir, keep) {
|
|
553
653
|
try {
|
|
554
654
|
const cutoff = Date.now() - 7 * 24 * 60 * 60 * 1e3;
|
|
555
|
-
for (const name of
|
|
655
|
+
for (const name of fs3.readdirSync(dir)) {
|
|
556
656
|
const isConfig = /^baseline(?:-\d+(?:-[a-f0-9]+)?)?\.sgconfig\.yml$/.test(name);
|
|
557
657
|
const isMergedDir = /^baseline-\d+(?:-[a-f0-9]+)?\.rules$/.test(name);
|
|
558
658
|
if (!isConfig && !isMergedDir)
|
|
559
659
|
continue;
|
|
560
|
-
const full =
|
|
660
|
+
const full = path3.join(dir, name);
|
|
561
661
|
if (keep.has(full))
|
|
562
662
|
continue;
|
|
563
663
|
try {
|
|
564
|
-
const stat2 =
|
|
664
|
+
const stat2 = fs3.statSync(full);
|
|
565
665
|
if (stat2.mtimeMs < cutoff) {
|
|
566
|
-
|
|
666
|
+
fs3.rmSync(full, { recursive: stat2.isDirectory(), force: true });
|
|
567
667
|
}
|
|
568
668
|
} catch {
|
|
569
669
|
}
|
|
@@ -624,8 +724,8 @@ function serverTraits(declaration) {
|
|
|
624
724
|
}
|
|
625
725
|
|
|
626
726
|
// dist/clients/lsp/config.js
|
|
627
|
-
import * as
|
|
628
|
-
import
|
|
727
|
+
import * as os3 from "node:os";
|
|
728
|
+
import path5 from "node:path";
|
|
629
729
|
|
|
630
730
|
// dist/clients/dispatch/known-runner-ids.js
|
|
631
731
|
var knownRunnerIds = /* @__PURE__ */ new Set();
|
|
@@ -642,12 +742,12 @@ function isKnownRunnerId(id) {
|
|
|
642
742
|
// dist/clients/lsp/launch.js
|
|
643
743
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
644
744
|
import { spawn as nodeSpawn } from "node:child_process";
|
|
645
|
-
import
|
|
646
|
-
import
|
|
647
|
-
import
|
|
745
|
+
import fs5 from "node:fs";
|
|
746
|
+
import os2 from "node:os";
|
|
747
|
+
import path4 from "node:path";
|
|
648
748
|
|
|
649
749
|
// dist/clients/lsp/ruby-drive-dirs.js
|
|
650
|
-
import * as
|
|
750
|
+
import * as fs4 from "node:fs";
|
|
651
751
|
var RUBY_VERSION_DIR = /^ruby\d/i;
|
|
652
752
|
var rubyDirNamesCache = new BoundedLruCache(16);
|
|
653
753
|
function rubyDriveKey(driveRoot) {
|
|
@@ -663,7 +763,7 @@ function getRubyVersionDirNamesSync(driveRoot) {
|
|
|
663
763
|
return cached;
|
|
664
764
|
let names;
|
|
665
765
|
try {
|
|
666
|
-
names = filterRubyDirNames(
|
|
766
|
+
names = filterRubyDirNames(fs4.readdirSync(driveRoot));
|
|
667
767
|
} catch {
|
|
668
768
|
names = [];
|
|
669
769
|
}
|
|
@@ -677,7 +777,7 @@ async function getRubyVersionDirNamesAsync(driveRoot) {
|
|
|
677
777
|
return cached;
|
|
678
778
|
let names;
|
|
679
779
|
try {
|
|
680
|
-
names = filterRubyDirNames(await
|
|
780
|
+
names = filterRubyDirNames(await fs4.promises.readdir(driveRoot));
|
|
681
781
|
} catch {
|
|
682
782
|
names = [];
|
|
683
783
|
}
|
|
@@ -694,9 +794,9 @@ function computeNeedsShell(resolvedCommand) {
|
|
|
694
794
|
var DEFAULT_STARTUP_FAILURE_WINDOW_MS = 50;
|
|
695
795
|
var WINDOWS_NAV_STARTUP_FAILURE_WINDOW_MS = 500;
|
|
696
796
|
var SESSIONSTART_LOG_DIR = getGlobalPiLensLogDir();
|
|
697
|
-
var SESSIONSTART_LOG =
|
|
698
|
-
var PI_LENS_BIN_DIR =
|
|
699
|
-
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");
|
|
700
800
|
function logSessionStart2(msg) {
|
|
701
801
|
if (isTestMode()) {
|
|
702
802
|
return;
|
|
@@ -704,8 +804,8 @@ function logSessionStart2(msg) {
|
|
|
704
804
|
const line = redactSecrets(`[${(/* @__PURE__ */ new Date()).toISOString()}] ${msg}
|
|
705
805
|
`);
|
|
706
806
|
try {
|
|
707
|
-
|
|
708
|
-
|
|
807
|
+
fs5.mkdirSync(SESSIONSTART_LOG_DIR, { recursive: true });
|
|
808
|
+
fs5.appendFileSync(SESSIONSTART_LOG, line);
|
|
709
809
|
} catch {
|
|
710
810
|
}
|
|
711
811
|
}
|
|
@@ -725,8 +825,8 @@ function splitPathEntries(value, delimiter) {
|
|
|
725
825
|
}
|
|
726
826
|
function normalizePathEntry(entry, platform) {
|
|
727
827
|
if (platform !== "win32")
|
|
728
|
-
return
|
|
729
|
-
return
|
|
828
|
+
return path4.posix.normalize(entry);
|
|
829
|
+
return path4.win32.normalize(entry).toLowerCase();
|
|
730
830
|
}
|
|
731
831
|
function combinePathValuesForPlatform(values, platform = process.platform) {
|
|
732
832
|
const unique = [];
|
|
@@ -769,34 +869,34 @@ function getLiveWindowsPath() {
|
|
|
769
869
|
}
|
|
770
870
|
async function buildAugmentedPath(basePath) {
|
|
771
871
|
const candidates = [];
|
|
772
|
-
const nodeDir =
|
|
872
|
+
const nodeDir = path4.dirname(process.execPath);
|
|
773
873
|
if (nodeDir) {
|
|
774
874
|
candidates.push(nodeDir);
|
|
775
875
|
}
|
|
776
876
|
if (isWindows) {
|
|
777
|
-
const home =
|
|
778
|
-
const driveRoot =
|
|
779
|
-
candidates.push(
|
|
780
|
-
candidates.push(
|
|
781
|
-
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"));
|
|
782
882
|
candidates.push(PI_LENS_BIN_DIR);
|
|
783
883
|
candidates.push(PI_LENS_TOOLS_BIN_DIR);
|
|
784
|
-
candidates.push(
|
|
785
|
-
candidates.push(
|
|
884
|
+
candidates.push(path4.join(driveRoot, "Program Files", "Go", "bin"));
|
|
885
|
+
candidates.push(path4.join(driveRoot, "Go", "bin"));
|
|
786
886
|
for (const entry of await getRubyVersionDirNamesAsync(driveRoot)) {
|
|
787
|
-
candidates.push(
|
|
887
|
+
candidates.push(path4.join(driveRoot, entry, "bin"));
|
|
788
888
|
}
|
|
789
889
|
}
|
|
790
890
|
const effectiveBase = isWindows ? combinePathValuesForPlatform([basePath, getLiveWindowsPath()]) : basePath;
|
|
791
891
|
const existing = /* @__PURE__ */ new Set();
|
|
792
|
-
for (const entry of splitPathEntries(effectiveBase,
|
|
892
|
+
for (const entry of splitPathEntries(effectiveBase, path4.delimiter)) {
|
|
793
893
|
if (!entry)
|
|
794
894
|
continue;
|
|
795
895
|
existing.add(normalizePathEntry(entry, process.platform));
|
|
796
896
|
}
|
|
797
897
|
const toAppend = [];
|
|
798
898
|
for (const candidate of candidates) {
|
|
799
|
-
if (!candidate || !
|
|
899
|
+
if (!candidate || !fs5.existsSync(candidate))
|
|
800
900
|
continue;
|
|
801
901
|
const normalized = normalizePathEntry(candidate, process.platform);
|
|
802
902
|
if (existing.has(normalized))
|
|
@@ -807,18 +907,18 @@ async function buildAugmentedPath(basePath) {
|
|
|
807
907
|
if (toAppend.length === 0)
|
|
808
908
|
return basePath ?? "";
|
|
809
909
|
if (!basePath)
|
|
810
|
-
return toAppend.join(
|
|
811
|
-
return `${basePath}${
|
|
910
|
+
return toAppend.join(path4.delimiter);
|
|
911
|
+
return `${basePath}${path4.delimiter}${toAppend.join(path4.delimiter)}`;
|
|
812
912
|
}
|
|
813
913
|
function isCmdShimValid(cmdPath) {
|
|
814
914
|
try {
|
|
815
|
-
const content =
|
|
915
|
+
const content = fs5.readFileSync(cmdPath, "utf-8");
|
|
816
916
|
const match = content.match(/"%~dp0[/\\]\.\.[/\\]((?:[\w./@-]|\\)+\.(?:mjs|cjs|js))"/i);
|
|
817
917
|
if (!match)
|
|
818
918
|
return true;
|
|
819
|
-
const relPath = match[1].replace(/[/\\]/g,
|
|
820
|
-
const target =
|
|
821
|
-
return
|
|
919
|
+
const relPath = match[1].replace(/[/\\]/g, path4.sep);
|
|
920
|
+
const target = path4.resolve(path4.dirname(cmdPath), "..", relPath);
|
|
921
|
+
return fs5.existsSync(target);
|
|
822
922
|
} catch {
|
|
823
923
|
return true;
|
|
824
924
|
}
|
|
@@ -843,16 +943,16 @@ function isMissingWindowsStartupCommand(spawnCommand, presence) {
|
|
|
843
943
|
}
|
|
844
944
|
function bypassPs1OnWindows(ps1Path, args) {
|
|
845
945
|
const cmdPath = `${ps1Path.slice(0, -4)}.cmd`;
|
|
846
|
-
if (
|
|
946
|
+
if (fs5.existsSync(cmdPath)) {
|
|
847
947
|
return { command: cmdPath, args, needsShell: true };
|
|
848
948
|
}
|
|
849
949
|
try {
|
|
850
|
-
const content =
|
|
950
|
+
const content = fs5.readFileSync(ps1Path, "utf-8");
|
|
851
951
|
const match = content.match(/"\$basedir[/\\]\.\.[/\\]((?:[\w./@-]|\\)+\.(?:mjs|cjs|js))"/i);
|
|
852
952
|
if (match) {
|
|
853
|
-
const relPath = match[1].replace(/[/\\]/g,
|
|
854
|
-
const jsPath =
|
|
855
|
-
if (
|
|
953
|
+
const relPath = match[1].replace(/[/\\]/g, path4.sep);
|
|
954
|
+
const jsPath = path4.resolve(path4.dirname(ps1Path), "..", relPath);
|
|
955
|
+
if (fs5.existsSync(jsPath)) {
|
|
856
956
|
return {
|
|
857
957
|
command: process.execPath,
|
|
858
958
|
args: [jsPath, ...args],
|
|
@@ -877,7 +977,7 @@ function withLspProjectCodePermission(allowed, spawn) {
|
|
|
877
977
|
var unknownProjectLocalNoticeGeneration = -1;
|
|
878
978
|
function recordUntrustedLspExecution(request, trust) {
|
|
879
979
|
const generation = getDegradationLedgerGeneration();
|
|
880
|
-
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)}`;
|
|
881
981
|
const metadata = request.kind === "project-code-server" ? {
|
|
882
982
|
field: request.kind,
|
|
883
983
|
serverId: request.serverId,
|
|
@@ -1058,9 +1158,9 @@ async function launchLSP(command, args = [], options = {}) {
|
|
|
1058
1158
|
delete env[OWNER_TAG_ENV];
|
|
1059
1159
|
else
|
|
1060
1160
|
env[OWNER_TAG_ENV] = ownerTag;
|
|
1061
|
-
const isBareCommand = !isFullyQualified(command) && !command.includes(
|
|
1062
|
-
const isRelativePath = !isFullyQualified(command) && (command.includes(
|
|
1063
|
-
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;
|
|
1064
1164
|
const scannedCommandPath = isBareCommand ? findBinaryOnPath(command, env, cwd) : void 0;
|
|
1065
1165
|
const resolvedCommand = scannedCommandPath ?? explicitCommand;
|
|
1066
1166
|
let needsShell = computeNeedsShell(resolvedCommand);
|
|
@@ -1216,7 +1316,7 @@ function asRecord(value) {
|
|
|
1216
1316
|
}
|
|
1217
1317
|
var CONFIG_RESOLVED_PHASE = "config_resolved";
|
|
1218
1318
|
function configResolutionKey(cwd) {
|
|
1219
|
-
return normalizeFilePath(
|
|
1319
|
+
return normalizeFilePath(path5.resolve(normalizeFilePath(cwd)));
|
|
1220
1320
|
}
|
|
1221
1321
|
function publishConfigResolutionPending(cwd) {
|
|
1222
1322
|
logSessionStart(`session_start config_resolution_pending session=${currentSessionRecordId()} root=${configResolutionKey(cwd)}`);
|
|
@@ -1246,7 +1346,7 @@ function recordConfigResolved(cwd, resolution, lspConfig, homeDir, resolveMs) {
|
|
|
1246
1346
|
});
|
|
1247
1347
|
logSessionStart(`config resolved documents=${summary.documents.length} legacy=${legacyDocuments} records=${summary.recordCount} deniedServers=${deniedServers} resolveMs=${resolveMs} session=${sessionId} root=${root}`);
|
|
1248
1348
|
}
|
|
1249
|
-
async function loadLSPConfig(cwd, homeDir =
|
|
1349
|
+
async function loadLSPConfig(cwd, homeDir = os3.homedir(), options = {}) {
|
|
1250
1350
|
const reporting = options.report !== false;
|
|
1251
1351
|
publishConfigResolutionPending(cwd);
|
|
1252
1352
|
const resolveStartedAt = Date.now();
|
|
@@ -1270,8 +1370,8 @@ async function loadLSPConfig(cwd, homeDir = os4.homedir(), options = {}) {
|
|
|
1270
1370
|
// contents are pi-lens settings. An LSP-scoped file still reports here.
|
|
1271
1371
|
...reporting ? { onReadError: reportConfigReadFailure } : {}
|
|
1272
1372
|
});
|
|
1273
|
-
const
|
|
1274
|
-
const config = lspConfigOf(resolution.value,
|
|
1373
|
+
const configProblems = newLspConfigProblems();
|
|
1374
|
+
const config = lspConfigOf(resolution.value, configProblems);
|
|
1275
1375
|
Object.defineProperty(config, "__provenance", {
|
|
1276
1376
|
value: resolution.provenance,
|
|
1277
1377
|
enumerable: false
|
|
@@ -1279,15 +1379,16 @@ async function loadLSPConfig(cwd, homeDir = os4.homedir(), options = {}) {
|
|
|
1279
1379
|
if (reporting) {
|
|
1280
1380
|
reportPiLensConfigRecords([
|
|
1281
1381
|
...resolution.records,
|
|
1282
|
-
...coversClaimRecords(resolution,
|
|
1382
|
+
...coversClaimRecords(resolution, configProblems),
|
|
1383
|
+
...disabledServerRecords(resolution, configProblems)
|
|
1283
1384
|
]);
|
|
1284
1385
|
}
|
|
1285
|
-
recordCoversUnvalidated(resolution,
|
|
1386
|
+
recordCoversUnvalidated(resolution, configProblems);
|
|
1286
1387
|
recordConfigResolved(cwd, resolution, config, homeDir, Date.now() - resolveStartedAt);
|
|
1287
1388
|
return config;
|
|
1288
1389
|
}
|
|
1289
|
-
function
|
|
1290
|
-
return { refusals: [], unvalidated: [] };
|
|
1390
|
+
function newLspConfigProblems() {
|
|
1391
|
+
return { refusals: [], unvalidated: [], unknownDisabled: [] };
|
|
1291
1392
|
}
|
|
1292
1393
|
function coversPointer(serverId) {
|
|
1293
1394
|
return `/${LSP_NAMESPACE_KEY}/servers/${serverId}/covers`;
|
|
@@ -1322,6 +1423,21 @@ function coversClaimRecords(resolution, problems) {
|
|
|
1322
1423
|
};
|
|
1323
1424
|
});
|
|
1324
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
|
+
}
|
|
1325
1441
|
function keptTail(keptCount) {
|
|
1326
1442
|
return keptCount > 0 ? "registers with the remaining covers claim" : "registers with no covers claim";
|
|
1327
1443
|
}
|
|
@@ -1373,6 +1489,21 @@ function customServerSpecsOf(value) {
|
|
|
1373
1489
|
const servers = asRecord(lspSectionOf(value).servers);
|
|
1374
1490
|
return servers ? coversValidatedServers(servers) : {};
|
|
1375
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
|
+
}
|
|
1376
1507
|
function lspConfigOf(value, problems, provenance) {
|
|
1377
1508
|
const section = lspSectionOf(value);
|
|
1378
1509
|
const config = {};
|
|
@@ -1384,7 +1515,7 @@ function lspConfigOf(value, problems, provenance) {
|
|
|
1384
1515
|
config.serverOverrides = serverOverrides;
|
|
1385
1516
|
}
|
|
1386
1517
|
if (Array.isArray(section.disabledServers)) {
|
|
1387
|
-
config.disabledServers = section.disabledServers;
|
|
1518
|
+
config.disabledServers = knownDisabledServerIds(section.disabledServers, servers, problems);
|
|
1388
1519
|
}
|
|
1389
1520
|
if (Array.isArray(section.warmFiles)) {
|
|
1390
1521
|
config.warmFiles = section.warmFiles;
|
|
@@ -1397,7 +1528,21 @@ function lspConfigOf(value, problems, provenance) {
|
|
|
1397
1528
|
}
|
|
1398
1529
|
return config;
|
|
1399
1530
|
}
|
|
1531
|
+
function customServerLaunch(config, id) {
|
|
1532
|
+
const { command } = config;
|
|
1533
|
+
if (typeof command === "string" && command !== "") {
|
|
1534
|
+
return { program: command, argv: config.args ?? ["--stdio"] };
|
|
1535
|
+
}
|
|
1536
|
+
if (Array.isArray(command) && typeof command[0] === "string" && command[0] !== "" && command.every((part) => typeof part === "string")) {
|
|
1537
|
+
return {
|
|
1538
|
+
program: command[0],
|
|
1539
|
+
argv: [...command.slice(1), ...config.args ?? []]
|
|
1540
|
+
};
|
|
1541
|
+
}
|
|
1542
|
+
throw new Error(`lsp.servers.${id}.command must be a non-empty string or a non-empty array of strings`);
|
|
1543
|
+
}
|
|
1400
1544
|
function createCustomServer(config, id) {
|
|
1545
|
+
const commandToken = typeof config.command === "string" ? config.command : Array.isArray(config.command) ? config.command[0] : void 0;
|
|
1401
1546
|
return {
|
|
1402
1547
|
id,
|
|
1403
1548
|
name: config.name,
|
|
@@ -1405,7 +1550,7 @@ function createCustomServer(config, id) {
|
|
|
1405
1550
|
// The own-command token the runner-coverage seam gates this row's
|
|
1406
1551
|
// covers claim on (#3968 F2): the declared covering lane's binary must
|
|
1407
1552
|
// be probeable before the claim can defer a CLI runner.
|
|
1408
|
-
command:
|
|
1553
|
+
...commandToken === void 0 ? {} : { command: commandToken },
|
|
1409
1554
|
extensions: config.extensions,
|
|
1410
1555
|
// A config-declared server is a language server. The public
|
|
1411
1556
|
// `lsp.servers.<id>.role` field is validated and projected by
|
|
@@ -1426,7 +1571,8 @@ function createCustomServer(config, id) {
|
|
|
1426
1571
|
...config.rootMarkers ? { rootMarkers: config.rootMarkers } : {}
|
|
1427
1572
|
}).cwd : async (file) => resolveToolCwd("lsp", id, file, { cwd: process.cwd() }).cwd,
|
|
1428
1573
|
async spawn(root) {
|
|
1429
|
-
const
|
|
1574
|
+
const { program, argv } = customServerLaunch(config, id);
|
|
1575
|
+
const proc = await launchLSP(program, argv, {
|
|
1430
1576
|
cwd: root,
|
|
1431
1577
|
env: config.env ? { ...process.env, ...config.env } : process.env
|
|
1432
1578
|
});
|
|
@@ -1447,7 +1593,7 @@ var EMPTY_CONFIG = {
|
|
|
1447
1593
|
};
|
|
1448
1594
|
var configInFlight = /* @__PURE__ */ new Map();
|
|
1449
1595
|
function normalizeWorkspacePath(cwd) {
|
|
1450
|
-
return
|
|
1596
|
+
return path5.resolve(cwd);
|
|
1451
1597
|
}
|
|
1452
1598
|
var unknownTrustNoticeGeneration = -1;
|
|
1453
1599
|
var serversForFileOverride;
|
|
@@ -1468,11 +1614,12 @@ function sourceFor(provenance, key) {
|
|
|
1468
1614
|
function executableAllowed(provenance, trust) {
|
|
1469
1615
|
return !provenance || !isRepoTier(provenance.tier) || trust === "trusted";
|
|
1470
1616
|
}
|
|
1471
|
-
function registryDecision(id, field, provenance, trust, allowed) {
|
|
1617
|
+
function registryDecision(id, section, field, provenance, trust, allowed) {
|
|
1472
1618
|
if (allowed || !provenance || !isRepoTier(provenance.tier))
|
|
1473
1619
|
return;
|
|
1474
1620
|
const subject = `${id}:${field}:${provenance.tier}`;
|
|
1475
|
-
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}`;
|
|
1476
1623
|
recordDegradationOnce({
|
|
1477
1624
|
kind: "lsp-registry-decision",
|
|
1478
1625
|
subject,
|
|
@@ -1492,6 +1639,70 @@ function registryDecision(id, field, provenance, trust, allowed) {
|
|
|
1492
1639
|
}
|
|
1493
1640
|
}
|
|
1494
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
|
+
}
|
|
1495
1706
|
function getConfigForFile(filePath) {
|
|
1496
1707
|
return sessionRootConfigForFile(filePath) ?? EMPTY_CONFIG;
|
|
1497
1708
|
}
|
|
@@ -1595,6 +1806,10 @@ var OVERRIDE_COPY_TRAITS = {
|
|
|
1595
1806
|
keep: false,
|
|
1596
1807
|
why: "Reset: marks config-supplied rows; catalog rows never declare it."
|
|
1597
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
|
+
},
|
|
1598
1813
|
command: {
|
|
1599
1814
|
keep: false,
|
|
1600
1815
|
why: "Reset: the custom-row command token; the override's command lives in its spawn."
|
|
@@ -1627,49 +1842,41 @@ function compileLspRegistry(config, provenance = /* @__PURE__ */ new Map()) {
|
|
|
1627
1842
|
const disabledServerIds = new Set(config.disabledServers ?? []);
|
|
1628
1843
|
if (config.servers) {
|
|
1629
1844
|
for (const [id, serverConfig] of Object.entries(config.servers)) {
|
|
1630
|
-
const
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
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))
|
|
1634
1849
|
continue;
|
|
1635
|
-
const envSource = sourceFor(provenance, `/lsp/servers/${id}/env`);
|
|
1636
|
-
const initSource = sourceFor(provenance, `/lsp/servers/${id}/initializationOptions`);
|
|
1637
|
-
const envAllowed = executableAllowed(envSource, trust);
|
|
1638
|
-
const initAllowed = executableAllowed(initSource, trust);
|
|
1639
|
-
registryDecision(id, "env", envSource, trust, envAllowed);
|
|
1640
|
-
registryDecision(id, "initializationOptions", initSource, trust, initAllowed);
|
|
1641
|
-
const admitted = { ...serverConfig };
|
|
1642
|
-
if (!envAllowed)
|
|
1643
|
-
delete admitted.env;
|
|
1644
|
-
if (!initAllowed)
|
|
1645
|
-
delete admitted.initializationOptions;
|
|
1646
1850
|
try {
|
|
1647
|
-
const server = createCustomServer(
|
|
1851
|
+
const server = createCustomServer({ ...serverConfig }, id);
|
|
1648
1852
|
customServers.push({ ...server, trustAllowed: true });
|
|
1649
1853
|
} catch {
|
|
1650
1854
|
}
|
|
1651
1855
|
}
|
|
1652
1856
|
}
|
|
1653
1857
|
const serverOverrides = /* @__PURE__ */ new Map();
|
|
1858
|
+
let globalOverrides;
|
|
1654
1859
|
if (config.serverOverrides) {
|
|
1655
|
-
for (const [id,
|
|
1656
|
-
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;
|
|
1657
1873
|
const initOpts = entry.initializationOptions;
|
|
1658
1874
|
const command = entry.command;
|
|
1659
|
-
const commandSource = sourceFor(provenance, `/lsp/serverOverrides/${id}/command`);
|
|
1660
|
-
const envSource = sourceFor(provenance, `/lsp/serverOverrides/${id}/env`);
|
|
1661
|
-
const initSource = sourceFor(provenance, `/lsp/serverOverrides/${id}/initializationOptions`);
|
|
1662
|
-
const commandAllowed = executableAllowed(commandSource, trust);
|
|
1663
|
-
const envAllowed = executableAllowed(envSource, trust);
|
|
1664
|
-
const overrideInitAllowed = executableAllowed(initSource, trust);
|
|
1665
|
-
registryDecision(id, "command override", commandSource, trust, commandAllowed);
|
|
1666
|
-
registryDecision(id, "env override", envSource, trust, envAllowed);
|
|
1667
|
-
registryDecision(id, "initializationOptions", initSource, trust, overrideInitAllowed);
|
|
1668
1875
|
if (command !== void 0 || entry.env !== void 0 || initOpts !== void 0 && typeof initOpts === "object" && initOpts !== null && !Array.isArray(initOpts)) {
|
|
1669
1876
|
serverOverrides.set(id, {
|
|
1670
|
-
...
|
|
1671
|
-
...
|
|
1672
|
-
...
|
|
1877
|
+
...initOpts !== void 0 ? { initializationOptions: initOpts } : {},
|
|
1878
|
+
...command !== void 0 ? { command } : {},
|
|
1879
|
+
...entry.env ? { env: entry.env } : {}
|
|
1673
1880
|
});
|
|
1674
1881
|
}
|
|
1675
1882
|
}
|
|
@@ -1716,7 +1923,7 @@ async function initLSPConfig(cwd) {
|
|
|
1716
1923
|
if (existing)
|
|
1717
1924
|
return existing;
|
|
1718
1925
|
const promise = (async () => {
|
|
1719
|
-
const config = registerLSPConfig(await loadLSPConfig(cwd,
|
|
1926
|
+
const config = registerLSPConfig(await loadLSPConfig(cwd, os3.homedir()));
|
|
1720
1927
|
forgetConfigResolvedClaims(setSessionRootConfig(normalizedCwd, config));
|
|
1721
1928
|
})();
|
|
1722
1929
|
configInFlight.set(normalizedCwd, promise);
|
|
@@ -2306,32 +2513,32 @@ function classifyCascadeWaitTier(lspService, filePath, snapshots) {
|
|
|
2306
2513
|
}
|
|
2307
2514
|
|
|
2308
2515
|
// dist/clients/lsp/lombok.js
|
|
2309
|
-
import * as
|
|
2310
|
-
import * as
|
|
2311
|
-
import * as
|
|
2516
|
+
import * as fs6 from "node:fs";
|
|
2517
|
+
import * as os4 from "node:os";
|
|
2518
|
+
import * as path6 from "node:path";
|
|
2312
2519
|
var LOMBOK_ENV_KEYS = ["PI_LENS_LOMBOK_JAR", "LOMBOK_JAR"];
|
|
2313
2520
|
var LOMBOK_PROJECT_FILES = [
|
|
2314
2521
|
"lombok.config",
|
|
2315
2522
|
"pom.xml",
|
|
2316
2523
|
"build.gradle",
|
|
2317
2524
|
"build.gradle.kts",
|
|
2318
|
-
|
|
2525
|
+
path6.join("gradle", "libs.versions.toml")
|
|
2319
2526
|
];
|
|
2320
2527
|
function fileExists(filePath) {
|
|
2321
2528
|
if (!filePath)
|
|
2322
2529
|
return false;
|
|
2323
2530
|
try {
|
|
2324
|
-
return
|
|
2531
|
+
return fs6.statSync(filePath).isFile();
|
|
2325
2532
|
} catch {
|
|
2326
2533
|
return false;
|
|
2327
2534
|
}
|
|
2328
2535
|
}
|
|
2329
2536
|
function readTextIfSmall(filePath, maxBytes = 512 * 1024) {
|
|
2330
2537
|
try {
|
|
2331
|
-
const stat2 =
|
|
2538
|
+
const stat2 = fs6.statSync(filePath);
|
|
2332
2539
|
if (!stat2.isFile() || stat2.size > maxBytes)
|
|
2333
2540
|
return "";
|
|
2334
|
-
return
|
|
2541
|
+
return fs6.readFileSync(filePath, "utf-8");
|
|
2335
2542
|
} catch {
|
|
2336
2543
|
return "";
|
|
2337
2544
|
}
|
|
@@ -2340,13 +2547,13 @@ function containsLombokDependency(text) {
|
|
|
2340
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);
|
|
2341
2548
|
}
|
|
2342
2549
|
function hasLombokProject(root) {
|
|
2343
|
-
const lombokConfig =
|
|
2550
|
+
const lombokConfig = path6.join(root, "lombok.config");
|
|
2344
2551
|
if (fileExists(lombokConfig))
|
|
2345
2552
|
return true;
|
|
2346
2553
|
for (const name of LOMBOK_PROJECT_FILES) {
|
|
2347
2554
|
if (name === "lombok.config")
|
|
2348
2555
|
continue;
|
|
2349
|
-
const text = readTextIfSmall(
|
|
2556
|
+
const text = readTextIfSmall(path6.join(root, name));
|
|
2350
2557
|
if (text && containsLombokDependency(text))
|
|
2351
2558
|
return true;
|
|
2352
2559
|
}
|
|
@@ -2356,23 +2563,23 @@ function envJarCandidate(env) {
|
|
|
2356
2563
|
for (const key of LOMBOK_ENV_KEYS) {
|
|
2357
2564
|
const value = env[key]?.trim();
|
|
2358
2565
|
if (fileExists(value))
|
|
2359
|
-
return
|
|
2566
|
+
return path6.resolve(value);
|
|
2360
2567
|
}
|
|
2361
2568
|
return void 0;
|
|
2362
2569
|
}
|
|
2363
2570
|
function localJarCandidates(root) {
|
|
2364
2571
|
return [
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
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")
|
|
2369
2576
|
];
|
|
2370
2577
|
}
|
|
2371
2578
|
function newestExistingJar(candidates) {
|
|
2372
2579
|
let best;
|
|
2373
2580
|
for (const candidate of candidates) {
|
|
2374
2581
|
try {
|
|
2375
|
-
const stat2 =
|
|
2582
|
+
const stat2 = fs6.statSync(candidate);
|
|
2376
2583
|
if (!stat2.isFile())
|
|
2377
2584
|
continue;
|
|
2378
2585
|
if (!best || stat2.mtimeMs > best.mtimeMs) {
|
|
@@ -2383,35 +2590,35 @@ function newestExistingJar(candidates) {
|
|
|
2383
2590
|
}
|
|
2384
2591
|
return best?.filePath;
|
|
2385
2592
|
}
|
|
2386
|
-
function mavenLocalLombokJar(home =
|
|
2387
|
-
const base =
|
|
2593
|
+
function mavenLocalLombokJar(home = os4.homedir()) {
|
|
2594
|
+
const base = path6.join(home, ".m2", "repository", "org", "projectlombok", "lombok");
|
|
2388
2595
|
let versions = [];
|
|
2389
2596
|
try {
|
|
2390
|
-
versions =
|
|
2597
|
+
versions = fs6.readdirSync(base);
|
|
2391
2598
|
} catch {
|
|
2392
2599
|
return void 0;
|
|
2393
2600
|
}
|
|
2394
|
-
return newestExistingJar(versions.map((version) =>
|
|
2601
|
+
return newestExistingJar(versions.map((version) => path6.join(base, version, `lombok-${version}.jar`)));
|
|
2395
2602
|
}
|
|
2396
|
-
function gradleCacheLombokJar(home =
|
|
2397
|
-
const base =
|
|
2603
|
+
function gradleCacheLombokJar(home = os4.homedir()) {
|
|
2604
|
+
const base = path6.join(home, ".gradle", "caches", "modules-2", "files-2.1", "org.projectlombok", "lombok");
|
|
2398
2605
|
const candidates = [];
|
|
2399
2606
|
let versions = [];
|
|
2400
2607
|
try {
|
|
2401
|
-
versions =
|
|
2608
|
+
versions = fs6.readdirSync(base);
|
|
2402
2609
|
} catch {
|
|
2403
2610
|
return void 0;
|
|
2404
2611
|
}
|
|
2405
2612
|
for (const version of versions) {
|
|
2406
|
-
const versionDir =
|
|
2613
|
+
const versionDir = path6.join(base, version);
|
|
2407
2614
|
let hashes = [];
|
|
2408
2615
|
try {
|
|
2409
|
-
hashes =
|
|
2616
|
+
hashes = fs6.readdirSync(versionDir);
|
|
2410
2617
|
} catch {
|
|
2411
2618
|
continue;
|
|
2412
2619
|
}
|
|
2413
2620
|
for (const hash of hashes) {
|
|
2414
|
-
candidates.push(
|
|
2621
|
+
candidates.push(path6.join(versionDir, hash, `lombok-${version}.jar`));
|
|
2415
2622
|
}
|
|
2416
2623
|
}
|
|
2417
2624
|
return newestExistingJar(candidates);
|
|
@@ -2443,16 +2650,16 @@ function createLombokJdtlsArgs(root, baseEnv = process.env) {
|
|
|
2443
2650
|
|
|
2444
2651
|
// dist/clients/lsp/jvm-runtime.js
|
|
2445
2652
|
import { existsSync as existsSync2, readdirSync as readdirSync4 } from "node:fs";
|
|
2446
|
-
import
|
|
2447
|
-
import
|
|
2653
|
+
import os5 from "node:os";
|
|
2654
|
+
import path7 from "node:path";
|
|
2448
2655
|
var JAVA_EXE = process.platform === "win32" ? "java.exe" : "java";
|
|
2449
2656
|
var JAVA_PROBE_TIMEOUT_MS = 5e3;
|
|
2450
2657
|
var MIN_JAVA_MAJOR = 17;
|
|
2451
2658
|
function jdkHomeFrom(dir) {
|
|
2452
|
-
if (existsSync2(
|
|
2659
|
+
if (existsSync2(path7.join(dir, "bin", JAVA_EXE)))
|
|
2453
2660
|
return dir;
|
|
2454
|
-
const macHome =
|
|
2455
|
-
if (existsSync2(
|
|
2661
|
+
const macHome = path7.join(dir, "Contents", "Home");
|
|
2662
|
+
if (existsSync2(path7.join(macHome, "bin", JAVA_EXE)))
|
|
2456
2663
|
return macHome;
|
|
2457
2664
|
return void 0;
|
|
2458
2665
|
}
|
|
@@ -2465,34 +2672,34 @@ function parseMajorVersion(name) {
|
|
|
2465
2672
|
}
|
|
2466
2673
|
function childDirs(base) {
|
|
2467
2674
|
try {
|
|
2468
|
-
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));
|
|
2469
2676
|
} catch {
|
|
2470
2677
|
return [];
|
|
2471
2678
|
}
|
|
2472
2679
|
}
|
|
2473
2680
|
function candidateRoots() {
|
|
2474
|
-
const home =
|
|
2681
|
+
const home = os5.homedir();
|
|
2475
2682
|
const roots = [];
|
|
2476
|
-
roots.push(
|
|
2477
|
-
roots.push(
|
|
2683
|
+
roots.push(path7.join(home, ".jdks"));
|
|
2684
|
+
roots.push(path7.join(getGlobalPiLensDir(), "tools"));
|
|
2478
2685
|
if (process.platform === "win32") {
|
|
2479
2686
|
const progFiles = [
|
|
2480
2687
|
process.env.ProgramFiles,
|
|
2481
2688
|
process.env["ProgramFiles(x86)"],
|
|
2482
2689
|
process.env.ProgramW6432,
|
|
2483
|
-
|
|
2690
|
+
path7.join(process.env.LOCALAPPDATA ?? path7.join(home, "AppData", "Local"), "Programs")
|
|
2484
2691
|
].filter((p) => Boolean(p));
|
|
2485
2692
|
for (const base of progFiles) {
|
|
2486
|
-
roots.push(
|
|
2487
|
-
roots.push(
|
|
2488
|
-
roots.push(
|
|
2489
|
-
roots.push(
|
|
2490
|
-
roots.push(
|
|
2491
|
-
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"));
|
|
2492
2699
|
}
|
|
2493
2700
|
} else if (process.platform === "darwin") {
|
|
2494
2701
|
roots.push("/Library/Java/JavaVirtualMachines");
|
|
2495
|
-
roots.push(
|
|
2702
|
+
roots.push(path7.join(home, "Library", "Java", "JavaVirtualMachines"));
|
|
2496
2703
|
roots.push("/opt/homebrew/opt");
|
|
2497
2704
|
roots.push("/usr/local/opt");
|
|
2498
2705
|
} else {
|
|
@@ -2516,7 +2723,7 @@ function discoverJdkHome(roots = candidateRoots(), javaHome = process.env.JAVA_H
|
|
|
2516
2723
|
continue;
|
|
2517
2724
|
found.push({
|
|
2518
2725
|
home: resolved,
|
|
2519
|
-
major: parseMajorVersion(
|
|
2726
|
+
major: parseMajorVersion(path7.basename(dir))
|
|
2520
2727
|
});
|
|
2521
2728
|
}
|
|
2522
2729
|
}
|
|
@@ -2619,12 +2826,12 @@ async function resolveJavaRuntimeEnv() {
|
|
|
2619
2826
|
}
|
|
2620
2827
|
const home = discoverJdkHome();
|
|
2621
2828
|
if (home) {
|
|
2622
|
-
const binDir =
|
|
2829
|
+
const binDir = path7.join(home, "bin");
|
|
2623
2830
|
const currentPath = process.env.PATH ?? process.env.Path ?? "";
|
|
2624
2831
|
_cachedEnv = {
|
|
2625
2832
|
value: {
|
|
2626
2833
|
JAVA_HOME: home,
|
|
2627
|
-
PATH: binDir +
|
|
2834
|
+
PATH: binDir + path7.delimiter + currentPath
|
|
2628
2835
|
},
|
|
2629
2836
|
trustGeneration
|
|
2630
2837
|
};
|
|
@@ -2683,7 +2890,7 @@ async function resolveLspServerCwd(server, filePath, sessionCwd, onRootFailure,
|
|
|
2683
2890
|
rootFailed = true;
|
|
2684
2891
|
onRootFailure?.(reason);
|
|
2685
2892
|
}
|
|
2686
|
-
const isFileDirFallback = serverRoot !== void 0 && rootMarkers?.length &&
|
|
2893
|
+
const isFileDirFallback = serverRoot !== void 0 && rootMarkers?.length && path8.resolve(serverRoot) === path8.resolve(path8.dirname(filePath));
|
|
2687
2894
|
if (!serverRoot || isFileDirFallback) {
|
|
2688
2895
|
const probedMarker = onRootFallback && !rootFailed && rootMarkers?.length ? resolveToolCwd("lsp", server.id, filePath, {
|
|
2689
2896
|
cwd: sessionCwd,
|
|
@@ -2692,7 +2899,7 @@ async function resolveLspServerCwd(server, filePath, sessionCwd, onRootFailure,
|
|
|
2692
2899
|
}).marker : void 0;
|
|
2693
2900
|
const refusedMarker = probedMarker !== void 0 && rootMarkers?.includes(probedMarker) ? probedMarker : void 0;
|
|
2694
2901
|
const fallbackCwd = rootMarkers?.length ? resolveToolCwd("lsp", server.id, filePath, {
|
|
2695
|
-
cwd:
|
|
2902
|
+
cwd: path8.dirname(path8.resolve(filePath)),
|
|
2696
2903
|
rootMarkers
|
|
2697
2904
|
}) : void 0;
|
|
2698
2905
|
if (!serverRoot) {
|
|
@@ -2775,17 +2982,17 @@ var PYTHON_EXTENSIONS = new Set(extensionsForLanguage("python"));
|
|
|
2775
2982
|
var loggedRootCeilingClamps = /* @__PURE__ */ new Set();
|
|
2776
2983
|
var posixCaseInsensitiveByPath = /* @__PURE__ */ new Map();
|
|
2777
2984
|
function posixFilesystemIsCaseInsensitive(root) {
|
|
2778
|
-
const resolved =
|
|
2985
|
+
const resolved = path8.resolve(root);
|
|
2779
2986
|
const cached = posixCaseInsensitiveByPath.get(resolved);
|
|
2780
2987
|
if (cached !== void 0)
|
|
2781
2988
|
return cached;
|
|
2782
2989
|
if (!existsSync3(resolved)) {
|
|
2783
2990
|
return false;
|
|
2784
2991
|
}
|
|
2785
|
-
const name =
|
|
2992
|
+
const name = path8.basename(resolved);
|
|
2786
2993
|
const alternate = name.toLowerCase() === name ? name.toUpperCase() : name.toLowerCase();
|
|
2787
2994
|
let insensitive = false;
|
|
2788
|
-
const alternatePath =
|
|
2995
|
+
const alternatePath = path8.join(path8.dirname(resolved), alternate);
|
|
2789
2996
|
if (alternate !== name && existsSync3(alternatePath)) {
|
|
2790
2997
|
try {
|
|
2791
2998
|
const actual = statSync4(resolved);
|
|
@@ -2803,7 +3010,7 @@ function resetLSPCaseSensitivityState() {
|
|
|
2803
3010
|
}
|
|
2804
3011
|
function isSameOrWithin(ancestor, candidate, deps = {}) {
|
|
2805
3012
|
const windowsShaped = isWindowsPath(ancestor) || isWindowsPath(candidate);
|
|
2806
|
-
const pathApi = windowsShaped ?
|
|
3013
|
+
const pathApi = windowsShaped ? path8.win32 : path8;
|
|
2807
3014
|
const resolvedAncestor = pathApi.resolve(ancestor);
|
|
2808
3015
|
const resolvedCandidate = pathApi.resolve(candidate);
|
|
2809
3016
|
let caseInsensitive = false;
|
|
@@ -2818,12 +3025,16 @@ function isSameOrWithin(ancestor, candidate, deps = {}) {
|
|
|
2818
3025
|
caseInsensitive = posixFilesystemIsCaseInsensitive(resolvedAncestor);
|
|
2819
3026
|
}
|
|
2820
3027
|
}
|
|
2821
|
-
const
|
|
2822
|
-
|
|
3028
|
+
const fold = windowsShaped || caseInsensitive;
|
|
3029
|
+
const form = (resolved) => {
|
|
3030
|
+
const slashed = windowsShaped ? toPosix(resolved) : resolved;
|
|
3031
|
+
return fold ? slashed.toLowerCase() : slashed;
|
|
3032
|
+
};
|
|
3033
|
+
return isWithinForm(form(resolvedCandidate), form(resolvedAncestor));
|
|
2823
3034
|
}
|
|
2824
3035
|
function enforceLspRootCeiling(root, sessionCwd, filePath) {
|
|
2825
3036
|
const windowsShaped = isWindowsPath(root) || isWindowsPath(sessionCwd);
|
|
2826
|
-
const pathApi = windowsShaped ?
|
|
3037
|
+
const pathApi = windowsShaped ? path8.win32 : path8;
|
|
2827
3038
|
const resolvedRoot = pathApi.resolve(root);
|
|
2828
3039
|
const resolvedCwd = pathApi.resolve(sessionCwd);
|
|
2829
3040
|
if (filePath && !isSameOrWithin(resolvedCwd, pathApi.resolve(filePath))) {
|
|
@@ -2850,8 +3061,8 @@ async function hasProjectBoundaryMarker(dir, server) {
|
|
|
2850
3061
|
return false;
|
|
2851
3062
|
}
|
|
2852
3063
|
function pathSegments(dir) {
|
|
2853
|
-
const parsed =
|
|
2854
|
-
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());
|
|
2855
3066
|
}
|
|
2856
3067
|
function hasFixtureConvention(dir) {
|
|
2857
3068
|
const segments = pathSegments(dir);
|
|
@@ -2863,11 +3074,9 @@ function hasAtomicStageSegment(dir) {
|
|
|
2863
3074
|
return pathSegments(dir).some((segment) => STAGE_TMP_PATTERN.test(segment));
|
|
2864
3075
|
}
|
|
2865
3076
|
async function findGitBoundary(dir, memo) {
|
|
2866
|
-
let current = path7.resolve(dir);
|
|
2867
|
-
const fsRoot = path7.parse(current).root;
|
|
2868
3077
|
const visited = [];
|
|
2869
3078
|
let found;
|
|
2870
|
-
|
|
3079
|
+
for (const current of walkUpDirs(dir, { spelling: true })) {
|
|
2871
3080
|
const key = normalizeMapKey(current);
|
|
2872
3081
|
if (memo?.has(key)) {
|
|
2873
3082
|
found = memo.get(key);
|
|
@@ -2878,16 +3087,13 @@ async function findGitBoundary(dir, memo) {
|
|
|
2878
3087
|
found = current;
|
|
2879
3088
|
break;
|
|
2880
3089
|
}
|
|
2881
|
-
if (current === fsRoot)
|
|
2882
|
-
break;
|
|
2883
|
-
current = path7.dirname(current);
|
|
2884
3090
|
}
|
|
2885
3091
|
for (const seen of visited)
|
|
2886
3092
|
memo?.set(seen, found);
|
|
2887
3093
|
return found;
|
|
2888
3094
|
}
|
|
2889
3095
|
async function isExcludedLspRoot(dir, gitBoundaries) {
|
|
2890
|
-
const candidate =
|
|
3096
|
+
const candidate = path8.resolve(dir);
|
|
2891
3097
|
if (hasFixtureConvention(candidate) || hasAtomicStageSegment(candidate))
|
|
2892
3098
|
return true;
|
|
2893
3099
|
const gitRoot = await findGitBoundary(candidate, gitBoundaries);
|
|
@@ -2898,12 +3104,11 @@ async function isExcludedLspRoot(dir, gitBoundaries) {
|
|
|
2898
3104
|
return isPathIgnoredByProject(candidate, gitRoot, true);
|
|
2899
3105
|
}
|
|
2900
3106
|
async function nearestNonExcludedFallbackRoot(candidate, stopDir) {
|
|
2901
|
-
|
|
2902
|
-
const
|
|
2903
|
-
const fsRoot = path7.parse(current).root;
|
|
3107
|
+
const startDir = path8.resolve(candidate);
|
|
3108
|
+
const fsRoot = path8.parse(startDir).root;
|
|
2904
3109
|
let nearestAllowed;
|
|
2905
3110
|
const gitBoundaries = /* @__PURE__ */ new Map();
|
|
2906
|
-
|
|
3111
|
+
for (const current of walkUpDirs(startDir, { spelling: true })) {
|
|
2907
3112
|
if (!await isExcludedLspRoot(current, gitBoundaries)) {
|
|
2908
3113
|
nearestAllowed ??= current;
|
|
2909
3114
|
for (const marker of FALLBACK_PROJECT_MARKERS) {
|
|
@@ -2911,17 +3116,13 @@ async function nearestNonExcludedFallbackRoot(candidate, stopDir) {
|
|
|
2911
3116
|
return current;
|
|
2912
3117
|
}
|
|
2913
3118
|
}
|
|
2914
|
-
if (
|
|
3119
|
+
if (normalizeEphemeralMapKey(current) === stopDir)
|
|
2915
3120
|
break;
|
|
2916
|
-
current = path7.dirname(current);
|
|
2917
3121
|
}
|
|
2918
3122
|
if (stopDir !== void 0)
|
|
2919
3123
|
return nearestAllowed ?? startDir;
|
|
2920
3124
|
return nearestAllowed ?? fsRoot;
|
|
2921
3125
|
}
|
|
2922
|
-
function isLspInstallDisabled() {
|
|
2923
|
-
return process.env.PI_LENS_DISABLE_LSP_INSTALL === "1";
|
|
2924
|
-
}
|
|
2925
3126
|
function canInstall(allowInstall) {
|
|
2926
3127
|
return allowInstall !== false && !isLspInstallDisabled();
|
|
2927
3128
|
}
|
|
@@ -2956,7 +3157,7 @@ async function installEvidenceForLaunch(toolId, installed, attempt) {
|
|
|
2956
3157
|
const confirmedManagedPath = await findManagedToolBinary(toolId);
|
|
2957
3158
|
return {
|
|
2958
3159
|
...evidence,
|
|
2959
|
-
binary:
|
|
3160
|
+
binary: path8.basename(installed),
|
|
2960
3161
|
...confirmedManagedPath !== void 0 && pathsEqual(confirmedManagedPath, installed) && {
|
|
2961
3162
|
source: "managed-dir"
|
|
2962
3163
|
}
|
|
@@ -3009,7 +3210,7 @@ function markDirectLspCommandUnavailable(command) {
|
|
|
3009
3210
|
directLspCommandUnavailableUntil.set(command, Date.now() + DIRECT_LSP_NEGATIVE_TTL_MS);
|
|
3010
3211
|
directLspCommandSkipLoggedUntil.delete(command);
|
|
3011
3212
|
}
|
|
3012
|
-
var PI_LENS_BIN_DIR2 =
|
|
3213
|
+
var PI_LENS_BIN_DIR2 = path8.join(getGlobalPiLensDir(), "bin");
|
|
3013
3214
|
async function resolveAndLaunch(spec, allowInstall) {
|
|
3014
3215
|
const generation = lspLaunchAvailabilityGeneration.capture();
|
|
3015
3216
|
const toolLabel = spec.managedToolId ?? spec.candidates[spec.candidates.length - 1] ?? "unknown";
|
|
@@ -3074,7 +3275,7 @@ async function resolveAndLaunch(spec, allowInstall) {
|
|
|
3074
3275
|
producer: "lsp-launch",
|
|
3075
3276
|
classifiedBy: "probe",
|
|
3076
3277
|
evidence: {
|
|
3077
|
-
binary:
|
|
3278
|
+
binary: path8.basename(managedCandidate),
|
|
3078
3279
|
source: "managed-dir",
|
|
3079
3280
|
correctsLatchedRow: false
|
|
3080
3281
|
}
|
|
@@ -3380,7 +3581,7 @@ async function resolveAndLaunchTreeBinary(spec, allowInstall) {
|
|
|
3380
3581
|
return void 0;
|
|
3381
3582
|
}
|
|
3382
3583
|
const suffix = process.platform === "win32" ? ".exe" : "";
|
|
3383
|
-
const binPath =
|
|
3584
|
+
const binPath = path8.join(bundleDir, ...spec.binRelPath.split("/")) + suffix;
|
|
3384
3585
|
try {
|
|
3385
3586
|
const proc = await launchLSP(binPath, spec.args, {
|
|
3386
3587
|
cwd: spec.cwd,
|
|
@@ -3395,7 +3596,7 @@ async function resolveAndLaunchTreeBinary(spec, allowInstall) {
|
|
|
3395
3596
|
}
|
|
3396
3597
|
}
|
|
3397
3598
|
function nodeBinLocalCandidates(root, baseName) {
|
|
3398
|
-
const localBase =
|
|
3599
|
+
const localBase = path8.join(root, "node_modules", ".bin", baseName);
|
|
3399
3600
|
if (process.platform === "win32") {
|
|
3400
3601
|
return [`${localBase}.cmd`, `${localBase}.exe`];
|
|
3401
3602
|
}
|
|
@@ -3405,7 +3606,7 @@ function nodeBinCandidates(root, baseName) {
|
|
|
3405
3606
|
return [...nodeBinLocalCandidates(root, baseName), baseName];
|
|
3406
3607
|
}
|
|
3407
3608
|
function piAgentExtensionsRootKey(file) {
|
|
3408
|
-
const dirKey = normalizeEphemeralMapKey(
|
|
3609
|
+
const dirKey = normalizeEphemeralMapKey(path8.dirname(path8.resolve(file)));
|
|
3409
3610
|
const marker = "/.pi/agent/extensions";
|
|
3410
3611
|
const index = dirKey.indexOf(marker);
|
|
3411
3612
|
if (index === -1)
|
|
@@ -3413,26 +3614,26 @@ function piAgentExtensionsRootKey(file) {
|
|
|
3413
3614
|
return dirKey.slice(0, index + marker.length);
|
|
3414
3615
|
}
|
|
3415
3616
|
function IgnoreHomeRoot(primary) {
|
|
3416
|
-
const homeKey = normalizeEphemeralMapKey(realpathOrResolve(
|
|
3617
|
+
const homeKey = normalizeEphemeralMapKey(realpathOrResolve(os6.homedir()));
|
|
3417
3618
|
return withRootMarkers(async (file) => {
|
|
3418
3619
|
const root = await primary(file);
|
|
3419
3620
|
if (!root)
|
|
3420
3621
|
return void 0;
|
|
3421
|
-
return normalizeEphemeralMapKey(
|
|
3622
|
+
return normalizeEphemeralMapKey(path8.resolve(root)) === homeKey ? void 0 : root;
|
|
3422
3623
|
}, primary.rootMarkers ?? []);
|
|
3423
3624
|
}
|
|
3424
3625
|
function rubyBinCandidates(baseName) {
|
|
3425
3626
|
const candidates = [];
|
|
3426
|
-
const home =
|
|
3627
|
+
const home = os6.homedir();
|
|
3427
3628
|
const isWin = process.platform === "win32";
|
|
3428
3629
|
const ext = isWin ? ".bat" : "";
|
|
3429
|
-
candidates.push(
|
|
3430
|
-
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}`));
|
|
3431
3632
|
if (isWin) {
|
|
3432
|
-
const driveRoot =
|
|
3633
|
+
const driveRoot = path8.parse(home).root;
|
|
3433
3634
|
for (const entry of getRubyVersionDirNamesSync(driveRoot)) {
|
|
3434
|
-
candidates.push(
|
|
3435
|
-
candidates.push(
|
|
3635
|
+
candidates.push(path8.join(driveRoot, entry, "bin", `${baseName}.bat`));
|
|
3636
|
+
candidates.push(path8.join(driveRoot, entry, "bin", baseName));
|
|
3436
3637
|
}
|
|
3437
3638
|
}
|
|
3438
3639
|
return candidates;
|
|
@@ -3489,13 +3690,13 @@ function PriorityRoot(markerGroups, excludePatterns, stopDir) {
|
|
|
3489
3690
|
}, markerGroups.flat());
|
|
3490
3691
|
}
|
|
3491
3692
|
var FileDirRoot = async (file) => {
|
|
3492
|
-
const candidate =
|
|
3693
|
+
const candidate = path8.resolve(path8.dirname(file));
|
|
3493
3694
|
return nearestNonExcludedFallbackRoot(candidate, piAgentExtensionsRootKey(file));
|
|
3494
3695
|
};
|
|
3495
3696
|
function declinesLooseFileRoot(server, root) {
|
|
3496
3697
|
if (server.looseFileRoot !== "decline")
|
|
3497
3698
|
return false;
|
|
3498
|
-
return isAtOrAboveHomeDir(realpathOrResolve(root), realpathOrResolve(
|
|
3699
|
+
return isAtOrAboveHomeDir(realpathOrResolve(root), realpathOrResolve(os6.homedir()));
|
|
3499
3700
|
}
|
|
3500
3701
|
var PROJECT_FILE_SEARCH_MAX_DIRS = 128;
|
|
3501
3702
|
async function declinesProjectlessRoot(server, root) {
|
|
@@ -3515,7 +3716,7 @@ async function declinesProjectlessRoot(server, root) {
|
|
|
3515
3716
|
if (visited + queue.length + 1 >= PROJECT_FILE_SEARCH_MAX_DIRS)
|
|
3516
3717
|
break;
|
|
3517
3718
|
if (entry.isDirectory() && !isExcludedDirName(entry.name)) {
|
|
3518
|
-
queue.push(
|
|
3719
|
+
queue.push(path8.join(dir, entry.name));
|
|
3519
3720
|
}
|
|
3520
3721
|
}
|
|
3521
3722
|
}
|
|
@@ -3540,21 +3741,21 @@ function markerProbeDir(dir, pattern) {
|
|
|
3540
3741
|
const normalized = toPosix(pattern);
|
|
3541
3742
|
const slash = normalized.lastIndexOf("/");
|
|
3542
3743
|
const parentPattern = slash >= 0 ? normalized.slice(0, slash) : "";
|
|
3543
|
-
return parentPattern ?
|
|
3744
|
+
return parentPattern ? path8.join(dir, ...parentPattern.split("/").filter(Boolean)) : dir;
|
|
3544
3745
|
}
|
|
3545
3746
|
async function markerExists(dir, pattern) {
|
|
3546
3747
|
if (!pattern.includes("*")) {
|
|
3547
3748
|
try {
|
|
3548
|
-
await stat(
|
|
3749
|
+
await stat(path8.join(dir, pattern));
|
|
3549
3750
|
return true;
|
|
3550
3751
|
} catch (err) {
|
|
3551
3752
|
if (isPermissionFsError(err)) {
|
|
3552
|
-
logSessionStart(`lsp root marker skipped: permission error stat ${
|
|
3753
|
+
logSessionStart(`lsp root marker skipped: permission error stat ${path8.join(dir, pattern)}`);
|
|
3553
3754
|
}
|
|
3554
3755
|
return false;
|
|
3555
3756
|
}
|
|
3556
3757
|
}
|
|
3557
|
-
const normalized = pattern
|
|
3758
|
+
const normalized = toPosix(pattern);
|
|
3558
3759
|
const slash = normalized.lastIndexOf("/");
|
|
3559
3760
|
const basenamePattern = slash >= 0 ? normalized.slice(slash + 1) : normalized;
|
|
3560
3761
|
if (!basenamePattern)
|
|
@@ -3586,7 +3787,7 @@ function NearestRoot(includePatterns, excludePatterns, stopDir) {
|
|
|
3586
3787
|
}
|
|
3587
3788
|
return withRootMarkers(async (file) => {
|
|
3588
3789
|
const identity = realpathOrResolve(file);
|
|
3589
|
-
const startDir =
|
|
3790
|
+
const startDir = path8.dirname(identity);
|
|
3590
3791
|
const dirKey = normalizeEphemeralMapKey(startDir);
|
|
3591
3792
|
const cached = cache.get(dirKey);
|
|
3592
3793
|
if (cached !== void 0 && Date.now() - cached.walkedAt < FRESHNESS_CADENCE_MS && await bounded(dirMtimesStillFreshAsync(cached.probedDirs), rootMtimeBound("lsp-root-memo-freshness")) === true)
|
|
@@ -3597,11 +3798,10 @@ function NearestRoot(includePatterns, excludePatterns, stopDir) {
|
|
|
3597
3798
|
const probedDirs = [];
|
|
3598
3799
|
const walkedAt = Date.now();
|
|
3599
3800
|
const promise = (async () => {
|
|
3600
|
-
|
|
3601
|
-
const fsRoot = path7.parse(currentDir).root;
|
|
3801
|
+
const fsRoot = path8.parse(startDir).root;
|
|
3602
3802
|
const stop = stopDir ? realpathOrResolve(stopDir) : fsRoot;
|
|
3603
|
-
|
|
3604
|
-
if (stop !== fsRoot && currentDir.startsWith(stop +
|
|
3803
|
+
for (const currentDir of walkUpDirs(startDir)) {
|
|
3804
|
+
if (stop !== fsRoot && currentDir.startsWith(stop + path8.sep) === false && currentDir !== stop) {
|
|
3605
3805
|
break;
|
|
3606
3806
|
}
|
|
3607
3807
|
const stepDirs = [
|
|
@@ -3618,20 +3818,17 @@ function NearestRoot(includePatterns, excludePatterns, stopDir) {
|
|
|
3618
3818
|
break;
|
|
3619
3819
|
}
|
|
3620
3820
|
}
|
|
3621
|
-
if (excluded)
|
|
3622
|
-
currentDir = path7.dirname(currentDir);
|
|
3821
|
+
if (excluded)
|
|
3623
3822
|
continue;
|
|
3624
|
-
}
|
|
3625
3823
|
}
|
|
3626
3824
|
for (const pattern of includePatterns) {
|
|
3627
|
-
if (await markerExists(currentDir, pattern) && (pattern !== ".git" || currentDir !== realpathOrResolve(
|
|
3825
|
+
if (await markerExists(currentDir, pattern) && (pattern !== ".git" || currentDir !== realpathOrResolve(os6.tmpdir())) && !await isExcludedLspRoot(currentDir)) {
|
|
3628
3826
|
return enforceLspRootCeiling(currentDir, process.cwd(), identity);
|
|
3629
3827
|
}
|
|
3630
3828
|
}
|
|
3631
3829
|
if (currentDir === stop || currentDir === fsRoot) {
|
|
3632
3830
|
break;
|
|
3633
3831
|
}
|
|
3634
|
-
currentDir = path7.dirname(currentDir);
|
|
3635
3832
|
}
|
|
3636
3833
|
return void 0;
|
|
3637
3834
|
})();
|
|
@@ -3672,22 +3869,19 @@ async function findAncestorFile(startDir, ...relativeSegments) {
|
|
|
3672
3869
|
return findAncestorFileAmong(startDir, [relativeSegments]);
|
|
3673
3870
|
}
|
|
3674
3871
|
async function findAncestorFileAmong(startDir, candidateSegmentLists) {
|
|
3675
|
-
const
|
|
3676
|
-
|
|
3677
|
-
const
|
|
3678
|
-
|
|
3872
|
+
const fs7 = await import("node:fs/promises");
|
|
3873
|
+
const home = realpathOrResolve(os6.homedir());
|
|
3874
|
+
for (const currentDir of walkUpDirs(startDir, { spelling: true })) {
|
|
3875
|
+
if (isAtOrAboveHomeDir(realpathOrResolve(currentDir), home))
|
|
3876
|
+
break;
|
|
3679
3877
|
for (const segments of candidateSegmentLists) {
|
|
3680
|
-
const candidate =
|
|
3878
|
+
const candidate = path8.join(currentDir, ...segments);
|
|
3681
3879
|
try {
|
|
3682
|
-
await
|
|
3880
|
+
await fs7.access(candidate);
|
|
3683
3881
|
return candidate;
|
|
3684
3882
|
} catch {
|
|
3685
3883
|
}
|
|
3686
3884
|
}
|
|
3687
|
-
const parent = path7.dirname(currentDir);
|
|
3688
|
-
if (parent === currentDir)
|
|
3689
|
-
break;
|
|
3690
|
-
currentDir = parent;
|
|
3691
3885
|
}
|
|
3692
3886
|
return void 0;
|
|
3693
3887
|
}
|
|
@@ -3700,21 +3894,21 @@ function resetClassicTsRepairGuard() {
|
|
|
3700
3894
|
classicTsRepairState().attempted = false;
|
|
3701
3895
|
}
|
|
3702
3896
|
function typescriptDirsForTsc(tscPath) {
|
|
3703
|
-
const binDir =
|
|
3897
|
+
const binDir = path8.dirname(tscPath);
|
|
3704
3898
|
return [
|
|
3705
|
-
|
|
3706
|
-
|
|
3899
|
+
path8.join(binDir, "..", "typescript"),
|
|
3900
|
+
path8.join(binDir, "..", "..", "typescript"),
|
|
3707
3901
|
// Windows npm-global: `<prefix>/tsc.cmd` beside `<prefix>/node_modules`.
|
|
3708
|
-
|
|
3902
|
+
path8.join(binDir, "node_modules", "typescript")
|
|
3709
3903
|
];
|
|
3710
3904
|
}
|
|
3711
3905
|
async function typescriptVersionForTsc(tscPath) {
|
|
3712
|
-
if (!
|
|
3906
|
+
if (!path8.isAbsolute(tscPath))
|
|
3713
3907
|
return void 0;
|
|
3714
3908
|
for (const dir of typescriptDirsForTsc(tscPath)) {
|
|
3715
3909
|
let manifest;
|
|
3716
3910
|
try {
|
|
3717
|
-
manifest = await readFile(
|
|
3911
|
+
manifest = await readFile(path8.join(dir, "package.json"), "utf8");
|
|
3718
3912
|
} catch {
|
|
3719
3913
|
continue;
|
|
3720
3914
|
}
|
|
@@ -3744,20 +3938,20 @@ async function hasTypescriptPackageDir(tscPath) {
|
|
|
3744
3938
|
return false;
|
|
3745
3939
|
}
|
|
3746
3940
|
async function absoluteCommandPath(command) {
|
|
3747
|
-
if (!command ||
|
|
3941
|
+
if (!command || path8.isAbsolute(command))
|
|
3748
3942
|
return command;
|
|
3749
3943
|
const found = await findCommandAsync(command);
|
|
3750
3944
|
return found ? realpath(found).catch(() => void 0) : void 0;
|
|
3751
3945
|
}
|
|
3752
3946
|
async function findTsserverPath(root, allowInstall, options) {
|
|
3753
|
-
const
|
|
3754
|
-
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))));
|
|
3755
3949
|
const admitCandidate = async (candidate, projectSupplied) => {
|
|
3756
3950
|
try {
|
|
3757
|
-
const real = await
|
|
3758
|
-
if (
|
|
3951
|
+
const real = await fs7.realpath(candidate);
|
|
3952
|
+
if (path8.basename(real) !== "tsserver.js" || !(await fs7.stat(real)).isFile())
|
|
3759
3953
|
return void 0;
|
|
3760
|
-
const manifest = JSON.parse(await
|
|
3954
|
+
const manifest = JSON.parse(await fs7.readFile(path8.join(path8.dirname(real), "..", "package.json"), "utf8"));
|
|
3761
3955
|
if (typeof manifest?.version !== "string" || !manifest.version)
|
|
3762
3956
|
return void 0;
|
|
3763
3957
|
return admitProjectSuppliedTsserver(real, options?.sessionRoot ?? process.cwd(), projectSupplied || projectRoots.some((dir) => isUnderDir(real, dir)), options?.projectCodeAllowed);
|
|
@@ -3771,9 +3965,9 @@ async function findTsserverPath(root, allowInstall, options) {
|
|
|
3771
3965
|
if (admittedAncestor)
|
|
3772
3966
|
return admittedAncestor;
|
|
3773
3967
|
}
|
|
3774
|
-
const cwdCandidate =
|
|
3968
|
+
const cwdCandidate = path8.join(process.cwd(), "node_modules", "typescript", "lib", "tsserver.js");
|
|
3775
3969
|
try {
|
|
3776
|
-
await
|
|
3970
|
+
await fs7.access(cwdCandidate);
|
|
3777
3971
|
const admittedCwd = await admitCandidate(cwdCandidate, false);
|
|
3778
3972
|
if (admittedCwd)
|
|
3779
3973
|
return admittedCwd;
|
|
@@ -3783,7 +3977,7 @@ async function findTsserverPath(root, allowInstall, options) {
|
|
|
3783
3977
|
if (!tscPath)
|
|
3784
3978
|
return void 0;
|
|
3785
3979
|
for (const dir of typescriptDirsForTsc(tscPath)) {
|
|
3786
|
-
const candidate =
|
|
3980
|
+
const candidate = path8.join(dir, "lib", "tsserver.js");
|
|
3787
3981
|
try {
|
|
3788
3982
|
const admitted = await admitCandidate(candidate, false);
|
|
3789
3983
|
if (admitted)
|
|
@@ -3812,11 +4006,12 @@ async function findTsserverPath(root, allowInstall, options) {
|
|
|
3812
4006
|
return tsserverForTsc(repairedTsc);
|
|
3813
4007
|
}
|
|
3814
4008
|
async function findNativeTypeScriptLsp(root) {
|
|
3815
|
-
|
|
3816
|
-
const
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
const
|
|
4009
|
+
const home = realpathOrResolve(os6.homedir());
|
|
4010
|
+
for (const currentDir of walkUpDirs(root, { spelling: true })) {
|
|
4011
|
+
if (isAtOrAboveHomeDir(realpathOrResolve(currentDir), home))
|
|
4012
|
+
break;
|
|
4013
|
+
const typescriptDir = path8.join(currentDir, "node_modules", "typescript");
|
|
4014
|
+
const packageJsonPath = path8.join(typescriptDir, "package.json");
|
|
3820
4015
|
let packageJsonText;
|
|
3821
4016
|
try {
|
|
3822
4017
|
packageJsonText = await readFile(packageJsonPath, "utf8");
|
|
@@ -3830,10 +4025,6 @@ async function findNativeTypeScriptLsp(root) {
|
|
|
3830
4025
|
return void 0;
|
|
3831
4026
|
} catch {
|
|
3832
4027
|
}
|
|
3833
|
-
const parent = path7.dirname(currentDir);
|
|
3834
|
-
if (parent === currentDir)
|
|
3835
|
-
return void 0;
|
|
3836
|
-
currentDir = parent;
|
|
3837
4028
|
continue;
|
|
3838
4029
|
}
|
|
3839
4030
|
let version;
|
|
@@ -3850,7 +4041,7 @@ async function findNativeTypeScriptLsp(root) {
|
|
|
3850
4041
|
const major = /^\d+$/.test(majorText) ? Number(majorText) : Number.NaN;
|
|
3851
4042
|
if (!Number.isFinite(major) || major < 7)
|
|
3852
4043
|
return void 0;
|
|
3853
|
-
const localTsc =
|
|
4044
|
+
const localTsc = path8.join(currentDir, "node_modules", ".bin", "tsc");
|
|
3854
4045
|
const candidates = process.platform === "win32" ? [`${localTsc}.cmd`, `${localTsc}.exe`, localTsc] : [localTsc];
|
|
3855
4046
|
for (const command of candidates) {
|
|
3856
4047
|
try {
|
|
@@ -3858,7 +4049,7 @@ async function findNativeTypeScriptLsp(root) {
|
|
|
3858
4049
|
return {
|
|
3859
4050
|
command,
|
|
3860
4051
|
version,
|
|
3861
|
-
nodeModulesDir:
|
|
4052
|
+
nodeModulesDir: path8.join(currentDir, "node_modules")
|
|
3862
4053
|
};
|
|
3863
4054
|
} catch {
|
|
3864
4055
|
}
|
|
@@ -3870,14 +4061,14 @@ async function findNativeTypeScriptLsp(root) {
|
|
|
3870
4061
|
async function findEffectTsgoLsp(nodeModulesDir) {
|
|
3871
4062
|
let release;
|
|
3872
4063
|
try {
|
|
3873
|
-
const manifest = JSON.parse(await readFile(
|
|
4064
|
+
const manifest = JSON.parse(await readFile(path8.join(nodeModulesDir, "@effect", "tsgo", "package.json"), "utf8"));
|
|
3874
4065
|
release = typeof manifest === "object" && manifest !== null && "version" in manifest ? manifest.version : void 0;
|
|
3875
4066
|
} catch {
|
|
3876
4067
|
return void 0;
|
|
3877
4068
|
}
|
|
3878
4069
|
if (typeof release !== "string" || !release)
|
|
3879
4070
|
return void 0;
|
|
3880
|
-
const localBin =
|
|
4071
|
+
const localBin = path8.join(nodeModulesDir, ".bin", "effect-tsgo");
|
|
3881
4072
|
const candidates = process.platform === "win32" ? [`${localBin}.cmd`, `${localBin}.exe`, localBin] : [localBin];
|
|
3882
4073
|
for (const command of candidates) {
|
|
3883
4074
|
try {
|
|
@@ -3889,17 +4080,17 @@ async function findEffectTsgoLsp(nodeModulesDir) {
|
|
|
3889
4080
|
return void 0;
|
|
3890
4081
|
}
|
|
3891
4082
|
function dotnetToolCandidates(tool) {
|
|
3892
|
-
const home =
|
|
4083
|
+
const home = os6.homedir();
|
|
3893
4084
|
return [
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
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),
|
|
3898
4089
|
tool
|
|
3899
4090
|
].filter(Boolean);
|
|
3900
4091
|
}
|
|
3901
4092
|
function binExeVariants(dir, tool) {
|
|
3902
|
-
const variants = process.platform === "win32" ? [
|
|
4093
|
+
const variants = process.platform === "win32" ? [path8.join(dir, `${tool}.exe`), path8.join(dir, tool)] : [path8.join(dir, tool)];
|
|
3903
4094
|
const admitted = [];
|
|
3904
4095
|
for (const candidate of variants) {
|
|
3905
4096
|
if (existsSync3(candidate) && isUntrustedProjectPath(candidate)) {
|
|
@@ -3911,12 +4102,12 @@ function binExeVariants(dir, tool) {
|
|
|
3911
4102
|
return admitted;
|
|
3912
4103
|
}
|
|
3913
4104
|
function goBinCandidates(tool) {
|
|
3914
|
-
const gopath = process.env.GOPATH?.split(
|
|
3915
|
-
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)];
|
|
3916
4107
|
}
|
|
3917
4108
|
function cargoBinCandidates(tool) {
|
|
3918
|
-
const cargoHome = process.env.CARGO_HOME ||
|
|
3919
|
-
return [tool, ...binExeVariants(
|
|
4109
|
+
const cargoHome = process.env.CARGO_HOME || path8.join(os6.homedir(), ".cargo");
|
|
4110
|
+
return [tool, ...binExeVariants(path8.join(cargoHome, "bin"), tool)];
|
|
3920
4111
|
}
|
|
3921
4112
|
async function tryGemInstall(gem) {
|
|
3922
4113
|
const { join: join4 } = await import("node:path");
|
|
@@ -3954,7 +4145,7 @@ var TS_TOOLING_MARKERS = [
|
|
|
3954
4145
|
];
|
|
3955
4146
|
var TS_FAMILY_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
3956
4147
|
function isTsFamilyFile(file) {
|
|
3957
|
-
return TS_FAMILY_EXTENSIONS.has(
|
|
4148
|
+
return TS_FAMILY_EXTENSIONS.has(path8.extname(file).toLowerCase());
|
|
3958
4149
|
}
|
|
3959
4150
|
function tsConfigMarkersForFile(file) {
|
|
3960
4151
|
return isTsFamilyFile(file) ? ["tsconfig.json"] : TS_CONFIG_MARKERS;
|
|
@@ -3978,39 +4169,36 @@ async function findExtensionBoundedRoot(file, extensionRootKey) {
|
|
|
3978
4169
|
const identity = realpathOrResolve(file);
|
|
3979
4170
|
const insideBoundary = isUnderDir(identity, extensionRootKey);
|
|
3980
4171
|
const boundaryKey = insideBoundary ? normalizeEphemeralMapKey(realpathOrResolve(extensionRootKey)) : extensionRootKey;
|
|
3981
|
-
|
|
4172
|
+
const start = path8.dirname(insideBoundary ? identity : path8.resolve(file));
|
|
3982
4173
|
const configMarkers = tsConfigMarkersForFile(file);
|
|
3983
|
-
|
|
4174
|
+
for (const currentDir of walkUpDirs(start, { spelling: true })) {
|
|
3984
4175
|
for (const pattern of configMarkers) {
|
|
3985
4176
|
try {
|
|
3986
|
-
await stat(
|
|
4177
|
+
await stat(path8.join(currentDir, pattern));
|
|
3987
4178
|
return currentDir;
|
|
3988
4179
|
} catch {
|
|
3989
4180
|
}
|
|
3990
4181
|
}
|
|
3991
4182
|
for (const pattern of TS_TOOLING_MARKERS) {
|
|
3992
4183
|
try {
|
|
3993
|
-
await stat(
|
|
4184
|
+
await stat(path8.join(currentDir, pattern));
|
|
3994
4185
|
return currentDir;
|
|
3995
4186
|
} catch {
|
|
3996
4187
|
}
|
|
3997
4188
|
}
|
|
3998
|
-
const currentKey = normalizeEphemeralMapKey(
|
|
4189
|
+
const currentKey = normalizeEphemeralMapKey(path8.resolve(currentDir));
|
|
3999
4190
|
if (currentKey === boundaryKey)
|
|
4000
4191
|
return void 0;
|
|
4001
|
-
const parent = path7.dirname(currentDir);
|
|
4002
|
-
if (parent === currentDir)
|
|
4003
|
-
return void 0;
|
|
4004
|
-
currentDir = parent;
|
|
4005
4192
|
}
|
|
4193
|
+
return void 0;
|
|
4006
4194
|
}
|
|
4007
4195
|
async function hasAgentLevelProjectMarker(extensionRootKey) {
|
|
4008
|
-
const agentDir =
|
|
4196
|
+
const agentDir = path8.dirname(extensionRootKey);
|
|
4009
4197
|
if (!agentDir || agentDir === extensionRootKey)
|
|
4010
4198
|
return false;
|
|
4011
4199
|
for (const pattern of [...TS_CONFIG_MARKERS, ...TS_TOOLING_MARKERS]) {
|
|
4012
4200
|
try {
|
|
4013
|
-
await stat(
|
|
4201
|
+
await stat(path8.join(agentDir, pattern));
|
|
4014
4202
|
return true;
|
|
4015
4203
|
} catch {
|
|
4016
4204
|
}
|
|
@@ -4228,13 +4416,13 @@ var PythonServer = {
|
|
|
4228
4416
|
if (!pyrightPath)
|
|
4229
4417
|
return void 0;
|
|
4230
4418
|
source = "managed";
|
|
4231
|
-
const binDir =
|
|
4419
|
+
const binDir = path8.dirname(pyrightPath);
|
|
4232
4420
|
const isWindows2 = process.platform === "win32";
|
|
4233
4421
|
const managedCandidates = isWindows2 ? [
|
|
4234
|
-
|
|
4235
|
-
|
|
4422
|
+
path8.join(binDir, "pyright-langserver.cmd"),
|
|
4423
|
+
path8.join(binDir, "pyright-langserver"),
|
|
4236
4424
|
"pyright-langserver"
|
|
4237
|
-
] : [
|
|
4425
|
+
] : [path8.join(binDir, "pyright-langserver"), "pyright-langserver"];
|
|
4238
4426
|
const resolved = await resolveAndLaunch({ candidates: managedCandidates, args: ["--stdio"], cwd: root, env }, false);
|
|
4239
4427
|
if (!resolved)
|
|
4240
4428
|
return void 0;
|
|
@@ -4325,8 +4513,8 @@ var GoServer = {
|
|
|
4325
4513
|
}
|
|
4326
4514
|
};
|
|
4327
4515
|
function cargoWorkspaceDeclaresMember(workspaceContent, parentDir, childDir) {
|
|
4328
|
-
const relativePath =
|
|
4329
|
-
if (relativePath
|
|
4516
|
+
const relativePath = toProjectRelativePath(childDir, parentDir);
|
|
4517
|
+
if (isAbsoluteFilePath(relativePath))
|
|
4330
4518
|
return false;
|
|
4331
4519
|
const matches = (pattern) => matchesWorkspaceMemberPattern(pattern, relativePath, CARGO_WORKSPACE_MEMBER_DIALECT, () => recordDegradationOnce({
|
|
4332
4520
|
kind: "workspace-glob-cap",
|
|
@@ -4339,7 +4527,7 @@ function cargoWorkspaceDeclaresMember(workspaceContent, parentDir, childDir) {
|
|
|
4339
4527
|
return readCargoWorkspaceMembers(workspaceContent).some(matches);
|
|
4340
4528
|
}
|
|
4341
4529
|
function sessionHoistCeiling(sessionCwd, file) {
|
|
4342
|
-
return isSameOrWithin(
|
|
4530
|
+
return isSameOrWithin(path8.resolve(sessionCwd), path8.resolve(file)) ? path8.resolve(sessionCwd) : void 0;
|
|
4343
4531
|
}
|
|
4344
4532
|
function RustWorkspaceRoot() {
|
|
4345
4533
|
const crateRoot = createRootDetector(["Cargo.toml", "Cargo.lock"]);
|
|
@@ -4349,15 +4537,14 @@ function RustWorkspaceRoot() {
|
|
|
4349
4537
|
return void 0;
|
|
4350
4538
|
const sessionCwd = process.cwd();
|
|
4351
4539
|
const stop = sessionHoistCeiling(sessionCwd, file);
|
|
4352
|
-
|
|
4353
|
-
const
|
|
4354
|
-
while (true) {
|
|
4540
|
+
const fsRoot = path8.parse(root).root;
|
|
4541
|
+
for (const current of walkUpDirs(root, { spelling: true })) {
|
|
4355
4542
|
if (stop !== void 0 && current === stop)
|
|
4356
4543
|
break;
|
|
4357
|
-
const parent =
|
|
4544
|
+
const parent = path8.dirname(current);
|
|
4358
4545
|
if (parent === current || parent === fsRoot)
|
|
4359
4546
|
break;
|
|
4360
|
-
const parentCargoPath =
|
|
4547
|
+
const parentCargoPath = path8.join(parent, "Cargo.toml");
|
|
4361
4548
|
const parentCargoContent = await readTextFileOrUndefined(parentCargoPath);
|
|
4362
4549
|
if (parentCargoContent !== void 0 && hasCargoWorkspaceTable(parentCargoContent)) {
|
|
4363
4550
|
if (cargoWorkspaceDeclaresMember(parentCargoContent, parent, root)) {
|
|
@@ -4365,7 +4552,6 @@ function RustWorkspaceRoot() {
|
|
|
4365
4552
|
}
|
|
4366
4553
|
break;
|
|
4367
4554
|
}
|
|
4368
|
-
current = parent;
|
|
4369
4555
|
}
|
|
4370
4556
|
return root;
|
|
4371
4557
|
}, crateRoot.rootMarkers ?? []);
|
|
@@ -4385,9 +4571,9 @@ async function declaresMavenModule(parentDir, parentPomPath, childDir) {
|
|
|
4385
4571
|
const modulesBlock = content.match(/<modules>([\s\S]*?)<\/modules>/);
|
|
4386
4572
|
if (!modulesBlock)
|
|
4387
4573
|
return false;
|
|
4388
|
-
const resolvedChild =
|
|
4574
|
+
const resolvedChild = path8.resolve(childDir);
|
|
4389
4575
|
for (const match of modulesBlock[1].matchAll(/<module>\s*([^<]+?)\s*<\/module>/g)) {
|
|
4390
|
-
if (pathsEqual(
|
|
4576
|
+
if (pathsEqual(path8.resolve(parentDir, match[1]), resolvedChild))
|
|
4391
4577
|
return true;
|
|
4392
4578
|
}
|
|
4393
4579
|
return false;
|
|
@@ -4409,24 +4595,20 @@ function JavaWorkspaceRoot() {
|
|
|
4409
4595
|
return root;
|
|
4410
4596
|
const sessionCwd = process.cwd();
|
|
4411
4597
|
const stop = sessionHoistCeiling(sessionCwd, file);
|
|
4412
|
-
let current = root;
|
|
4413
4598
|
let lastHop = root;
|
|
4414
|
-
const fsRoot =
|
|
4415
|
-
|
|
4599
|
+
const fsRoot = path8.parse(root).root;
|
|
4600
|
+
for (const current of walkUpDirs(root, { spelling: true })) {
|
|
4416
4601
|
if (stop !== void 0 && current === stop)
|
|
4417
4602
|
break;
|
|
4418
|
-
const parent =
|
|
4603
|
+
const parent = path8.dirname(current);
|
|
4419
4604
|
if (parent === current || parent === fsRoot)
|
|
4420
4605
|
break;
|
|
4421
|
-
if (await markerExists(parent, "pom.xml"))
|
|
4422
|
-
const parentPom = path7.join(parent, "pom.xml");
|
|
4423
|
-
if (!await declaresMavenModule(parent, parentPom, lastHop))
|
|
4424
|
-
break;
|
|
4425
|
-
current = parent;
|
|
4426
|
-
lastHop = parent;
|
|
4606
|
+
if (!await markerExists(parent, "pom.xml"))
|
|
4427
4607
|
continue;
|
|
4428
|
-
|
|
4429
|
-
|
|
4608
|
+
const parentPom = path8.join(parent, "pom.xml");
|
|
4609
|
+
if (!await declaresMavenModule(parent, parentPom, lastHop))
|
|
4610
|
+
break;
|
|
4611
|
+
lastHop = parent;
|
|
4430
4612
|
}
|
|
4431
4613
|
return enforceLspRootCeiling(lastHop, sessionCwd, file);
|
|
4432
4614
|
}, moduleRoot.rootMarkers ?? []);
|
|
@@ -4526,17 +4708,17 @@ var PHPServer = {
|
|
|
4526
4708
|
return {
|
|
4527
4709
|
...result,
|
|
4528
4710
|
initialization: {
|
|
4529
|
-
storagePath:
|
|
4711
|
+
storagePath: path8.join(getGlobalPiLensDir(), "intelephense")
|
|
4530
4712
|
}
|
|
4531
4713
|
};
|
|
4532
4714
|
}
|
|
4533
4715
|
};
|
|
4534
4716
|
function buildPsesArgs(bundleDir) {
|
|
4535
|
-
const script =
|
|
4536
|
-
const sessionDir =
|
|
4717
|
+
const script = path8.join(bundleDir, "PowerShellEditorServices", "Start-EditorServices.ps1");
|
|
4718
|
+
const sessionDir = path8.join(getGlobalPiLensDir(), "pses", `${process.pid}-${Date.now()}`);
|
|
4537
4719
|
mkdirSync2(sessionDir, { recursive: true });
|
|
4538
|
-
const logPath =
|
|
4539
|
-
const sessionDetailsPath =
|
|
4720
|
+
const logPath = path8.join(sessionDir, "pses.log");
|
|
4721
|
+
const sessionDetailsPath = path8.join(sessionDir, "session.json");
|
|
4540
4722
|
return [
|
|
4541
4723
|
"-NoLogo",
|
|
4542
4724
|
"-NoProfile",
|
|
@@ -4683,6 +4865,51 @@ var KotlinServer = {
|
|
|
4683
4865
|
}, options?.allowInstall);
|
|
4684
4866
|
}
|
|
4685
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
|
+
};
|
|
4686
4913
|
var LeanServer = createInteractiveServer({
|
|
4687
4914
|
id: "lean",
|
|
4688
4915
|
name: "Lean 4 Language Server",
|
|
@@ -4953,6 +5180,12 @@ var BashServer = {
|
|
|
4953
5180
|
// installed; when it is not, the shellcheck runner's dialect gate keeps
|
|
4954
5181
|
// zsh quiet instead of falling back to a zsh-illiterate analyzer.
|
|
4955
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
|
+
},
|
|
4956
5189
|
root: FileDirRoot,
|
|
4957
5190
|
// #2194 bounded the installer's own verification at 20s; the dispatch
|
|
4958
5191
|
// touch's client-wait floor stayed at the shared 5s default, so a cold
|
|
@@ -5198,8 +5431,8 @@ var VueServer = {
|
|
|
5198
5431
|
initializeTimeoutMs: 3e4,
|
|
5199
5432
|
async spawn(root, options) {
|
|
5200
5433
|
const tsserverPath = await findTsserverPath(root, options?.allowInstall, options);
|
|
5201
|
-
const hasPackageJson = existsSync3(
|
|
5202
|
-
const hasNodeModules = existsSync3(
|
|
5434
|
+
const hasPackageJson = existsSync3(path8.join(root, "package.json"));
|
|
5435
|
+
const hasNodeModules = existsSync3(path8.join(root, "node_modules"));
|
|
5203
5436
|
if (hasPackageJson && !hasNodeModules) {
|
|
5204
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.`);
|
|
5205
5438
|
}
|
|
@@ -5214,7 +5447,7 @@ var VueServer = {
|
|
|
5214
5447
|
return {
|
|
5215
5448
|
process: proc.process,
|
|
5216
5449
|
source: proc.source,
|
|
5217
|
-
initialization: tsserverPath ? { typescript: { tsdk:
|
|
5450
|
+
initialization: tsserverPath ? { typescript: { tsdk: path8.dirname(tsserverPath) } } : void 0
|
|
5218
5451
|
};
|
|
5219
5452
|
}
|
|
5220
5453
|
};
|
|
@@ -5256,7 +5489,7 @@ var SvelteServer = {
|
|
|
5256
5489
|
return {
|
|
5257
5490
|
process: proc.process,
|
|
5258
5491
|
source: proc.source,
|
|
5259
|
-
initialization: tsserverPath ? { typescript: { tsdk:
|
|
5492
|
+
initialization: tsserverPath ? { typescript: { tsdk: path8.dirname(tsserverPath) } } : void 0
|
|
5260
5493
|
};
|
|
5261
5494
|
}
|
|
5262
5495
|
};
|
|
@@ -5534,6 +5767,7 @@ var LSP_SERVERS = [
|
|
|
5534
5767
|
FSharpServer,
|
|
5535
5768
|
JavaServer,
|
|
5536
5769
|
KotlinServer,
|
|
5770
|
+
GroovyServer,
|
|
5537
5771
|
LeanServer,
|
|
5538
5772
|
SwiftServer,
|
|
5539
5773
|
DartServer,
|
|
@@ -5580,7 +5814,7 @@ function getServerById(id) {
|
|
|
5580
5814
|
}
|
|
5581
5815
|
|
|
5582
5816
|
// dist/clients/lsp/session-roots.js
|
|
5583
|
-
import
|
|
5817
|
+
import path9 from "node:path";
|
|
5584
5818
|
var SESSION_ROOT_CAP = 128;
|
|
5585
5819
|
var sessionRoots = new BoundedFifoMap(SESSION_ROOT_CAP);
|
|
5586
5820
|
function noteEvictedRoots(evicted) {
|
|
@@ -5595,21 +5829,21 @@ function noteEvictedRoots(evicted) {
|
|
|
5595
5829
|
return roots;
|
|
5596
5830
|
}
|
|
5597
5831
|
function registerSessionRoot(cwd) {
|
|
5598
|
-
const root =
|
|
5832
|
+
const root = path9.resolve(cwd);
|
|
5599
5833
|
if (sessionRoots.has(root))
|
|
5600
5834
|
return [];
|
|
5601
5835
|
return noteEvictedRoots(sessionRoots.set(root, void 0));
|
|
5602
5836
|
}
|
|
5603
5837
|
function setSessionRootConfig(cwd, config) {
|
|
5604
|
-
return noteEvictedRoots(sessionRoots.set(
|
|
5838
|
+
return noteEvictedRoots(sessionRoots.set(path9.resolve(cwd), config));
|
|
5605
5839
|
}
|
|
5606
5840
|
function isSameOrChildPath(filePath, candidateRoot) {
|
|
5607
5841
|
if (filePath === candidateRoot)
|
|
5608
5842
|
return true;
|
|
5609
|
-
return filePath.startsWith(`${candidateRoot}${
|
|
5843
|
+
return filePath.startsWith(`${candidateRoot}${path9.sep}`);
|
|
5610
5844
|
}
|
|
5611
5845
|
function sessionRootConfigForFile(filePath) {
|
|
5612
|
-
const resolvedFilePath =
|
|
5846
|
+
const resolvedFilePath = path9.resolve(filePath);
|
|
5613
5847
|
let bestMatch;
|
|
5614
5848
|
for (const [root, config] of sessionRoots) {
|
|
5615
5849
|
if (config === void 0)
|
|
@@ -5636,16 +5870,16 @@ function disabledPrimaries(filePath) {
|
|
|
5636
5870
|
};
|
|
5637
5871
|
}
|
|
5638
5872
|
function isSessionRootRegistered(cwd) {
|
|
5639
|
-
return sessionRoots.has(
|
|
5873
|
+
return sessionRoots.has(path9.resolve(cwd));
|
|
5640
5874
|
}
|
|
5641
5875
|
function shouldInitializeSessionRoot(cwd, readyRoots) {
|
|
5642
|
-
const normalized =
|
|
5876
|
+
const normalized = path9.resolve(cwd);
|
|
5643
5877
|
return !readyRoots.has(normalized) || !isSessionRootRegistered(normalized);
|
|
5644
5878
|
}
|
|
5645
5879
|
function isOutsideAllSessionRoots(filePath) {
|
|
5646
5880
|
if (sessionRoots.size === 0)
|
|
5647
5881
|
return false;
|
|
5648
|
-
const resolved =
|
|
5882
|
+
const resolved = path9.resolve(filePath);
|
|
5649
5883
|
for (const root of sessionRoots.keys()) {
|
|
5650
5884
|
if (isSameOrWithin(root, resolved))
|
|
5651
5885
|
return false;
|
|
@@ -5661,14 +5895,19 @@ export {
|
|
|
5661
5895
|
getAstGrepRuleSources,
|
|
5662
5896
|
getAstGrepRuleFingerprint,
|
|
5663
5897
|
registerRunnerId,
|
|
5898
|
+
runnerIdentityPopulated,
|
|
5899
|
+
isKnownRunnerId,
|
|
5664
5900
|
withLspProjectCodePermission,
|
|
5665
5901
|
refuseUntrustedLspExecution,
|
|
5666
5902
|
resolveAnalysisRootPath,
|
|
5667
5903
|
resolveAnalysisRoot,
|
|
5668
5904
|
canWriteAnalysisRoot,
|
|
5905
|
+
resolveSessionConfigRoot,
|
|
5669
5906
|
BUILTIN_SERVER_RUNNER_COVERS,
|
|
5670
5907
|
isAuxiliary,
|
|
5671
5908
|
serverTraits,
|
|
5909
|
+
isShellcheckDialectSupported,
|
|
5910
|
+
resolveShellFileDialect,
|
|
5672
5911
|
getStrategy,
|
|
5673
5912
|
classifyServerWaitTier,
|
|
5674
5913
|
classifyCascadeWaitTier,
|
|
@@ -5691,6 +5930,8 @@ export {
|
|
|
5691
5930
|
isOutsideAllSessionRoots,
|
|
5692
5931
|
getSessionRootsForTelemetry,
|
|
5693
5932
|
loadLSPConfig,
|
|
5933
|
+
newLspConfigProblems,
|
|
5934
|
+
disabledServerRecords,
|
|
5694
5935
|
customServerSpecsOf,
|
|
5695
5936
|
lspConfigOf,
|
|
5696
5937
|
registerLSPConfig,
|