Skip to content

Custom lsp commands for file system access - #66

Merged
srivastava-diya merged 3 commits into
mainfrom
fileystems
Aug 4, 2026
Merged

Custom lsp commands for file system access#66
srivastava-diya merged 3 commits into
mainfrom
fileystems

Conversation

@jdesrosiers

Copy link
Copy Markdown
Collaborator

This branch moves filesystem access out of the language server process and into the client by adding two custom LSP requests, hyperjump/readFile and hyperjump/findFiles.

The LSP has no standard way for a server to ask a client to read an arbitrary file or scan the files in the workspace. Currently, the server accesses the file system directly, but that won't work for all clients. For example, the Monaco Editor allows you to use a VSCode-like editor on a web page. There's no file system in a browser context, so our current solution wouldn't work. This allows the language server to work in those contexts by requiring that each client implement workspace file access however is appropriate for that client.

I updated the Hyperjump file URI plugin and the workspace scan to use these new functions so nothing is depending on filesystem access anymore. I also updated the typescript config so we can enable running the server without compiling using node's type stripping feature which is convenient for neovim configuration.

This also enables some other enhancements we can make later. Currently, schemas need to be saved before we can revalidate instances because Hyperjump can't see the state of open documents, only the saved state. We can now use the custom file URI handler to look in open documents first to get the editor state and only request the file if it's not open.

A similar problem we will have in the future is that not all clients (including neovim) support notifications when files change. We can use a similar approach to enable that support in the neovim client.

Comment thread language-server/src/services/SchemaStore.ts
@srivastava-diya
srivastava-diya merged commit 4f2d5d7 into main Aug 4, 2026
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants