Skip to content

Commit

Permalink
fix(lsp): update diagnostics only for supported files (#3741)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored Aug 30, 2024
1 parent bba3412 commit ca54036
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/biome_lsp/src/handlers/text_document.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use crate::utils::apply_document_changes;
use crate::{documents::Document, session::Session};
use anyhow::Result;
use biome_service::workspace::{
ChangeFileParams, CloseFileParams, DocumentFileSource, GetFileContentParams, OpenFileParams,
};
use tower_lsp::lsp_types;
use tracing::{error, field};

use crate::utils::apply_document_changes;
use crate::{documents::Document, session::Session};

/// Handler for `textDocument/didOpen` LSP notification
#[tracing::instrument(
level = "debug",
Expand Down
10 changes: 10 additions & 0 deletions crates/biome_lsp/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,16 @@ impl Session {
path: biome_path.clone(),
})?;

if !file_features.supports_lint()
&& !file_features.supports_organize_imports()
&& !file_features.supports_assists()
{
self.client
.publish_diagnostics(url, vec![], Some(doc.version))
.await;
return Ok(());
}

let diagnostics: Vec<Diagnostic> = {
let mut categories = RuleCategoriesBuilder::default().with_syntax();
if self.configuration_status().is_loaded() {
Expand Down

0 comments on commit ca54036

Please sign in to comment.