facebook / facebook/pyrefly

Semantic Token Inconsistencies between Editors

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

Description

### Describe the Bug

I am noticing some bugs around semantic tokens in neovim. Below is a screenshot of some code I am working on (code attached as well for reference)

Image

On the left is vscode, running pyrefly 0.45.1 and on the right is neovim running pyrefly 0.45.1.

You can see that the semantic tokens in vscode all seem to be applying correctly but in neovim they aren't, The one that caught my eye is the coloring for "MetadataManager", a custom class I am writing

Image

Image

Interestingly, pyrefly _is_ applying semantic tokens for _some_ stuff in Neovim, exceptions for example are being correctly highlighted

Image

I have noticed lots of weirdness around semantic tokens lately but I finally decided to submit something to see if I am doing something wrong here.
I am not sure how to "inspect" the highlighting of a token in vscode (or if that is even possible).

In neovim, I am using neovim's native `lsp` and my command is simply `pyrefly lsp`. Currently I am passing no options along to the lsp server.
I also attached the log from neovim's lsp client, maybe that is useful? Please let me know if there is anything else I can provide!

[test_manager.py](https://github.com/user-attachments/files/24088374/test_manager.py)

[pyrefly.log](https://github.com/user-attachments/files/24088376/pyrefly.log)

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

_No response_

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.