cameron-martin / bazel-lsp

A language server implementation for Bazel
Apache License 2.0
36 stars 1 forks source link

Preserve output bases between language server restarts #13

Closed cameron-martin closed 5 months ago

cameron-martin commented 5 months ago

75b930625cc3f345529a86f5e6d5e4994fc6d426 introduced a distinct output base for querying. However, it uses a temp directory that is deleted after the language server shuts down. This directory is potentially quite expensive to create, so destroying it is not ideal. Instead, we should put it in a permanent location, in a directory named after the hash of the workspace directory.

stagnation commented 5 months ago

Sounds good. For the record, as a special use-case: I tend to open a lot of concurrent neovim programs in the same repository, to quickly edit a build file or bzl file here and there (then I tend to forget them as background jobs), then I have some main windows where I edit source files and again jump to BUILD files. So I will often have more than one LSP in the same repository. Resource exhaustion aside, do you forsee any problems with this kind of multiplexing?

cameron-martin commented 5 months ago

This should be fine, considering that you can only interact with one window at the same time and all bazel interactions from the editor should be short, so the shared lock on bazel shouldn't get in the way too much if at all.

I think the current way it works will be very bad for this use case, since each time you create a new editor instance it'll have to refetch all repos, redo analysis, etc.