@@ -18,38 +18,59 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol
18
18
namespace Models
19
19
{
20
20
[ Parallel ]
21
- [ Method ( TextDocumentNames . ColorPresentation , Direction . ClientToServer ) ]
21
+ [ Method ( TextDocumentNames . DocumentColor , Direction . ClientToServer ) ]
22
22
[
23
23
GenerateHandler ( "OmniSharp.Extensions.LanguageServer.Protocol.Document" ) ,
24
24
GenerateHandlerMethods ,
25
25
GenerateRequestMethods ( typeof ( ITextDocumentLanguageClient ) , typeof ( ILanguageClient ) )
26
26
]
27
27
[ RegistrationOptions ( typeof ( DocumentColorRegistrationOptions ) ) , Capability ( typeof ( ColorProviderCapability ) ) ]
28
- public partial record ColorPresentationParams : IRequest < Container < ColorPresentation > >
28
+ public partial record DocumentColorParams : IPartialItemsRequest < Container < ColorInformation > , ColorInformation > , IWorkDoneProgressParams
29
29
{
30
30
/// <summary>
31
- /// The document to provide document links for .
31
+ /// The text document.
32
32
/// </summary>
33
33
public TextDocumentIdentifier TextDocument { get ; init ; }
34
+ }
34
35
36
+ public partial record ColorInformation
37
+ {
35
38
/// <summary>
36
- /// The actual color value for this color range .
39
+ /// The range in the document where this color appears .
37
40
/// </summary>
38
- public DocumentColor Color { get ; init ; }
41
+ public Range Range { get ; init ; }
39
42
40
43
/// <summary>
41
- /// The range in the document where this color appers .
44
+ /// The actual color value for this color range .
42
45
/// </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
+ }
44
56
}
45
57
46
58
[ Parallel ]
59
+ [ Method ( TextDocumentNames . ColorPresentation , Direction . ClientToServer ) ]
47
60
[
48
61
GenerateHandler ( "OmniSharp.Extensions.LanguageServer.Protocol.Document" ) ,
49
62
GenerateHandlerMethods ,
50
63
GenerateRequestMethods ( typeof ( ITextDocumentLanguageClient ) , typeof ( ILanguageClient ) )
51
64
]
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
+
53
74
public partial record ColorPresentation
54
75
{
55
76
/// <summary>
@@ -75,35 +96,6 @@ public partial record ColorPresentation
75
96
public TextEditContainer ? AdditionalTextEdits { get ; init ; }
76
97
}
77
98
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
-
107
99
/// <summary>
108
100
/// Represents a color in RGBA space.
109
101
/// </summary>
0 commit comments