Projections: Alternate with context of point
nicosierra opened this issue · comments
Hi there!
TLDR: I was wondering whether we could consider the context of the point to filter it out and use it to set more granular rules.
Multiple times, I have encountered projects which have all sort of styles when it comes to split files into smaller chunks.
One example (of a rails project) could be:
A FooController
with create
, update
, destroy
methods, its tests spread through spec/controllers/foo/{ctx}_spec.rb
, being {ctx}
the name of the method above (e.g. spec/controllers/foo/create_spec.rb
).
As per the documentation, if we were to set the alternate value for controllers to that of spec/controllers/{}/
folders, where {}
is the filtered name of the controller, we would only be able to jump to one file, i.e. the first readable file.
A nice solution would be to set templates from the context, perhaps allowing us to define textObjects of the sort NearestMethod
to set up that context.
Perhaps all this is an edge case in the rails
community, although I see it as a useful feature for vim-projectionist in general.
The nearest method can be expanded with {define}
. This isn't used for a bare :A
; rather it is reserved for :.A
and :R
.