facebook / facebook/pyrefly

Make typechecking on by default for non-VSCode editors

Open
#1,340 8 comments 0 reactions 0 assignees View on GitHub
language-server needs-discussion
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

Hi, I'm trying to run pyrefly in neovim and not getting any type checking. Here are the error logs with timestamp and level removed). I've attached debug logs at the bottom as well

```
"rpc" "pyrefly" "stderr" "starting generic LSP server\n"
"rpc" "pyrefly" "stderr" "Reading messages\n"
"rpc" "pyrefly" "stderr" "Request textDocument/semanticTokens/full (2) is canceled due to subsequent mutation\n"
"rpc" "pyrefly" "stderr" "Could not decode `LspConfig` from Null, skipping client configuration request: invalid type: null, expected struct LspConfig.\n"

```

Setting [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME) means my config comes from the below directory

```
# > echo $NVIM_APPNAME
nvim-pyrefly-reproducer
# > pwd
/home/ajc/.config/nvim-pyrefly-reproducer
# > ls
init.lua test.py
# > cat init.lua
vim.lsp.config['pyrefly'] ={
cmd = { 'pyrefly', 'lsp' },
filetypes = { 'python' },
root_markers = {
'pyrefly.toml',
'pyproject.toml',
'setup.py',
'setup.cfg',
'requirements.txt',
'Pipfile',
'.git',
},
on_exit = function(code, _, _)
vim.notify('Closing Pyrefly LSP exited with code: ' .. code, vim.log.levels.INFO)
end,
}
vim.lsp.set_log_level("debug")
vim.lsp.enable("pyrefly")
```

I open test.py, and there's no type checking for my obvious errors

```python
def add(a: int, b: int) -> int:
return a + b

add("a","b")
```

Running on linux. Pyrefly installed through uv tool install:
```
# > nvim --version
NVIM v0.11.4
Build type: RelWithDebInfo
LuaJIT 2.1.1753364724
Run "nvim -V1 -v" for more info
# > pyrefly --version
pyrefly 0.37.0
```

I've attached my full lsp.log from opening the file
[lsp.log](https://github.com/user-attachments/files/22995375/lsp.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.