language-ruby icon indicating copy to clipboard operation
language-ruby copied to clipboard

Escaped characters in Ruby regex throws off color syntax highlighter

Open jreif opened this issue 3 years ago • 3 comments

Description

When writing code in ruby that includes an empty regex expression (ex: //) or that includes only an escaped character (ex: /\D/), it throws off the colors of the syntax highlighter on the line and often on the rest of the file too.

Steps to Reproduce

  1. Create new file
  2. Select Ruby grammar for the file
  3. Type the following line of code character by character: "test 123".match(/\D/)

Expected behavior:

Expectation is for colors to remain correct instead of blanking out. Ex: green for string, blue for method, purple for regex delimiters (forward slashes), light blue for escaped characters within regex.

Actual behavior:

Note colors look ok as you type, but colors go away as soon as you close the regex expression (second forward slash) and whole line remains in plain white color. There are some variations to this but this is the simplest example I can describe that consistently borks like this.

Reproduces how often:

All the time.

Versions

macOS 11.2.3 Atom : 1.55.0 Electron: 6.1.12 Chrome : 76.0.3809.146 Node : 12.4.0 apm 2.5.2 npm 6.14.8 node 12.4.0 x64 atom 1.55.0 python 2.7.16 git 2.30.1

jreif avatar Mar 16 '21 22:03 jreif

You should open the issue with the example code in this repo: https://github.com/atom/language-ruby

aminya avatar Mar 22 '21 15:03 aminya

@jreif Could you add some code samples? A screenshot or gif would be good

darangi avatar Mar 23 '21 11:03 darangi

atom-highlight

jreif avatar Mar 24 '21 00:03 jreif