implements PLN-0135
Intrepid/Prometeu/Studio/pipeline/pr-master Build started...
JaCoCo Coverage #### Project Overview
No changes detected, that affect the code coverage.
* Line Coverage: 63.56% (19159/30145)
* Branch Coverage: 54.14% (7612/14060)
* Lines of Code: 30145
* Cyclomatic Complexity: 12214
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 678
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: 63.56% (19159/30145)
* Branch Coverage: 54.14% (7612/14060)
* Lines of Code: 30145
* Cyclomatic Complexity: 12214
#### Quality Gates Summary
Output truncated.
Test / Build skipped: 15, passed: 678
Intrepid/Prometeu/Studio/pipeline/head This commit looks good
Add PBS rename as a validated WorkspaceEdit of physical identifier sites on FrontendLanguageService. Identity is definition; locals and params rename from their name span. Refuse aliases, virtual stdlib, builtins, error labels, keywords, and collisions. Advertise renameProvider with prepareProvider; refused cursors are LSP errors, not empty success. Housekeep DSC-0043 with LSN-0072.
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
package p.studio.lsp.messages;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public record BaselinePrepareRename(Optional<BaselineDefinitionLocation> placeholder) {
|
||||
|
||||
public BaselinePrepareRename {
|
||||
placeholder = placeholder == null ? Optional.empty() : placeholder;
|
||||
}
|
||||
|
||||
public static BaselinePrepareRename none() {
|
||||
return new BaselinePrepareRename(Optional.empty());
|
||||
}
|
||||
|
||||
public static BaselinePrepareRename of(final BaselineDefinitionLocation location) {
|
||||
return new BaselinePrepareRename(Optional.of(location));
|
||||
}
|
||||
|
||||
public boolean renameable() {
|
||||
return placeholder.isPresent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package p.studio.lsp.messages;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record BaselineRename(
|
||||
boolean applied,
|
||||
String message,
|
||||
List<BaselineRenameEdit> edits) {
|
||||
|
||||
public BaselineRename {
|
||||
message = message == null ? "" : message;
|
||||
edits = edits == null ? List.of() : List.copyOf(edits);
|
||||
}
|
||||
|
||||
public static BaselineRename unsupported() {
|
||||
return new BaselineRename(false, "unsupported", List.of());
|
||||
}
|
||||
|
||||
public static BaselineRename refused(final String message) {
|
||||
return new BaselineRename(false, message == null || message.isBlank() ? "not renameable" : message, List.of());
|
||||
}
|
||||
|
||||
public static BaselineRename applied(final List<BaselineRenameEdit> edits) {
|
||||
return new BaselineRename(true, "", edits);
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package p.studio.lsp.messages;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record BaselineRenameEdit(
|
||||
String uri,
|
||||
int startLine,
|
||||
int startCharacter,
|
||||
int endLine,
|
||||
int endCharacter,
|
||||
String newText) {
|
||||
|
||||
public BaselineRenameEdit {
|
||||
uri = requireText(uri, "uri");
|
||||
if (startLine < 0 || startCharacter < 0 || endLine < 0 || endCharacter < 0) {
|
||||
throw new IllegalArgumentException("rename range coordinates must not be negative");
|
||||
}
|
||||
newText = Objects.requireNonNull(newText, "newText");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
+1
@@ -14,6 +14,7 @@ public record BaselineServerDescription(
|
||||
boolean referencesSupported,
|
||||
boolean documentSymbolsSupported,
|
||||
boolean workspaceSymbolsSupported,
|
||||
boolean renameSupported,
|
||||
List<String> semanticTokenTypes,
|
||||
List<BaselineSemanticHostProjection> semanticHostProjections,
|
||||
List<BaselineVisualTheme> visualThemes,
|
||||
|
||||
Reference in New Issue
Block a user