plugins.autocomplete
local autocomplete = require "plugins.autocomplete"
icons
(field) icons: table<string, plugins.autocomplete.icon>
map_manually
(field) map_manually: table<string, plugins.autocomplete.map>
on_close
(field) on_close: fun(doc: core.doc, item: plugins.autocomplete.symbolinfo)|nil
config.plugins.autocomplete
Configuration options for autocomplete
plugin.
desc_font_size
(field) desc_font_size: number
Font size of the description box
hide_icons
(field) hide_icons: boolean
Do not show the icons associated to the suggestions
hide_info
(field) hide_info: boolean
Do not show the additional information related to a suggestion
icon_position
(field) icon_position: "left"|"right"
Position where icons will be displayed on the suggestions list
max_height
(field) max_height: integer
The max amount of visible items
max_suggestions
(field) max_suggestions: integer
The max amount of scrollable items
max_symbols
(field) max_symbols: integer
Maximum amount of symbols to cache per document
min_len
(field) min_len: integer
Amount of characters that need to be written for autocomplete
suggestions_scope
(field) suggestions_scope: "global"|"local"|"none"|"related"
Which symbols to show on the suggestions list: global, local, related, none
plugins.autocomplete.cachedata
last_change_id
(field) last_change_id: number
symbols
(field) symbols: table<string, boolean>
plugins.autocomplete.icon
char
(field) char: string
color
(field) color: string|renderer.color
font
(field) font: renderer.font
plugins.autocomplete.map
files
(field) files: string|table<integer, string>
Lua patterns which match the files where the symbols are valid.
items
(field) items: table<string, plugins.autocomplete.symbolinfo>
List of symbols that belong to this symbols table.
plugins.autocomplete.symbolinfo
data
(field) data: any
Optional data that can be used for onhover and onselect callbacks.
desc
(field) desc: string?
Description shown when the symbol is hovered on the autocomplete box.
icon
(field) icon: string?
Name of a registered icon.
info
(field) info: string?
Additional information displayed on autocomplete box, eg: item type.
onhover
(field) onhover: fun(idx: integer, item: plugins.autocomplete.symbolinfo)?
An optional callback called once when the symbol is hovered.
onselect
(field) onselect: (fun(idx: integer, item: plugins.autocomplete.symbolinfo):boolean)?
An optional callback called when the symbol is selected.
text
(field) text: string
Text value of the symbol displayed on the autocomplete box.
plugins.autocomplete.symbols
files
(field) files: string|table<integer, string>
Lua patterns which match the files where the symbols are valid.
items
(field) items: table<string, string|plugins.autocomplete.symbolinfo|false|nil>
List of symbols that belong to this symbols table.
name
(field) name: string
Name of the symbols table.
add
function plugins.autocomplete.add(t: plugins.autocomplete.symbols, manually_triggered?: boolean)
Register a symbols table used for autocompletion.
add_icon
function plugins.autocomplete.add_icon(name: string, character: string, font?: renderer.font, color?: string|renderer.color)
Register a font icon that can be assigned to completion items.
@param color
— A style.syntax[] name or specific color
can_complete
function plugins.autocomplete.can_complete()
-> boolean
Check if autocomplete can be triggered by checking if current partial symbol meets the required minimum autocompletion len.
close
function plugins.autocomplete.close()
Manually close the completions list.
complete
function plugins.autocomplete.complete(completions: plugins.autocomplete.symbols, on_close?: fun(doc: core.doc, item: plugins.autocomplete.symbolinfo))
Manually invoke the completion list using the provided symbols.
get_partial_symbol
function plugins.autocomplete.get_partial_symbol()
-> partial: string
2. line1: integer
3. col1: integer
4. line2: integer
5. col2: integer
Retrieve the current document partial symbol.
is_open
function plugins.autocomplete.is_open()
-> boolean
Check if the completion lists is visible.
open
function plugins.autocomplete.open(on_close?: fun(doc: core.doc, item: plugins.autocomplete.symbolinfo))
Manually invoke the completion list using already registered symbols.