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

Add extension management #813

Closed
wants to merge 3 commits into from
Closed

Conversation

vinistock
Copy link
Member

Motivation

Closes #590

It will be good to allow clients to both display which Ruby LSP extensions are being used and also deactivate them if desired. Maybe an extension is failing and we want to disable it temporarily.

This PR adds a custom request that clients can use to discover which extensions have been registered and also starts accepting an initialization option with extension configuration, which clients can use to disable specific extensions.

Implementation

I split the implementation by commits.

  1. Add a custom request that returns the discovered extensions
  2. Starts accepting initialization options with extension configuration, so that we can skip activating disabled ones
  3. Made an adjustment to our documentation mentioning that extensions should register their functionality all inside of activate. We'll need to update ruby-lsp-rails to match this, but I couldn't think of another way to de-register a listener that wouldn't involve messing up with the $LOAD_PATH and $LOADED_FEATURES

I'd appreciate feedback on the approach.

Automated Tests

Added some tests.

…ing activate

If server extensions register listeners outside of activation, then we
have no way of preventing them from registering if the user decided to
disable it
@vinistock vinistock added the enhancement New feature or request label Jul 12, 2023
@vinistock vinistock added this to the 2023-Q3 milestone Jul 12, 2023
@vinistock vinistock self-assigned this Jul 12, 2023
@vinistock vinistock requested a review from a team as a code owner July 12, 2023 18:50
@vinistock vinistock requested review from andyw8 and KaanOzkan July 12, 2023 18:50
@github-actions
Copy link
Contributor

Benchmark results in seconds (slowest at top)

          textDocument/completion average: 0.263018 std_dev: 0.005053
          textDocument/diagnostic average: 0.040978 std_dev: 0.008788
          textDocument/definition average: 0.004354 std_dev: 0.00293
      textDocument/selectionRange average: 0.003355 std_dev: 0.000489
   textDocument/documentHighlight average: 0.00183 std_dev: 0.0001
        textDocument/documentLink average: 0.001747 std_dev: 0.000106
            textDocument/codeLens average: 0.001736 std_dev: 0.000106
 textDocument/semanticTokens/full average: 0.001709 std_dev: 0.000263
      textDocument/documentSymbol average: 0.001703 std_dev: 7.3e-05
        textDocument/foldingRange average: 0.001598 std_dev: 0.000103
textDocument/semanticTokens/range average: 0.000858 std_dev: 7.4e-05
               codeAction/resolve average: 0.000649 std_dev: 5.1e-05
               textDocument/hover average: 0.000614 std_dev: 4.9e-05
           textDocument/inlayHint average: 0.000612 std_dev: 3.7e-05
          textDocument/formatting average: 6.9e-05 std_dev: 0.000285
    textDocument/onTypeFormatting average: 6.8e-05 std_dev: 4.0e-05
          textDocument/codeAction average: 4.0e-05 std_dev: 2.7e-05


================================================================================
Comparison with main branch:

 textDocument/semanticTokens/full unchanged
textDocument/semanticTokens/range unchanged
      textDocument/documentSymbol unchanged
        textDocument/foldingRange unchanged
          textDocument/formatting unchanged
          textDocument/diagnostic unchanged
        textDocument/documentLink unchanged
           textDocument/inlayHint unchanged
      textDocument/selectionRange unchanged
   textDocument/documentHighlight unchanged
               textDocument/hover unchanged
          textDocument/codeAction unchanged
    textDocument/onTypeFormatting unchanged
               codeAction/resolve unchanged
          textDocument/completion unchanged
            textDocument/codeLens unchanged
          textDocument/definition unchanged


================================================================================
Missing benchmarks:

RubyLsp::Requests::ShowSyntaxTree

@vinistock
Copy link
Member Author

Putting this on pause from now until we have more use cases to learn from.

@vinistock vinistock closed this Jul 17, 2023
@vinistock vinistock deleted the vs/add_extension_management branch July 17, 2023 17:14
vinistock pushed a commit that referenced this pull request Feb 28, 2024
…d-patch-9aea4da10c

Bump the minor-and-patch group with 5 updates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inform client of server extensions
1 participant