Skip to content

Commit

Permalink
Add method doc.supports_language_server for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp-M committed May 18, 2023
1 parent ec2f909 commit 1122928
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 2 additions & 5 deletions helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ impl Application {
let docs = self
.editor
.documents()
.filter(|doc| doc.language_servers().any(|l| l.id() == server_id));
.filter(|doc| doc.supports_language_server(server_id));

// trigger textDocument/didOpen for docs that are already open
for doc in docs {
Expand Down Expand Up @@ -969,10 +969,7 @@ impl Application {
.editor
.documents_mut()
.filter_map(|doc| {
if doc
.language_servers()
.any(|server| server.id() == server_id)
{
if doc.supports_language_server(server_id) {
doc.clear_diagnostics(server_id);
doc.url()
} else {
Expand Down
4 changes: 4 additions & 0 deletions helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,10 @@ impl Document {
})
}

pub fn supports_language_server(&self, id: usize) -> bool {
self.language_servers().any(|l| l.id() == id)
}

pub fn diff_handle(&self) -> Option<&DiffHandle> {
self.diff_handle.as_ref()
}
Expand Down

0 comments on commit 1122928

Please sign in to comment.