Skip to content

Commit

Permalink
config support
Browse files Browse the repository at this point in the history
  • Loading branch information
qarlosalberto committed Oct 28, 2021
1 parent d1e1cb4 commit ad5c037
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 44 deletions.
83 changes: 40 additions & 43 deletions configs/verilog.configuration.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,41 @@
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"],
["begin", "end"],
["case", "endcase"],
["casex", "endcase"],
["casez", "endcase"],
["checker", "endchecker"],
["class", "endclass"],
["clocking", "endclocking"],
["config", "endconfig"],
["covergroup", "endgroup"],
["fork", "join"],
["fork", "join_any"],
["fork", "join_none"],
["function", "endfunction"],
["generate", "endgenerate"],
["interface", "endinterface"],
["macromodule", "endmodule"],
["module", "endmodule"],
["package", "endpackage"],
["primitive", "endprimitive"],
["program", "endprogram"],
["property", "endproperty"],
["randcase", "endcase"],
["specify", "endspecify"],
["sequence", "endsequence"],
["table", "endtable"],
["task", "endtask"]
],
// Copyright (c) 2021 xiaohuyz

"autoClosingPairs": [
{"open":"(", "close":")"},
{"open":"[", "close":"]"},
{"open":"{", "close":"}"},
{"open":"\"", "close":"\"", "notIn":["string"]}
]
}
{
"comments": {
"lineComment": "//",
"blockComment": [ "/*", "*/" ]
},
// symbols used as brackets
"brackets": [["{", "}"], ["[", "]"], ["(", ")"]],
// symbols that are auto closed when typing
"autoClosingPairs": [
{ "open": "{", "close": "}" },
{ "open": "[", "close": "]" },
{ "open": "(", "close": ")" },
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"]},
{ "open": "/*", "close": "*/", "notIn": ["string"]},
],
// symbols that that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["/* ", " */"]
],
"wordPattern": "(-?\\d*\\.\\d\\w*)|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)",
"indentationRules": {
"increaseIndentPattern": "^\\s*(((priority|unique|unique0)\\s+)?(case|casex|casez)|checker|(virtual\\s+)?class|config|covergroup|generate|interface|module|package|primitive|program|property|randcase|randsequence|sequence|specify|((virtual\\s+)?((local|protected|static)\\s+)?|(local|protected|static)\\s+(virtual\\s+)?)(function|task))\\b|^((?!\\/\\/|\\/\\*).)*\\bbegin\\b(?!.*\\bend\\b)|^((?!\\/\\/|\\/\\*|\\bdisable\\b|\\bwait\\b).)*\\bfork\\b(?!.*\\b(join(_any|_none|))\\b)|^((?!\\/\\/|\\/\\*).)*\\{\\s*((\\/\\/|\\/\\*).*|$)|^\\s*((default|global)\\s+)?(clocking\\b).*\\@",
"decreaseIndentPattern": "^\\s*(end(case|checker|class|clocking|config|function|generate|group|interface|module|package|primitive|program|property|sequence|specify|task)\\b)|^\\s*end\\b|^\\s*join(_any|_none|)\\b|^\\s*\\}",
// sadly there is no option to include multi lines... so this rule fails on the first unterminated block comment line. Life is cruel. ^^
// "indentNextLinePattern": "^(?!.*(begin|end|fork|join|\\`\\w+(\\(.*\\))?|\\;|\\{)\\s*(\\/\\/|\\/\\*)?).*[^\\s;{}]\\s*$",
// unIndented contains: comments, macros, attributes
"unIndentedLinePattern": "^\\s*(\\/\\/|\\/\\*|\\`\\w+|\\(\\*).*$"
},
"folding": {
"markers": {
"start": "^\\s*(`celldefine|`ifdef|`ifndef|`pragma\\s+protect\\b.*\\b(begin|begin_protected)\\b|`unconnected_drive)\\b|^\\s*(((priority|unique|unique0)\\s+)?(case|casex|casez)|checker|(virtual\\s+)?class|config|covergroup|generate|interface|module|package|primitive|program|property|randcase|randsequence|sequence|specify|(virtual\\s+)?((local|protected|static)\\s+)?(function|task))\\b|^((?!\\/\\/|\\/\\*).)*\\bbegin\\b(?!.*\\bend\\b)|^((?!\\/\\/|\\/\\*|\\bdisable\\b|\\bwait\\b).)*\\bfork\\b(?!.*\\b(join(_any|_none|))\\b)|^((?!\\/\\/|\\/\\*).)*\\{\\s*((\\/\\/|\\/\\*).*|$)|^\\s*((default|global)\\s+)?(clocking\\b).*\\@",
"end": "^\\s*(`endcelldefine|`endif|`nounconnected_drive|`pragma\\s+protect\\b.*\\b(end|end_protected)|`resetall)\\b|^\\s*(end(case|checker|class|clocking|config|function|generate|group|interface|module|package|primitive|program|property|sequence|specify|task)\\b)|^\\s*end\\b|^\\s*join(_any|_none|)\\b|^\\s*\\}"
}
}
}
15 changes: 14 additions & 1 deletion configs/vhdl.configuration.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) 2019 Rich J. Young

{
"comments": {
"lineComment": "--",
Expand All @@ -15,11 +17,22 @@
["\"", "\""],
["'", "'"]
],
"autoCloseBefore": ";:,=])\n\t",
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
],
"wordPattern": "(?<!\\\\)\\b([0-9a-zA-Z]+[0-9a-zA-Z_]*)\\b(?!\\\\)|(\\\\([0-9a-zA-Z]+[0-9a-zA-Z_\\\\]*)\\\\)",
"indentationRules": {
"increaseIndentPattern": "^((?!(--|/\\*)).)*(\\b(begin|else|loop|generate|then)\\b|\\b(component|block|process|is|generic|port)\\b[^;]*$)",
// `^((?!(--|/\*)).)*` ignore any text in a comment
// `\b(begin|else|loop|generate|then)\b` increase indent on a line containing these keywords
// `\b(component|block|process|is|generic|port)\b[^;]*$` only increase indent a line containing these keywords if no `;` follows on the same line.
"decreaseIndentPattern": "^((?!.*?\\/\\*).*\\*/)?\\s*(elsif|else|end|begin)\\b",
// `^((?!.*?/\*).*\*/)??` ignore any text in a comment at the start of the line
// `\s*(elsif|else|end|begin)\b)` decrease indent on a line starting with these keywords
}
}
1 change: 1 addition & 0 deletions resources/release_notes/release-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ <h2>New features</h2>
<ul>
<li>Improvements in state machine parser.</li>
<li>New selection icon in project manager.</li>
<li>Editor auto-indentation.</li>
</ul>
</p>
<br>
Expand Down

0 comments on commit ad5c037

Please sign in to comment.