implements PLN-0137 (2/7) document-links
Advertise document links only when the frontend supports them. A link covers the ModuleRef span when module assembly already bound that module to a regular file. Virtual stdlib and unresolved modules produce no link.
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 FrontendDocumentLink(
|
||||
Path path,
|
||||
int startOffset,
|
||||
int endOffset) {
|
||||
|
||||
public FrontendDocumentLink {
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -139,6 +139,20 @@ public interface FrontendLanguageService {
|
||||
return rename(request, offset, newName);
|
||||
}
|
||||
|
||||
default boolean documentLinksSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
default List<FrontendDocumentLink> documentLinks(final FrontendDocumentRequest request) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
default List<FrontendDocumentLink> documentLinks(
|
||||
final FrontendDocumentRequest request,
|
||||
final FrontendEditorialContext editorialContext) {
|
||||
return documentLinks(request);
|
||||
}
|
||||
|
||||
default boolean codeActionsSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user