Unbundle `LSP.Sever`

Abierto
#417 1 comentario 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
20/100
Tipo de issue
Refactorización
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
haskell
Área
devtools

Línea de trabajo

Empieza leyendo LSP.Sever y la SeverDefinition monolítica; después compara el ejemplo del reactor y cómo ghcide gestiona el dispatch y el estado de VFS. El issue no identifica archivos ni tests; para darlo por terminado sería necesario acordar una descomposición implementable de la E/S del servidor, los handlers de inicialización y el acceso al estado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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?
Lenguaje dominante
Haskell
Estrellas
426
Forks
107
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de haskell/lsp

Todos los issues de haskell/lsp

Issues similares

Más issues de Haskell

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.