@@ -18,38 +18,59 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol
1818 namespace Models
1919 {
2020 [ Parallel ]
21- [ Method ( TextDocumentNames . ColorPresentation , Direction . ClientToServer ) ]
21+ [ Method ( TextDocumentNames . DocumentColor , Direction . ClientToServer ) ]
2222 [
2323 GenerateHandler ( "OmniSharp.Extensions.LanguageServer.Protocol.Document" ) ,
2424 GenerateHandlerMethods ,
2525 GenerateRequestMethods ( typeof ( ITextDocumentLanguageClient ) , typeof ( ILanguageClient ) )
2626 ]
2727 [ RegistrationOptions ( typeof ( DocumentColorRegistrationOptions ) ) , Capability ( typeof ( ColorProviderCapability ) ) ]
28- public partial record ColorPresentationParams : IRequest < Container < ColorPresentation > >
28+ public partial record DocumentColorParams : IPartialItemsRequest < Container < ColorInformation > , ColorInformation > , IWorkDoneProgressParams
2929 {
3030 /// <summary>
31- /// The document to provide document links for .
31+ /// The text document.
3232 /// </summary>
3333 public TextDocumentIdentifier TextDocument { get ; init ; }
34+ }
3435
36+ public partial record ColorInformation
37+ {
3538 /// <summary>
36- /// The actual color value for this color range .
39+ /// The range in the document where this color appears .
3740 /// </summary>
38- public DocumentColor Color { get ; init ; }
41+ public Range Range { get ; init ; }
3942
4043 /// <summary>
41- /// The range in the document where this color appers .
44+ /// The actual color value for this color range .
4245 /// </summary>
43- public Range Range { get ; init ; }
46+ public DocumentColor Color { get ; init ; }
47+
48+ public ColorPresentationParams For ( TextDocumentIdentifier textDocumentIdentifier )
49+ {
50+ return new ColorPresentationParams ( ) {
51+ Color = Color ,
52+ Range = Range ,
53+ TextDocument = textDocumentIdentifier
54+ } ;
55+ }
4456 }
4557
4658 [ Parallel ]
59+ [ Method ( TextDocumentNames . ColorPresentation , Direction . ClientToServer ) ]
4760 [
4861 GenerateHandler ( "OmniSharp.Extensions.LanguageServer.Protocol.Document" ) ,
4962 GenerateHandlerMethods ,
5063 GenerateRequestMethods ( typeof ( ITextDocumentLanguageClient ) , typeof ( ILanguageClient ) )
5164 ]
52- [ RegistrationOptions ( typeof ( DocumentColorRegistrationOptions ) ) , Capability ( typeof ( ColorProviderCapability ) ) ]
65+ [ Capability ( typeof ( ColorProviderCapability ) ) ]
66+ public partial record ColorPresentationParams : ColorInformation , IRequest < Container < ColorPresentation > > , IDoesNotParticipateInRegistration
67+ {
68+ /// <summary>
69+ /// The document to provide document links for.
70+ /// </summary>
71+ public TextDocumentIdentifier TextDocument { get ; init ; }
72+ }
73+
5374 public partial record ColorPresentation
5475 {
5576 /// <summary>
@@ -75,35 +96,6 @@ public partial record ColorPresentation
7596 public TextEditContainer ? AdditionalTextEdits { get ; init ; }
7697 }
7798
78- [ Parallel ]
79- [ Method ( TextDocumentNames . DocumentColor , Direction . ClientToServer ) ]
80- [
81- GenerateHandler ( "OmniSharp.Extensions.LanguageServer.Protocol.Document" ) ,
82- GenerateHandlerMethods ,
83- GenerateRequestMethods ( typeof ( ITextDocumentLanguageClient ) , typeof ( ILanguageClient ) )
84- ]
85- [ RegistrationOptions ( typeof ( DocumentColorRegistrationOptions ) ) , Capability ( typeof ( ColorProviderCapability ) ) ]
86- public partial record DocumentColorParams : IPartialItemsRequest < Container < ColorInformation > , ColorInformation > , IWorkDoneProgressParams
87- {
88- /// <summary>
89- /// The text document.
90- /// </summary>
91- public TextDocumentIdentifier TextDocument { get ; init ; }
92- }
93-
94- public partial record ColorInformation
95- {
96- /// <summary>
97- /// The range in the document where this color appers.
98- /// </summary>
99- public Range Range { get ; init ; }
100-
101- /// <summary>
102- /// The actual color value for this color range.
103- /// </summary>
104- public DocumentColor Color { get ; init ; }
105- }
106-
10799 /// <summary>
108100 /// Represents a color in RGBA space.
109101 /// </summary>
0 commit comments