Skip to content

lsp4clj utils #14

Open
Open
@mainej

Description

@mainej

Based on a discussion started in #13, the idea was raised of creating a suite of utils for projects that use lsp4clj. This could either be additional namespaces in lsp4clj or (my vote) a separate project.

Things we could move from lsp4clj to the utils:

  • liveness-probe, which is used to shutdown automatically when the client closes. This is a useful utility, but unrelated to the core responsibility of handling LSP JSON-RPC messages.
  • coercer, which is used primarily for conforming the server's responses. I dislike 90% of the coercer. IMO, it's primarily a relic of lsp4j. It was useful when we needed to create Java objects, but now its main utility is for converting keywords to integer enum values. That could just as easily be done by looking up the enum values in a map. To be fair, the conformers do more than handling enums; they also restructure data slightly. But again, I'd rather have helper functions that do the same thing. That said, some project might want to use the coercer. They may even want to have utils that automatically apply conformations based on the method name of the JSON-RPC message.

Things we could move from clojure-lsp to the utils:

  • The IProducer protocol, which is used to send messages to clients. clojure-lsp needs this protocol so that it can swap in a no-op version in tests, and a version that prints messages to stdout in the API. Other servers may need to do the same thing, or they may want a protocol simply to organize their code and make it easier to find usages of the protocol methods.
  • The ILogger protocol, which is used to add messages to the log. Again, clojure-lsp needs this so it can swap in no-op versions. Other servers might have similar concerns.
  • shared tools for
    • managing files
    • manipulating uris
    • other cross-platform utilities
  • Anything else pioneered by clojure-lsp that other servers find useful.
  • See also lsp4clj features to move clojure-lsp#826 and Lsp4clj left-overs clojure-lsp#818, although those are getting stale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions