Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
mawkler opened this issue Aug 6, 2023 · 5 comments
Open
1 task done
Assignees
Labels
bug Something isn't working

Comments

@mawkler
Copy link

mawkler commented Aug 6, 2023

Please confirm

  • I am running the latest version of this plugin

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
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):

  • OS: Manjaro Linux x86_64
@mawkler mawkler added the bug Something isn't working label Aug 6, 2023
@lambtho12
Copy link
Member

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

@mawkler
Copy link
Author

mawkler commented Aug 11, 2023

@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
Copy link
Member

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
Copy link
Contributor

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants