apply decreaseIndent for ruby code

This commit is contained in:
rebornix 2016-12-02 10:54:45 -08:00
parent bf38fbef59
commit db979de520
4 changed files with 45 additions and 1 deletions

View file

@ -1,8 +1,10 @@
{
"name": "ruby",
"version": "0.1.0",
"version": "0.2.0",
"publisher": "vscode",
"engines": { "vscode": "*" },
"activationEvents": ["onLanguage:ruby"],
"main": "./out/rubyMain",
"contributes": {
"languages": [{
"id": "ruby",
@ -17,5 +19,9 @@
"scopeName": "source.ruby",
"path": "./syntaxes/Ruby.plist"
}]
},
"scripts": {
"compile": "gulp compile-extension:ruby",
"watch": "gulp watch-extension:ruby"
}
}

View file

@ -0,0 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { ExtensionContext, languages } from 'vscode';
export function activate(context: ExtensionContext): any {
languages.setLanguageConfiguration('ruby', {
indentationRules: {
increaseIndentPattern: /^\s*((begin|class|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while)|(.*\sdo\b))\b[^\{;]*$/,
decreaseIndentPattern: /^\s*([}\]]([,)]?\s*(#|$)|\.[a-zA-Z_]\w*\b)|(end|rescue|ensure|else|elsif|when)\b)/
},
wordPattern: /(-?\d+(?:\.\d+))|(:?[A-Za-z][^-`~@#%^&()=+[{}|;:'",<>/.*\]\s\\!?]*[!?]?)/
});
}

10
extensions/ruby/src/typings/ref.d.ts vendored Normal file
View file

@ -0,0 +1,10 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../src/typings/mocha.d.ts'/>
/// <reference path='../../../../extensions/node.d.ts'/>
/// <reference path='../../../../extensions/lib.core.d.ts'/>
/// <reference path='../../../../extensions/declares.d.ts'/>

View file

@ -0,0 +1,12 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"outDir": "./out",
"noLib": true,
"sourceMap": true
},
"exclude": [
"node_modules"
]
}