<commit_before>import * as vscode from 'vscode';
import * as json from 'load-json-file';
import ConfigurationDependentGunController from './ConfigurationDependentGunController';
import ConfigurationProvider from './ConfigurationProvider';
import path = require('path');


export default class SyntaxHighlightingGunController extends ConfigurationDependentGunController {
    private initialSettings = (new class {
        private tokenColorCustomizations : any;

        store(configuration : vscode.WorkspaceConfiguration) {
            this.tokenColorCustomizations = configuration.get("editor.tokenColorCustomizations");
        }

        restore(configuration : vscode.WorkspaceConfiguration) {
            configuration.update("editor.tokenColorCustomizations", this.tokenColorCustomizations);
        }
    })

    constructor(configurationProvider : ConfigurationProvider) {
        super(configurationProvider);
    }

    takeTheGunWithConfigurationCore(configuration : vscode.WorkspaceConfiguration) {
        this.initialSettings.store(configuration);

        let currentThemeId = configuration.get<string>("workbench.colorTheme");
        configuration.update("editor.tokenColorCustomizations", this.createTokenColorCustomizations(currentThemeId));
    }

    giveTheGunBackWithConfigurationCore(configuration : vscode.WorkspaceConfiguration) {
        this.initialSettings.restore(configuration);
    }

    private createTokenColorCustomizations(currentThemeId : string) {
        let editorForegroundColor = this.getEditorForegroundColor(currentThemeId);

        let textMateRules =
            SyntaxHighlightingGunController.getCSharpTokenColorCustomizations()
                .concat(SyntaxHighlightingGunController.getTypescriptTokenColorCustomizations())
                .map(scopeName => ({
                    scope: scopeName,
                    settings: {
                        foreground: editorForegroundColor
                    }
                }));

        return {
            comments : editorForegroundColor,
            functions : editorForegroundColor,
            keywords : editorForegroundColor,
            numbers : editorForegroundColor,
            strings: editorForegroundColor,
            types : editorForegroundColor,
            variables : editorForegroundColor,
            textMateRules : textMateRules
        };
    }

    // TODO-IG: Make these token customizations configurable.
    // Or even better, is it possible to get them dynamically in the extension itself?<commit_msg>feat: Removes font styles from syntax highlighting<commit_after>import * as vscode from 'vscode';
import * as json from 'load-json-file';
import ConfigurationDependentGunController from './ConfigurationDependentGunController';
import ConfigurationProvider from './ConfigurationProvider';
import path = require('path');


export default class SyntaxHighlightingGunController extends ConfigurationDependentGunController {
    private initialSettings = (new class {
        private tokenColorCustomizations : any;

        store(configuration : vscode.WorkspaceConfiguration) {
            this.tokenColorCustomizations = configuration.get("editor.tokenColorCustomizations");
        }

        restore(configuration : vscode.WorkspaceConfiguration) {
            configuration.update("editor.tokenColorCustomizations", this.tokenColorCustomizations);
        }
    })

    constructor(configurationProvider : ConfigurationProvider) {
        super(configurationProvider);
    }

    takeTheGunWithConfigurationCore(configuration : vscode.WorkspaceConfiguration) {
        this.initialSettings.store(configuration);

        let currentThemeId = configuration.get<string>("workbench.colorTheme");
        configuration.update("editor.tokenColorCustomizations", this.createTokenColorCustomizations(currentThemeId));
    }

    giveTheGunBackWithConfigurationCore(configuration : vscode.WorkspaceConfiguration) {
        this.initialSettings.restore(configuration);
    }

    private createTokenColorCustomizations(currentThemeId : string) {
        let editorForegroundColor = this.getEditorForegroundColor(currentThemeId);

        let textMateRules =
            SyntaxHighlightingGunController.getCSharpTokenColorCustomizations()
                .concat(SyntaxHighlightingGunController.getTypescriptTokenColorCustomizations())
                .map(scopeName => ({
                    scope: scopeName,
                    settings: {
                        foreground: editorForegroundColor,
                        fontStyle : ""
                    }
                }));

        return {
            comments : editorForegroundColor,
            functions : editorForegroundColor,
            keywords : editorForegroundColor,
            numbers : editorForegroundColor,
            strings: editorForegroundColor,
            types : editorForegroundColor,
            variables : editorForegroundColor,
            textMateRules : textMateRules
        };
    }

    // TODO-IG: Make these token customizations configurable.
    // Or even better, is it possible to get them dynamically in the extension itself?
{'fraction_non_alphanumeric': 0.07111024995155978, 'fraction_numerical': 0.0, 'mean_word_length': 3.0139968895800933, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '916772', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1117, 'n_words': 224}