clojure-lsp / clojure-lsp/lsp4clj
lsp4clj utils
- Dominant language
- Clojure
- Stars
- 67
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
Based on a [discussion](https://github.com/clojure-lsp/lsp4clj/pull/13#discussion_r928005153) 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 https://github.com/clojure-lsp/clojure-lsp/issues/826 and https://github.com/clojure-lsp/clojure-lsp/issues/818, although those are getting stale.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.