nvim-telekasten / telekasten.nvim

A Neovim (lua) plugin for working with a markdown zettelkasten / wiki and mixing it with a journal, based on telescope.nvim
MIT License
1.42k stars 91 forks source link

[BUG] "no parser for 'telekasten' language, see :help treesitter-parsers" #279

Open mawkler opened 1 year ago

mawkler commented 1 year ago

Please confirm

Describe the bug

Hi! I'm trying out Telekasten but I immediately ran into an issue. Telekasten seems to be clashing with tsnode-marker.nvim. It seems to be because tsnode-marker.nvim calls vim.treesitter.get_parser(), which causes Treesitter to throw the error "no parser for 'telekasten' language, see :help treesitter-parsers".

To Reproduce

Steps to reproduce the behavior:

Use the following init.lua:

Click to expand ```lua local root = '/tmp/nvim/site/pack' for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name end -- bootstrap lazy.nvim local lazypath = root .. '/plugins/lazy.nvim' if not vim.loop.fs_stat(lazypath) then vim.fn.system({ 'git', 'clone', '--filter=blob:none', 'https://github.com/folke/lazy.nvim.git', lazypath, }) end vim.opt.runtimepath:prepend(lazypath) local plugins = { { 'renerocksai/telekasten.nvim', dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' }, opts = { home = vim.fn.expand("~/zettelkasten") } }, } require('lazy').setup(plugins, { root = root .. '/plugins', }) ```
  1. nvim -u init.lua
  2. :Telekasten new_note
  3. Call it Test note
  4. :=vim.treesitter.get_parser(0)
  5. Error: "no parser for 'telekasten' language, see :help treesitter-parsers"

Expected behavior I'm not sure what the expected behaviour is, because I'm not familiar with get_parser. Perhaps it should return the one for Markdown? Treesitter should at least not throw an error.

Operating system (please complete the following information):

lambtho12 commented 1 year ago

have you tried disabling the filetype so it stays markdown and not becomes telekasten?

mawkler commented 1 year ago

@lambtho12 That does solve the problem. Are there any disadvantages to having the filetype Markdown instead of Telekasten?

I do however feel like Telekasten should be compatible with Treesitter out of the box since its build into Neovim. Is there any other solution?

lambtho12 commented 1 year ago

The main issue is with the renaming of the files and subsequent update of the links. When you rename a file, Telekasten first saves all buffers with a telekasten type and then update the links. If I recall correctly, when the filetype is not set to Telekasten, the links are modified in open buffer but without saving them first. So any non-saved changes in a buffer that contains a link that must be updated may be lost. This is the only "big" issue I can think of.

The main idea behind a specific filetype is to allow specific interactions with other plugins. With that you can very easily create snippets that would work for your notes (telekasten filetype) and do not clutter/clash with your regular markdown experience. This is rather niche though.

If you look a bit through the issues, setting the syntax to telekasten seems to lead to more and more issues over time. As the benefits it provides are very limited (I beleive), I am seriously thinking about removing this all together to simplify maintenance.

onemoresuza commented 1 month ago

I believe this can be solved by doing the folloing:

require("vim.treesitter.language").register("markdown", "telekasten")

This causes the markdown treesitter parser to be used on the telekasten filetype.

i-am-mike-davis commented 3 days ago

I believe this can be solved by doing the folloing:

require("vim.treesitter.language").register("markdown", "telekasten")

This causes the markdown treesitter parser to be used on the telekasten filetype.

This appears to work for me.