-
Notifications
You must be signed in to change notification settings - Fork 5
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
39 vscode extension better status bar information #48
Changes from all commits
dd9fe83
de7dc48
3d24c3d
118b4e7
7ac8e85
cfa02f1
23a75d9
7a18c8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,8 @@ impl LspServer { | |
}) | ||
.id; | ||
drop(files); | ||
self.clear_all().map_err(VerifyError::ServerError)?; | ||
self.clear_file_information(&file_id) | ||
.map_err(VerifyError::ServerError)?; | ||
let result = verify(self, &[file_id]); | ||
let res = match &result { | ||
Ok(_) => Response::new_ok(id, Value::Null), | ||
|
@@ -195,9 +196,22 @@ impl LspServer { | |
Ok(None) | ||
} | ||
"textDocument/didClose" => { | ||
let _params: DidCloseTextDocumentParams = | ||
let params: DidCloseTextDocumentParams = | ||
notification.extract("textDocument/didClose")?; | ||
// TODO: remove file? | ||
|
||
let file_id = self | ||
.files | ||
.lock() | ||
.unwrap() | ||
.find_uri(params.text_document.clone()) | ||
.unwrap_or_else(|| { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Possibly just turn this into an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clippy complains about the |
||
panic!( | ||
"Could not find file id for document {:?}", | ||
params.text_document | ||
) | ||
}) | ||
.id; | ||
self.clear_file_information(&file_id)?; | ||
Ok(None) | ||
} | ||
_ => Ok(Some(notification)), | ||
|
@@ -297,14 +311,14 @@ impl LspServer { | |
Ok(()) | ||
} | ||
|
||
fn clear_all(&mut self) -> Result<(), ServerError> { | ||
for diags in self.diagnostics.values_mut() { | ||
diags.clear(); | ||
fn clear_file_information(&mut self, file_id: &FileId) -> Result<(), ServerError> { | ||
if let Some(diag) = self.diagnostics.get_mut(file_id) { | ||
diag.clear(); | ||
} | ||
for explanations in self.vc_explanations.values_mut() { | ||
if let Some(explanations) = self.vc_explanations.get_mut(file_id) { | ||
explanations.clear(); | ||
} | ||
self.statuses.clear(); | ||
self.statuses.retain(|span, _| span.file != *file_id); | ||
self.publish_diagnostics()?; | ||
self.publish_verify_statuses()?; | ||
Ok(()) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method necessary? Why not just call
find(SourceFilePath::Lsp(ident))
?