Files
lucioandClaude Fable 5 e9b7510ca4 Templates 0.4.0: context-gated statement/item snippet completion
A template tier between index names and keywords: if / if-else / else-if
(gated on the line head, so it appears after end but not after an
identifier), case and casez with default, loops, always_ff (plain and
reset variants), always_comb, always @(...), initial, and declaration
templates - logic/localparam/parameter in .sv, wire/reg/integer twins in
.v; pathless buffers get the conservative Verilog set. One renderer
spells each body as snippet and plain text so the two cannot drift, and a
registry-wide test parses every untouched expansion. Nine overlapping
static VS Code snippets moved server-side; file-level ones stay static.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-08-24 17:28:31 -07:00

82 lines
1.8 KiB
JSON

{
"Module": {
"prefix": "module",
"body": [
"module ${1:name} (",
" input wire ${2:clk},",
" input wire ${3:rst_n}$4",
");",
" $0",
"endmodule"
],
"description": "Module with a port list"
},
"Function": {
"prefix": "function",
"body": [
"function ${1:[7:0]} ${2:name}(input ${3:[7:0]} ${4:arg});",
" begin",
" $2 = ${5:$4};",
" end",
"endfunction"
],
"description": "Function declaration"
},
"Task": {
"prefix": "task",
"body": [
"task ${1:name}(input ${2:[7:0]} ${3:arg});",
" begin",
" $0",
" end",
"endtask"
],
"description": "Task declaration"
},
"Generate for": {
"prefix": "genfor",
"body": [
"genvar ${1:i};",
"generate",
" for ($1 = 0; $1 < ${2:N}; $1 = $1 + 1) begin : ${3:gen_$1}",
" $0",
" end",
"endgenerate"
],
"description": "Generate for loop with a named block"
},
"Testbench skeleton": {
"prefix": "tb",
"body": [
"module ${1:${TM_FILENAME_BASE}};",
" reg clk = 1'b0;",
" reg rst_n;",
"",
" always #${2:5} clk = ~clk;",
"",
" initial begin",
" rst_n = 1'b0;",
" repeat (2) @(posedge clk);",
" rst_n = 1'b1;",
" $0",
" \\$display(\"${3:done}\");",
" \\$finish;",
" end",
"endmodule"
],
"description": "Testbench with clock and reset"
},
"Include guard": {
"prefix": "guard",
"body": [
"`ifndef ${1:${TM_FILENAME_BASE/(.*)/${1:/upcase}/}_VH}",
"`define $1",
"",
"$0",
"",
"`endif // $1"
],
"description": "ifndef/define include guard from the file name"
}
}