Skip to content

feat(completion): smart paren detection to avoid duplicate parens#415

Open
16bit-ykiko wants to merge 2 commits intomainfrom
feat/completion-smart-parens
Open

feat(completion): smart paren detection to avoid duplicate parens#415
16bit-ykiko wants to merge 2 commits intomainfrom
feat/completion-smart-parens

Conversation

@16bit-ykiko
Copy link
Copy Markdown
Member

Summary

  • When the next non-whitespace character after the cursor is already (, skip inserting parentheses and parameter placeholders in the snippet
  • Prevents duplicate parens when completing a function name that already has arguments: fo|(args) → inserts just foooo, not foooo(${1:...})
  • Uses the original file content for lookahead (not Clang's internal buffer which may be modified during completion)

Test plan

  • SmartParensSkip — next char is (, no parens inserted
  • SmartParensInsert — next char is ;, parens inserted normally
  • All 496 unit tests pass
  • pixi run format clean

Stacked on #412.

🤖 Generated with Claude Code

16bit-ykiko and others added 2 commits April 9, 2026 16:09
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>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 10208449-8e36-4975-b71f-24dadb52dcb3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/completion-smart-parens

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Base automatically changed from feat/completion-snippets to main April 9, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant