From 94f3ea94fc7ca9c6828c58c98b318728b990690b Mon Sep 17 00:00:00 2001 From: VAGukov Date: Mon, 14 Sep 2020 19:24:23 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=8F=D0=B7=D1=8B=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=BB=D0=B0=D1=81=D1=82=D0=B5=D0=B9=20=D0=B8=D1=81?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20lan?= =?UTF-8?q?guage=20server?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GenerateStandardRegionsSupplier.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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();