<commit_before>/*
 * Copyright (C) 2017 Ericsson and others.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 */

import { interfaces } from "inversify";
import {
    createPreferenceProxy,
    PreferenceContribution,
    PreferenceProxy,
    PreferenceService,
} from '@theia/preferences/lib/common';

export interface EditorConfiguration {
    'editor.tabSize': number,
    'editor.lineNumbers': 'on' | 'off'
    'editor.renderWhitespace': 'none' | 'boundary' | 'all'
}

export const defaultEditorConfiguration: EditorConfiguration = {
    'editor.tabSize': 4,
    'editor.lineNumbers': 'on',
    'editor.renderWhitespace': 'none'

}

export const EditorPreferences = Symbol('EditorPreferences');
export type EditorPreferences = PreferenceProxy<EditorConfiguration>;

export function createEditorPreferences(preferences: PreferenceService): EditorPreferences {
    return createPreferenceProxy(preferences, defaultEditorConfiguration);
}

export function bindEditorPreferences(bind: interfaces.Bind): void {
    bind(EditorPreferences).toDynamicValue(ctx => {
        const preferences = ctx.container.get(PreferenceService);
        return createEditorPreferences(preferences);
    });

    bind(PreferenceContribution).toConstantValue({
        preferences: [{
            name: 'editor.tabSize',
            defaultValue: defaultEditorConfiguration['editor.tabSize'],
            description: "Configure the tab size in the monaco editor"
        },
        {
            name: 'editor.lineNumbers',
            defaultValue: defaultEditorConfiguration['editor.lineNumbers'],
            description: "Control the rendering of line numbers"
        },
        {
            name: 'editor.renderWhitespace',
            defaultValue: defaultEditorConfiguration['editor.lineNumbers'],
            description: "Control the rendering of whitespaces in the editor"
        }]
    });
}<commit_msg>[Preferences] Fix editor whitespace default preference<commit_after>/*
 * Copyright (C) 2017 Ericsson and others.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 */

import { interfaces } from "inversify";
import {
    createPreferenceProxy,
    PreferenceContribution,
    PreferenceProxy,
    PreferenceService,
} from '@theia/preferences/lib/common';

export interface EditorConfiguration {
    'editor.tabSize': number,
    'editor.lineNumbers': 'on' | 'off'
    'editor.renderWhitespace': 'none' | 'boundary' | 'all'
}

export const defaultEditorConfiguration: EditorConfiguration = {
    'editor.tabSize': 4,
    'editor.lineNumbers': 'on',
    'editor.renderWhitespace': 'none'

}

export const EditorPreferences = Symbol('EditorPreferences');
export type EditorPreferences = PreferenceProxy<EditorConfiguration>;

export function createEditorPreferences(preferences: PreferenceService): EditorPreferences {
    return createPreferenceProxy(preferences, defaultEditorConfiguration);
}

export function bindEditorPreferences(bind: interfaces.Bind): void {
    bind(EditorPreferences).toDynamicValue(ctx => {
        const preferences = ctx.container.get(PreferenceService);
        return createEditorPreferences(preferences);
    });

    bind(PreferenceContribution).toConstantValue({
        preferences: [{
            name: 'editor.tabSize',
            defaultValue: defaultEditorConfiguration['editor.tabSize'],
            description: "Configure the tab size in the monaco editor"
        },
        {
            name: 'editor.lineNumbers',
            defaultValue: defaultEditorConfiguration['editor.lineNumbers'],
            description: "Control the rendering of line numbers"
        },
        {
            name: 'editor.renderWhitespace',
            defaultValue: defaultEditorConfiguration['editor.renderWhitespace'],
            description: "Control the rendering of whitespaces in the editor"
        }]
    });
}
{'fraction_non_alphanumeric': 0.10028653295128939, 'fraction_numerical': 0.004297994269340974, 'mean_word_length': 3.6441241685144123, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '523072', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1036, 'n_words': 279}