Replies: 1 comment 1 reply
-
Through trial and error I've found that:
So, for the example code Plug({
source = gh("foo/bar"),
desc = "foo bar",
tags = { t.foo },
on_load = function()
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
print("foo")
end,
})the query ;extends
(function_call
name: (identifier) @_identifier
arguments: (arguments
(table_constructor
(field
name: (identifier) @_maybe_source) @context.start
(_) @context.final))
(#eq? @_identifier Plug)
(#eq? @_maybe_source source)) @contextwill show the context the query (function_call
name: (identifier) @_identifier
arguments: (arguments
(table_constructor
(field
name: (identifier) @_maybe_source)
(_) @context.final))
(#eq? @_identifier Plug)
(#eq? @_maybe_source source)) @contextwill show the context and the query (function_call
name: (identifier) @_identifier
arguments: (arguments
(table_constructor
(field
name: (identifier) @_maybe_source)
(_) @context.end))
(#eq? @_identifier Plug)
(#eq? @_maybe_source source)) @contextwill show the context But, there's another issue (at least on my testing). To get these results I had to manually remove the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello o/
I'm trying to make a custom query to have the

source = ...line in my context, to know the name of the plugin I'm currently scrolling through.For example the code & TS looks like this:
(You can find an example copy/pastable snippet at https://github.com/bew/dotfiles/blob/c210773d11f41cb8ed3/nvim/lua/mycfg/plugs/for_treesitter.lua#L38)
I want the end result to look like:
I tried to make the following query (in a
;; extendfile):(function_call name: (identifier) @_maybe_plug arguments: (arguments (table_constructor . ; first field (field name: (identifier) @_maybe_source @context.start ) ) ) (#eq? @_maybe_plug "Plug") (#eq? @_maybe_source "source") ) @contextWhere I specify
@contextto span the same way as the function call, and@context.startto mark that it's thesource ..line that should be visible in the context window.But I'm always getting error like
`start` is higher than `end`from thenvim_buf_get_textcall in the plugin.👉 I don't really understand this error and what to do about it..
And I tried to use
@context.endbut I'm not sure where to put it..NOTE: I kinda managed at some point to get the
sourceline in the context but at the wrong position (I don't remember how I did it now), and it's definitely not what I want anyway..:Also, I didn't find documentation for
@context.startnor@context.finalthat I see being used incontext.scmfiles 🤔Can someone help me?
Thanks 🙏
Beta Was this translation helpful? Give feedback.
All reactions