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

Elixir: "W18: Invalid character in group name" #1405

Closed
millnitzluan opened this issue Jun 17, 2021 · 18 comments · Fixed by #1551
Closed

Elixir: "W18: Invalid character in group name" #1405

millnitzluan opened this issue Jun 17, 2021 · 18 comments · Fixed by #1551
Labels
bug Something isn't working

Comments

@millnitzluan
Copy link

Describe the bug

When opening elixir files like .ex/.exs I'm getting this error.

To Reproduce

Steps to reproduce the behavior:

  1. Go to elixir files
  2. See the error. W18: Invalid character in group name

Expected behavior

This error shows every time when using nvim + telescope with file preview. You can easily check it while previewing the files. Disabling elixir syntax stops the error.

Output of :checkhealth nvim_treesitter

health#nvim_treesitter#check ======================================================================== ## Installation - OK: `tree-sitter` found 0.19.5 (parser generator, only needed for :TSInstallFromGrammar) - OK: `node` found v12.20.1 (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

  • bash ‚úì ‚úì ‚úì . ‚úì
  • ruby ‚úì ‚úì ‚úì ‚úì ‚úì
  • python ‚úì ‚úì ‚úì ‚úì ‚úì
  • lua ‚úì ‚úì ‚úì ‚úì ‚úì
  • elixir ‚úì ‚úì . ‚úì ‚úì
  • html ‚úì ‚úì ‚úì ‚úì ‚úì
  • json ‚úì ‚úì ‚úì ‚úì .
  • javascript ‚úì ‚úì ‚úì ‚úì ‚úì
  • css ‚úì . ‚úì ‚úì ‚úì
  • typescript ‚úì ‚úì ‚úì ‚úì ‚úì

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}

Output of nvim --version

nvim --version NVIM v0.5.0-dev+1385-g93f15db5d Build type: Release LuaJIT 2.1.0-beta3 Compilation: clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210607-11245-s88s7u/build/config -I/tmp/neovim-20210607-11245-s88s7u/src -I/opt/homebrew/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/gettext/include -I/tmp/neovim-20210607-11245-s88s7u/build/src/nvim/auto -I/tmp/neovim-20210607-11245-s88s7u/build/include Compiled by luanmillnitz@marvin.local

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

system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/opt/homebrew/Cellar/neovim/HEAD-93f15db_2/share/nvim"

Run :checkhealth for more info

Additional context

I'm using iterm2.

@millnitzluan millnitzluan added the bug Something isn't working label Jun 17, 2021
@theHamsta
Copy link
Member

Could this be related to neovim/neovim#14767 ?

@millnitzluan
Copy link
Author

IDK if it's related, built neovim with your modifications and the error is still happening.

@matiaslb
Copy link

Same thing happens to me, I believe that the issue happens when the following plugin is loaded: vim-editors/vim-elixir

@cigrainger
Copy link

Same thing happens to me, including after I removed vim-editors/vim-elixir.

@stsewd
Copy link
Member

stsewd commented Jun 26, 2021

This error shows every time when using nvim + telescope with file preview. You can easily check it while previewing the files. Disabling elixir syntax stops the error.

Does this happen when not using telescope? I think you should report this issue there, then.

@millnitzluan
Copy link
Author

This error shows every time when using nvim + telescope with file preview. You can easily check it while previewing the files. Disabling elixir syntax stops the error.

Does this happen when not using telescope? I think you should report this issue there, then.

I don't that the errors happen in telescope, due that it's easy to get the error using telescope + preview. I think that the same happens without telescope.

@stsewd
Copy link
Member

stsewd commented Jul 3, 2021

@millnitzluan can you provide a file to replicate this? Also, are you able to replicate this without telescope?

@thedelchop
Copy link

FWIW, the issue is triggered when an .exs file contain a HEREDOC string. This example, without telescope installed and syntax set to off, always produces the error:

defmodule Test do
  def foo do
    """
      This is a string I am going to return that
      includes some new lines and what not.
    """
  end
end

while this never does:

defmodule Test do
  def foo do
    "This is a string I am going to return that includes some new lines and what not."
  end
end

I can also confirm that this error only appeared after I had installed elixir-vim and persists even after removing elixir-vim and re-installing nvim-treesitter. I can't seem to grasp how that plugin could have an effect on tree-sitter but 🤷‍♂️

This is using NeoVim 0.5.0

@stsewd
Copy link
Member

stsewd commented Jul 10, 2021

@thedelchop thanks for providing the file to test this, but I wasn't able to replicate this even installing vim-elixir. Can you try replicating this with a minimal init.vim?

@thedelchop
Copy link

thedelchop commented Jul 10, 2021

@stsewd I still see the error, using that file, with this minimal init.lua file:

require('packer').startup(function()
  use 'wbthomason/packer.nvim'

  use { 'nvim-treesitter/nvim-treesitter',                -- The goal of nvim-treesitter is both to provide a simple and easy way to use the interface for tree-sitter in Neovim
    run = ':TSUpdate',
    config = function()
      require("nvim-treesitter.configs").setup {
        ensure_installed = {
          'elixir'
        },
        highlight = {
          enable = true
        },
        indent = {
          enable = true
        }
      }
    end
  }
end)

vim.g.mapleader = ";"
vim.api.nvim_set_keymap('i', 'jk', '<Esc>', {noremap = true})

And I also wiped out my ~/.local/share/nvim and ~/.local/.cache/nvim directories and reinstalled neovim. I also, just to be super sure, killed tmux and started neovim from Terminal.app instead of iTerm2.

@thedelchop
Copy link

@stsewd just to be sure, did you update your elixir parser for TS?

@stsewd
Copy link
Member

stsewd commented Jul 10, 2021

I was able to replicate this with that minimal init.vim. Actually, I'm able to replicate with my init.vim, but the message was being hidden. I thought this was being shown as a lua error, but it's shown as a message :messages

@stsewd
Copy link
Member

stsewd commented Jul 11, 2021

there is an invalid capture group in elixir highlights' queries, not sure how the CI passed...

stsewd added a commit to stsewd/nvim-treesitter that referenced this issue Jul 11, 2021
This was in our CONTRIBUTING.md file,
but wasn't defined.

Fixes nvim-treesitter#1405
@stsewd
Copy link
Member

stsewd commented Jul 11, 2021

#1551 should fix this, also, I think that what you actually want for these queries is a new group like string.delimiter

@stsewd
Copy link
Member

stsewd commented Jul 11, 2021

BTW, the highlight queries make use of _ instead of (_) and they give a syntax error in the playground, I asked more information about the difference in tree-sitter/tree-sitter#1253

@thedelchop
Copy link

@stsewd Awesome, thank you so much. I am trying to learn more about tree sitter as it seems pretty cool, but I'm still kind of a newbie. I'll try to setup the playground and see what I can find.

stsewd added a commit to stsewd/tree-sitter-query that referenced this issue Jul 11, 2021
stsewd added a commit that referenced this issue Jul 11, 2021
* Highlights: define string.special

This was in our CONTRIBUTING.md file,
but wasn't defined.

Fixes #1405

* Use string.escape
@theHamsta
Copy link
Member

@stsewd the CI does not test parsers that require npm

@jameschensmith
Copy link

jameschensmith commented Jul 11, 2021

Just ran into this same error message in Nix files. The string.special fix will most likely address it, as the comments in #1551 note. When I get a chance to validate the fix, I'll post an update here 👍

Edit: Oh, wow. After less than a minute of posting this, I was able to pull down the changes and validate. Yep, fixed. Thank you so much for this amazing library, Maintainers!

stsewd added a commit to tree-sitter-grammars/tree-sitter-query that referenced this issue Jul 13, 2021
theHamsta pushed a commit to theHamsta/nvim-treesitter that referenced this issue Oct 21, 2021
* Highlights: define string.special

This was in our CONTRIBUTING.md file,
but wasn't defined.

Fixes nvim-treesitter#1405

* Use string.escape
amaanq pushed a commit to tree-sitter-grammars/tree-sitter-query that referenced this issue May 22, 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

Successfully merging a pull request may close this issue.

7 participants