sogaiu / tree-sitter-janet-simple

Simple Janet grammar for tree-sitter
13 stars 2 forks source link

Doesn't seem to work. #1

Closed nstgc closed 1 year ago

nstgc commented 1 year ago

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.

- WARNING `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
         x) errors found in the query, try to run :TSUpdate {lang} ~

I tried that, but it says parser is up-to-date.


==============================================================================
LanguageClient: health#LanguageClient#check

- OK binary found: /home/nstgc5/.local/share/nvim/plugged/LanguageClient-neovim/bin/languageclient
- OK languageclient 0.1.161
- OK Floating window is supported and will be used for hover

==============================================================================
deoplete: health#deoplete#check

deoplete.nvim ~
- OK exists("v:t_list") was successful
- OK has("timers") was successful
- OK has("python3") was successful
- OK Require Python 3.6.1+ was successful
- OK Require msgpack 1.0.0+ was successful
- If you're still having problems, try the following commands:
  - $ export NVIM_PYTHON_LOG_FILE=/tmp/log
  - $ export NVIM_PYTHON_LOG_LEVEL=DEBUG
  - $ nvim
  - $ cat /tmp/log_{PID}
  - and then create an issue on github

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

Configuration ~
- OK no issues found

Runtime ~
- OK $VIMRUNTIME: /usr/share/nvim/runtime

Performance ~
- OK Build type: Release

Remote Plugins ~
- OK Up to date

terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=\177`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $VTE_VERSION="7202"
- $TERM_PROGRAM="guake"
- $COLORTERM="truecolor"

==============================================================================
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 v20.5.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) 13.2.1 20230801
- 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.4.11-arch2-1",
  sysname = "Linux",
  version = "#1 SMP PREEMPT_DYNAMIC Sat, 19 Aug 2023 15:38:34 +0000"
} ~

Parser/Features         H L F I J
  - clojure             ✓ ✓ ✓ . ✓
  - fennel              ✓ ✓ ✓ . ✓
  - haskell             ✓ . ✓ . ✓
  - janet_simple        ✓ ✓ ✓ . ✓
  - julia               ✓ ✓ ✓ ✓ ✓
  - latex               ✓ . ✓ . ✓
  - rust                ✓ ✓ ✓ ✓ ✓
  - vim                 ✓ ✓ ✓ . ✓

  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} ~

==============================================================================
provider: health#provider#check

Clipboard (optional) ~
- OK Clipboard tool found: xclip

Python 3 provider (optional) ~
- `g:python3_host_prog` is not set.  Searching for python3 in the environment.
- Executable: /usr/bin/python3
- Python version: 3.11.3
- pynvim version: 0.4.3
- OK Latest pynvim is installed.

Python virtualenv ~
- OK no $VIRTUAL_ENV

Ruby provider (optional) ~
- WARNING `ruby` and `gem` must be in $PATH.
  - ADVICE:
    - Install Ruby and verify that `ruby` and `gem` commands work.

Node.js provider (optional) ~
- Node.js: v20.5.1
- WARNING Missing "neovim" npm (or yarn, pnpm) package.
  - ADVICE:
    - Run in shell: npm install -g neovim
    - Run in shell (if you use yarn): yarn global add neovim
    - Run in shell (if you use pnpm): pnpm install -g neovim
    - You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim

Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
  - ADVICE:
    - See :help |provider-perl| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

==============================================================================
vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: /home/nstgc5/.local/state/nvim/lsp.log
- Log size: 144 KB

vim.lsp: Active Clients ~
- No active clients

==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: clojure    ABI: 13, path: /home/nstgc5/.local/share/nvim/plugged/nvim-treesitter/parser/clojure.so
- OK Parser: fennel     ABI: 13, path: /home/nstgc5/.local/share/nvim/plugged/nvim-treesitter/parser/fennel.so
- OK Parser: haskell    ABI: 14, path: /home/nstgc5/.local/share/nvim/plugged/nvim-treesitter/parser/haskell.so
- OK Parser: janet_simple ABI: 13, path: /home/nstgc5/.local/share/nvim/plugged/nvim-treesitter/parser/janet_simple.so
- OK Parser: julia      ABI: 14, path: /home/nstgc5/.local/share/nvim/plugged/nvim-treesitter/parser/julia.so
- OK Parser: latex      ABI: 14, path: /home/nstgc5/.local/share/nvim/plugged/nvim-treesitter/parser/latex.so
- OK Parser: rust       ABI: 14, path: /home/nstgc5/.local/share/nvim/plugged/nvim-treesitter/parser/rust.so
- OK Parser: vim        ABI: 14, path: /home/nstgc5/.local/share/nvim/plugged/nvim-treesitter/parser/vim.so
sogaiu commented 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.

sogaiu commented 1 year ago

@nstgc Have things worked out for you with respect to this issue?

nstgc commented 1 year ago

Sorry. I'll look over this as soon as my coffee kicks in. Thank you both for responding and for following up.

nstgc commented 1 year ago

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!

nstgc commented 1 year ago

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!

sogaiu commented 1 year ago

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!

nstgc commented 1 year ago

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.

sogaiu commented 1 year ago

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.