From 5686c6694eab8f6f5d8d94179474149baf1593bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98ystein=20Sandvik?= Date: Sun, 28 Jul 2024 12:39:33 +0200 Subject: [PATCH] fix: dont crash if bash treesitter parser is not installed --- ftplugin/curl.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ftplugin/curl.lua b/ftplugin/curl.lua index 7397a86..3ab06ec 100644 --- a/ftplugin/curl.lua +++ b/ftplugin/curl.lua @@ -1,7 +1,11 @@ vim.bo.syntax = "sh" vim.bo.commentstring = "# %s" -vim.treesitter.language.register("bash", "curl") +local bash_lang_installed, _ = pcall(vim.treesitter.language.register, "bash", "curl") + +if bash_lang_installed then + return +end -- Custom highlights for curl-specific elements local query = vim.treesitter.query.parse(