Unbundle `LSP.Sever`

Aperta
#417 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
haskell
Ambito
devtools

Direzione di ricerca

Inizia leggendo LSP.Sever e la SeverDefinition monolitica, quindi confronta l’esempio del reactor e la gestione del dispatch e dello stato di VFS in ghcide. L’issue non identifica file o test; per considerare il lavoro completato sarebbe necessaria una scomposizione concordata e implementabile dell’I/O del server, degli handler di inizializzazione e dell’accesso allo stato.

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

Descrizione

v3

At the moment LSP.Sever is "framework-like": you provide various kinds of functions via the monolithic SeverDefinition, and then the server framework is responsible for calling them. This has some warts:

  • It is unclear what is handled by the framework and what isn't (see e.g. https://github.com/haskell/lsp/issues/414)
  • It is difficult to customize parts of the behaviour
    • A big example is the message dispatch loop. Our "reactor" example is (IMO) godawful: you have to override the handlers in order to sneak in some custom dispatch logic. ghcide similarly tries to completely bypass this. (Also see e.g. https://github.com/haskell/lsp/issues/409)
    • Another example is whether or not to feed the intializationOptions to the configuration changed function. This isn't specified in the spec, but some clients expect it, so it's really something the server author should decide about, not us.
  • It is difficult to mange state differently. For example, HLS wants to delay updates to the VFS so that long-running processes don't see inconsistent states. To do this they have to implement a complete second layer which takes VFS snapshots!

Here's some ideas for how to unbundle this:

  • Modularise the server in/out into IO actions that communicate over a channel, which clients can fork as they like.
  • Modularise the initialization handlers so we provide a number of standard handlers which do common actions and which can be combined with <>.
  • Modularise state accesses so that they access the state via a typeclass, allowing multiple implementations.
  • More?

Big questions:

  • Is this a good direction of travel?
  • Are there going to be any bits that will be really difficult?
Lingua principale
Haskell
Stelle
426
Fork
107
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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 haskell/lsp

Tutte le issue di haskell/lsp

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.