Skip to content

Commit 206f90a

Browse files
committed
Добавление в symbol api информации о deprecated
1 parent 8e300cb commit 206f90a

File tree

3 files changed

+6
-22
lines changed

3 files changed

+6
-22
lines changed

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/Symbol.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public interface Symbol {
4545

4646
List<Symbol> getChildren();
4747

48+
default boolean isDeprecated() {
49+
return false;
50+
}
51+
4852
default Optional<Symbol> getRootParent() {
4953
return getParent().flatMap(Symbol::getRootParent).or(() -> Optional.of(this));
5054
}

src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DocumentSymbolProvider.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private static DocumentSymbol toDocumentSymbol(Symbol symbol) {
5757
.map(DocumentSymbolProvider::toDocumentSymbol)
5858
.collect(Collectors.toList());
5959

60-
documentSymbol.setDeprecated(isDeprecated(symbol));
60+
documentSymbol.setDeprecated(symbol.isDeprecated());
6161
documentSymbol.setChildren(children);
6262

6363
return documentSymbol;
@@ -77,13 +77,4 @@ private static Range getSelectionRange(Symbol symbol) {
7777
return selectionRange;
7878
}
7979

80-
private static boolean isDeprecated(Symbol symbol) {
81-
boolean deprecated;
82-
if (symbol instanceof MethodSymbol) {
83-
deprecated = ((MethodSymbol) symbol).isDeprecated();
84-
} else {
85-
deprecated = false;
86-
}
87-
return deprecated;
88-
}
8980
}

src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SymbolProvider.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
import com.github._1c_syntax.bsl.languageserver.context.DocumentContext;
2525
import com.github._1c_syntax.bsl.languageserver.context.ServerContext;
26-
import com.github._1c_syntax.bsl.languageserver.context.symbol.MethodSymbol;
2726
import com.github._1c_syntax.bsl.languageserver.context.symbol.Symbol;
2827
import com.github._1c_syntax.bsl.languageserver.context.symbol.VariableSymbol;
2928
import com.github._1c_syntax.bsl.languageserver.context.symbol.variable.VariableKind;
@@ -77,16 +76,6 @@ private static Stream<Pair<URI, Symbol>> getSymbolPairs(DocumentContext document
7776
.map(symbol -> Pair.of(documentContext.getUri(), symbol));
7877
}
7978

80-
private static boolean isDeprecated(Symbol symbol) {
81-
boolean deprecated;
82-
if (symbol instanceof MethodSymbol) {
83-
deprecated = ((MethodSymbol) symbol).isDeprecated();
84-
} else {
85-
deprecated = false;
86-
}
87-
return deprecated;
88-
}
89-
9079
private static boolean isSupported(Symbol symbol) {
9180
var symbolKind = symbol.getSymbolKind();
9281
switch (symbolKind) {
@@ -107,7 +96,7 @@ private static SymbolInformation createSymbolInformation(Pair<URI, Symbol> symbo
10796
symbol.getSymbolKind(),
10897
new Location(uri.toString(), symbol.getRange())
10998
);
110-
symbolInformation.setDeprecated(isDeprecated(symbol));
99+
symbolInformation.setDeprecated(symbol.isDeprecated());
111100
return symbolInformation;
112101
}
113102
}

0 commit comments

Comments
 (0)