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:
+2
@@ -78,6 +78,7 @@ class CompilerLanguageServiceBridgeTest {
|
||||
new BaselineCodeActionDiagnostic("E_SEM_DUPLICATE_RESERVED_ATTRIBUTE", 0, 0, 0, 1)))
|
||||
.actions().isEmpty());
|
||||
assertTrue(bridge.documentLinks(context, documentUri, "fn main() {}").links().isEmpty());
|
||||
assertTrue(bridge.formatDocument(context, documentUri, "fn main() {}").edits().isEmpty());
|
||||
assertTrue(bridge.foldingRanges(context, documentUri, "fn main() {}").ranges().isEmpty());
|
||||
assertTrue(bridge.selectionRanges(context, documentUri, "fn main() {}", List.of(new DocumentPosition(0, 0)))
|
||||
.ranges().isEmpty());
|
||||
@@ -778,6 +779,7 @@ class CompilerLanguageServiceBridgeTest {
|
||||
assertTrue(description.documentLinksSupported());
|
||||
assertTrue(description.foldingRangesSupported());
|
||||
assertTrue(description.selectionRangesSupported());
|
||||
assertTrue(description.formattingSupported());
|
||||
assertEquals(1, description.semanticHostProjections().size());
|
||||
assertEquals("vscode", description.semanticHostProjections().getFirst().hostId());
|
||||
assertTrue(description.semanticHostProjections().getFirst().tokenProjections().stream()
|
||||
|
||||
+1
@@ -108,6 +108,7 @@ class PrometeuLanguageServerTest {
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
List.of(),
|
||||
List.of(new BaselineSemanticHostProjection(
|
||||
"vscode",
|
||||
|
||||
+5
@@ -60,6 +60,7 @@ final class Lsp4jProtocolMessageMapperTest {
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
List.of("demo-keyword"),
|
||||
List.of(new BaselineSemanticHostProjection(
|
||||
"vscode",
|
||||
@@ -90,6 +91,9 @@ final class Lsp4jProtocolMessageMapperTest {
|
||||
assertEquals(Boolean.FALSE, result.getCapabilities().getDocumentLinkProvider().getResolveProvider());
|
||||
assertEquals(Boolean.TRUE, result.getCapabilities().getFoldingRangeProvider().getLeft());
|
||||
assertEquals(Boolean.TRUE, result.getCapabilities().getSelectionRangeProvider().getLeft());
|
||||
assertEquals(Boolean.TRUE, result.getCapabilities().getDocumentFormattingProvider().getLeft());
|
||||
assertNull(result.getCapabilities().getDocumentRangeFormattingProvider());
|
||||
assertNull(result.getCapabilities().getDocumentOnTypeFormattingProvider());
|
||||
|
||||
final var experimental = assertInstanceOf(Map.class, result.getCapabilities().getExperimental());
|
||||
final var semanticPayload = assertInstanceOf(Map.class, experimental.get("prometeuSemanticHostProjections"));
|
||||
@@ -343,6 +347,7 @@ final class Lsp4jProtocolMessageMapperTest {
|
||||
documentLinksSupported,
|
||||
documentLinksSupported,
|
||||
documentLinksSupported,
|
||||
documentLinksSupported,
|
||||
List.of("demo-keyword"),
|
||||
List.of(new BaselineSemanticHostProjection(
|
||||
"vscode",
|
||||
|
||||
Reference in New Issue
Block a user