import * as os from 'os' ; import * as path from "path" ; import * as vscode from "vscode" ; import { IAzExtOutputChannel , IAzureUserInput } from "vscode-azureextensionui" ; import { LanguageClient } from 'vscode-languageclient/node' ; import { configPrefix , isWebpack } from "../common" ; import { DeploymentFileMapping } from "./documents/parameters/DeploymentFileMapping" ; import { IProvideOpenedDocuments } from './IProvideOpenedDocuments' ; import { LanguageServerState } from "./languageclient/startArmLanguageServer" ; import { ISnippetManager } from './snippets/ISnippetManager' ; import { CompletionsSpy } from "./util/CompletionsSpy" ; import { InitializeBeforeUse } from "./util/InitializeBeforeUse" ; import { IConfiguration , VsCodeConfiguration } from './vscodeIntegration/Configuration' ; import { JsonOutlineProvider } from "./vscodeIntegration/Treeview" ; /**
 * Namespace for common variables used throughout the extension. They must be initialized in the activate() method of extension.ts
 */ class ExtensionVariables { public readonly extensionId : string = "msazurermtools.azurerm-vscode-tools" ; private _context : InitializeBeforeUse < vscode . ExtensionContext > = new InitializeBeforeUse < vscode . ExtensionContext > ( "_context" ) ; private _jsonOutlineProvider : InitializeBeforeUse < JsonOutlineProvider > = new InitializeBeforeUse < JsonOutlineProvider > ( "_jsonOutlineProvider" ) ; private _outputChannel : InitializeBeforeUse < IAzExtOutputChannel > = new InitializeBeforeUse < IAzExtOutputChannel > ( "_outputChannel" ) ; private _ui : InitializeBeforeUse < IAzureUserInput > = new InitializeBeforeUse < IAzureUserInput > ( "_ui" ) ; private _languageServerState : LanguageServerState = LanguageServerState . NotStarted ; private _languageServerStateEmitter : vscode . EventEmitter < void > = new vscode . EventEmitter < void > ( ) ; public set context ( context ) { this . _context . value = context ; } public get context ( ) : vscode . ExtensionContext { return this . _context . value ; } public set jsonOutlineProvider ( context ) { this . _jsonOutlineProvider . value = context ; } public get jsonOutlineProvider ( ) : JsonOutlineProvider { return this . _jsonOutlineProvider . value ; } public set outputChannel ( outputChannel ) { this . _outputChannel . value = outputChannel ; } public get outputChannel ( ) : IAzExtOutputChannel { return this . _outputChannel . value ; } public set ui ( ui ) { this . _ui . value = ui ; } public get ui ( ) : IAzureUserInput { return this . _ui . value ; } public EOL : string = os . EOL ; public pathSeparator : string = path . sep ; public provideOpenedDocuments : IProvideOpenedDocuments | undefined ; public readonly ignoreBundle : boolean = ! isWebpack ; public languageServerClient : LanguageClient | undefined ; public set languageServerState ( value ) { if ( this . _languageServerState !== value ) { this . _languageServerState = value ; this . _languageServerStateEmitter . fire ( ) ; } } public get languageServerState ( ) : LanguageServerState { return this . _languageServerState ; } public get languageServerStateChanged ( ) : vscode . Event < void > { return this . _languageServerStateEmitter . event ; } public languageServerStartupError : string | undefined ; public extensionStartupComplete : boolean | undefined ; public extensionStartupError : string | undefined ; public addCompletedDiagnostic : boolean = false ; public readonly configuration : IConfiguration = new VsCodeConfiguration ( configPrefix ) ; public readonly completionItemsSpy : CompletionsSpy = new CompletionsSpy ( ) ; public deploymentFileMapping : InitializeBeforeUse < DeploymentFileMapping > = new InitializeBeforeUse < DeploymentFileMapping > ( "deploymentFileMapping" ) ; public snippetManager : InitializeBeforeUse < ISnippetManager > = new InitializeBeforeUse < ISnippetManager > ( "snippetManager" , true ) ; } if ( ! ( < any > global ) . vscodearm_ext ) { ( < any > global ) . vscodearm_ext = new ExtensionVariables ( ) ; } export const ext = ( < any > global ) . vscodearm_ext ;