Search in sources :

Example 1 with DEFAULT_LANGUAGE

use of com.github._1c_syntax.bsl.languageserver.configuration.Language.DEFAULT_LANGUAGE in project bsl-language-server by 1c-syntax.

the class LanguageServerConfigurationTest method testPartialInitialization.

@Test
void testPartialInitialization() {
    // given
    File configurationFile = new File(PATH_TO_PARTIAL_CONFIGURATION_FILE);
    configuration.update(configurationFile);
    // when
    CodeLensOptions codeLensOptions = configuration.getCodeLensOptions();
    DiagnosticsOptions diagnosticsOptions = configuration.getDiagnosticsOptions();
    // then
    assertThat(codeLensOptions.isShowCognitiveComplexity()).isTrue();
    assertThat(codeLensOptions.isShowCyclomaticComplexity()).isFalse();
    assertThat(configuration.getLanguage()).isEqualTo(DEFAULT_LANGUAGE);
    assertThat(diagnosticsOptions.getMode()).isEqualTo(Mode.ON);
    assertThat(diagnosticsOptions.getSkipSupport()).isEqualTo(SkipSupport.NEVER);
    assertThat(diagnosticsOptions.getParameters()).isEmpty();
}
Also used : DiagnosticsOptions(com.github._1c_syntax.bsl.languageserver.configuration.diagnostics.DiagnosticsOptions) CodeLensOptions(com.github._1c_syntax.bsl.languageserver.configuration.codelens.CodeLensOptions) File(java.io.File) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with DEFAULT_LANGUAGE

use of com.github._1c_syntax.bsl.languageserver.configuration.Language.DEFAULT_LANGUAGE in project bsl-language-server by 1c-syntax.

the class LanguageServerConfigurationTest method createFromEmptyFile.

@Test
void createFromEmptyFile() {
    // given
    File configurationFile = new File(PATH_TO_EMPTY_CONFIGURATION_FILE);
    // when
    configuration.update(configurationFile);
    // then
    DiagnosticsOptions diagnosticsOptions = configuration.getDiagnosticsOptions();
    Language language = configuration.getLanguage();
    Map<String, Either<Boolean, Map<String, Object>>> parameters = diagnosticsOptions.getParameters();
    assertThat(language).isEqualTo(DEFAULT_LANGUAGE);
    assertThat(parameters).isEmpty();
}
Also used : DiagnosticsOptions(com.github._1c_syntax.bsl.languageserver.configuration.diagnostics.DiagnosticsOptions) Either(org.eclipse.lsp4j.jsonrpc.messages.Either) File(java.io.File) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

DiagnosticsOptions (com.github._1c_syntax.bsl.languageserver.configuration.diagnostics.DiagnosticsOptions)2 File (java.io.File)2 Test (org.junit.jupiter.api.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 CodeLensOptions (com.github._1c_syntax.bsl.languageserver.configuration.codelens.CodeLensOptions)1 Either (org.eclipse.lsp4j.jsonrpc.messages.Either)1