Skip to content

Commit

Permalink
Определение языка областей исправлено на настройки language server
Browse files Browse the repository at this point in the history
  • Loading branch information
EightM committed Sep 14, 2020
1 parent eb830d9 commit 94f3ea9
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
package com.github._1c_syntax.bsl.languageserver.codeactions;

import com.github._1c_syntax.bsl.languageserver.configuration.Language;
import com.github._1c_syntax.bsl.languageserver.configuration.LanguageServerConfiguration;
import com.github._1c_syntax.bsl.languageserver.context.DocumentContext;
import com.github._1c_syntax.bsl.languageserver.context.FileType;
Expand All @@ -37,6 +38,7 @@
import org.eclipse.lsp4j.Range;
import org.eclipse.lsp4j.TextEdit;
import org.eclipse.lsp4j.WorkspaceEdit;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
Expand Down Expand Up @@ -117,13 +119,24 @@ private ScriptVariant getRegionsLanguage(DocumentContext documentContext, FileTy
ScriptVariant regionsLanguage;
Configuration configuration = documentContext.getServerContext().getConfiguration();
if (configuration.getConfigurationSource() == ConfigurationSource.EMPTY || fileType == FileType.OS) {
regionsLanguage = ScriptVariant.RUSSIAN;
regionsLanguage = getScriptVariantFromConfigLanguage();
} else {
regionsLanguage = documentContext.getServerContext().getConfiguration().getScriptVariant();
}
return regionsLanguage;
}

@NotNull
private ScriptVariant getScriptVariantFromConfigLanguage() {
ScriptVariant regionsLanguage;
if (languageServerConfiguration.getLanguage() == Language.EN) {
regionsLanguage = ScriptVariant.ENGLISH;
} else {
regionsLanguage = ScriptVariant.RUSSIAN;
}
return regionsLanguage;
}

private Range calculateFixRange(Range range) {

Position start = range.getStart();
Expand Down

0 comments on commit 94f3ea9

Please sign in to comment.