Skip to content

Commit

Permalink
Display add-on version in the displayAddons command (#2662)
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 authored Oct 3, 2024
1 parent a7373cc commit 6b6dcf8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/ruby_lsp/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def process_message(message)
id: message[:id],
response:
Addon.addons.map do |addon|
{ name: addon.name, errored: addon.error? }
{ name: addon.name, version: addon.version, errored: addon.error? }
end,
),
)
Expand Down
4 changes: 3 additions & 1 deletion test/server_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,11 @@ def test_workspace_addons
addons_info = @server.pop_response.response

assert_equal("Foo", addons_info[0][:name])
assert_equal("0.1.0", addons_info[0][:version])
refute(addons_info[0][:errored])

assert_equal("Bar", addons_info[1][:name])
assert_equal("0.2.0", addons_info[1][:version])
assert(addons_info[1][:errored])
ensure
RubyLsp::Addon.addons.clear
Expand Down Expand Up @@ -722,7 +724,7 @@ def name
def deactivate; end

def version
"0.1.0"
"0.2.0"
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions vscode/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export interface RubyInterface {
export interface Addon {
name: string;
errored: boolean;
// Older versions of ruby-lsp don't return version for add-ons requests
version?: string;
}

export interface ClientInterface {
Expand Down
2 changes: 1 addition & 1 deletion vscode/src/rubyLsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class RubyLsp {
.map((addon) => {
const icon = addon.errored ? "$(error)" : "$(pass)";
return {
label: `${icon} ${addon.name}`,
label: `${icon} ${addon.name} ${addon.version ? `v${addon.version}` : ""}`,
};
});

Expand Down

0 comments on commit 6b6dcf8

Please sign in to comment.