Repository navigation
Hook Results
Federico Conticello edited this page Mar 24, 2026
·
1 revision
Any hook can return a table with one or more of these fields. All fields are optional.
Only meaningful in on_document_save. Returns modified text to be saved instead of the original.
return { modified_content = cleaned_text }Shows a toast notification in the editor.
return {
status_message = {
level = "info", -- "info", "warning", "error"
text = "Lint passed: 0 issues"
}
}Array of diagnostic objects. Typically returned from on_document_lint.
return {
diagnostics = {
{
line = 10,
message = "Unused variable 'x'",
level = "warning",
column = 5,
fix_message = "Remove or use the variable",
url = "https://example.com/rules/unused-var"
}
}
}Array of line annotation objects. Typically returned from on_highlight_request.
return {
line_annotations = {
{ line = 5, text = "!", color = {255, 0, 0} },
{ line = 12, text = "?", color = {255, 255, 0} }
}
}Display a widget panel. See Widget API for full documentation.
Opens a file in the editor as a new tab.
return { open_file = "/path/to/file.rs" }Jumps to a specific line in the current document (1-indexed).
return { goto_line = 42 }Copies text to the system clipboard.
return { clipboard_text = "copied content" }You can return multiple fields at once:
return {
diagnostics = parsed_diagnostics,
status_message = {
level = "info",
text = #parsed_diagnostics .. " issues found"
},
tree_view = {
title = "Lint Results",
root = results_tree
}
}