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

Perl. Syntax highlight. // operator as a comment #1495

Closed
axlewdev opened this issue Apr 8, 2018 · 15 comments · Fixed by #2048
Closed

Perl. Syntax highlight. // operator as a comment #1495

axlewdev opened this issue Apr 8, 2018 · 15 comments · Fixed by #2048

Comments

@axlewdev
Copy link

axlewdev commented Apr 8, 2018

After // operator all lines is highlighted as comment.
Version 3.0 3143

@alexqfredrickson
Copy link

alexqfredrickson commented Apr 24, 2018

+1 as I am facing this issue as well in Sublime Text 3.0 (Build 3143). Syntax highlighting is broken for all code after the // invocation - i.e. all following lines, and the remainder of the line.

This can also happen with / /, as in split / /.

For example:

use XML::XPath;

$file_handler = XML::XPath->new(filename => "$filename");
my @config_info = split / /, get_configuration( "//foo/config", $file_handler );

sub get_configuration {
    my $param1 = shift;
    my $param2 = shift;
    return "configuration";
}

TheClams pushed a commit to TheClams/Packages that referenced this issue May 10, 2018
Fix issue sublimehq#541 with  space at the beginnign of a regexp
Fix issue sublimehq#1495 and sublimehq#1594 where // can break the syntax highlighting
Fix issue sublimehq#1325 and sublimehq#1029 related to regexp modifier

Fix issue sublimehq#1326 with variable starting with underscore
deathaxe added a commit to deathaxe/sublime-packages that referenced this issue May 11, 2018
Fixes sublimehq#541, sublimehq#1029, sublimehq#1325, sublimehq#1326, sublimehq#1495

Supersedes sublimehq#1556

According to sublimehq#481 this commit provides an Oniguruma free Perl syntax
definition written from scratch.

OUTLINE

  1. fixes all currently open issues
  2. much more feature complete
  3. completely compatible with new regex engine
  4. uses embed to include custom syntaxes within
     POD and HEREDOCS (CSS,JS,JSON,HTML,SQL,XML)
  5. provides a syntax test file
  6. uses as much atomic rules from Perl.sublime-syntax and
     ModernPerl package as possible (with some fixes/modifications)
  7. follows the doc http://perldoc.perl.org as close as possible
  8. add some snippets with some files renamed to match naming style

REMARKS

1. The benchmark tests on a 100k file with all kinds of statements
   output about 360ms for evaluation on a Windows box.

2. The main focus is to create a robust base for syntax highlighting
   rather than scoping each language entity/construct in detail.

   a) Not all meta scoping RFCs are implemented in detail due to
      some limitations caused by HEREDOC. Especially pushing in/out
      of `meta.block` or `meta.braces` breaks some HEREDOC constructs.

   b) Scope names were changed to follow the scope naming guidelines
      as close as possible and try to use as general names as possible.
      -> Maybe needs some refines?

3. At the current point the implementation is a work in progress and
   needs testing by perl power users to

   a) check for highlighting to work in all situations

   b) constants/variables/functions are scoped correctly

4. This commit adds some snippets but does not include any completions
   in favor of https://packagecontrol.io/packages/Perl%20Completions
@deathaxe
Copy link
Collaborator

Should be fixed by the merged PR #1564

@KES777
Copy link

KES777 commented Jun 19, 2018

Is there instruction which steps I should take to be updated to latest version?

@rwols
Copy link
Contributor

rwols commented Jun 19, 2018

@KES777:

  1. clone this repository like any other repository, say /path/to/Packages
  2. make a symlink to /path/to/Packages/Perl from
  • $XDG_CONFIG_HOME/sublime-text-3/Packages/Perl (linux), or
  • ~/Library/"Application Support"/"Sublime Text 3"/Packages/Perl (osx), or
  • %APPDATA%\Sublime Text 3\Packages\Perl (windows)

This is just for Perl, you can make more symlinks for other languages.

@KES777
Copy link

KES777 commented Jun 20, 2018

  1. I did that. Now code is pink =) May you advice some theme editor so I can fix colors?

or some tool that will display info about what stash/content_for are
or tool which will point the line at My.hmTheme file which used for highlight keyword (I use that two years ago but now I do not remember it)

It thinks that keyword is variable.scss:

		<dict>
			<key>name</key>
			<string>SCSS: Variables (pink)</string>
			<key>scope</key>
			<string>variable, variable.scss</string>
			<key>settings</key>
			<dict>
				<key>foreground</key>
				<string>#D33682</string>
			</dict>
		</dict>

Before installation the keyword was detected as:

		<dict>
			<key>name</key>
			<string>User-defined constant</string>
			<key>scope</key>
			<string>constant.character, constant.other</string>
			<key>settings</key>
			<dict>
				<key>foreground</key>
				<string>#CB4B16</string>
			</dict>
		</dict>

and methods are not detected at all

  1. The same part of code may be highlighted differently:

delete1

  1. Regular expressions are not highlighted correct

delete2
as you can see third and forth lines are broken

@KES777
Copy link

KES777 commented Jun 20, 2018

The text of target sub:

sub _is_email {
  state $email_rfc5322_re = do {
    my $atom           = qr;[a-zA-Z0-9_!#\$\%&'*+/=?\^`{}~|\-]+;o;
    my $quoted_string  = qr/"(?:\\[^\r\n]|[^\\"])*"/o;
    my $domain_literal = qr/\[(?:\\[\x01-\x09\x0B-\x0c\x0e-\x7f]|[\x21-\x5a\x5e-\x7e])*\]/o;
    my $dot_atom       = qr/$atom(?:[.]$atom)*/o;
    my $local_part     = qr/(?:$dot_atom|$quoted_string)/o;
    my $domain         = qr/(?:$dot_atom|$domain_literal)/o;

    qr/$local_part\@$domain/o;
  };

  return $_[0] =~ $email_rfc5322_re;
}

@deathaxe
Copy link
Collaborator

Are you sure to have the latest Perl.sublime-syntax to be applied?

If I enter your example from the screenshots and paste your latest snippet into ST it looks like that

screenshot

@KES777
Copy link

KES777 commented Jun 20, 2018

I am sure. Now // works fine.

and without that plugin the code displayed as:

delete1

What problem can be?

@deathaxe
Copy link
Collaborator

What means "Now // works fine"? Does it mean the current Perl syntax works or does it mean you deleted it to make it work?

Just tried the default Perl.sublime-syntax which is bundled with ST3176. It does not highlight everything but at least does not break the code. So I can't tell you the reason as everything works for me.

@KES777
Copy link

KES777 commented Jun 20, 2018

After installing (as rwols said) the // started to work fine.

If I remove installed Packages/Perl the code is highlighted as this:

delete1

I will check fresh 3176 version when it will be available as package for linux mint

@vsespb
Copy link

vsespb commented Jul 24, 2018

still broken in 3176 under debian 9

@wbond
Copy link
Member

wbond commented Jul 24, 2018

@vsespb This isn't part of the 3176 release. Did you install from this git repo?

@vsespb
Copy link

vsespb commented Jul 24, 2018

no. i get it - need wait new release after 3176

@michaelblyons
Copy link
Collaborator

Looks good in 3208.

@KES777
Copy link

KES777 commented Jul 27, 2019

At the version 5163f2ef3d5 I see next results:

_2

They are OK

deathaxe pushed a commit to deathaxe/sublime-packages that referenced this issue Aug 25, 2019
This PR proposes to close some already fixed issues, which were not (correctly) referenced in the fixing pull requests.

Closes sublimehq#442
Closes sublimehq#685
Closes sublimehq#691 (invalid)
Closes sublimehq#795
Closes sublimehq#807
Closes sublimehq#903
Closes sublimehq#1141
Closes sublimehq#1172
Closes sublimehq#1245
Closes sublimehq#1257
Closes sublimehq#1286
Closes sublimehq#1320
Closes sublimehq#1357
Closes sublimehq#1382 (wontfix)
Closes sublimehq#1403
Closes sublimehq#1451
Closes sublimehq#1453 (maybe)
Closes sublimehq#1472
Closes sublimehq#1495
Closes sublimehq#1540
Closes sublimehq#1542
Closes sublimehq#1565
Closes sublimehq#1576
Closes sublimehq#1625
Closes sublimehq#1880
Closes sublimehq#1898
Closes sublimehq#1940 (invalid)
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

Successfully merging a pull request may close this issue.

8 participants