diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java index 0fd1d55c87e..ea4b58c43f4 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java @@ -89,6 +89,10 @@ public ParseTree visitFunction(BSLParser.FunctionContext ctx) { return ctx; } + if (!declaration.annotation().isEmpty()) { + startNode = declaration.annotation().get(0).AMPERSAND(); + } + MethodSymbol methodSymbol = createMethodSymbol( startNode, stopNode, @@ -119,6 +123,10 @@ public ParseTree visitProcedure(BSLParser.ProcedureContext ctx) { return ctx; } + if (!declaration.annotation().isEmpty()) { + startNode = declaration.annotation().get(0).AMPERSAND(); + } + MethodSymbol methodSymbol = createMethodSymbol( startNode, stopNode, diff --git a/src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java b/src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java index 339f8f752af..6865eca7aae 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java @@ -44,18 +44,24 @@ void prepare() { var documentContext = TestUtils.getDocumentContextFromFile("./src/test/resources/context/symbol/MethodDescription.bsl"); var methods = documentContext.getSymbolTree().getMethods(); - assertThat(methods.size()).isEqualTo(14); + assertThat(methods).hasSize(15); methodsWithDescription = methods.stream() .map(MethodSymbol::getDescription) .filter(Optional::isPresent) .map(Optional::get) - .collect(Collectors.toList()); + .toList(); - assertThat(methodsWithDescription.size()).isEqualTo(13); + assertThat(methodsWithDescription.size()).isEqualTo(14); } } + @Test + void testMethodWithAnnotation() { + var method = methodsWithDescription.get(13); + assertThat(method.getDescription()).isEqualTo("// Описание процедуры"); + } + @Test void testMethod13() { var method = methodsWithDescription.get(12); diff --git a/src/test/resources/context/symbol/MethodDescription.bsl b/src/test/resources/context/symbol/MethodDescription.bsl index 1abed2994d4..0fa49e789be 100644 --- a/src/test/resources/context/symbol/MethodDescription.bsl +++ b/src/test/resources/context/symbol/MethodDescription.bsl @@ -143,3 +143,8 @@ // Функция BUG_1495(Ссылки, Знач Реквизиты, ВыбратьРазрешенные = Ложь) Экспорт КонецФункции + +// Описание процедуры +&Аннотация("Параметр") +Процедура ПроцедураСАннотацией() +КонецПроцедуры