Skip to content

Commit afc0c19

Browse files
Move PowerShellEditorServices over to Omnisharp-lsp (#995)
* Add starting point * x * More work * Make integration tests pass for omnisharp * Changes * add dummy workspace symbols handler * use LoggerFactory * A working WorkspaceSymbolsHandler * working text document syncer * needed document selector and getVersion handler to work with vscode * Add diagnostics (#18) * Add setting support (#19) * Added Diagnostics * didChangeConfiguration message and general settings support * Apply suggestions from code review Co-Authored-By: Robert Holt <rjmholt@gmail.com> * Folding support (#20) * Added Diagnostics * didChangeConfiguration message and general settings support * initial folding support * log level trace * folding works with latest omnisharp version * comment typo * added test for folding * Added Diagnostics * didChangeConfiguration message and general settings support * initial folding support * added test for folding * formatting support * remove merge conflict * add formatting tests
1 parent fd77c0d commit afc0c19

File tree

60 files changed

+8135
-56
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+8135
-56
lines changed

Diff for: NuGet.Config

+3
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
<solution>
44
<add key="disableSourceControlIntegration" value="true" />
55
</solution>
6+
<packageSources>
7+
<add key="nuget.org" value="https://www.myget.org/F/omnisharp/api/v3/index.json" protocolVersion="3" />
8+
</packageSources>
69
</configuration>

Diff for: PowerShellEditorServices.build.ps1

+19-6
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,24 @@ $script:RequiredBuildAssets = @{
7474
'Microsoft.PowerShell.EditorServices.Protocol.dll',
7575
'Microsoft.PowerShell.EditorServices.Protocol.pdb'
7676
)
77+
78+
'PowerShellEditorServices.Engine' = @(
79+
'publish/Microsoft.PowerShell.EditorServices.Engine.dll',
80+
'publish/Microsoft.PowerShell.EditorServices.Engine.pdb',
81+
'publish/OmniSharp.Extensions.JsonRpc.dll',
82+
'publish/OmniSharp.Extensions.LanguageProtocol.dll',
83+
'publish/OmniSharp.Extensions.LanguageServer.dll',
84+
'publish/Serilog.dll',
85+
'publish/Serilog.Extensions.Logging.dll',
86+
'publish/Serilog.Sinks.Console.dll',
87+
'publish/Microsoft.Extensions.DependencyInjection.Abstractions.dll',
88+
'publish/Microsoft.Extensions.DependencyInjection.dll',
89+
'publish/Microsoft.Extensions.Logging.Abstractions.dll',
90+
'publish/Microsoft.Extensions.Logging.dll',
91+
'publish/Microsoft.Extensions.Options.dll',
92+
'publish/Microsoft.Extensions.Primitives.dll',
93+
'publish/System.Reactive.dll'
94+
)
7795
}
7896

7997
$script:VSCodeModuleBinPath = @{
@@ -102,12 +120,6 @@ $script:RequiredNugetBinaries = @{
102120
@{ PackageName = 'System.Security.AccessControl'; PackageVersion = '4.5.0'; TargetRuntime = 'net461' },
103121
@{ PackageName = 'System.IO.Pipes.AccessControl'; PackageVersion = '4.5.1'; TargetRuntime = 'net461' }
104122
)
105-
106-
'6.0' = @(
107-
@{ PackageName = 'System.Security.Principal.Windows'; PackageVersion = '4.5.0'; TargetRuntime = 'netcoreapp2.0' },
108-
@{ PackageName = 'System.Security.AccessControl'; PackageVersion = '4.5.0'; TargetRuntime = 'netcoreapp2.0' },
109-
@{ PackageName = 'System.IO.Pipes.AccessControl'; PackageVersion = '4.5.1'; TargetRuntime = 'netstandard2.0' }
110-
)
111123
}
112124

113125
if (Get-Command git -ErrorAction SilentlyContinue) {
@@ -326,6 +338,7 @@ namespace Microsoft.PowerShell.EditorServices.Host
326338

327339
task Build {
328340
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices\PowerShellEditorServices.csproj -f $script:TargetPlatform }
341+
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Engine\PowerShellEditorServices.Engine.csproj -f $script:TargetPlatform }
329342
exec { & $script:dotnetExe publish -c $Configuration .\src\PowerShellEditorServices.Host\PowerShellEditorServices.Host.csproj -f $script:TargetPlatform }
330343
exec { & $script:dotnetExe build -c $Configuration .\src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj $script:TargetFrameworksParam }
331344
}

Diff for: PowerShellEditorServices.sln

+15
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.Te
2828
EndProject
2929
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerShellEditorServices.VSCode", "src\PowerShellEditorServices.VSCode\PowerShellEditorServices.VSCode.csproj", "{3B38E8DA-8BFF-4264-AF16-47929E6398A3}"
3030
EndProject
31+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerShellEditorServices.Engine", "src\PowerShellEditorServices.Engine\PowerShellEditorServices.Engine.csproj", "{29EEDF03-0990-45F4-846E-2616970D1FA2}"
32+
EndProject
3133
Global
3234
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3335
Debug|Any CPU = Debug|Any CPU
@@ -134,6 +136,18 @@ Global
134136
{3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Release|x64.Build.0 = Release|Any CPU
135137
{3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Release|x86.ActiveCfg = Release|Any CPU
136138
{3B38E8DA-8BFF-4264-AF16-47929E6398A3}.Release|x86.Build.0 = Release|Any CPU
139+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
140+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
141+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|x64.ActiveCfg = Debug|Any CPU
142+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|x64.Build.0 = Debug|Any CPU
143+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|x86.ActiveCfg = Debug|Any CPU
144+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Debug|x86.Build.0 = Debug|Any CPU
145+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
146+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|Any CPU.Build.0 = Release|Any CPU
147+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|x64.ActiveCfg = Release|Any CPU
148+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|x64.Build.0 = Release|Any CPU
149+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|x86.ActiveCfg = Release|Any CPU
150+
{29EEDF03-0990-45F4-846E-2616970D1FA2}.Release|x86.Build.0 = Release|Any CPU
137151
EndGlobalSection
138152
GlobalSection(SolutionProperties) = preSolution
139153
HideSolutionNode = FALSE
@@ -147,5 +161,6 @@ Global
147161
{F8A0946A-5D25-4651-8079-B8D5776916FB} = {F594E7FD-1E72-4E51-A496-B019C2BA3180}
148162
{E3A5CF5D-6E41-44AC-AE0A-4C227E4BACD4} = {422E561A-8118-4BE7-A54F-9309E4F03AAE}
149163
{3B38E8DA-8BFF-4264-AF16-47929E6398A3} = {F594E7FD-1E72-4E51-A496-B019C2BA3180}
164+
{29EEDF03-0990-45F4-846E-2616970D1FA2} = {F594E7FD-1E72-4E51-A496-B019C2BA3180}
150165
EndGlobalSection
151166
EndGlobal

Diff for: module/PowerShellEditorServices/PowerShellEditorServices.psm1

+12-15
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@ if ($PSEdition -eq 'Desktop') {
88
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.IO.Pipes.AccessControl.dll"
99
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.Security.AccessControl.dll"
1010
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Desktop/System.Security.Principal.Windows.dll"
11-
} elseif ($PSVersionTable.PSVersion -ge '6.0' -and $PSVersionTable.PSVersion -lt '6.1' -and $IsWindows) {
12-
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/6.0/System.IO.Pipes.AccessControl.dll"
13-
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/6.0/System.Security.AccessControl.dll"
14-
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/6.0/System.Security.Principal.Windows.dll"
1511
}
1612

1713
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.dll"
1814
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.Host.dll"
1915
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.Protocol.dll"
16+
Microsoft.PowerShell.Utility\Add-Type -Path "$PSScriptRoot/bin/Microsoft.PowerShell.EditorServices.Engine.dll"
2017

2118
function Start-EditorServicesHost {
2219
[CmdletBinding()]
@@ -97,13 +94,13 @@ function Start-EditorServicesHost {
9794

9895
$editorServicesHost = $null
9996
$hostDetails =
100-
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Session.HostDetails @(
97+
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.HostDetails @(
10198
$HostName,
10299
$HostProfileId,
103100
(Microsoft.PowerShell.Utility\New-Object System.Version @($HostVersion)))
104101

105102
$editorServicesHost =
106-
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Host.EditorServicesHost @(
103+
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.EditorServicesHost @(
107104
$hostDetails,
108105
$BundledModulesPath,
109106
$EnableConsoleRepl.IsPresent,
@@ -114,40 +111,40 @@ function Start-EditorServicesHost {
114111

115112
# Build the profile paths using the root paths of the current $profile variable
116113
$profilePaths =
117-
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Session.ProfilePaths @(
114+
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.ProfilePaths @(
118115
$hostDetails.ProfileId,
119116
[System.IO.Path]::GetDirectoryName($profile.AllUsersAllHosts),
120117
[System.IO.Path]::GetDirectoryName($profile.CurrentUserAllHosts))
121118

122119
$editorServicesHost.StartLogging($LogPath, $LogLevel);
123120

124121
$languageServiceConfig =
125-
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportConfig
122+
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.EditorServiceTransportConfig
126123

127124
$debugServiceConfig =
128-
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportConfig
125+
Microsoft.PowerShell.Utility\New-Object Microsoft.PowerShell.EditorServices.Engine.EditorServiceTransportConfig
129126

130127
switch ($PSCmdlet.ParameterSetName) {
131128
"Stdio" {
132-
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportType]::Stdio
133-
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportType]::Stdio
129+
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.EditorServiceTransportType]::Stdio
130+
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.EditorServiceTransportType]::Stdio
134131
break
135132
}
136133
"NamedPipe" {
137-
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportType]::NamedPipe
134+
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.EditorServiceTransportType]::NamedPipe
138135
$languageServiceConfig.InOutPipeName = "$LanguageServiceNamedPipe"
139136
if ($DebugServiceNamedPipe) {
140-
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportType]::NamedPipe
137+
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.EditorServiceTransportType]::NamedPipe
141138
$debugServiceConfig.InOutPipeName = "$DebugServiceNamedPipe"
142139
}
143140
break
144141
}
145142
"NamedPipeSimplex" {
146-
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportType]::NamedPipe
143+
$languageServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.EditorServiceTransportType]::NamedPipe
147144
$languageServiceConfig.InPipeName = $LanguageServiceInNamedPipe
148145
$languageServiceConfig.OutPipeName = $LanguageServiceOutNamedPipe
149146
if ($DebugServiceInNamedPipe -and $DebugServiceOutNamedPipe) {
150-
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Host.EditorServiceTransportType]::NamedPipe
147+
$debugServiceConfig.TransportType = [Microsoft.PowerShell.EditorServices.Engine.EditorServiceTransportType]::NamedPipe
151148
$debugServiceConfig.InPipeName = $DebugServiceInNamedPipe
152149
$debugServiceConfig.OutPipeName = $DebugServiceOutNamedPipe
153150
}
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"WARNING01": "*********************************************************************************",
12+
"WARNING02": "The C# extension was unable to automatically to decode projects in the current",
13+
"WARNING03": "workspace to create a runnable lanch.json file. A template launch.json file has",
14+
"WARNING04": "been created as a placeholder.",
15+
"WARNING05": "",
16+
"WARNING06": "If OmniSharp is currently unable to load your project, you can attempt to resolve",
17+
"WARNING07": "this by restoring any missing project dependencies (example: run 'dotnet restore')",
18+
"WARNING08": "and by fixing any reported errors from building the projects in your workspace.",
19+
"WARNING09": "If this allows OmniSharp to now load your project then --",
20+
"WARNING10": " * Delete this file",
21+
"WARNING11": " * Open the Visual Studio Code command palette (View->Command Palette)",
22+
"WARNING12": " * run the command: '.NET: Generate Assets for Build and Debug'.",
23+
"WARNING13": "",
24+
"WARNING14": "If your project requires a more complex launch configuration, you may wish to delete",
25+
"WARNING15": "this configuration and pick a different template using the 'Add Configuration...'",
26+
"WARNING16": "button at the bottom of this file.",
27+
"WARNING17": "*********************************************************************************",
28+
"preLaunchTask": "build",
29+
"program": "${workspaceFolder}/bin/Debug/<insert-target-framework-here>/<insert-project-name-here>.dll",
30+
"args": [],
31+
"cwd": "${workspaceFolder}",
32+
"console": "internalConsole",
33+
"stopAtEntry": false
34+
},
35+
{
36+
"name": ".NET Core Attach",
37+
"type": "coreclr",
38+
"request": "attach",
39+
"processId": "${command:pickProcess}"
40+
}
41+
]
42+
}

Diff for: src/PowerShellEditorServices.Engine/BuildInfo.cs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Microsoft.PowerShell.EditorServices.Engine
2+
{
3+
public static class BuildInfo
4+
{
5+
public const string BuildVersion = "<unset>";
6+
public const string BuildOrigin = "<unset>";
7+
public static readonly System.DateTime? BuildTime = null;
8+
}
9+
}

0 commit comments

Comments
 (0)