Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Show to users which modules/values are being used from open modules #1048

Open
davesnx opened this issue Nov 22, 2022 · 2 comments
Labels
type: feature New feature or request

Comments

@davesnx
Copy link

davesnx commented Nov 22, 2022

Hi,

One of the features that gets a little of fear while working with newcomers is a toplevel open. The reasoning is to make sure that you are aware from which modules came your fns/values.

But I believe it could be a tooling issue, where we the editor can render the list of values used. I'm aware that you can hover on the module and the interface will be rendered.

I'm not sure what's the best interface for solving this, both lenses and dimming what isn't used seems like a valid approach but I don't want to propose a solution.

@ulugbekna
Copy link
Collaborator

ulugbekna commented Nov 22, 2022

Solution for now:

ocamllsp has a code action "put module name in identifiers" (see https://github.com/ocaml/ocaml-lsp/blob/master/CHANGES.md#features-7) that allows to prepend the module name to all identifiers that come from that module. The code action can be run when the cursor is on an open statement. After the run, VCS should show all places that added this prefix. Hacky but I do it sometimes, and it's fine

A better solution we could implement:

I think we could use inlay hints (grayed out text within your editor) to render module names as prefixes to values that come from it. It shouldn't be difficult to do, but last time I tried, ocamllsp seemed to be sluggish to handle inlay hints requests

@davesnx
Copy link
Author

davesnx commented Nov 22, 2022

Woa https://github.com/ocaml/ocaml-lsp/blob/master/CHANGES.md#features-7 that's something that I need to try, no exactly what I was thinking, but it works.

@smorimoto smorimoto added the type: feature New feature or request label Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants