aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/extension.ts16
1 files changed, 12 insertions, 4 deletions
diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts
index c464ab5b2..dc1792e94 100644
--- a/editors/code/src/extension.ts
+++ b/editors/code/src/extension.ts
@@ -1,8 +1,6 @@
1'use strict'; 1'use strict';
2import * as vscode from 'vscode'; 2import * as vscode from 'vscode';
3import * as lc from 'vscode-languageclient' 3import * as lc from 'vscode-languageclient'
4import { DH_UNABLE_TO_CHECK_GENERATOR } from 'constants';
5
6 4
7let client: lc.LanguageClient; 5let client: lc.LanguageClient;
8 6
@@ -10,8 +8,14 @@ let uris = {
10 syntaxTree: vscode.Uri.parse('ra-lsp://syntaxtree') 8 syntaxTree: vscode.Uri.parse('ra-lsp://syntaxtree')
11} 9}
12 10
11let highlightingOn = true;
13 12
14export function activate(context: vscode.ExtensionContext) { 13export function activate(context: vscode.ExtensionContext) {
14 let config = vscode.workspace.getConfiguration('ra-lsp');
15 if (config.has('highlightingOn')) {
16 highlightingOn = config.get('highlightingOn') as boolean;
17 }
18
15 let textDocumentContentProvider = new TextDocumentContentProvider() 19 let textDocumentContentProvider = new TextDocumentContentProvider()
16 let dispose = (disposable: vscode.Disposable) => { 20 let dispose = (disposable: vscode.Disposable) => {
17 context.subscriptions.push(disposable); 21 context.subscriptions.push(disposable);
@@ -232,14 +236,18 @@ const decorations: { [index: string]: vscode.TextEditorDecorationType } = (() =>
232 236
233function setHighlights( 237function setHighlights(
234 editor: vscode.TextEditor, 238 editor: vscode.TextEditor,
235 highlihgs: Array<Decoration> 239 highlights: Array<Decoration>
236) { 240) {
241 if (!highlightingOn) {
242 return;
243 }
244
237 let byTag: Map<string, vscode.Range[]> = new Map() 245 let byTag: Map<string, vscode.Range[]> = new Map()
238 for (let tag in decorations) { 246 for (let tag in decorations) {
239 byTag.set(tag, []) 247 byTag.set(tag, [])
240 } 248 }
241 249
242 for (let d of highlihgs) { 250 for (let d of highlights) {
243 if (!byTag.get(d.tag)) { 251 if (!byTag.get(d.tag)) {
244 console.log(`unknown tag ${d.tag}`) 252 console.log(`unknown tag ${d.tag}`)
245 continue 253 continue