Skip to content

Commit 4bc6942

Browse files
committed
Fix formatting. Remove overly verbose selection
1 parent bd0bc9b commit 4bc6942

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Set the default behavior, in case people don't have core.autocrlf set.
22
* text=auto
33

4+
# Set svg to binary type, as SVG is unlikely to be editted by hand. Can be treated as checked in blob
5+
*.svg binary
6+
47
# .gitattributes in project root
58
# npm now seems to be insisting on LF - see https://github.com/npm/npm/issues/17161
69
package.json text eol=lf

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@
105105
"category": "PowerShell"
106106
},
107107
{
108-
"command": "PowerShell.RefreshCommandsExplorer",
109-
"title": "Refresh",
110-
"icon": {
111-
"light": "resources/light/refresh.svg",
112-
"dark": "resources/dark/refresh.svg"
108+
"command": "PowerShell.RefreshCommandsExplorer",
109+
"title": "Refresh",
110+
"icon": {
111+
"light": "resources/light/refresh.svg",
112+
"dark": "resources/dark/refresh.svg"
113113
},
114114
"category": "PowerShell"
115115
},
@@ -651,4 +651,4 @@
651651
]
652652
},
653653
"private": true
654-
}
654+
}

src/features/GetCommands.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ export class GetCommandsFeature implements IFeature {
1919
return;
2020
}
2121
this.languageClient.sendRequest(GetAllCommandsRequestType, "").then((result) => {
22-
this.commandsExplorerProvider.PowerShellCommands = result.map(toCommand);
22+
this.commandsExplorerProvider.powerShellCommands = result.map(toCommand);
2323
this.commandsExplorerProvider.refresh();
2424
});
2525
});
2626
this.commandsExplorerProvider = new CommandsExplorerProvider();
2727
vscode.window.registerTreeDataProvider("PowerShellCommands", this.commandsExplorerProvider);
2828
vscode.commands.registerCommand("PowerShell.InsertCommand", (item) => {
2929
const editor = vscode.window.activeTextEditor;
30-
const document = editor.document;
31-
const selection = editor.selection;
32-
const sls = selection.start;
33-
const sle = selection.end;
30+
const sls = editor.selection.start;
31+
const sle = editor.selection.end;
3432
const range = new vscode.Range(sls.line, sls.character, sle.line, sle.character);
3533
editor.edit((editBuilder) => {
3634
editBuilder.replace(range, item.Name);
@@ -50,7 +48,7 @@ export class GetCommandsFeature implements IFeature {
5048

5149
class CommandsExplorerProvider implements vscode.TreeDataProvider<Command> {
5250
public readonly onDidChangeTreeData: vscode.Event<Command | undefined>;
53-
public PowerShellCommands: Command[];
51+
public powerShellCommands: Command[];
5452
private didChangeTreeData: vscode.EventEmitter<Command | undefined> = new vscode.EventEmitter<Command>();
5553

5654
constructor() {
@@ -66,10 +64,11 @@ class CommandsExplorerProvider implements vscode.TreeDataProvider<Command> {
6664
}
6765

6866
public getChildren(element?: Command): Thenable<Command[]> {
69-
return Promise.resolve(this.PowerShellCommands ? this.PowerShellCommands : []);
67+
return Promise.resolve(this.powerShellCommands || []);
7068
}
7169

7270
}
71+
7372
function toCommand(command: any): Command {
7473
return new Command(
7574
command.name,

src/features/ShowHelp.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ export class ShowHelpFeature implements IFeature {
2424
}
2525
if (item === undefined) {
2626

27-
const editor = vscode.window.activeTextEditor;
28-
const selection = editor.selection;
29-
const doc = editor.document;
30-
const cwr = doc.getWordRangeAtPosition(selection.active);
31-
const text = doc.getText(cwr);
27+
const editor = vscode.window.activeTextEditor;
28+
29+
const selection = editor.selection;
30+
const doc = editor.document;
31+
const cwr = doc.getWordRangeAtPosition(selection.active);
32+
const text = doc.getText(cwr);
3233

3334
this.languageClient.sendRequest(ShowHelpRequestType, text);
3435
} else {

0 commit comments

Comments
 (0)