atom / language-javascript

JavaScript language package for Atom
Other
194 stars 236 forks source link

Open brace in regex causes auto-indent error #658

Open wbt opened 5 years ago

wbt commented 5 years ago

This Issue is very similar to #646.

Steps to Reproduce

  1. In Atom, create a new Javascript file or edit an existing one.
  2. Add the following lines of code:
    var matches = line.match(/{/);
    console.log("Javascript line to follow");
  3. Select that code, and/or all code in the file.
  4. Autoindent.

Expected behavior: These two lines of code are indented to the same level, whatever that may be, as shown above.

Actual behavior: The second line, and all which follow, are indented one extra level.

Edit by @rsese to add screenshot

auto-indent-with-regex-brace

Reproduces how often: Every time.

Versions

atom --version: Atom : 1.23.2 Electron: 1.6.15 Chrome : 56.0.2924.87 Node : 7.4.0 apm --version: apm 2.4.3 npm 6.2.0 node 10.2.1 x64 atom 1.40.1 python git 2.15.0.windows.1 visual studio 2015

Windows 10

rsese commented 5 years ago

Thanks again for reporting :+1: Reproduced with 1.40.1 on macOS 10.14.6.