autoload/lsp/inlayhints.vim | 13 ++++++++++++- autoload/lsp/lsp.vim | 6 ------ diff --git a/autoload/lsp/inlayhints.vim b/autoload/lsp/inlayhints.vim index 7c29d0968207b54dd54e1d51c4704341a6c83cfc..b10c722a5c156d01f5f258c61cad50fa01698528 100644 --- a/autoload/lsp/inlayhints.vim +++ b/autoload/lsp/inlayhints.vim @@ -4,6 +4,7 @@ # Functions for dealing with inlay hints import './util.vim' import './buffer.vim' as buf +import './options.vim' as opt # Initialize the highlight group and the text property type used for # inlay hints. @@ -103,7 +104,17 @@ endif enddef # Do buffer-local initialization for displaying inlay hints -export def BufferInit(bnr: number) +export def BufferInit(lspserver: dict, bnr: number) + if !lspserver.isInlayHintProvider && !lspserver.isClangdInlayHintsProvider + # no support for inley hints + return + endif + + # Inlays hints are disabled + if !opt.lspOptions.showInlayHints + return + endif + var acmds: list> = [] # Update the inlay hints (if needed) when the cursor is not moved for some diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index f66b957af05b085ceb314e97363d4cfd85e456d0..3f9be040354698dfad98fe8869abee58d92efa83 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -300,12 +300,6 @@ group: 'LSPBufferAutocmds', cmd: 'call LspDocHighlightClear() | call LspDocHighlight()'}) endif - # Displaying inlay hints needs the Vim virtual text support. - if opt.lspOptions.showInlayHints && (lspserver.isInlayHintProvider - || lspserver.isClangdInlayHintsProvider) - inlayhints.BufferInit(bnr) - endif - # Show diagnostics on the status line if opt.lspOptions.showDiagOnStatusLine acmds->add({bufnr: bnr,