Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Larger source files cause failure to delete backup files #422

Open
Crunkle opened this issue Jun 27, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@Crunkle
Copy link

commented Jun 27, 2019

When saving larger source files, usually 80KB and up, I am often receiving E207: Can't delete backup file. This message occurs on the majority of saves including when no changes are made. When this plugin is disabled, the backup files are deleted properly and no error appears.

Here you can see all of the backup files that failed to delete when spamming :w a few times:

backup_files

I am using Windows, Neovim, clang, ccls, and a very minimal configuration for testing. All of the diagnostics work normally and this saving issue on large source code is the only major issue.

This is fixable by disabling backups entirely, but this seems like a bad solution.

@Crunkle

This comment has been minimized.

Copy link
Author

commented Jun 27, 2019

I spoke too soon, this is not fixed when disabling write backups. With set nowritebackup the file simply cannot be written to and I receive a E212: Can't open file for writing: unknown error almost every save.

@prabirshrestha

This comment has been minimized.

Copy link
Owner

commented Jun 27, 2019

Can you try other lang servers?

@Crunkle

This comment has been minimized.

Copy link
Author

commented Jun 27, 2019

I have only tried a few of the Clang-based servers so can't comment on any others yet. It seems to occur on any that open the file for reading directly. Could this be a race condition of some sort due to the stricter file locking on Windows?

If I wrap the save callback within a timer_start then the issue is resolved, even at 0 delay:

function! s:on_text_document_did_save() abort
    let l:buf = bufnr('%')
    if getbufvar(l:buf, '&buftype') ==# 'terminal' | return | endif
    call lsp#log('s:on_text_document_did_save()', l:buf)
    for l:server_name in lsp#get_whitelisted_servers(l:buf)
        call s:ensure_flush(l:buf, l:server_name, {result->timer_start(0, {result->s:call_did_save(l:buf, l:server_name, result, function('s:Noop'))})})
    endfor
endfunction

I can use this for now but it seems like a bit of a dodgy solution without knowing the cause. This only occurs on Windows, my Linux machine is totally fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.