Add syntax symbols for auto-complete

This commit is contained in:
Francesco Abbate 2022-04-09 12:06:14 +02:00
parent 683d23e3ba
commit d4f84e1aff
1 changed files with 11 additions and 2 deletions

View File

@ -76,10 +76,19 @@ local max_symbols = config.plugins.autocomplete.max_symbols
core.add_thread(function() core.add_thread(function()
local cache = setmetatable({}, { __mode = "k" }) local cache = setmetatable({}, { __mode = "k" })
local function get_syntax_symbols(symbols, doc)
if doc.syntax then
for sym in pairs(doc.syntax.symbols) do
symbols[sym] = true
end
end
end
local function get_symbols(doc) local function get_symbols(doc)
if doc.disable_symbols then return {} end
local i = 1
local s = {} local s = {}
get_syntax_symbols(s, doc)
if doc.disable_symbols then return s end
local i = 1
local symbols_count = 0 local symbols_count = 0
while i < #doc.lines do while i < #doc.lines do
for sym in doc.lines[i]:gmatch(config.symbol_pattern) do for sym in doc.lines[i]:gmatch(config.symbol_pattern) do