dschwen / switch-header-source

Quick switching between C/C++ header and source files
MIT License
13 stars 49 forks source link

Incorrect switch if same file name exists elsewhere #32

Open tophmatthews opened 6 years ago

tophmatthews commented 6 years ago

When on test/src/kernels/MatDiffusion.C, switch goes to modules/phase_field_include/kernels/MatDiffusion.h

dschwen commented 6 years ago

Yeah, that's a tough one. How to you propose this should be handled?

tophmatthews commented 6 years ago

Only having one MatDiffusion in the repo? I'm surprised that is even "allowed".

The other way would be to check the path that differs by the include or src subdirectory first.

dschwen commented 6 years ago

They are never both used in the same app. The include/src check would severely limit the usefulness of the plugin (I use it to switch between .h,.C, and .md files using (.*)(\.(h|C|md))$ as my _Tracked file regular expression`).

tophmatthews commented 6 years ago

They aren't used in the same app, but they're still all accessible in my atom Moose window. I didn't know you could switch with the md now, that's handy.

All in all, not really a big deal since this seems like a one-off. Just an FYI.

maddanio commented 4 years ago

How about preferring switch targets by "closeness" in filesystem? At the very least on name colisions prefer the one that is in the same directory, and beyond that maybe use a metric based on how far apart in the directory tree two files are? should be simple, no? at least the "same dir" check should be. would help a lot :).