Skip to content

Commit 9d06ca5

Browse files
committed
feat(cpp)!: pvf can only be expanded in class declaration now
1 parent 3d2f175 commit 9d06ca5

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ Snippets with `*` are available only when `vim_snippet` is enabled.
151151
| `cpo` | Expands to customize point object. | No | | |
152152
| `ns%s(%S+)` | Expands to namespace block (including comments). | No | | |
153153
| `itf` | Expands to a struct with default virtual destruction. | No | | |
154-
| `pvf` | Expands to a pure virtual function declaration. | No | | |
154+
| `pvf` | Expands to a pure virtual function declaration. | In Class | | |
155155
| `qcls` | Expands to a class inherts from QObject. | No | Yes | |
156156
| `#if` | Wrap selected code in `#if ... #endif` block. | After cut selection | No | |
157157
| `if` | Wrap selected code in `if (...)` block. | After cut selection | No | |

lua/luasnip-snippets/snippets/cpp/lambda_fn.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ local f = ls.function_node
1515
---@field CPP_CLASS_BODY_START { [1]: number, [2]: number }?
1616
---@field CPP_IN_HEADER_FILE boolean
1717
---@field CPP_IN_QUALIFIED_FUNCTION boolean
18+
---@field LS_SELECT_RAW? string[]
1819

1920
---Returns if the node's declarator is qualified or not.
2021
---@param node TSNode? `function_definition` node

lua/luasnip-snippets/snippets/cpp/statements.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ return {
164164
name = "Pure virtual function",
165165
dscr = "Declare pure virtual function",
166166
mode = "bw",
167+
resolveExpandParams = inject_class_name,
167168
nodes = fmta("virtual <ret_t> <name>(<args>) <specifier> = 0;", {
168169
name = i(1, "func", { dscr = "Function name" }),
169170
args = i(2, "args", { dscr = "Function arguments" }),

0 commit comments

Comments
 (0)