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

Make haskell-language-server work with NormalizedUri instead of NormalizedFilePath #4504

Open
MangoIV opened this issue Feb 23, 2025 · 2 comments

Comments

@MangoIV
Copy link
Contributor

MangoIV commented Feb 23, 2025

Currently, hls assumes that everything that it is working with are files. This is true even for the VFS.

This is a problem because it prevents hls to work with URIs like inmemory://, which would be useful when trying to deploy haskell-language-server on an online-playground-like webpage (as an example).

The interesting bit is that there are very few places where the knowledge that something is a filepath (vs an URI) is actually required, (probably) non-exhaustive list

  • FileExists.getFileExistsVFS (we need to load the file if the file is not part of the virtual file system)
  • FileStore.addWatchedFileRule (we need to register file watchers, I think there should be an error here, if the uri is not a file)
  • FileStore.getModificationTimeImpl (we need to get the last modified date of the file, we can just assume that the last modified date is the current time, or annotate this as an optional information)
  • IdeConfiguration.isWorkspaceFile (we need to check if the path is relative, but I think that can be worked around by just assuming that an URI that is not a filepath is part of the workspace)

I know that changing NormalizedFilePath to NormalizedUri quickly is possible and I also know that it works, but I think that would leave HLS with a lot of kind of "ad hoc" logic where

  • you check that the thing if that thing is a file
  • you do something with the filepath

I think this is an option because it seems as if this is done quite a lot in Notifications with whenUriFile but maybe someone has an idea of how to create a better interface of "things that are only supported if the uri is a file"

@michaelpj
Copy link
Collaborator

Seems fine. If someone's willing to do the work I think we could do this!

@MangoIV
Copy link
Contributor Author

MangoIV commented Mar 5, 2025

I am going to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants