neovim/make-tree-sitter-optional.patch
Richard Rahl bb82ee52cd - Update to 0.10.2
- Features
 * jumplist: Allow opting out of removing unloaded buffers (#30419)
- Bug Fixes
 * api: Error properly with invalid field in nvim_open_win (#30078)
 * api: Nvim_buf_get_text() crashes with large negative column #28740
 * api: Fix crash/leak with float title/footer on error (#30543)
 * channel: Handle writing to file instead of pipe (#30520)
 * column: Set signcolumn width after splitting window (#30556)
 * completion: Don't include <Lua function> in -complete= (#30209)
 * decor: Don't use separate DecorSignHighlight for url (#30096)
 * decor: Exclude invalid marks from meta total
 * diagnostics: Don't apply extmarks to invalid lines #29321
 * diff: Use mmfile_t in linematch
 * filetype: Handle .in files with no filename (#30487)
 * float: Properly find last window of tabpage (#30571)
 * health: Fix pyenv root and python exepath detect issue
 * health: Return correct name from 'path2name()'
 * lsp: Don't send foreign diagnostics to servers in buf.code_action (#29501)
 * lsp: Avoid reusing diagnostics from different servers in actions (#30002)
 * lsp: Return call hierarchy item, not the index (#30145)
 * lsp: Handle out-of-bounds character positions #30288
 * lsp: Handle encoding bounds in str_utfindex_enc
 * lsp: Handle nil bytes in strings
 * lua: Ignore stdout and stderr for xdg-open
 * man: Avoid setting v:errmsg (#30052)
 * man: Check if buffer is valid before restoring 'tagfunc' (#30180)
 * regexp: Fix typo in E888 error message (#30161)
 * runtime: Sync bundled treesitter queries
 * runtime: Sync bundled treesitter queries

OBS-URL: https://build.opensuse.org/package/show/editors/neovim?expand=0&rev=164
2024-10-04 05:40:33 +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'