aboutsummaryrefslogtreecommitdiff
path: root/plugins/force_syntax.lua
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-06-16 00:09:48 -0400
committerjgmdev <jgmdev@gmail.com>2022-06-16 00:09:48 -0400
commitd8fbb5ea0c65e01c441e7b9917dcb97da60e8f2b (patch)
tree46ffdcfb54df20415018256c6fbdcd81a86148ca /plugins/force_syntax.lua
parent189397d18164201ab9da5e7b7be2a65186843d96 (diff)
downloadlite-xl-plugins-d8fbb5ea0c65e01c441e7b9917dcb97da60e8f2b.tar.gz
lite-xl-plugins-d8fbb5ea0c65e01c441e7b9917dcb97da60e8f2b.zip
force_syntax: use new command_view:enter interface
Diffstat (limited to 'plugins/force_syntax.lua')
-rw-r--r--plugins/force_syntax.lua13
1 files changed, 5 insertions, 8 deletions
diff --git a/plugins/force_syntax.lua b/plugins/force_syntax.lua
index 48a1853..5c1d2eb 100644
--- a/plugins/force_syntax.lua
+++ b/plugins/force_syntax.lua
@@ -103,23 +103,20 @@ end
command.add("core.docview", {
["force-syntax:select-file-syntax"] =
function()
- core.command_view:enter(
- "Set syntax for this file",
- function(text, item) -- submit
+ core.command_view:enter("Set syntax for this file", {
+ submit = function(text, item)
local list, _ = get_syntax_list()
doc().force_syntax = list[item.text]
doc():reset_syntax()
end,
- function(text) -- suggest
+ suggest = function(text)
local _, keylist = get_syntax_list()
local res = common.fuzzy_match(keylist, text)
-- Force Current and Auto detect syntax to the bottom
-- if the text is empty
table.sort(res, #text == 0 and bias_sorter or sorter)
return res
- end,
- nil, -- cancel
- nil -- validate
- )
+ end
+ })
end
})