implements PLN-0131
Intrepid/Prometeu/Studio/pipeline/pr-master Build started...
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 62.22% (17996/28921)
* Branch Coverage: 52.87% (6986/13213)
* Lines of Code: 28921
* Cyclomatic Complexity: 11624
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 659
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.22% (17996/28921)
* Branch Coverage: 52.87% (6986/13213)
* Lines of Code: 28921
* Cyclomatic Complexity: 11624
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 659
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
Add PBS go-to-definition as hover editorial lookup plus physical declaration locations on FrontendLanguageService. Empty results stay honest when the target is not a regular file, including virtual stdlib paths. Housekeep DSC-0039 with LSN-0068.
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
package p.studio.compiler.services;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
|
||||
public record FrontendDefinitionLocation(
|
||||
Path path,
|
||||
int startOffset,
|
||||
int endOffset) {
|
||||
|
||||
public FrontendDefinitionLocation {
|
||||
path = Objects.requireNonNull(path, "path").toAbsolutePath().normalize();
|
||||
if (startOffset < 0) {
|
||||
throw new IllegalArgumentException("startOffset must not be negative");
|
||||
}
|
||||
if (endOffset < startOffset) {
|
||||
throw new IllegalArgumentException("endOffset must not be before startOffset");
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
-1
@@ -3,5 +3,13 @@ package p.studio.compiler.services;
|
||||
public record FrontendEditorialContext(
|
||||
Object syntaxTree,
|
||||
Object supplementalDeclarations,
|
||||
Object semanticContext) {
|
||||
Object semanticContext,
|
||||
Object sourceFiles) {
|
||||
|
||||
public FrontendEditorialContext(
|
||||
final Object syntaxTree,
|
||||
final Object supplementalDeclarations,
|
||||
final Object semanticContext) {
|
||||
this(syntaxTree, supplementalDeclarations, semanticContext, null);
|
||||
}
|
||||
}
|
||||
|
||||
+13
@@ -59,4 +59,17 @@ public interface FrontendLanguageService {
|
||||
final int offset) {
|
||||
return signatureHelp(request, offset);
|
||||
}
|
||||
|
||||
default List<FrontendDefinitionLocation> definition(
|
||||
final FrontendDocumentRequest request,
|
||||
final int offset) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
default List<FrontendDefinitionLocation> definition(
|
||||
final FrontendDocumentRequest request,
|
||||
final FrontendEditorialContext editorialContext,
|
||||
final int offset) {
|
||||
return definition(request, offset);
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -22,6 +22,20 @@ class FrontendLanguageServiceTest {
|
||||
assertTrue(service.completion(request, 0).isEmpty());
|
||||
assertTrue(service.hover(request, 0).isEmpty());
|
||||
assertEquals(FrontendSignatureHelp.empty(), service.signatureHelp(request, 0));
|
||||
assertTrue(service.definition(request, 0).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
void definitionLocationRejectsBlankPathAndInvertedOffsets() {
|
||||
final Path path = Path.of("src/main.pbs").toAbsolutePath();
|
||||
final var location = new FrontendDefinitionLocation(path, 4, 9);
|
||||
assertEquals(path.normalize(), location.path());
|
||||
assertEquals(4, location.startOffset());
|
||||
assertEquals(9, location.endOffset());
|
||||
|
||||
assertThrows(NullPointerException.class, () -> new FrontendDefinitionLocation(null, 0, 1));
|
||||
assertThrows(IllegalArgumentException.class, () -> new FrontendDefinitionLocation(path, -1, 0));
|
||||
assertThrows(IllegalArgumentException.class, () -> new FrontendDefinitionLocation(path, 5, 4));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user