Author Topic: Rust language syntax highlighting issue  (Read 2191 times)

Teknomancer

  • Community Member
  • Posts: 28
  • Hero Points: 1
Rust language syntax highlighting issue
« on: October 18, 2019, 02:29:00 PM »
Function definitions does not get proper syntax highlighting when lifetime parameters are specified using < and >.

I'm using SlickEdit Pro 2018 (v23.0.2.0 64-bit)

Attached a picture that shows this problem (see "parse_number" vs "parse_operator" in the pic).
« Last Edit: October 18, 2019, 02:47:20 PM by Teknomancer »

Dennis

  • Senior Community Member
  • Posts: 3960
  • Hero Points: 517
Re: Rust language syntax highlighting issue
« Reply #1 on: October 18, 2019, 07:22:25 PM »
This is a known limitation of the color coding.  parse_operator is not followed by an open paren (it is followed by a '<' character).  "Function" color is simply an identifier followed by a paren.

You can customize the color coding for Rust to handle this case.  Document > Rust Options... > Color Coding > Tokens > Add Other

   Type:  Function
   Start Delimeter:  :v(#= *\<[^>]*\> *\()            SlickEdit regex

This expression does not handle nested angle brackets.  I leave that as an exercise for the reader.

Teknomancer

  • Community Member
  • Posts: 28
  • Hero Points: 1
Re: Rust language syntax highlighting issue
« Reply #2 on: October 19, 2019, 04:16:57 AM »
Thanks, that worked! Will look at nesting later.