implements PLN-0098

This commit is contained in:
2026-07-15 07:10:15 +01:00
parent d680504c31
commit f32a25eb59
6 changed files with 70 additions and 13 deletions
@@ -6,12 +6,22 @@ public record PbsEditorialCompletionCandidate(
String label,
PbsEditorialSymbolKind kind,
String detail,
String origin) {
String origin,
String documentation) {
public PbsEditorialCompletionCandidate(
final String label,
final PbsEditorialSymbolKind kind,
final String detail,
final String origin) {
this(label, kind, detail, origin, "");
}
public PbsEditorialCompletionCandidate {
label = requireText(label, "label");
kind = Objects.requireNonNull(kind, "kind");
detail = normalize(detail);
origin = normalize(origin);
documentation = normalize(documentation);
}
private static String requireText(
@@ -482,10 +482,11 @@ public final class PbsEditorialSupportService {
}
for (final var method : structInfo.methods().entrySet()) {
completions.put(method.getKey(), new PbsEditorialCompletionCandidate(
method.getKey(),
PbsEditorialSymbolKind.METHOD,
formatCallableDetails(method.getValue()),
receiverType.name()));
method.getKey(),
PbsEditorialSymbolKind.METHOD,
formatCallableDetails(method.getValue()),
receiverType.name(),
documentationFromCallables(method.getValue())));
}
}
} else if (receiverType.kind() == Kind.SERVICE || receiverType.kind() == Kind.CONTRACT) {
@@ -494,10 +495,11 @@ public final class PbsEditorialSupportService {
: Optional.ofNullable(model.contracts.get(receiverType.name())).map(ContractInfo::methods).orElse(Map.of());
for (final var method : methods.entrySet()) {
completions.put(method.getKey(), new PbsEditorialCompletionCandidate(
method.getKey(),
PbsEditorialSymbolKind.METHOD,
formatCallableDetails(method.getValue()),
receiverType.name()));
method.getKey(),
PbsEditorialSymbolKind.METHOD,
formatCallableDetails(method.getValue()),
receiverType.name(),
documentationFromCallables(method.getValue())));
}
}
return List.copyOf(completions.values());
@@ -751,7 +753,8 @@ public final class PbsEditorialSupportService {
topDeclSymbol.localName(),
symbolKind(topDeclSymbol.decl()),
detail,
topDeclSymbol.origin());
topDeclSymbol.origin(),
documentationFromTopDecl(topDeclSymbol.decl()));
}
private List<PbsEditorialSignature> signaturesForTopDecl(final PbsAst.TopDecl topDecl) {