Closed nstgc closed 1 year ago
Hi,
I can try to help, but let me mention a few things up front.
1) It looks like you are using neovim with nvim-treesitter, but the repository housing this issue is specifically about the tree-sitter-janet-simple grammar which is used by nvim-treesitter (but also by other programs). If I'm not able to help, it might be that you would get better help from the nvim-treesitter folks. I presume you know this, but FWIW, they have a repository at https://github.com/nvim-treesitter/nvim-treesitter along with a troubleshooting section (which I confess to not understanding that well (^^: ).
2) Although I use neovim and nvim-treesitter from time to time, I'm not an expert user of either, still struggling to learn how to use vim-ish things well after multiple years.
With that out of the way, I didn't figure out what was not working from your post, but perhaps it's that highlighting is not functioning?
If that's the case, I have a relatively minimal setup below for neovim that seems to work here. May be there's something there that helps?
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'nvim-treesitter/nvim-treesitter'
call plug#end()
" adapted:
" https://github.com/janet-lang/janet.vim/blob/master/ftdetect/janet.vim
au BufRead,BufNewFile *.janet,*.jdn setlocal filetype=janet
lua <<EOF
require('nvim-treesitter.configs').setup {
ensure_installed = "all",
highlight = {
enable = true,
disable = { "css" },
},
}
EOF
On a possibly related note, the nvim-treesitter integration of this grammar only really supports highlighting. If you want indentation to work, I think having something like bakpakin's janet.vim installed might be effective.
If you do go that route, I think the au BufRead,BufNewFile *.janet,*.jdn setlocal filetype=janet
line in the settings above may not be necessary.
@nstgc Have things worked out for you with respect to this issue?
Sorry. I'll look over this as soon as my coffee kicks in. Thank you both for responding and for following up.
It looks like you are using neovim with nvim-treesitter, but the repository housing this issue is specifically about the tree-sitter-janet-simple grammar which is used by nvim-treesitter (but also by other programs).
I don't follow, am I in the wrong place? Treesitter works for all other languages I have grammars installed for it. Which are Haskell, Clojure, Julia, LaTeX, Rust, Vim, and Fennel, and I assumed this was to be installed in the same way as those. So I further assumed the issue was with the this repo.
Although I use neovim and nvim-treesitter from time to time, I'm not an expert user of either, still struggling to learn how to use vim-ish things well after multiple years.
Heh, yeah. I know that feeling. I've been using Vim for 15 years, but I'm still learning it's mysterious ways. I'm over the learning cliff, however, and have moved on to the learning curve.
With that out of the way, I didn't figure out what was not working from your post, but perhaps it's that highlighting is not functioning?
Sorry, I should have been more clear. I'm just talking about highlighting. I don't use folding and Parinfer takes care of tabs.
If that's the case, I have a relatively minimal setup below for neovim that seems to work here. May be there's something there that helps?
I tried copying that into a fresh init.vim
file, but it didn't work any better. Copying in some relevant parts from my usual nvim config file:
lua << EOF
require("nvim-treesitter.configs").setup {
highlight = {
-- ...
},
-- ...
rainbow = {
enable = true,
-- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {} -- table of colour name strings
}
}
--
-- require('aerial').setup({})
--
-- require("twilight").setup {
-- -- your configuration comes here
-- -- or leave it empty to use the default settings
-- -- refer to the configuration section below
-- }
EOF
I don't have a line for au BufRead...
. Adding it in fixed the issue. Thanks!
As a follow up, indentation doesn't seem to work properly with just Parinfer. I didn't realize Calvin's Janet pluggin was responsible for that. Good to know!
Just to clarify one thing:
I don't follow, am I in the wrong place? Treesitter works for all other languages I have grammars installed for it. Which are Haskell, Clojure, Julia, LaTeX, Rust, Vim, and Fennel, and I assumed this was to be installed in the same way as those. So I further assumed the issue was with the this repo.
It's confusing to be sure, but this repository is for the grammar only. nvim-treesitter happens to use the grammar, but other non-Neovim-related programs (e.g. difftastic, Helix, etc.) also use it. I don't really understand how the grammar is used in detail in most of these programs (^^;
Of course, figuring out what the source(s) of a difficulty encountered is not necessarily trivial (and in my experience, on the challenging side for vim-ish things) so figuring out where to direct queries to isn't always straight-forward either.
In any case, glad to hear things seem to be working!
It's confusing to be sure, but this repository is for the grammar only. nvim-treesitter happens to use the grammar, but other non-Neovim-related programs (e.g. difftastic, Helix, etc.) also use it. I don't really understand how the grammar is used in detail in most of these programs (^^;
Ah, I see.
in my experience, on the challenging side for vim-ish things
Would you say this sort of thing is easier with something like Doom or Spacemacs? I try Emacs every couple of years, and each time I come away feeling like it's just too large, but I can't deny that (Neo)Vim isn't without it's share of issues.
Would you say this sort of thing is easier with something like Doom or Spacemacs?
I have tried both Doom and Spacemacs but I've reverted to plain configuration (that's what I had most experience previously though) as I found the additional layer not worth the additional trouble that seemed to inevitably surface as a result of using a layer.
In recent times, I've found that Emacs configuration has been improved (e.g. use-package
), but also there is considerably more readable material [1] and many folks who can be queried. Neither of these things were the case when I started learning unfortunately.
I try Emacs every couple of years, and each time I come away feeling like it's just too large, but I can't deny that (Neo)Vim isn't without it's share of issues.
I can relate to the feeling of largeness and agree that's not helpful for learning. (I still haven't "seen the edge" either after years of Emacs use.)
I believe I only managed to become comfortable because there was no helpful vi manual nor any suitable person I could ask when learning (^^;
On a side note, I would say that kakoune got a fair bit right, but as someone who likes to tweak / extend, the choice of shell for extending keeps me away.
I tried VSCode for a while, and while I thought it was pretty good for some things (especially the out-of-box experience, familiar UI, and simple configuration), as a user I don't feel I'm in a position to extend in any significant way (I tried writing extensions as well and got the same feeling that you don't get to do things that MS doesn't want you to do.)
[1] One resource I've been trying to digest recently is Mastering Emacs, though some of its articles also feel "large" (in the Emacs sense), so I end up trying to process them across days.
I installed the grammer with
TSInstall janet_simple
and have updated all my plugins.:checkhealth
seems okay save for one part which is needed for "TSInstallFromGrammer" which is not what I used.I tried that, but it says parser is up-to-date.