import { Disposable , workspace } from 'vscode' ; import { LanguageClient , LanguageClientOptions , TransportKind , ServerOptions , ErrorAction , CloseAction } from 'vscode-languageclient' ; import * as path from 'path' ; author Samuel Brucksch
  export class LocalLanguageClientProvider { constructor ( ) { } public connect ( context ) { const debugOptions = { execArgv : [ "--nolazy" , "--inspect=6009" ] } ; const serverModule = context . asAbsolutePath ( path . join ( "serverJS" , "out" , "LSPServer.js" ) ) ; const serverOptions = { run : { module : serverModule , transport : TransportKind . ipc , } , debug : { module : serverModule , transport : TransportKind . ipc , options : debugOptions , } , } ; const extensions = [ "things" , "items" , "rules" , "script" , "sitemap" , "persist" ] ; const clientOptions = { documentSelector : [ { scheme : "file" , language : "openhab" , pattern : `**/*.{${ extensions . join ( "," ) }}` } ] , synchronize : { configurationSection : "openhab" , fileEvents : workspace . createFileSystemWatcher ( "**/.clientrc" ) , } , errorHandler : { error : ( ) => ErrorAction . Continue , closed : ( ) => CloseAction . DoNotRestart } } ; const lc = new LanguageClient ( "openhabLanguageServer" , "openHAB Language Server" , serverOptions , clientOptions ) ; return lc . start ( ) ; } }