`autocomplete`: Fix "Too many symbols" message when `Doc` has no name

Before, when a `Doc` had no name, an error was thrown.
This commit is contained in:
Guldoman 2022-06-29 05:54:37 +02:00
parent 438ed6984a
commit 79dd8779c4
No known key found for this signature in database
GPG Key ID: EA928C8BDA1A8825
1 changed files with 7 additions and 1 deletions

View File

@ -145,8 +145,14 @@ core.add_thread(function()
if symbols_count > max_symbols then if symbols_count > max_symbols then
s = nil s = nil
doc.disable_symbols = true doc.disable_symbols = true
local filename_message
if doc.filename then
filename_message = "document " .. doc.filename
else
filename_message = "unnamed document"
end
core.status_view:show_message("!", style.accent, core.status_view:show_message("!", style.accent,
"Too many symbols in document "..doc.filename.. "Too many symbols in "..filename_message..
": stopping auto-complete for this document according to ".. ": stopping auto-complete for this document according to "..
"config.plugins.autocomplete.max_symbols." "config.plugins.autocomplete.max_symbols."
) )