clojure-lsp / clojure-lsp/clojure-lsp

Provide structured data (docstring, arglist, etc.) for completionItem

Open
#1,929 9 comments 2 reactions 0 assignees View on GitHub
enhancement need-more-info
Dominant language
Clojure
Stars
1.3k
Forks
180
Avg merge
13m
Merged PRs (30d)
4

Description

Would y'all be open to a PR that populates the optional `data` field of the LSP [completionItem](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem) with a map of more structured information?
E.g., for a function it would include the symbol, fully qualified symbol, docstring, arglist, etc.

This would allow clients to display more structured information.

I started investigating this when I noticed that the Emacs completions were quite bare for lsp-mode Clojure:

![SCR-20241210-nztv](https://github.com/user-attachments/assets/0424d836-858d-4124-86ab-e6d9ed1ea36c)

compared to the built-in Emacs describe function:

![SCR-20241210-oaky](https://github.com/user-attachments/assets/c048ee78-8f7b-421f-847e-cf873923451d)

(These screenshots are using the [Vertico](https://github.com/minad/vertico) and [Marginalia](https://github.com/minad/marginalia) Emacs packages.)

I would love for the completion to actually search for matches in docstrings too, though that would likely be a more involved change.
(I'd probably build an n-gram index using roaring bitmaps.)

Anyway, just wanted to float the idea before I started working on anything.
I totally understand if this would be out of scope for the project and more appropriate for a fork / standalone thing.

Clojure LSP is really cool and I will continue to use it either way --- thanks for all the great work!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.