File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/LanguageServer/Impl/Indexing Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 7
7
using Microsoft . Python . Analysis . Documents ;
8
8
using Microsoft . Python . Core ;
9
9
using Microsoft . Python . Core . Diagnostics ;
10
+ using Microsoft . Python . Parsing . Ast ;
10
11
11
12
namespace Microsoft . Python . LanguageServer . Indexing {
12
13
class MostRecentDocumentSymbols : IMostRecentDocumentSymbols {
@@ -120,7 +121,20 @@ public void Dispose() {
120
121
}
121
122
122
123
private async Task < IReadOnlyList < HierarchicalSymbol > > IndexAsync ( IDocument doc , CancellationToken indexCt ) {
123
- var ast = await doc . GetAstAsync ( indexCt ) ;
124
+ PythonAst ast = null ;
125
+
126
+ for ( var i = 0 ; i < 5 ; i ++ ) {
127
+ ast = await doc . GetAstAsync ( indexCt ) ;
128
+ if ( ast != null ) {
129
+ break ;
130
+ }
131
+ await Task . Delay ( 100 ) ;
132
+ }
133
+
134
+ if ( ast == null ) {
135
+ return Array . Empty < HierarchicalSymbol > ( ) ;
136
+ }
137
+
124
138
indexCt . ThrowIfCancellationRequested ( ) ;
125
139
var walker = new SymbolIndexWalker ( ast ) ;
126
140
ast . Walk ( walker ) ;
You can’t perform that action at this time.
0 commit comments