Skip to content

Commit

Permalink
Merge pull request #45 from RSDuck/master
Browse files Browse the repository at this point in the history
Some small improvements
  • Loading branch information
kosz78 committed Mar 21, 2017
2 parents b178e63 + c62a119 commit 460bf1d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
22 changes: 22 additions & 0 deletions nimcfg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"comments": {
"lineComment": "#",
"blockComment": [ "#[", "]#" ]
},
"brackets": [
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["#[", "]#"],
{"open": "[", "close": "]", "notIn": ["comment"]},
["(", ")"],
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] }
],
"surroundingPairs": [
["[", "]"],
["(", ")"],
["'", "'"],
["\"", "\""]
]
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,14 @@
{
"id": "nim",
"aliases": ["Nim", "nim"],
"extensions": [".nim", ".nims", "nim.cfg", ".nim.cfg"]
"extensions": [".nim", ".nims", "nim.cfg", ".nim.cfg"],
"configuration": "./nimcfg.json"
},
{
"id": "nimble",
"aliases": ["Nimble", "nimble"],
"extensions": [".nimble"]
"extensions": [".nimble"],
"configuration": "./nimcfg.json"
}
],
"grammars": [
Expand Down
24 changes: 1 addition & 23 deletions src/nimMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,32 +41,10 @@ export function activate(ctx: vscode.ExtensionContext): void {

vscode.languages.setLanguageConfiguration(NIM_MODE.language, {
indentationRules: {
increaseIndentPattern: /^\s*(((if|when|elif|else|except|finally|for|try|while|of)\b.*:)|((proc|macro|iterator|template|converter)\b.*\=)|(import|var|const|type))\s*$/,
increaseIndentPattern: /^\s*((((proc|macro|iterator|template|converter)\b.*\=)|(import|var|const|type)\s)|(import|let|var|const|type)|([^:]+:))$/,
decreaseIndentPattern: /^\s*(((return|break|continue|raise)\n)|((elif|else|except|finally)\b.*:))\s*$/
},
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
onEnterRules: [
{
beforeText: /^ *#\s.*$/,
afterText: /.+$/,
action: { indentAction: vscode.IndentAction.None, appendText: '# ' }
},
{
beforeText: /^ *##\s.*$/,
afterText: /.+$/,
action: { indentAction: vscode.IndentAction.None, appendText: '## ' }
}
],
comments: {
lineComment: '#',
blockComment: ['#[', ']#'],
},
brackets: [
['[', ']'],
['(', ')'],
['"', '"'],
['\'', '\'']
]
});

vscode.window.onDidChangeActiveTextEditor(showHideStatus, null, ctx.subscriptions);
Expand Down

0 comments on commit 460bf1d

Please sign in to comment.