implements PLN-0137 (4/7) document-formatting
Advertise full-document formatting only. The formatter reprints the token stream and changes indentation by four spaces where brace or parenthesis nesting changes. Doc text-block interiors stay as written, comments stay on their current line, and declarations are not reordered. Range formatting and on-type formatting stay off.
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
package p.studio.lsp.messages;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public record BaselineFormatting(List<BaselineTextEdit> edits) {
|
||||
public BaselineFormatting {
|
||||
edits = edits == null ? List.of() : List.copyOf(edits);
|
||||
}
|
||||
|
||||
public static BaselineFormatting empty() {
|
||||
return new BaselineFormatting(List.of());
|
||||
}
|
||||
}
|
||||
+1
@@ -19,6 +19,7 @@ public record BaselineServerDescription(
|
||||
boolean documentLinksSupported,
|
||||
boolean foldingRangesSupported,
|
||||
boolean selectionRangesSupported,
|
||||
boolean formattingSupported,
|
||||
List<String> semanticTokenTypes,
|
||||
List<BaselineSemanticHostProjection> semanticHostProjections,
|
||||
List<BaselineVisualTheme> visualThemes,
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package p.studio.lsp.messages;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record BaselineTextEdit(
|
||||
int startLine,
|
||||
int startCharacter,
|
||||
int endLine,
|
||||
int endCharacter,
|
||||
String newText) {
|
||||
|
||||
public BaselineTextEdit {
|
||||
if (startLine < 0 || startCharacter < 0 || endLine < 0 || endCharacter < 0) {
|
||||
throw new IllegalArgumentException("text edit coordinates must not be negative");
|
||||
}
|
||||
newText = Objects.requireNonNull(newText, "newText");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user