@@ -48,6 +48,10 @@ internal class SymbolsService
48
48
/// the given Runspace to execute language service operations.
49
49
/// </summary>
50
50
/// <param name="factory">An ILoggerFactory implementation used for writing log messages.</param>
51
+ /// <param name="runspaceContext"></param>
52
+ /// <param name="executionService"></param>
53
+ /// <param name="workspaceService"></param>
54
+ /// <param name="configurationService"></param>
51
55
public SymbolsService (
52
56
ILoggerFactory factory ,
53
57
IRunspaceContext runspaceContext ,
@@ -175,7 +179,7 @@ public static SymbolReference FindSymbolAtLocation(
175
179
/// <param name="referencedFiles">An array of scriptFiles too search for references in</param>
176
180
/// <param name="workspace">The workspace that will be searched for symbols</param>
177
181
/// <returns>FindReferencesResult</returns>
178
- public List < SymbolReference > FindReferencesOfSymbol (
182
+ public async Task < List < SymbolReference > > FindReferencesOfSymbol (
179
183
SymbolReference foundSymbol ,
180
184
ScriptFile [ ] referencedFiles ,
181
185
WorkspaceService workspace )
@@ -303,7 +307,7 @@ public static SymbolReference FindFunctionDefinitionAtLocation(
303
307
/// <param name="lineNumber">The line number at which the symbol can be located.</param>
304
308
/// <param name="columnNumber">The column number at which the symbol can be located.</param>
305
309
/// <returns></returns>
306
- public async Task < SymbolDetails > FindSymbolDetailsAtLocationAsync (
310
+ public Task < SymbolDetails > FindSymbolDetailsAtLocationAsync (
307
311
ScriptFile scriptFile ,
308
312
int lineNumber ,
309
313
int columnNumber )
@@ -316,16 +320,14 @@ public async Task<SymbolDetails> FindSymbolDetailsAtLocationAsync(
316
320
317
321
if ( symbolReference == null )
318
322
{
319
- return null ;
323
+ return Task . FromResult < SymbolDetails > ( null ) ;
320
324
}
321
325
322
326
symbolReference . FilePath = scriptFile . FilePath ;
323
- SymbolDetails symbolDetails = await SymbolDetails . CreateAsync (
327
+ return SymbolDetails . CreateAsync (
324
328
symbolReference ,
325
329
_runspaceContext . CurrentRunspace ,
326
- _executionService ) . ConfigureAwait ( false ) ;
327
-
328
- return symbolDetails ;
330
+ _executionService ) ;
329
331
}
330
332
331
333
/// <summary>
@@ -443,8 +445,7 @@ public async Task<SymbolReference> GetDefinitionOfSymbolAsync(
443
445
if ( foundDefinition == null )
444
446
{
445
447
// Get a list of all powershell files in the workspace path
446
- IEnumerable < string > allFiles = _workspaceService . EnumeratePSFiles ( ) ;
447
- foreach ( string file in allFiles )
448
+ foreach ( string file in _workspaceService . EnumeratePSFiles ( ) )
448
449
{
449
450
if ( filesSearched . Contains ( file ) )
450
451
{
@@ -540,7 +541,7 @@ private ScriptFile[] GetBuiltinCommandScriptFiles(
540
541
}
541
542
542
543
string modPath = moduleInfo . Path ;
543
- List < ScriptFile > scriptFiles = new List < ScriptFile > ( ) ;
544
+ List < ScriptFile > scriptFiles = new ( ) ;
544
545
ScriptFile newFile ;
545
546
546
547
// find any files where the moduleInfo's path ends with ps1 or psm1
@@ -595,7 +596,7 @@ public static FunctionDefinitionAst GetFunctionDefinitionForHelpComment(
595
596
IEnumerable < Ast > foundAsts = scriptFile . ScriptAst . FindAll (
596
597
ast =>
597
598
{
598
- if ( ! ( ast is FunctionDefinitionAst fdAst ) )
599
+ if ( ast is not FunctionDefinitionAst fdAst )
599
600
{
600
601
return false ;
601
602
}
@@ -605,7 +606,7 @@ public static FunctionDefinitionAst GetFunctionDefinitionForHelpComment(
605
606
} ,
606
607
true ) ;
607
608
608
- if ( foundAsts == null || ! foundAsts . Any ( ) )
609
+ if ( foundAsts ? . Any ( ) != true )
609
610
{
610
611
helpLocation = null ;
611
612
return null ;
0 commit comments