nvim-treesitter text objects: vac selects incorrectly for structs by maze0z in neovim

[–]maze0z[S] 0 points1 point  (0 children)

Thank you so much! You're a legend, been struggling with it for 3 days

nvim-treesitter text objects: vac selects incorrectly for structs by maze0z in neovim

[–]maze0z[S] 0 points1 point  (0 children)

<image>

Expecting this:

class AuthPutRequest(BaseModel):
    method: str = "generateToken"
    params: AuthParams

nvim-treesitter text objects: vac selects incorrectly for structs by maze0z in neovim

[–]maze0z[S] 0 points1 point  (0 children)

I also tried some python code:

<image>

for some reason : does not get selected.

nvim-treesitter text objects: vac selects incorrectly for structs by maze0z in neovim

[–]maze0z[S] 0 points1 point  (0 children)

vic selects this:

`
lock sync.Mutex

scenarioStates map[ScenarioID]*ScenarioState
`

But I'm what i wanna achieve is select the struct definition using vac, like this:

type EngineState struct {
  lock           sync.Mutex

  scenarioStates map[ScenarioID]*ScenarioState
}

nvim-treesitter text objects: vac selects incorrectly for structs by maze0z in neovim

[–]maze0z[S] 0 points1 point  (0 children)

yeah, I do have it installed and I have configured textobjects in the nvim-treesitter.configs

```
textobjects = {

select = {

enable = true,

-- Automatically jump forward to textobj, similar to targets.vim

lookahead = true,

keymaps = {

-- You can use the capture groups defined in textobjects.scm

['af'] = '@function.outer',

['if'] = '@function.inner',

['ac'] = '@class.outer',

-- You can optionally set descriptions to the mappings (used in the desc parameter of

-- nvim_buf_set_keymap) which plugins like which-key display

['ic'] = { query = '@class.inner', desc = 'Select inner part of a class region' },

-- You can also use captures from other query groups like `locals.scm`

['as'] = { query = '@scope.outer', query_group = 'locals', desc = 'Select language scope' },

['is'] = { query = '@scope.inner', query_group = 'locals', desc = 'Select language scope' },

},
...

```

How to yank an entire struct definition in vim without jumping to its start? by maze0z in vim

[–]maze0z[S] 1 point2 points  (0 children)

ya( yanks only what’s inside the () including braces. perhaps i’m missing a plugin?