pi-agent-ide 0.9.4 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +1 -1
- package/dist/{chunk-ZXO4D5UB.js → chunk-2AANEKFS.js} +1 -1
- package/dist/{chunk-BU7IZLKB.js → chunk-2DSY4U73.js} +1 -1
- package/dist/chunk-2YO6RVX4.js +1 -0
- package/dist/{chunk-WES2E4VR.js → chunk-33U3RUM3.js} +1 -1
- package/dist/{chunk-CJPS4GXD.js → chunk-34IYWKY5.js} +1 -1
- package/dist/{chunk-2TTSJOLO.js → chunk-4CSNQX54.js} +1 -1
- package/dist/{chunk-DAZQSXUW.js → chunk-53IV6EKV.js} +1 -1
- package/dist/{chunk-7PVDTMEM.js → chunk-5AROEOJB.js} +1 -1
- package/dist/{chunk-IG5DXVDJ.js → chunk-5D4C225L.js} +1 -1
- package/dist/{chunk-GHO6TCPJ.js → chunk-5DN2XBVI.js} +1 -1
- package/dist/{chunk-FHRHYY4M.js → chunk-5W6QQZFI.js} +1 -1
- package/dist/{chunk-5PC5INOL.js → chunk-6W4OJLCJ.js} +1 -1
- package/dist/chunk-6ZYCTWQE.js +1 -0
- package/dist/{chunk-B25LXXNV.js → chunk-72FL5FHZ.js} +1 -1
- package/dist/{chunk-BB4A5UI3.js → chunk-7JWZPJI5.js} +1 -1
- package/dist/{chunk-T3Z4KXOX.js → chunk-AMSNDWBT.js} +1 -1
- package/dist/{chunk-DFXXT6MJ.js → chunk-APWMLLSE.js} +6 -6
- package/dist/{chunk-NA2NEU4V.js → chunk-B5UJCNQU.js} +1 -1
- package/dist/chunk-BMSAVDRD.js +13 -0
- package/dist/{chunk-MPNE25CY.js → chunk-BRJIXNFU.js} +1 -1
- package/dist/chunk-C2GZLLSP.js +5 -0
- package/dist/{chunk-XCPIIDFS.js → chunk-DHOIQZUF.js} +1 -1
- package/dist/chunk-ECSMTGVM.js +6 -0
- package/dist/{chunk-DEP55R35.js → chunk-EHFWODRT.js} +1 -1
- package/dist/{chunk-6WCHBHFW.js → chunk-EWTVVPUA.js} +1 -1
- package/dist/{chunk-H3GEEOOL.js → chunk-FBR7ZLLN.js} +1 -1
- package/dist/{chunk-UD3DMY3Q.js → chunk-FGN2ZMEN.js} +1 -1
- package/dist/{chunk-MKDOT76B.js → chunk-FJSYWOE6.js} +1 -1
- package/dist/{chunk-LF325WYO.js → chunk-FTECKRK6.js} +1 -1
- package/dist/chunk-GRZTKMXQ.js +1 -0
- package/dist/chunk-H6FEBUAP.js +1 -0
- package/dist/{chunk-FYOU4RBH.js → chunk-HFCHOFLV.js} +1 -1
- package/dist/chunk-HFF4GY7R.js +3 -0
- package/dist/{chunk-QJ6V5IAY.js → chunk-HJXSEPO7.js} +14 -12
- package/dist/{chunk-SRFWT562.js → chunk-HSEDKYH4.js} +1 -1
- package/dist/{chunk-6P7LTQZT.js → chunk-II7AOJNH.js} +1 -1
- package/dist/chunk-J6CDIH3S.js +84 -0
- package/dist/{chunk-USG6WHAT.js → chunk-JHWLRL4U.js} +1 -1
- package/dist/{chunk-35LZOKEW.js → chunk-JMQ67UNK.js} +1 -1
- package/dist/{chunk-7OUML24Z.js → chunk-JRIP33PC.js} +1 -1
- package/dist/chunk-JXULBI4S.js +2 -0
- package/dist/chunk-JYITLCXC.js +1 -0
- package/dist/{chunk-4IWEKRSP.js → chunk-KJAR2WDO.js} +1 -1
- package/dist/{chunk-GS5ZRTUG.js → chunk-KQV2ZXLP.js} +1 -1
- package/dist/{chunk-AMIIOWFL.js → chunk-KX7MG72M.js} +1 -1
- package/dist/{chunk-HGCJDIRR.js → chunk-LIGOOMJS.js} +5 -5
- package/dist/{chunk-OMNKD7WW.js → chunk-LY2UANKU.js} +3 -3
- package/dist/chunk-M7P7V4WI.js +25 -0
- package/dist/chunk-N2NEFXHB.js +13 -0
- package/dist/{chunk-2TZDG2JH.js → chunk-NF74ITWT.js} +2 -2
- package/dist/{chunk-AP2BOC24.js → chunk-NQYUIQRH.js} +1 -1
- package/dist/{chunk-7C73WVPB.js → chunk-OCU6NW5Y.js} +1 -1
- package/dist/chunk-OIEA4QWF.js +4 -0
- package/dist/{chunk-FXPY3V4L.js → chunk-ON5HDFNL.js} +1 -1
- package/dist/{chunk-U2N73BUY.js → chunk-P43GGKUC.js} +5 -5
- package/dist/{chunk-5BGWNYQS.js → chunk-P7FUD4WY.js} +1 -1
- package/dist/{chunk-VMLPXSMK.js → chunk-PPCWY4BB.js} +1 -1
- package/dist/{chunk-YPYROPQF.js → chunk-QGXZ4RWX.js} +1 -1
- package/dist/chunk-S3T5NOSL.js +1 -0
- package/dist/chunk-S7E2D5K7.js +5 -0
- package/dist/{chunk-DDH3FP4G.js → chunk-SIYPD5MM.js} +3 -3
- package/dist/{chunk-6A3ORNW3.js → chunk-T5ACAOKJ.js} +3 -3
- package/dist/chunk-TILMPAF2.js +1 -0
- package/dist/{chunk-RIJRPAL2.js → chunk-TSNY2FSU.js} +1 -1
- package/dist/{chunk-UI4KSKS3.js → chunk-TWJINFQB.js} +4 -4
- package/dist/chunk-TWQ6ACOI.js +1 -0
- package/dist/chunk-UDVVKVG4.js +1 -0
- package/dist/{chunk-WQIMM4SU.js → chunk-V2D5MLGE.js} +1 -1
- package/dist/{chunk-PQWANILR.js → chunk-VDSSAP6Y.js} +1 -1
- package/dist/{chunk-AVJVTF5H.js → chunk-VHYJTAXX.js} +1 -1
- package/dist/{chunk-MJFY4RGT.js → chunk-WCSWQDJ2.js} +1 -1
- package/dist/{chunk-JWSJCEIB.js → chunk-WQTF6Q2X.js} +1 -1
- package/dist/chunk-YFPU2LRR.js +23 -0
- package/dist/{chunk-KWJD7FBS.js → chunk-YLEERRX3.js} +14 -14
- package/dist/chunk-YNOR4LIE.js +1 -0
- package/dist/{chunk-WEE3NM6L.js → chunk-YOJHCARZ.js} +1 -1
- package/dist/chunk-YPTDPMK5.js +1 -0
- package/dist/{chunk-GXL4NMHR.js → chunk-YZTVC7ME.js} +1 -1
- package/dist/entry-0.js +1 -1
- package/dist/entry-10.js +1 -1
- package/dist/entry-11.js +1 -1
- package/dist/entry-12.js +1 -1
- package/dist/entry-14.js +1 -1
- package/dist/entry-15.js +1 -1
- package/dist/entry-17.js +1 -1
- package/dist/entry-19.js +1 -1
- package/dist/entry-2.js +1 -1
- package/dist/entry-20.js +1 -1
- package/dist/entry-21.js +1 -1
- package/dist/entry-22.js +1 -1
- package/dist/entry-25.js +1 -1
- package/dist/entry-31.js +2 -2
- package/dist/entry-32.js +1 -1
- package/dist/entry-33.js +1 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +1 -1
- package/dist/entry-36.js +1 -1
- package/dist/entry-37.js +1 -1
- package/dist/entry-38.js +13 -13
- package/dist/entry-39.js +1 -1
- package/dist/entry-4.js +1 -1
- package/dist/entry-40.js +1 -1
- package/dist/entry-41.js +1 -1
- package/dist/entry-42.js +1 -1
- package/dist/entry-43.js +1 -1
- package/dist/entry-44.js +1 -1
- package/dist/entry-48.js +1 -1
- package/dist/entry-49.js +1 -1
- package/dist/entry-50.js +1 -1
- package/dist/entry-51.js +1 -1
- package/dist/entry-52.js +1 -1
- package/dist/entry-53.js +1 -1
- package/dist/entry-56.js +1 -1
- package/dist/entry-57.js +1 -1
- package/dist/entry-58.js +1 -1
- package/dist/entry-59.js +1 -1
- package/dist/entry-60.js +1 -1
- package/dist/entry-61.js +1 -1
- package/dist/entry-62.js +1 -1
- package/dist/entry-63.js +1 -1
- package/dist/entry-64.js +1 -1
- package/dist/entry-65.js +1 -1
- package/dist/entry-66.js +1 -1
- package/dist/entry-67.js +1 -1
- package/dist/entry-69.js +1 -1
- package/dist/entry-72.js +1 -1
- package/dist/entry-74.js +1 -1
- package/dist/entry-75.js +1 -1
- package/dist/entry-77.js +1 -1
- package/dist/entry-79.js +1 -1
- package/dist/entry-8.js +1 -1
- package/dist/entry-82.js +1 -1
- package/dist/entry-84.js +1 -1
- package/dist/entry-85.js +1 -1
- package/dist/entry-86.js +1 -1
- package/dist/entry-87.js +1 -1
- package/dist/entry-90.js +1 -1
- package/dist/entry-91.js +1 -1
- package/dist/entry-92.js +1 -1
- package/dist/entry-93.js +1 -1
- package/dist/entry-94.js +1 -1
- package/dist/pi-agent-ide.js +11 -11
- package/docs/development.md +2 -0
- package/docs/generated/tool-catalog/python.md +1 -0
- package/docs/tools.md +2 -0
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-doctor/src/connect-plugin.ts +2 -2
- package/node_modules/pi-agent-doctor/src/evidence.ts +1 -1
- package/node_modules/pi-agent-doctor/src/fixtures/executable-probe.ts +2 -2
- package/node_modules/pi-agent-doctor/src/plugin-protocol.ts +4 -4
- package/node_modules/pi-agent-doctor/src/project-probes.ts +2 -2
- package/node_modules/pi-agent-doctor/src/workspace.ts +2 -2
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/index.ts +2 -2
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem/src/file-write-lock.ts +70 -0
- package/node_modules/pi-agent-filesystem/src/replace-file.ts +50 -0
- package/node_modules/pi-agent-filesystem/src/resolver.ts +28 -8
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/index.ts +1 -1
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-jq/src/api/jq.ts +1 -1
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/index.ts +1 -1
- package/node_modules/pi-agent-ide-ast/package.json +13 -13
- package/node_modules/pi-agent-ide-ast/src/api/scope.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +33 -11
- package/node_modules/pi-agent-ide-ast/src/ast/native-parser.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/ast/outline.ts +60 -55
- package/node_modules/pi-agent-ide-ast/src/doctor-plugin.ts +4 -3
- package/node_modules/pi-agent-ide-ast/src/extension.ts +10 -10
- package/node_modules/pi-agent-ide-ast/src/outline-resolver.ts +3 -3
- package/node_modules/pi-agent-ide-ast/src/overflow-handler.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/scope-handler.ts +35 -8
- package/node_modules/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/node_modules/pi-agent-ide-ast/src/search-resolver.ts +161 -23
- package/node_modules/pi-agent-ide-ast/src/tool-ast-search.ts +1 -1
- package/node_modules/pi-agent-ide-changes/index.ts +9 -9
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-changes/src/change-anchor.ts +4 -4
- package/node_modules/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
- package/node_modules/pi-agent-ide-changes/src/changes/change-service.ts +4 -4
- package/node_modules/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -1
- package/node_modules/pi-agent-ide-changes/src/current-change-presenter.ts +4 -4
- package/node_modules/pi-agent-ide-changes/src/tool-index-change.ts +5 -5
- package/node_modules/pi-agent-ide-changes/src/tool-text-undo.ts +6 -6
- package/node_modules/pi-agent-ide-formatter/index.ts +5 -5
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-formatter/src/doctor-plugin.ts +2 -2
- package/node_modules/pi-agent-ide-formatter/src/formatter.ts +2 -2
- package/node_modules/pi-agent-ide-formatter/src/registry.ts +1 -1
- package/node_modules/pi-agent-ide-languages/index.ts +1 -1
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/index.ts +9 -9
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lint/src/catalog.ts +4 -0
- package/node_modules/pi-agent-ide-lint/src/command-linter.ts +15 -6
- package/node_modules/pi-agent-ide-lint/src/diagnostics.ts +8 -14
- package/node_modules/pi-agent-ide-lint/src/doctor-plugin.ts +3 -3
- package/node_modules/pi-agent-ide-lint/src/registry.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/index.ts +37 -16
- package/node_modules/pi-agent-ide-lsp/package.json +12 -12
- package/node_modules/pi-agent-ide-lsp/src/catalog.ts +12 -1
- package/node_modules/pi-agent-ide-lsp/src/declaration-targets.ts +21 -14
- package/node_modules/pi-agent-ide-lsp/src/diagnostic-source.ts +63 -20
- package/node_modules/pi-agent-ide-lsp/src/doctor-plugin.ts +4 -4
- package/node_modules/pi-agent-ide-lsp/src/idle-timeout.ts +15 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/abort.ts +11 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/client.ts +434 -80
- package/node_modules/pi-agent-ide-lsp/src/lsp/code-views.ts +121 -35
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/diagnostics.ts +26 -12
- package/node_modules/pi-agent-ide-lsp/src/lsp/document-leases.ts +31 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/errors.ts +4 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/file-watchers.ts +1 -77
- package/node_modules/pi-agent-ide-lsp/src/lsp/index.ts +19 -19
- package/node_modules/pi-agent-ide-lsp/src/lsp/language-map.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +5 -4
- package/node_modules/pi-agent-ide-lsp/src/lsp/manager.ts +59 -28
- package/node_modules/pi-agent-ide-lsp/src/lsp/navigation.ts +42 -22
- package/node_modules/pi-agent-ide-lsp/src/lsp/owner-transport.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/position-map.ts +52 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/project.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/lsp/registry.ts +2 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/rename.ts +2 -2
- package/node_modules/pi-agent-ide-lsp/src/lsp/server-request-handlers.mjs +325 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +797 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/shared-servers.ts +322 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/source-changes.ts +29 -0
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbol-search.ts +76 -17
- package/node_modules/pi-agent-ide-lsp/src/lsp/symbols.ts +3 -3
- package/node_modules/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/manager-provider.ts +1 -1
- package/node_modules/pi-agent-ide-lsp/src/rename-plan.ts +16 -8
- package/node_modules/pi-agent-ide-lsp/src/search-resolver.ts +149 -134
- package/node_modules/pi-agent-ide-lsp/src/tool-lsp-search.ts +1 -1
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-image/src/index.ts +1 -1
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-pdf/src/index.ts +1 -1
- package/node_modules/pi-agent-read/index.ts +1 -1
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-read/src/api/connect-plugin.ts +1 -1
- package/node_modules/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-read/src/api/read-parameters.ts +1 -1
- package/node_modules/pi-agent-read/src/api/rendering.ts +2 -2
- package/node_modules/pi-agent-read/src/api/tools/read.ts +8 -2
- package/node_modules/pi-agent-read/src/core/extension.ts +4 -4
- package/node_modules/pi-agent-read/src/core/read-core.ts +4 -4
- package/node_modules/pi-agent-read/src/core/tools/read/output-truncation.ts +2 -2
- package/node_modules/pi-agent-read/src/core/tools/read/persisted-result.ts +1 -1
- package/node_modules/pi-agent-read/src/core/tools/read/raw-read.ts +3 -3
- package/node_modules/pi-agent-read/src/core/tools/read/read-renderer.ts +4 -4
- package/node_modules/pi-agent-read/src/core/tools/read/read-result.ts +21 -14
- package/node_modules/pi-agent-read/src/core/tools/read/result-target.ts +24 -18
- package/node_modules/pi-agent-read/src/core/tools/read/structured-result.ts +2 -2
- package/node_modules/pi-agent-read/src/core/tools/tool-read.ts +44 -18
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/connect-plugin.ts +4 -4
- package/node_modules/pi-agent-resource/src/content-conversion/content-converter.ts +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-description.ts +1 -1
- package/node_modules/pi-agent-resource/src/content-conversion/content-host.ts +4 -4
- package/node_modules/pi-agent-resource/src/content-conversion/content-runner.ts +3 -3
- package/node_modules/pi-agent-resource/src/content-conversion/plugin-protocol.ts +2 -2
- package/node_modules/pi-agent-resource/src/content-conversion/validation.ts +2 -2
- package/node_modules/pi-agent-resource/src/index.ts +19 -19
- package/node_modules/pi-agent-resource/src/resolver.ts +1 -1
- package/node_modules/pi-agent-resource/src/resource-access.ts +1 -1
- package/node_modules/pi-agent-resource/src/resource-error.ts +1 -1
- package/node_modules/pi-agent-resource/src/resource.ts +1 -1
- package/node_modules/pi-agent-resource/src/result-images.ts +1 -1
- package/node_modules/pi-agent-resource/src/result-targets.ts +23 -2
- package/node_modules/pi-agent-resource/src/temp-resource-store.ts +2 -2
- package/node_modules/pi-agent-resource/src/tool-result.ts +2 -2
- package/node_modules/pi-agent-resource/src/validation.ts +3 -3
- package/node_modules/pi-agent-search/index.ts +1 -1
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search/src/api/connect-plugin.ts +1 -1
- package/node_modules/pi-agent-search/src/api/fuzzy.ts +2 -2
- package/node_modules/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/node_modules/pi-agent-search/src/api/presentation.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search-scope.ts +1 -1
- package/node_modules/pi-agent-search/src/api/search.ts +7 -7
- package/node_modules/pi-agent-search/src/core/extension.ts +7 -7
- package/node_modules/pi-agent-search/src/core/search-core.ts +3 -3
- package/node_modules/pi-agent-search-text/index.ts +8 -8
- package/node_modules/pi-agent-search-text/package.json +10 -10
- package/node_modules/pi-agent-search-text/src/doctor-plugin.ts +1 -1
- package/node_modules/pi-agent-search-text/src/file-search.ts +1 -1
- package/node_modules/pi-agent-search-text/src/fuzzy-search.ts +2 -2
- package/node_modules/pi-agent-search-text/src/persisted-result.ts +1 -1
- package/node_modules/pi-agent-search-text/src/resolvers.ts +9 -9
- package/node_modules/pi-agent-search-text/src/scoped-search.ts +4 -4
- package/node_modules/pi-agent-search-text/src/search-backend.ts +3 -3
- package/node_modules/pi-agent-search-text/src/search-presentation.ts +1 -1
- package/node_modules/pi-agent-search-text/src/search-recipe.ts +2 -2
- package/node_modules/pi-agent-search-text/src/search-renderer.ts +3 -3
- package/node_modules/pi-agent-search-text/src/search-result.ts +2 -2
- package/node_modules/pi-agent-search-text/src/search-session.ts +132 -67
- package/node_modules/pi-agent-search-text/src/tool-file-search.ts +1 -1
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text/src/index.ts +7 -7
- package/node_modules/pi-agent-text/src/source-line.ts +1 -1
- package/node_modules/pi-agent-text/src/text-document.ts +50 -2
- package/node_modules/pi-agent-text-anchor-constant/index.ts +1 -1
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/index.ts +2 -2
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/src/anchor.ts +63 -48
- package/node_modules/pi-agent-text-anchor-exact/src/recovery.ts +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/index.ts +2 -2
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-anchor-line-hash/src/read-handler.ts +23 -12
- package/node_modules/pi-agent-text-editor/index.ts +5 -5
- package/node_modules/pi-agent-text-editor/package.json +9 -9
- package/node_modules/pi-agent-text-editor/src/api/connect-plugin.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/file-operations.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/file-transfers.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/mutation-guard.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/api/mutation-result.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/api/mutation-tool.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/api/native-edit-batch-event.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/native-files.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/plugin-protocol.ts +14 -14
- package/node_modules/pi-agent-text-editor/src/api/post-edit.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/api/tool-renderer.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/delete-policy.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/diff-tool.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/extension.ts +13 -13
- package/node_modules/pi-agent-text-editor/src/core/file-operation-guards.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -6
- package/node_modules/pi-agent-text-editor/src/core/file-operations.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/file-transfers.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/image-write.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +11 -6
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/diff.ts +213 -20
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +39 -3
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/mutation-result-targets.ts +6 -6
- package/node_modules/pi-agent-text-editor/src/core/native-text-edit-batch.ts +22 -22
- package/node_modules/pi-agent-text-editor/src/core/post-edit-scope.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/read-fragment-resolver.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/result-input.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/result-target-anchors.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/result-transfer.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/source-change-retry.ts +41 -0
- package/node_modules/pi-agent-text-editor/src/core/structured-result.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/temporary-directories.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-recovery.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/text-anchor-registry.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/core/text-change-engine.ts +4 -7
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +34 -21
- package/node_modules/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/text-edit-origin.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/text-editor-core.ts +72 -30
- package/node_modules/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/text-mutation.ts +211 -159
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +1 -1
- package/node_modules/pi-agent-text-editor/src/core/write-agent-result.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/tools/extension.ts +7 -7
- package/node_modules/pi-agent-text-editor/src/tools/text-selection.ts +2 -2
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-copy.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-insert.ts +3 -3
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -5
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-replace.ts +4 -4
- package/node_modules/pi-agent-text-editor/src/tools/tool-text-write.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/index.ts +5 -5
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-renderer/src/diff-renderer.ts +3 -3
- package/node_modules/pi-agent-text-editor-renderer/src/diff-viewport.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/frozen-viewport.ts +2 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -4
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-projection.ts +2 -2
- package/node_modules/pi-agent-text-editor-renderer/src/mutation-result.ts +3 -3
- package/node_modules/pi-agent-text-editor-renderer/src/persisted-result.ts +2 -2
- package/node_modules/pi-agent-text-editor-renderer/src/render-resource.ts +1 -1
- package/node_modules/pi-agent-text-editor-renderer/src/renderer.ts +7 -7
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
- package/node_modules/pi-agent-tool-call-interception/src/index.ts +32 -9
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- package/node_modules/pi-agent-tool-ui/src/index.ts +1 -1
- package/node_modules/pi-agent-tool-ui/src/result-panel.ts +1 -1
- package/node_modules/pi-agent-web/index.ts +3 -3
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web/src/doctor-plugin.ts +1 -1
- package/node_modules/pi-agent-web/src/resolver.ts +1 -1
- package/node_modules/pi-agent-web-html/index.ts +1 -1
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-html/src/html-converter.ts +1 -1
- package/node_modules/pi-agent-web-image/package.json +3 -3
- package/node_modules/pi-agent-web-pdf/package.json +3 -3
- package/node_modules/pi-agent-web-text/package.json +3 -3
- package/package.json +36 -36
- package/src/api/code-view.ts +3 -3
- package/src/api/connect-plugin.ts +1 -1
- package/src/api/connect-tip-provider.ts +2 -2
- package/src/api/doctor-runtime.ts +1 -1
- package/src/api/doctor.ts +1 -1
- package/src/api/hooks.ts +2 -2
- package/src/api/plugin-protocol.ts +1 -1
- package/src/api/settings.ts +6 -1
- package/src/api/standalone.ts +1 -1
- package/src/api/tips.ts +1 -1
- package/src/api/tool-config/linters.json +1 -1
- package/src/api/tool-config/lsp-servers.json +11 -0
- package/src/api/tool-config.ts +45 -5
- package/src/api/toolchain.ts +3 -3
- package/src/backend/config.ts +2 -2
- package/src/backend/configured-process.ts +5 -5
- package/src/backend/dap-java-transport.ts +6 -6
- package/src/backend/dap-node-transport.ts +5 -5
- package/src/backend/dap-tcp-transport.ts +3 -3
- package/src/backend/dap-transport.ts +5 -5
- package/src/backend/debugger-registration.ts +7 -7
- package/src/backend/debugger-workspace-owner.ts +10 -10
- package/src/backend/doctor-registration.ts +5 -5
- package/src/backend/doctor-workspace.ts +13 -13
- package/src/backend/file-operation-resolver.ts +5 -5
- package/src/backend/file-revision.ts +1 -1
- package/src/backend/file-transfer.ts +4 -4
- package/src/backend/formatter-registration.ts +11 -11
- package/src/backend/git-registration.ts +4 -4
- package/src/backend/index.ts +3 -3
- package/src/backend/lint-registration.ts +11 -11
- package/src/backend/lsp-file-watchers.ts +5 -5
- package/src/backend/lsp-registration.ts +11 -11
- package/src/backend/lsp-transport.ts +7 -7
- package/src/backend/lsp-workspace-owner.ts +4 -4
- package/src/backend/object-transfer.ts +5 -5
- package/src/backend/owned-command.ts +2 -2
- package/src/backend/owned-process-stop.ts +4 -4
- package/src/backend/owned-read-command.ts +2 -2
- package/src/backend/process-environment.ts +2 -2
- package/src/backend/process-metadata.ts +2 -2
- package/src/backend/recipe-evidence.ts +2 -2
- package/src/backend/registration.ts +8 -8
- package/src/backend/registry.ts +2 -2
- package/src/backend/resource-resolver.ts +2 -2
- package/src/backend/search-environment.ts +3 -3
- package/src/backend/ssh-channel.ts +3 -3
- package/src/backend/ssh-transport.ts +2 -2
- package/src/backend/ssh.ts +6 -6
- package/src/backend/tool-config-access.ts +4 -4
- package/src/backend/tool-project.ts +5 -5
- package/src/backend/web-browser.ts +3 -3
- package/src/backend/web-http.ts +2 -2
- package/src/backend/web-owner.ts +5 -5
- package/src/backend/web-registration.ts +5 -5
- package/src/code-review/extension.ts +3 -3
- package/src/code-review/reviewer.ts +2 -2
- package/src/code-view/diagnostic-view.ts +4 -4
- package/src/composite/builtin-extensions.ts +37 -37
- package/src/composite/capabilities.ts +2 -2
- package/src/composite/capability-schemas.ts +1 -1
- package/src/composite/detached-results.ts +32 -0
- package/src/composite/extensions-config.ts +2 -2
- package/src/composite/module-settings-store.ts +2 -2
- package/src/composite/module-settings.ts +12 -12
- package/src/composite/nested-tool-rendering.ts +3 -3
- package/src/composite/output-limits.ts +6 -1
- package/src/composite/preferences.ts +10 -0
- package/src/composite/presets.ts +1 -1
- package/src/composite/reload-required.ts +6 -6
- package/src/composite/settings-documentation.ts +5 -5
- package/src/composite/settings-registry.ts +4 -4
- package/src/composite/text-results.ts +2 -2
- package/src/core/diagnostic-entry.ts +2 -2
- package/src/core/diagnostic-store.ts +3 -3
- package/src/core/extension.ts +8 -8
- package/src/core/ide-core.ts +4 -4
- package/src/doctor/config-writer.ts +3 -3
- package/src/doctor/core.ts +2 -2
- package/src/doctor/discovery.ts +4 -4
- package/src/doctor/extension.ts +7 -7
- package/src/doctor/index.ts +1 -1
- package/src/doctor/inventory.ts +1 -1
- package/src/doctor/run.ts +6 -6
- package/src/doctor/tip-provider.ts +2 -2
- package/src/documentation/extension.ts +3 -3
- package/src/documentation/registry.ts +1 -1
- package/src/documentation/search.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/index.ts +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/index.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/src/api/jq.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/file-write-lock.ts +70 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/replace-file.ts +50 -0
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/src/resolver.ts +28 -8
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/index.ts +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/index.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/src/html-converter.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/doctor-plugin.ts +1 -1
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/src/resolver.ts +1 -1
- package/src/extensions/pi-agent-read/index.ts +1 -1
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-read/src/api/connect-plugin.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/read-parameters.ts +1 -1
- package/src/extensions/pi-agent-read/src/api/rendering.ts +2 -2
- package/src/extensions/pi-agent-read/src/api/tools/read.ts +8 -2
- package/src/extensions/pi-agent-read/src/core/extension.ts +4 -4
- package/src/extensions/pi-agent-read/src/core/read-core.ts +4 -4
- package/src/extensions/pi-agent-read/src/core/tools/read/output-truncation.ts +2 -2
- package/src/extensions/pi-agent-read/src/core/tools/read/persisted-result.ts +1 -1
- package/src/extensions/pi-agent-read/src/core/tools/read/raw-read.ts +3 -3
- package/src/extensions/pi-agent-read/src/core/tools/read/read-renderer.ts +4 -4
- package/src/extensions/pi-agent-read/src/core/tools/read/read-result.ts +21 -14
- package/src/extensions/pi-agent-read/src/core/tools/read/result-target.ts +24 -18
- package/src/extensions/pi-agent-read/src/core/tools/read/structured-result.ts +2 -2
- package/src/extensions/pi-agent-read/src/core/tools/tool-read.ts +44 -18
- package/src/extensions/pi-agent-search/index.ts +1 -1
- package/src/extensions/pi-agent-search/package.json +5 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/index.ts +8 -8
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +10 -10
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/doctor-plugin.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/file-search.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/fuzzy-search.ts +2 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/persisted-result.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/resolvers.ts +9 -9
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/scoped-search.ts +4 -4
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-backend.ts +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-presentation.ts +1 -1
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-recipe.ts +2 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-renderer.ts +3 -3
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-result.ts +2 -2
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/search-session.ts +132 -67
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/src/tool-file-search.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/connect-plugin.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/fuzzy.ts +2 -2
- package/src/extensions/pi-agent-search/src/api/plugin-protocol.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/presentation.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search-scope.ts +1 -1
- package/src/extensions/pi-agent-search/src/api/search.ts +7 -7
- package/src/extensions/pi-agent-search/src/core/extension.ts +7 -7
- package/src/extensions/pi-agent-search/src/core/search-core.ts +3 -3
- package/src/extensions/pi-agent-text-editor/index.ts +5 -5
- package/src/extensions/pi-agent-text-editor/package.json +9 -9
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/index.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/index.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/anchor.ts +63 -48
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/src/recovery.ts +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/index.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/src/read-handler.ts +23 -12
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/index.ts +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-renderer.ts +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/diff-viewport.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/frozen-viewport.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-panel.ts +4 -4
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-projection.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/mutation-result.ts +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/persisted-result.ts +2 -2
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/render-resource.ts +1 -1
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/src/renderer.ts +7 -7
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/src/api/connect-plugin.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/edit-pipeline.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/file-operations.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/file-transfers.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/mutation-guard.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/api/mutation-result.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/api/mutation-tool.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/api/native-edit-batch-event.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/native-files.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/plugin-protocol.ts +14 -14
- package/src/extensions/pi-agent-text-editor/src/api/post-edit.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/api/tool-call-interceptor.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/api/tool-renderer.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/delete-policy.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/diff-tool.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/extension.ts +13 -13
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-guards.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/file-operation-tools.ts +6 -6
- package/src/extensions/pi-agent-text-editor/src/core/file-operations.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/core/file-result-targets.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/file-transfers.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/image-write.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/agent-diff.ts +11 -6
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/diff.ts +213 -20
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/file-mutation-agent-result.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/final-state-fragment.ts +39 -3
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/grouped-replacements.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result/inline-hints.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/mutation-result-targets.ts +6 -6
- package/src/extensions/pi-agent-text-editor/src/core/native-text-edit-batch.ts +22 -22
- package/src/extensions/pi-agent-text-editor/src/core/post-edit-scope.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/read-fragment-resolver.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/result-input.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/result-target-anchors.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/result-transfer.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/source-change-retry.ts +41 -0
- package/src/extensions/pi-agent-text-editor/src/core/structured-result.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/temporary-directories.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-recovery.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-anchor-registry.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/core/text-change-engine.ts +4 -7
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-coordinator.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-recovery.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch-registrar.ts +34 -21
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-batch.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/text-edit-origin.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-editor-core.ts +72 -30
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation-anchor-error.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/text-mutation.ts +211 -159
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/coordinator.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/core/tool-call-interceptor/streaming-provider.ts +1 -1
- package/src/extensions/pi-agent-text-editor/src/core/write-agent-result.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/tools/extension.ts +7 -7
- package/src/extensions/pi-agent-text-editor/src/tools/text-selection.ts +2 -2
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-copy.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-delete.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-insert.ts +3 -3
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-move.ts +5 -5
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-replace.ts +4 -4
- package/src/extensions/pi-agent-text-editor/src/tools/tool-text-write.ts +1 -1
- package/src/index.ts +1 -1
- package/src/pi-agent-ide.ts +22 -20
- package/src/plugins/pi-agent-ide-ast/index.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/api/scope.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +33 -11
- package/src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/ast/outline.ts +60 -55
- package/src/plugins/pi-agent-ide-ast/src/doctor-plugin.ts +4 -3
- package/src/plugins/pi-agent-ide-ast/src/extension.ts +10 -10
- package/src/plugins/pi-agent-ide-ast/src/outline-resolver.ts +3 -3
- package/src/plugins/pi-agent-ide-ast/src/overflow-handler.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/scope-handler.ts +35 -8
- package/src/plugins/pi-agent-ide-ast/src/scope-resolver.ts +1 -1
- package/src/plugins/pi-agent-ide-ast/src/search-resolver.ts +161 -23
- package/src/plugins/pi-agent-ide-ast/src/tool-ast-search.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/index.ts +9 -9
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-changes/src/change-anchor.ts +4 -4
- package/src/plugins/pi-agent-ide-changes/src/changes/change-groups.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/src/changes/change-service.ts +4 -4
- package/src/plugins/pi-agent-ide-changes/src/changes/git-changes-backend.ts +1 -1
- package/src/plugins/pi-agent-ide-changes/src/current-change-presenter.ts +4 -4
- package/src/plugins/pi-agent-ide-changes/src/tool-index-change.ts +5 -5
- package/src/plugins/pi-agent-ide-changes/src/tool-text-undo.ts +6 -6
- package/src/plugins/pi-agent-ide-debugger/index.ts +21 -13
- package/src/plugins/pi-agent-ide-debugger/src/breakpoint-view.ts +1 -1
- package/src/plugins/pi-agent-ide-debugger/src/doctor-plugin.ts +4 -4
- package/src/plugins/pi-agent-ide-debugger/src/java-runtime.ts +2 -2
- package/src/plugins/pi-agent-ide-debugger/src/process-provider.ts +3 -3
- package/src/plugins/pi-agent-ide-debugger/src/renderer.ts +1 -1
- package/src/plugins/pi-agent-ide-debugger/src/session-manager.ts +5 -5
- package/src/plugins/pi-agent-ide-debugger/src/ui.ts +1 -1
- package/src/plugins/pi-agent-ide-debugger/src/vscode-backend.ts +1 -1
- package/src/plugins/pi-agent-ide-debugger/src/workspace-owner.ts +2 -2
- package/src/plugins/pi-agent-ide-diagnostics/index.ts +1 -1
- package/src/plugins/pi-agent-ide-formatter/index.ts +5 -5
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-formatter/src/doctor-plugin.ts +2 -2
- package/src/plugins/pi-agent-ide-formatter/src/formatter.ts +2 -2
- package/src/plugins/pi-agent-ide-formatter/src/registry.ts +1 -1
- package/src/plugins/pi-agent-ide-languages/index.ts +1 -1
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/index.ts +9 -9
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lint/src/catalog.ts +4 -0
- package/src/plugins/pi-agent-ide-lint/src/command-linter.ts +15 -6
- package/src/plugins/pi-agent-ide-lint/src/diagnostics.ts +8 -14
- package/src/plugins/pi-agent-ide-lint/src/doctor-plugin.ts +3 -3
- package/src/plugins/pi-agent-ide-lint/src/registry.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/index.ts +37 -16
- package/src/plugins/pi-agent-ide-lsp/package.json +12 -12
- package/src/plugins/pi-agent-ide-lsp/src/catalog.ts +12 -1
- package/src/plugins/pi-agent-ide-lsp/src/declaration-targets.ts +21 -14
- package/src/plugins/pi-agent-ide-lsp/src/diagnostic-source.ts +63 -20
- package/src/plugins/pi-agent-ide-lsp/src/doctor-plugin.ts +4 -4
- package/src/plugins/pi-agent-ide-lsp/src/idle-timeout.ts +15 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/abort.ts +11 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/client.ts +434 -80
- package/src/plugins/pi-agent-ide-lsp/src/lsp/code-views.ts +121 -35
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostic-adapters.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/diagnostics.ts +26 -12
- package/src/plugins/pi-agent-ide-lsp/src/lsp/document-leases.ts +31 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/errors.ts +4 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/file-watchers.ts +1 -77
- package/src/plugins/pi-agent-ide-lsp/src/lsp/index.ts +19 -19
- package/src/plugins/pi-agent-ide-lsp/src/lsp/language-map.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/lsp-compiler.ts +5 -4
- package/src/plugins/pi-agent-ide-lsp/src/lsp/manager.ts +59 -28
- package/src/plugins/pi-agent-ide-lsp/src/lsp/navigation.ts +42 -22
- package/src/plugins/pi-agent-ide-lsp/src/lsp/owner-transport.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/position-map.ts +52 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/project.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/lsp/registry.ts +2 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/rename.ts +2 -2
- package/src/plugins/pi-agent-ide-lsp/src/lsp/server-request-handlers.mjs +325 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-server-host.mjs +797 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/shared-servers.ts +322 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/source-changes.ts +29 -0
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbol-search.ts +76 -17
- package/src/plugins/pi-agent-ide-lsp/src/lsp/symbols.ts +3 -3
- package/src/plugins/pi-agent-ide-lsp/src/lsp/workspace-owner.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/manager-provider.ts +1 -1
- package/src/plugins/pi-agent-ide-lsp/src/rename-plan.ts +16 -8
- package/src/plugins/pi-agent-ide-lsp/src/search-resolver.ts +149 -134
- package/src/plugins/pi-agent-ide-lsp/src/tool-lsp-search.ts +1 -1
- package/src/plugins/pi-agent-ide-processes/index.ts +4 -4
- package/src/plugins/pi-agent-ide-processes/src/ui.ts +1 -1
- package/src/plugins/pi-agent-ide-semantic/src/vera-backend.ts +2 -2
- package/src/plugins/pi-agent-ide-terminal/index.ts +17 -17
- package/src/plugins/pi-agent-ide-terminal/src/origin.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/output-limits.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/process-provider.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/renderer.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/resources.ts +5 -5
- package/src/plugins/pi-agent-ide-terminal/src/screen-image.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/search.ts +2 -2
- package/src/plugins/pi-agent-ide-terminal/src/session-manager.ts +3 -3
- package/src/plugins/pi-agent-ide-terminal/src/shell-profile.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/shell-result.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/tools.ts +9 -9
- package/src/plugins/pi-agent-ide-terminal/src/types.ts +1 -1
- package/src/plugins/pi-agent-ide-terminal/src/ui.ts +3 -3
- package/src/post-edit/gate.ts +1 -1
- package/src/semantic/extension.ts +2 -2
- package/src/semantic/index.ts +4 -4
- package/src/standalone/resource-host.ts +13 -13
- package/src/standalone/scoped-api.ts +2 -2
- package/src/tips/core.ts +1 -1
- package/src/tips/extension.ts +6 -6
- package/src/tips/setup-hint.ts +1 -1
- package/src/toolchain/diagnostic.ts +1 -1
- package/src/toolchain/registry.ts +1 -1
- package/dist/chunk-2AY526TN.js +0 -3
- package/dist/chunk-52PFWQMU.js +0 -5
- package/dist/chunk-57F5GTHO.js +0 -1
- package/dist/chunk-5S74Z6Y4.js +0 -7
- package/dist/chunk-7D7PXIVV.js +0 -1
- package/dist/chunk-BT2CFM7D.js +0 -11
- package/dist/chunk-C2JT2G5K.js +0 -1
- package/dist/chunk-DEWWWKUF.js +0 -6
- package/dist/chunk-FEZLTM4L.js +0 -1
- package/dist/chunk-G4PRFO6G.js +0 -1
- package/dist/chunk-H5Z54BEU.js +0 -25
- package/dist/chunk-HISGZD3C.js +0 -81
- package/dist/chunk-HRBUY2FF.js +0 -4
- package/dist/chunk-ICIRQLZ4.js +0 -23
- package/dist/chunk-LIQ4BVOB.js +0 -1
- package/dist/chunk-LXDF2NWX.js +0 -1
- package/dist/chunk-MDD5ORB6.js +0 -1
- package/dist/chunk-OJEIX7OZ.js +0 -1
- package/dist/chunk-S5PL5DFQ.js +0 -1
- package/dist/chunk-U7YDLVFL.js +0 -1
- package/dist/chunk-VDJSH3DQ.js +0 -2
- package/dist/chunk-XH5WN5XA.js +0 -2
|
@@ -12,18 +12,25 @@ import {
|
|
|
12
12
|
createMessageConnection,
|
|
13
13
|
CancellationTokenSource,
|
|
14
14
|
type MessageConnection,
|
|
15
|
+
ResponseError,
|
|
15
16
|
StreamMessageReader,
|
|
16
17
|
} from "vscode-jsonrpc/node";
|
|
17
18
|
import { URI } from "vscode-uri";
|
|
18
19
|
|
|
19
|
-
import type { LspDiagnostic } from "./types.
|
|
20
|
+
import type { LspDiagnostic } from "./types.ts";
|
|
20
21
|
|
|
21
|
-
import { LspFileWatchers, type LspFileWatcherSubscriptions } from "./file-watchers.
|
|
22
|
+
import { LspFileWatchers, type LspFileWatcherSubscriptions } from "./file-watchers.ts";
|
|
23
|
+
import { configurationItems } from "./server-request-handlers.mjs";
|
|
24
|
+
import {
|
|
25
|
+
DEFAULT_SHARED_SERVER_LINGER_MS,
|
|
26
|
+
type LspSharedServer,
|
|
27
|
+
type LspSharedServers,
|
|
28
|
+
} from "./shared-servers.ts";
|
|
22
29
|
|
|
23
|
-
import { TransportWriter } from "./transport-writer.
|
|
24
|
-
import { documentUri } from "./document-uri.
|
|
25
|
-
import { waitWithSignal } from "./abort.
|
|
26
|
-
import { mapLspUris, type LspOwnerTransport, type LspOwnedProcess } from "./owner-transport.
|
|
30
|
+
import { TransportWriter } from "./transport-writer.ts";
|
|
31
|
+
import { documentUri } from "./document-uri.ts";
|
|
32
|
+
import { delayWithSignal, waitWithSignal } from "./abort.ts";
|
|
33
|
+
import { mapLspUris, type LspOwnerTransport, type LspOwnedProcess } from "./owner-transport.ts";
|
|
27
34
|
|
|
28
35
|
/** Latest push observation for an open document, without a completion guarantee. */
|
|
29
36
|
export interface LspDiagnosticPublication {
|
|
@@ -31,6 +38,13 @@ export interface LspDiagnosticPublication {
|
|
|
31
38
|
readonly diagnostics: LspDiagnostic[];
|
|
32
39
|
}
|
|
33
40
|
|
|
41
|
+
/** A complete pulled diagnostic report for one synchronized document version. */
|
|
42
|
+
export interface LspPulledDiagnosticReport {
|
|
43
|
+
readonly version: number;
|
|
44
|
+
readonly resultId: string;
|
|
45
|
+
readonly diagnostics: readonly LspDiagnostic[];
|
|
46
|
+
}
|
|
47
|
+
|
|
34
48
|
/**
|
|
35
49
|
* Generic LSP client — JSON-RPC over stdio.
|
|
36
50
|
*
|
|
@@ -42,6 +56,8 @@ export class LspClient {
|
|
|
42
56
|
private _ownedProcess: LspOwnedProcess | null = null;
|
|
43
57
|
private _ownedStartup: Promise<LspOwnedProcess> | undefined;
|
|
44
58
|
private readonly _ownerTransport: LspOwnerTransport | undefined;
|
|
59
|
+
private readonly _sharedServers: LspSharedServers | undefined;
|
|
60
|
+
private _sharedServer: LspSharedServer | null = null;
|
|
45
61
|
private _connection: MessageConnection | null = null;
|
|
46
62
|
private _initialized = false;
|
|
47
63
|
private _serverCapabilities: Record<string, unknown> | null = null;
|
|
@@ -60,8 +76,27 @@ export class LspClient {
|
|
|
60
76
|
private readonly _documentContents = new Map<string, string>();
|
|
61
77
|
|
|
62
78
|
private readonly _diagnosticPublications = new Map<string, LspDiagnosticPublication>();
|
|
79
|
+
private readonly _pulledReports = new Map<string, LspPulledDiagnosticReport>();
|
|
63
80
|
private _diagnosticMode: "unknown" | "pull" | "push" = "unknown";
|
|
81
|
+
/**
|
|
82
|
+
* ID under which the server registered pull diagnostics after initialization, as pyright does.
|
|
83
|
+
* Its pushes can then be incomplete reports from an analysis still in progress.
|
|
84
|
+
*/
|
|
85
|
+
private _pullRegistration: string | undefined;
|
|
86
|
+
/** Set once the server versions its pushes; its unversioned pushes then describe closed documents. */
|
|
87
|
+
private _versionedDiagnostics = false;
|
|
64
88
|
private readonly _activeDiagnosticRequests = new Set<string>();
|
|
89
|
+
/** Latest `experimental/serverStatus` (rust-analyzer); undefined until the server sends one. */
|
|
90
|
+
private _serverStatus: { quiescent: boolean; message?: string } | undefined;
|
|
91
|
+
private readonly _serverStatusListeners = new Set<() => void>();
|
|
92
|
+
/** Saves held back until the server has loaded the project. */
|
|
93
|
+
private readonly _pendingSaves = new Set<string>();
|
|
94
|
+
/** Operations that still use each open document; the last release closes it. */
|
|
95
|
+
private readonly _documentLeases = new Map<string, number>();
|
|
96
|
+
private _pendingRequests = 0;
|
|
97
|
+
private _idleTimer: ReturnType<typeof setTimeout> | undefined;
|
|
98
|
+
private readonly _idleTimeoutMs: number | undefined;
|
|
99
|
+
private readonly _onIdle: (() => void) | undefined;
|
|
65
100
|
|
|
66
101
|
readonly serverId: string;
|
|
67
102
|
readonly rootUri: string;
|
|
@@ -81,6 +116,11 @@ export class LspClient {
|
|
|
81
116
|
settings?: Record<string, unknown>;
|
|
82
117
|
timeoutMs?: number;
|
|
83
118
|
ownerTransport?: LspOwnerTransport;
|
|
119
|
+
/** Share a local server with other Pi sessions; if that fails, start an own process. */
|
|
120
|
+
sharedServers?: LspSharedServers;
|
|
121
|
+
/** Without requests or open operations for this long, onIdle runs. Omitted: never idle. */
|
|
122
|
+
idleTimeoutMs?: number;
|
|
123
|
+
onIdle?: () => void;
|
|
84
124
|
}) {
|
|
85
125
|
this.serverId = parameters.serverId;
|
|
86
126
|
this.rootUri = parameters.rootUri;
|
|
@@ -91,6 +131,9 @@ export class LspClient {
|
|
|
91
131
|
this._settings = parameters.settings;
|
|
92
132
|
this._timeoutMs = parameters.timeoutMs ?? 30_000;
|
|
93
133
|
this._ownerTransport = parameters.ownerTransport;
|
|
134
|
+
this._sharedServers = parameters.sharedServers;
|
|
135
|
+
this._idleTimeoutMs = parameters.idleTimeoutMs;
|
|
136
|
+
this._onIdle = parameters.onIdle;
|
|
94
137
|
}
|
|
95
138
|
|
|
96
139
|
// ── lifecycle ──────────────────────────────────────────────────────
|
|
@@ -104,7 +147,12 @@ export class LspClient {
|
|
|
104
147
|
}
|
|
105
148
|
|
|
106
149
|
get pid(): number | null {
|
|
107
|
-
return this._process?.pid ?? null;
|
|
150
|
+
return this._process?.pid ?? this._sharedServer?.pid ?? null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Whether this client reaches a server shared with other Pi sessions. */
|
|
154
|
+
get shared(): boolean {
|
|
155
|
+
return this._sharedServer !== null;
|
|
108
156
|
}
|
|
109
157
|
|
|
110
158
|
/** Remote process identity; pid remains null for these servers. */
|
|
@@ -137,6 +185,51 @@ export class LspClient {
|
|
|
137
185
|
return Array.isArray(provider?.commands) && provider.commands.includes(command);
|
|
138
186
|
}
|
|
139
187
|
|
|
188
|
+
/** Whether the server reports that it is still loading the project, so its results are incomplete. */
|
|
189
|
+
get loading(): boolean {
|
|
190
|
+
return this._serverStatus?.quiescent === false;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Wait until the server has loaded the project, so empty results mean that nothing was found.
|
|
195
|
+
* Fails when loading takes longer than the request timeout.
|
|
196
|
+
*/
|
|
197
|
+
async waitUntilLoaded(signal?: AbortSignal): Promise<void> {
|
|
198
|
+
if (!this.loading) return;
|
|
199
|
+
let listener: (() => void) | undefined;
|
|
200
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
201
|
+
try {
|
|
202
|
+
await waitWithSignal(
|
|
203
|
+
new Promise<void>((resolve, reject) => {
|
|
204
|
+
listener = () => {
|
|
205
|
+
if (!this.loading) resolve();
|
|
206
|
+
};
|
|
207
|
+
this._serverStatusListeners.add(listener);
|
|
208
|
+
timer = setTimeout(() => {
|
|
209
|
+
const message = this._serverStatus?.message;
|
|
210
|
+
reject(
|
|
211
|
+
Object.assign(
|
|
212
|
+
new Error(
|
|
213
|
+
`[lsp] ${this.serverId} is still loading the project${message ? ` (${message})` : ""}; its results would be incomplete. Try again later.`,
|
|
214
|
+
),
|
|
215
|
+
{ code: "SERVER_LOADING" },
|
|
216
|
+
),
|
|
217
|
+
);
|
|
218
|
+
}, this._timeoutMs);
|
|
219
|
+
}),
|
|
220
|
+
signal,
|
|
221
|
+
);
|
|
222
|
+
} finally {
|
|
223
|
+
clearTimeout(timer);
|
|
224
|
+
if (listener) this._serverStatusListeners.delete(listener);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private _setServerStatus(status: { quiescent: boolean; message?: string } | undefined): void {
|
|
229
|
+
this._serverStatus = status;
|
|
230
|
+
for (const listener of [...this._serverStatusListeners]) listener();
|
|
231
|
+
}
|
|
232
|
+
|
|
140
233
|
/** Whether initialization advertised support for workspace/symbol requests. */
|
|
141
234
|
get hasWorkspaceSymbolCapability(): boolean {
|
|
142
235
|
const provider = this._serverCapabilities?.workspaceSymbolProvider;
|
|
@@ -160,6 +253,19 @@ export class LspClient {
|
|
|
160
253
|
return this._diagnosticPublications.get(uri);
|
|
161
254
|
}
|
|
162
255
|
|
|
256
|
+
/**
|
|
257
|
+
* The last pulled report of the document's current version. A server that still has the same
|
|
258
|
+
* result answers a pull with its result id as unchanged instead of checking the file again.
|
|
259
|
+
*/
|
|
260
|
+
pulledReport(uri: string): LspPulledDiagnosticReport | undefined {
|
|
261
|
+
const report = this._pulledReports.get(uri);
|
|
262
|
+
return report?.version === this.documentVersion(uri) ? report : undefined;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
rememberPulledReport(uri: string, report: LspPulledDiagnosticReport): void {
|
|
266
|
+
if (report.version === this.documentVersion(uri)) this._pulledReports.set(uri, report);
|
|
267
|
+
}
|
|
268
|
+
|
|
163
269
|
beginDiagnosticRequest(uri: string): void {
|
|
164
270
|
this._activeDiagnosticRequests.add(uri);
|
|
165
271
|
}
|
|
@@ -224,6 +330,42 @@ export class LspClient {
|
|
|
224
330
|
},
|
|
225
331
|
];
|
|
226
332
|
|
|
333
|
+
const watchFiles = this._ownerTransport
|
|
334
|
+
? this._ownerTransport.fileWatchers !== undefined
|
|
335
|
+
: true;
|
|
336
|
+
const initializeParameters = {
|
|
337
|
+
processId: this._ownerTransport ? null : process.pid,
|
|
338
|
+
rootUri: this._ownerTransport?.toServerUri(this.rootUri) ?? this.rootUri,
|
|
339
|
+
|
|
340
|
+
workspaceFolders,
|
|
341
|
+
capabilities: {
|
|
342
|
+
workspace: {
|
|
343
|
+
applyEdit: false,
|
|
344
|
+
|
|
345
|
+
configuration: true,
|
|
346
|
+
|
|
347
|
+
workspaceFolders: true,
|
|
348
|
+
|
|
349
|
+
didChangeWatchedFiles: {
|
|
350
|
+
dynamicRegistration: watchFiles,
|
|
351
|
+
relativePatternSupport: watchFiles,
|
|
352
|
+
},
|
|
353
|
+
symbol: { dynamicRegistration: false },
|
|
354
|
+
},
|
|
355
|
+
// rust-analyzer reports while it loads the project; its results are incomplete until then.
|
|
356
|
+
experimental: { serverStatusNotification: true },
|
|
357
|
+
textDocument: {
|
|
358
|
+
synchronization: { didOpen: true, didChange: true, didClose: true },
|
|
359
|
+
publishDiagnostics: { relatedInformation: true, versionSupport: true },
|
|
360
|
+
|
|
361
|
+
diagnostic: { dynamicRegistration: true, relatedDocumentSupport: false },
|
|
362
|
+
documentSymbol: { hierarchicalDocumentSymbolSupport: true },
|
|
363
|
+
foldingRange: { lineFoldingOnly: true },
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
initializationOptions: this._initOptions,
|
|
367
|
+
};
|
|
368
|
+
|
|
227
369
|
this._ownedStartup = this._ownerTransport?.start({
|
|
228
370
|
rootUri: this.rootUri,
|
|
229
371
|
command: this._command,
|
|
@@ -236,23 +378,36 @@ export class LspClient {
|
|
|
236
378
|
// An owner can become ready while shutdown is waiting for it.
|
|
237
379
|
// eslint-disable-next-line typescript/no-unnecessary-condition
|
|
238
380
|
if (this._disposed) throw new Error(`[lsp] ${this.serverId}: disposed`);
|
|
239
|
-
const
|
|
381
|
+
const sharedServer = ownedProcess
|
|
240
382
|
? undefined
|
|
241
|
-
:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
383
|
+
: await this._attachSharedServer(projectRoot, initializeParameters, signal);
|
|
384
|
+
// Shutdown that ran during the attach could not see this connection.
|
|
385
|
+
// eslint-disable-next-line typescript/no-unnecessary-condition
|
|
386
|
+
if (this._disposed) {
|
|
387
|
+
await sharedServer?.stop();
|
|
388
|
+
throw new Error(`[lsp] ${this.serverId}: disposed`);
|
|
389
|
+
}
|
|
390
|
+
this._sharedServer = sharedServer ?? null;
|
|
391
|
+
signal?.throwIfAborted();
|
|
392
|
+
const childProcess =
|
|
393
|
+
ownedProcess || sharedServer
|
|
394
|
+
? undefined
|
|
395
|
+
: spawnProcess(bin, this._args, {
|
|
396
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
397
|
+
...(signal && { signal }),
|
|
398
|
+
cwd: projectRoot,
|
|
399
|
+
env: createConfiguredProcessEnvironment(
|
|
400
|
+
{ command: this._command, env: this._env },
|
|
401
|
+
projectRoot,
|
|
402
|
+
process.env,
|
|
403
|
+
),
|
|
404
|
+
});
|
|
251
405
|
this._process = childProcess ?? null;
|
|
252
406
|
const spawnPromise = childProcess ? waitForSpawn(childProcess) : Promise.resolve();
|
|
253
|
-
const
|
|
254
|
-
const
|
|
255
|
-
const
|
|
407
|
+
const stream = ownedProcess ?? sharedServer;
|
|
408
|
+
const stdin = requiredValue(stream?.stdin ?? childProcess?.stdin);
|
|
409
|
+
const stdout = requiredValue(stream?.stdout ?? childProcess?.stdout);
|
|
410
|
+
const stderr = requiredValue(stream?.stderr ?? childProcess?.stderr);
|
|
256
411
|
|
|
257
412
|
// Consume process stream errors so a failed optional server cannot
|
|
258
413
|
// become an uncaught exception in the host process.
|
|
@@ -261,6 +416,16 @@ export class LspClient {
|
|
|
261
416
|
stderr.on("error", () => void 0);
|
|
262
417
|
|
|
263
418
|
this._stderr = "";
|
|
419
|
+
// A process can exit before its last stderr output arrives; startup errors wait for it.
|
|
420
|
+
const stderrEnded = new Promise<void>((resolve) => {
|
|
421
|
+
stderr.once("end", resolve);
|
|
422
|
+
stderr.once("close", resolve);
|
|
423
|
+
});
|
|
424
|
+
let exitCode: number | null | undefined;
|
|
425
|
+
let markExited = () => {};
|
|
426
|
+
const exited = new Promise<void>((resolve) => {
|
|
427
|
+
markExited = resolve;
|
|
428
|
+
});
|
|
264
429
|
stderr.setEncoding("utf8");
|
|
265
430
|
stderr.on("data", (chunk: string) => {
|
|
266
431
|
this._stderr = (this._stderr + chunk).slice(-4096);
|
|
@@ -279,9 +444,16 @@ export class LspClient {
|
|
|
279
444
|
this._process = null;
|
|
280
445
|
});
|
|
281
446
|
|
|
447
|
+
const current = () =>
|
|
448
|
+
ownedProcess
|
|
449
|
+
? this._ownedProcess === ownedProcess
|
|
450
|
+
: sharedServer
|
|
451
|
+
? this._sharedServer === sharedServer
|
|
452
|
+
: this._process === childProcess;
|
|
282
453
|
const onExit = (code: number | null) => {
|
|
283
|
-
if (
|
|
284
|
-
|
|
454
|
+
if (!current()) return;
|
|
455
|
+
exitCode ??= code;
|
|
456
|
+
markExited();
|
|
285
457
|
void this._closeFileWatchers();
|
|
286
458
|
if (!this._disposed && code !== 0 && code !== null) {
|
|
287
459
|
this._crashed = true;
|
|
@@ -290,16 +462,20 @@ export class LspClient {
|
|
|
290
462
|
this._connection?.dispose();
|
|
291
463
|
this._connection = null;
|
|
292
464
|
this._diagnosticPublications.clear();
|
|
465
|
+
this._pulledReports.clear();
|
|
293
466
|
this._activeDiagnosticRequests.clear();
|
|
294
467
|
this._diagnosticMode = "unknown";
|
|
468
|
+
this._pullRegistration = undefined;
|
|
469
|
+
this._versionedDiagnostics = false;
|
|
470
|
+
this._setServerStatus(undefined);
|
|
295
471
|
this._process = null;
|
|
296
472
|
this._initialized = false;
|
|
297
473
|
};
|
|
298
474
|
childProcess?.on("exit", onExit);
|
|
299
|
-
void
|
|
475
|
+
void stream?.completion.then(
|
|
300
476
|
({ exitCode }) => onExit(exitCode),
|
|
301
477
|
() => {
|
|
302
|
-
if (
|
|
478
|
+
if (!current()) return;
|
|
303
479
|
this._crashed = true;
|
|
304
480
|
onExit(null);
|
|
305
481
|
},
|
|
@@ -328,9 +504,12 @@ export class LspClient {
|
|
|
328
504
|
};
|
|
329
505
|
const failed = (error: Error) =>
|
|
330
506
|
console.error(`[lsp] ${this.serverId}: file watcher failed:`, error);
|
|
507
|
+
// A shared host watches files for its server itself.
|
|
331
508
|
this._fileWatchers = this._ownerTransport
|
|
332
509
|
? this._ownerTransport.fileWatchers?.(this.rootUri, changed, failed)
|
|
333
|
-
:
|
|
510
|
+
: sharedServer
|
|
511
|
+
? undefined
|
|
512
|
+
: new LspFileWatchers(projectRoot, changed, failed);
|
|
334
513
|
this._connection.onRequest(
|
|
335
514
|
"client/registerCapability",
|
|
336
515
|
async (parameters: {
|
|
@@ -343,6 +522,11 @@ export class LspClient {
|
|
|
343
522
|
for (const registration of parameters.registrations) {
|
|
344
523
|
// Settings are fixed for this client and already served by workspace/configuration.
|
|
345
524
|
if (registration.method === "workspace/didChangeConfiguration") continue;
|
|
525
|
+
if (registration.method === "textDocument/diagnostic") {
|
|
526
|
+
this._pullRegistration = registration.id;
|
|
527
|
+
if (this._initialized) this._diagnosticMode = "pull";
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
346
530
|
if (registration.method !== "workspace/didChangeWatchedFiles")
|
|
347
531
|
throw new Error(`Unsupported dynamic capability: ${registration.method}`);
|
|
348
532
|
if (!this._fileWatchers)
|
|
@@ -358,26 +542,28 @@ export class LspClient {
|
|
|
358
542
|
this._connection.onRequest(
|
|
359
543
|
"client/unregisterCapability",
|
|
360
544
|
async (parameters: { unregisterations: { id: string }[] }) => {
|
|
361
|
-
for (const registration of parameters.unregisterations)
|
|
362
|
-
|
|
545
|
+
for (const registration of parameters.unregisterations) {
|
|
546
|
+
if (registration.id === this._pullRegistration) {
|
|
547
|
+
this._pullRegistration = undefined;
|
|
548
|
+
if (this._initialized) this._diagnosticMode = "push";
|
|
549
|
+
} else await this._fileWatchers?.unregister(registration.id);
|
|
550
|
+
}
|
|
363
551
|
return null;
|
|
364
552
|
},
|
|
365
553
|
);
|
|
366
554
|
this._connection.onRequest("window/workDoneProgress/create", () => null);
|
|
555
|
+
// A pull-diagnostic server asks for new pulls after results change; pyright exits when this
|
|
556
|
+
// request fails. Handlers registered for the method see each refresh.
|
|
557
|
+
this._connection.onRequest("workspace/diagnostic/refresh", () => {
|
|
558
|
+
for (const handler of this._handlers.get("workspace/diagnostic/refresh") ?? [])
|
|
559
|
+
handler(undefined);
|
|
560
|
+
return null;
|
|
561
|
+
});
|
|
367
562
|
|
|
368
563
|
this._connection.onRequest(
|
|
369
564
|
"workspace/configuration",
|
|
370
565
|
(parameters: { items: { section?: string }[] }) =>
|
|
371
|
-
parameters.items
|
|
372
|
-
let value: unknown = this._settings ?? null;
|
|
373
|
-
for (const segment of item.section?.split(".").filter(Boolean) ?? []) {
|
|
374
|
-
value =
|
|
375
|
-
typeof value === "object" && value !== null
|
|
376
|
-
? ((value as Record<string, unknown>)[segment] ?? null)
|
|
377
|
-
: null;
|
|
378
|
-
}
|
|
379
|
-
return value;
|
|
380
|
-
}),
|
|
566
|
+
configurationItems(this._settings, parameters.items),
|
|
381
567
|
);
|
|
382
568
|
|
|
383
569
|
this._connection.listen();
|
|
@@ -392,6 +578,16 @@ export class LspClient {
|
|
|
392
578
|
const publication = mapped as
|
|
393
579
|
| { uri?: unknown; version?: unknown; diagnostics?: unknown }
|
|
394
580
|
| undefined;
|
|
581
|
+
if (typeof publication?.version === "number") this._versionedDiagnostics = true;
|
|
582
|
+
else if (
|
|
583
|
+
this._versionedDiagnostics &&
|
|
584
|
+
typeof publication?.uri === "string" &&
|
|
585
|
+
this._documentVersions.has(publication.uri)
|
|
586
|
+
)
|
|
587
|
+
// A server that versions its reports omits the version only for a document it sees as
|
|
588
|
+
// closed. Such a push for a document open here was sent before the server processed
|
|
589
|
+
// the latest didOpen, for example the clear for a close that a quick reopen followed.
|
|
590
|
+
return;
|
|
395
591
|
if (
|
|
396
592
|
publication &&
|
|
397
593
|
typeof publication.uri === "string" &&
|
|
@@ -406,6 +602,13 @@ export class LspClient {
|
|
|
406
602
|
});
|
|
407
603
|
}
|
|
408
604
|
}
|
|
605
|
+
if (method === "experimental/serverStatus") {
|
|
606
|
+
const status = mapped as { quiescent?: unknown; message?: unknown } | undefined;
|
|
607
|
+
this._setServerStatus({
|
|
608
|
+
quiescent: status?.quiescent !== false,
|
|
609
|
+
...(typeof status?.message === "string" && { message: status.message }),
|
|
610
|
+
});
|
|
611
|
+
}
|
|
409
612
|
for (const handler of this._handlers.get(method) ?? []) {
|
|
410
613
|
handler(mapped);
|
|
411
614
|
}
|
|
@@ -419,44 +622,28 @@ export class LspClient {
|
|
|
419
622
|
|
|
420
623
|
const initResult = await waitWithSignal(
|
|
421
624
|
withTimeout(
|
|
422
|
-
this._connection.sendRequest<InitResult>("initialize",
|
|
423
|
-
processId: this._ownerTransport ? null : process.pid,
|
|
424
|
-
rootUri: this._ownerTransport?.toServerUri(this.rootUri) ?? this.rootUri,
|
|
425
|
-
|
|
426
|
-
workspaceFolders,
|
|
427
|
-
capabilities: {
|
|
428
|
-
workspace: {
|
|
429
|
-
applyEdit: false,
|
|
430
|
-
|
|
431
|
-
configuration: true,
|
|
432
|
-
|
|
433
|
-
workspaceFolders: true,
|
|
434
|
-
|
|
435
|
-
didChangeWatchedFiles: {
|
|
436
|
-
dynamicRegistration: this._fileWatchers !== undefined,
|
|
437
|
-
relativePatternSupport: this._fileWatchers !== undefined,
|
|
438
|
-
},
|
|
439
|
-
symbol: { dynamicRegistration: false },
|
|
440
|
-
},
|
|
441
|
-
textDocument: {
|
|
442
|
-
synchronization: { didOpen: true, didChange: true, didClose: true },
|
|
443
|
-
publishDiagnostics: { relatedInformation: true },
|
|
444
|
-
|
|
445
|
-
diagnostic: { dynamicRegistration: false, relatedDocumentSupport: false },
|
|
446
|
-
documentSymbol: { hierarchicalDocumentSymbolSupport: true },
|
|
447
|
-
foldingRange: { lineFoldingOnly: true },
|
|
448
|
-
},
|
|
449
|
-
},
|
|
450
|
-
initializationOptions: this._initOptions,
|
|
451
|
-
}),
|
|
625
|
+
this._connection.sendRequest<InitResult>("initialize", initializeParameters),
|
|
452
626
|
this._timeoutMs,
|
|
453
627
|
`[lsp] ${this.serverId}: initialize timed out`,
|
|
454
628
|
),
|
|
455
629
|
signal,
|
|
456
|
-
).catch((error: unknown) => {
|
|
630
|
+
).catch(async (error: unknown) => {
|
|
631
|
+
if (signal?.aborted) throw error;
|
|
632
|
+
// A failed initialize write can precede the exit event and the server's last stderr output.
|
|
633
|
+
await Promise.race([
|
|
634
|
+
Promise.all([stderrEnded, exited]),
|
|
635
|
+
delayWithSignal(STDERR_DRAIN_MS, signal),
|
|
636
|
+
]).catch(() => undefined);
|
|
457
637
|
const detail = this._stderr.trim();
|
|
458
|
-
|
|
459
|
-
|
|
638
|
+
const exit =
|
|
639
|
+
exitCode === undefined
|
|
640
|
+
? undefined
|
|
641
|
+
: `exited during startup${exitCode === null ? "" : ` with code ${exitCode}`}`;
|
|
642
|
+
if (!detail && !exit) throw error;
|
|
643
|
+
const message = `[lsp] ${this.serverId}${exit ? ` ${exit}` : ""}${detail ? `: ${detail}` : ""}`;
|
|
644
|
+
// The exit is the root cause; the connection error it caused would hide it from callers
|
|
645
|
+
// that report the innermost cause.
|
|
646
|
+
throw exit ? new Error(message) : new Error(message, { cause: error });
|
|
460
647
|
});
|
|
461
648
|
|
|
462
649
|
await this._connection.sendNotification("initialized", {
|
|
@@ -477,11 +664,81 @@ export class LspClient {
|
|
|
477
664
|
this._serverCapabilities = initResult.capabilities;
|
|
478
665
|
|
|
479
666
|
// Unadvertised methods may return null or internal errors rather than MethodNotFound.
|
|
480
|
-
this._diagnosticMode =
|
|
667
|
+
this._diagnosticMode =
|
|
668
|
+
initResult.capabilities.diagnosticProvider || this._pullRegistration !== undefined
|
|
669
|
+
? "pull"
|
|
670
|
+
: "push";
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/** Reach a server shared with other Pi sessions; undefined means start an own process. */
|
|
674
|
+
private async _attachSharedServer(
|
|
675
|
+
projectRoot: string,
|
|
676
|
+
initialize: Record<string, unknown>,
|
|
677
|
+
signal: AbortSignal | undefined,
|
|
678
|
+
): Promise<LspSharedServer | undefined> {
|
|
679
|
+
if (!this._sharedServers) return undefined;
|
|
680
|
+
try {
|
|
681
|
+
return await this._sharedServers.attach({
|
|
682
|
+
serverId: this.serverId,
|
|
683
|
+
command: this._command,
|
|
684
|
+
cwd: projectRoot,
|
|
685
|
+
configuredEnv: this._env,
|
|
686
|
+
env: createConfiguredProcessEnvironment(
|
|
687
|
+
{ command: this._command, env: this._env },
|
|
688
|
+
projectRoot,
|
|
689
|
+
process.env,
|
|
690
|
+
),
|
|
691
|
+
settings: this._settings,
|
|
692
|
+
initialize,
|
|
693
|
+
lingerMs: this._idleTimeoutMs ?? DEFAULT_SHARED_SERVER_LINGER_MS,
|
|
694
|
+
timeoutMs: this._timeoutMs,
|
|
695
|
+
...(signal && { signal }),
|
|
696
|
+
});
|
|
697
|
+
} catch {
|
|
698
|
+
signal?.throwIfAborted();
|
|
699
|
+
// The shared host is optional: an own process gives the same results.
|
|
700
|
+
return undefined;
|
|
701
|
+
}
|
|
481
702
|
}
|
|
482
703
|
|
|
704
|
+
/** Restart the idle period; requests and open operations keep the server busy. */
|
|
483
705
|
touch(): void {
|
|
484
|
-
|
|
706
|
+
clearTimeout(this._idleTimer);
|
|
707
|
+
this._idleTimer = undefined;
|
|
708
|
+
if (this._idleTimeoutMs === undefined || this._disposed || this._busy) return;
|
|
709
|
+
const timer = setTimeout(() => {
|
|
710
|
+
if (this._idleTimer !== timer) return;
|
|
711
|
+
this._idleTimer = undefined;
|
|
712
|
+
if (this.ready && !this._busy) this._onIdle?.();
|
|
713
|
+
}, this._idleTimeoutMs);
|
|
714
|
+
timer.unref();
|
|
715
|
+
this._idleTimer = timer;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
private get _busy(): boolean {
|
|
719
|
+
return this._pendingRequests > 0 || this._documentLeases.size > 0;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Keep a document open for one operation. The returned release is idempotent; the last
|
|
724
|
+
* release of a document closes it on the server.
|
|
725
|
+
*/
|
|
726
|
+
retainDocument(uri: string): () => void {
|
|
727
|
+
this._documentLeases.set(uri, (this._documentLeases.get(uri) ?? 0) + 1);
|
|
728
|
+
this.touch();
|
|
729
|
+
let released = false;
|
|
730
|
+
return () => {
|
|
731
|
+
if (released) return;
|
|
732
|
+
released = true;
|
|
733
|
+
const remaining = (this._documentLeases.get(uri) ?? 1) - 1;
|
|
734
|
+
if (remaining > 0) {
|
|
735
|
+
this._documentLeases.set(uri, remaining);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
this._documentLeases.delete(uri);
|
|
739
|
+
if (this.ready && this._documentVersions.has(uri)) this.closeDocument(uri);
|
|
740
|
+
this.touch();
|
|
741
|
+
};
|
|
485
742
|
}
|
|
486
743
|
|
|
487
744
|
async restart(signal?: AbortSignal): Promise<void> {
|
|
@@ -497,7 +754,9 @@ export class LspClient {
|
|
|
497
754
|
this._documentVersions.clear();
|
|
498
755
|
this._documentContents.clear();
|
|
499
756
|
this._diagnosticPublications.clear();
|
|
757
|
+
this._pulledReports.clear();
|
|
500
758
|
this._diagnosticMode = "unknown";
|
|
759
|
+
this._versionedDiagnostics = false;
|
|
501
760
|
this._activeDiagnosticRequests.clear();
|
|
502
761
|
this._serverCapabilities = null;
|
|
503
762
|
await this.start(signal);
|
|
@@ -513,6 +772,40 @@ export class LspClient {
|
|
|
513
772
|
): Promise<T> {
|
|
514
773
|
this._assertReady();
|
|
515
774
|
signal?.throwIfAborted();
|
|
775
|
+
this._pendingRequests++;
|
|
776
|
+
this.touch();
|
|
777
|
+
try {
|
|
778
|
+
let reloaded = false;
|
|
779
|
+
for (let attempt = 0; ; attempt++) {
|
|
780
|
+
let result: T;
|
|
781
|
+
try {
|
|
782
|
+
result = await this._sendRequest<T>(method, parameters, signal);
|
|
783
|
+
} catch (error) {
|
|
784
|
+
const delay = REQUEST_RETRY_DELAYS_MS[attempt];
|
|
785
|
+
if (delay === undefined || !isRetryableCancellation(error)) throw error;
|
|
786
|
+
// The server dropped a stale result; ask again once it has applied the latest text.
|
|
787
|
+
await delayWithSignal(delay, signal);
|
|
788
|
+
this._assertReady();
|
|
789
|
+
continue;
|
|
790
|
+
}
|
|
791
|
+
// A server that is still loading the project answers from the part it has seen, often
|
|
792
|
+
// with nothing. Ask once more after loading; commands may have effects and run once.
|
|
793
|
+
if (reloaded || !this.loading || method === "workspace/executeCommand") return result;
|
|
794
|
+
reloaded = true;
|
|
795
|
+
await this.waitUntilLoaded(signal);
|
|
796
|
+
this._assertReady();
|
|
797
|
+
}
|
|
798
|
+
} finally {
|
|
799
|
+
this._pendingRequests--;
|
|
800
|
+
this.touch();
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
private async _sendRequest<T>(
|
|
805
|
+
method: string,
|
|
806
|
+
parameters: unknown,
|
|
807
|
+
signal: AbortSignal | undefined,
|
|
808
|
+
): Promise<T> {
|
|
516
809
|
const owner = this._ownerTransport;
|
|
517
810
|
const requestParameters = owner
|
|
518
811
|
? mapLspUris(parameters, (uri) => owner.toServerUri(uri))
|
|
@@ -612,6 +905,7 @@ export class LspClient {
|
|
|
612
905
|
}
|
|
613
906
|
|
|
614
907
|
this._diagnosticPublications.delete(uri);
|
|
908
|
+
this._pulledReports.delete(uri);
|
|
615
909
|
this.sendNotification("textDocument/didOpen", {
|
|
616
910
|
textDocument: { uri, languageId, version, text },
|
|
617
911
|
});
|
|
@@ -630,23 +924,47 @@ export class LspClient {
|
|
|
630
924
|
} else {
|
|
631
925
|
this.changeDocument(uri, text, currentVersion + 1);
|
|
632
926
|
}
|
|
927
|
+
if (!saved) return;
|
|
928
|
+
// rust-analyzer exits when a save arrives while it scans the project
|
|
929
|
+
// (rust-lang/rust-analyzer#19406), so report the save once loading ends.
|
|
930
|
+
if (this.loading) this._deferSave(uri);
|
|
931
|
+
else this._sendSave(uri);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
private _sendSave(uri: string): void {
|
|
633
935
|
const synchronization = this._serverCapabilities?.textDocumentSync;
|
|
634
936
|
const save =
|
|
635
937
|
typeof synchronization === "object" && synchronization !== null
|
|
636
938
|
? (synchronization as { save?: boolean | { includeText?: boolean } }).save
|
|
637
939
|
: undefined;
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
})
|
|
643
|
-
}
|
|
940
|
+
const text = this._documentContents.get(uri);
|
|
941
|
+
if (!save || text === undefined) return;
|
|
942
|
+
this.sendNotification("textDocument/didSave", {
|
|
943
|
+
textDocument: { uri },
|
|
944
|
+
...(typeof save === "object" && save.includeText && { text }),
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
private _deferSave(uri: string): void {
|
|
949
|
+
const waiting = this._pendingSaves.size > 0;
|
|
950
|
+
this._pendingSaves.add(uri);
|
|
951
|
+
if (waiting) return;
|
|
952
|
+
const listener = () => {
|
|
953
|
+
if (this.loading) return;
|
|
954
|
+
this._serverStatusListeners.delete(listener);
|
|
955
|
+
const uris = [...this._pendingSaves];
|
|
956
|
+
this._pendingSaves.clear();
|
|
957
|
+
// A document closed in the meantime has no save to report.
|
|
958
|
+
for (const pending of uris) this._sendSave(pending);
|
|
959
|
+
};
|
|
960
|
+
this._serverStatusListeners.add(listener);
|
|
644
961
|
}
|
|
645
962
|
|
|
646
963
|
changeDocument(uri: string, text: string, version: number): void {
|
|
647
964
|
const currentVersion = this._documentVersions.get(uri);
|
|
648
965
|
const nextVersion = Math.max(version, (currentVersion ?? 0) + 1);
|
|
649
966
|
this._diagnosticPublications.delete(uri);
|
|
967
|
+
this._pulledReports.delete(uri);
|
|
650
968
|
this.sendNotification("textDocument/didChange", {
|
|
651
969
|
textDocument: { uri, version: nextVersion },
|
|
652
970
|
contentChanges: [{ text }],
|
|
@@ -663,6 +981,7 @@ export class LspClient {
|
|
|
663
981
|
this._documentContents.delete(uri);
|
|
664
982
|
|
|
665
983
|
this._diagnosticPublications.delete(uri);
|
|
984
|
+
this._pulledReports.delete(uri);
|
|
666
985
|
}
|
|
667
986
|
|
|
668
987
|
// ── cleanup ────────────────────────────────────────────────────────
|
|
@@ -674,6 +993,9 @@ export class LspClient {
|
|
|
674
993
|
|
|
675
994
|
private async _shutdown(): Promise<void> {
|
|
676
995
|
this._disposed = true;
|
|
996
|
+
this._setServerStatus(undefined);
|
|
997
|
+
clearTimeout(this._idleTimer);
|
|
998
|
+
this._idleTimer = undefined;
|
|
677
999
|
|
|
678
1000
|
const watcherCleanup = this._closeFileWatchers();
|
|
679
1001
|
|
|
@@ -701,6 +1023,9 @@ export class LspClient {
|
|
|
701
1023
|
this._ownedProcess = null;
|
|
702
1024
|
this._ownedStartup = undefined;
|
|
703
1025
|
const ownedCleanup = Promise.resolve().then(() => owned?.stop());
|
|
1026
|
+
const shared = this._sharedServer;
|
|
1027
|
+
this._sharedServer = null;
|
|
1028
|
+
const sharedCleanup = Promise.resolve().then(() => shared?.stop());
|
|
704
1029
|
const child = this._process;
|
|
705
1030
|
this._process = null;
|
|
706
1031
|
if (child && !child.killed) {
|
|
@@ -714,10 +1039,12 @@ export class LspClient {
|
|
|
714
1039
|
this._documentVersions.clear();
|
|
715
1040
|
this._documentContents.clear();
|
|
716
1041
|
this._diagnosticPublications.clear();
|
|
1042
|
+
this._pulledReports.clear();
|
|
717
1043
|
this._diagnosticMode = "unknown";
|
|
1044
|
+
this._versionedDiagnostics = false;
|
|
718
1045
|
this._activeDiagnosticRequests.clear();
|
|
719
1046
|
this._serverCapabilities = null;
|
|
720
|
-
const results = await Promise.allSettled([ownedCleanup, watcherCleanup]);
|
|
1047
|
+
const results = await Promise.allSettled([ownedCleanup, sharedCleanup, watcherCleanup]);
|
|
721
1048
|
const failures: unknown[] = [];
|
|
722
1049
|
for (const result of results) {
|
|
723
1050
|
if (result.status === "rejected") failures.push(result.reason);
|
|
@@ -765,6 +1092,33 @@ export class LspClient {
|
|
|
765
1092
|
}
|
|
766
1093
|
}
|
|
767
1094
|
|
|
1095
|
+
/** How long a startup error waits for stderr output of a server that already exited. */
|
|
1096
|
+
const STDERR_DRAIN_MS = 250;
|
|
1097
|
+
|
|
1098
|
+
/** Waits before each retry of a request the server cancelled; about 1.5 s in total. */
|
|
1099
|
+
const REQUEST_RETRY_DELAYS_MS = [50, 100, 200, 400, 800];
|
|
1100
|
+
/** LSP error codes from the specification; vscode-jsonrpc defines only JSON-RPC ones. */
|
|
1101
|
+
const CONTENT_MODIFIED = -32_801;
|
|
1102
|
+
const SERVER_CANCELLED = -32_802;
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* ContentModified (-32801): the document changed while the server computed the result.
|
|
1106
|
+
* ServerCancelled (-32802): the server dropped the request, for example while it reloads the
|
|
1107
|
+
* project; a diagnostic request is not retried when the server says retriggering will not help.
|
|
1108
|
+
*/
|
|
1109
|
+
function isRetryableCancellation(error: unknown): boolean {
|
|
1110
|
+
if (!(error instanceof ResponseError)) return false;
|
|
1111
|
+
if (error.code === CONTENT_MODIFIED) return true;
|
|
1112
|
+
if (error.code !== SERVER_CANCELLED) return false;
|
|
1113
|
+
const data: unknown = error.data;
|
|
1114
|
+
return !(
|
|
1115
|
+
data !== null &&
|
|
1116
|
+
typeof data === "object" &&
|
|
1117
|
+
"retriggerRequest" in data &&
|
|
1118
|
+
data.retriggerRequest === false
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
|
|
768
1122
|
function waitForSpawn(childProcess: ChildProcess): Promise<void> {
|
|
769
1123
|
return new Promise<void>((resolve, reject) => {
|
|
770
1124
|
const cleanup = () => {
|