neovim/make-tree-sitter-optional.patch
Richard Rahl 4a74e5ecc0 - add make-tree-sitter-optional.patch for making the tree-sitter plugins
optional (behind bcond) - this fixes s390x
- enable luajit for riscv64, which leaves ppc64le as the lone arch
  which uses lua
- remove post and postun from the spec template, as most standard
  packages don't need this (and ChangeLog file, as most projects dont use this
  file anymore.
- revert back to default compiler flags

OBS-URL: https://build.opensuse.org/package/show/editors/neovim?expand=0&rev=156
2024-08-15 00:37:54 +00:00

44 lines
1.4 KiB
Diff

From: Jakub Jirutka <jakub@jirutka.cz>
Date: Thu, 23 May 2024 20:07:15 +0200
Subject: Fallback to classic syntax highlighting if tree-sitter parser
is not available
See https://gitlab.alpinelinux.org/alpine/aports/-/issues/16132,
https://github.com/neovim/neovim/pull/26824
--- a/runtime/ftplugin/help.lua
+++ b/runtime/ftplugin/help.lua
@@ -1,5 +1,8 @@
-- use treesitter over syntax (for highlighted code blocks)
-vim.treesitter.start()
+local ok, _ = pcall(vim.treesitter.start)
+if not ok then
+ print('Note: tree-sitter-vimdoc package is not installed, some features will not work')
+end
-- add custom highlights for list in `:h highlight-groups`
local bufname = vim.fs.normalize(vim.api.nvim_buf_get_name(0))
--- a/runtime/ftplugin/lua.lua
+++ b/runtime/ftplugin/lua.lua
@@ -1,2 +1,5 @@
-- use treesitter over syntax
-vim.treesitter.start()
+local ok, _ = pcall(vim.treesitter.start)
+if not ok then
+ print('Note: tree-sitter-lua package is not installed, some features will not work')
+end
--- a/runtime/ftplugin/query.lua
+++ b/runtime/ftplugin/query.lua
@@ -9,7 +9,10 @@
-- Do not set vim.b.did_ftplugin = 1 to allow loading of ftplugin/lisp.vim
-- use treesitter over syntax
-vim.treesitter.start()
+local ok, _ = pcall(vim.treesitter.start)
+if not ok then
+ print('Note: tree-sitter-query package is not installed, some features will not work')
+end
-- set omnifunc
vim.bo.omnifunc = 'v:lua.vim.treesitter.query.omnifunc'