atom / language-javascript

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

Some types of variables are missing scopes #635

Open pbarbiero opened 5 years ago

pbarbiero commented 5 years ago

Prerequisites

Description

In atom 1.34, I am trying to update my syntax sheet that worked with the old syntax parser to take advantage of the tree-sitter parsers. Without any other extension enabled, the examples below are just from toggling the use tree sitter parsers option. (examples below are using https://github.com/thomaslindstrom/no-caffeine-syntax)

Steps to Reproduce

Edit by @rsese to add code for copy/paste

function functionName(param1, param2, param3) {}
function functionName(param1, param2, param3 = 1) {}
functionName(param1, param2).then((result) => {});
functionName(param1, param2).then(({ result }) => {});
const newThing = calculate(param1, store.getState())

Have code like this with tree sitter parsers disabled: old syntax parser

Enable tree sitter parsers, and your code will look like this: tree sitter parser

Problems seen between the two: Line 1: No problems Line 2: No scope present for param3 Line 3: No scope present for param1 and param2 Line 4: Same as line 3 except also no scope present for result Line 5: No scope present for param and store

Notes: line 4 lets me differentiate result from result in line 3 line 5 lets me differentiate store from param1

Expected behavior: All variables would have the unique scopes to target styles like we could with the old parser

Actual behavior: New parser does not target some variables with scopes to allow consistent styling with the old parser

Reproduces how often: 100%

Versions

Atom 1.34.0 Electron 2.0.16 Chrome 61.0.3163.100 Node v8.9.3

Additional

See #630

rsese commented 5 years ago

Thanks for creating a new issue for this @pbarbiero - reproduced with 1.34.0 on macOS 10.12.6.