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

fix: wrap didSaveFile method with try-finally block #495

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion autoload/lsp/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,14 @@ def LspSavedFile(bnr: number)
endif

for lspserver in lspservers
lspserver.didSaveFile(bnr)
# TODO: implement `catch` block
# Wrap method with `try-finally` block to solve error:
# `E716: Key not present in Dictionary: "supportsDidSave"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how this would happen?

try
lspserver.didSaveFile(bnr)
finally
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even it happened, just return or should continue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't dive into the entire code base, I just hid the errors that appeared during programming. Perhaps it would be worthwhile to implement the ability to hide errors using a variable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though @yegappan accepted your/this PR, but i think:

  1. this didnot fix (or hid) the real err, since it perhaps was an init case, tho not sure how come that happened.
  2. and perhaps worse, since if that really happened, i thought it should continue to next lspserver vs return.

endtry
endfor
enddef

Expand Down