File tree 4 files changed +32
-8
lines changed
extensions/typescript-language-features/src
4 files changed +32
-8
lines changed Original file line number Diff line number Diff line change @@ -306,7 +306,10 @@ class GetErrRequest {
306
306
public readonly files : ResourceMap < void > ,
307
307
onDone : ( ) => void
308
308
) {
309
- const allFiles = coalesce ( Array . from ( files . entries ) . map ( entry => client . normalizedPath ( entry . resource ) ) ) ;
309
+ const allFiles = coalesce ( Array . from ( files . entries )
310
+ . filter ( entry => client . hasCapabilityForResource ( entry . resource , ClientCapability . Semantic ) )
311
+ . map ( entry => client . normalizedPath ( entry . resource ) ) ) ;
312
+
310
313
if ( ! allFiles . length || ! client . capabilities . has ( ClientCapability . Semantic ) ) {
311
314
this . _done = true ;
312
315
setImmediate ( onDone ) ;
@@ -529,7 +532,7 @@ export default class BufferSyncSupport extends Disposable {
529
532
this . triggerDiagnostics ( ) ;
530
533
}
531
534
532
- public getErr ( resources : vscode . Uri [ ] ) : any {
535
+ public getErr ( resources : readonly vscode . Uri [ ] ) : any {
533
536
const handledResources = resources . filter ( resource => this . handles ( resource ) ) ;
534
537
if ( ! handledResources . length ) {
535
538
return ;
Original file line number Diff line number Diff line change @@ -145,10 +145,15 @@ export interface ITypeScriptServiceClient {
145
145
/**
146
146
* Tries to ensure that a vscode document is open on the TS server.
147
147
*
148
- * Returns the normalized path.
148
+ * @return The normalized path or `undefined` if the document is not open on the server .
149
149
*/
150
150
toOpenedFilePath ( document : vscode . TextDocument ) : string | undefined ;
151
151
152
+ /**
153
+ * Checks if `resource` has a given capability.
154
+ */
155
+ hasCapabilityForResource ( resource : vscode . Uri , capability : ClientCapability ) : boolean ;
156
+
152
157
getWorkspaceRootForResource ( resource : vscode . Uri ) : string | undefined ;
153
158
154
159
readonly onTsServerStarted : vscode . Event < { version : TypeScriptVersion , usedApiVersion : API } > ;
Original file line number Diff line number Diff line change @@ -673,6 +673,26 @@ export default class TypeScriptServiceClient extends Disposable implements IType
673
673
return this . toPath ( document . uri ) || undefined ;
674
674
}
675
675
676
+ public hasCapabilityForResource ( resource : vscode . Uri , capability : ClientCapability ) : boolean {
677
+ switch ( capability ) {
678
+ case ClientCapability . Semantic :
679
+ {
680
+ switch ( resource . scheme ) {
681
+ case fileSchemes . file :
682
+ case fileSchemes . untitled :
683
+ return true ;
684
+ default :
685
+ return false ;
686
+ }
687
+ }
688
+ case ClientCapability . Syntax :
689
+ case ClientCapability . EnhancedSyntax :
690
+ {
691
+ return true ;
692
+ }
693
+ }
694
+ }
695
+
676
696
public toResource ( filepath : string ) : vscode . Uri {
677
697
if ( filepath . startsWith ( this . inMemoryResourcePrefix ) ) {
678
698
const resource = vscode . Uri . parse ( filepath . slice ( 1 ) ) ;
Original file line number Diff line number Diff line change 6
6
export const file = 'file' ;
7
7
export const untitled = 'untitled' ;
8
8
export const git = 'git' ;
9
- export const pr = 'pr' ;
10
- export const privateScheme = 'private' ;
11
9
/** Live share scheme */
12
10
export const vsls = 'vsls' ;
13
11
export const walkThroughSnippet = 'walkThroughSnippet' ;
@@ -22,7 +20,5 @@ export const semanticSupportedSchemes = [
22
20
*/
23
21
export const disabledSchemes = new Set ( [
24
22
git ,
25
- vsls ,
26
- privateScheme ,
27
- pr ,
23
+ vsls
28
24
] ) ;
You can’t perform that action at this time.
0 commit comments