Skip to content

Conversation

@NobbZ
Copy link
Owner

@NobbZ NobbZ commented Jun 18, 2025

Summary by CodeRabbit

  • New Features

    • Added new snippet sets for Elixir and Lua, enabling quick insertion of common function and module templates with interactive placeholders.
    • Introduced UI and keybindings for cycling through and selecting choices within active snippet nodes for enhanced snippet editing.
  • Improvements

    • Changed snippet expansion keybinding to Ctrl+e, restricted to insert and select modes for better workflow.
    • Updated git commit snippet navigation to jump directly to the final input field after the first.
    • Enhanced snippet expansion and jump behavior by integrating snippet state with completion popup visibility for smoother editing.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 18, 2025

## Walkthrough

This update changes the keybinding for snippet expansion and restricts its active modes, adjusts the tabstop navigation in a git commit snippet, introduces a new Gleam language snippet for external function declarations, adds new Elixir and Lua snippet modules, and enhances snippet expansion and jump logic integration within the blink plugin.

## Changes

| File(s)                                               | Change Summary                                                                                                         |
|------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| plugins/nobbz/lua/nobbz/luasnip.lua                  | Changed snippet expand keybinding from Ctrl+k to Ctrl+e; restricted keybinding to insert and select modes; added Ctrl+j and Ctrl+Shift+j for choice cycling and selection. |
| plugins/nobbz/lua/nobbz/luasnip/gitcommit.lua        | Modified snippet to use `i(0)` instead of `i(2)` for the final insert node, altering tabstop flow.                     |
| plugins/nobbz/lua/nobbz/luasnip/gleam.lua            | Added a new snippet for Gleam: "external" function declaration with interactive parameters and choices.                 |
| plugins/nobbz/lua/nobbz/luasnip/elixir.lua           | Added new Elixir snippet module with three snippets for public/private function definitions and debug pipe operator.    |
| plugins/nobbz/lua/nobbz/luasnip/lua.lua              | Added new Lua snippet module with three snippets for standalone functions, module functions, and module templates.       |
| plugins/nobbz/lua/nobbz/blink.lua                     | Added `is_hidden_snippet()` helper; extended blink snippet setup with `expand` and `jump` functions integrating luasnip expansion and jump logic. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant User
    participant LuasnipPlugin
    participant GleamSnippet
    participant ElixirSnippet
    participant LuaSnippet
    participant BlinkPlugin

    User->>LuasnipPlugin: Presses Ctrl+e in insert/select mode
    LuasnipPlugin->>LuasnipPlugin: Expand snippet

    User->>LuasnipPlugin: Types "external" in Gleam file
    LuasnipPlugin->>GleamSnippet: Trigger "external" snippet
    GleamSnippet-->>User: Insert external function template with choices and placeholders

    User->>LuasnipPlugin: Types Elixir snippet triggers ("def:", "defp:", ">d")
    LuasnipPlugin->>ElixirSnippet: Trigger Elixir snippets
    ElixirSnippet-->>User: Insert Elixir function or debug pipe snippet

    User->>LuasnipPlugin: Types Lua snippet triggers ("fn", "fnM", "mod")
    LuasnipPlugin->>LuaSnippet: Trigger Lua snippets
    LuaSnippet-->>User: Insert Lua function or module snippet

    User->>BlinkPlugin: Request snippet expand or jump
    BlinkPlugin->>LuasnipPlugin: Call expand or jump based on snippet and completion state

Possibly related PRs

  • do some blink #31: Adds snippet preset configuration and changes preselection in blink.lua, related to snippet handling but focusing on different aspects.

Poem

A hop and a skip, a snippet anew,
Ctrl+e now brings code right to you!
Gleam, Elixir, Lua join the fun,
Snippets expanding, one by one.
Blink jumps in with logic so bright—
Rabbits code deep into the night!
🐇✨


<!-- walkthrough_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEejqANiS5EraZpEQZ43biVyQAZvj4kAHjQUGGgWiAYActjMApRcAOwAjAYAqoixkOGCAgBaRvrG4FBk9PieOATEZMo09Eys7Fy8/MKi4lIy8kxKVKrqWjr5JlBwqKiY5YSk5FQ1CvUYnJBUAO6OUcxoFPJyCt0qapraumCGBaYG3BbYRPAYiAD0GFkAXvdXaI8vb9hoTi4a7w4BgARKCDABicGQACCAElKtNqHQ1qxNvJSoxYJhSGEDHASI5nK53JB/NxMIh4PgsABrEiyNQYWi3IiQZa/THY5GeCgsSAAYVwFAsAGoaZAABTA4D8sA0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B/WgOmWgPi3igQEy/y7ygSzwBITwWgB/IcZSumOIAQBgNSzwOmB/Xi2K6yky9SmSh/JK7iumEgUSlmBIPihINyhgXi7iiSzwcSuIUykyuXFmWgDygQPiyyqyiAaGOihincJi2qEMWgTDN8fQIAA== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

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.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=NobbZ/nobbz-vim&utm_content=71):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai explain this code block.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and explain its main purpose.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai generate sequence diagram` to generate a sequence diagram of the changes in this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@NobbZ NobbZ requested a review from Copilot June 18, 2025 20:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new Gleam snippet for externals, updates the Git commit snippet to position the cursor at the end, and remaps the snippet expansion keybinding to Ctrl+e in insert/select modes.

  • Introduce external snippet in Gleam with language, module, function, args, and return placeholders
  • Change Git commit snippet’s final tabstop to 0 for end-of-line cursor placement
  • Update snippet expansion hotkey to <C-e> limited to insert and select modes

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
plugins/nobbz/lua/nobbz/luasnip/gleam.lua New external snippet definition for Gleam
plugins/nobbz/lua/nobbz/luasnip/gitcommit.lua Adjusted Git‐commit snippet final placeholder
plugins/nobbz/lua/nobbz/luasnip.lua Remapped expand key to <C-e> with mode options
Comments suppressed due to low confidence (3)

plugins/nobbz/lua/nobbz/luasnip/gleam.lua:9

  • [nitpick] The placeholder label "function" may be confused with the reserved keyword. Rename it to "function_name" or similar for clarity.
      i(3, "function"),

plugins/nobbz/lua/nobbz/luasnip/gleam.lua:1

  • Consider adding unit tests or snippet validation to ensure the external snippet expands correctly across the supported languages and argument scenarios.
return {

plugins/nobbz/lua/nobbz/luasnip/gitcommit.lua:5

  • Please update the plugin's README or changelog to document that the final cursor position is now handled by a 0 tabstop in this snippet.
    { t("[SC-"), i(1), t("]"), i(0), }),


WK.add({
{ "<C-k>", luasnip.expand, desc = "expand snippet", },
{ "<C-e>", luasnip.expand, desc = "expand snippet", mode = { "i", "s", }, },
Copy link

Copilot AI Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The trailing comma in the mode table is valid Lua but may not align with the project's style guide—consider removing it if unnecessary.

Suggested change
{ "<C-e>", luasnip.expand, desc = "expand snippet", mode = { "i", "s", }, },
{ "<C-e>", luasnip.expand, desc = "expand snippet", mode = { "i", "s" }, },

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
plugins/nobbz/lua/nobbz/blink.lua (1)

6-9: Optimize module usage - avoid redundant require.

The function re-requires luasnip on line 7 even though it's already available as the luasnip variable from line 2. This is inefficient and unnecessary.

Apply this diff to use the existing module reference:

 local function is_hidden_snippet()
-  local ls = require("luasnip")
-  return not require("blink.cmp").is_visible() and not ls.in_snippet() and ls.expandable()
+  return not require("blink.cmp").is_visible() and not luasnip.in_snippet() and luasnip.expandable()
 end
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9988e9c and ac37f9d.

📒 Files selected for processing (1)
  • plugins/nobbz/lua/nobbz/blink.lua (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`plugins/**/*.lua`: Please ensure all of the following: - Plugins are lazyloaded if possible through `nobbz.lazy` - `local` has to be used - coding follows the [luarocks styleguide...

plugins/**/*.lua: Please ensure all of the following:

  • Plugins are lazyloaded if possible through nobbz.lazy
  • local has to be used
  • coding follows the luarocks styleguide, but with 2 spaces indentation
  • plugins/nobbz/lua/nobbz/blink.lua
🔇 Additional comments (2)
plugins/nobbz/lua/nobbz/blink.lua (2)

22-22: LGTM: Clean snippet expansion implementation.

The expand function correctly delegates to luasnip.lsp_expand for snippet expansion.


23-26: LGTM: Well-structured conditional jump logic.

The jump function implements sound logic:

  • Uses the helper function to determine when to expand or jump
  • Falls back to directional jumping when appropriate
  • Properly handles the return value from luasnip.jumpable()

The integration with the blink completion plugin state through is_hidden_snippet() is well thought out.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
plugins/nobbz/lua/nobbz/luasnip/elixir.lua (1)

6-7: Remove unnecessary fmt usage for static strings.

The fmt function is not needed when there are no placeholders to format.

   s({ trig = ">d", name = "pipe debug", desc = "pipe into debug", },
-    fmt("|> dbg()")),
+    t("|> dbg()")),

Note: You'll also need to import t (text node) with the other imports:

 local ls = require("luasnip")
 local s = ls.snippet
 local i = ls.insert_node
+local t = ls.text_node
 local fmt = require("luasnip.extras.fmt").fmt
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 72ab73d and 475d733.

📒 Files selected for processing (3)
  • plugins/nobbz/lua/nobbz/luasnip.lua (1 hunks)
  • plugins/nobbz/lua/nobbz/luasnip/elixir.lua (1 hunks)
  • plugins/nobbz/lua/nobbz/luasnip/lua.lua (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins/nobbz/lua/nobbz/luasnip.lua
🧰 Additional context used
📓 Path-based instructions (1)
`plugins/**/*.lua`: Please ensure all of the following: - Plugins are lazyloaded if possible through `nobbz.lazy` - `local` has to be used - coding follows the [luarocks styleguide...

plugins/**/*.lua: Please ensure all of the following:

  • Plugins are lazyloaded if possible through nobbz.lazy
  • local has to be used
  • coding follows the luarocks styleguide, but with 2 spaces indentation
  • plugins/nobbz/lua/nobbz/luasnip/lua.lua
  • plugins/nobbz/lua/nobbz/luasnip/elixir.lua
🔇 Additional comments (2)
plugins/nobbz/lua/nobbz/luasnip/lua.lua (1)

17-23: Well-structured snippet definitions.

The snippet definitions follow good practices with descriptive triggers, names, and descriptions. The template formatting and placeholder usage look correct for LuaSnip.

plugins/nobbz/lua/nobbz/luasnip/elixir.lua (1)

2-5: Well-crafted Elixir function snippets.

The snippet definitions for def: and defp: are well-structured with appropriate placeholders for function names, arguments, and bodies. The triggers are intuitive for Elixir developers.

Comment on lines +1 to +23
local fun_string = [[function {}({})
{}
end]]

local module_string = [[local M = {{}}

function M.{}({})
{}
end

return M]]

local module_fun_string = [[function M.{}({})
{}
end]]

return {
s({ trig = "fn", name = "function", desc = "function definition", }, fmt(fun_string, { i(1, "name"), i(2), i(0), })),
s({ trig = "fnM", name = "module function", desc = "function definition in module", },
fmt(module_fun_string, { i(1, "name"), i(2), i(0), })),
s({ trig = "mod", name = "module", desc = "module definition", },
fmt(module_string, { i(1, "name"), i(2, "func"), i(3), i(0), })),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing imports for LuaSnip functions.

The code uses s, fmt, and i functions but doesn't import them. These appear to be LuaSnip functions that need to be imported at the top of the file.

Add the missing imports at the beginning of the file:

+local ls = require("luasnip")
+local s = ls.snippet
+local i = ls.insert_node
+local fmt = require("luasnip.extras.fmt").fmt
+
 local fun_string = [[function {}({})
   {}
 end]]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
local fun_string = [[function {}({})
{}
end]]
local module_string = [[local M = {{}}
function M.{}({})
{}
end
return M]]
local module_fun_string = [[function M.{}({})
{}
end]]
return {
s({ trig = "fn", name = "function", desc = "function definition", }, fmt(fun_string, { i(1, "name"), i(2), i(0), })),
s({ trig = "fnM", name = "module function", desc = "function definition in module", },
fmt(module_fun_string, { i(1, "name"), i(2), i(0), })),
s({ trig = "mod", name = "module", desc = "module definition", },
fmt(module_string, { i(1, "name"), i(2, "func"), i(3), i(0), })),
}
local ls = require("luasnip")
local s = ls.snippet
local i = ls.insert_node
local fmt = require("luasnip.extras.fmt").fmt
local fun_string = [[function {}({})
{}
end]]
local module_string = [[local M = {{}}
function M.{} ({})
{}
end
return M]]
local module_fun_string = [[function M.{}({})
{}
end]]
return {
s({ trig = "fn", name = "function", desc = "function definition" }, fmt(fun_string, { i(1, "name"), i(2), i(0) })),
s({ trig = "fnM", name = "module function", desc = "function definition in module" }, fmt(module_fun_string, { i(1, "name"), i(2), i(0) })),
s({ trig = "mod", name = "module", desc = "module definition" }, fmt(module_string, { i(1, "name"), i(2, "func"), i(3), i(0) })),
}
🤖 Prompt for AI Agents
In plugins/nobbz/lua/nobbz/luasnip/lua.lua lines 1 to 23, the LuaSnip functions
s, fmt, and i are used but not imported. Add the required local imports for
these functions at the top of the file by requiring them from the LuaSnip module
to ensure they are defined before use.

Comment on lines +1 to +8
return {
s({ trig = "def:", name = "def oneliner", desc = "one line function definition", },
fmt("def {}({}), do: {}", { i(1, "name"), i(2, "args"), i(0, "body"), })),
s({ trig = "defp:", name = "defp oneliner", desc = "one line private function definition", },
fmt("defp {}({}), do: {}", { i(1, "name"), i(2, "args"), i(0, "body"), })),
s({ trig = ">d", name = "pipe debug", desc = "pipe into debug", },
fmt("|> dbg()")),
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add missing imports for LuaSnip functions.

The code uses s, fmt, and i functions but doesn't import them. These are LuaSnip functions that need to be imported.

Add the missing imports at the beginning of the file:

+local ls = require("luasnip")
+local s = ls.snippet
+local i = ls.insert_node
+local fmt = require("luasnip.extras.fmt").fmt
+
 return {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return {
s({ trig = "def:", name = "def oneliner", desc = "one line function definition", },
fmt("def {}({}), do: {}", { i(1, "name"), i(2, "args"), i(0, "body"), })),
s({ trig = "defp:", name = "defp oneliner", desc = "one line private function definition", },
fmt("defp {}({}), do: {}", { i(1, "name"), i(2, "args"), i(0, "body"), })),
s({ trig = ">d", name = "pipe debug", desc = "pipe into debug", },
fmt("|> dbg()")),
}
local ls = require("luasnip")
local s = ls.snippet
local i = ls.insert_node
local fmt = require("luasnip.extras.fmt").fmt
return {
s({ trig = "def:", name = "def oneliner", desc = "one line function definition", },
fmt("def {}({}), do: {}", { i(1, "name"), i(2, "args"), i(0, "body"), })),
s({ trig = "defp:", name = "defp oneliner", desc = "one line private function definition", },
fmt("defp {}({}), do: {}", { i(1, "name"), i(2, "args"), i(0, "body"), })),
s({ trig = ">d", name = "pipe debug", desc = "pipe into debug", },
fmt("|> dbg()")),
}
🤖 Prompt for AI Agents
In plugins/nobbz/lua/nobbz/luasnip/elixir.lua at lines 1 to 8, the functions s,
fmt, and i from LuaSnip are used but not imported. To fix this, add the required
local imports for these functions at the top of the file by requiring them from
the LuaSnip module, ensuring s, fmt, and i are properly defined before usage.

@NobbZ NobbZ merged commit 98e9184 into main Jun 20, 2025
3 checks passed
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.

2 participants