Skip to content

tree-sitter-scss nodes parsed as ERROR only in vue #10

Closed
@sethidden

Description

@sethidden

Recently, a scss parser was added to nvim-treesitter:

Also see the PR that added tree-sitter-scss to nvim-treesitter: https://github.com/nvim-treesitter/nvim-treesitter/pull/1109/files


tree-sitter-scss highlights .scss files fine, but if you paste the very same contents of that .scss file into a .vue <style lang="scss"> tag, this happens:

2021-04-17T09:48:36,094974285+02:00
top half: .scss file - left is query info, right is the source code itself
bottom half: .vue file - left is query info, right is the source code

The syntax highlighting starts breaking whenever you use the keywords "and" or "or", even if they're part of a variable name:
eg. $my-color: red; - since color contains or, the highlighting breaks. But that happens only in .vue files. .scss files are ok.

People originally started reporting parsing issues since this comment: nvim-treesitter/nvim-treesitter#650 (comment)

(query info thanks to https://github.com/nvim-treesitter/playground)


System info:

treesitter healthcheck
## Installation
 24   - OK: `tree-sitter` found  0.19.4 (6dd41e2e45f8b4a00fda21f28bc0ebc6b172ffed) (parser generator, only needed for :TSInstallFromGrammar)
 25   - OK: `node` found v14.16.0 (only needed for :TSInstallFromGrammar)
 26   - OK: `git` executable found.
 27   - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl" }
 28   - OK: Neovim was compiled with tree-sitter runtime ABI version 13 (required >=13). Parsers must be compatible with runtime ABI.
## Parser/Features H L F I
  ...cut out unrelated parsers...
  - typescript     ✓ ✓ ✓ ✓ 
  - javascript     ✓ ✓ ✓ ✓ 
  - scss           ✓ . . ✓ 
  - css            ✓ . ✓ ✓ 
  - html           ✓ ✓ ✓ ✓ 
  - vue            ✓ . ✓ . 
nvim verison
NVIM v0.5.0-dev+1227-gb518b9076
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az207-598

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

Plugin versions:
nvim-treesitter a0e99abd7c4485d4da34e8f57fb930fe1dbaa93c

Parser versions:
tree-sitter-vue 91fe275
tree-sitter-scss b2407613f3804d0db15ae6f9f49cf2e759f06dba

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions