Comments (8)
@stsewd could you elaborate on what you mean? I'm running into the same issue...
@dlants create a file in ~/.config/nvim/after/queries/go/textobjects.scm
(node) @mycustomobject
with your custom queries, and then in your config
require'nvim-treesitter.configs'.setup {
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@mycustomobject",
},
},
}
from nvim-treesitter-textobjects.
@mawkler Maybe you need to put ; extends
from nvim-treesitter-textobjects.
I experienced the same attempt to index local 'query' (a nil value)
error when trying to define custom textobjects for the Go language. I threw in some debugging and discovered that the plugin was falling back to the comment
language at some point during the text object flow. I've got no idea if this should be expected, but removing unused languages including the comment
language silenced the error.
Unfortunately, the custom textobjects still don't seem to trigger for me after this change.
from nvim-treesitter-textobjects.
I think this option should be deprecated and instead recommend putting your custom queries on ~/.config/nvim/after/queries/go/textobjects.scm
from nvim-treesitter-textobjects.
@stsewd could you elaborate on what you mean? I'm running into the same issue...
from nvim-treesitter-textobjects.
@stsewd I can't get your solution to work. I tried creating the following textobjects.csm
file
;; ~/.config/nvim/after/queries/typescript/textobjects.scm
(method_definition) @mymethod
And I'm using the following minimal lazy.nvim config:
{
'nvim-treesitter/nvim-treesitter',
dependencies = 'nvim-treesitter/nvim-treesitter-textobjects',
build = ':TSUpdate',
config = function()
require('nvim-treesitter.configs').setup({
ensure_installed = 'all',
highlight = {
enable = true,
},
textobjects = {
move = {
enable = true,
goto_next_start = {
[']m'] = '@mymethod'
}
}
}
})
end
}
Nothing happens when I press ]m
inside a TypeScript file (with a bunch of methods). I want ]m
to jump to the next method. What am I doing wrong?
from nvim-treesitter-textobjects.
@kiyoon That works, thank you!
Do you have a link to some resource that explains what ; extends
does? I couldn't find any info online.
from nvim-treesitter-textobjects.
FWIW, not sure if it's the same, but I learned about using ; extends
in the context of nvim-treesitter here.
from nvim-treesitter-textobjects.
Related Issues (20)
- C/C++ Grammer-related crash when opening file HOT 4
- Question: closures intentionally not captured under function.inner/outer ?
- textobject's select {...} keymaps don't function once timeoutlen is set to 0
- key, value textobjects don't work HOT 4
- FR: Confusion about filetype=sh, and treesitter language bash
- change inside function(@funcion.inner) doesn't work after first time HOT 1
- Is there any way to only select function signaure? HOT 1
- Nim parser fails at compiling and installs incorrectly HOT 7
- error on perl files HOT 1
- Rust @function.outer breaks with indentation HOT 1
- Swap Keymaps Not Being Used in TypeScript, Javascript, or Ruby Buffers HOT 4
- Allow multiple queries for `select` to increase configurability
- Richer Nix queries
- after nvim-treesitter/nvim-treesitter#6024, `nvim-treesitter-textobject` started showing errors HOT 1
- Scope locals not correct for lua files
- The `move` function is very slow on some large cpp files HOT 2
- Add `set_jumps` option to `select` module
- Delete @function.outer deletes more than it should HOT 3
- Errors on Fennel files; need to update queries HOT 1
- nvim-treesitter.textobjects.repeatable_move is not found HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-treesitter-textobjects.