Skip to content

Commit 54e1887

Browse files
author
WebFreak001
committed
Added electric characters & closing character pairs fix #10
1 parent 7097be8 commit 54e1887

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-d",
33
"description": "auto-complete, snippets, linter and formatter for dlang",
4-
"version": "0.2.1",
4+
"version": "0.2.2",
55
"publisher": "webfreak",
66
"repository": {
77
"type": "git",

src/extension.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,28 @@ export function activate(context: vscode.ExtensionContext) {
2222
context.subscriptions.push(vscode.languages.registerDocumentFormattingEditProvider(D_MODE, workspaced));
2323
context.subscriptions.push(workspaced);
2424

25+
vscode.languages.setLanguageConfiguration(D_MODE.language, {
26+
__electricCharacterSupport: {
27+
brackets: [
28+
{ tokenType: 'delimiter.curly.ts', open: '{', close: '}', isElectric: true },
29+
{ tokenType: 'delimiter.square.ts', open: '[', close: ']', isElectric: true },
30+
{ tokenType: 'delimiter.paren.ts', open: '(', close: ')', isElectric: true }
31+
]
32+
},
33+
34+
__characterPairSupport: {
35+
autoClosingPairs: [
36+
{ open: '{', close: '}' },
37+
{ open: '[', close: ']' },
38+
{ open: '(', close: ')' },
39+
{ open: '`', close: '`', notIn: ['string'] },
40+
{ open: '"', close: '"', notIn: ['string'] },
41+
{ open: '\'', close: '\'', notIn: ['string', 'comment'] }
42+
]
43+
}
44+
});
45+
46+
2547
context.subscriptions.push(vscode.languages.registerWorkspaceSymbolProvider(workspaced));
2648

2749
diagnosticCollection = vscode.languages.createDiagnosticCollection("d");

0 commit comments

Comments
 (0)