Skip to content

Commit

Permalink
feat!: remove dependency on nvim-treesitter
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jun 22, 2024
1 parent b7d056d commit eaf9fda
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 4 additions & 2 deletions lua/cellular-automaton/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ M.start_animation = function(animation_name)
end

-- Make sure nvim treesitter parser exists for current buffer
if not require("nvim-treesitter.parsers").has_parser() then
error("Error while starting an animation. Current buffer doesn't have associated nvim-treesitter parser.")
local ft = vim.bo[0].filetype
local lang = vim.treesitter.language.get_lang(ft)
if not lang then
error("Error while starting an animation. Current buffer doesn't have associated tree-sitter parser.")
end

manager.execute_animation(M.animations[animation_name])
Expand Down
10 changes: 2 additions & 8 deletions plugin/cellular-automaton.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
if 1 ~= vim.fn.has("nvim-0.8.0") then
vim.api.nvim_err_writeln("Cellular-automaton.nvim requires at least nvim-0.8.0")
return
end

local ok, _ = pcall(require, "nvim-treesitter")
if not ok then
vim.api.nvim_err_writeln("Cellular-automaton.nvim requires nvim-treesitter/nvim-treesitter plugin to be installed.")
if 1 ~= vim.fn.has("nvim-0.9.0") then
vim.api.nvim_err_writeln("Cellular-automaton.nvim requires at least nvim-0.9.0")
return
end

Expand Down

0 comments on commit eaf9fda

Please sign in to comment.