Skip to content

Commit

Permalink
Merge pull request #54 from ironmansoftware/refactoring
Browse files Browse the repository at this point in the history
Fixed issue with refactoring
  • Loading branch information
adamdriscoll authored Jul 5, 2024
2 parents f6150c7 + 459d059 commit aa4ede0
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions vscode/powershellprotools/src/commands/refactoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ import { RefactorInfo, RefactoringProperty, RefactorProperty, RefactorRequest, R

//https://github.com/microsoft/vscode-extension-samples/blob/master/code-actions-sample/src/extension.ts
export class RefactoringCommands implements ICommand, vscode.CodeActionProvider {

licensed: boolean;

constructor() {
// Container.PowerShellService.GetLicense().then(license => {
// this.licensed = license.Status === 'Licensed';
// });
}

async provideCodeActions(document: vscode.TextDocument, range: vscode.Range | vscode.Selection, context: vscode.CodeActionContext, token: vscode.CancellationToken): Promise<(vscode.CodeAction | vscode.Command)[]> {
if (!Container.initialize) return;

Expand All @@ -36,24 +27,13 @@ export class RefactoringCommands implements ICommand, vscode.CodeActionProvider
let we = await this.requestRefactor(request, false);
if (we.entries().length == 0) continue;

if (this.licensed) {
var action = new vscode.CodeAction(r.Name, vscode.CodeActionKind.RefactorExtract);
action.edit = we;
action.command = {
title: 'Rename',
command: 'editor.action.rename'
}
codeActions.push(action);
}
else {
var action = new vscode.CodeAction(r.Name, vscode.CodeActionKind.Refactor);
action.command = {
command: 'poshProTools.refactoringInfo',
title: 'Refactoring requires a PowerShell Pro Tools license',
tooltip: 'Learn more.'
}
codeActions.push(action);
var action = new vscode.CodeAction(r.Name, vscode.CodeActionKind.RefactorExtract);
action.edit = we;
action.command = {
title: 'Rename',
command: 'editor.action.rename'
}
codeActions.push(action);
}

return codeActions;
Expand Down

0 comments on commit aa4ede0

Please sign in to comment.