Sublime Forum

Bug with perl syntax highlight

#4

Easiest way is to just download the Perl.tmLanguage file and place it in your /Packages/User directory. Then open a Perl file and change the syntax to User -> Perl (if it doesn’t open as such automatically).

0 Likes

#5

in your tmLanguage this construction does not work (((

$var = $name ? '?somevar=test' : 'other';

0 Likes

#6

another wrong highlight:
*(http://i.piccy.info/i7/9d98a6a41defb4f7126579b5d5751214/4-44-314/35134627/bug.jpg)

see: undef, $name

Also it is not show the open bracket which belong to this closing*

0 Likes

#7

Thanks for the bug report. :smile: Please grab the latest version from the repo as I believe it accounts for both errors.

0 Likes

#8

it resolve partialy. see next case:
piccy.info/view3/3390386/ba7815e … c5df0700c/

and this case also do not work, I think that is relative:

piccy.info/view3/3390398/b8d1669 … 164da9c2e/

0 Likes

#9

one another example:
piccy.info/view3/3390417/230a12a … 5dec95885/

  1. After line of comment next line is gray
  2. function calling from module also gray
  3. assigning to list context - gray
0 Likes

#10

Just to check, are you using the latest version from the repo? I’ve made some additional changes since my last post in this thread that might address the issue.

Also, it looks like some of the highlighting is broken above the sections of code you’re showing (the “sub” keyword is grey, for example). Are you able to post a larger portion of the file? If not, can you provide the scope names for the greyed out code (CTRL + ALT + SHIFT + P to show the scope in the status bar).

0 Likes

#11

Yes, I use latest

another wrong highlight:
RegEx was catched incorrectly:
piccy.info/view3/3393381/35c31a2 … 83423beae/

You must much whole words, not only parts:
piccy.info/view3/3393394/6660bd0 … f09ecf6bc/
‘pop’ clash with ‘populate’

0 Likes

#12

I can not find point where it is broken (((

But find this:

 $SRS::Error::queue_error = 'SHOP_OLD_SERVICE_LOT_IS_INACTIVE';

variable is not highlighted

0 Likes

#13

The following illustrates a syntax highlighting error. It highlights correctly without the s in s/\//gr. Or without the r. I guess r is relatively new in perl 5.14

0 Likes

#14

it seems you must: catch them as:
(
s # start for regex
'/^&*( … any symbol] #as perl syntax allow

.*? # non greedy match catched symbol in last expression

(I do not know how to show this in regex syntax) # The cantched symbol after ‘s’

.*? #non greedy match again

(I do not know how to show this in regex syntax) # The cantched symbol after ‘s’. This will match end of regex

in short: “s’!].?’!].?’!]”
But last two '!] must be as backref’s to first one

0 Likes

#15

Sorry I haven’t had the chance to work on this. Perhaps this weekend.

0 Likes

#16

one bug more. Look at this:
http://i.piccy.info/i7/5f10ef3635e1f9ca8c35609d06bde8a3/4-44-915/52379312/sublime.png

0 Likes

#17

one more:

0 Likes

#18

Is this ever going to be fixed? I just installed Version 3.0, Build 3143 yesterday as “Sublime Text is the best” and the first time i try to edit a perl script 3/4 of my file has no highlighting because of a “//”!

0 Likes

#19

This is being tracked at https://github.com/sublimehq/Packages/issues/1495.

So far we haven’t found any contributors who have decided to contribute to the Perl syntax. If you have any interest, there is a group of contributors on the Discord server who I am sure would be happy to help navigate working on syntaxes and how to submit a good PR with tests.

0 Likes

#20

Thank you for this info, i’ll take a look at it. If I have the cycles i’ll see what I can contribute.

0 Likes

#21

@glenntanner3

I put a little effort into the Perl syntax to fix a couple of issues and hopefully make it more robust.

All Perl users are invited to try it out and leave some comments in order to find remaining issues.

If you find some issues, please provide some code snippets to help identify the culprit.

1 Like

#22

Awesome; how to add to sublime? I’ll be happy to give it a shot on my perl files and give you any feedback. Feel free to comment on how to add to sublime on github.

0 Likes

#23

There are instructions on how to install these syntaxes in the README on the Package Reposistory.

0 Likes