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 highlight for gleam until ran :TSBufEnable highlight #6602

Open
glyh opened this issue May 8, 2024 · 2 comments
Open

No syntax highlight for gleam until ran :TSBufEnable highlight #6602

glyh opened this issue May 8, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@glyh
Copy link

glyh commented May 8, 2024

Describe the bug

For gleam, I have to run :TSBufEnable highlight to see the highlight, this doesn't happen to other languages.

To Reproduce

  1. Install gleam on nvim-treesitter
  2. Open some gleam files

Expected behavior

Syntax highlighting works just fine.

Output of :checkhealth nvim-treesitter

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK `node` found v21.7.3 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (GCC) 13.2.1 20240417
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.8.9-arch1-1",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Thu, 02 May 2024 17:49:46 +0000"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - cuda                ✓ ✓ ✓ ✓ ✓
  - gleam               ✓ ✓ ✓ ✓ ✓
  - go                  ✓ ✓ ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - ruby                ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓
  - vimdoc              ✓ . . . ✓

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

Output of nvim --version

NVIM v0.10.0-dev-3096+g17c89eac1
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

Additional context

No response

@glyh glyh added the bug Something isn't working label May 8, 2024
@clason
Copy link
Contributor

clason commented May 8, 2024

Need a reproducible setup, otherwise there's nothing we can do. Also, make sure your filetype is actually set to gleam (before nvim-treesitter is loaded; lazy-loading is not supported).

@nvim-treesitter nvim-treesitter deleted a comment from fshamim Jun 12, 2024
@jjramsey
Copy link

FWIW, I have a similar problem, but with hyprlang instead of gleam. In my case, either :TSEnable highlight or :TSBufEnable highlight works.

Output of :checkhealth nvim-treesitter:

==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~
- OK `tree-sitter` found 0.22.6 (b40f342067a89cd6331bf4c27407588320f3c263) (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v22.4.1 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
  Version: cc (GCC) 14.1.1 20240522
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
  machine = "x86_64",
  release = "6.6.40-1-lts",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Mon, 15 Jul 2024 09:23:08 +0000"
} ~

Parser/Features         H L F I J
  - bash                ✓ ✓ ✓ . ✓
  - c                   ✓ ✓ ✓ ✓ ✓
  - hyprlang            ✓ . ✓ ✓ ✓
  - lua                 ✓ ✓ ✓ ✓ ✓
  - markdown            ✓ . ✓ ✓ ✓
  - markdown_inline     ✓ . . . ✓
  - python              ✓ ✓ ✓ ✓ ✓
  - query               ✓ ✓ ✓ ✓ ✓
  - vimdoc              ✓ . . . ✓

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

I had installed the nvim-treesetter plugin via vim-plug. Here's my init.lua:

local vim = vim

vim.filetype.add({
  pattern = { [".*/hypr/.*%.conf"] = "hyprlang" },
})

local Plug = vim.fn['plug#']

vim.call('plug#begin')

Plug('nvim-treesitter/nvim-treesitter', { ['do'] = ':TSUpdate' })

vim.call('plug#end')

The file that I was editing had the name ~/.config/hypr/hyprland.conf. The pattern for filename matching was cribbed from https://github.com/tree-sitter-grammars/tree-sitter-hyprlang.

Running :set filetype=hyprlang does nothing.

Neovim and tree-sitter (not nvim-treesitter) were installed via regular Arch Linux packages. (The neovim-nvim-treesitter package from the AUR wasn't used because it got me the sort of errors described here: #3092.)

@nvim-treesitter nvim-treesitter deleted a comment from RomanMIzulin Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants