bscan / PerlNavigator

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

Improved support for Dancer and Dancer2 #85

Closed ulizama closed 9 months ago

ulizama commented 10 months ago

84 This pull requests does some improvements on the Dancer/Dancer2 support.

Screenshot 2023-08-29 at 12 53 05

bscan commented 10 months ago

Also, in your screenshot, it doesn't look like get/any/post/hook keywords were syntax highlighted. Does the additional syntax highlighting work for you? If you have other syntax highlighting extensions enabled (e.g. Better Perl Syntax) they can interfere with the Navigator's highlighting.

ulizama commented 10 months ago

Updated the code with the suggested fixes.

I also updated the screenshot with the Better Perl Syntax disabled to show the correct highlights from the plugin. All Dancer keywords are being correctly highlighted.

bscan commented 9 months ago

Thanks for the commit and I appreciate your patience on this one. While I was merging your code, it made me realize I had a few long-standing issues in there. For example, pltags was double looping over all code in CleanForBalanced which was slower than needed. By preprocessing the code and refactoring into a class, the tagger is now better suited for extensions like this one. For example, the Dancer2 code is now it's own function: https://github.com/bscan/PerlNavigator/blob/a270c5e5eab1f1c4091eee30163a1300dc6c2a11/server/src/perl/lib_bs22/pltags.pm#L376

I like the idea of supporting more frameworks and your Dancer2 example is great code for others to follow. Thanks again for the ticket and the pull request. I will do some more testing before releasing to the marketplace, but let me know if I broke anything during the merge. Thanks!