Repository navigation
refactor(lsp): Phase 0 latency and mutex containment #3969
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
Changes from all commits
792aa76
ea10fa3
7fc1c18
97cda15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,17 +5,17 @@ | |||||
| | Suite | Location | Purpose | | ||||||
| |-------|----------|---------| | ||||||
| | `baml_tests` | `crates/baml_tests/` | Snapshot tests with detailed CST/HIR/THIR output | | ||||||
| | `lsp_actions_tests` | `crates/lsp_actions_tests/` | LSP integration tests with inline expectations | | ||||||
| | `baml_lsp2_actions_tests` | `crates/baml_lsp2_actions_tests/` | LSP integration tests with inline expectations | | ||||||
|
|
||||||
| ## Workflow: Debugging a Failing Test | ||||||
|
|
||||||
| ### 1. Identify the issue in lsp_actions_tests | ||||||
| ### 1. Identify the issue in baml_lsp2_actions_tests | ||||||
|
|
||||||
| ```bash | ||||||
| cargo test --package lsp_actions_tests | ||||||
| cargo test --package baml_lsp2_actions_tests | ||||||
| ``` | ||||||
|
|
||||||
| Look for errors in `crates/lsp_actions_tests/test_files/syntax/`. | ||||||
| Look for errors in `crates/baml_lsp2_actions_tests/test_files/syntax/`. | ||||||
|
|
||||||
| ### 2. Create a minimal repro in baml_tests | ||||||
|
|
||||||
|
|
@@ -64,16 +64,16 @@ Edit the relevant crate (`baml_compiler_parser`, `baml_compiler_syntax`, `baml_c | |||||
| cargo test --package baml_tests my_repro | ||||||
| cargo insta accept --all | ||||||
|
|
||||||
| # Update lsp_actions_tests inline expectations | ||||||
| UPDATE_EXPECT=1 cargo test --package lsp_actions_tests | ||||||
| # Update baml_lsp2_actions_tests inline expectations | ||||||
| UPDATE_EXPECT=1 cargo test --package baml_lsp2_actions_tests | ||||||
| ``` | ||||||
|
|
||||||
| ### 7. Verify all tests pass | ||||||
|
|
||||||
| ```bash | ||||||
| # Run all tests (can skip slow parser_stress with --skip parser_stress) | ||||||
| cargo test --package baml_tests -- --skip parser_stress | ||||||
| cargo test --package lsp_actions_tests | ||||||
| cargo test --package baml_lsp2_actions_tests | ||||||
| ``` | ||||||
|
|
||||||
| ## Quick Commands | ||||||
|
|
@@ -89,7 +89,7 @@ cargo test --package baml_tests | |||||
| cargo test --package baml_tests -- --skip parser_stress | ||||||
|
|
||||||
| # Run LSP tests and auto-update expectations | ||||||
| UPDATE_EXPECT=1 cargo test --package lsp_actions_tests | ||||||
| UPDATE_EXPECT=1 cargo test --package baml_lsp2_actions_tests | ||||||
|
|
||||||
| # Accept all pending snapshots | ||||||
| cargo insta accept --all | ||||||
|
|
@@ -108,7 +108,7 @@ cargo insta review | |||||
| - **Type checking**: `crates/baml_compiler2_tir/src/builder.rs` | ||||||
|
|
||||||
|
|
||||||
| DO NOT EDIT the diagnostics manually in lsp_actions_tests. Use update_expect=1 | ||||||
| DO NOT EDIT the diagnostics manually in baml_lsp2_actions_tests. Use update_expect=1 | ||||||
|
Contributor
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. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Use the correct environment variable name.
Proposed fix-DO NOT EDIT the diagnostics manually in baml_lsp2_actions_tests. Use update_expect=1
+DO NOT EDIT the diagnostics manually in baml_lsp2_actions_tests. Use UPDATE_EXPECT=1📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| Find the base-case that makes syntax fail and add that to baml_test with a good name and good folder organization. | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ use std::{collections::HashMap, path::Path}; | |
|
|
||
| use baml_compiler_diagnostics::{RenderConfig, render_diagnostic}; | ||
| use baml_lsp2_actions::{ | ||
| annotations::{AnnotationKind, InlineAnnotation, annotations}, | ||
| annotations::{AnnotationKind, InlineAnnotation, file_annotations}, | ||
|
Contributor
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. 🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift Keep inlay-hint collection on the Salsa-tracked query path. The supplied Make Also applies to: 168-170 🤖 Prompt for AI Agents |
||
| check::check_file, | ||
| completions::completions_at, | ||
| tokens::{SemanticToken, semantic_tokens}, | ||
|
|
@@ -165,9 +165,9 @@ pub fn run_test(parsed: &ParsedTestFile) -> TestResult { | |
| let actual_inlay_hints = if parsed.expected_inlay_hints.is_some() { | ||
| let mut all_hints: Vec<(String, InlineAnnotation)> = Vec::new(); | ||
| for (filename, source_file) in &file_map { | ||
| let hints = annotations(&db, *source_file); | ||
| let hints = file_annotations(&db, *source_file); | ||
| for hint in hints { | ||
| all_hints.push((filename.clone(), hint)); | ||
| all_hints.push((filename.clone(), hint.clone())); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -184,7 +184,7 @@ pub fn run_test(parsed: &ParsedTestFile) -> TestResult { | |
| for (filename, source_file) in &file_map { | ||
| let tokens = semantic_tokens(&db, *source_file); | ||
| for token in tokens { | ||
| all_tokens.push((filename.clone(), token)); | ||
| all_tokens.push((filename.clone(), token.clone())); | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Include the required library test command.
This verification block omits
cargo test --lib. Because this PR changes Rust code, add that command to the documented verification workflow.As per coding guidelines, always run
cargo test --libwhen Rust code changes.🤖 Prompt for AI Agents
Source: Coding guidelines