builder
builder copied to clipboard
Enhance AI Description generation with LSP-based intelligent code extraction
Description
In #2242, we implemented a truncation strategy to keep AI Description payloads within backend limits. While this works, it uses simple character-based truncation which may cut off important context.
We could leverage Language Server Protocol (LSP) capabilities to intelligently extract key information from .spx source files instead of raw truncation. This means extracting func signatures, comments, type definitions while omitting implementation details. This would allow us to include more sprites in the LLM context and preserve semantic completeness.
Possible solutions
- Use standard LSP methods like
textDocument/documentSymbolto get code structure - Extract comments and docs while omitting implementation details
- Build concise code representations focusing on API surface rather than implementation
- Prioritize func signatures, event handlers, and type definitions over code logic