haskell / haskell/haskell-language-server

Clarify how HLS is supposed to access information about files

Open
#3,739 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

At the moment it's a little unclear how HLS (rules, plugin handlers, everything really) is supposed to access information about files.

We have two possible sources of information:
- The VFS
- The filesystem

Where do we look? What do we do if something is not in the VFS?

After some discussion on IRC, @fendor and I came to the following conclusion:
- The point of the VFS is to handle _files that are managed by the client_, and whose content may differ from the filesystem.
- For files that are _not_ in the VFS, and hence not managed by the client, it is totally fine to get them from the filesystem.

See also the prose in the spec: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_didOpen

However, at the moment, we are most often using e.g. `getFileContents`, which _only_ reads from the VFS. That might be fine (it avoids doing filesystem IO, which might be desirable), but it should be very obvious. There is a function that falls back to the filesystem, the confusingly named `getSourceFileSource`, but it's not as widely used.

We should clarify the situation and try to make things more consistent.

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.