Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some small improvements #45

Merged
merged 2 commits into from
Mar 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions nimcfg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"comments": {
"lineComment": "#",
"blockComment": [ "#[", "]#" ]
},
"brackets": [
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont sure that this is good idea to use json configuration together with code based in nimMain.ts, also autoClosingPairs is marked as Deprecated in https://github.com/Microsoft/vscode/blob/master/src/vs/vscode.d.ts#L2786
May be it will more reasonable use declaration in code for better type safety?

Copy link
Contributor Author

@RSDuck RSDuck Mar 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really deprecated if it's inside a json configuration? Because the source code states:

/**
* **Deprecated** Do not use.
*
* @deprecated * Use the the autoClosingPairs property in the language configuration file instead.
*/

That's the reason why I created a json language config file anyway. And here in the official manual they still recommend autoClosingPairs in json configs. Also e.g. the Python extension(integrated into VSCode) depends on autoClosingPairs, otherwise they would have the same problem.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

["#[", "]#"],
{"open": "[", "close": "]", "notIn": ["comment"]},
["(", ")"],
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
{ "open": "\"", "close": "\"", "notIn": ["string", "comment"] }
],
"surroundingPairs": [
["[", "]"],
["(", ")"],
["'", "'"],
["\"", "\""]
]
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
{
"id": "nim",
"aliases": ["Nim", "nim"],
"extensions": [".nim", ".nims", "nim.cfg", ".nim.cfg"]
"extensions": [".nim", ".nims", "nim.cfg", ".nim.cfg"],
"configuration": "./nimcfg.json"
},
{
"id": "nimble",
Expand Down
22 changes: 0 additions & 22 deletions src/nimMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,6 @@ export function activate(ctx: vscode.ExtensionContext): void {
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