private createServerOptions()

in src/languageservice/serviceclient.ts [310:353]


    private createServerOptions(servicePath): ServerOptions {
        let serverArgs = [];
        let serverCommand: string = servicePath;

        let config = workspace.getConfiguration(Constants.extensionConfigSectionName);

        if (config) {
            // Override the server path with the local debug path if enabled

            let useLocalSource = config['useDebugSource'];
            if (useLocalSource) {
                let localSourcePath = config['debugSourcePath'];
                let filePath = path.join(localSourcePath, 'pgsqltoolsservice/pgtoolsservice_main.py');
                process.env.PYTHONPATH = localSourcePath;
                serverCommand = process.platform === 'win32' ? 'python' : 'python3';

                let enableStartupDebugging = config['enableStartupDebugging'];
                let debuggingArg = enableStartupDebugging ? '--enable-remote-debugging-wait' : '--enable-remote-debugging';
                let debugPort = config['debugServerPort'];
                debuggingArg += '=' + debugPort;
                serverArgs = [filePath, debuggingArg];
            }

            let logFileLocation = path.join(this.getDefaultLogLocation(), 'pgsql');

            serverArgs.push('--log-dir=' + logFileLocation);
            serverArgs.push(logFileLocation);

            // Enable diagnostic logging in the service if it is configured
            let logDebugInfo = config['logDebugInfo'];
            if (logDebugInfo) {
                serverArgs.push('--enable-logging');
            }
            let applyLocalization = config[Constants.configApplyLocalization];
            if (applyLocalization) {
                let locale = vscode.env.language;
                serverArgs.push('--locale');
                serverArgs.push(locale);
            }
        }

        // run the service host
        return  {  command: serverCommand, args: serverArgs, transport: TransportKind.stdio  };
    }