Skip to content

Commit

Permalink
return error on write file error
Browse files Browse the repository at this point in the history
  • Loading branch information
phcreery committed Oct 3, 2024
1 parent 7d8e256 commit 99c5702
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/server/features_formatting.v
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ pub fn (mut ls LanguageServer) formatting(params lsp.DocumentFormattingParams) !
uri := params.text_document.uri.normalize()
file := ls.get_file(uri) or { return error('Cannot format not opened file') }

os.write_file(temp_formatting_file_path, file.psi_file.source_text) or {
return error('Cannot write temp file for formatting: ${err}')
}
os.write_file(temp_formatting_file_path, file.psi_file.source_text)!

loglib.with_fields({
'uri': file.uri.str()
Expand Down Expand Up @@ -42,7 +40,6 @@ pub fn (mut ls LanguageServer) formatting(params lsp.DocumentFormattingParams) !
errors := fmt_proc.stderr_slurp().trim_space()
ls.client.show_message(errors, .info)
return error('Formatting failed: ${errors}')
// return []
}

return [
Expand Down

0 comments on commit 99c5702

Please sign in to comment.