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

Lean's LSP internals appear in autocompletes for IO.FS.Stream #6135

Open
david-christiansen opened this issue Nov 20, 2024 · 2 comments
Open
Labels
bug Something isn't working P-low We are not planning to work on this issue

Comments

@david-christiansen
Copy link
Contributor

Description

When a library transitively imports the Lean language server, then various functions that it defines in the IO.FS.Stream namespace show up in completion results for streams. In fact, they make up the majority of these completion results!

This could easily hit a user who's downstream of Verso or Alloy, both of which define their own LSP handlers.

Context

This came up when working on the IO chapter of the reference manual, but it's not a blocker in the slightest.

Steps to Reproduce

  1. Open a new empty Lean file and type #check IO.FS.Stream. and invoke completion.
  2. Observe the completion list
  3. Add import Lean as the first line of the file
  4. Invoke completion in the same position as before, and observe the completion list

Expected behavior:

I would expect that the completions were unchanged.

Actual behavior:

The majority of the completions list has to do with JSON-RPC and LSP, giving the impression that this is the purpose of IO.FS.Stream.

Suggestions

I think this could be solved in two ways in the language server:

  1. Get those functions out of the namespace. This would make the experience of working on the LSP server a bit worse, because dot-completion would no longer select those functions.

  2. Define abbref LspStream := IO.FS.Stream and then put the functions in the LSPStream namespace. This would spare downstream users from seeing them, and also perhaps make it marginally more clear which role a given stream plays.

Versions

"4.15.0-nightly-2024-11-19", on live.lean-lang.org.

Impact

I think this is a papercut at worst.

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@david-christiansen david-christiansen added the bug Something isn't working label Nov 20, 2024
@nomeata
Copy link
Collaborator

nomeata commented Nov 20, 2024

Isn't there also the idea floating around of a change to name resolution, so that if open A, then A.B.f works as B.f for b : B? So that namespace can add selective dot notation to other types?

@david-christiansen
Copy link
Contributor Author

That language change would indeed introduce a third way to remedy this!

@leanprover-bot leanprover-bot added the P-low We are not planning to work on this issue label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-low We are not planning to work on this issue
Projects
None yet
Development

No branches or pull requests

3 participants