builder icon indicating copy to clipboard operation
builder copied to clipboard

Enhance AI Description generation with LSP-based intelligent code extraction

Open aofei opened this issue 3 months ago • 0 comments

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/documentSymbol to 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

aofei avatar Sep 19 '25 07:09 aofei