diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/codeactions/GenerateStandardRegionsSupplier.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/codeactions/GenerateStandardRegionsSupplier.java index e8d18b29a8a..55983bbc3b2 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/codeactions/GenerateStandardRegionsSupplier.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/codeactions/GenerateStandardRegionsSupplier.java @@ -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; @@ -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; @@ -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();