Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin opens files from other projects #26

Open
lczech opened this issue Jan 18, 2018 · 3 comments
Open

Plugin opens files from other projects #26

lczech opened this issue Jan 18, 2018 · 3 comments
Assignees

Comments

@lczech
Copy link

lczech commented Jan 18, 2018

The configuration says

The plugin will match each file's name in the project...

but it opens files from other Project Folders, too. In my particular case, I am working on a library, but also have a project that uses the library as a git submodule. So, when invoking the plugin, it sometimes switches to the copy in the submodule...

@dschwen
Copy link
Owner

dschwen commented Jan 18, 2018

Excellent point. I don't see how anyone would need to switch to a header or source in a different project.

@dschwen dschwen self-assigned this Jan 18, 2018
@lczech
Copy link
Author

lczech commented Jan 19, 2018

On that note, I also sometimes have trouble with files named the same, but in different directories. For example, foo.hpp header and foo.cpp implementation in on dir, and foo.cpp in the test dir. I tried changing the regex to start with ^, so that the whole directory is matched only, but that also just resulted in opening the file from the other project, as explained above.

Is there a way to tell the plugin to prefer opening files from the same dir?

@Glandos
Copy link

Glandos commented Jun 21, 2019

Is there a way to tell the plugin to prefer opening files from the same dir?

I see a problem in the switchMap design.

Currently, the switchMap is built with basename as key, and a list of full paths as value. In this list, files can be found in multiple projects, and they can even have the same name (not only basename, e.g. ["src/Class.h", "tst/Class.h"]), resulting in a weird source switching.

This map should index things differently to solve different pending issues. Let's start with one thought:

  • Key: file name. E.g. "Class.h"
  • Value: List of files matching the regex, but without the same name. This list should be sorted, to be able to select the next best match (i.e. select first the file in the same directory). E.g. ["src/Class.cpp", "tst/Class.cpp"]

This is a start, and a call for ideas. Maybe the full path should be used in the key? Of course, the map will use more memory… But we don't need a light-but-buggy packages 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants