bscan / PerlNavigator

Perl Language Server that includes syntax checking, perl critic, and code navigation
MIT License
198 stars 39 forks source link

refactor: improve readability #98

Closed IAKOBVS closed 11 months ago

IAKOBVS commented 11 months ago

Are the values of the enums in PerlSymbolKind used externally? If not, we should remove the values or use numbers since a C compiler can optimize lookup of a switch statement with continuous values to be O(1).

bscan commented 11 months ago

Are the values of the enums in PerlSymbolKind used externally? If not, we should remove the values or use numbers since a C compiler can optimize lookup of a switch statement with continuous values to be O(1).

Yes, these values are also specified in Inquisitor.pm. When the Navigator runs perl -c on an open file, it also runs the Inquisitor in the same process which inspects the symbol tables and prints out elements. It mostly looks for imported symbols like imported packages, subs, methods, and variables. You can see the format if you run this from the main directory.

perl -c -I server/src/perl -MInquisitor testWorkspace/mainTest.pl

Essentially, parser.ts primarily parses the "current" file, while the Perl compiler is what parses all loaded dependencies.

bscan commented 11 months ago

Looks good to me, thanks again for the contributions! I'll merge some other stuff in today, and I'll try to format the files as I go.

bscan commented 11 months ago

I made a couple small touchups after the fact. There was an off-by-one issue in completion ($foo vs foo). Also, I continued adding to the subroutine signatures, and I needed to add some new code to close the call signatures when ) is reached. Thanks!