Skip to content

Commit 7c3ebf8

Browse files
author
Kapil Borle
committed
Add all formatting types and requests
1 parent 3da17ee commit 7c3ebf8

File tree

1 file changed

+69
-2
lines changed
  • src/PowerShellEditorServices.Protocol/LanguageServer

1 file changed

+69
-2
lines changed

src/PowerShellEditorServices.Protocol/LanguageServer/Formatting.cs

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,86 @@ namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
99
{
1010
public class DocumentFormattingRequest
1111
{
12-
public static readonly
13-
RequestType<DocumentFormattingParams, TextEdit[], object,TextDocumentRegistrationOptions> Type = RequestType<DocumentFormattingParams, TextEdit[], object,TextDocumentRegistrationOptions>.Create("textDocument/formatting");
12+
public static readonly RequestType<DocumentFormattingParams, TextEdit[], object, TextDocumentRegistrationOptions> Type = RequestType<DocumentFormattingParams, TextEdit[], object, TextDocumentRegistrationOptions>.Create("textDocument/formatting");
13+
}
14+
15+
public class DocumentRangeFormattingRequest
16+
{
17+
public static readonly RequestType<DocumentRangeFormattingParams, TextEdit[], object, TextDocumentRegistrationOptions> Type = RequestType<DocumentRangeFormattingParams, TextEdit[], object, TextDocumentRegistrationOptions>.Create("textDocument/rangeFormatting");
18+
19+
}
20+
21+
public class DocumentOnTypeFormattingRequest
22+
{
23+
public static readonly RequestType<DocumentOnTypeFormattingRequest, TextEdit[], object, TextDocumentRegistrationOptions> Type = RequestType<DocumentOnTypeFormattingRequest, TextEdit[], object, TextDocumentRegistrationOptions>.Create("textDocument/onTypeFormatting");
24+
25+
}
26+
27+
public class DocumentRangeFormattingParams
28+
{
29+
/// <summary>
30+
/// The document to format.
31+
/// </summary>
32+
public TextDocumentIdentifier TextDocument { get; set; }
33+
34+
/// <summary>
35+
/// The range to format.
36+
/// </summary>
37+
/// <returns></returns>
38+
public Range Range { get; set; }
39+
40+
/// <summary>
41+
/// The format options.
42+
/// </summary>
43+
public FormattingOptions options { get; set; }
44+
}
45+
46+
public class DocumentOnTypeFormattingParams
47+
{
48+
/// <summary>
49+
/// The document to format.
50+
/// </summary>
51+
public TextDocumentIdentifier TextDocument { get; set; }
52+
53+
/// <summary>
54+
/// The position at which this request was sent.
55+
/// </summary>
56+
public Position Position { get; set; }
57+
58+
/// <summary>
59+
/// The character that has been typed.
60+
/// </summary>
61+
public string ch { get; set; }
62+
63+
/// <summary>
64+
/// The format options.
65+
/// </summary>
66+
public FormattingOptions options { get; set; }
1467
}
1568

1669
public class DocumentFormattingParams
1770
{
71+
/// <summary>
72+
/// The document to format.
73+
/// </summary>
1874
public TextDocumentIdentifier TextDocument { get; set; }
75+
76+
/// <summary>
77+
/// The format options.
78+
/// </summary>
1979
public FormattingOptions options { get; set; }
2080
}
2181

2282
public class FormattingOptions
2383
{
84+
/// <summary>
85+
/// Size of a tab in spaces.
86+
/// </summary>
2487
int TabSize { get; set; }
88+
89+
/// <summary>
90+
/// Prefer spaces over tabs.
91+
/// </summary>
2592
bool InsertSpaces { get; set; }
2693
}
2794
}

0 commit comments

Comments
 (0)