aboutsummaryrefslogtreecommitdiffstats
path: root/integration/intellij/src/main/java/ai/vespa/intellij/schema/SdLanguageCodeStyleSettingsProvider.java
blob: afc7f4b946efb99684c2ab70f11d92574307eb31 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.intellij.schema;

import com.intellij.lang.Language;
import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable;
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;

/**
 * This class is used for the extension (in plugin.xml), to make the IDE use our plugin's code for coding style.
 *
 * @author Shahar Ariel
 */
public class SdLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSettingsProvider {
    
    @Override
    public Language getLanguage() {
        return SdLanguage.INSTANCE;
    }
    
    @Override
    public void customizeSettings(CodeStyleSettingsCustomizable consumer, SettingsType settingsType) {
        if (settingsType == SettingsType.SPACING_SETTINGS) {
            consumer.showStandardOptions("SPACE_AFTER_COLON");
//            consumer.renameStandardOption("SPACE_AROUND_ASSIGNMENT_OPERATORS", "Separator");
        } else if (settingsType == SettingsType.BLANK_LINES_SETTINGS) {
            consumer.showStandardOptions("KEEP_BLANK_LINES_IN_CODE");
//        } else if (settingsType == SettingsType.INDENT_SETTINGS) {
//            consumer.showStandardOptions("USE_RELATIVE_INDENTS");
        }
    }
    
    @Override
    public String getCodeSample(SettingsType settingsType) {
        return "field myField type int {\n    indexing: summary\n}";
    }
    
}