diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a4d3dc0c658..004e8bdc7fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,18 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom ### Editors ### Formatter ### JavaScript APIs +### Linter +### Parser +### VSCode + +## 1.1.2 (2023-09-07) + +### Editors + +#### Bug fixes + +- Fixed a case where an empty JSON file would cause the LSP server to crash. + ### Linter #### Enhancements @@ -34,12 +46,6 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom export * as MY_NAMESPACE from "./lib.js"; ``` -#### Bug fixes - - -### Parser -### VSCode - ## 1.1.1 (2023-09-07) ### Analyzer diff --git a/crates/rome_service/src/file_handlers/json.rs b/crates/rome_service/src/file_handlers/json.rs index 556cdfec625f..b8093565e538 100644 --- a/crates/rome_service/src/file_handlers/json.rs +++ b/crates/rome_service/src/file_handlers/json.rs @@ -247,54 +247,54 @@ fn lint(params: LintParams) -> LintResults { let has_lint = params.filter.categories.contains(RuleCategories::LINT); let analyzer_options = compute_analyzer_options(¶ms.settings, PathBuf::from(params.path.as_path())); + let Ok(value) = &root.value() else { + return LintResults { + diagnostics, + errors, + skipped_diagnostics, + }; + }; + let (_, analyze_diagnostics) = analyze(value, params.filter, &analyzer_options, |signal| { + if let Some(mut diagnostic) = signal.diagnostic() { + // Do not report unused suppression comment diagnostics if this is a syntax-only analyzer pass + if !has_lint && diagnostic.category() == Some(category!("suppressions/unused")) { + return ControlFlow::::Continue(()); + } - let (_, analyze_diagnostics) = analyze( - &root.value().unwrap(), - params.filter, - &analyzer_options, - |signal| { - if let Some(mut diagnostic) = signal.diagnostic() { - // Do not report unused suppression comment diagnostics if this is a syntax-only analyzer pass - if !has_lint && diagnostic.category() == Some(category!("suppressions/unused")) - { - return ControlFlow::::Continue(()); - } - - diagnostic_count += 1; - - // We do now check if the severity of the diagnostics should be changed. - // The configuration allows to change the severity of the diagnostics emitted by rules. - let severity = diagnostic - .category() - .filter(|category| category.name().starts_with("lint/")) - .map(|category| { - params - .rules - .and_then(|rules| rules.get_severity_from_code(category)) - .unwrap_or(Severity::Warning) - }) - .unwrap_or_else(|| diagnostic.severity()); - - if severity <= Severity::Error { - errors += 1; - } + diagnostic_count += 1; + + // We do now check if the severity of the diagnostics should be changed. + // The configuration allows to change the severity of the diagnostics emitted by rules. + let severity = diagnostic + .category() + .filter(|category| category.name().starts_with("lint/")) + .map(|category| { + params + .rules + .and_then(|rules| rules.get_severity_from_code(category)) + .unwrap_or(Severity::Warning) + }) + .unwrap_or_else(|| diagnostic.severity()); + + if severity <= Severity::Error { + errors += 1; + } - if diagnostic_count <= params.max_diagnostics { - for action in signal.actions() { - if !action.is_suppression() { - diagnostic = diagnostic.add_code_suggestion(action.into()); - } + if diagnostic_count <= params.max_diagnostics { + for action in signal.actions() { + if !action.is_suppression() { + diagnostic = diagnostic.add_code_suggestion(action.into()); } + } - let error = diagnostic.with_severity(severity); + let error = diagnostic.with_severity(severity); - diagnostics.push(rome_diagnostics::serde::Diagnostic::new(error)); - } + diagnostics.push(rome_diagnostics::serde::Diagnostic::new(error)); } + } - ControlFlow::::Continue(()) - }, - ); + ControlFlow::::Continue(()) + }); diagnostics.extend( analyze_diagnostics diff --git a/editors/vscode/package.json b/editors/vscode/package.json index 97cc4fc35141..46fff63800de 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -3,7 +3,7 @@ "publisher": "biomejs", "displayName": "Biome", "description": "Biome LSP VS Code Extension", - "version": "1.2.1", + "version": "1.2.2", "icon": "icon.png", "activationEvents": [ "onLanguage:javascript", diff --git a/packages/@biomejs/biome/package.json b/packages/@biomejs/biome/package.json index e5acdfacb9e8..a6de2de120f4 100644 --- a/packages/@biomejs/biome/package.json +++ b/packages/@biomejs/biome/package.json @@ -1,6 +1,6 @@ { "name": "@biomejs/biome", - "version": "1.1.1", + "version": "1.1.2", "bin": "bin/biome", "scripts": { "postinstall": "node scripts/postinstall.js" diff --git a/website/src/content/docs/internals/changelog.mdx b/website/src/content/docs/internals/changelog.mdx index 232b0972ca0b..0a881dc421b5 100644 --- a/website/src/content/docs/internals/changelog.mdx +++ b/website/src/content/docs/internals/changelog.mdx @@ -22,6 +22,18 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom ### Editors ### Formatter ### JavaScript APIs +### Linter +### Parser +### VSCode + +## 1.1.2 (2023-09-07) + +### Editors + +#### Bug fixes + +- Fixed a case where an empty JSON file would cause the LSP server to crash. + ### Linter #### Enhancements @@ -40,12 +52,6 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom export * as MY_NAMESPACE from "./lib.js"; ``` -#### Bug fixes - - -### Parser -### VSCode - ## 1.1.1 (2023-09-07) ### Analyzer