From fff4668b1017d556a639bcd7ed8c54714a70dc68 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Fri, 27 Dec 2024 16:40:16 +0100 Subject: [PATCH] Fix QF --- .../hover/DescriptionFormatter.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java index 1eccad44d8..277aac1ef0 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java @@ -34,6 +34,7 @@ import org.eclipse.lsp4j.SymbolKind; import org.springframework.stereotype.Component; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -124,7 +125,7 @@ public String getCallOptionsSection(MethodSymbol methodSymbol) { return getSectionWithCodeFences(callOptions, CALL_OPTIONS_KEY); } - public String getSectionWithCodeFences(List codeBlocks, String resourceKey) { + public String getSectionWithCodeFences(Collection codeBlocks, String resourceKey) { String codeFences = codeBlocks .stream() .map(codeBlock -> "```bsl\n" + codeBlock + "\n```") @@ -169,7 +170,7 @@ public String getLocation(VariableSymbol symbol) { } public String getSignature(MethodSymbol methodSymbol) { - String signatureTemplate = "```bsl\n%s %s(%s)%s%s\n```"; + var signatureTemplate = "```bsl\n%s %s(%s)%s%s\n```"; String methodKind; if (methodSymbol.isFunction()) { @@ -194,10 +195,10 @@ public String getSignature(MethodSymbol methodSymbol) { } public String getSignature(AnnotationSymbol symbol, MethodSymbol methodSymbol) { - String signatureTemplate = "```bsl\n%s &%s(%s)\n```"; + var signatureTemplate = "```bsl\n%s &%s(%s)\n```"; - String annotationKind = getResourceString(ANNOTATION_KEY); - String annotationName = symbol.getName(); + var annotationKind = getResourceString(ANNOTATION_KEY); + var annotationName = symbol.getName(); var parameters = getParametersDescriptionPart(methodSymbol); @@ -210,11 +211,11 @@ public String getSignature(AnnotationSymbol symbol, MethodSymbol methodSymbol) { } public String getSignature(VariableSymbol symbol) { - String signatureTemplate = "```bsl\n%s %s%s\n```"; + var signatureTemplate = "```bsl\n%s %s%s\n```"; - String varKey = getResourceString(VARIABLE_KEY); - String name = symbol.getName(); - String export = symbol.isExport() ? (" " + getResourceString(EXPORT_KEY)) : ""; + var varKey = getResourceString(VARIABLE_KEY); + var name = symbol.getName(); + var export = symbol.isExport() ? (" " + getResourceString(EXPORT_KEY)) : ""; return String.format( signatureTemplate, @@ -292,7 +293,7 @@ public String parameterToString(ParameterDescription parameter, int level) { } public String parameterToString(ParameterDefinition parameterDefinition) { - int level = 0; + var level = 0; var parameterDescription = parameterDefinition.getDescription(); if (parameterDescription.isPresent()) { return parameterToString(parameterDescription.get(), level); @@ -318,7 +319,7 @@ private Map typesToMap(List parameterTypes, int return types; } - private String typesMapToString(Map types, int level) { + private static String typesMapToString(Map types, int level) { var result = new StringJoiner(" \n"); // два пробела var indent = "  ".repeat(level); types.forEach((String key, String value) -> {