nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.04k stars 134 forks source link

Add ts grammar to the dependencies #434

Closed pleshevskiy closed 1 year ago

pleshevskiy commented 1 year ago

I install milisims/tree-sitter-org manually and I make sure I use latest version (081179c52b3e8175af62b9b91dc099d010c38770).

On startup orgmode plugin fails with the following error:

[orgmode] You are using outdated version of tree-sitter grammar for Orgmode.
To use latest version, replace current grammar installation with "require('orgmode').setup_ts_grammar()" and run :TSUpdate org.
More info in setup section of readme: https://github.com/nvim-orgmode/orgmode#setup

Because my org-parser don't have a revision field.

:lua print(vim.inspect(require('nvim-treesitter.parsers').get_parser_configs().org));
{
  install_info = {
    branch = "main",
    files = { "src/parser.c", "src/scanner.cc" },
    url = "https://github.com/milisims/tree-sitter-org"
  },
  <metatable> = {
    __newindex = <function 1>
  }
}

I made a patch removing grammar checker, but I think we can add milisims/tree-sitter-org to the dependencies in the readme or to make some kind of relaxation to the check.

kristijanhusak commented 1 year ago

We are using a specific grammar version to make sure nothing breaks, since grammar is not used only for highlighting, as it is the case in most of the other grammars. If you want to provide custom commit hash for any reason, do it like this:

require('orgmode').setup_ts_grammar('custom_hash_here')