Skip to content

Commit

Permalink
chore: update codegen to include GraphQL
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Jun 27, 2024
1 parent b3ca28e commit 0c28f64
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 50 deletions.
6 changes: 6 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions crates/biome_configuration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ biome_deserialize_macros = { workspace = true }
biome_diagnostics = { workspace = true }
biome_flags = { workspace = true }
biome_formatter = { workspace = true, features = ["serde"] }
biome_graphql_analyze = { workspace = true }
biome_graphql_parser = { workspace = true }
biome_graphql_syntax = { workspace = true }
biome_js_analyze = { workspace = true }
biome_js_formatter = { workspace = true, features = ["serde"] }
biome_js_syntax = { workspace = true, features = ["serde", "schema"] }
Expand All @@ -47,6 +50,7 @@ schema = [
"biome_formatter/serde",
"biome_json_syntax/schema",
"biome_css_syntax/schema",
"biome_graphql_syntax/schema",
]

[dev-dependencies]
Expand Down
76 changes: 48 additions & 28 deletions crates/biome_configuration/src/linter/rules.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/biome_service/src/file_handlers/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ fn lint(params: LintParams) -> LintResults {
.map(|selector| selector.into())
.collect::<Vec<_>>();

dbg!(&enabled_rules);
let filter = AnalysisFilter {
categories: params.categories,
enabled_rules: Some(enabled_rules.as_slice()),
Expand Down
1 change: 1 addition & 0 deletions crates/biome_service/src/workspace/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ impl Workspace for WorkspaceServer {
let (diagnostics, errors, skipped_diagnostics) =
if let Some(lint) = self.get_file_capabilities(&params.path).analyzer.lint {
info_span!("Pulling diagnostics", categories =? params.categories).in_scope(|| {
dbg!("here");
let results = lint(LintParams {
parse,
workspace: &self.workspace(),
Expand Down
27 changes: 26 additions & 1 deletion crates/biome_service/tests/workspace.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#[cfg(test)]
mod test {
use biome_analyze::RuleCategories;
use biome_fs::BiomePath;
use biome_js_syntax::{JsFileSource, TextSize};
use biome_service::file_handlers::DocumentFileSource;
Expand Down Expand Up @@ -185,7 +186,7 @@ mod test {
content: r#"type Query {
me: User
}
type User {
id: ID
name: String
Expand All @@ -202,4 +203,28 @@ type User {

assert!(syntax.starts_with("GraphqlRoot"))
}

#[test]
fn correctly_pulls_lint_diagnostics() {
let workspace = create_server();

let graphql_file = FileGuard::open(
workspace.as_ref(),
OpenFileParams {
path: BiomePath::new("file.graphql"),
content: r#"query {
member @deprecated(abc: 123)
}"#
.into(),
version: 0,
document_file_source: None,
},
)
.unwrap();
let result = graphql_file.pull_diagnostics(RuleCategories::all(), 10, vec![], vec![]);
assert!(result.is_ok());
let diagnostics = result.unwrap().diagnostics;

dbg!(diagnostics);
}
}
4 changes: 4 additions & 0 deletions packages/@biomejs/backend-jsonrpc/src/workspace.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/@biomejs/biome/configuration_schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0c28f64

Please sign in to comment.