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

Wrong highlighting for the first pattern of a match when it starts with a pipe #373

Open
danielhenrymantilla opened this issue Mar 31, 2019 · 1 comment
Labels
A-syntax Area: Syntax highlighting

Comments

@danielhenrymantilla
Copy link

Sublime Text Version

Sublime Text 3.2 (Build 3200) (when tested on Windows)

Rust Enhanced Version

2.19.0 (when tested on Windows)

Operating system

Tested on both Linux Mint and Windows 10

Expected behavior

From the Rust reference, regarding match grammar:

MatchArmPatterns :
   |? Pattern ( | Pattern )*

are valid MatchArmPatterns and should be colored accordingly.

Actual behavior

But the optional first pipe (|) sygil, when used right after the opening brace of the match expression leads to an incorrect syntax highlighting (might be related to closure syntax).

The current work around is to add a comment between the opening brace and the first pattern.

Steps to reproduce

  1. fn main ()
    {
        match None { 
            | Some(42) /* <- not highlighted */ => {},
            | Some(x) => {},
            | None => {}
        }
    } 
  2. fn main ()
    {
        match None {//
            | Some(42) /* <- good highlighting */ => {},
            | Some(x) => {},
            | None => {}
        }
    } 

References

Maybe #284

@ehuss
Copy link

ehuss commented Mar 31, 2019

Thanks, I think this is 24 on the list in #284. The issue is that it is being confused with a closure. I think the solution is to add special handling for match blocks.

@ehuss ehuss added the A-syntax Area: Syntax highlighting label Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-syntax Area: Syntax highlighting
Projects
None yet
Development

No branches or pull requests

2 participants