From 50d1a97b25d77f33d312b4775fbd68217d22c946 Mon Sep 17 00:00:00 2001 From: Kristijan Husak Date: Fri, 29 Oct 2021 09:48:01 +0200 Subject: [PATCH] [NOTICE] Add warning about tree-sitter branch becoming master soon. --- README.md | 6 ++++-- lua/orgmode/init.lua | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ee938c01..3b80119c3 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,10 @@ ## Tree-sitter Tree-sitter support branch: https://github.com/kristijanhusak/orgmode.nvim/tree/tree-sitter -#### NOTE: tree-sitter branch will become main very soon! -All new features and fixes are going to the `tree-sitter` branch. +#### Tree-sitter branch will become main very soon! +To remove warning message, you can do two things: +1. Temporarily switch to the [tree-sitter](https://github.com/kristijanhusak/orgmode.nvim/tree/tree-sitter) branch +2. Stay on master branch and install [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) and [tree-sitter-org grammar](https://github.com/milisims/tree-sitter-org). More info here: https://github.com/kristijanhusak/orgmode.nvim/tree/tree-sitter#setup. ## Installation diff --git a/lua/orgmode/init.lua b/lua/orgmode/init.lua index a07429a80..7e23ee4c9 100644 --- a/lua/orgmode/init.lua +++ b/lua/orgmode/init.lua @@ -14,6 +14,7 @@ function Org:new() setmetatable(data, self) self.__index = self data:setup_autocmds() + vim.defer_fn(data.notify_update, 200) return data end @@ -47,6 +48,18 @@ function Org:setup_autocmds() vim.cmd([[augroup END]]) end +function Org:notify_update() + local success, _ = pcall(vim.treesitter.inspect_language, 'org') + if success then + return + end + local msg = { + '[orgmode] Master branch will soon require tree-sitter support.', + 'To remove this message, see https://github.com/kristijanhusak/orgmode.nvim/tree/master#tree-sitter.', + } + vim.notify(table.concat(msg, '\n'), vim.log.levels.WARN) +end + ---@param opts? table ---@return Org local function setup(opts)