Skip to content

Commit 9fd9c8e

Browse files
committed
Merge branch 'master' into release
Because we re-released from an old tag, we're merging `master` back into the `release` branch with the `theirs` strategy to prefer all changes from `master`.
2 parents 99b5b7e + 28bb5d2 commit 9fd9c8e

File tree

203 files changed

+6972
-12977
lines changed

Some content is hidden

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

203 files changed

+6972
-12977
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://help.github.com/articles/about-codeowners/
22

33
# Global reviewers
4-
* @andschwa @rjmholt
4+
* @andschwa
55

66
# Area: Analysis & Formatting
77
src/PowerShellEditorServices/Analysis/ @rjmholt

.github/dependabot.yml

-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ updates:
88
timezone: America/Los_Angeles
99
reviewers:
1010
- "andschwa"
11-
- "rjmholt"

.vsts-ci/azure-pipelines-ci.yml

-17
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,7 @@ variables:
88
- name: DOTNET_CLI_TELEMETRY_OPTOUT
99
value: 'true'
1010

11-
trigger:
12-
branches:
13-
include:
14-
- master
15-
16-
pr:
17-
- master
18-
1911
jobs:
20-
- job: PS51_Win2016
21-
displayName: PowerShell 5.1 - Windows Server 2016
22-
pool:
23-
vmImage: vs2017-win2016
24-
steps:
25-
- template: templates/ci-general.yml
26-
parameters:
27-
pwsh: false
28-
2912
- job: PS51_Win2019
3013
displayName: PowerShell 5.1 - Windows Server 2019
3114
pool:

CHANGELOG.md

+100
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,106 @@
55

66
No changes. We're re-releasing to update signatures with a new certificate.
77

8+
## v3.0.3
9+
### Monday, December 20, 2021
10+
11+
- 🐛 🚂 [vscode-powershell #3718](https://github.com/PowerShell/PowerShellEditorServices/pull/1647) - Create `$psEditor` as a constant.
12+
- #️⃣ 🙏 [PowerShellEditorServices #1641](https://github.com/PowerShell/PowerShellEditorServices/pull/1641) - Added check to see if `PSModulePath` already contained `BundledModulePath`. (Thanks @dkattan!)
13+
- #️⃣ 🙏 [PowerShellEditorServices #1640](https://github.com/PowerShell/PowerShellEditorServices/pull/1640) - Implemented `-LanguageServiceOnly` switch. (Thanks @dkattan!)
14+
- 🐛 🛫 [PowerShellEditorServices #1638](https://github.com/PowerShell/PowerShellEditorServices/pull/1638) - Fix `BundledModulePath` and PSReadLine loading (redux).
15+
- 🐛 🔍 [PowerShellEditorServices #1635](https://github.com/PowerShell/PowerShellEditorServices/pull/1635) - Re-enable `DebugServiceTests` suite.
16+
17+
## v3.0.2
18+
### Monday, November 22, 2021
19+
20+
- ✨ 📖 [PowerShellEditorServices #1631](https://github.com/PowerShell/PowerShellEditorServices/pull/1631) - Add Justin Grote as maintainer.
21+
- 🐛 🔍 [vscode-powershell #3667](https://github.com/PowerShell/PowerShellEditorServices/pull/1630) - Improve debugger's variable population mechanism. (Thanks @JustinGrote and @SeeminglyScience!)
22+
- 🐛 👷 [PowerShellEditorServices #1628](https://github.com/PowerShell/PowerShellEditorServices/pull/1628) - Fix build for Apple M1 when running PowerShell 7.2 (arm64).
23+
- 🐛 👷 [PowerShellEditorServices #1626](https://github.com/PowerShell/PowerShellEditorServices/pull/1626) - Remove Windows Server 2016 from CI.
24+
- ✨ 👷 [PowerShellEditorServices #1619](https://github.com/PowerShell/PowerShellEditorServices/pull/1619) - Install a single `dotnet` SDK.
25+
26+
## v3.0.1
27+
### Wednesday, November 03, 2021
28+
29+
- 🐛 🔍 [PowerShellEditorServices #1608](https://github.com/PowerShell/PowerShellEditorServices/pull/1611) - Improve PowerShell command and argument escaping. (Thanks @JustinGrote!)
30+
- 🐛 📟 [PowerShellEditorServices #1603](https://github.com/PowerShell/PowerShellEditorServices/pull/1606) - Add `LengthInBufferCells` back to `EditorServicesConsolePSHostRawUserInterface`.
31+
- #️⃣ 🙏 [PowerShellEditorServices #1604](https://github.com/PowerShell/PowerShellEditorServices/pull/1604) - Fix profile loading and `$PROFILE` variable.
32+
33+
## v3.0.0
34+
### Thursday, October 28, 2021
35+
36+
This preview release includes a complete overhaul of the core PowerShell engine
37+
of PowerShell Editor Services.
38+
This represents over a year's work,
39+
tracked in [PSES #1295](https://github.com/PowerShell/PowerShellEditorServices/issues/1295)
40+
and implemented in [PSES #1459](https://github.com/PowerShell/PowerShellEditorServices/pull/1459),
41+
and is our answer to many, many issues
42+
opened by users over the last few years.
43+
We're hoping you'll see a marked improvement
44+
in the reliability, performance and footprint
45+
of the extension as a result.
46+
47+
Previously the Integrated Console was run
48+
by setting threadpool tasks on a shared main runspace,
49+
and where LSP servicing was done with PowerShell idle events.
50+
This lead to overhead, threading issues
51+
and a complex implementation intended to work around
52+
the asymmetry between PowerShell as a synchronous,
53+
single-threaded runtime and a language server
54+
as an asynchronous, multi-threaded service.
55+
56+
Now, PowerShell Editor Services maintains its own dedicated pipeline thread,
57+
which is able to service requests similar to JavaScript's event loop,
58+
meaning we can run everything synchronously on the correct thread.
59+
We also get more efficiency because we can directly call
60+
PowerShell APIs and code written in C# from this thread,
61+
without the overhead of a PowerShell pipeline.
62+
63+
This change has overhauled how we service LSP requests,
64+
how the Integrated Console works,
65+
how PSReadLine is integrated,
66+
how debugging is implemented,
67+
how remoting is handled,
68+
and a long tail of other features in PowerShell Editor Services.
69+
70+
Also, in making it, while 6,000 lines of code were added,
71+
we removed 12,000,
72+
for a more maintainable, more efficient
73+
and easier to understand extension backend.
74+
75+
While most of our testing has been re-enabled
76+
(and we're working on adding more),
77+
there are bound to be issues with this new implementation.
78+
Please give this a try and let us know if you run into anything.
79+
80+
We also want to thank [@SeeminglyScience](https://github.com/SeeminglyScience)
81+
for his help and knowledge as we've made this migration.
82+
83+
Finally, a crude breakdown of the work from the commits:
84+
85+
- An initial dedicated pipeline thread consumer implementation
86+
- Implement the console REPL
87+
- Implement PSRL idle handling
88+
- Implement completions
89+
- Move to invoking PSRL as a C# delegate
90+
- Implement cancellation and <kbd>Ctrl</kbd>+<kbd>C</kbd>
91+
- Make <kbd>F8</kbd> work again
92+
- Ensure execution policy is set correctly
93+
- Implement $PROFILE support
94+
- Make nested prompts work
95+
- Implement REPL debugging
96+
- Implement remote debugging in the REPL
97+
- Hook up the debugging UI
98+
- Implement a new concurrent priority queue for PowerShell tasks
99+
- Reimplement the REPL synchronously rather than on its own thread
100+
- Really get debugging working...
101+
- Implement DSC breakpoint support
102+
- Reimplement legacy readline support
103+
- Ensure stdio is still supported as an LSP transport
104+
- Remove PowerShellContextService and other defunct code
105+
- Get integration tests working again (and improve diagnosis of PSES failures)
106+
- Get unit testing working again (except debug service tests)
107+
8108
## v2.5.2
9109
### Monday, October 18, 2021
10110

PowerShellEditorServices.Common.props

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>2.5.3</VersionPrefix>
3+
<VersionPrefix>3.0.3</VersionPrefix>
44
<VersionSuffix></VersionSuffix>
55
<Company>Microsoft</Company>
66
<Copyright>© Microsoft Corporation.</Copyright>
7-
<LangVersion>9.0</LangVersion>
7+
<LangVersion>latest</LangVersion>
88
<PackageTags>PowerShell;editor;development;language;debugging</PackageTags>
99
<PackageLicenseUrl>https://raw.githubusercontent.com/PowerShell/PowerShellEditorServices/master/LICENSE</PackageLicenseUrl>
1010
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>

PowerShellEditorServices.build.ps1

+29-15
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ $script:dotnetTestArgs = @(
2929
)
3030

3131
$script:IsNix = $IsLinux -or $IsMacOS
32-
$script:IsRosetta = $IsMacOS -and (sysctl -n sysctl.proc_translated) -eq 1 # Mac M1
32+
# For Apple M1, pwsh might be getting emulated, in which case we need to check
33+
# for the proc_translated flag, otherwise we can check the architecture.
34+
$script:IsAppleM1 = $IsMacOS -and ((sysctl -n sysctl.proc_translated) -eq 1 -or (uname -m) -eq "arm64")
3335
$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Hosting", "BuildInfo.cs")
3436
$script:PsesCommonProps = [xml](Get-Content -Raw "$PSScriptRoot/PowerShellEditorServices.Common.props")
3537

@@ -52,12 +54,16 @@ if (Get-Command git -ErrorAction SilentlyContinue) {
5254

5355
function Install-Dotnet {
5456
param (
55-
[string[]]$Channel
57+
[string[]]$Channel,
58+
[switch]$Runtime
5659
)
5760

5861
$env:DOTNET_INSTALL_DIR = "$PSScriptRoot/.dotnet"
5962

60-
Write-Host "Installing .NET channels $Channel" -ForegroundColor Green
63+
$components = if ($Runtime) { "Runtime " } else { "SDK and Runtime " }
64+
$components += $Channel -join ', '
65+
66+
Write-Host "Installing .NET $components" -ForegroundColor Green
6167

6268
# The install script is platform-specific
6369
$installScriptExt = if ($script:IsNix) { "sh" } else { "ps1" }
@@ -70,18 +76,13 @@ function Install-Dotnet {
7076
# Download and install the different .NET channels
7177
foreach ($dotnetChannel in $Channel)
7278
{
73-
Write-Host "`n### Installing .NET CLI $Version...`n"
74-
7579
if ($script:IsNix) {
7680
chmod +x $installScriptPath
7781
}
7882

79-
$params = if ($script:IsNix)
80-
{
83+
$params = if ($script:IsNix) {
8184
@('-Channel', $dotnetChannel, '-InstallDir', $env:DOTNET_INSTALL_DIR, '-NoPath', '-Verbose')
82-
}
83-
else
84-
{
85+
} else {
8586
@{
8687
Channel = $dotnetChannel
8788
InstallDir = $env:DOTNET_INSTALL_DIR
@@ -90,9 +91,13 @@ function Install-Dotnet {
9091
}
9192
}
9293

93-
& $installScriptPath @params
94+
# Install just the runtime, not the SDK
95+
if ($Runtime) {
96+
if ($script:IsNix) { $params += @('-Runtime', 'dotnet') }
97+
else { $params['Runtime'] = 'dotnet' }
98+
}
9499

95-
Write-Host "`n### Installation complete for version $Version."
100+
exec { & $installScriptPath @params }
96101
}
97102

98103
$env:PATH = $env:DOTNET_INSTALL_DIR + [System.IO.Path]::PathSeparator + $env:PATH
@@ -107,7 +112,12 @@ task SetupDotNet -Before Clean, Build, TestServerWinPS, TestServerPS7, TestServe
107112

108113
if (!(Test-Path $dotnetExePath)) {
109114
# TODO: Test .NET 5 with PowerShell 7.1
110-
Install-Dotnet -Channel '3.1','5.0','6.0'
115+
#
116+
# We use the .NET 6 SDK, so we always install it and its runtime.
117+
Install-Dotnet -Channel '6.0' # SDK and runtime
118+
# Anywhere other than on a Mac with an M1 processor, we additionally
119+
# install the .NET 3.1 and 5.0 runtimes (but not their SDKs).
120+
if (!$script:IsAppleM1) { Install-Dotnet -Channel '3.1','5.0' -Runtime }
111121
}
112122

113123
# This variable is used internally by 'dotnet' to know where it's installed
@@ -228,10 +238,14 @@ task TestServer TestServerWinPS,TestServerPS7,TestServerPS72
228238

229239
task TestServerWinPS -If (-not $script:IsNix) {
230240
Set-Location .\test\PowerShellEditorServices.Test\
241+
# TODO: See https://github.com/dotnet/sdk/issues/18353 for x64 test host
242+
# that is debuggable! If architecture is added, the assembly path gets an
243+
# additional folder, necesstiating fixes to find the commands definition
244+
# file and test files.
231245
exec { & $script:dotnetExe $script:dotnetTestArgs $script:NetRuntime.Desktop }
232246
}
233247

234-
task TestServerPS7 -If (-not $script:IsRosetta) {
248+
task TestServerPS7 -If (-not $script:IsAppleM1) {
235249
Set-Location .\test\PowerShellEditorServices.Test\
236250
exec { & $script:dotnetExe $script:dotnetTestArgs $script:NetRuntime.PS7 }
237251
}
@@ -245,7 +259,7 @@ task TestE2E {
245259
Set-Location .\test\PowerShellEditorServices.Test.E2E\
246260

247261
$env:PWSH_EXE_NAME = if ($IsCoreCLR) { "pwsh" } else { "powershell" }
248-
$NetRuntime = if ($IsRosetta) { $script:NetRuntime.PS72 } else { $script:NetRuntime.PS7 }
262+
$NetRuntime = if ($IsAppleM1) { $script:NetRuntime.PS72 } else { $script:NetRuntime.PS7 }
249263
exec { & $script:dotnetExe $script:dotnetTestArgs $NetRuntime }
250264

251265
# Run E2E tests in ConstrainedLanguage mode.

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,16 @@ contribute code, documentation, tests, or bug reports, please read our [Contribu
157157

158158
## Maintainers
159159

160+
- [Justin Grote](https://github.com/JustinGrote) - [@JustinWGrote](https://twitter.com/justinwgrote)
160161
- [Patrick Meinecke](https://github.com/SeeminglyScience) - [@SeeminglyScienc](http://twitter.com/SeeminglyScienc)
161-
- [Rob Holt](https://github.com/rjmholt) - [@rjmholt](https://twitter.com/rjmholt)
162162
- [Andy Schwartzmeyer](https://github.com/andschwa) - [andschwa.com](https://andschwa.com/)
163163

164+
### Emeriti
165+
166+
- [Rob Holt](https://github.com/rjmholt) - [@rjmholt](https://twitter.com/rjmholt)
167+
- [Tyler Leonhardt](https://github.com/TylerLeonhardt) - [tylerleonhardt.com](https://tylerleonhardt.com)
168+
- [David Wilson](https://github.com/daviwil) - [@daviwil](https://twitter.com/daviwil)
169+
164170
## License
165171

166172
This project is [licensed under the MIT License](LICENSE).

global.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"sdk": {
3+
"version": "6.0",
4+
"rollForward": "latestFeature",
5+
"allowPrerelease": true
6+
}
7+
}

module/PowerShellEditorServices/PowerShellEditorServices.psd1

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ RootModule = if ($PSEdition -eq 'Core')
1919
}
2020

2121
# Version number of this module.
22-
ModuleVersion = '2.5.3'
22+
ModuleVersion = '3.0.3'
2323

2424
# ID used to uniquely identify this module
2525
GUID = '9ca15887-53a2-479a-9cda-48d26bcb6c47'

module/PowerShellEditorServices/Start-EditorServices.ps1

+3
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ param(
6666
[switch]
6767
$DebugServiceOnly,
6868

69+
[switch]
70+
$LanguageServiceOnly,
71+
6972
[string[]]
7073
$AdditionalModules,
7174

modules.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"Version": "1.1.3"
77
},
88
"PSReadLine": {
9-
"Version": "2.1.0"
9+
"Version": "2.2.0-beta4",
10+
"AllowPrerelease": true
1011
}
1112
}

src/PowerShellEditorServices.Hosting/Commands/InvokeReadLineConstructorCommand.cs

-21
This file was deleted.

src/PowerShellEditorServices.Hosting/Commands/InvokeReadLineForEditorServicesCommand.cs

-53
This file was deleted.

0 commit comments

Comments
 (0)