-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathextension.ts
36 lines (28 loc) · 1 KB
/
extension.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"use strict";
import * as vscode from "vscode";
import { BoxCompletionProvider } from "./services/BoxCompletionProvider";
const SUPPORTED_LANGUAGES = [ "cfml" ];
/**
* Verifies if ColdBox configuration is enabled
*
* @returns Boolean if is enabled or not
*/
function isEnabled(): boolean {
const config = vscode.workspace.getConfiguration( "coldbox" );
const enabled: boolean = ( config === null ) ? true : config.get( "autocomplete" );
return enabled;
}
/**
* Add the providers to the suscriptions context
*
* @param context the context
*/
export function activate( context: vscode.ExtensionContext ): void {
if ( !isEnabled() ) { return; }
const boxCompletionProvider = new BoxCompletionProvider();
for ( const languageId of SUPPORTED_LANGUAGES ) {
const provider = vscode.languages.registerCompletionItemProvider( languageId, boxCompletionProvider, "." );
context.subscriptions.push( provider );
}
}
export function deactivate(): void { /* TODO document why this function 'deactivate' is empty */ }