Hi,
Iβm working on bringing tree-sitter-elixir to emacs tree-sitter-lang to make support syntax highlighting. The branch that Iβm working on is here . You can clone and point to the package via load-path
for or use-package
if you using it.
If you found any issue such as syntax highlight is the wrong color, comment on this thread or comment on Emacs tree-sitter support Β· Issue #4 Β· elixir-lang/tree-sitter-elixir Β· GitHub with mentioning me.
Thanks.
9 Likes
Kudos for the effort! Do you have a step-by-step for Spacemacs? I suppose inserting use-package
at the right place should be enough?
3 Likes
I didnβt use spacemacs in my daily life. But I can tell that itβs need to enable per major-mode via hook or enable it all. The package will know that what syntax should use base on major mode.
You can see it here for the resource about tree-sitter syntax highlight.
2 Likes
axelson
December 16, 2021, 6:11am
4
FYI, Iβve been testing this locally and itβs been working well for me (I just switched to your βtreesitter-queriesβ branch), although it does seem a little slower than Iβd like, but that might be similar to this nvim treesitter issue:
opened 06:30PM - 31 Oct 21 UTC
closed 02:19PM - 14 Dec 21 UTC
bug
### Before reporting
- [X] I have updated my neovim version to latest _master_
β¦ - [X] I have updated my plugin to the latest version
- [X] I have run `:TSUpdate`
### Describe the bug
Neovim take anywhere from 750ms up to a second to open any elixir file, be it a simple test file or a large module.
### To Reproduce
1. Install elixir treesitter parser
2. Open any file
3. Notice the large lag
### Expected behavior
Obviously some additional delay is expected, but this much makes elixir with treesitter basically unusable
### Output of `:checkhealth nvim-treesitter`
```markdown
## Installation
- OK: `tree-sitter` found 0.20.0 (parser generator, only needed for :TSInstallFromGrammar)
- OK: `node` found v14.18.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) 11.1.0
- 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 J
- comment β . . . .
- javascript β β β β β
- json β β β β .
- bash β β β . β
- html β β β β β
- css β . β β β
- elixir β β β β β
- heex β . β β β
- typescript β β β β β
- c β β β β β
- tsx β β β β β
- vue β . β . β
- rust β β β β β
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`
```text
NVIM v0.6.0-dev+525-ge921e98ce
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -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-az50-602
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
```
### Additional context
Here's the startup log when opening an elixir file:
> times in msec
> clock self+sourced self: sourced script
> clock elapsed: other lines
>
> 000.008 000.008: --- NVIM STARTING ---
> 000.261 000.253: locale set
> 000.567 000.306: inits 1
> 000.580 000.013: window checked
> 000.619 000.039: parsing arguments
> 000.656 000.037: expanding arguments
> 000.693 000.037: inits 2
> 001.072 000.379: init highlight
> 001.074 000.002: waiting for UI
> 001.746 000.673: done waiting for UI
> 001.755 000.008: init screen for UI
> 001.892 000.015 000.015: sourcing /usr/share/nvim/archlinux.vim
> 001.897 000.046 000.031: sourcing /etc/xdg//nvim/sysinit.vim
> 004.009 002.054 002.054: sourcing /home/pankamyk/.local/share/nvim/site/autoload/plug.vim
> 012.010 000.027 000.027: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/elixir.vim
> 012.044 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/fennel.vim
> 012.076 000.016 000.016: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/fish.vim
> 012.104 000.016 000.016: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/gdresource.vim
> 012.130 000.012 000.012: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/gdscript.vim
> 012.153 000.009 000.009: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/gomod.vim
> 012.184 000.016 000.016: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/graphql.vim
> 012.215 000.017 000.017: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/hcl.vim
> 012.240 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/heex.vim
> 012.264 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/hjson.vim
> 012.287 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/json5.vim
> 012.312 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/julia.vim
> 012.340 000.016 000.016: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/ledger.vim
> 012.365 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/nix.vim
> 012.389 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/ql.vim
> 012.428 000.023 000.023: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/query.vim
> 012.460 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/surface.vim
> 012.485 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/teal.vim
> 012.508 000.009 000.009: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/tlaplus.vim
> 012.532 000.010 000.010: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/yang.vim
> 012.557 000.011 000.011: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/ftdetect/zig.vim
> 012.678 000.012 000.012: sourcing /usr/share/vim/vimfiles/ftdetect/PKGBUILD.vim
> 013.064 006.651 006.358: sourcing /usr/share/nvim/runtime/filetype.vim
> 013.279 000.037 000.037: sourcing /usr/share/nvim/runtime/ftplugin.vim
> 013.488 000.030 000.030: sourcing /usr/share/nvim/runtime/indent.vim
> 014.154 000.303 000.303: sourcing /usr/share/nvim/runtime/syntax/syncolor.vim
> 014.373 000.602 000.299: sourcing /usr/share/nvim/runtime/syntax/synload.vim
> 014.454 000.819 000.217: sourcing /usr/share/nvim/runtime/syntax/syntax.vim
> 021.070 000.135 000.135: sourcing /usr/share/nvim/runtime/syntax/syncolor.vim
> 021.853 000.151 000.151: sourcing /usr/share/nvim/runtime/syntax/syncolor.vim
> 022.394 000.128 000.128: sourcing /usr/share/nvim/runtime/syntax/syncolor.vim
> 023.654 002.855 002.442: sourcing /home/pankamyk/.config/nvim/plugged/shady.vim/colors/shady.vim
> 024.055 022.137 009.691: sourcing /home/pankamyk/.config/nvim/init.vim
> 024.065 000.127: sourcing vimrc file(s)
> 024.514 000.223 000.223: sourcing /home/pankamyk/.config/nvim/plugged/vim-transparent/plugin/background.vim
> 025.019 000.430 000.430: sourcing /home/pankamyk/.config/nvim/plugged/vim-eunuch/plugin/eunuch.vim
> 025.449 000.185 000.185: sourcing /home/pankamyk/.config/nvim/plugged/vim-gitgutter/autoload/gitgutter/utility.vim
> 025.822 000.186 000.186: sourcing /home/pankamyk/.config/nvim/plugged/vim-gitgutter/autoload/gitgutter/highlight.vim
> 026.734 001.613 001.242: sourcing /home/pankamyk/.config/nvim/plugged/vim-gitgutter/plugin/gitgutter.vim
> 026.841 000.029 000.029: sourcing /home/pankamyk/.config/nvim/plugged/nvim-toggle-terminal/plugin/nvim_toggle_terminal.vim
> 027.767 000.867 000.867: sourcing /home/pankamyk/.config/nvim/plugged/fzf.vim/plugin/fzf.vim
> 029.700 001.854 001.854: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/plugin/nvim-treesitter.vim
> 030.006 000.235 000.235: sourcing /home/pankamyk/.config/nvim/plugged/playground/plugin/nvim-treesitter-playground.vim
> 030.528 000.260 000.260: sourcing /usr/share/nvim/runtime/plugin/gzip.vim
> 030.558 000.012 000.012: sourcing /usr/share/nvim/runtime/plugin/health.vim
> 030.651 000.080 000.080: sourcing /usr/share/nvim/runtime/plugin/man.vim
> 030.680 000.014 000.014: sourcing /usr/share/nvim/runtime/plugin/matchit.vim
> 030.831 000.139 000.139: sourcing /usr/share/nvim/runtime/plugin/matchparen.vim
> 030.866 000.019 000.019: sourcing /usr/share/nvim/runtime/plugin/netrwPlugin.vim
> 031.020 000.141 000.141: sourcing /usr/share/nvim/runtime/plugin/rplugin.vim
> 031.136 000.099 000.099: sourcing /usr/share/nvim/runtime/plugin/shada.vim
> 031.182 000.024 000.024: sourcing /usr/share/nvim/runtime/plugin/spellfile.vim
> 031.338 000.141 000.141: sourcing /usr/share/nvim/runtime/plugin/tarPlugin.vim
> 031.439 000.083 000.083: sourcing /usr/share/nvim/runtime/plugin/tohtml.vim
> 031.474 000.019 000.019: sourcing /usr/share/nvim/runtime/plugin/tutor.vim
> 031.667 000.177 000.177: sourcing /usr/share/nvim/runtime/plugin/zipPlugin.vim
> 032.320 000.567 000.567: sourcing /usr/share/vim/vimfiles/plugin/fzf.vim
> 032.753 001.661: loading plugins
> 032.846 000.093: loading packages
> 033.027 000.182: loading after plugins
> 033.038 000.011: inits 3
> 037.712 004.673: reading ShaDa
> 041.252 000.019 000.019: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/after/ftplugin/elixir.vim
> 088.514 000.013 000.013: sourcing /home/pankamyk/.config/nvim/plugged/nvim-treesitter/after/ftplugin/elixir.vim
> 092.971 055.228: opening buffers
> 093.159 000.130 000.130: sourcing /home/pankamyk/.config/nvim/plugged/vim-gitgutter/autoload/gitgutter.vim
> 093.422 000.321: BufEnter autocommands
> 093.425 000.004: editing files in windows
> 093.524 000.056 000.056: sourcing /home/pankamyk/.config/nvim/plugged/vim-transparent/autoload/background.vim
> 095.779 002.298: VimEnter autocommands
> 095.783 000.004: UIEnter autocommands
> 096.092 000.228 000.228: sourcing /usr/share/nvim/runtime/autoload/provider/clipboard.vim
> 096.100 000.089: before starting main loop
> 754.147 658.047: first screen update
> 754.154 000.006: --- NVIM STARTED ---
4 Likes
Thanks for your help and sorry for the late reply. I would keep an eye on that issue.
2 Likes
axelson
December 27, 2021, 6:08am
6
No worries. Thanks for driving this forward!
1 Like
Hi,
Sorry for disappearing for so long. Iβve got a bit busy from taking care my kid.
I would like to update the PR details here:
Update tree-sitter-elixir submodule to latest commit.
Update highlight query to conform tree-sitter-hl-mode.
Iβve encounter the issue on not in
keyword and not sure how to solving this issue at the moment but I think the syntax highlight now looks ready.
If someone find any issue. Feel free to mention me in the PR comment or reply this thread.
Thanks.
3 Likes