<commit_before>import * as vscode from 'vscode'
import {DeprecatedConfiguration} from './configurationlib/deprecated'
import type {Extension} from '../main'

export class Configuration {
    private readonly extension: Extension
    private readonly deprecatedConfiguration: DeprecatedConfiguration

    constructor(extension: Extension) {
        this.extension = extension
        this.logConfiguration()
        vscode.workspace.onDidChangeConfiguration((ev) => {
            this.logChangeOnConfiguration(ev)
        })
        this.deprecatedConfiguration = new DeprecatedConfiguration(extension)
        this.deprecatedConfiguration.check()
    }

    private readonly configurationsToLog = [
        'editor.acceptSuggestionOnEnter',
        'latex-workshop.bind.enter.key',
        'latex-workshop.docker.enabled',
        'latex-workshop.docker.image.latex',
        'latex-workshop.hover.preview.mathjax.extensions',
        'latex-workshop.intellisense.package.enabled',
        'latex-workshop.intellisense.update.aggressive.enabled',
        'latex-workshop.intellisense.update.delay',
        'latex-workshop.latex.autoBuild.run',
        'latex-workshop.latex.build.forceRecipeUsage',
        'latex-workshop.latex.outDir',
        'latex-workshop.latex.recipes',
        'latex-workshop.latex.tools',
        'latex-workshop.viewer.pdf.internal.keyboardEvent'
    ]

    private logConfiguration() {
        const configuration = vscode.workspace.getConfiguration()
        for(const config of this.configurationsToLog) {
            const value = configuration.get(config)
            this.extension.logger.addLogMessage(`${config}: ${JSON.stringify(value, null, ' ')}`)
        }
    }

    private logChangeOnConfiguration(ev: vscode.ConfigurationChangeEvent) {
        for(const config of this.configurationsToLog) {
            if (ev.affectsConfiguration(config)) {
                const configuration = vscode.workspace.getConfiguration()
                const value = configuration.get(config)
                this.extension.logger.addLogMessage(`Configutation changed to { ${config}: ${JSON.stringify(value)} }`)
            }
        }
    }

}
<commit_msg>Log configurations on multi-root workspaces.<commit_after>import * as vscode from 'vscode'
import {DeprecatedConfiguration} from './configurationlib/deprecated'
import type {Extension} from '../main'

export class Configuration {
    private readonly extension: Extension
    private readonly deprecatedConfiguration: DeprecatedConfiguration

    constructor(extension: Extension) {
        this.extension = extension
        this.logConfiguration()
        vscode.workspace.onDidChangeConfiguration((ev) => {
            this.logChangeOnConfiguration(ev)
        })
        this.deprecatedConfiguration = new DeprecatedConfiguration(extension)
        this.deprecatedConfiguration.check()
    }

    private readonly configurationsToLog = [
        'editor.acceptSuggestionOnEnter',
        'latex-workshop.bind.enter.key',
        'latex-workshop.docker.enabled',
        'latex-workshop.docker.image.latex',
        'latex-workshop.hover.preview.mathjax.extensions',
        'latex-workshop.intellisense.package.enabled',
        'latex-workshop.intellisense.update.aggressive.enabled',
        'latex-workshop.intellisense.update.delay',
        'latex-workshop.latex.autoBuild.run',
        'latex-workshop.latex.build.forceRecipeUsage',
        'latex-workshop.latex.outDir',
        'latex-workshop.latex.recipes',
        'latex-workshop.latex.tools',
        'latex-workshop.viewer.pdf.internal.keyboardEvent'
    ]

    private logConfiguration() {
        const workspaceFolders = vscode.workspace.workspaceFolders || [undefined]
        for (const workspace of workspaceFolders) {
            this.extension.logger.addLogMessage(`Workspace for configuration: ${workspace?.uri.toString(true)}`)
            const configuration = vscode.workspace.getConfiguration(undefined, workspace)
            for(const config of this.configurationsToLog) {
                const value = configuration.get(config)
                this.extension.logger.addLogMessage(`${config}: ${JSON.stringify(value, null, ' ')}`)
            }
        }
    }

    private logChangeOnConfiguration(ev: vscode.ConfigurationChangeEvent) {
        const workspaceFolders = vscode.workspace.workspaceFolders || [undefined]
        for(const config of this.configurationsToLog) {
            for (const workspace of workspaceFolders) {
                if (ev.affectsConfiguration(config, workspace)) {
                    const configuration = vscode.workspace.getConfiguration()
                    const value = configuration.get(config)
                    this.extension.logger.addLogMessage(`Configutation changed to { ${config}: ${JSON.stringify(value)} } at ${workspace?.uri.toString(true)}`)
                }
            }
        }
    }

}

{'fraction_non_alphanumeric': 0.10624872786484836, 'fraction_numerical': 0.0, 'mean_word_length': 2.857142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1859602', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1312, 'n_words': 206}