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

Can't ctrl click sub names that are in a required file. #157

Open
Caleb-Jeffery opened this issue Feb 5, 2025 · 2 comments
Open

Can't ctrl click sub names that are in a required file. #157

Caleb-Jeffery opened this issue Feb 5, 2025 · 2 comments

Comments

@Caleb-Jeffery
Copy link

I have a cgi file:

use lib "..";
use lib "../..";

require "common.cgi";
require "microsoft_graph.cgi";
my $siteId = get_siteId( tenant => $tenant, site => $siteName );

If I ctrl click get_siteId it is not recognised as a subroutine and I can't go to it within the microsoft_graph.cgi file.

@bscan
Copy link
Owner

bscan commented Feb 5, 2025

Hi @Caleb-Jeffery, yes this is currently a limitation of the Navigator. It's generally recommended to prefer "use" statements over "require" statements whenever possible, as I believe the require "file.cgi" is a style that was more prevalent in Perl 4.

That said, I'd still really like to support this feature. Currently, most imported symbols are found during compilation time by inspecting the symbol table. I'd like to expand this to use the Typescript based shallow Perl parser in https://github.com/bscan/PerlNavigator/blob/main/server/src/parser.ts . That's the parser already used for generating the Outline view, and has been very fast and reliable. The parser would need to run on all files in require statements, as well as runtime inheritance like Moo's extends 'ParentClass'; syntax. Additionally, I'd like to run the parser against all files in the entire workspace (assuming the workspace is reasonably sized). Pathing will be a bit tricky, especially in your example where use lib "../.."; changes where the parser needs to look for required files, but I think it can work. I can probably dive into this at some point, but others are welcome to take a stab at it as well. Thanks!

@calebjeffery
Copy link

I might take a look at this as well no promises though as this would be my first github contribution got to start somewhere

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