-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(agent): normalize indentation in code completion postprocess #3361
fix(agent): normalize indentation in code completion postprocess #3361
Conversation
Follow up: This is kind of a post-processing filter to prevent inconsistent extra spaces due to different model capabilities. The above bad example happens when using the demo website model, but sometimes works fine with StarCoder-1B without this modification. |
clients/tabby-agent/src/codeCompletion/postprocess/normalizeIndentation.test.ts
Show resolved
Hide resolved
As all bad cases in #3263 have exactly one extra space in the line indent, I suggest we should only process the case of exactly one extra space in the line indent, not extra indent.
and the completion is
|
The current version should work fine with this. |
@sboys3 I am very sorry for causing this problem, I will fix the bug caused by this PR as quickly as possible |
#3263
Fixing wrong indent in inline completion predict solution
Demo
Screen.Recording.2024-11-15.at.09.24.21.mov
Before
Only first line has extra spaces:

exactly one extra space in the line indent

After
exactly one extra space in the line indent
Implementation
Using whether the current indent is even as the judgment basis. If it's even, the prediction doesn't need any extra spaces and the prediction context will be processed accordingly.
Potential risks:
Some users might use odd indent size
Why
This approach is simple and doesn't require adding additional LSP or obtaining the best indent through client operations.
Issue didn't fix
Due to some concern this post-processing not going to fix this situation
All lines in prediction have extra spaces:
