@@ -18,8 +18,7 @@ class TextDocumentHandler : ITextDocumentSyncHandler
1818 private readonly OmniSharp . Extensions . LanguageServer . Protocol . Server . ILanguageServer _router ;
1919
2020 private readonly DocumentSelector _documentSelector = new DocumentSelector (
21- new DocumentFilter ( )
22- {
21+ new DocumentFilter ( ) {
2322 Pattern = "**/*.cs"
2423 }
2524 ) ;
@@ -35,8 +34,7 @@ public TextDocumentHandler(OmniSharp.Extensions.LanguageServer.Protocol.Server.I
3534
3635 public Task < Unit > Handle ( DidChangeTextDocumentParams notification , CancellationToken token )
3736 {
38- _router . Window . LogMessage ( new LogMessageParams ( )
39- {
37+ _router . Window . LogMessage ( new LogMessageParams ( ) {
4038 Type = MessageType . Log ,
4139 Message = "Hello World!!!!"
4240 } ) ;
@@ -45,8 +43,7 @@ public Task<Unit> Handle(DidChangeTextDocumentParams notification, CancellationT
4543
4644 TextDocumentChangeRegistrationOptions IRegistration < TextDocumentChangeRegistrationOptions > . GetRegistrationOptions ( )
4745 {
48- return new TextDocumentChangeRegistrationOptions ( )
49- {
46+ return new TextDocumentChangeRegistrationOptions ( ) {
5047 DocumentSelector = _documentSelector ,
5148 SyncKind = Change
5249 } ;
@@ -60,8 +57,7 @@ public void SetCapability(SynchronizationCapability capability)
6057 public async Task < Unit > Handle ( DidOpenTextDocumentParams notification , CancellationToken token )
6158 {
6259 await Task . Yield ( ) ;
63- _router . Window . LogMessage ( new LogMessageParams ( )
64- {
60+ _router . Window . LogMessage ( new LogMessageParams ( ) {
6561 Type = MessageType . Log ,
6662 Message = "Hello World!!!!"
6763 } ) ;
@@ -70,8 +66,7 @@ public async Task<Unit> Handle(DidOpenTextDocumentParams notification, Cancellat
7066
7167 TextDocumentRegistrationOptions IRegistration < TextDocumentRegistrationOptions > . GetRegistrationOptions ( )
7268 {
73- return new TextDocumentRegistrationOptions ( )
74- {
69+ return new TextDocumentRegistrationOptions ( ) {
7570 DocumentSelector = _documentSelector ,
7671 } ;
7772 }
@@ -88,8 +83,7 @@ public Task<Unit> Handle(DidSaveTextDocumentParams notification, CancellationTok
8883
8984 TextDocumentSaveRegistrationOptions IRegistration < TextDocumentSaveRegistrationOptions > . GetRegistrationOptions ( )
9085 {
91- return new TextDocumentSaveRegistrationOptions ( )
92- {
86+ return new TextDocumentSaveRegistrationOptions ( ) {
9387 DocumentSelector = _documentSelector ,
9488 IncludeText = true
9589 } ;
@@ -99,4 +93,53 @@ public TextDocumentAttributes GetTextDocumentAttributes(Uri uri)
9993 return new TextDocumentAttributes ( uri , "csharp" ) ;
10094 }
10195 }
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+ }
102145}
0 commit comments