@@ -12,6 +12,7 @@ import type * as Proto from '../tsServer/protocol/protocol';
12
12
import * as PConst from '../tsServer/protocol/protocol.const' ;
13
13
import * as typeConverters from '../typeConverters' ;
14
14
import { ITypeScriptServiceClient } from '../typescriptService' ;
15
+ import { coalesce } from '../utils/arrays' ;
15
16
16
17
function getSymbolKind ( item : Proto . NavtoItem ) : vscode . SymbolKind {
17
18
switch ( item . kind ) {
@@ -64,9 +65,7 @@ class TypeScriptWorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvide
64
65
return [ ] ;
65
66
}
66
67
67
- return response . body
68
- . filter ( item => item . containerName || item . kind !== 'alias' )
69
- . map ( item => this . toSymbolInformation ( item ) ) ;
68
+ return coalesce ( response . body . map ( item => this . toSymbolInformation ( item ) ) ) ;
70
69
}
71
70
72
71
private get searchAllOpenProjects ( ) {
@@ -89,13 +88,22 @@ class TypeScriptWorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvide
89
88
return this . client . toOpenTsFilePath ( document ) ;
90
89
}
91
90
92
- private toSymbolInformation ( item : Proto . NavtoItem ) {
91
+ private toSymbolInformation ( item : Proto . NavtoItem ) : vscode . SymbolInformation | undefined {
92
+ if ( ! item . containerName || item . kind === 'alias' ) {
93
+ return ;
94
+ }
95
+
96
+ const uri = this . client . toResource ( item . file ) ;
97
+ if ( uri . scheme === fileSchemes . chatCodeBlock ) {
98
+ return ;
99
+ }
100
+
93
101
const label = TypeScriptWorkspaceSymbolProvider . getLabel ( item ) ;
94
102
const info = new vscode . SymbolInformation (
95
103
label ,
96
104
getSymbolKind ( item ) ,
97
105
item . containerName || '' ,
98
- typeConverters . Location . fromTextSpan ( this . client . toResource ( item . file ) , item ) ) ;
106
+ typeConverters . Location . fromTextSpan ( uri , item ) ) ;
99
107
const kindModifiers = item . kindModifiers ? parseKindModifier ( item . kindModifiers ) : undefined ;
100
108
if ( kindModifiers ?. has ( PConst . KindModifiers . deprecated ) ) {
101
109
info . tags = [ vscode . SymbolTag . Deprecated ] ;
0 commit comments