@@ -18,8 +18,7 @@ class TextDocumentHandler : ITextDocumentSyncHandler
18
18
private readonly OmniSharp . Extensions . LanguageServer . Protocol . Server . ILanguageServer _router ;
19
19
20
20
private readonly DocumentSelector _documentSelector = new DocumentSelector (
21
- new DocumentFilter ( )
22
- {
21
+ new DocumentFilter ( ) {
23
22
Pattern = "**/*.cs"
24
23
}
25
24
) ;
@@ -35,8 +34,7 @@ public TextDocumentHandler(OmniSharp.Extensions.LanguageServer.Protocol.Server.I
35
34
36
35
public Task < Unit > Handle ( DidChangeTextDocumentParams notification , CancellationToken token )
37
36
{
38
- _router . Window . LogMessage ( new LogMessageParams ( )
39
- {
37
+ _router . Window . LogMessage ( new LogMessageParams ( ) {
40
38
Type = MessageType . Log ,
41
39
Message = "Hello World!!!!"
42
40
} ) ;
@@ -45,8 +43,7 @@ public Task<Unit> Handle(DidChangeTextDocumentParams notification, CancellationT
45
43
46
44
TextDocumentChangeRegistrationOptions IRegistration < TextDocumentChangeRegistrationOptions > . GetRegistrationOptions ( )
47
45
{
48
- return new TextDocumentChangeRegistrationOptions ( )
49
- {
46
+ return new TextDocumentChangeRegistrationOptions ( ) {
50
47
DocumentSelector = _documentSelector ,
51
48
SyncKind = Change
52
49
} ;
@@ -60,8 +57,7 @@ public void SetCapability(SynchronizationCapability capability)
60
57
public async Task < Unit > Handle ( DidOpenTextDocumentParams notification , CancellationToken token )
61
58
{
62
59
await Task . Yield ( ) ;
63
- _router . Window . LogMessage ( new LogMessageParams ( )
64
- {
60
+ _router . Window . LogMessage ( new LogMessageParams ( ) {
65
61
Type = MessageType . Log ,
66
62
Message = "Hello World!!!!"
67
63
} ) ;
@@ -70,8 +66,7 @@ public async Task<Unit> Handle(DidOpenTextDocumentParams notification, Cancellat
70
66
71
67
TextDocumentRegistrationOptions IRegistration < TextDocumentRegistrationOptions > . GetRegistrationOptions ( )
72
68
{
73
- return new TextDocumentRegistrationOptions ( )
74
- {
69
+ return new TextDocumentRegistrationOptions ( ) {
75
70
DocumentSelector = _documentSelector ,
76
71
} ;
77
72
}
@@ -88,8 +83,7 @@ public Task<Unit> Handle(DidSaveTextDocumentParams notification, CancellationTok
88
83
89
84
TextDocumentSaveRegistrationOptions IRegistration < TextDocumentSaveRegistrationOptions > . GetRegistrationOptions ( )
90
85
{
91
- return new TextDocumentSaveRegistrationOptions ( )
92
- {
86
+ return new TextDocumentSaveRegistrationOptions ( ) {
93
87
DocumentSelector = _documentSelector ,
94
88
IncludeText = true
95
89
} ;
@@ -99,4 +93,53 @@ public TextDocumentAttributes GetTextDocumentAttributes(Uri uri)
99
93
return new TextDocumentAttributes ( uri , "csharp" ) ;
100
94
}
101
95
}
96
+
97
+ class FoldingRangeHandler : IFoldingRangeHandler
98
+ {
99
+ private FoldingRangeCapability _capability ;
100
+
101
+ public TextDocumentRegistrationOptions GetRegistrationOptions ( )
102
+ {
103
+ return new TextDocumentRegistrationOptions ( ) {
104
+ DocumentSelector = DocumentSelector . ForLanguage ( "csharp" )
105
+ } ;
106
+ }
107
+
108
+ public Task < Container < FoldingRange > > Handle ( FoldingRangeRequestParam request ,
109
+ CancellationToken cancellationToken )
110
+ {
111
+ return Task . FromResult ( new Container < FoldingRange > ( new FoldingRange ( ) {
112
+ StartLine = 10 ,
113
+ EndLine = 20 ,
114
+ Kind = FoldingRangeKind . Region ,
115
+ EndCharacter = 0 ,
116
+ StartCharacter = 0
117
+ } ) ) ;
118
+ }
119
+
120
+ public void SetCapability ( FoldingRangeCapability capability )
121
+ {
122
+ _capability = capability ;
123
+ }
124
+ }
125
+
126
+ class DidChangeWatchedFilesHandler : IDidChangeWatchedFilesHandler
127
+ {
128
+ private DidChangeWatchedFilesCapability _capability ;
129
+
130
+ public object GetRegistrationOptions ( )
131
+ {
132
+ return new object ( ) ;
133
+ }
134
+
135
+ public Task < Unit > Handle ( DidChangeWatchedFilesParams request , CancellationToken cancellationToken )
136
+ {
137
+ return Unit . Task ;
138
+ }
139
+
140
+ public void SetCapability ( DidChangeWatchedFilesCapability capability )
141
+ {
142
+ _capability = capability ;
143
+ }
144
+ }
102
145
}
0 commit comments