diff options
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/extension.ts | 16 |
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'; |
2 | import * as vscode from 'vscode'; | 2 | import * as vscode from 'vscode'; |
3 | import * as lc from 'vscode-languageclient' | 3 | import * as lc from 'vscode-languageclient' |
4 | import { DH_UNABLE_TO_CHECK_GENERATOR } from 'constants'; | ||
5 | |||
6 | 4 | ||
7 | let client: lc.LanguageClient; | 5 | let 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 | ||
11 | let highlightingOn = true; | ||
13 | 12 | ||
14 | export function activate(context: vscode.ExtensionContext) { | 13 | export 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 | ||
233 | function setHighlights( | 237 | function 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 |