facebook / facebook/pyrefly

[LSP] Semantic tokens and inlay hints show up inconsistently in first file opened in new window

Open
#1,413 6 comments 1 reaction 0 assignees View on GitHub
language-server
Dominant language
Rust
Stars
7k
Forks
519
PR merge metrics
No merged PRs in 30d

Description

Sometimes, when I reload my VSCode window and open up a new Python file, semantic tokens and/or inlay hints don't show up no matter how long I wait, but then show up instantaneously if I do some action (e.g., type in the file, navigate away and come back). Things like hover, gotodef, etc. still work in the meantime.

This doesn't reproduce reliably, but my setup is:
Folder named `bar` containing:
1. A file named `bar.py` with these contents:
```
import torch
x = torch.zeros()
```
2. A Python 3.13 venv called `.venv` in which I've pip installed `torch`.
I've set the interpreter in VSCode to `bar/.venv/bin/python`.

If you repeatedly reload the window and then open up `bar.py` and wait a few seconds, you should sometimes see semantic tokens but no inlay hints (this is the most common case for me) and occasionally neither semantic tokens nor inlay hints.

The server traces contain lots of "Request failed: Request is canceled due to subsequent mutation", which may be related?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.