Skip to content

Commit

Permalink
Improve Ruby LSP extension's status item names
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Aug 23, 2024
1 parent 20ff3b1 commit 2661022
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
8 changes: 4 additions & 4 deletions vscode/src/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class RubyVersionStatus extends StatusItem {
constructor() {
super("rubyVersion");

this.item.name = "Ruby LSP Status";
this.item.name = "Ruby Version";
this.item.command = {
title: "Configure",
command: Command.SelectVersionManager,
Expand All @@ -65,7 +65,7 @@ export class ServerStatus extends StatusItem {
constructor() {
super("server");

this.item.name = "Ruby LSP Status";
this.item.name = "Ruby LSP Server Status";
this.item.text = "Ruby LSP: Starting";
this.item.severity = vscode.LanguageStatusSeverity.Information;
this.item.command = {
Expand Down Expand Up @@ -124,7 +124,7 @@ export class ExperimentalFeaturesStatus extends StatusItem {
? "Experimental features enabled"
: "Experimental features disabled";

this.item.name = "Experimental features";
this.item.name = "Ruby LSP Experimental Features";
this.item.text = message;
this.item.command = {
title: experimentalFeaturesEnabled ? "Disable" : "Enable",
Expand Down Expand Up @@ -164,7 +164,7 @@ export class FormatterStatus extends StatusItem {
constructor() {
super("formatter");

this.item.name = "Formatter";
this.item.name = "Ruby LSP Formatter";
this.item.command = {
title: "Help",
command: Command.FormatterHelp,
Expand Down
13 changes: 10 additions & 3 deletions vscode/src/test/suite/status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ suite("StatusItems", () => {

test("Status is initialized with the right values", () => {
assert.strictEqual(status.item.text, "Using Ruby 3.2.0 with shadowenv");
assert.strictEqual(status.item.name, "Ruby LSP Status");
assert.strictEqual(status.item.name, "Ruby Version");
assert.strictEqual(status.item.command?.title, "Configure");
assert.strictEqual(
status.item.command.command,
Expand Down Expand Up @@ -93,6 +93,7 @@ suite("StatusItems", () => {
status.item.severity,
vscode.LanguageStatusSeverity.Information,
);
assert.strictEqual(status.item.name, "Ruby LSP Server Status");
});

test("Refresh when server is running", () => {
Expand All @@ -103,6 +104,7 @@ suite("StatusItems", () => {
status.item.severity,
vscode.LanguageStatusSeverity.Information,
);
assert.strictEqual(status.item.name, "Ruby LSP Server Status");
});

test("Refresh when server is stopping", () => {
Expand All @@ -113,6 +115,7 @@ suite("StatusItems", () => {
status.item.severity,
vscode.LanguageStatusSeverity.Information,
);
assert.strictEqual(status.item.name, "Ruby LSP Server Status");
});

test("Refresh when server has errored", () => {
Expand All @@ -123,6 +126,7 @@ suite("StatusItems", () => {
status.item.severity,
vscode.LanguageStatusSeverity.Error,
);
assert.strictEqual(status.item.name, "Ruby LSP Server Status");
});
});

Expand All @@ -146,7 +150,7 @@ suite("StatusItems", () => {

test("Status is initialized with the right values", () => {
assert.match(status.item.text, /Experimental features (dis|en)abled/);
assert.strictEqual(status.item.name, "Experimental features");
assert.strictEqual(status.item.name, "Ruby LSP Experimental Features");
assert.match(status.item.command?.title!, /Enable|Disable/);
assert.strictEqual(
status.item.command!.command,
Expand Down Expand Up @@ -264,7 +268,7 @@ suite("StatusItems", () => {

test("Status is initialized with the right values", () => {
assert.strictEqual(status.item.text, "Formatter: auto");
assert.strictEqual(status.item.name, "Formatter");
assert.strictEqual(status.item.name, "Ruby LSP Formatter");
assert.strictEqual(status.item.command?.title, "Help");
assert.strictEqual(status.item.command.command, Command.FormatterHelp);
});
Expand Down Expand Up @@ -296,13 +300,15 @@ suite("StatusItems", () => {
status.item.text,
"Addons: requires server to be v0.17.4 or higher to display this field",
);
assert.strictEqual(status.item.name, "Ruby LSP Addons");
});

test("Status displays no addons when addons is an empty array", () => {
workspace.lspClient!.addons = [];
status.refresh(workspace);

assert.strictEqual(status.item.text, "Addons: none");
assert.strictEqual(status.item.name, "Ruby LSP Addons");
});

test("Status displays addon count and command to list commands", () => {
Expand All @@ -314,6 +320,7 @@ suite("StatusItems", () => {
status.refresh(workspace);

assert.strictEqual(status.item.text, "Addons: 2");
assert.strictEqual(status.item.name, "Ruby LSP Addons");
assert.strictEqual(status.item.command?.title, "Details");
assert.strictEqual(status.item.command.command, Command.DisplayAddons);
});
Expand Down

0 comments on commit 2661022

Please sign in to comment.