GithubHelp home page GithubHelp logo

Comments (1)

nhu avatar nhu commented on June 2, 2024

I have noticed the same issue in rust and csharp.

It may be related to the 'textobjects.select.include_surrounding_whitespace' option.
If it is set to true, I get the described behaviour.
If it is et to false, the function is selected correctly.

InspectTree shows that the syntax tree is correct, if this is any useful.

2024-02-06_15-43

config (it's the sample config without comments)
textobjects = {
  select = {
    enable = true,
    lookahead = true,
    keymaps = {
      ["af"] = "@function.outer",
      ["if"] = "@function.inner",
      ["ac"] = "@class.outer",
      ["ic"] = { query = "@class.inner", desc = "Select inner part of a class region" },
      ["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" },
    },
    selection_modes = {
      ['@parameter.outer'] = 'v', 
      ['@function.outer'] = 'V',  
      ['@class.outer'] = '<c-v>', 
    },
    include_surrounding_whitespace = false,  -- <-- set to TRUE and the selection breaks
  },
}
:checkhealth nvim-treesitter ============================================================================== nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~

  • OK tree-sitter found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar)
  • OK node found v21.6.1 (only needed for :TSInstallFromGrammar)
  • OK git executable found.
  • OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (GCC) 13.2.1 20230801
  • OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
machine = "x86_64",
release = "6.7.2-arch1-1",
sysname = "Linux",
version = "#1 SMP PREEMPT_DYNAMIC Fri, 26 Jan 2024 19:10:20 +0000"
} ~

Parser/Features H L F I J

  • bash ✓ ✓ ✓ . ✓
  • c ✓ ✓ ✓ ✓ ✓
  • c_sharp ✓ ✓ ✓ . ✓
  • csv ✓ . . . .
  • graphql ✓ . . ✓ ✓
  • html ✓ ✓ ✓ ✓ ✓
  • hurl ✓ . ✓ ✓ ✓
  • javascript ✓ ✓ ✓ ✓ ✓
  • json ✓ ✓ ✓ ✓ .
  • lua ✓ ✓ ✓ ✓ ✓
  • luadoc ✓ . . . .
  • luap ✓ . . . .
  • markdown ✓ . ✓ ✓ ✓
  • markdown_inline ✓ . . . ✓
  • python ✓ ✓ ✓ ✓ ✓
  • query ✓ ✓ ✓ ✓ ✓
  • regex ✓ . . . .
  • rust ✓ ✓ ✓ ✓ ✓
  • sql ✓ . . ✓ ✓
  • tsx ✓ ✓ ✓ ✓ ✓
  • typescript ✓ ✓ ✓ ✓ ✓
  • vim ✓ ✓ ✓ . ✓
  • vimdoc ✓ . . . ✓
  • wgsl ✓ . ✓ ✓ .
  • yaml ✓ ✓ ✓ ✓ ✓

Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang} ~

nvim --version NVIM v0.9.5 Build type: Release LuaJIT 2.1.1702233742

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

from nvim-treesitter-textobjects.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.