import { Connection , ConnectionOptions } from 'vscode-languageserver' ; import { createConnection } from 'vscode-languageserver/node' ; import { isMainThread } from 'worker_threads' ; import { getCancellationStrategyFromArgv } from './common/fileBasedCancellationUtils' ; export function run ( runServer , runBackgroundThread ) { if ( process . env . NODE_ENV === 'production' ) { require ( 'source-map-support' ) . install ( ) ; } if ( isMainThread ) { runServer ( createConnection ( getConnectionOptions ( ) ) ) ; } else { runBackgroundThread ( ) ; } } export function getConnectionOptions ( ) { return { cancellationStrategy : getCancellationStrategyFromArgv ( process . argv ) } ; }