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

Automatically detect additional workspace #55

Open
rabbiveesh opened this issue Dec 16, 2022 · 4 comments
Open

Automatically detect additional workspace #55

rabbiveesh opened this issue Dec 16, 2022 · 4 comments
Labels
good first issue Good for newcomers

Comments

@rabbiveesh
Copy link

I have a monorepo setup, where I have some code in the root of my repo, and other code in subdirectories.

RIght now, perlnavigator is only picking up that the root of my repo is the workspaceFolder, but not in my subdirectories. The subdir is just like any other standard perl dir, with lib/, t/, bin/ and the like. It even has a dist.ini.

Is there a way to automatically get perlnavigator to pick this up?

@bscan
Copy link
Owner

bscan commented Dec 16, 2022

Yes, this should work. The Navigator is not very workspace centric, but rather path centric. I suspect you just need lib on the path.

Something like "perlnavigator.includePaths": [ "$workspaceFolder/mySubFolder/lib" ] should work.

In general, most of the path resolution is done by perl itself using perl -c, so as long as individual perl files can find their dependencies via -I include paths, most of the features should work. Let me know if something doesn't work as expected with this setup.

@rabbiveesh
Copy link
Author

rabbiveesh commented Dec 17, 2022 via email

@bscan
Copy link
Owner

bscan commented Dec 17, 2022

Correct, the Navigator really isn't workspace oriented, it's oriented around single files. As long as each file does a use on any dependency it needs, perl resolves all the files it needs and the Navigator is able to work well. Is there anything workspace-specific that the Navigator isn't currently finding? I suppose the use module autocompletion will be missing things from subdirectories.

One thing that could help is automatically finding the root paths and adding them to the include path. For example, if I open lib/Bar/Baz.pm which has package Bar::Baz at the top, and it tries to use Bar::Qux, it's pretty clear that the user needs to include that base lib directory to get this to work. Adding it automatically would be a nice convenience feature. This would help for subdirectories in monorepos, and for users who simply open files without any workspace at all. However, this wouldn't work for any other files outside of that lib directory. For example, with two different projects as subdirectories with lib folders, one project would not be able to import from the other.

@bscan bscan added the good first issue Good for newcomers label Jul 10, 2023
@bscan
Copy link
Owner

bscan commented Jul 10, 2023

Just curating tickets here and tagging this as "good first issue". Updating getAdjustedPerlCode in diagnostics.ts would be a nice feature. Essentially, it should detect packages and automatically add the base path from that package.

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

No branches or pull requests

2 participants