implements PLN-0133
Intrepid/Prometeu/Studio/pipeline/pr-master Build started...
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 62.84% (18504/29445)
* Branch Coverage: 53.33% (7215/13528)
* Lines of Code: 29445
* Cyclomatic Complexity: 11850
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 669
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
Intrepid/Prometeu/Studio/pipeline/pr-master Build started...
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 62.84% (18504/29445)
* Branch Coverage: 53.33% (7215/13528)
* Lines of Code: 29445
* Cyclomatic Complexity: 11850
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 669
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
Add PBS document symbols as an AST-backed hierarchical outline of the open .pbs file on FrontendLanguageService. Recovered syntax is enough; unnamed InvalidDecl is omitted; barrels, imports, locals, and compile-only frontends stay empty. Advertise documentSymbolProvider with hierarchical DocumentSymbol. Housekeep DSC-0041 with LSN-0070.
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
package p.studio.compiler.services;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public record FrontendDocumentSymbol(
|
||||
String name,
|
||||
FrontendSymbolKind kind,
|
||||
String detail,
|
||||
int rangeStart,
|
||||
int rangeEnd,
|
||||
int selectionStart,
|
||||
int selectionEnd,
|
||||
List<FrontendDocumentSymbol> children) {
|
||||
|
||||
public FrontendDocumentSymbol {
|
||||
name = requireText(name, "name");
|
||||
kind = Objects.requireNonNull(kind, "kind");
|
||||
detail = detail == null ? "" : detail.trim();
|
||||
if (rangeStart < 0) {
|
||||
throw new IllegalArgumentException("rangeStart must not be negative");
|
||||
}
|
||||
if (rangeEnd < rangeStart) {
|
||||
throw new IllegalArgumentException("rangeEnd must not be before rangeStart");
|
||||
}
|
||||
if (selectionStart < 0) {
|
||||
throw new IllegalArgumentException("selectionStart must not be negative");
|
||||
}
|
||||
if (selectionEnd < selectionStart) {
|
||||
throw new IllegalArgumentException("selectionEnd must not be before selectionStart");
|
||||
}
|
||||
children = children == null ? List.of() : List.copyOf(children);
|
||||
}
|
||||
|
||||
private static String requireText(
|
||||
final String value,
|
||||
final String field) {
|
||||
final String candidate = Objects.requireNonNull(value, field).trim();
|
||||
if (candidate.isEmpty()) {
|
||||
throw new IllegalArgumentException(field + " must not be blank");
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
+10
@@ -85,4 +85,14 @@ public interface FrontendLanguageService {
|
||||
final int offset) {
|
||||
return references(request, offset);
|
||||
}
|
||||
|
||||
default List<FrontendDocumentSymbol> documentSymbols(final FrontendDocumentRequest request) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
default List<FrontendDocumentSymbol> documentSymbols(
|
||||
final FrontendDocumentRequest request,
|
||||
final FrontendEditorialContext editorialContext) {
|
||||
return documentSymbols(request);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user