Apologies for the subject/description, I had a really tough time coming up with a one sentence summary.
With this directory structure:
lib/
ops.ex
ops/
accounts/
filters.ex
suppliers.ex
test/
ops/
suppliers_test.exs
I would like the command :Edomain without arguments to edit lib/ops.ex and otherwise edit files within lib/ops/*.ex.
I can accomplish this with the following:
let g:projectionist_heuristics['mix.exs'] = {
\ 'lib/ops.ex': {
\ 'type': 'domain',
\ },
\ 'lib/ops/*.ex': {
\ 'type': 'domain'
\ }
\ }
However, as soon as I introduce an alternate file to either command, things get a little funky.
let g:projectionist_heuristics['mix.exs'] = {
\ 'lib/ops.ex': {
\ 'type': 'domain',
\ },
\ 'lib/ops/*.ex': {
\ 'type': 'domain',
\ 'alternate': 'test/ops/{}_test.exs' " <----- Add this
\ }
\ }
Now calling :Edomain (no args) on a file within lib/ops/ that doesn't have a test will take me to the depth-first file under that dir--In my case that's opts/accounts/filters.ex. Calling it on a file with a test, in my case lib/ops/suppliers.ex, will be a no-op (leaving me on the current file). Otherwise, calling it from outside lib/ops will take me to lib/ops.ex.
I've tried some hacks like adding: 'related': ['lib/ops.ex'] under both keys to no avail.
I know it's documented that alternate will be used as the default for related but I don't think that matches up with what I'm seeing here.
Is this a bug or to be expected?
I created a small sample app here.
I've actually found this behaviour to be somewhat random (race condition, perhaps?). For example, sometimes calling :Edo on the suppliers.ex will take me to the filters.ex file, but other times it will be a no-op.
Thanks!
Apologies for the subject/description, I had a really tough time coming up with a one sentence summary.
With this directory structure:
I would like the command
:Edomainwithout arguments to editlib/ops.exand otherwise edit files withinlib/ops/*.ex.I can accomplish this with the following:
However, as soon as I introduce an alternate file to either command, things get a little funky.
Now calling
:Edomain(no args) on a file withinlib/ops/that doesn't have a test will take me to the depth-first file under that dir--In my case that'sopts/accounts/filters.ex. Calling it on a file with a test, in my caselib/ops/suppliers.ex, will be a no-op (leaving me on the current file). Otherwise, calling it from outsidelib/opswill take me tolib/ops.ex.I've tried some hacks like adding:
'related': ['lib/ops.ex'] under both keys to no avail.I know it's documented that
alternatewill be used as the default forrelatedbut I don't think that matches up with what I'm seeing here.Is this a bug or to be expected?
I created a small sample app here.
I've actually found this behaviour to be somewhat random (race condition, perhaps?). For example, sometimes calling
:Edoon the suppliers.ex will take me to the filters.ex file, but other times it will be a no-op.Thanks!