Skip to content

Commit 454b6f1

Browse files
committed
(todo) Working!
1 parent 1a86d4b commit 454b6f1

File tree

17 files changed

+562
-118
lines changed

17 files changed

+562
-118
lines changed

PowerShellEditorServices.build.ps1

+2
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ Schema is:
5151
}
5252
#>
5353
$script:RequiredBuildAssets = @{
54+
# TODO: Add glob.cs.dll
5455
$script:ModuleBinPath = @{
5556
'PowerShellEditorServices' = @(
5657
'publish/Serilog.dll',
5758
'publish/Serilog.Sinks.Async.dll',
5859
'publish/Serilog.Sinks.Console.dll',
5960
'publish/Serilog.Sinks.File.dll',
61+
'publish/Microsoft.Extensions.FileSystemGlobbing.dll',
6062
'Microsoft.PowerShell.EditorServices.dll',
6163
'Microsoft.PowerShell.EditorServices.pdb'
6264
)

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

+9
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,9 @@ await this.RunScriptDiagnosticsAsync(
725725
}
726726
}
727727

728+
// NEED TO CHECK FILE GLOBBING HERE!!
729+
// This is the handler for textDocument/definition - https://microsoft.github.io/language-server-protocol/specification#textDocument_definition
730+
// It searches the workspace for a function reference, which is then used as the definition
728731
protected async Task HandleDefinitionRequestAsync(
729732
TextDocumentPositionParams textDocumentPosition,
730733
RequestContext<Location[]> requestContext)
@@ -748,6 +751,7 @@ protected async Task HandleDefinitionRequestAsync(
748751
await editorSession.LanguageService.GetDefinitionOfSymbolAsync(
749752
scriptFile,
750753
foundSymbol,
754+
// Probably something here...
751755
editorSession.Workspace);
752756

753757
if (definition != null)
@@ -764,6 +768,9 @@ await editorSession.LanguageService.GetDefinitionOfSymbolAsync(
764768
await requestContext.SendResultAsync(definitionLocations.ToArray());
765769
}
766770

771+
// NEED TO CHECK FILE GLOBBING HERE!!
772+
// This is the handler for textDocument/References - https://microsoft.github.io/language-server-protocol/specification#textDocument_references
773+
// It searches the workspace for a function reference
767774
protected async Task HandleReferencesRequestAsync(
768775
ReferencesParams referencesParams,
769776
RequestContext<Location[]> requestContext)
@@ -781,7 +788,9 @@ protected async Task HandleReferencesRequestAsync(
781788
FindReferencesResult referencesResult =
782789
await editorSession.LanguageService.FindReferencesOfSymbolAsync(
783790
foundSymbol,
791+
// Probably something here...
784792
editorSession.Workspace.ExpandScriptReferences(scriptFile),
793+
// Probably something here...
785794
editorSession.Workspace);
786795

787796
Location[] referenceLocations = s_emptyLocationResult;

src/PowerShellEditorServices/Language/LanguageService.cs

+2
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ public async Task<FindReferencesResult> FindReferencesOfSymbolAsync(
337337
fileMap[scriptFile.FilePath] = scriptFile;
338338
}
339339

340+
// Probably something here...
340341
foreach (string filePath in workspace.EnumeratePSFiles())
341342
{
342343
if (!fileMap.Contains(filePath))
@@ -451,6 +452,7 @@ public async Task<GetDefinitionResult> GetDefinitionOfSymbolAsync(
451452
if (foundDefinition == null)
452453
{
453454
// Get a list of all powershell files in the workspace path
455+
// Probably something here...
454456
IEnumerable<string> allFiles = workspace.EnumeratePSFiles();
455457
foreach (string file in allFiles)
456458
{

src/PowerShellEditorServices/PowerShellEditorServices.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
2121
<PackageReference Include="Serilog.Sinks.Async" Version="1.3.0" />
2222
<PackageReference Include="System.Runtime.Extensions" Version="4.3.0" />
23+
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="2.2.0" />
2324
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
2425
</ItemGroup>
2526
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">

0 commit comments

Comments
 (0)