From e32e16deeb930198c349b09fa2f5ff5e44bd4f82 Mon Sep 17 00:00:00 2001 From: "shane.xb.qian" Date: Fri, 14 Apr 2023 14:09:32 +0800 Subject: [PATCH] fix: log fs path was not correct Signed-off-by: shane.xb.qian --- autoload/lsp/completion.vim | 2 -- autoload/lsp/util.vim | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index b487cb5..c0afe64 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -165,8 +165,6 @@ export def CompletionReply(lspserver: dict, cItems: any) 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 cb1798e..a02f79b 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. -- 2.50.0