feat: support configurable tabline status label

This commit is contained in:
Valdemar Lorenzen
2026-10-12 10:56:30 +02:00
parent 05d62aa4a5
commit d55b7b65d2
10 changed files with 526 additions and 32 deletions
+16 -3
View File
@@ -16,6 +16,7 @@ module Vamp
@file_picker_view = "tree"
@file_explorer_view = "tree"
@clipboard_mode = "system"
@tabline_label = ""
@diff_context_lines = 10
@diff_expand_lines = 15
end
@@ -62,6 +63,12 @@ module Vamp
@clipboard_mode = nonempty_string!(mode, "clipboard mode")
end
# @param text [String] plain text displayed at the right of the tab line; empty clears it
# @return [String]
def tabline_label=(text)
@tabline_label = Vamp.string!(text, "tabline label")
end
# @param lines [Integer] nonnegative context lines around each diff change
# @return [Integer]
def diff_context_lines=(lines)
@@ -104,7 +111,7 @@ module Vamp
def response
{ "version" => 1, "type" => "config", "plugins" => @plugins, "lsp" => lsp_options, "bindings" => @bindings,
"leader" => @leader, "file_explorer_side" => @file_explorer_side, "file_picker_view" => @file_picker_view,
"file_explorer_view" => @file_explorer_view, "clipboard_mode" => @clipboard_mode,
"file_explorer_view" => @file_explorer_view, "clipboard_mode" => @clipboard_mode, "tabline_label" => @tabline_label,
"diff_context_lines" => @diff_context_lines, "diff_expand_lines" => @diff_expand_lines }
end
@@ -203,7 +210,7 @@ module Vamp
attr_reader :path
# @return [Integer] positive invocation ID
attr_reader :request_id
# @return [Array<Hash{String => String}>] queued insert/replace/message effects
# @return [Array<Hash{String => String}>] queued text and presentation effects
attr_reader :effects
# @param context [Hash{String => String, Integer, nil}] primary caret/document snapshot
@@ -237,6 +244,12 @@ module Vamp
queue("message", text)
end
# @param text [String] plain text displayed at the right of the tab line; empty clears it
# @return [nil]
def tabline_label(text)
queue("tabline_label", text)
end
private
# @param context [Hash{String => String, Integer, nil}]
@@ -281,7 +294,7 @@ module Vamp
raise ArgumentError, "context buffer_id and revision must be nonnegative integers"
end
# @param type [String] insert, replace, or message
# @param type [String] insert, replace, message, or tabline_label
# @param text [String]
# @return [nil]
def queue(type, text)