atom / language-ruby

Ruby package for Atom
Other
101 stars 144 forks source link

Escaped characters in Ruby regex throws off color syntax highlighter #295

Open jreif opened 3 years ago

jreif commented 3 years ago

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

aminya commented 3 years ago

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

darangi commented 3 years ago

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

jreif commented 3 years ago

atom-highlight