public sendAllSettings()

in Extension/src/LanguageServer/client.ts [1517:1596]


    public sendAllSettings(): void {
        const cppSettingsScoped: { [key: string]: any } = {};
        // Gather the C_Cpp settings
        {
            const cppSettingsResourceScoped: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp", this.RootUri);
            const cppSettingsNonScoped: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp");

            for (const key in cppSettingsResourceScoped) {
                const curSetting: any = util.packageJson.contributes.configuration.properties["C_Cpp." + key];
                if (curSetting === undefined) {
                    continue;
                }
                const settings: vscode.WorkspaceConfiguration = (curSetting.scope === "resource" || curSetting.scope === "machine-overridable") ? cppSettingsResourceScoped : cppSettingsNonScoped;
                cppSettingsScoped[key] = settings.get(key);
            }
            cppSettingsScoped["default"] = { systemIncludePath: cppSettingsResourceScoped.get("default.systemIncludePath") };
        }

        const otherSettingsFolder: OtherSettings = new OtherSettings(this.RootUri);
        const otherSettingsWorkspace: OtherSettings = new OtherSettings();
        const clangTidyConfig: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("C_Cpp.codeAnalysis.clangTidy", this.RootUri);

        // Unlike the LSP message, the event does not contain all settings as a payload, so we need to
        // build a new JSON object with everything we need on the native side.
        const settings: any = {
            C_Cpp: {
                ...cppSettingsScoped,
                clang_format_path: util.resolveVariables(cppSettingsScoped.clang_format_path, this.AdditionalEnvironment),
                intelliSenseCachePath: util.resolveCachePath(cppSettingsScoped.intelliSenseCachePath, this.AdditionalEnvironment),
                codeAnalysis: {
                    ...vscode.workspace.getConfiguration("C_Cpp.codeAnalysis", this.RootUri),
                    clangTidy: {
                        ...clangTidyConfig,
                        path: util.resolveVariables(clangTidyConfig.path, this.AdditionalEnvironment),
                        fix: {
                            ...vscode.workspace.getConfiguration("C_Cpp.codeAnalysis.clangTidy.fix", this.RootUri)
                        },
                        checks: {
                            ...vscode.workspace.getConfiguration("C_Cpp.codeAnalysis.clangTidy.checks", this.RootUri)
                        }
                    }
                },
                files: {
                    exclude: vscode.workspace.getConfiguration("C_Cpp.files.exclude", this.RootUri)
                },
                intelliSense: {
                    ...vscode.workspace.getConfiguration("C_Cpp.intelliSense", this.RootUri)
                },
                references: {
                    ...vscode.workspace.getConfiguration("C_Cpp.references", this.RootUri)
                },
                vcFormat: {
                    ...vscode.workspace.getConfiguration("C_Cpp.vcFormat", this.RootUri),
                    indent: vscode.workspace.getConfiguration("C_Cpp.vcFormat.indent", this.RootUri),
                    newLine: {
                        ...vscode.workspace.getConfiguration("C_Cpp.vcFormat.newLine", this.RootUri),
                        beforeOpenBrace: vscode.workspace.getConfiguration("C_Cpp.vcFormat.newLine.beforeOpenBrace", this.RootUri),
                        closeBraceSameLine: vscode.workspace.getConfiguration("C_Cpp.vcFormat.newLine.closeBraceSameLine", this.RootUri)
                    },
                    space: vscode.workspace.getConfiguration("C_Cpp.vcFormat.space", this.RootUri),
                    wrap: vscode.workspace.getConfiguration("C_Cpp.vcFormat.wrap", this.RootUri)
                }
            },
            editor: {
                autoClosingBrackets: otherSettingsFolder.editorAutoClosingBrackets
            },
            files: {
                encoding: otherSettingsFolder.filesEncoding,
                exclude: vscode.workspace.getConfiguration("files.exclude", this.RootUri),
                associations: new OtherSettings().filesAssociations,
                autoSaveAfterDelay: otherSettingsFolder.filesAutoSaveAfterDelay
            },
            workspace_fallback_encoding: otherSettingsWorkspace.filesEncoding,
            search: {
                exclude: vscode.workspace.getConfiguration("search.exclude", this.RootUri)
            }
        };

        this.sendDidChangeSettings(settings);
    }