rust-lang / rust-lang/rust-analyzer

Custom type rendering support

Open
#23,141 6 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

My library whippyunits (and upcoming linear algebra adapter whippyalgebra) makes extensive use of deep, not very human readable generics. To deal with this, I ship a LSP proxy that wraps the rust-analyzer binary, intercepting the JSON messages, sniffing out my types, and rewriting them into human readable form:

Image

This works exceptionally well - it is hard to overstate how helpful it is to be able to look at the shape and semantics of a matrix on mouseover - but it is not composable and it requires an annoying installation for my users.

A proper r-a feature that allows this kind of text manipulation would be extremely useful. Even better if it allows customization of autofill behavior on double-click (my LSP proxy replaces verbose Quantity types with simple qty! macro invocations). There's no need to support particularly deep reflection/metaprogramming in the text transformation layer - you get very good results even if you just parse the literal string of the type that would be rendered, and re-render it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rust-analyzer binary and the JSON messages intercepted by the existing LSP proxy. Determine which rendered-type and double-click autofill behaviors would need a customization interface, then define a minimal composable design and verify it against the whippyunits examples described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.