@@ -15,16 +15,9 @@ import {
15
15
TypeDefinitionRequest ,
16
16
} from '../../protocol'
17
17
import { DocumentSelector } from '../../types/document'
18
- import { NextSignature } from '../../types/middleware'
19
18
import { Client } from '../client'
20
- import { Middleware } from '../middleware'
21
19
import { ensure , Feature } from './common'
22
20
23
- export type ProvideTextDocumentLocationMiddleware <
24
- P extends TextDocumentPositionParams = TextDocumentPositionParams ,
25
- L extends Location = Location
26
- > = NextSignature < P , Observable < L | L [ ] | null > >
27
-
28
21
/**
29
22
* Support for requests that retrieve a list of locations (e.g., textDocument/definition,
30
23
* textDocument/implementation, and textDocument/typeDefinition).
@@ -49,9 +42,6 @@ export abstract class TextDocumentLocationFeature<
49
42
/** Override to compute whether the server capabilities report support for this feature. */
50
43
protected abstract isSupported ( capabilities : ServerCapabilities ) : boolean
51
44
52
- /** Override to return the middleware for this feature. */
53
- protected abstract getMiddleware ?( midleware : Middleware ) : ProvideTextDocumentLocationMiddleware < P , L > | undefined
54
-
55
45
public initialize ( capabilities : ServerCapabilities , documentSelector : DocumentSelector ) : void {
56
46
if ( ! this . isSupported ( capabilities ) || ! documentSelector ) {
57
47
return
@@ -63,14 +53,9 @@ export abstract class TextDocumentLocationFeature<
63
53
}
64
54
65
55
protected registerProvider ( options : TextDocumentRegistrationOptions ) : Unsubscribable {
66
- const client = this . client
67
- const provideTextDocumentLocation : ProvideTextDocumentLocationSignature < P , L > = params =>
68
- from ( client . sendRequest ( this . messages , params ) )
69
- const middleware = this . getMiddleware ? this . getMiddleware ( client . options . middleware ) : undefined
70
56
return this . registry . registerProvider (
71
57
options ,
72
- ( params : P ) : Observable < L | L [ ] | null > =>
73
- middleware ? middleware ( params , provideTextDocumentLocation ) : provideTextDocumentLocation ( params )
58
+ ( params : P ) : Observable < L | L [ ] | null > => from ( this . client . sendRequest ( this . messages , params ) )
74
59
)
75
60
}
76
61
}
@@ -89,12 +74,6 @@ export class TextDocumentDefinitionFeature extends TextDocumentLocationFeature {
89
74
protected isSupported ( capabilities : ServerCapabilities ) : boolean {
90
75
return ! ! capabilities . definitionProvider
91
76
}
92
-
93
- protected getMiddleware (
94
- middleware : Middleware
95
- ) : ProvideTextDocumentLocationMiddleware < TextDocumentPositionParams , Location > | undefined {
96
- return middleware . provideTextDocumentDefinition
97
- }
98
77
}
99
78
100
79
/**
@@ -111,12 +90,6 @@ export class TextDocumentImplementationFeature extends TextDocumentLocationFeatu
111
90
protected isSupported ( capabilities : ServerCapabilities ) : boolean {
112
91
return ! ! capabilities . implementationProvider
113
92
}
114
-
115
- protected getMiddleware (
116
- middleware : Middleware
117
- ) : ProvideTextDocumentLocationMiddleware < TextDocumentPositionParams , Location > | undefined {
118
- return middleware . provideTextDocumentImplementation
119
- }
120
93
}
121
94
122
95
/**
@@ -133,12 +106,6 @@ export class TextDocumentTypeDefinitionFeature extends TextDocumentLocationFeatu
133
106
protected isSupported ( capabilities : ServerCapabilities ) : boolean {
134
107
return ! ! capabilities . typeDefinitionProvider
135
108
}
136
-
137
- protected getMiddleware (
138
- middleware : Middleware
139
- ) : ProvideTextDocumentLocationMiddleware < TextDocumentPositionParams , Location > | undefined {
140
- return middleware . provideTextDocumentTypeDefinition
141
- }
142
109
}
143
110
144
111
/**
@@ -155,10 +122,4 @@ export class TextDocumentReferencesFeature extends TextDocumentLocationFeature<R
155
122
protected isSupported ( capabilities : ServerCapabilities ) : boolean {
156
123
return ! ! capabilities . referencesProvider
157
124
}
158
-
159
- protected getMiddleware (
160
- middleware : Middleware
161
- ) : ProvideTextDocumentLocationMiddleware < ReferenceParams > | undefined {
162
- return middleware . provideTextDocumentReferences
163
- }
164
125
}
0 commit comments