Replies: 1 comment
-
|
This issue has been recently taken up by @Yharooer in #896 . While I appreciate the extension of the language server low-level API, adding three new tools is a major extension and one has to bear in mind all additional cost (in tokens, logic and maintenance) that comes with it. Before merging any such extension, the problem that it solves and the evidence that it actually solves it has to be provided. We will be enriching symbol information with hover documentation (will be committed soon), which has overlapping functionality. The original issue proposed by @YuMuuu could be solved by prompting, not necessarily by new tools |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Thank you very much for creating and maintaining serena.
I use it extensively for both personal and work-related projects and really appreciate the effort behind it.
I would like to share an idea for a potential improvement related to code implementation tasks.
This is a relatively large idea, so I understand it may not be something to implement immediately.
Background
Currently, serena makes very good use of LSP-based tools for code investigation, such as:
find_symbolfind_referencing_symbolsget_symbols_overviewThese tools help reduce token usage while still allowing the model to understand the code structure.
However, when looking at how actual code modifications are performed, I often observe that
LSP-aware editing tools like:
insert_after_symbolinsert_before_symbolinsert_at_linereplace_symbol_bodyare not used very often. Instead,
replace_regexis frequently used multiple times in a rather coarse way to modify code.Motivation
When human engineers write code, they usually rely heavily on IDE/LSP features such as:
Code completion
Type and parameter hints (InlayHints)
Symbol information (Hover)
These features strongly influence how code is written and help prevent mistakes.
In the current LLM + serena setup, these "code-writing assistance" capabilities are not exposed as tools.
As a result, the LLM sometimes behaves like a clever beginner engineer who keeps rewriting code
until it works, rather than using structured, context-aware assistance.
Proposal
I would like to propose exposing the following LSP APIs as serena tools:
CompletionInlayHintsHoverAdditionally, providing templates or prompts that actively encourage the use of these tools could help
the LLM generate code in a more human-like, IDE-assisted way.
I believe this could reduce over-reliance on
replace_regexand lead to more precise and maintainable code edits.I would be very interested to hear your thoughts on this idea.
Beta Was this translation helpful? Give feedback.
All reactions