Merge pull request #913 from lite-xl/auto-complete-syntax-symbols

Add syntax symbols for auto-complete
This commit is contained in:
Francesco 2022-04-11 20:42:17 +02:00 committed by GitHub
commit 16fcb2e751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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()
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)
if doc.disable_symbols then return {} end
local i = 1
local s = {}
get_syntax_symbols(s, doc)
if doc.disable_symbols then return s end
local i = 1
local symbols_count = 0
while i <= #doc.lines do
for sym in doc.lines[i]:gmatch(config.symbol_pattern) do