From a8f4a3246acf1e88e7e548fddbe8d7aa72c54255 Mon Sep 17 00:00:00 2001 From: zztrieuzz Date: Fri, 8 Oct 2021 19:34:40 +0700 Subject: [PATCH] fix: check parser nil #29 --- .github/stale.yml | 17 +++++++++++++++++ lua/nvim-ts-autotag/internal.lua | 3 +++ 2 files changed, 20 insertions(+) create mode 100644 .github/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..dc90e5a --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/lua/nvim-ts-autotag/internal.lua b/lua/nvim-ts-autotag/internal.lua index d747fe9..46aff08 100644 --- a/lua/nvim-ts-autotag/internal.lua +++ b/lua/nvim-ts-autotag/internal.lua @@ -265,6 +265,9 @@ end M.close_tag = function () parsers.get_parser():parse() + local buf_parser = parsers.get_parser() + if not buf_parser then return end + buf_parser:parse() local result, tag_name = check_close_tag() if result == true and tag_name ~= nil then vim.cmd(string.format([[normal! a]],tag_name))