From 5fa76563147b746965ef9e51bca87da287014be5 Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Sun, 25 Sep 2022 03:09:54 +0200 Subject: [PATCH] update snippets --- src/data/snippets.zig | 24 +++++++++++++++++------- tests/tests.zig | 1 - 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/data/snippets.zig b/src/data/snippets.zig index 1b2d8f9..d04150b 100644 --- a/src/data/snippets.zig +++ b/src/data/snippets.zig @@ -9,12 +9,13 @@ pub const Snipped = struct { pub const top_level_decl_data = [_]Snipped{ .{ .label = "fn", .kind = .Snippet, .text = "fn ${1:name}($2) ${3:!void} {$0}" }, .{ .label = "pub fn", .kind = .Snippet, .text = "pub fn ${1:name}($2) ${3:!void} {$0}" }, - .{ .label = "struct", .kind = .Snippet, .text = "const $1 = struct {$0}" }, - .{ .label = "error set", .kind = .Snippet, .text = "const ${1:Error} = error {$0}" }, - .{ .label = "enum", .kind = .Snippet, .text = "const $1 = enum {$0}" }, - .{ .label = "union", .kind = .Snippet, .text = "const $1 = union {$0}" }, - .{ .label = "union tagged", .kind = .Snippet, .text = "const $1 = union(${2:enum}) {$0}" }, + .{ .label = "struct", .kind = .Snippet, .text = "const $1 = struct {$0};" }, + .{ .label = "error set", .kind = .Snippet, .text = "const ${1:Error} = error {$0};" }, + .{ .label = "enum", .kind = .Snippet, .text = "const $1 = enum {$0};" }, + .{ .label = "union", .kind = .Snippet, .text = "const $1 = union {$0};" }, + .{ .label = "union tagged", .kind = .Snippet, .text = "const $1 = union(${2:enum}) {$0};" }, .{ .label = "test", .kind = .Snippet, .text = "test \"$1\" {$0}" }, + .{ .label = "main", .kind = .Snippet, .text = "pub fn main() !void {$0}" }, }; pub const generic = [_]Snipped{ @@ -55,7 +56,7 @@ pub const generic = [_]Snipped{ .{ .label = "resume", .kind = .Keyword }, .{ .label = "return", .kind = .Keyword }, .{ .label = "linksection", .kind = .Keyword }, - .{ .label = "struct", .kind = .Keyword, .text = "struct {$0}" }, + .{ .label = "struct", .kind = .Keyword, .text = "struct {$0};" }, .{ .label = "suspend", .kind = .Keyword }, .{ .label = "switch", .kind = .Keyword, .text = "switch ($1) {$0}" }, .{ .label = "test", .kind = .Keyword, .text = "test \"$1\" {$0}" }, @@ -75,5 +76,14 @@ pub const generic = [_]Snipped{ .{ .label = "fori", .kind = .Snippet, .text = "for ($1) |_, ${2:i}| {$0}" }, .{ .label = "forvi", .kind = .Snippet, .text = "for ($1) |${2:value},${3:i}| {$0}" }, .{ .label = "if else", .kind = .Snippet, .text = "if ($1) {$2} else {$0}" }, - .{ .label = "catch switch", .kind = .Snippet, .text = "catch |${1:err}| switch(${1:err}) {$0}" }, + .{ .label = "catch switch", .kind = .Snippet, .text = "catch |${1:err}| switch(${1:err}) {$0};" }, + + // snippets + .{ .label = "main", .kind = .Snippet, .text = "pub fn main() !void {$0}" }, + .{ .label = "todo", .kind = .Snippet, .text = "std.debug.todo(\"$0\");" }, + .{ .label = "print", .kind = .Snippet, .text = "std.debug.print(\"$1\", .{$0});" }, + .{ .label = "log err", .kind = .Snippet, .text = "std.log.err(\"$1\", .{$0});" }, + .{ .label = "log warn", .kind = .Snippet, .text = "std.log.warn(\"$1\", .{$0});" }, + .{ .label = "log info", .kind = .Snippet, .text = "std.log.info(\"$1\", .{$0});" }, + .{ .label = "log debug", .kind = .Snippet, .text = "std.log.debug(\"$1\", .{$0});" }, }; diff --git a/tests/tests.zig b/tests/tests.zig index 6848c0a..3f85a87 100644 --- a/tests/tests.zig +++ b/tests/tests.zig @@ -1,6 +1,5 @@ comptime { _ = @import("helper.zig"); - _ = @import("sessions.zig"); _ = @import("utility/offsets.zig"); _ = @import("utility/position_context.zig");