yegappan / lsp

Language Server Protocol (LSP) plugin for Vim9
MIT License
458 stars 49 forks source link

Ignore formatting errors for long loading language server #476

Open maximyurevich opened 5 months ago

maximyurevich commented 5 months ago

How can I ignore this errors? Screenshot from 2024-03-14 12-51-46

My svelteserver config:

if executable('svelteserver')
    lsp#lsp#AddServer([{
        name: 'svelteserver',
        filetype: ['svelte'],
        path: 'svelteserver',
        args: ['--stdio'],
        syncInit: v:true
    }])
endif

My efm-langserver config:

if executable('efm-langserver')
    lsp#lsp#AddServer([{
        name: 'efm',
        filetype: [
            'javascript',
            'javascriptreact',
            'typescript',
            'typescriptreact',
            'fish',
            'gitcommit',
            'lua',
            'python',
            'vue',
            'sh',
            'svelte',
            'markdown',
            'rst',
            'yaml'
        ],
        path: 'efm-langserver',
        args: [],
        initializationOptions: {
            'documentFormatting': v:true
        },
        features: {
            'documentFormatting': v:true
        },
        syncInit: v:true
    }])
endif

LspAttached config:

def OnLspBufferAttached()
    augroup lsp_format
      autocmd! BufWritePre *.py,*.sh,*.svelte,*.toml,*.vue,*.rb,*.html,*.json,*.yaml,*.lua,*.css,*.js,*.jsx,*.ts,*.tsx,*.rs,*.go,*.dart,*.md,*.c,*.cpp :LspFormat
    augroup END
enddef

augroup lsp_attach
    au!
    au User LspAttached call s:OnLspBufferAttached()
augroup END
yegappan commented 5 months ago

When do you see this error message? Do you see this message after loading a new file or do you see this message every time after saving a file?

maximyurevich commented 5 months ago

When do you see this error message? Do you see this message after loading a new file or do you see this message every time after saving a file?

Every time after saving a file for about 30 seconds until prettier configured with efm formats my file

saccarosium commented 5 months ago

Hi, I've been having a similar issue when running efm-langserver that was trying to run mypy on save when it wasn't on my path. But it happened only when I've was trying to save a file with no modifications.