Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

lsp.client: no per-file server binding (project×mime only), and rename merges WorkspaceEdits from every bound server

Aperta
#9,582 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

Inizia leggendo ide/lsp.client, in particolare LSPBindings e la SPI LanguageServerProvider.startServer, quindi segui il percorso di rename che unisce i WorkspaceEdits dei binding di lookupAll. Riproduci il problema con due provider registrati per un MIME e verifica che il design scelto supporti un binding per file oppure un unico server di rename autorevole, senza applicare modifiche duplicate.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

LSP
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 setMIMEType reroutes 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.

Lingua principale
Java
Stelle
3.1k
Fork
939
Merge medio
5g 12h
PR unite (30g)
23

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/netbeans

Tutte le issue di apache/netbeans

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.