autoload/lsp/completion.vim | 2 -- autoload/lsp/util.vim | 8 +++++++- diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index b487cb59f5732153c6528d134acbada969ae923f..c0afe642819a1c3c0000f51144deee5257d70bfa 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -165,8 +165,6 @@ }) endfor endif - #writefile([$'chcol = {chcol}, starttext = [{starttext}], prefix = [{prefix}], start_idx = {start_idx}, end_idx = {end_idx}, start_col = {start_col}'], '/tmp/lspcomplete.log', 'a') - var completeItems: list> = [] for item in items var d: dict = {} diff --git a/autoload/lsp/util.vim b/autoload/lsp/util.vim index cb1798e610f34ad46b0a933dceb32c0c968a13cf..a02f79b48adffcad00d32a8e824f6c5c20f5b53c 100644 --- a/autoload/lsp/util.vim +++ b/autoload/lsp/util.vim @@ -34,7 +34,13 @@ enddef # Empty out the LSP server trace logs export def ClearTraceLogs(fname: string) - writefile([], fname) + var fullname = $'{lsp_log_dir}{fname}' + # If file existed but not writable + if filewritable(fullname) != 1 && filereadable(fullname) + ErrMsg($'File {fullname} is not writable') + return + endif + writefile([], fullname) enddef # Open the LSP server debug messages file.