@@ -12,7 +12,6 @@ import cache from './cache'
12
12
import { complete } from './complete'
13
13
import createDiagnostics from './createDiagnostics'
14
14
import createConnection from './createConnection'
15
- import yargs from 'yargs'
16
15
import SettingStore from './SettingStore'
17
16
import { Schema } from './database_libs/AbstractClient'
18
17
import getDatabaseClient from './database_libs/getDatabaseClient'
@@ -26,14 +25,11 @@ import path from 'path'
26
25
import process from 'process'
27
26
28
27
export type ConnectionMethod = 'node-ipc' | 'stdio'
29
- type Args = {
30
- method ?: ConnectionMethod
31
- }
32
28
33
29
const TRIGGER_CHARATER = '.'
34
30
35
- export function createServerWithConnection ( connection : Connection ) {
36
- initializeLogging ( )
31
+ export function createServerWithConnection ( connection : Connection , debug = false ) {
32
+ initializeLogging ( debug )
37
33
const logger = log4js . getLogger ( )
38
34
const documents = new TextDocuments ( TextDocument )
39
35
documents . listen ( connection ) ;
@@ -325,7 +321,7 @@ export function createServerWithConnection(connection: Connection) {
325
321
return connection
326
322
}
327
323
328
- export function createServer ( ) {
329
- const connection : Connection = createConnection ( ( yargs . argv as Args ) . method || 'node-ipc' )
330
- return createServerWithConnection ( connection )
324
+ export function createServer ( params : { method ?: ConnectionMethod , debug ?: boolean } = { } ) {
325
+ const connection : Connection = createConnection ( params . method ?? 'node-ipc' )
326
+ return createServerWithConnection ( connection , params . debug )
331
327
}
0 commit comments