Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display addons status in the control panel #2180

Merged
merged 1 commit into from
Jun 14, 2024
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Jun 13, 2024

Motivation

This will give users a quick overview of the addons that are enabled in their workspace.

We plan to expand this feature to display more information about addons in the future, such as:

  • The version of the addon
  • The gem name of the addon
  • Addons that weren't activated due to errors

But some of these features will require changes to the addon API, so we will plan them for a future release.

Implementation

The feature is implemented on both the server and the extension:

  • Server:
    • The server now has an experimental field in the capabilities object, which currently only has the addon_detection field.
    • The server now supports a custom rubyLsp/workspace/addons request that returns the list of addons that are enabled in the workspace. At this iteration, each addon only has name and errored attributes.
  • Extension:
    • In the client.afterStart callback, the extension now sends a rubyLsp/workspace/addons request to the server to fetch and store the list of addons.
    • A new AddonsStatus status item is added to display addon's status.
      • If the server doesn't have the capability, the status will mention that server 0.17.4 or later is required.
        Screenshot 2024-06-13 at 13 42 47
      • If the server supports the capability but the workspace has no addons, the status will mention that no addons are enabled.
        Screenshot 2024-06-13 at 13 29 26
      • If the workspace has addons, the status will display the names of the addons that are enabled. If the addon failed to activate, (errored) will be added after its name.
        Screenshot 2024-06-13 at 13 29 55

I plan to explore better UI in later iterations as simply having the names listed will already make addon development easier.

Automated Tests

Added some

Manual Tests

@st0012 st0012 force-pushed the implement-addon-status branch 3 times, most recently from a03e3aa to 969794f Compare June 14, 2024 15:37
@st0012 st0012 added enhancement New feature or request vscode This pull request should be included in the VS Code extension's release notes labels Jun 14, 2024
@st0012 st0012 self-assigned this Jun 14, 2024
@st0012 st0012 marked this pull request as ready for review June 14, 2024 15:50
@st0012 st0012 requested a review from a team as a code owner June 14, 2024 15:50
@st0012 st0012 requested review from andyw8 and vinistock June 14, 2024 15:50
lib/ruby_lsp/server.rb Show resolved Hide resolved
vscode/src/status.ts Outdated Show resolved Hide resolved
vscode/src/status.ts Outdated Show resolved Hide resolved
This will give users a quick overview of the addons that are enabled in
their workspace.

We plan to expand this feature to display more information about addons
in the future, such as:

- The version of the addon
- The gem name of the addon
- Addons that weren't activated due to errors

But some of these features will require changes to the addon API, so
we will plan them for a future release.

The feature is implemented on both the server and the extension:

- Server:
  - The server now has an experimental field in the capabilities object,
    which currently only has the `addon_detection` field.
  - The server now supports a custom `rubyLsp/workspace/addons` request
    that returns the list of addons that are enabled in the workspace.
    At this iteration, each addon only has name and errored attributes.
- Extension:
  - In the client.afterStart callback, the extension now sends a
    `rubyLsp/workspace/addons` request to the server to fetch and store
    the list of addons.
  - A new `AddonsStatus` status item is added to display addon's status.
    - If the server doesn't have the capability, the status will mention
      that server 0.17.4 or later is required.
    - If the server supports the capability but the workspace has no addons,
      the status will mention that no addons are enabled.
    - If the workspace has addons, the status will display the names of the
      addons that are enabled.
@st0012 st0012 merged commit b91ec1b into main Jun 14, 2024
34 checks passed
@st0012 st0012 deleted the implement-addon-status branch June 14, 2024 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants