-
Notifications
You must be signed in to change notification settings - Fork 308
Implement baml language server code completions #2581
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
base: canary
Are you sure you want to change the base?
Implement baml language server code completions #2581
Conversation
Co-authored-by: aaron <[email protected]>
Cursor Agent can help with this pull request. Just |
The latest updates on your projects. Learn more about Vercel for GitHub.
|
get_symbol_before_position(&doc.contents, &prev_pos) | ||
} else { | ||
String::new() | ||
}; |
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.
Bug: Block Attribute Detection Logic Error
The logic for detecting @@
block attributes is flawed. When prev
is identified as @
, the subsequent check for a second @
uses get_symbol_before_position
on a position one character back from the cursor. This effectively checks two positions back from the cursor, which may incorrectly identify or miss the @@
pattern.
🌿 Preview your docs: https://boundary-preview-d74e1fd7-4b58-4240-8d97-cce56a7bb652.docs.buildwithfern.com |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Add context-aware code completions to the BAML language server for attributes, prompt helpers, keywords, and IR symbols.
Slack Thread
Note
Adds LSP completion logic for attributes, prompt helpers, keywords, and IR-derived symbols, plus a basic completion test and resilient logging init.
engine/language_server/src/server/api/requests/completion.rs
.get_word_at_position
andget_symbol_before_position
(attributes@
/@@
,_.role(
,ctx.
/ctx.client.
, top-level).@alias
,@stream.*
,@@dynamic
, etc.), prompt helpers (_.role("system"|"user"|"assistant")
,ctx.output_format
,ctx.client.*
), top-level keywords (function
,class
,enum
,client
,generator
,retry_policy
,template_string
,type
), and IR symbols (functions/classes/enums/type aliases) via runtime.CompletionResponse::List
withCompletionItemKind
and minimal details; add helper builders.test_basic_attribute_completion
inengine/language_server/src/tests.rs
validating@alias
suggestion.engine/language_server/src/logging.rs
, avoid panic if global subscriber already set; print warning and continue.docs/lsp-completions-design.md
outlining goals, approach, examples, and testing.Written by Cursor Bugbot for commit 6672932. This will update automatically on new commits. Configure here.