Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(indent): scope/chunk no longer work for Python & eRuby files since commit e0f882e #1413

Closed
4 tasks done
bluz71 opened this issue Feb 25, 2025 · 4 comments · Fixed by #1335
Closed
4 tasks done
Labels
bug Something isn't working

Comments

@bluz71
Copy link

bluz71 commented Feb 25, 2025

Did you check docs and existing issues?

  • I have read all the snacks.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of snacks.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.4

Operating system/version

Linux Mint 22.1

Describe the bug

Scope & block indent highlighting no longer function since commit e0f882 (use async treesitter parsing when available) for Python & eRuby files; note, other filetypes such as Lua, JavaScript, Ruby do continue to work. Problems appears to only effect some filetypes (I think Bash and TSX files also fail since commit e0f882e).

Rollback to the commit before e0f882 and all filetypes work.

Steps To Reproduce

This is my minimal Neovim init.vim configuration:

" % NVIM_APPNAME=nvim_test nvim

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath

set mouse=a
set termguicolors
set splitkeep=cursor

call plug#begin('~/.config/nvim_test/plugged')
Plug 'folke/snacks.nvim'
call plug#end()

lua << END
require("snacks").setup({
  indent = {
    animate = {
      enabled = false,
    },
    scope = {
      only_current = true,
    },
    chunk = {
      enabled = true,
      only_current = true,
    },
  },
})
END

Then test against this simple Python file (let's name it hcf.py):

# Python program to find H.C.F of two numbers

# define a function
def compute_hcf(x, y):

# choose the smaller number
    if x > y:
        smaller = y
    else:
        smaller = x
    for i in range(1, smaller+1):
        if((x % i == 0) and (y % i == 0)):
            hcf = i 
    return hcf

num1 = 54 
num2 = 24

print("The H.C.F. is", compute_hcf(num1, num2))

Expected Behavior

I expect to see scope and chunk indent highlighting as I navigate the Python file (or eRuby file).

No such highlighting occurs with commit e0f882e (or later).
Rollback to the commit prior, dd15e3a, and scope/chunk indent highlighting does display.

Repro

See *Steps to Reproduce".
@bluz71 bluz71 added the bug Something isn't working label Feb 25, 2025
@folke
Copy link
Owner

folke commented Feb 25, 2025

Can't reproduce. Make sure you use Neovim stable or a recent nightly.
If you want me to further look into this, then please provide a repro from the issue template.

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2025
@bluz71
Copy link
Author

bluz71 commented Feb 25, 2025

Note, I did use NVIM v0.10.4 stable and the Neovim nightly from today (Feb 25th). Both produced the issue with Python and eRuby files.

I am quite surprised you can't reproduce it. I wonder if computer speed factors in?

I guess I will try again with the issue template.

@bluz71
Copy link
Author

bluz71 commented Feb 25, 2025

This repro.lua file produces the issue for me:

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    {
      "folke/snacks.nvim",
      opts = {
        indent = {
          animate = {
            enabled = false,
          },
          scope = {
            only_current = true,
          },
          chunk = {
            enabled = true,
            only_current = true,
          },
        },
      },
    },
  },
})

When I edit this Python file (nvim -u repro.lua hcf.py) I get no scope/chunk indentation:

# Python program to find H.C.F of two numbers

# define a function
def compute_hcf(x, y):

# choose the smaller number
    if x > y:
        smaller = y
    else:
        smaller = x
    for i in range(1, smaller+1):
        if((x % i == 0) and (y % i == 0)):
            hcf = i 
    return hcf

num1 = 54 
num2 = 24

print("The H.C.F. is", compute_hcf(num1, num2))

See this screenshot:

Image

My Neovim version is:

:version
NVIM v0.10.4
Build type: Release
LuaJIT 2.1.1713484068
Run ":verbose version" for more info

@bluz71
Copy link
Author

bluz71 commented Feb 25, 2025

Thank you @folke, confirmed as fixed.

folke pushed a commit that referenced this issue Feb 25, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.22.0](v2.21.0...v2.22.0)
(2025-02-25)


### Features

* **image:** allow disabling math rendering. Closes
[#1247](#1247)
([1543a06](1543a06))
* **image:** configurable templates for math expressions. Closes
[#1338](#1338)
([e039139](e039139))
* **image:** removed `org` integration, since that is now handled by the
org mode plugin directly.
([956fe69](956fe69))
* **picker.input:** added some ctrl+r keymaps similar to cmdline. Closes
[#1420](#1420)
([c864a7d](c864a7d))
* **util:** util method to check if ts lang is available on any Neovim
version. See [#1422](#1422)
([e2cb9df](e2cb9df))


### Bug Fixes

* **compat:** fixup
([ceabfc1](ceabfc1))
* **compat:** properly detect async treesitter parsing
([842605f](842605f))
* **compat:** vim.fs.normalize. Closes
[#1321](#1321)
([2295cfc](2295cfc))
* **dim:** check that win is valid when animating dim. Closes
[#1342](#1342)
([47e1440](47e1440))
* **image.placement:** max width/height in cells is 297. Closes
[#1345](#1345)
([5fa93cb](5fa93cb))
* **image.terminal:** reset queue when timer runs
([2b34c4d](2b34c4d))
* **image.terminal:** write queued terminal output on main
([1b63b18](1b63b18))
* **picker.buffers:** add `a` flag when buffer is visible in a window.
See [#1417](#1417)
([91c3da0](91c3da0))
* **picker.recent:** expand to full path before normalizing. Closes
[#1406](#1406)
([cf47fa7](cf47fa7))
* **picker:** allow overriding winhl of layout box wins. Closes
[#1424](#1424)
([b0f983e](b0f983e))
* **picker:** disable regex for grep_word
([#1363](#1363))
([54298eb](54298eb))
* **picker:** remove unused keymaps for mouse scrolling
([33df54d](33df54d))
* **picker:** update titles before showing. Closes
[#1337](#1337)
([3ae9863](3ae9863))
* **scope:** use `rawequal` to check if scope impl is treesitter. Closes
[#1413](#1413)
([4ce197b](4ce197b))
* **scroll:** compat with Neovim 0.9.4
([4c52b7f](4c52b7f))
* **statuscolumn:** right-align the current line number when
relativenumber=true. Closes
[#1376](#1376)
([dd15e3a](dd15e3a))
* **win:** don't update title is relative win is invalid. Closes
[#1348](#1348)
([a00c323](a00c323))
* **win:** use correct keys for displaying help. Closes
[#1364](#1364)
([b100c93](b100c93))
* **zen:** always count cmdheight towards Zen bottom offset
([#1402](#1402))
([041bf1d](041bf1d))


### Performance Improvements

* **scope:** use async treesitter parsing when available
([e0f882e](e0f882e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants