feat(completion): smart paren detection to avoid duplicate parens#415
Open
16bit-ykiko wants to merge 2 commits intomainfrom
Open
feat(completion): smart paren detection to avoid duplicate parens#41516bit-ykiko wants to merge 2 commits intomainfrom
16bit-ykiko wants to merge 2 commits intomainfrom
Conversation
Generate LSP snippet placeholders (${1:param}, ${2:param}) for function
and method completions in non-bundle mode when
enable_function_arguments_snippet is enabled.
- New build_snippet() extracts CK_Placeholder chunks from Clang's
CodeCompletionString into ${N:text} format
- No-arg functions produce no snippet (plain text insertion)
- Bundle mode is unaffected (snippets only for individual overloads)
- Optional chunks (default arguments) are skipped in snippet generation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the next non-whitespace character after the cursor is already '(',
skip inserting parentheses and parameter placeholders in the snippet.
This prevents duplicate parens when completing a function name that
already has arguments written after it.
Uses the original file content (not Clang's internal buffer) for
lookahead to correctly detect the next token.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
(, skip inserting parentheses and parameter placeholders in the snippetfo|(args)→ inserts justfoooo, notfoooo(${1:...})Test plan
SmartParensSkip— next char is(, no parens insertedSmartParensInsert— next char is;, parens inserted normallypixi run formatcleanStacked on #412.
🤖 Generated with Claude Code