revert(lsp): temporarily revert #3867 to land #4000 first#4002
Conversation
This reverts commit a05ec5a.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
📝 WalkthroughWalkthroughThis PR migrates contextual keyword handling to generic words, unifies catch bindings with pattern bindings, removes obsolete compiler resolver metadata, replaces semantic-token classification with CST/compiler2 traversal, simplifies LSP transport, and updates or removes related tests and tooling. ChangesCompiler syntax and binding migration
Semantic-token migration
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant BexLSP
participant Compiler2
Client->>BexLSP: request semanticTokens/full
BexLSP->>Compiler2: compute semantic tokens
Compiler2-->>BexLSP: ordered token ranges and types
BexLSP-->>Client: full LSP semantic-token response
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Binary size checks passed✅ 7 passed
Generated by |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
baml_language/crates/baml_compiler_parser/src/parser.rs (1)
1781-1816: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick winPrevent
find_token_after_hashesfrom returningtokens.len()at EOF
find_token_after_hashescan still returnSome(self.tokens.len())after the final hash run, soparse_raw_stringandlooks_like_config_expressioncan index past the end on bare hash input at EOF. ReturnNonewhen the post-hash scan reaches EOF, and add a unit test for raw-string lookahead on##/EOF.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_compiler_parser/src/parser.rs` around lines 1781 - 1816, The find_token_after_hashes method must not return Some(tokens.len()) when the post-hash trivia scan reaches EOF. Update its post-hash return path to return None at end of input while preserving valid next-token lookahead, and add a unit test covering raw-string lookahead for bare ## at EOF.Source: Path instructions
🧹 Nitpick comments (1)
baml_language/crates/baml_lsp2_actions/src/definition.rs (1)
426-430: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winConsider navigating to the interface's own member declaration instead of
None.Returning
NoneforInterfaceVirtualMethod/InterfaceVirtualFieldremoves "Go to Definition" entirely for interface-dispatched calls/field accesses. Since the interface declaration itself is a single, stable location (unlike a specific implementor), pointing there would preserve some navigation value instead of silently doing nothing.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_lsp2_actions/src/definition.rs` around lines 426 - 430, Update the InterfaceVirtualMethod and InterfaceVirtualField branches in the definition-resolution match to return the owning interface member declaration location instead of None. Resolve the interface’s declared member using the available interface and member-name information, while preserving the existing behavior for statically resolvable definitions and avoiding navigation to any specific implementor.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/multi_segment_path.baml`:
- Around line 59-61: Update the expected semantic-token fixture for the
expression-body string literal so `"hi"` is represented as one token with len=4,
rather than separate opening quote, content, and closing quote tokens. Preserve
the existing token position and token type while changing only the expected
segmentation in the multi-segment path fixture.
In
`@baml_language/crates/baml_lsp2_actions_tests/test_files/syntax/hover/catch_binding.baml`:
- Line 28: Update local_type_info handling for PatternBinding in type_info.rs to
resolve and return the binding’s actual inferred type instead of the hardcoded
"unknown" value, then change the catch_binding.baml hover expectation back to
the specific inferred union type.
In `@baml_language/crates/baml_lsp2_actions/src/tokens.rs`:
- Around line 738-767: The constructor and field token classification in the
surrounding expression-processing logic uses heuristic span_text.find lookups
that can select repeated identifiers incorrectly. Plumb exact identifier spans
through AstSourceMap for the constructor type name, field names, and pattern
binding name, then use those spans directly when inserting semantic tokens
instead of searching the full span text; preserve the existing inferred token
type and Property classification.
In `@baml_language/crates/baml_lsp2_actions/src/type_info.rs`:
- Around line 704-710: Update local_type_info’s DefinitionSite::PatternBinding
arm in baml_language/crates/baml_lsp2_actions/src/type_info.rs:704-710 to use
find_binding_ty_in_scopes(db, index, scope_id, pat_id) and return the resolved
inferred type instead of hardcoded "unknown"; update
baml_language/crates/baml_lsp2_actions_tests/test_files/syntax/hover/catch_binding.baml:28
to restore the expected hover type Errors.AuthError | Errors.NotFoundError.
---
Outside diff comments:
In `@baml_language/crates/baml_compiler_parser/src/parser.rs`:
- Around line 1781-1816: The find_token_after_hashes method must not return
Some(tokens.len()) when the post-hash trivia scan reaches EOF. Update its
post-hash return path to return None at end of input while preserving valid
next-token lookahead, and add a unit test covering raw-string lookahead for bare
## at EOF.
---
Nitpick comments:
In `@baml_language/crates/baml_lsp2_actions/src/definition.rs`:
- Around line 426-430: Update the InterfaceVirtualMethod and
InterfaceVirtualField branches in the definition-resolution match to return the
owning interface member declaration location instead of None. Resolve the
interface’s declared member using the available interface and member-name
information, while preserving the existing behavior for statically resolvable
definitions and avoiding navigation to any specific implementor.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9842bd66-b0f8-44eb-a075-b842dd81209f
⛔ Files ignored due to path filters (66)
baml_language/Cargo.lockis excluded by!**/*.lockbaml_language/crates/baml_tests/snapshots/broken_syntax/optional_parameter_defaults/baml_tests__broken_syntax__optional_parameter_defaults__02_parser__function_type_defaults.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/broken_syntax/pending_greaters_fix/baml_tests__broken_syntax__pending_greaters_fix__02_parser__extra_greater.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/broken_syntax/test_invalid_contexts/baml_tests__broken_syntax__test_invalid_contexts__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/broken_syntax/type_annotation_errors/baml_tests__broken_syntax__type_annotation_errors__02_parser__type_malformed.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/config_dictionary/baml_tests__compiles__config_dictionary__02_parser__valid_dictionary.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_alias_basic/baml_tests__compiles__json_alias_basic__02_parser__json_alias_basic.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_map_literal/baml_tests__compiles__json_map_literal__02_parser__json_map_literal.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/lambda_advanced/baml_tests__compiles__lambda_advanced__02_parser__lambda_advanced.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/lexical_scoping/baml_tests__compiles__lexical_scoping__02_parser__lexical_scoping.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/literal_union_arithmetic/baml_tests__compiles__literal_union_arithmetic__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/llm_parse_catchable_parse_error/baml_tests__compiles__llm_parse_catchable_parse_error__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/method_explicit_type_args/baml_tests__compiles__method_explicit_type_args__02_parser__method_explicit_type_args.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/namespaces_type_resolution/baml_tests__compiles__namespaces_type_resolution__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/namespaces_type_resolution/baml_tests__compiles__namespaces_type_resolution__02_parser__ns_auth_auth.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/namespaces_type_resolution/baml_tests__compiles__namespaces_type_resolution__02_parser__ns_llm_models.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/optional_function_parameters/baml_tests__compiles__optional_function_parameters__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/parser_expressions/baml_tests__compiles__parser_expressions__02_parser__precedence.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/parser_statements/baml_tests__compiles__parser_statements__02_parser__break_continue.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__02_parser__patterns_new.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/stream_crossfile/baml_tests__compiles__stream_crossfile__02_parser__file_a.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/test_expr_name_concat/baml_tests__compiles__test_expr_name_concat__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/test_raw_string_name/baml_tests__compiles__test_raw_string_name__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/testset_basic/baml_tests__compiles__testset_basic__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/testset_dynamic/baml_tests__compiles__testset_dynamic__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/testset_nested/baml_tests__compiles__testset_nested__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_annotation/baml_tests__compiles__type_annotation__02_parser__type_alias_interaction.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_annotation/baml_tests__compiles__type_annotation__02_parser__type_positions.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_test/baml_tests__compiles__type_builder_test__02_parser__test.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/attr_disambiguation/baml_tests__diagnostic_errors__attr_disambiguation__02_parser__non_field.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/backtick_strict_types/baml_tests__diagnostic_errors__backtick_strict_types__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/basic_types/baml_tests__diagnostic_errors__basic_types__02_parser__types.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/builtin_io/baml_tests__diagnostic_errors__builtin_io__02_parser__io_ops.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/builtin_io/baml_tests__diagnostic_errors__builtin_io__02_parser__shell_ops.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/catch_arm_braceless_return/baml_tests__diagnostic_errors__catch_arm_braceless_return__02_parser__repro.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/catch_return_type_mismatch/baml_tests__diagnostic_errors__catch_return_type_mismatch__02_parser__catch_return_type_mismatch.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/duplicate_class_span/baml_tests__diagnostic_errors__duplicate_class_span__02_parser__repro.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/format_checks/baml_tests__diagnostic_errors__format_checks__02_parser__binary_expr.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/format_checks/baml_tests__diagnostic_errors__format_checks__02_parser__config_decls.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/format_checks/baml_tests__diagnostic_errors__format_checks__02_parser__loop_stmts.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/format_checks/baml_tests__diagnostic_errors__format_checks__02_parser__match_exprs.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/format_checks/baml_tests__diagnostic_errors__format_checks__02_parser__other_exprs.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/format_checks/baml_tests__diagnostic_errors__format_checks__02_parser__type_alias_decls.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_throws/baml_tests__diagnostic_errors__function_type_throws__02_parser__negative.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/function_types/baml_tests__diagnostic_errors__function_types__02_parser__function_types.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/generics/baml_tests__diagnostic_errors__generics__02_parser__classes.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/headers_edge_cases/baml_tests__diagnostic_errors__headers_edge_cases__02_parser__edge_cases.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__02_parser__match_exhaustiveness.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/null_handling/baml_tests__diagnostic_errors__null_handling__02_parser__null_handling.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/optional_parameter_defaults/baml_tests__diagnostic_errors__optional_parameter_defaults__02_parser__unsupported_contexts.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/parser_constructors/baml_tests__diagnostic_errors__parser_constructors__02_parser__array_constructor.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/parser_constructors/baml_tests__diagnostic_errors__parser_constructors__02_parser__map_constructor.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/stream_types/baml_tests__diagnostic_errors__stream_types__02_parser__complex.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/stream_types/baml_tests__diagnostic_errors__stream_types__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/stream_types/baml_tests__diagnostic_errors__stream_types__02_parser__ns_foo_with_top_level_refs.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/test_expr_name_type_error/baml_tests__diagnostic_errors__test_expr_name_type_error__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/test_expr_wrong_runner/baml_tests__diagnostic_errors__test_expr_wrong_runner__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/test_with_runner_ambiguity/baml_tests__diagnostic_errors__test_with_runner_ambiguity__02_parser__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_aliases/baml_tests__diagnostic_errors__type_aliases__02_parser__type_aliases.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_aliases/baml_tests__diagnostic_errors__type_aliases__02_parser__type_aliases_json.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/unknown_type_error/baml_tests__diagnostic_errors__unknown_type_error__02_parser__unknown_type_error.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/void_return_type/baml_tests__diagnostic_errors__void_return_type__02_parser__function_type_throws.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/void_return_type/baml_tests__diagnostic_errors__void_return_type__02_parser__void_function_type.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/void_return_type/baml_tests__diagnostic_errors__void_return_type__02_parser__void_type_position_errors.snapis excluded by!**/*.snappnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (122)
baml_language/Cargo.tomlbaml_language/crates/baml_cli/src/paint.rsbaml_language/crates/baml_compiler2_ast/src/lower_expr_body.rsbaml_language/crates/baml_compiler2_hir/src/builder.rsbaml_language/crates/baml_compiler2_hir/src/item_tree.rsbaml_language/crates/baml_compiler2_hir/src/semantic_index.rsbaml_language/crates/baml_compiler2_mir/src/lower.rsbaml_language/crates/baml_compiler2_tir/src/inference.rsbaml_language/crates/baml_compiler2_tir/src/resolve.rsbaml_language/crates/baml_compiler_parser/src/parser.rsbaml_language/crates/baml_compiler_syntax/src/ast.rsbaml_language/crates/baml_compiler_syntax/src/syntax_kind.rsbaml_language/crates/baml_fmt/src/ast/declarations.rsbaml_language/crates/baml_fmt/src/ast/expressions.rsbaml_language/crates/baml_fmt/src/ast/tokens.rsbaml_language/crates/baml_fmt/src/ast/types.rsbaml_language/crates/baml_lsp2_actions/Cargo.tomlbaml_language/crates/baml_lsp2_actions/src/completions.rsbaml_language/crates/baml_lsp2_actions/src/definition.rsbaml_language/crates/baml_lsp2_actions/src/definition_at_tests.rsbaml_language/crates/baml_lsp2_actions/src/describe.rsbaml_language/crates/baml_lsp2_actions/src/lib.rsbaml_language/crates/baml_lsp2_actions/src/tokens.rsbaml_language/crates/baml_lsp2_actions/src/tokens/classify.rsbaml_language/crates/baml_lsp2_actions/src/tokens/index.rsbaml_language/crates/baml_lsp2_actions/src/type_info.rsbaml_language/crates/baml_lsp2_actions_tests/src/lib.rsbaml_language/crates/baml_lsp2_actions_tests/src/range_tokens_test.rsbaml_language/crates/baml_lsp2_actions_tests/src/runner.rsbaml_language/crates/baml_lsp2_actions_tests/src/typing_robustness_test.rsbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/array_pattern.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/attributes.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/backtick_string.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/bigint_literals.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/block_attributes.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/break_continue.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/byte_strings.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/call_named_args.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/cancel_token.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/catch_all_keyword.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/catch_param.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/catch_throw.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/class.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/client.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/config_dictionary.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/const_binding.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/const_let_else_defer.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/constructor_spread.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/deep_method_call.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/dynamic_type_builder.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/enum_decls.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/enum_member_access.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/exhaustive.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/extends_chain.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/field_alias.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/for_loops.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/function.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/generators.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/generic_field_chain.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/generic_function_call.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/header_comments.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/http_config.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/if_else.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/if_expression.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/if_let_chain.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/implements_for.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/index_access.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/interface_impl.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/interfaces_inferred_generic_type_args.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/interfaces_iter_core.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/interfaces_sort_comparable.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/is_operator.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/iterator.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/jinja_control_prompt.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/json_map_literal.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/json_parse_stringify_intrinsics.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/lambda_advanced.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/literal_types.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/llm_function.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/map_literal_keys.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/map_type_and_methods.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/match_expr.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/match_literal_types.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/method_explicit_type_args.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/multi_segment_path.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_agent_clients.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_ansi.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_game_clients.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_images_pipeline.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_sentiment.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/patterns_new.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/remap_role.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/requires_clause.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/retry_policy_valid_retry.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/self_qualified_call.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/signature_variety.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/stream_llm_inferred_typeargs.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/task_group.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/template_string.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/template_string_calls.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/test_block.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/test_expr_throwing_body.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/testset.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/testset_vibes_nested.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/throws_clause.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/top_level_binding.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/type_alias.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/type_aliases_jinja.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/watch_let.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/while_loop.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/with_keyword.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/syntax/hover/catch_binding.bamlbaml_language/crates/bex_project/src/bex_lsp/multi_project/mod.rsbaml_language/crates/bex_project/src/bex_lsp/multi_project/request.rsbaml_language/crates/tools_semantic_tokens/Cargo.tomlbaml_language/crates/tools_semantic_tokens/README.mdbaml_language/crates/tools_semantic_tokens/src/analysis.rsbaml_language/crates/tools_semantic_tokens/src/index.htmlbaml_language/crates/tools_semantic_tokens/src/main.rsbaml_language/crates/tools_semantic_tokens/src/server.rsbaml_language/crates/tools_semantic_tokens/src/staleness.rsbaml_language/stow.toml
💤 Files with no reviewable changes (88)
- baml_language/crates/baml_lsp2_actions_tests/src/range_tokens_test.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/top_level_binding.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/attributes.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/testset.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/array_pattern.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/if_expression.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/generators.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/constructor_spread.baml
- baml_language/crates/tools_semantic_tokens/Cargo.toml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/deep_method_call.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/header_comments.baml
- baml_language/crates/tools_semantic_tokens/src/index.html
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_agent_clients.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/block_attributes.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/template_string_calls.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/enum_decls.baml
- baml_language/crates/tools_semantic_tokens/README.md
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/catch_param.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/generic_field_chain.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/generic_function_call.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/self_qualified_call.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/implements_for.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/index_access.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/jinja_control_prompt.baml
- baml_language/crates/baml_lsp2_actions_tests/src/typing_robustness_test.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/json_parse_stringify_intrinsics.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/field_alias.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/json_map_literal.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/is_operator.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/literal_types.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/test_expr_throwing_body.baml
- baml_language/crates/baml_lsp2_actions/Cargo.toml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/backtick_string.baml
- baml_language/crates/baml_lsp2_actions/src/tokens/classify.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_images_pipeline.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/iterator.baml
- baml_language/crates/baml_lsp2_actions/src/tokens/index.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/http_config.baml
- baml_language/crates/baml_lsp2_actions_tests/src/lib.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/retry_policy_valid_retry.baml
- baml_language/crates/tools_semantic_tokens/src/staleness.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_game_clients.baml
- baml_language/crates/tools_semantic_tokens/src/server.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/map_type_and_methods.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/with_keyword.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/config_dictionary.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/call_named_args.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/testset_vibes_nested.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/catch_all_keyword.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/enum_member_access.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/extends_chain.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/task_group.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/if_let_chain.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/remap_role.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/exhaustive.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/method_explicit_type_args.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/bigint_literals.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/catch_throw.baml
- baml_language/crates/tools_semantic_tokens/src/analysis.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/type_aliases_jinja.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/interface_impl.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/stream_llm_inferred_typeargs.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/requires_clause.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/cancel_token.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/interfaces_sort_comparable.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_ansi.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/byte_strings.baml
- baml_language/crates/tools_semantic_tokens/src/main.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/dynamic_type_builder.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/const_let_else_defer.baml
- baml_language/crates/baml_lsp2_actions/src/definition_at_tests.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/signature_variety.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/ns_sentiment.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/throws_clause.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/match_literal_types.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/patterns_new.baml
- baml_language/crates/baml_compiler2_tir/src/inference.rs
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/lambda_advanced.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/watch_let.baml
- baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/map_literal_keys.baml
- baml_language/crates/baml_lsp2_actions/src/describe.rs
- baml_language/crates/baml_compiler2_ast/src/lower_expr_body.rs
- baml_language/Cargo.toml
- baml_language/crates/baml_fmt/src/ast/tokens.rs
- baml_language/crates/bex_project/src/bex_lsp/multi_project/mod.rs
- baml_language/crates/baml_compiler2_hir/src/item_tree.rs
- baml_language/crates/baml_compiler2_tir/src/resolve.rs
- baml_language/crates/baml_compiler_syntax/src/syntax_kind.rs
|
Disposition of the CodeRabbit review: the Critical finding is valid and now addressed — the EOF guard in |
…oundaryML#3867) (BoundaryML#4005) Stacked on BoundaryML#4002 (retargets to canary when it merges). Re-applies the one change in BoundaryML#3867 that was a standalone bug fix rather than part of the semantic-tokens feature, so the revert doesn't reintroduce it — addressing CodeRabbit's Critical finding on BoundaryML#4002. `find_token_after_hashes` could return the one-past-the-end index after a hash run at EOF, and `parse_raw_string` indexed `tokens` with it directly — a panic on incomplete input like a bare `##` at end of file, present on canary long before BoundaryML#3867. Under the new LSP core (BoundaryML#4000) a parser panic on the source path additionally poisons the project into a terminal broken state, so this class matters more now. Both hunks are byte-for-byte @codeshaunted's fix from BoundaryML#3867 (credited as co-author). New here: the regression test the original lacked — verified to panic (`index out of bounds: the len is 15 but the index is 15`) with the guards removed, and covering bare `#`/`##` at top level, inside expression bodies, and after `let`. Validation: `cargo test -p baml_compiler_parser` 140/140 (139 pre-existing + the new test), clippy `-D warnings` clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VEMxti5WQ8bCgJUuX9AQvo <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved handling of incomplete raw-string syntax at end-of-file. * Prevented unexpected parser crashes when inputs end with standalone hash characters. * Malformed inputs (including truncated bare-hash sequences) now return parse errors instead of failing. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Avery Townsend <avery@boundaryml.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…L#3867) on BoundaryML#4000 (BoundaryML#4011) Re-lands BoundaryML#3867 (reverted in BoundaryML#4002 to let BoundaryML#4000 land first) as a revert-of-revert on top of BoundaryML#4000, following the re-land guidance agreed in BoundaryML#4002. ## Byte-for-byte re-land The classification engine is unchanged from what BoundaryML#3867 shipped: the span-keyed resolution index, the CST classification walk, interface-member resolution, the contextual-keyword re-lexing (`as`/`type`/`true`/`false`/`null`), all 78 semantic-token fixtures, and the `tools_semantic_tokens` viewer. ## Adapted to BoundaryML#4000 (LSP boundary only) - **Negotiated encoding**: `encode_semantic_tokens` now encodes through the connection's `PositionCodec` — `delta_start`/`length` are negotiated code units (UTF-16 default, surrogate pairs handled), and multiline tokens split into per-line segments. This also fixes the byte-length miscount for non-ASCII identifiers that BoundaryML#3867 originally shipped (called out in BoundaryML#4002). - **Request idiom**: `semanticTokens/full`, `full/delta`, and `range` use `encoding_for_request` + `read_for_request` — bounded gate with ambient cancellation observed at entry / post-gate / completion — instead of `try_lock_db`. - **Connection-scoped delta cache**: `semantic_tokens_cache` is now per-connection (fresh in `connection_scoped_lsp_session`, next to the encoding negotiation), so concurrent clients can't cross-serve wrongly-encoded tokens or trample each other's `previous_result_id`. The `result_id` sequence stays process-global. - **`returns(ref)`**: the tracked `semantic_tokens` query keeps BoundaryML#4000's `returns(ref)` + `salsa::Update`, avoiding an O(tokens) clone per request. **Not re-landed**: BoundaryML#4002's incidental `pnpm-lock.yaml` refresh (fiddle-proxy entries for an untracked package) — unrelated to BoundaryML#3867 on both sides; the diff is strictly `baml_language/`-scoped. ## New tests - Negotiated-encoding token encoding: UTF-16 vs UTF-8 lengths, astral-plane surrogate pairs, multiline segment splitting (`request.rs`). - Connection-scoped token-cache freshness asserted in the session-scoping test (`mod.rs`). ## Validation - Full suite: 7486/7486 (nextest) + `baml_src baml_test` 2057/2057 standalone. - `bex_project` 52/52 incl. the new encoding + session tests. - clippy clean (workspace, all targets), `cargo check --target wasm32-unknown-unknown -p bex_project` clean. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added richer, type-aware semantic highlighting, including booleans, escape sequences, declarations, properties, methods, enum members, and library symbols. - Added range-based and delta semantic-token updates for faster editor refreshes. - Added a local semantic-token viewer with fixture comparison, scratchpad editing, token inspection, and snapshot acceptance. - Improved navigation to interface fields and methods, including aliased members. - **Bug Fixes** - Improved type information and completion support for destructuring and catch bindings. - Corrected contextual keyword and literal parsing, formatting, and highlighting. - Improved hover results for caught values. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Clean revert of a05ec5a (#3867, "resolution-first semantic tokens rework"), coordinated with @codeshaunted.
Why
#3867 merged ~30 minutes after #4000 (the LSP mutex/latency fix: position-encoding negotiation, connection-scoped sessions, bounded ingress) opened, and the two rework the same LSP boundary. Landing order matters: #4000 is the infrastructure #3867's feature should sit on. Integrating #3867 inside #4000's merge would mean rewriting its encoder and cache inside a merge commit — worse for review and for feature ownership. Reverting and re-landing on top is cleaner for everyone.
The revert also removes a live encoding issue from canary until the re-land:
encode_semantic_tokenscurrently emits fixed-encoding positions (LineIndex) and byte lengths, which miscounts any non-ASCII identifier under the LSP-default UTF-16.Re-land guidance (agreed with Avery)
The classification engine (resolution index, CST walk,
tools_semantic_tokensvisualizer) re-lands byte-for-byte. Only the LSP boundary adapts:PositionCodec(available at every handler after fix(lsp): resolve the 0.14 mutex/latency regression — Phase 0 containment + Phase 1 bounded ingress #4000) instead ofLineIndex+ byte lengths.semantic_tokens_cacheinto connection-scoped session state — sessions are per-connection with per-connection encodings after fix(lsp): resolve the 0.14 mutex/latency regression — Phase 0 containment + Phase 1 bounded ingress #4000, so a process-global cache would cross-serve wrongly-encoded tokens and trample delta baselines. The atomic result-id sequence can stay global.returns(ref)instead ofreturns(clone)on the tracked query to avoid an O(tokens) clone per request;handle_request_with_cancellationfor the new handlers.Sequence
🤖 Generated with Claude Code
https://claude.ai/code/session_01VEMxti5WQ8bCgJUuX9AQvo
Summary by CodeRabbit
New Features
dynamic,with, andthrowssyntax.Bug Fixes
asandtype.Breaking Changes