Skip to content

Commit ea2589c

Browse files
Fix startup on empty workspace (#1289)
* Fix startup on empty workspace and add useful snippets * Update CHANGELOG.md Co-authored-by: Tyler Leonhardt (POWERSHELL) <tyleonha@microsoft.com>
1 parent 07b4131 commit ea2589c

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

.vscode/snippets.code-snippets

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
// Place your PowerShellEditorServices workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3+
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4+
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5+
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7+
// Placeholders with the same ids are connected.
8+
// Example:
9+
// "Print to console": {
10+
// "scope": "javascript,typescript",
11+
// "prefix": "log",
12+
// "body": [
13+
// "console.log('$1');",
14+
// "$2"
15+
// ],
16+
// "description": "Log output to console"
17+
// }
18+
// Use https://snippet-generator.app/ to generate snippets
19+
"Wait for debugger to be attached": {
20+
"prefix": "WaitForDebugger",
21+
"body": [
22+
"while (!System.Diagnostics.Debugger.IsAttached)",
23+
"{",
24+
" System.Console.WriteLine(System.Diagnostics.Process.GetCurrentProcess().Id);",
25+
" System.Threading.Thread.Sleep(2000);",
26+
"}"
27+
],
28+
"description": "Wait for debugger to be attached"
29+
},
30+
"Copyright header": {
31+
"prefix": "CopyrightHeader",
32+
"body": [
33+
"//",
34+
"// Copyright (c) Microsoft. All rights reserved.",
35+
"// Licensed under the MIT license. See LICENSE file in the project root for full license information.",
36+
"//"
37+
],
38+
"description": "Copyright header"
39+
}
40+
}

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## v2.2.0-preview.2
44
### Wednesday, May 06, 2020
55

6+
- 🛫🐛 [PowerShellEditorServices #1289](https://github.com/PowerShell/PowerShellEditorServices/pull/1289) -
7+
Fix startup on empty workspaces.
68
- 🛫🐛 [PowerShellEditorServices #1285](https://github.com/PowerShell/PowerShellEditorServices/pull/1285) -
79
Use API on ScriptBlock to generate PSCommand to run in ConstrainedLanguage mode.
810
- ⚡️🧠 [PowerShellEditorServices #1283](https://github.com/PowerShell/PowerShellEditorServices/pull/1283) -

src/PowerShellEditorServices/Server/PsesLanguageServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public async Task StartAsync()
102102
{
103103
workspaceService.WorkspacePath = request.RootUri.GetFileSystemPath();
104104
}
105-
else
105+
else if (request.WorkspaceFolders != null)
106106
{
107107
// If RootUri isn't set, try to use the first WorkspaceFolder.
108108
// TODO: Support multi-workspace.

0 commit comments

Comments
 (0)