Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 9 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -486,18 +486,7 @@
"body": {
"name": "PowerShell Attach to Host Process",
"type": "PowerShell",
"request": "attach",
"runspaceId": 1
}
},
{
"label": "PowerShell: Attach Interactive Session Runspace",
"description": "Open runspace picker to select runspace to attach debugger to",
"body": {
"name": "PowerShell Attach Interactive Session Runspace",
"type": "PowerShell",
"request": "attach",
"processId": "current"
"request": "attach"
}
},
{
Expand Down Expand Up @@ -588,29 +577,27 @@
"properties": {
"computerName": {
"type": "string",
"description": "Optional: The computer name to which a remote session will be established. Works only on PowerShell 4 and above."
"description": "Optional: The computer name to which a remote session will be established.",
"default": null
},
"processId": {
"type": "string",
"description": "The process id of the PowerShell host process to attach to. Works only on PowerShell 5 and above.",
"type": "number",
"description": "Optional: The ID of the PowerShell host process that should be attached. Will prompt if unspecified.",
"default": null
},
"runspaceId": {
"type": [
"string",
"number"
],
"description": "Optional: The ID of the runspace to debug in the attached process. Defaults to 1. Works only on PowerShell 5 and above.",
"type": "number",
"description": "Optional: The ID of the runspace to debug in the attached process. Will prompt if unspecified.",
"default": null
},
"runspaceName": {
"type": "string",
"description": "Optional: The Name of the runspace to debug in the attached process. Works only on PowerShell 5 and above.",
"description": "Optional: The name of the runspace to debug in the attached process.",
"default": null
},
"customPipeName": {
"type": "string",
"description": "The custom pipe name of the PowerShell host process to attach to. Works only on PowerShell 6.2 and above.",
"description": "The custom pipe name of the PowerShell host process to attach to.",
"default": null
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/features/CodeActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ import vscode = require("vscode");
import { ILogger } from "../logging";

export class CodeActionsFeature implements vscode.Disposable {
private showDocumentationCommand: vscode.Disposable;
private command: vscode.Disposable;

constructor(private log: ILogger) {
// NOTE: While not exposed to the user via package.json, this is
// required as the server's code action sends across a command name.
//
// TODO: In the far future with LSP 3.19 the server can just set a URL
// and this can go away. See https://github.com/microsoft/language-server-protocol/issues/1548
this.showDocumentationCommand =
this.command =
vscode.commands.registerCommand("PowerShell.ShowCodeActionDocumentation", async (ruleName: string) => {
await this.showRuleDocumentation(ruleName);
});
}

public dispose(): void {
this.showDocumentationCommand.dispose();
this.command.dispose();
}

public async showRuleDocumentation(ruleId: string): Promise<void> {
private async showRuleDocumentation(ruleId: string): Promise<void> {
const pssaDocBaseURL = "https://docs.microsoft.com/powershell/utility-modules/psscriptanalyzer/rules/";

if (!ruleId) {
Expand Down
12 changes: 6 additions & 6 deletions src/features/Console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ export class ConsoleFeature extends LanguageClientConsumer {
} else {
selectionRange = editor.document.lineAt(editor.selection.start.line).range;
}

await this.languageClient?.sendRequest(EvaluateRequestType, {
const client = await LanguageClientConsumer.getLanguageClient();
await client.sendRequest(EvaluateRequestType, {
expression: editor.document.getText(selectionRange),
});

Expand All @@ -217,19 +217,19 @@ export class ConsoleFeature extends LanguageClientConsumer {
for (const command of this.commands) {
command.dispose();
}

for (const handler of this.handlers) {
handler.dispose();
}
}

public override setLanguageClient(languageClient: LanguageClient): void {
this.languageClient = languageClient;
public override onLanguageClientSet(languageClient: LanguageClient): void {
this.handlers = [
this.languageClient.onRequest(
languageClient.onRequest(
ShowChoicePromptRequestType,
(promptDetails) => showChoicePrompt(promptDetails)),

this.languageClient.onRequest(
languageClient.onRequest(
ShowInputPromptRequestType,
(promptDetails) => showInputPrompt(promptDetails)),
];
Expand Down
Loading