lsp.client: no per-file server binding (project×mime only), and rename merges WorkspaceEdits from every bound server
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- java
調査の方向性
まず ide/lsp.client、特に LSPBindings と SPI である LanguageServerProvider.startServer を読み、次に lookupAll バインディングから WorkspaceEdits をマージする rename の経路を追跡します。1 つの MIME に対して 2 つの provider を登録して問題を再現し、選択した設計がファイルごとの binding、または単一の権威ある rename サーバーをサポートし、重複した編集を適用しないことを確認します。
索引モデルが issue の本文から書いたものです。
説明
Apache NetBeans version
Apache NetBeans 25 (observed on RELEASE300, still present on RELEASE310)
Bug description
Two related limitations in ide/lsp.client that together make it impossible to attach a language server to a subset of files sharing a MIME type — and make it hazardous for two servers to share a mime at all:
1. Bindings are per PROJECT × MIME, never per file. LSPBindings keys server bindings by (project, mime). LanguageServerProvider.startServer receives no file/document context, so a provider cannot decide per file whether to attach. Concrete case: Angular CLI ≥ 21 generates suffixless templates (widget.html beside widget.ts), which want the Angular Language Service — but binding ngserver under text/html attaches it to every html file in the project, plain documents included.
2. Rename applies WorkspaceEdits from EVERY bound server. When two servers are bound to one mime (which lookupAll deliberately allows — useful for eslint-style diagnostic servers), the platform's rename collects and applies edits from all of them. With two servers that both implement rename (e.g. ngserver beside typescript-language-server on text/typescript), every rename is applied twice — we measured real double-renames before suppressing one server's mime binding entirely.
Also worth noting: the bindings consult the FileObject's resolver-assigned mime, not the document mime — a DataObject that pins the editor content type via the public CloneableEditorSupport.setMIMEType gets the full editor surface (coloring, keybindings, popup) for the new mime, but LSP still binds by the file mime, so the two disagree.
Steps to reproduce
For (2): register two LanguageServerProviders for one mime where both back rename; rename a symbol; observe the edit applied twice.
For (1): attempt to attach a server to only those text/html files matching a project-structural condition — there is no seam: startServer has no file, and mime-folder registration is all-or-nothing per project.
Expected behavior
Either of these would unblock the use case safely:
- a per-file consultation in the provider SPI (e.g. the provider sees the triggering FileObject/document and may decline), or
- bindings consulting the document mime (so
setMIMETypereroutes LSP together with the editor surface), or - rename asking one authoritative server per capability instead of merging all bindings' edits.
Context
Found while building NMOX Studio (Apache-2.0, NetBeans-Platform based): https://github.com/NMOX/NMOX-Studio — engineering ledger entries 81/82 (docs/engineering/tech-debt.md) carry the measurements and the decompiled details. Related: #9581 (multi-mime provider registrations and the instance-keyed reuse map). Happy to test patches or provide more detail.
- 主要言語
- Java
- スター
- 3.1k
- フォーク
- 939
- 平均マージ
- 4日 21時間
- マージ済み PR(30日)
- 24
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/netbeans のほかの issue
-
Contribution welcome kind:feature Platform
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/netbeans#9614 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
kind:bug LSP needs:triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/netbeans#9548 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Editor Java kind:feature needs:triage
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
The main Options dialog window has buttons with OK on the left instead of on the right on Linuxオープンkind:bug needs:triage os:linux os:macos Platform UI
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
kind:bug needs:triage
難易度 1/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
apache/netbeans の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Netcracker/qubership-integration-platform#1046 ·
メンテナーはふだん 2 日以内に返信
-
`check_java_version()` fails when Java path contains spaces (Windows / Git Bash, `C:\Program Files`)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
Fix Math.ceilDiv wrong result for exact positive divisions対応中かも @pamod-madubashana が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
scala-native/scala-native#5094 ·
メンテナーはふだん 1 日以内に返信
-
NullPointerException in blocking command completion callback when the command succeeds (3.52.0)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 2 日以内に返信