Skip to content

Commit

Permalink
[Enhance]: auto set filetype for secondary view
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhongjia committed Feb 20, 2024
1 parent b8b3f30 commit a7b2b90
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lua/LspUI/pos_abstract.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ local push_tagstack = nil
--- @alias lsp_position { buffer_id: integer, fold: boolean, range: lsp_range[]}
--- @alias Lsp_position_wrap { [lsp.URI]: lsp_position}

-- more info, see M.method
--- @type { method: string, name: string, fold: boolean }
local method = nil

Expand Down Expand Up @@ -63,7 +64,7 @@ M.method = {
},
type_definition = {
method = lsp.protocol.Methods.textDocument_typeDefinition,
name = "type definition",
name = "type_definition",
fold = false,
},
declaration = {
Expand Down Expand Up @@ -691,6 +692,15 @@ local generate_secondary_view = function()
buf = M.secondary_view_buffer(),
})

-- set the secondary buffer filetype
api.nvim_set_option_value(
"filetype",
string.format("LspUI-%s", method.name),
{
buf = M.secondary_view_buffer(),
}
)

-- hl_num for highlight lnum recording
local hl_num = 0
-- this array stores the highlighted line number
Expand Down

0 comments on commit a7b2b90

Please sign in to comment.