From dd09dcc3318488be5fc2585d7263194d3577985f Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Fri, 12 Jan 2024 07:38:45 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B4=D0=B8=D0=BD=D0=B0=D0=BC=D0=B8=D1=87=D0=B5?= =?UTF-8?q?=D1=81=D0=BA=D0=B8=D1=85=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D1=85=20=D0=B2=20=D0=B4=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D0=B5=20=D1=81=D0=B8=D0=BC=D0=B2=D0=BE=D0=BB=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bsl/languageserver/providers/DocumentSymbolProvider.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProvider.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProvider.java index 7a0b3311d64..e62aecb7f8b 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProvider.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProvider.java @@ -45,6 +45,7 @@ public final class DocumentSymbolProvider { private static final Set supportedVariableKinds = EnumSet.of( VariableKind.MODULE, + VariableKind.LOCAL, VariableKind.GLOBAL ); @@ -64,6 +65,7 @@ private static DocumentSymbol toDocumentSymbol(SourceDefinedSymbol symbol) { ); List children = symbol.getChildren().stream() + .filter(DocumentSymbolProvider::isSupported) .map(DocumentSymbolProvider::toDocumentSymbol) .collect(Collectors.toList()); From 16575174a764f17e3f0b2c366b16311d7f7864ce Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Fri, 12 Jan 2024 07:39:34 +0100 Subject: [PATCH 2/2] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D0=BE=20?= =?UTF-8?q?=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D1=81?= =?UTF-8?q?=D0=B5=D0=B3=D0=B4=D0=B0=20=D0=BF=D1=83=D1=81=D1=82=D0=BE=D0=B9?= =?UTF-8?q?=20=D0=BA=D0=BE=D0=BB=D0=BB=D0=B5=D0=BA=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=B4=D0=B5=D1=82=D0=B5=D0=B9=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D1=8B=D1=85,=20=D0=BE=D0=BF=D1=82=D0=B8?= =?UTF-8?q?=D0=BC=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D0=B7=D1=83=D0=B5=D0=BC=D0=BE=D0=B9=20=D0=BF?= =?UTF-8?q?=D0=B0=D0=BC=D1=8F=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../symbol/AbstractVariableSymbol.java | 19 ++++++------------- .../symbol/IntBasedVariableSymbol.java | 4 +--- .../symbol/ShortBasedVariableSymbol.java | 4 +--- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java index 51c641e636b..529b33fb768 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java @@ -46,7 +46,7 @@ @NonFinal @Builder(builderClassName = "Builder") @EqualsAndHashCode(onlyExplicitlyIncluded = true) -@ToString(exclude = {"children", "parent"}) +@ToString(exclude = {"parent"}) public abstract class AbstractVariableSymbol implements VariableSymbol { /** @@ -74,12 +74,6 @@ public abstract class AbstractVariableSymbol implements VariableSymbol { @NonFinal Optional parent; - /** - * Список "детей" символа - символов, которые располагаются внутри данного символа. - */ - @Getter - List children; - /** * Тип переменной. */ @@ -95,6 +89,11 @@ public abstract class AbstractVariableSymbol implements VariableSymbol { */ Optional description; + @Override + public List getChildren() { + return Collections.emptyList(); + } + @Override public SymbolKind getSymbolKind() { return SymbolKind.Variable; @@ -129,10 +128,6 @@ public static class Builder { @Accessors(fluent = true, chain = true) Optional parent = Optional.empty(); - @Setter - @Accessors(fluent = true, chain = true) - List children = Collections.emptyList(); - private int startLine; private int startCharacter; private int endLine; @@ -179,7 +174,6 @@ public VariableSymbol build() { scope, owner, parent, - children, (byte) kind.ordinal(), export, description, @@ -197,7 +191,6 @@ public VariableSymbol build() { scope, owner, parent, - children, (byte) kind.ordinal(), export, description, diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.java index 21ca99c4d5a..977d18ba6eb 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.java @@ -32,7 +32,6 @@ import lombok.experimental.NonFinal; import org.eclipse.lsp4j.Range; -import java.util.List; import java.util.Optional; /** @@ -65,7 +64,6 @@ public IntBasedVariableSymbol( SourceDefinedSymbol scope, DocumentContext owner, Optional parent, - List children, byte kind, boolean export, Optional description, @@ -77,7 +75,7 @@ public IntBasedVariableSymbol( int variableNameStartCharacter, int variableNameEndCharacter ) { - super(name, scope, owner, parent, children, kind, export, description); + super(name, scope, owner, parent, kind, export, description); this.startLine = startLine; this.startCharacter = startCharacter; diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java index 974469623db..854661b50b8 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java @@ -32,7 +32,6 @@ import lombok.experimental.NonFinal; import org.eclipse.lsp4j.Range; -import java.util.List; import java.util.Optional; /** @@ -65,7 +64,6 @@ public ShortBasedVariableSymbol( SourceDefinedSymbol scope, DocumentContext owner, Optional parent, - List children, byte kind, boolean export, Optional description, @@ -77,7 +75,7 @@ public ShortBasedVariableSymbol( short variableNameStartCharacter, short variableNameEndCharacter ) { - super(name, scope, owner, parent, children, kind, export, description); + super(name, scope, owner, parent, kind, export, description); this.startLine = startLine; this.startCharacter = startCharacter;