1
1
import { BehaviorSubject , from , Observable , TeardownLogic } from 'rxjs'
2
2
import * as uuidv4 from 'uuid/v4'
3
3
import { TextDocumentIdentifier } from 'vscode-languageserver-types'
4
- import { ProvideTextDocumentDecorationsSignature } from '../../environment/providers/decoration'
4
+ import { ProvideTextDocumentDecorationSignature } from '../../environment/providers/decoration'
5
5
import { TextDocumentFeatureProviderRegistry } from '../../environment/providers/textDocument'
6
6
import { ClientCapabilities , ServerCapabilities , TextDocumentRegistrationOptions } from '../../protocol'
7
7
import {
8
8
TextDocumentDecoration ,
9
- TextDocumentDecorationsParams ,
10
- TextDocumentDecorationsRequest ,
9
+ TextDocumentDecorationParams ,
10
+ TextDocumentDecorationRequest ,
11
11
TextDocumentPublishDecorationsNotification ,
12
12
TextDocumentPublishDecorationsParams ,
13
13
} from '../../protocol/decoration'
@@ -16,32 +16,32 @@ import { NextSignature } from '../../types/middleware'
16
16
import { Client } from '../client'
17
17
import { ensure , TextDocumentFeature } from './common'
18
18
19
- export type ProvideTextDocumentDecorationsMiddleware = NextSignature <
20
- TextDocumentDecorationsParams ,
19
+ export type ProvideTextDocumentDecorationMiddleware = NextSignature <
20
+ TextDocumentDecorationParams ,
21
21
Observable < TextDocumentDecoration [ ] | null >
22
22
>
23
23
24
24
/**
25
- * Support for static text document decorations requested by the client (textDocument/decorations requests to the
25
+ * Support for static text document decorations requested by the client (textDocument/decoration requests to the
26
26
* server).
27
27
*/
28
- export class TextDocumentStaticDecorationsFeature extends TextDocumentFeature < TextDocumentRegistrationOptions > {
28
+ export class TextDocumentStaticDecorationFeature extends TextDocumentFeature < TextDocumentRegistrationOptions > {
29
29
constructor (
30
30
client : Client ,
31
31
private registry : TextDocumentFeatureProviderRegistry <
32
32
TextDocumentRegistrationOptions ,
33
- ProvideTextDocumentDecorationsSignature
33
+ ProvideTextDocumentDecorationSignature
34
34
>
35
35
) {
36
- super ( client , TextDocumentDecorationsRequest . type )
36
+ super ( client , TextDocumentDecorationRequest . type )
37
37
}
38
38
39
39
public fillClientCapabilities ( capabilities : ClientCapabilities ) : void {
40
- ensure ( capabilities , 'decorations ' ) ! . static = true
40
+ ensure ( capabilities , 'decoration ' ) ! . static = true
41
41
}
42
42
43
43
public initialize ( capabilities : ServerCapabilities , documentSelector : DocumentSelector ) : void {
44
- if ( ! capabilities . decorationsProvider || ! capabilities . decorationsProvider . static || ! documentSelector ) {
44
+ if ( ! capabilities . decorationProvider || ! capabilities . decorationProvider . static || ! documentSelector ) {
45
45
return
46
46
}
47
47
this . register ( this . messages , {
@@ -52,20 +52,20 @@ export class TextDocumentStaticDecorationsFeature extends TextDocumentFeature<Te
52
52
53
53
protected registerProvider ( options : TextDocumentRegistrationOptions ) : TeardownLogic {
54
54
const client = this . client
55
- const provideTextDocumentDecorations : ProvideTextDocumentDecorationsSignature = params =>
56
- from ( client . sendRequest ( TextDocumentDecorationsRequest . type , params ) )
55
+ const provideTextDocumentDecoration : ProvideTextDocumentDecorationSignature = params =>
56
+ from ( client . sendRequest ( TextDocumentDecorationRequest . type , params ) )
57
57
const middleware = client . clientOptions . middleware !
58
58
return this . registry . registerProvider (
59
59
options ,
60
- ( params : TextDocumentDecorationsParams ) : Observable < TextDocumentDecoration [ ] | null > =>
61
- middleware . provideTextDocumentDecorations
62
- ? middleware . provideTextDocumentDecorations ( params , provideTextDocumentDecorations )
63
- : provideTextDocumentDecorations ( params )
60
+ ( params : TextDocumentDecorationParams ) : Observable < TextDocumentDecoration [ ] | null > =>
61
+ middleware . provideTextDocumentDecoration
62
+ ? middleware . provideTextDocumentDecoration ( params , provideTextDocumentDecoration )
63
+ : provideTextDocumentDecoration ( params )
64
64
)
65
65
}
66
66
}
67
67
68
- export type HandleTextDocumentDecorationsMiddleware = NextSignature <
68
+ export type HandleTextDocumentDecorationMiddleware = NextSignature <
69
69
TextDocumentPublishDecorationsParams ,
70
70
Observable < TextDocumentDecoration [ ] | null >
71
71
>
@@ -74,26 +74,26 @@ export type HandleTextDocumentDecorationsMiddleware = NextSignature<
74
74
* Support for dynamic text document decorations published by the server (textDocument/publishDecorations
75
75
* notifications from the server).
76
76
*/
77
- export class TextDocumentDynamicDecorationsFeature extends TextDocumentFeature < TextDocumentRegistrationOptions > {
77
+ export class TextDocumentDynamicDecorationFeature extends TextDocumentFeature < TextDocumentRegistrationOptions > {
78
78
/** Map of document URI to its decorations (last published by the server). */
79
79
private decorations = new Map < string , BehaviorSubject < TextDocumentDecoration [ ] | null > > ( )
80
80
81
81
constructor (
82
82
client : Client ,
83
83
private registry : TextDocumentFeatureProviderRegistry <
84
84
TextDocumentRegistrationOptions ,
85
- ProvideTextDocumentDecorationsSignature
85
+ ProvideTextDocumentDecorationSignature
86
86
>
87
87
) {
88
88
super ( client , TextDocumentPublishDecorationsNotification . type )
89
89
}
90
90
91
91
public fillClientCapabilities ( capabilities : ClientCapabilities ) : void {
92
- ensure ( capabilities , 'decorations ' ) ! . dynamic = true
92
+ ensure ( capabilities , 'decoration ' ) ! . dynamic = true
93
93
}
94
94
95
95
public initialize ( capabilities : ServerCapabilities , documentSelector : DocumentSelector ) : void {
96
- if ( ! capabilities . decorationsProvider || ! capabilities . decorationsProvider . dynamic || ! documentSelector ) {
96
+ if ( ! capabilities . decorationProvider || ! capabilities . decorationProvider . dynamic || ! documentSelector ) {
97
97
return
98
98
}
99
99
this . register ( this . messages , {
@@ -108,15 +108,15 @@ export class TextDocumentDynamicDecorationsFeature extends TextDocumentFeature<T
108
108
109
109
protected registerProvider ( options : TextDocumentRegistrationOptions ) : TeardownLogic {
110
110
const client = this . client
111
- const provideTextDocumentDecorations : ProvideTextDocumentDecorationsSignature = params =>
111
+ const provideTextDocumentDecoration : ProvideTextDocumentDecorationSignature = params =>
112
112
this . getDecorationsSubject ( params . textDocument )
113
113
const middleware = client . clientOptions . middleware !
114
114
return this . registry . registerProvider (
115
115
options ,
116
- ( params : TextDocumentDecorationsParams ) : Observable < TextDocumentDecoration [ ] | null > =>
117
- middleware . provideTextDocumentDecorations
118
- ? middleware . provideTextDocumentDecorations ( params , provideTextDocumentDecorations )
119
- : provideTextDocumentDecorations ( params )
116
+ ( params : TextDocumentDecorationParams ) : Observable < TextDocumentDecoration [ ] | null > =>
117
+ middleware . provideTextDocumentDecoration
118
+ ? middleware . provideTextDocumentDecoration ( params , provideTextDocumentDecoration )
119
+ : provideTextDocumentDecoration ( params )
120
120
)
121
121
}
122
122
0 commit comments