From 54e188740f4f949417b74e95d590e9e3392fba8c Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 4 Jan 2016 14:27:36 +0100 Subject: [PATCH] Added electric characters & closing character pairs fix #10 --- package.json | 2 +- src/extension.ts | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 394771b..cd20145 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "code-d", "description": "auto-complete, snippets, linter and formatter for dlang", - "version": "0.2.1", + "version": "0.2.2", "publisher": "webfreak", "repository": { "type": "git", diff --git a/src/extension.ts b/src/extension.ts index 164bdf4..076357b 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -22,6 +22,28 @@ export function activate(context: vscode.ExtensionContext) { context.subscriptions.push(vscode.languages.registerDocumentFormattingEditProvider(D_MODE, workspaced)); context.subscriptions.push(workspaced); + vscode.languages.setLanguageConfiguration(D_MODE.language, { + __electricCharacterSupport: { + brackets: [ + { tokenType: 'delimiter.curly.ts', open: '{', close: '}', isElectric: true }, + { tokenType: 'delimiter.square.ts', open: '[', close: ']', isElectric: true }, + { tokenType: 'delimiter.paren.ts', open: '(', close: ')', isElectric: true } + ] + }, + + __characterPairSupport: { + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '`', close: '`', notIn: ['string'] }, + { open: '"', close: '"', notIn: ['string'] }, + { open: '\'', close: '\'', notIn: ['string', 'comment'] } + ] + } + }); + + context.subscriptions.push(vscode.languages.registerWorkspaceSymbolProvider(workspaced)); diagnosticCollection = vscode.languages.createDiagnosticCollection("d");