-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e0f65d
commit d460e15
Showing
11 changed files
with
127 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>name</key> | ||
<string>Indentation Rules</string> | ||
<key>scope</key> | ||
<string>source.odin</string> | ||
<key>settings</key> | ||
<dict> | ||
<key>decreaseIndentPattern</key> | ||
<string>(?x) | ||
^ # start of line | ||
(.*\*/)? # skip comments if present | ||
( # three possibilities | ||
\s* \} # whitespace and a closing curly brace | ||
( # capture: | ||
[^}{"']* \{ # anything other than curly braces or quotes, then open curly | ||
)? # (optional) | ||
[;\s]*? # any whitespace or semicolons | ||
| | ||
(?:\s* (case).*:) # case statements pop back one indent | ||
| | ||
(?: \) (?<! \( ) ) # closing braces not preceded by opening braces | ||
) | ||
(//.*|/\*.*\*/\s*)? # skip any comments (optional) | ||
$ # end of line | ||
</string> | ||
<key>increaseIndentPattern</key> | ||
<string>(?x) | ||
^ | ||
(?: .* \*/ )? # skip any comments | ||
(?: | ||
(.* \{ [^}"'\n]*) # lines containing an open curly but no quotes or close curly | ||
| # OR | ||
(?:\s* (case).*:) # case statements | ||
| # OR | ||
(.* \( [^)"'\n]*) # lines containing an open brace but no quotes or close brace | ||
) | ||
(//.*|/\*.*\*/\s*)? # skip any comments (optional) | ||
$ | ||
</string> | ||
<!-- | ||
<key>indentNextLinePattern</key> | ||
<string>(?x)^ | ||
(?! .* [;:{}] # do not indent when line ends with ;, :, {, or } | ||
\s* (//|/[*] .* [*]/ \s* $) # …account for potential trailing comment | ||
) | ||
</string> | ||
--> | ||
<key>unIndentedLinePattern</key> | ||
<string>^\s*((/\*|\*/|//|import\b.*|export\b.*|(using\s+import)\b.*).*)?$</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<snippet> | ||
<content><![CDATA[for ${2:i} in ${3:0}..${1:count} { | ||
$0 | ||
}]]></content> | ||
<tabTrigger>for</tabTrigger> | ||
<scope>source.odin</scope> | ||
<description>For Loop</description> | ||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<snippet> | ||
<content><![CDATA[if ${1:condition} { | ||
$0 | ||
}]]></content> | ||
<tabTrigger>if</tabTrigger> | ||
<scope>source.odin</scope> | ||
<description>If Statement</description> | ||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<snippet> | ||
<content><![CDATA[struct { | ||
${0:var: vartype,} | ||
}]]></content> | ||
<tabTrigger>st</tabTrigger> | ||
<scope>source.odin</scope> | ||
<description>Struct</description> | ||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<snippet> | ||
<content><![CDATA[switch ${2:condition} { | ||
case ${3:expr}: | ||
$0 | ||
}]]></content> | ||
<tabTrigger>switch</tabTrigger> | ||
<scope>source.odin</scope> | ||
<description>Switch Statement</description> | ||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<snippet> | ||
<content><![CDATA[when ${1:condition} { | ||
$0 | ||
}]]></content> | ||
<tabTrigger>when</tabTrigger> | ||
<scope>source.odin</scope> | ||
<description>When Statement</description> | ||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<snippet> | ||
<content><![CDATA[export $2"${1:name}"]]></content> | ||
<tabTrigger>exp</tabTrigger> | ||
<scope>source.odin</scope> | ||
<description>Export</description> | ||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<snippet> | ||
<content><![CDATA[import $2"${1:name}"]]></content> | ||
<tabTrigger>imp</tabTrigger> | ||
<scope>source.odin</scope> | ||
<description>Import</description> | ||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<snippet> | ||
<content><![CDATA[main :: proc() { | ||
$0 | ||
}]]></content> | ||
<tabTrigger>main</tabTrigger> | ||
<scope>source.odin</scope> | ||
<description>main()</description> | ||
</snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<snippet> | ||
<content><![CDATA[${1:proc_name} :: proc($2)$3 { | ||
$0 | ||
}]]></content> | ||
<tabTrigger>proc</tabTrigger> | ||
<scope>source.odin</scope> | ||
<description>Function</description> | ||
</snippet> |