Skip to content

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

Open
@danielhenrymantilla

Description

@danielhenrymantilla

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxArea: Syntax highlighting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions