You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix high CPU usage when encountering non-file URI workspaces (#1396)
Fixes#1394
There are two issues here:
- Non-file schemes were being treated as if they were `file://` URIs and
we were getting their filesystem path when ends up being an empty
string.
- Neovim, when opening a virtual file (e.g. `foo://bar.html`), causes
the server to be initialized with a file URI of `file://.` and rootPath
of `/.`. I'd expect them to use the `foo://` scheme but that does not
happen. I think it's super reasonable to have the server refuse a
workspace folder that _is_ the filesystem root. This check is definitely
not exhaustive (may not handle network shares, arbitrary mounts,
different drives on Windows, etc…) but this is probably "good enough" to
detect this situation.
Both of these results in the folder being treated as `/` and results in
a file search from the root causing super high CPU usage. I've also
added a check inside `getProject` so files with non-file schemes are
ignored. They'll get a `fsPath` of empty string as well and as such
won't match any project. The VSCode extension already does this at the
extension level but we weren't doing it in the language server.
0 commit comments