morph-labs/rift

Read workspace into memory from the `workspaceFolders` passed into `/initialize`

jesse-michael-han opened this issue · 2 comments

The base LSP server's handler for /initialize is currently a no-op:

    @rpc_method("initialize")
    async def on_initialize(self, params: InitializeParams) -> InitializeResult:
        # [todo] inject lsp capabilities here.
        logger.info(f"initializing LSP server {self.name}")
        return InitializeResult(
            serverInfo=PeerInfo(name=self.name, version=None),
            capabilities=self.capabilities,
        )

It should, if workspace folders / a root dir are specified in the params, load files (subject to reasonable constraints, e.g. excluding large binary blobs, or only including those tracked by git) into self.documents so that the server starts with an in-memory view of the workspace which is updated by didChange and didOpen events from the client.

Is this compatible with #73 ?

I think so. I haven't read the code, but I would speculate that VSCode remote editing opens an SSH connection from the client to the devbox, constructs the InitializeParams on the client after getting information about the filesystem from the devbox, and then creates and connects to a server colocated with the code on the devbox.