private createLanguageClient()

in Extension/src/LanguageServer/client.ts [1078:1515]


    private createLanguageClient(allClients: ClientCollection): LanguageClient {
        const serverModule: string = getLanguageServerFileName();
        const exeExists: boolean = fs.existsSync(serverModule);
        if (!exeExists) {
            telemetry.logLanguageServerEvent("missingLanguageServerBinary");
            throw String('Missing binary at ' + serverModule);
        }
        const serverName: string = this.getName(this.rootFolder);
        const serverOptions: ServerOptions = {
            run: { command: serverModule },
            debug: { command: serverModule, args: [serverName] }
        };

        // Get all the per-workspace settings.
        // They're sent as individual arrays to make it easier to process on the server,
        // so don't refactor this to an array of settings objects unless a good method is
        // found for processing data in that format on the server.
        const settings_clangFormatPath: (string | undefined)[] = [];
        const settings_clangFormatStyle: (string | undefined)[] = [];
        const settings_clangFormatFallbackStyle: (string | undefined)[] = [];
        const settings_clangFormatSortIncludes: (string | undefined)[] = [];
        const settings_codeAnalysisExclude: (vscode.WorkspaceConfiguration | undefined)[] = [];
        const settings_codeAnalysisRunAutomatically: (boolean | undefined)[] = [];
        const settings_clangTidyEnabled: (boolean | undefined)[] = [];
        const settings_clangTidyPath: (string | undefined)[] = [];
        const settings_clangTidyConfig: (string | undefined)[] = [];
        const settings_clangTidyFallbackConfig: (string | undefined)[] = [];
        const settings_clangTidyFixWarnings: (boolean | undefined)[] = [];
        const settings_clangTidyFixErrors: (boolean | undefined)[] = [];
        const settings_clangTidyFixNotes: (boolean | undefined)[] = [];
        const settings_clangTidyHeaderFilter: (string | undefined | null)[] = [];
        const settings_clangTidyArgs: (string[] | undefined)[] = [];
        const settings_clangTidyChecksEnabled: (string[] | undefined)[] = [];
        const settings_clangTidyChecksDisabled: (string[] | undefined)[] = [];
        const settings_filesEncoding: (string | undefined)[] = [];
        const settings_cppFilesExclude: (vscode.WorkspaceConfiguration | undefined)[] = [];
        const settings_filesExclude: (vscode.WorkspaceConfiguration | undefined)[] = [];
        const settings_filesAutoSaveAfterDelay: boolean[] = [];
        const settings_searchExclude: (vscode.WorkspaceConfiguration | undefined)[] = [];
        const settings_editorAutoClosingBrackets: (string | undefined)[] = [];
        const settings_intelliSenseEngine: (string | undefined)[] = [];
        const settings_intelliSenseEngineFallback: (string | undefined)[] = [];
        const settings_errorSquiggles: (string | undefined)[] = [];
        const settings_dimInactiveRegions: boolean[] = [];
        const settings_enhancedColorization: string[] = [];
        const settings_suggestSnippets: (boolean | undefined)[] = [];
        const settings_exclusionPolicy: (string | undefined)[] = [];
        const settings_preferredPathSeparator: (string | undefined)[] = [];
        const settings_defaultSystemIncludePath: (string[] | undefined)[] = [];
        const settings_intelliSenseCachePath: (string | undefined)[] = [];
        const settings_intelliSenseCacheSize: (number | undefined)[] = [];
        const settings_intelliSenseMemoryLimit: (number | undefined)[] = [];
        const settings_autocomplete: (string | undefined)[] = [];
        const settings_autocompleteAddParentheses: (boolean | undefined)[] = [];
        const workspaceSettings: CppSettings = new CppSettings();
        const workspaceOtherSettings: OtherSettings = new OtherSettings();
        const settings_indentBraces: boolean[] = [];
        const settings_indentMultiLine: (string | undefined)[] = [];
        const settings_indentWithinParentheses: (string | undefined)[] = [];
        const settings_indentPreserveWithinParentheses: boolean[] = [];
        const settings_indentCaseLabels: boolean[] = [];
        const settings_indentCaseContents: boolean[] = [];
        const settings_indentCaseContentsWhenBlock: boolean[] = [];
        const settings_indentLambdaBracesWhenParameter: boolean[] = [];
        const settings_indentGotoLabels: (string | undefined)[] = [];
        const settings_indentPreprocessor: (string | undefined)[] = [];
        const settings_indentAccessSpecifiers: boolean[] = [];
        const settings_indentNamespaceContents: boolean[] = [];
        const settings_indentPreserveComments: boolean[] = [];
        const settings_newLineBeforeOpenBraceNamespace: (string | undefined)[] = [];
        const settings_newLineBeforeOpenBraceType: (string | undefined)[] = [];
        const settings_newLineBeforeOpenBraceFunction: (string | undefined)[] = [];
        const settings_newLineBeforeOpenBraceBlock: (string | undefined)[] = [];
        const settings_newLineBeforeOpenBraceLambda: (string | undefined)[] = [];
        const settings_newLineScopeBracesOnSeparateLines: boolean[] = [];
        const settings_newLineCloseBraceSameLineEmptyType: boolean[] = [];
        const settings_newLineCloseBraceSameLineEmptyFunction: boolean[] = [];
        const settings_newLineBeforeCatch: boolean[] = [];
        const settings_newLineBeforeElse: boolean[] = [];
        const settings_newLineBeforeWhileInDoWhile: boolean[] = [];
        const settings_spaceBeforeFunctionOpenParenthesis: (string | undefined)[] = [];
        const settings_spaceWithinParameterListParentheses: boolean[] = [];
        const settings_spaceBetweenEmptyParameterListParentheses: boolean[] = [];
        const settings_spaceAfterKeywordsInControlFlowStatements: boolean[] = [];
        const settings_spaceWithinControlFlowStatementParentheses: boolean[] = [];
        const settings_spaceBeforeLambdaOpenParenthesis: boolean[] = [];
        const settings_spaceWithinCastParentheses: boolean[] = [];
        const settings_spaceSpaceAfterCastCloseParenthesis: boolean[] = [];
        const settings_spaceWithinExpressionParentheses: boolean[] = [];
        const settings_spaceBeforeBlockOpenBrace: boolean[] = [];
        const settings_spaceBetweenEmptyBraces: boolean[] = [];
        const settings_spaceBeforeInitializerListOpenBrace: boolean[] = [];
        const settings_spaceWithinInitializerListBraces: boolean[] = [];
        const settings_spacePreserveInInitializerList: boolean[] = [];
        const settings_spaceBeforeOpenSquareBracket: boolean[] = [];
        const settings_spaceWithinSquareBrackets: boolean[] = [];
        const settings_spaceBeforeEmptySquareBrackets: boolean[] = [];
        const settings_spaceBetweenEmptySquareBrackets: boolean[] = [];
        const settings_spaceGroupSquareBrackets: boolean[] = [];
        const settings_spaceWithinLambdaBrackets: boolean[] = [];
        const settings_spaceBetweenEmptyLambdaBrackets: boolean[] = [];
        const settings_spaceBeforeComma: boolean[] = [];
        const settings_spaceAfterComma: boolean[] = [];
        const settings_spaceRemoveAroundMemberOperators: boolean[] = [];
        const settings_spaceBeforeInheritanceColon: boolean[] = [];
        const settings_spaceBeforeConstructorColon: boolean[] = [];
        const settings_spaceRemoveBeforeSemicolon: boolean[] = [];
        const settings_spaceInsertAfterSemicolon: boolean[] = [];
        const settings_spaceRemoveAroundUnaryOperator: boolean[] = [];
        const settings_spaceAroundBinaryOperator: (string | undefined)[] = [];
        const settings_spaceAroundAssignmentOperator: (string | undefined)[] = [];
        const settings_spacePointerReferenceAlignment: (string | undefined)[] = [];
        const settings_spaceAroundTernaryOperator: (string | undefined)[] = [];
        const settings_wrapPreserveBlocks: (string | undefined)[] = [];

        {
            const settings: CppSettings[] = [];
            const otherSettings: OtherSettings[] = [];

            if (vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) {
                for (const workspaceFolder of vscode.workspace.workspaceFolders) {
                    settings.push(new CppSettings(workspaceFolder.uri));
                    otherSettings.push(new OtherSettings(workspaceFolder.uri));
                }
            } else {
                settings.push(workspaceSettings);
                otherSettings.push(workspaceOtherSettings);
            }

            for (const setting of settings) {
                settings_clangFormatPath.push(util.resolveVariables(setting.clangFormatPath, this.AdditionalEnvironment));
                settings_codeAnalysisExclude.push(setting.codeAnalysisExclude);
                settings_codeAnalysisRunAutomatically.push(setting.codeAnalysisRunAutomatically);
                settings_clangTidyEnabled.push(setting.clangTidyEnabled);
                settings_clangTidyPath.push(util.resolveVariables(setting.clangTidyPath, this.AdditionalEnvironment));
                settings_clangTidyConfig.push(setting.clangTidyConfig);
                settings_clangTidyFallbackConfig.push(setting.clangTidyFallbackConfig);
                settings_clangTidyFixWarnings.push(setting.clangTidyFixWarnings);
                settings_clangTidyFixErrors.push(setting.clangTidyFixErrors);
                settings_clangTidyFixNotes.push(setting.clangTidyFixNotes);
                settings_clangTidyHeaderFilter.push(setting.clangTidyHeaderFilter);
                settings_clangTidyArgs.push(setting.clangTidyArgs);
                settings_clangTidyChecksEnabled.push(setting.clangTidyChecksEnabled);
                settings_clangTidyChecksDisabled.push(setting.clangTidyChecksDisabled);
                settings_indentBraces.push(setting.vcFormatIndentBraces);
                settings_indentWithinParentheses.push(setting.vcFormatIndentWithinParentheses);
                settings_indentPreserveWithinParentheses.push(setting.vcFormatIndentPreserveWithinParentheses);
                settings_indentMultiLine.push(setting.vcFormatIndentMultiLineRelativeTo);
                settings_indentCaseLabels.push(setting.vcFormatIndentCaseLabels);
                settings_indentCaseContents.push(setting.vcFormatIndentCaseContents);
                settings_indentCaseContentsWhenBlock.push(setting.vcFormatIndentCaseContentsWhenBlock);
                settings_indentLambdaBracesWhenParameter.push(setting.vcFormatIndentLambdaBracesWhenParameter);
                settings_indentGotoLabels.push(setting.vcFormatIndentGotoLables);
                settings_indentPreprocessor.push(setting.vcFormatIndentPreprocessor);
                settings_indentAccessSpecifiers.push(setting.vcFormatIndentAccessSpecifiers);
                settings_indentNamespaceContents.push(setting.vcFormatIndentNamespaceContents);
                settings_indentPreserveComments.push(setting.vcFormatIndentPreserveComments);
                settings_newLineBeforeOpenBraceNamespace.push(setting.vcFormatNewlineBeforeOpenBraceNamespace);
                settings_newLineBeforeOpenBraceType.push(setting.vcFormatNewlineBeforeOpenBraceType);
                settings_newLineBeforeOpenBraceFunction.push(setting.vcFormatNewlineBeforeOpenBraceFunction);
                settings_newLineBeforeOpenBraceBlock.push(setting.vcFormatNewlineBeforeOpenBraceBlock);
                settings_newLineScopeBracesOnSeparateLines.push(setting.vcFormatNewlineScopeBracesOnSeparateLines);
                settings_newLineBeforeOpenBraceLambda.push(setting.vcFormatNewlineBeforeOpenBraceLambda);
                settings_newLineCloseBraceSameLineEmptyType.push(setting.vcFormatNewlineCloseBraceSameLineEmptyType);
                settings_newLineCloseBraceSameLineEmptyFunction.push(setting.vcFormatNewlineCloseBraceSameLineEmptyFunction);
                settings_newLineBeforeCatch.push(setting.vcFormatNewlineBeforeCatch);
                settings_newLineBeforeElse.push(setting.vcFormatNewlineBeforeElse);
                settings_newLineBeforeWhileInDoWhile.push(setting.vcFormatNewlineBeforeWhileInDoWhile);
                settings_spaceBeforeFunctionOpenParenthesis.push(setting.vcFormatSpaceBeforeFunctionOpenParenthesis);
                settings_spaceWithinParameterListParentheses.push(setting.vcFormatSpaceWithinParameterListParentheses);
                settings_spaceBetweenEmptyParameterListParentheses.push(setting.vcFormatSpaceBetweenEmptyParameterListParentheses);
                settings_spaceAfterKeywordsInControlFlowStatements.push(setting.vcFormatSpaceAfterKeywordsInControlFlowStatements);
                settings_spaceWithinControlFlowStatementParentheses.push(setting.vcFormatSpaceWithinControlFlowStatementParentheses);
                settings_spaceBeforeLambdaOpenParenthesis.push(setting.vcFormatSpaceBeforeLambdaOpenParenthesis);
                settings_spaceWithinCastParentheses.push(setting.vcFormatSpaceWithinCastParentheses);
                settings_spaceSpaceAfterCastCloseParenthesis.push(setting.vcFormatSpaceAfterCastCloseParenthesis);
                settings_spaceWithinExpressionParentheses.push(setting.vcFormatSpaceWithinExpressionParentheses);
                settings_spaceBeforeBlockOpenBrace.push(setting.vcFormatSpaceBeforeBlockOpenBrace);
                settings_spaceBetweenEmptyBraces.push(setting.vcFormatSpaceBetweenEmptyBraces);
                settings_spaceBeforeInitializerListOpenBrace.push(setting.vcFormatSpaceBeforeInitializerListOpenBrace);
                settings_spaceWithinInitializerListBraces.push(setting.vcFormatSpaceWithinInitializerListBraces);
                settings_spacePreserveInInitializerList.push(setting.vcFormatSpacePreserveInInitializerList);
                settings_spaceBeforeOpenSquareBracket.push(setting.vcFormatSpaceBeforeOpenSquareBracket);
                settings_spaceWithinSquareBrackets.push(setting.vcFormatSpaceWithinSquareBrackets);
                settings_spaceBeforeEmptySquareBrackets.push(setting.vcFormatSpaceBeforeEmptySquareBrackets);
                settings_spaceBetweenEmptySquareBrackets.push(setting.vcFormatSpaceBetweenEmptySquareBrackets);
                settings_spaceGroupSquareBrackets.push(setting.vcFormatSpaceGroupSquareBrackets);
                settings_spaceWithinLambdaBrackets.push(setting.vcFormatSpaceWithinLambdaBrackets);
                settings_spaceBetweenEmptyLambdaBrackets.push(setting.vcFormatSpaceBetweenEmptyLambdaBrackets);
                settings_spaceBeforeComma.push(setting.vcFormatSpaceBeforeComma);
                settings_spaceAfterComma.push(setting.vcFormatSpaceAfterComma);
                settings_spaceRemoveAroundMemberOperators.push(setting.vcFormatSpaceRemoveAroundMemberOperators);
                settings_spaceBeforeInheritanceColon.push(setting.vcFormatSpaceBeforeInheritanceColon);
                settings_spaceBeforeConstructorColon.push(setting.vcFormatSpaceBeforeConstructorColon);
                settings_spaceRemoveBeforeSemicolon.push(setting.vcFormatSpaceRemoveBeforeSemicolon);
                settings_spaceInsertAfterSemicolon.push(setting.vcFormatSpaceInsertAfterSemicolon);
                settings_spaceRemoveAroundUnaryOperator.push(setting.vcFormatSpaceRemoveAroundUnaryOperator);
                settings_spaceAroundBinaryOperator.push(setting.vcFormatSpaceAroundBinaryOperator);
                settings_spaceAroundAssignmentOperator.push(setting.vcFormatSpaceAroundAssignmentOperator);
                settings_spacePointerReferenceAlignment.push(setting.vcFormatSpacePointerReferenceAlignment);
                settings_spaceAroundTernaryOperator.push(setting.vcFormatSpaceAroundTernaryOperator);
                settings_wrapPreserveBlocks.push(setting.vcFormatWrapPreserveBlocks);
                settings_clangFormatStyle.push(setting.clangFormatStyle);
                settings_clangFormatFallbackStyle.push(setting.clangFormatFallbackStyle);
                settings_clangFormatSortIncludes.push(setting.clangFormatSortIncludes);
                settings_intelliSenseEngine.push(setting.intelliSenseEngine);
                settings_intelliSenseEngineFallback.push(setting.intelliSenseEngineFallback);
                settings_errorSquiggles.push(setting.errorSquiggles);
                settings_dimInactiveRegions.push(setting.dimInactiveRegions);
                settings_enhancedColorization.push(workspaceSettings.enhancedColorization ? "Enabled" : "Disabled");
                settings_suggestSnippets.push(setting.suggestSnippets);
                settings_exclusionPolicy.push(setting.exclusionPolicy);
                settings_preferredPathSeparator.push(setting.preferredPathSeparator);
                settings_defaultSystemIncludePath.push(setting.defaultSystemIncludePath);
                settings_intelliSenseCachePath.push(util.resolveCachePath(setting.intelliSenseCachePath, this.AdditionalEnvironment));
                settings_intelliSenseCacheSize.push(setting.intelliSenseCacheSize);
                settings_intelliSenseMemoryLimit.push(setting.intelliSenseMemoryLimit);
                settings_autocomplete.push(setting.autocomplete);
                settings_autocompleteAddParentheses.push(setting.autocompleteAddParentheses);
                settings_cppFilesExclude.push(setting.filesExclude);
            }

            for (const otherSetting of otherSettings) {
                settings_filesEncoding.push(otherSetting.filesEncoding);
                settings_filesExclude.push(otherSetting.filesExclude);
                settings_filesAutoSaveAfterDelay.push(otherSetting.filesAutoSaveAfterDelay);
                settings_searchExclude.push(otherSetting.searchExclude);
                settings_editorAutoClosingBrackets.push(otherSetting.editorAutoClosingBrackets);
            }
        }

        let intelliSenseCacheDisabled: boolean = false;
        if (os.platform() === "darwin") {
            const releaseParts: string[] = os.release().split(".");
            if (releaseParts.length >= 1) {
                // AutoPCH doesn't work for older Mac OS's.
                intelliSenseCacheDisabled = parseInt(releaseParts[0]) < 17;
            }
        }

        const localizedStrings: string[] = [];
        for (let i: number = 0; i < localizedStringCount; i++) {
            localizedStrings.push(lookupString(i));
        }

        const clientOptions: LanguageClientOptions = {
            documentSelector: [
                { scheme: 'file', language: 'c' },
                { scheme: 'file', language: 'cpp' },
                { scheme: 'file', language: 'cuda-cpp' }
            ],
            initializationOptions: {
                freeMemory: os.freemem() / 1048576,
                maxConcurrentThreads: workspaceSettings.maxConcurrentThreads,
                maxCachedProcesses: workspaceSettings.maxCachedProcesses,
                maxMemory: workspaceSettings.maxMemory,
                intelliSense: {
                    maxCachedProcesses: workspaceSettings.intelliSenseMaxCachedProcesses,
                    maxMemory: workspaceSettings.intelliSenseMaxMemory
                },
                references: {
                    maxConcurrentThreads: workspaceSettings.referencesMaxConcurrentThreads,
                    maxCachedProcesses: workspaceSettings.referencesMaxCachedProcesses,
                    maxMemory: workspaceSettings.referencesMaxMemory
                },
                codeAnalysis: {
                    maxConcurrentThreads: workspaceSettings.codeAnalysisMaxConcurrentThreads,
                    maxMemory: workspaceSettings.codeAnalysisMaxMemory,
                    updateDelay: workspaceSettings.codeAnalysisUpdateDelay,
                    exclude: settings_codeAnalysisExclude,
                    runAutomatically: settings_codeAnalysisRunAutomatically,
                    clangTidy: {
                        enabled: settings_clangTidyEnabled,
                        path: settings_clangTidyPath,
                        config: settings_clangTidyConfig,
                        fallbackConfig: settings_clangTidyFallbackConfig,
                        fix: {
                            warnings: settings_clangTidyFixWarnings,
                            errors: settings_clangTidyFixErrors,
                            notes: settings_clangTidyFixNotes
                        },
                        headerFilter: settings_clangTidyHeaderFilter,
                        args: settings_clangTidyArgs,
                        checks: {
                            enabled: settings_clangTidyChecksEnabled,
                            disabled: settings_clangTidyChecksDisabled
                        }
                    }
                },
                clang_format_path: settings_clangFormatPath,
                clang_format_style: settings_clangFormatStyle,
                vcFormat: {
                    indent: {
                        braces: settings_indentBraces,
                        multiLineRelativeTo: settings_indentMultiLine,
                        withinParentheses: settings_indentWithinParentheses,
                        preserveWithinParentheses: settings_indentPreserveWithinParentheses,
                        caseLabels: settings_indentCaseLabels,
                        caseContents: settings_indentCaseContents,
                        caseContentsWhenBlock: settings_indentCaseContentsWhenBlock,
                        lambdaBracesWhenParameter: settings_indentLambdaBracesWhenParameter,
                        gotoLabels: settings_indentGotoLabels,
                        preprocessor: settings_indentPreprocessor,
                        accesSpecifiers: settings_indentAccessSpecifiers,
                        namespaceContents: settings_indentNamespaceContents,
                        preserveComments: settings_indentPreserveComments
                    },
                    newLine: {
                        beforeOpenBrace: {
                            namespace: settings_newLineBeforeOpenBraceNamespace,
                            type: settings_newLineBeforeOpenBraceType,
                            function: settings_newLineBeforeOpenBraceFunction,
                            block: settings_newLineBeforeOpenBraceBlock,
                            lambda: settings_newLineBeforeOpenBraceLambda
                        },
                        scopeBracesOnSeparateLines: settings_newLineScopeBracesOnSeparateLines,
                        closeBraceSameLine: {
                            emptyType: settings_newLineCloseBraceSameLineEmptyType,
                            emptyFunction: settings_newLineCloseBraceSameLineEmptyFunction
                        },
                        beforeCatch: settings_newLineBeforeCatch,
                        beforeElse: settings_newLineBeforeElse,
                        beforeWhileInDoWhile: settings_newLineBeforeWhileInDoWhile

                    },
                    space: {
                        beforeFunctionOpenParenthesis: settings_spaceBeforeFunctionOpenParenthesis,
                        withinParameterListParentheses: settings_spaceWithinParameterListParentheses,
                        betweenEmptyParameterListParentheses: settings_spaceBetweenEmptyParameterListParentheses,
                        afterKeywordsInControlFlowStatements: settings_spaceAfterKeywordsInControlFlowStatements,
                        withinControlFlowStatementParentheses: settings_spaceWithinControlFlowStatementParentheses,
                        beforeLambdaOpenParenthesis: settings_spaceBeforeLambdaOpenParenthesis,
                        withinCastParentheses: settings_spaceWithinCastParentheses,
                        afterCastCloseParenthesis: settings_spaceSpaceAfterCastCloseParenthesis,
                        withinExpressionParentheses: settings_spaceWithinExpressionParentheses,
                        beforeBlockOpenBrace: settings_spaceBeforeBlockOpenBrace,
                        betweenEmptyBraces: settings_spaceBetweenEmptyBraces,
                        beforeInitializerListOpenBrace: settings_spaceBeforeInitializerListOpenBrace,
                        withinInitializerListBraces: settings_spaceWithinInitializerListBraces,
                        preserveInInitializerList: settings_spacePreserveInInitializerList,
                        beforeOpenSquareBracket: settings_spaceBeforeOpenSquareBracket,
                        withinSquareBrackets: settings_spaceWithinSquareBrackets,
                        beforeEmptySquareBrackets: settings_spaceBeforeEmptySquareBrackets,
                        betweenEmptySquareBrackets: settings_spaceBetweenEmptySquareBrackets,
                        groupSquareBrackets: settings_spaceGroupSquareBrackets,
                        withinLambdaBrackets: settings_spaceWithinLambdaBrackets,
                        betweenEmptyLambdaBrackets: settings_spaceBetweenEmptyLambdaBrackets,
                        beforeComma: settings_spaceBeforeComma,
                        afterComma: settings_spaceAfterComma,
                        removeAroundMemberOperators: settings_spaceRemoveAroundMemberOperators,
                        beforeInheritanceColon: settings_spaceBeforeInheritanceColon,
                        beforeConstructorColon: settings_spaceBeforeConstructorColon,
                        removeBeforeSemicolon: settings_spaceRemoveBeforeSemicolon,
                        insertAfterSemicolon: settings_spaceInsertAfterSemicolon,
                        removeAroundUnaryOperator: settings_spaceRemoveAroundUnaryOperator,
                        aroundBinaryOperator: settings_spaceAroundBinaryOperator,
                        aroundAssignmentOperator: settings_spaceAroundAssignmentOperator,
                        pointerReferenceAlignment: settings_spacePointerReferenceAlignment,
                        aroundTernaryOperator: settings_spaceAroundTernaryOperator
                    },
                    wrap: {
                        preserveBlocks: settings_wrapPreserveBlocks
                    }
                },
                clang_format_fallbackStyle: settings_clangFormatFallbackStyle,
                clang_format_sortIncludes: settings_clangFormatSortIncludes,
                extension_path: util.extensionPath,
                files: {
                    encoding: settings_filesEncoding,
                    autoSaveAfterDelay: settings_filesAutoSaveAfterDelay
                },
                editor: {
                    autoClosingBrackets: settings_editorAutoClosingBrackets
                },
                workspace_fallback_encoding: workspaceOtherSettings.filesEncoding,
                cpp_exclude_files: settings_cppFilesExclude,
                exclude_files: settings_filesExclude,
                exclude_search: settings_searchExclude,
                associations: workspaceOtherSettings.filesAssociations,
                storage_path: this.storagePath,
                intelliSenseEngine: settings_intelliSenseEngine,
                intelliSenseEngineFallback: settings_intelliSenseEngineFallback,
                intelliSenseCacheDisabled: intelliSenseCacheDisabled,
                intelliSenseCachePath: settings_intelliSenseCachePath,
                intelliSenseCacheSize: settings_intelliSenseCacheSize,
                intelliSenseMemoryLimit: settings_intelliSenseMemoryLimit,
                intelliSenseUpdateDelay: workspaceSettings.intelliSenseUpdateDelay,
                autocomplete: settings_autocomplete,
                autocompleteAddParentheses: settings_autocompleteAddParentheses,
                errorSquiggles: settings_errorSquiggles,
                dimInactiveRegions: settings_dimInactiveRegions,
                enhancedColorization: settings_enhancedColorization,
                suggestSnippets: settings_suggestSnippets,
                simplifyStructuredComments: workspaceSettings.simplifyStructuredComments,
                loggingLevel: workspaceSettings.loggingLevel,
                workspaceParsingPriority: workspaceSettings.workspaceParsingPriority,
                workspaceSymbols: workspaceSettings.workspaceSymbols,
                exclusionPolicy: settings_exclusionPolicy,
                preferredPathSeparator: settings_preferredPathSeparator,
                default: {
                    systemIncludePath: settings_defaultSystemIncludePath
                },
                vcpkg_root: util.getVcpkgRoot(),
                experimentalFeatures: workspaceSettings.experimentalFeatures,
                edgeMessagesDirectory: path.join(util.getExtensionFilePath("bin"), "messages", util.getLocaleId()),
                localizedStrings: localizedStrings,
                packageVersion: util.packageJson.version
            },
            middleware: createProtocolFilter(allClients),
            errorHandler: {
                error: () => ErrorAction.Continue,
                closed: () => {
                    languageClientCrashTimes.push(Date.now());
                    languageClientCrashedNeedsRestart = true;
                    telemetry.logLanguageServerEvent("languageClientCrash");
                    if (languageClientCrashTimes.length < 5) {
                        allClients.forEach(client => { allClients.replace(client, true); });
                    } else {
                        const elapsed: number = languageClientCrashTimes[languageClientCrashTimes.length - 1] - languageClientCrashTimes[0];
                        if (elapsed <= 3 * 60 * 1000) {
                            vscode.window.showErrorMessage(localize('server.crashed2', "The language server crashed 5 times in the last 3 minutes. It will not be restarted."));
                            allClients.forEach(client => { allClients.replace(client, false); });
                        } else {
                            languageClientCrashTimes.shift();
                            allClients.forEach(client => { allClients.replace(client, true); });
                        }
                    }
                    return CloseAction.DoNotRestart;
                }
            }

            // TODO: should I set the output channel?  Does this sort output between servers?
        };

        // Create the language client
        this.loggingLevel = clientOptions.initializationOptions.loggingLevel;
        return new LanguageClient(`cpptools`, serverOptions, clientOptions);
    }