vscode-languageclient/node#StateChangeEvent TypeScript Examples
The following examples show how to use
vscode-languageclient/node#StateChangeEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: language-server.ts From vscode-cadence with Apache License 2.0 | 5 votes |
constructor (ctx: ExtensionContext, config: Config, emulatorState: EmulatorState, activeAccount: Account | null) {
// Init running state with false and update, when client is connected to server
this.running = false
const activeAccountName = (activeAccount != null) ? activeAccount.name : ''
const activeAccountAddress = (activeAccount != null) ? activeAccount.address : ''
const { configPath } = config
this.client = new LanguageClient(
'cadence',
'Cadence',
{
command: config.flowCommand,
args: START_LANGUAGE_SERVER_ARGS
},
{
documentSelector: [{ scheme: 'file', language: 'cadence' }],
synchronize: {
configurationSection: 'cadence'
},
initializationOptions: {
accessCheckMode: config.accessCheckMode,
configPath,
emulatorState,
activeAccountName,
activeAccountAddress
}
}
)
this.client
.onReady()
.then(() =>
window.showInformationMessage('Cadence language server started')
)
.catch((err: Error) =>
window.showErrorMessage(`Cadence language server failed to start: ${err.message}`)
)
this.client.onDidChangeState((e: StateChangeEvent) => {
this.running = e.newState === State.Running
})
const clientDisposable = this.client.start()
ctx.subscriptions.push(clientDisposable)
}