`disableLanguageServices` is ignored until the initial `workspace/configuration` response arrives
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
`disable_language_services` defaults to `false`, and is only set once the client answers the `workspace/configuration` request from `Server::new`:
https://github.com/facebook/pyrefly/blob/e43ca9967d49ecacdcad657ec2ed9fd48f4aafd1/pyrefly/lib/lsp/non_wasm/server.rs#L2783
Until then this check passes:
https://github.com/facebook/pyrefly/blob/e43ca9967d49ecacdcad657ec2ed9fd48f4aafd1/pyrefly/lib/lsp/non_wasm/server.rs#L4285-L4288
In my `numba` workspace (in VSCode), that was the first ~40 requests, including `documentSymbol`, `codeAction`, `codeLens`, `inlayHint` and `foldingRange`:
```
INFO Handling non-canceled request textDocument/documentSymbol (43)
INFO Client configuration applied to workspace: Some(Url { ... path: "/home/joren/Workspace/numba" ... })
INFO Handling non-canceled request textDocument/codeAction (46)
INFO Skipping request - language services disabled
```
VSCode caches document symbols per document version, so the outline from that window will stick around until the file is edited.
The reply is late because the `workspace/configuration` extension middleware awaits `getInterpreterPath`, which blocks while ms-python is activating:
https://github.com/facebook/pyrefly/blob/e43ca9967d49ecacdcad657ec2ed9fd48f4aafd1/lsp/src/extension.ts#L176-L190
The middleware doesn't need to wait for the interpreter. `onDidChangeInterpreter` already sends a `didChangeConfiguration`, so it could return the config as-is. The path then comes in on the next request.
That only narrows the window though; `awaiting_initial_workspace_config` would have to be checked in `make_handle_if_enabled` as well, not just before indexing.
Contributor guide
Assessment
This issue has not been assessed yet.