Skip to content

Commit db979de

Browse files
committed
apply decreaseIndent for ruby code
1 parent bf38fbe commit db979de

4 files changed

Lines changed: 45 additions & 1 deletion

File tree

extensions/ruby/package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"name": "ruby",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"publisher": "vscode",
55
"engines": { "vscode": "*" },
6+
"activationEvents": ["onLanguage:ruby"],
7+
"main": "./out/rubyMain",
68
"contributes": {
79
"languages": [{
810
"id": "ruby",
@@ -17,5 +19,9 @@
1719
"scopeName": "source.ruby",
1820
"path": "./syntaxes/Ruby.plist"
1921
}]
22+
},
23+
"scripts": {
24+
"compile": "gulp compile-extension:ruby",
25+
"watch": "gulp watch-extension:ruby"
2026
}
2127
}

extensions/ruby/src/rubyMain.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
'use strict';
6+
import { ExtensionContext, languages } from 'vscode';
7+
8+
export function activate(context: ExtensionContext): any {
9+
languages.setLanguageConfiguration('ruby', {
10+
indentationRules: {
11+
increaseIndentPattern: /^\s*((begin|class|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while)|(.*\sdo\b))\b[^\{;]*$/,
12+
decreaseIndentPattern: /^\s*([}\]]([,)]?\s*(#|$)|\.[a-zA-Z_]\w*\b)|(end|rescue|ensure|else|elsif|when)\b)/
13+
},
14+
wordPattern: /(-?\d+(?:\.\d+))|(:?[A-Za-z][^-`~@#%^&()=+[{}|;:'",<>/.*\]\s\\!?]*[!?]?)/
15+
});
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
/// <reference path='../../../../src/vs/vscode.d.ts'/>
7+
/// <reference path='../../../../src/typings/mocha.d.ts'/>
8+
/// <reference path='../../../../extensions/node.d.ts'/>
9+
/// <reference path='../../../../extensions/lib.core.d.ts'/>
10+
/// <reference path='../../../../extensions/declares.d.ts'/>

extensions/ruby/tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es5",
5+
"outDir": "./out",
6+
"noLib": true,
7+
"sourceMap": true
8+
},
9+
"exclude": [
10+
"node_modules"
11+
]
12+
}

0 commit comments

Comments
 (0)