Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Syntax Highlighting in nvim_treesitter #1

Closed
LordMZTE opened this issue May 7, 2021 · 3 comments
Closed

No Syntax Highlighting in nvim_treesitter #1

LordMZTE opened this issue May 7, 2021 · 3 comments

Comments

@LordMZTE
Copy link

LordMZTE commented May 7, 2021

Hello, I installed this parser using this config in my init.lua file:

local configs = require "nvim-treesitter.configs"
local parsers = require "nvim-treesitter.parsers"

local parser_config = parsers.get_parser_configs()

parser_config.haxe = {
    install_info = {
        url = "https://github.com/vantreeseba/tree-sitter-haxe",
        files = {"src/parser.c"},
        branch = "main"
    },
    filetype = "haxe"
}

configs.setup {
    ensure_installed = { "haxe" },
    highlight = {
        enable = true
    }
}

and it installs just fine when running :TSInstallFromGrammar haxe. However, I don't get any syntax highlighted in .hx files (Their filetype is set to haxe), and running :checkhealth nvim_treesitter gives me this output:

health#nvim_treesitter#check
========================================================================
## Installation
  - OK: `tree-sitter` found  0.19.4 (parser generator, only needed for :TSInstallFromGrammar)
  - OK: `node` found v15.6.0 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl" }
  - 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
  - haxe           . . . . 

 Legend: H[ighlight], L[ocals], F[olds], I[ndents]
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

and that looks fine to me. However the whole haxe file has no syntax highlighting.

@LordMZTE
Copy link
Author

LordMZTE commented May 7, 2021

Having installed some more treesitter parsers, it looks like all others show a checkmark instead of . in the syntax column. So apparently, highlighting is disabled for haxe. Is this something that needs to be changed here, or is that something I can change using my config?

@vantreeseba
Copy link
Owner

vantreeseba commented May 11, 2021

I'm not sure how they are doing it with other parsers, but I had to manually copy the queries/*.scm into the tree-sitter plugin folder.

I will look into this, and see how other ones are doing it, but it looks like they just include it in the main repo.

For example: https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries/javascript

So in my local install of it, I just made a folder beside the JS one called haxe, copied my SCM into it, restarted vim and that worked.

@vantreeseba
Copy link
Owner

Closing for now in favor of #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants