Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Tree-Sitter: Invalid scope detected for empty JavaScript lines #17942

Closed
@robertrossmann

Description

Prerequisites

Description

With Tree-Sitter enabled, inside a JavaScript file, the scope is reported as * if the cursor is placed on an empty line. This causes JavaScript code snippets to not work at all.

As soon as I place the cursor on any piece of code the scope is properly reported as being source.js + whatever syntax node is currently under the cursor.

Steps to Reproduce

  1. Enable Tree-Sitter parsers
  2. Create a new, empty JavaScript file or open an existing JS file and place the cursor on an empty line (ie. the last line)
  3. Log the cursor's scope
  4. Observe scope being reported as just * instead of source.js

Expected behavior: Scope is always reported as source.js regardless of whether or not there is a syntax node under the cursor

Actual behavior: Scope is reported as * when there is no syntax node under the cursor

Reproduces how often: All the time, for JavaScript files only (tested with Makefile, .json, .yaml, .sql, scopes work correctly here)

Versions

Atom    : 1.32.0-nightly3
Electron: 2.0.7
Chrome  : 61.0.3163.100
Node    : 8.9.3

Additional Information

I think this started happening sometime around 1.31.0-nightly6, not sure precisely when.

Obligatory screenshot with the scopes Atom reported as I tested it with various files.

scopes

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions