Skip to content

Commit

Permalink
javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
nixel2007 committed Apr 1, 2023
1 parent 7d209fe commit 6372e30
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,18 @@

import java.util.List;

/**
* Базовый интерфейс для наполнения {@link com.github._1c_syntax.bsl.languageserver.providers.InlayHintProvider}
* данными о доступных в документе inlay hints.
*/
public interface InlayHintSupplier {

/**
* Получить inlay hints, доступные в документе.
*
* @param documentContext Контекст документа, для которого надо рассчитать inlay hints.
* @param params Параметры запроса.
* @return Список inlay hints в документе.
*/
List<InlayHint> getInlayHints(DocumentContext documentContext, InlayHintParams params);
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ public CodeLensData extractData(CodeLens codeLens) {
return objectMapper.readValue(rawCodeLensData.toString(), CodeLensData.class);
}

/**
* Отправить запрос на обновление линз кода.
*/
public void refreshCodeLenses() {
boolean clientSupportsRefreshCodeLenses = clientCapabilitiesHolder.getCapabilities()
.map(ClientCapabilities::getWorkspace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
import java.util.List;
import java.util.stream.Collectors;

/**
* Провайдер, обрабатывающий запросы {@code textDocument/inlayHint} и {@code inlayHint/resolve}.
*
* @see <a href="https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint">Inlay hint request</a>.
* @see <a href="https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#inlayHint_resolve">Inlay hint resolve request</a>
*/
@Component
@RequiredArgsConstructor
public class InlayHintProvider {
Expand All @@ -47,13 +53,23 @@ public class InlayHintProvider {
private final ClientCapabilitiesHolder clientCapabilitiesHolder;
private final LanguageClientHolder clientHolder;

/**
* Получить список inlay hints в документе.
*
* @param documentContext Документ, для которого запрашиваются inlay hints.
* @param params Параметры запроса.
* @return Список inlay hints в документе
*/
public List<InlayHint> getInlayHint(DocumentContext documentContext, InlayHintParams params) {
return suppliers.stream()
.map(supplier -> supplier.getInlayHints(documentContext, params))
.flatMap(Collection::stream)
.collect(Collectors.toList());
}

/**
* Отправить запрос на обновление inlay hints.
*/
public void refreshInlayHints() {
boolean refreshSupport = clientCapabilitiesHolder.getCapabilities()
.map(ClientCapabilities::getWorkspace)
Expand Down

0 comments on commit 6372e30

Please sign in to comment.