yegappan / lsp

Language Server Protocol (LSP) plugin for Vim9
MIT License
447 stars 43 forks source link

clangd + semanticHighlight causes major lag and slow down #491

Open S4deghN opened 3 months ago

S4deghN commented 3 months ago

takes seconds to delete a line or undo it same for loading buffers. just disabling semanticHighlight make everything snappy. any idea what's the issue?

this is my config for reference:

var lspOpts = {
    semanticHighlight: true,
    aleSupport: false,
    autoComplete: true,
    autoHighlight: false,
    autoHighlightDiags: true,
    autoPopulateDiags: false,
    completionMatcher: 'icase',
    completionMatcherValue: 1,
    echoSignature: false,
    hideDisabledCodeActions: false,
    highlightDiagInline: false,
    hoverInPreview: false,
    ignoreMissingServer: true,
    keepFocusInDiags: false,
    keepFocusInReferences: true,
    completionTextEdit: true,
    diagVirtualTextAlign: 'above',
    diagVirtualTextWrap: 'default',
    noNewlineInCompletion: false,
    omniComplete: false,
    outlineOnRight: false,
    outlineWinSize: 20,
    showDiagInBalloon: true,
    showDiagInPopup: true,
    showDiagOnStatusLine: false,
    showDiagWithSign: true,
    showDiagWithVirtualText: false,
    showInlayHints: false,
    showSignature: true,
    snippetSupport: false,
    ultisnipsSupport: false,
    useBufferCompletion: false,
    usePopupInCodeAction: false,
    useQuickfixForLocations: true,
    vsnipSupport: false,
    bufferCompletionTimeout: 0,
    customCompletionKinds: false,
    completionKinds: {},
    filterCompletionDuplicates: false,
}

var lspServers = [
    {
        name: 'clangd',
        filetype: ['c', 'cpp'],
        path: 'clangd',
        args: [
            '--background-index',
            "--malloc-trim",
            "--enable-config",
            "--all-scopes-completion=true",
            "--completion-style=detailed",
            "--function-arg-placeholders",
            "--header-insertion=iwyu",
            "--header-insertion-decorators",
        ]
    },
]
S4deghN commented 3 months ago

I wanted to add that syntax highlighting on small projects doesn't introduce any discernible lag. And that I also tested the same project with a minimal neovim with native lsp config to see if it's a clangd issue but neovim didn't have any problem with syntax highlighting.