Lean's LSP internals appear in autocompletes for `IO.FS.Stream`
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 9.2k
- Forks
- 990
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 175
Description
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
- Open a new empty Lean file and type
#check IO.FS.Stream.and invoke completion. - Observe the completion list
- Add
import Leanas the first line of the file - 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:
-
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.
-
Define
abbref LspStream := IO.FS.Streamand then put the functions in theLSPStreamnamespace. 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the completion difference for IO.FS.Stream. in an empty file with and without import Lean. Read the IO.FS.Stream namespace and the Lean language-server LSP definitions, then determine how the LSP functions can be separated from downstream stream completions. Done means the completion list no longer presents JSON-RPC and LSP functions as the majority of IO.FS.Stream results.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100