astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.

Home Page:https://docs.astral.sh/ruff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

assertion failed: start.raw <= end.raw appears again

zhangzhen opened this issue · comments

I'm using ruff in neovim 0.9.5.

RANGE_DICT = {
    ("NRF1_chr9_gap1_g0", 0): (32, 43),
    ("NRF1_chr9_gap1_g0", 1): (62, 73),
}

Before the constant defining statement, i typed def and then type a space. No errors occurred.
After it, i typed def and then a space. I got the following error:
thread 'main' panicked at /Users/runner/work/ruff/ruff/crates/ruff_text_size/src/range.rs:48:9:
assertion failed: start.raw <= end.raw

The current Ruff version: 0.4.4.
The current Ruff settings:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[tool.pyright]
include = ["foodie"]

Thanks for the report!

Can you tell me exactly where you're typing the def and a space? Is it like below?

RANGE_DICT = {
    ("NRF1_chr9_gap1_g0", 0): (32, 43),
    ("NRF1_chr9_gap1_g0", 1): (62, 73),
}
def 

I'm not getting any panics if I type def and a space anywhere around this code.

Can you confirm that Neovim is using the correct ruff executable i.e., the one you mentioned the version for?

Can you confirm that Neovim is using the correct ruff executable i.e., the one you mentioned the version for?

yes, it is 0.4.4

Can you tell me exactly where you're typing the def and a space? Is it like below?

yes. In any line after the global variable definition, the error occurs. here is the screenshot:
image

Sorry but I'm unable to reproduce this with the snippet above.

yes, it is 0.4.4

Can you provide the steps you took to get this value? I'm specifically referring to the Ruff version ruff-lsp is using. You can get this by following the steps below:

  1. Set the LSP log level to INFO with: :lua vim.lsp.set_log_level(vim.lsp.log_levels.INFO)
  2. Write the function to reproduce the panic
  3. Open the LSP logs with :LspLog command
  4. Look for a message like Found ruff 0.4.3 at /Users/dhruv/.local/bin/ruff

Can you confirm the Ruff version with this steps? If you face any problem, you can connect withe me on Discord (username: dhruvmanila) and we can diagnose the issue :)

Can you confirm the Ruff version with this steps?

Found ruff 0.4.0 at /Users/zhangzhen/.local/share/nvim/mason/packages/ruff-lsp/venv/bin/ruff
The Ruff version is 0.4.0 not 0.4.4.

Ah ok. Can you upgrade the ruff version installed in that environment? I believe this was fixed in a prior release as @dhruvmanila mentioned.

Yes, this was fixed in 0.4.1 via #11032. Can you try it after upgrading Ruff to 0.4.1 or later?