Skip to content
This repository was archived by the owner on Dec 8, 2023. It is now read-only.

Commit 829176e

Browse files
authored
Merge pull request #20 from MarioAriasC/0.0.7
0.0.7
2 parents 6d7d6c6 + bddaf1b commit 829176e

File tree

5 files changed

+80
-18
lines changed

5 files changed

+80
-18
lines changed

CHANGELOG.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,28 @@
33
# zig-support Changelog
44

55
## [Unreleased]
6-
6+
### Added
7+
- More Live Templates for Zig:
8+
- `St` -> `[]const u8`
9+
- `tst` -> Creates a test: `test "" {}`
10+
- `csd` -> Constant `Self` declaration: `const Self = @This();`
11+
- `ced` -> Enum
12+
- `cstd` -> Struct
13+
- `fn0` -> Function without parameters
14+
- `fn1` -> Function with one parameter
15+
- `fn2` -> Function with two parameters
16+
- Support for the new IDEA platform version 2022.2
717
## [0.0.6]
8-
### Added
9-
- Improved parser: 100% of the language is parsed correctly.
10-
- Insert closing pair match for `(`, `{`, `[` and `"`
11-
- Highlight `(`, `{` and `[` pairs
12-
- Introduce Live Templates for Zig:
13-
- `import` -> Create an import using the `@import` function
14-
- `sdp` -> Debug Print statement
15-
- `sli` -> Log Info statement
16-
17-
### Fixed
18+
### Added
19+
- Improved parser: 100% of the language is parsed correctly.
20+
- Insert closing pair match for `(`, `{`, `[` and `"`
21+
- Highlight `(`, `{` and `[` pairs
22+
- Introduce Live Templates for Zig:
23+
- `import` -> Create an import using the `@import` function
24+
- `sdp` -> Debug Print statement
25+
- `sli` -> Log Info statement
26+
27+
### Fixed
1828
- Fix issue [#15](https://github.com/MarioAriasC/zig-support/issues/15)
1929

2030
## [0.0.5]

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33

44
pluginGroup = com.github.marioariasc.zigsupport
55
pluginName = zig-support
6-
pluginVersion = 0.0.6
6+
pluginVersion = 0.0.7
77

88
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
99
# for insight into build numbers and IntelliJ Platform versions.
10-
pluginSinceBuild = 211
11-
pluginUntilBuild = 221.*
10+
pluginSinceBuild = 213
11+
pluginUntilBuild = 222.*
1212

1313

1414
platformType = IC
15-
platformVersion = 2021.1.3
15+
platformVersion = 2021.3.3
1616

1717
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1818
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22

src/main/kotlin/org/ziglang/jb/completion/ZigCompletionContributor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ZigCompletionContributor : CompletionContributor() {
4040
}
4141

4242
private val lookupLowerCase = { element: IElementType ->
43-
val lowerCased = element.toString().toLowerCase()
43+
val lowerCased = element.toString().lowercase()
4444
LookupElementBuilder
4545
.create(lowerCased)
4646
.withPresentableText(lowerCased)

src/main/kotlin/org/ziglang/jb/types/utils.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ fun ZigPrimaryTypeExpr.type(context: Context): Type? {
7777
fun ZigContainerDecl.type(context: Context): Type? {
7878
return context.cacheType(this) {
7979
when (firstChild?.firstChild?.text) {
80-
ZigTypes.STRUCT.toString().toLowerCase() -> context.getStructType(this)
81-
ZigTypes.ENUM.toString().toLowerCase() -> context.getEnumType(this)
80+
ZigTypes.STRUCT.toString().lowercase() -> context.getStructType(this)
81+
ZigTypes.ENUM.toString().lowercase() -> context.getEnumType(this)
8282
else -> null
8383
}
8484
}

src/main/resources/liveTemplates/Zig.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,56 @@
2121
<option name="ZIG_CODE" value="true"/>
2222
</context>
2323
</template>
24+
<template description="String a.k.a []const u8" name="St" value="[]const u8">
25+
<context>
26+
<option name="ZIG_CODE" value="true"/>
27+
</context>
28+
</template>
29+
<template description="Test" name="tst" value="test &quot;$NAME$&quot; {$END$}">
30+
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true"/>
31+
<context>
32+
<option name="ZIG_CODE" value="true"/>
33+
</context>
34+
</template>
35+
<template description="Self declaration" name="csd" value="const Self = @This();">
36+
<context>
37+
<option name="ZIG_CODE" value="true"/>
38+
</context>
39+
</template>
40+
<template description="Enum declaration" name="ced" value="const $NAME$ = enum {$END$};">
41+
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true"/>
42+
<context>
43+
<option name="ZIG_CODE" value="true"/>
44+
</context>
45+
</template>
46+
<template description="Struct declaration" name="cstd" value="const $NAME$ = struct {$END$};">
47+
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true"/>
48+
<context>
49+
<option name="ZIG_CODE" value="true"/>
50+
</context>
51+
</template>
52+
<template description="Function declaration without parameters" name="fn0" value="fn $NAME$() $RETURN$ {$END$}">
53+
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true"/>
54+
<variable name="RETURN" expression="" defaultValue="" alwaysStopAt="true"/>
55+
<context>
56+
<option name="ZIG_CODE" value="true"/>
57+
</context>
58+
</template>
59+
<template description="Function declaration with one parameter" name="fn1" value="fn $NAME$($PARAM1$) $RETURN$ {$END$}">
60+
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true"/>
61+
<variable name="PARAM1" expression="" defaultValue="" alwaysStopAt="true"/>
62+
<variable name="RETURN" expression="" defaultValue="" alwaysStopAt="true"/>
63+
<context>
64+
<option name="ZIG_CODE" value="true"/>
65+
</context>
66+
</template>
67+
<template description="Function declaration with two parameters" name="fn2" value="fn $NAME$($PARAM1$, $PARAM2$) $RETURN$ {$END$}">
68+
<variable name="NAME" expression="" defaultValue="" alwaysStopAt="true"/>
69+
<variable name="PARAM1" expression="" defaultValue="" alwaysStopAt="true"/>
70+
<variable name="PARAM2" expression="" defaultValue="" alwaysStopAt="true"/>
71+
<variable name="RETURN" expression="" defaultValue="" alwaysStopAt="true"/>
72+
<context>
73+
<option name="ZIG_CODE" value="true"/>
74+
</context>
75+
</template>
2476
</templateSet>

0 commit comments

Comments
 (0)