diff --git a/docs/CODE_OF_CONDUCT_md.html b/docs/CODE_OF_CONDUCT_md.html new file mode 100644 index 00000000..37e93af7 --- /dev/null +++ b/docs/CODE_OF_CONDUCT_md.html @@ -0,0 +1,183 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + +
+

Contributor Covenant Code of Conduct

+ +

Our Pledge

+ +

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

+ +

Our Standards

+ +

Examples of behavior that contributes to creating a positive environment include:

+ + +

Examples of unacceptable behavior by participants include:

+ + +

Our Responsibilities

+ +

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

+ +

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

+ +

Scope

+ +

This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

+ +

Enforcement

+ +

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at opensource@shopify.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

+ +

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.

+ +

Attribution

+ +

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at www.contributor-covenant.org/version/1/4/code-of-conduct.html

+ +

For answers to common questions about this code of conduct, see www.contributor-covenant.org/faq

+
+
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/CONTRIBUTING_md.html b/docs/CONTRIBUTING_md.html new file mode 100644 index 00000000..0774bebe --- /dev/null +++ b/docs/CONTRIBUTING_md.html @@ -0,0 +1,157 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + +
+

CONTRIBUTING

+ +

Bug reports and pull requests are welcome on GitHub at github.com/Shopify/ruby-lsp-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

+ +

Developing on Ruby LSP

+ +

For general information about developing, refer to the to the documentation for Ruby LSP itself.

+ +

Manually testing a change

+ +

The repo includes a dummy Rails app in test/dummy. If you’re developing a feature, you can add new code to it for testing.

+ +

To test with a real Rails application, you can add a Gemfile entry for ruby-lsp-rails and point it to your local checkout:

+ +
gem "ruby-lsp-rails", path: "../ruby-lsp-rails"
+
+ +

Or to a branch in your fork:

+ +
gem "ruby-lsp-rails", github: "USERNAME/ruby-lsp-rails", branch: "your_branch"
+
+ +

Running the test suite

+ +

To set up the database for the dummy Rails app, and run the full test suite:

+ +
bundle exec rake
+
+ +

Tests are written as ActiveSupport::TestCase tests, so an individual test can be run with:

+ +
bin/rails test test/my_test.rb
+
+
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/LICENSE.txt b/docs/LICENSE.txt new file mode 100644 index 00000000..bf777b4d --- /dev/null +++ b/docs/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2023-present, Shopify Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/docs/README_md.html b/docs/README_md.html new file mode 100644 index 00000000..ae9154de --- /dev/null +++ b/docs/README_md.html @@ -0,0 +1,177 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + +
+

+ +

Ruby LSP Rails

+ +

Ruby LSP Rails is a Ruby LSP addon for extra Rails editor features, such as:

+ + +

Installation

+ +

If you haven’t already done so, you’ll need to first set up Ruby LSP.

+ +

As of v0.3.0, Ruby LSP will automatically include the Ruby LSP Rails addon in its custom bundle when a Rails app is detected. There is no need to add the gem to your bundle.

+ +

Documentation

+ +

See the documentation for more in-depth details about the supported features.

+ +

How Runtime Introspection Works

+ +

LSP tooling is typically based on static analysis, but ruby-lsp-rails actually communicates with your Rails app for some features.

+ +

When Ruby LSP Rails starts, it spawns a rails runner instance which runs {server.rb}. The addon communicates with this process over a pipe (i.e. stdin and stdout) to fetch runtime information about the application.

+ +

When extension is stopped (e.g. by quitting the editor), the server instance is shut down.

+ +
+

[!NOTE] Prior to v0.3.0, ruby-lsp-rails used a different approach which involved mounting a Rack application within the Rails app. That approach was brittle and susceptible to the application’s configuration, such as routing and middleware.

+
+ +

Contributing

+ +

See CONTRIBUTING.md

+ +

License

+ +

The gem is available as open source under the terms of the MIT License.

+
+
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp.html b/docs/RubyLsp.html new file mode 100644 index 00000000..433e3685 --- /dev/null +++ b/docs/RubyLsp.html @@ -0,0 +1,155 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

module RubyLsp

+
+

typed: strict

+ +

typed: strict

+ +

typed: strict

+ +

typed: strict

+ +

NOTE: We should avoid printing to stderr since it causes problems. We never read the standard error pipe from the client, so it will become full and eventually hang or crash. Instead, return a response with an error key.

+ +

typed: strict

+ +

typed: strict

+ +

typed: strict

+ +

typed: strict

+ +

typed: strict

+
+ +
+ + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails.html b/docs/RubyLsp/Rails.html new file mode 100644 index 00000000..2b0d3d79 --- /dev/null +++ b/docs/RubyLsp/Rails.html @@ -0,0 +1,166 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

module RubyLsp::Rails

+
+

Supported features

+ +
+ +
+ + +
+

Constants

+ +
+
>VERSION
+
+
+
+ + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/ActiveSupportTestCaseHelper.html b/docs/RubyLsp/Rails/ActiveSupportTestCaseHelper.html new file mode 100644 index 00000000..8cb04c92 --- /dev/null +++ b/docs/RubyLsp/Rails/ActiveSupportTestCaseHelper.html @@ -0,0 +1,193 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

module RubyLsp::Rails::ActiveSupportTestCaseHelper

+
+ +
+ + + + + + + + + + + + +
+

Public Instance Methods

+ +
+
+

+ extract_test_case_name(node) + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Addon.html b/docs/RubyLsp/Rails/Addon.html new file mode 100644 index 00000000..6599aa33 --- /dev/null +++ b/docs/RubyLsp/Rails/Addon.html @@ -0,0 +1,425 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::Addon

+
+ +
+ + + + + + + + +
+

Public Class Methods

+ +
+
+

+ new() + + +

+ + + +
+ Calls superclass method + +
+ + +
+ + +
+
+ + + + + + +
+

Public Instance Methods

+ +
+
+

+ activate(global_state, message_queue) + + +

+ + + + + +
+ + +
+
+
+

+ create_code_lens_listener(response_builder, uri, dispatcher) + + +

+ + + + + +
+ + +
+
+
+

+ create_definition_listener(response_builder, uri, node_context, dispatcher) + + +

+ + + + + +
+ + +
+
+
+

+ create_document_symbol_listener(response_builder, dispatcher) + + +

+ + + + + +
+ + +
+
+
+

+ create_hover_listener(response_builder, node_context, dispatcher) + + +

+ + + + + +
+ + +
+
+
+

+ deactivate() + + +

+ + + + + +
+ + +
+
+
+

+ name() + + +

+ + + + + +
+ + +
+
+
+

+ register_additional_file_watchers(global_state:, message_queue:) + + +

+ + + + + +
+ + +
+
+
+

+ workspace_did_change_watched_files(changes) + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/CodeLens.html b/docs/RubyLsp/Rails/CodeLens.html new file mode 100644 index 00000000..7b9b5c5c --- /dev/null +++ b/docs/RubyLsp/Rails/CodeLens.html @@ -0,0 +1,441 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::CodeLens

+
+

+ +

This feature adds Code Lens features for Rails applications.

+ +

For Active Support test cases:

+
  • +

    Run tests in the VS Terminal

    +
  • +

    Run tests in the VS Code Test Explorer

    +
  • +

    Debug tests

    +
  • +

    Run migrations in the VS Terminal

    +
+ +

For Rails controllers:

+
  • +

    See the path corresponding to an action

    +
  • +

    Click on the action’s Code Lens to jump to its declaration in the routes.

    +
+ +

Note: This depends on a support for the rubyLsp.openFile command. For the VS Code extension this is built-in, but for other editors this may require some custom configuration.

+ +

The code lens request informs the editor of runnable commands such as tests. It’s available for tests which inherit from ActiveSupport::TestCase or one of its descendants, such as ActionDispatch::IntegrationTest.

+ +

Example:

+ +

For the following code, Code Lenses will be added above the class definition above each test method.

+ +
Run
+class HelloTest < ActiveSupport::TestCase # <- Will show code lenses above for running or debugging the whole test
+  test "outputs hello" do # <- Will show code lenses above for running or debugging this test
+    # ...
+  end
+
+  test "outputs goodbye" do # <- Will show code lenses above for running or debugging this test
+    # ...
+  end
+end
+
+ +

Example:

+ +
Run
+class AddFirstNameToUsers < ActiveRecord::Migration[7.1]
+  # ...
+end
+
+ +

The code lenses will be displayed above the class and above each test method.

+ +

Note: When using the Test Explorer view, if your code contains a statement to pause execution (e.g. debugger) it will cause the test runner to hang.

+ +

For the following code, assuming the routing contains resources :users, a Code Lens will be seen above each action.

+ +
class UsersController < ApplicationController
+  GET /users(.:format)
+  def index # <- Will show code lens above for the path
+  end
+end
+
+ +

Note: Complex routing configurations may not be supported.

+
+ +
+ + + + + + + + +
+

Public Class Methods

+ +
+
+

+ new(client, global_state, response_builder, uri, dispatcher) + + +

+ + + + + +
+ + +
+
+ + + + + + +
+

Public Instance Methods

+ +
+
+

+ on_call_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_class_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_class_node_leave(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_def_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_module_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_module_node_leave(node) + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Definition.html b/docs/RubyLsp/Rails/Definition.html new file mode 100644 index 00000000..045d0567 --- /dev/null +++ b/docs/RubyLsp/Rails/Definition.html @@ -0,0 +1,330 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::Definition

+
+

+ +

The definition request jumps to the definition of the symbol under the cursor.

+ +

Currently supported targets:

+
  • +

    Callbacks

    +
  • +

    Named routes (e.g. users_path)

    +
+ +

Example

+ +
before_action :foo # <- Go to definition on this symbol will jump to the method
+
+ +

Notes for named routes:

+
  • +

    It is available only in Rails 7.1 or newer.

    +
  • +

    Route may be defined across multiple files, e.g. using draw, rather than in routes.rb.

    +
  • +

    Routes won’t be found if not defined for the Rails development environment.

    +
  • +

    If using constraints, the route can only be found if the constraints are met.

    +
  • +

    Changes to routes won’t be picked up until the server is restarted.

    +
+
+ +
+ + + + + + + + +
+

Public Class Methods

+ +
+
+

+ new(client, response_builder, node_context, index, dispatcher) + + +

+ + + + + +
+ + +
+
+ + + + + + +
+

Public Instance Methods

+ +
+
+

+ handle_possible_dsl(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_call_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_string_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_symbol_node_enter(node) + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/DocumentSymbol.html b/docs/RubyLsp/Rails/DocumentSymbol.html new file mode 100644 index 00000000..dfb4af57 --- /dev/null +++ b/docs/RubyLsp/Rails/DocumentSymbol.html @@ -0,0 +1,335 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::DocumentSymbol

+
+

+ +

The document symbol request allows users to navigate between associations, validations, callbacks and ActiveSupport test cases with VS Code’s “Go to Symbol” feature.

+
+ +
+ + + + + + + + +
+

Public Class Methods

+ +
+
+

+ new(response_builder, dispatcher) + + +

+ + + + + +
+ + +
+
+ + + + + + +
+

Public Instance Methods

+ +
+
+

+ on_call_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_class_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_class_node_leave(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_module_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_module_node_leave(node) + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Hover.html b/docs/RubyLsp/Rails/Hover.html new file mode 100644 index 00000000..20379014 --- /dev/null +++ b/docs/RubyLsp/Rails/Hover.html @@ -0,0 +1,282 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::Hover

+
+

+ +

Augment hover with information about a model.

+ +

Example

+ +
User.all
+# ^ hovering here will show information about the User model
+
+
+ +
+ + + + + + + + +
+

Public Class Methods

+ +
+
+

+ new(client, response_builder, node_context, global_state, dispatcher) + + +

+ + + + + +
+ + +
+
+ + + + + + +
+

Public Instance Methods

+ +
+
+

+ on_call_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_constant_path_node_enter(node) + + +

+ + + + + +
+ + +
+
+
+

+ on_constant_read_node_enter(node) + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/IndexingEnhancement.html b/docs/RubyLsp/Rails/IndexingEnhancement.html new file mode 100644 index 00000000..138569b1 --- /dev/null +++ b/docs/RubyLsp/Rails/IndexingEnhancement.html @@ -0,0 +1,181 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::IndexingEnhancement

+
+ +
+ + + + + + + + + + + + +
+

Public Instance Methods

+ +
+
+

+ on_call_node(index, owner, node, file_path) + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Railtie.html b/docs/RubyLsp/Rails/Railtie.html new file mode 100644 index 00000000..4c8a2f17 --- /dev/null +++ b/docs/RubyLsp/Rails/Railtie.html @@ -0,0 +1,135 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::Railtie

+
+ +
+ + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/RunnerClient.html b/docs/RubyLsp/Rails/RunnerClient.html new file mode 100644 index 00000000..66bea324 --- /dev/null +++ b/docs/RubyLsp/Rails/RunnerClient.html @@ -0,0 +1,497 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::RunnerClient

+
+ +
+ + +
+

Constants

+ +
+
>MAX_RETRIES
+
+
+
+ + +
+

Attributes

+ + +
+

+ rails_root (attr_reader) +

+ +
+ +
+
+ +
+ + + + + +
+

Public Class Methods

+ +
+
+

+ create_client() + + +

+ + + + + +
+ + +
+
+
+

+ new() + + +

+ + + + + +
+ + +
+
+ + + + + + +
+

Public Instance Methods

+ +
+
+

+ association_target_location(model_name:, association_name:) + + +

+ + + + + +
+ + +
+
+
+

+ model(name) + + +

+ + + + + +
+ + +
+
+
+

+ route(controller:, action:) + + +

+ + + + + +
+ + +
+
+
+

+ route_location(name) + + +

+ + + + + +
+ + +
+
+
+

+ shutdown() + + +

+ + + + + +
+ + +
+
+
+

+ stopped?() + + +

+ + + + + +
+ + +
+
+
+

+ trigger_reload() + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/RunnerClient/EmptyMessageError.html b/docs/RubyLsp/Rails/RunnerClient/EmptyMessageError.html new file mode 100644 index 00000000..7bab4fd1 --- /dev/null +++ b/docs/RubyLsp/Rails/RunnerClient/EmptyMessageError.html @@ -0,0 +1,135 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::RunnerClient::EmptyMessageError

+
+ +
+ + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/RunnerClient/IncompleteMessageError.html b/docs/RubyLsp/Rails/RunnerClient/IncompleteMessageError.html new file mode 100644 index 00000000..0ae2b04a --- /dev/null +++ b/docs/RubyLsp/Rails/RunnerClient/IncompleteMessageError.html @@ -0,0 +1,135 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::RunnerClient::IncompleteMessageError

+
+ +
+ + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/RunnerClient/InitializationError.html b/docs/RubyLsp/Rails/RunnerClient/InitializationError.html new file mode 100644 index 00000000..86b29f6d --- /dev/null +++ b/docs/RubyLsp/Rails/RunnerClient/InitializationError.html @@ -0,0 +1,135 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::RunnerClient::InitializationError

+
+ +
+ + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/RunnerClient/NullClient.html b/docs/RubyLsp/Rails/RunnerClient/NullClient.html new file mode 100644 index 00000000..4ca25ceb --- /dev/null +++ b/docs/RubyLsp/Rails/RunnerClient/NullClient.html @@ -0,0 +1,252 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::RunnerClient::NullClient

+
+ +
+ + + + + + + + +
+

Public Class Methods

+ +
+
+

+ new() + + +

+ + + + + +
+ + +
+
+ + + + + + +
+

Public Instance Methods

+ +
+
+

+ rails_root() + + +

+ + + + + +
+ + +
+
+
+

+ shutdown() + + +

+ + + + + +
+ + +
+
+
+

+ stopped?() + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Server.html b/docs/RubyLsp/Rails/Server.html new file mode 100644 index 00000000..17cb299a --- /dev/null +++ b/docs/RubyLsp/Rails/Server.html @@ -0,0 +1,291 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::Server

+
+ +
+ + +
+

Constants

+ +
+
>VOID
+
+
+
+ + + + + + +
+

Public Class Methods

+ +
+
+

+ new() + + +

+ + + + + +
+ + +
+
+ + + + + + +
+

Public Instance Methods

+ +
+
+

+ execute(request, params) + + +

+ + + + + +
+ + +
+
+
+

+ start() + + +

+ + + + + +
+ + +
+
+ + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Support.html b/docs/RubyLsp/Rails/Support.html new file mode 100644 index 00000000..11719139 --- /dev/null +++ b/docs/RubyLsp/Rails/Support.html @@ -0,0 +1,135 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

module RubyLsp::Rails::Support

+
+ +
+ + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Support/Associations.html b/docs/RubyLsp/Rails/Support/Associations.html new file mode 100644 index 00000000..12b28b1d --- /dev/null +++ b/docs/RubyLsp/Rails/Support/Associations.html @@ -0,0 +1,155 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

module RubyLsp::Rails::Support::Associations

+
+ +
+ + +
+

Constants

+ +
+
>ALL
+
+
+
+ + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Support/Callbacks.html b/docs/RubyLsp/Rails/Support/Callbacks.html new file mode 100644 index 00000000..025da5e9 --- /dev/null +++ b/docs/RubyLsp/Rails/Support/Callbacks.html @@ -0,0 +1,176 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

module RubyLsp::Rails::Support::Callbacks

+
+ +
+ + +
+

Constants

+ +
+
>ALL
+
+
>CONTROLLERS
+
+
>JOBS
+
+
>MODELS
+
+
+
+ + + + + + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Support/LocationBuilder.html b/docs/RubyLsp/Rails/Support/LocationBuilder.html new file mode 100644 index 00000000..6d412bd3 --- /dev/null +++ b/docs/RubyLsp/Rails/Support/LocationBuilder.html @@ -0,0 +1,186 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::Support::LocationBuilder

+
+ +
+ + + + + + + + +
+

Public Class Methods

+ +
+
+

+ line_location_from_s(location_string) + + +

+ + + + + +
+ + +
+
+ + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/RubyLsp/Rails/Support/RailsDocumentClient.html b/docs/RubyLsp/Rails/Support/RailsDocumentClient.html new file mode 100644 index 00000000..76cc7dbc --- /dev/null +++ b/docs/RubyLsp/Rails/Support/RailsDocumentClient.html @@ -0,0 +1,222 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+

class RubyLsp::Rails::Support::RailsDocumentClient

+
+ +
+ + +
+

Constants

+ +
+
>RAILS_DOC_HOST
+
+
>RAILTIES_VERSION
+
+
>SUPPORTED_RAILS_DOC_NAMESPACES
+
+
+
+ + + + + + +
+

Public Class Methods

+ +
+
+

+ generate_rails_document_urls(name) + + +

+ + + + + +
+ + +
+
+ + + + + + + + +
+
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/code_lens.gif b/docs/code_lens.gif new file mode 100644 index 00000000..77daf6ce Binary files /dev/null and b/docs/code_lens.gif differ diff --git a/docs/created.rid b/docs/created.rid new file mode 100644 index 00000000..0ebb441d --- /dev/null +++ b/docs/created.rid @@ -0,0 +1,20 @@ +Wed, 28 Aug 2024 19:27:22 +0000 +CODE_OF_CONDUCT.md Wed, 28 Aug 2024 19:27:14 +0000 +CONTRIBUTING.md Wed, 28 Aug 2024 19:27:14 +0000 +README.md Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby-lsp-rails.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/addon.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/code_lens.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/definition.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/document_symbol.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/hover.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/indexing_enhancement.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/runner_client.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/server.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/support/active_support_test_case_helper.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/support/associations.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/support/callbacks.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/support/location_builder.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp/ruby_lsp_rails/support/rails_document_client.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp_rails/railtie.rb Wed, 28 Aug 2024 19:27:14 +0000 +lib/ruby_lsp_rails/version.rb Wed, 28 Aug 2024 19:27:14 +0000 diff --git a/docs/css/snapper.css b/docs/css/snapper.css new file mode 100644 index 00000000..3b449e27 --- /dev/null +++ b/docs/css/snapper.css @@ -0,0 +1,499 @@ +:root { + --font-size: 1.55rem; + --line-height: 1.5; + + --space: calc(var(--font-size) * var(--line-height)); + + --font-sans: "SF Pro Display", system-ui, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif; + --font-mono: Menlo, 'Lucida Console', Consolas, Monaco, Cousine, 'Courier New', Courier, monospace; + + --red: rgb(255, 80, 80); +} + +html { + font-family: var(--font-sans); + font-size: 62.5%; + line-height: var(--line-height); + color: rgb(35, 50, 60); + box-sizing: border-box; +} + +*, +*:before, +*:after { + box-sizing: inherit; +} + +body { + font-size: var(--font-size); +} + +h1 { + margin-top: var(--space); + margin-bottom: calc(var(--space) * 2); + font-size: 2.35em; +} + +h2 { + margin-top: var(--space); + margin-bottom: var(--space); + font-size: 1.75em; +} + +h3 { + margin-top: var(--space); + margin-bottom: 0; + font-size: 1.35em; +} + +h4 { + margin-top: var(--space); + margin-bottom: 0; +} + +a { + color: var(--red); + text-underline-offset: 2px; +} + +a:has(code) { + text-decoration: none; + overflow-x: hidden; + margin-top: 0; + margin-right: 0; +} + +footer { + text-align: center; +} + +#main-container { + display: flex; + justify-content: flex-start; + transition: filter 0.2s ease-in-out; +} + +#main-container article { + width: 100%; + min-width: 500px; + padding: 0 25px 0 25px; +} + +h1:hover span a, +h2:hover span a, +h3:hover span a, +h4:hover span a, +h5:hover span a, +h6:hover span a { + color: var(--red); +} + +h1 span a, +h2 span a, +h3 span a, +h4 span a, +h5 span a, +h6 span a { + vertical-align: super; + font-size: 14px; + text-decoration: none; + color: transparent; +} + +pre, +code { + font-size: 0.85em; + font-family: var(--font-mono); + background-color: #F6F6F9; + border-radius: 5px; +} + +pre { + padding: calc(var(--space) / 2); + border: 1px solid #DFDFE8; +} + +code { + margin: 0 calc(var(--space) / 6); + padding: calc(var(--space) / 6); +} + +#nav { + border-right: 1px solid #E3E7EC; + width: auto; + padding: 15px 10px 0 0; +} + +#nav .separator { + color: #47484A; + font-size: 12px; + font-weight: 500; +} + +#navigation-list { + list-style-type: none; + color: black; + font-style: normal; + font-size: 16px; + font-weight: 400; + padding: 0 0 0 10px; + min-width: 250px; +} + +#navigation-list ul { + list-style-type: none; + padding-inline-start: 20px; +} + +#navigation-list a { + color: black; + text-decoration: none; +} + +#navigation-list a:hover { + color: var(--red); +} + +.index-entry, +.expandable-index-entry summary { + border-radius: 8px; + padding: 10px; + margin: 5px 0 5px 0; +} + +#getting-started { + padding: 10px 0 10px 0; +} + +.title { + white-space: nowrap; +} + +.title:before { + content: ""; + padding: 0 0.5em; + font-size: 0.8em; + font-weight: normal; + color: rgb(175, 190, 195); +} + +.expandable-index-entry:hover>details>summary, +.expandable-index-entry details[open]>summary { + background-color: #F6F6F9; +} + +summary::after { + content: " ›"; + font-size: 20px; + float: right; + /* padding-top: 4px; */ + position: relative; + bottom: 4px; +} + +details[open]>summary:after { + content: " ⌄"; + bottom: 8px; +} + +.link-list summary::after { + bottom: 10px; +} + +.link-list details[open]>summary:after { + bottom: 12px; +} + +details>summary { + list-style: none; +} + +details>summary::marker, +details>summary::-webkit-details-marker { + display: none; +} + +#side-search { + width: 90%; + border-radius: 7px; + outline: none; + border: 1px solid #0B1324; + padding: 10px; + box-shadow: 0px 1px 3.3px 0px #0B13241A; + box-shadow: 0px -1px 0px 0px #0000001A inset; + display: block; + margin: 15px auto; +} + +#search-modal { + filter: none; + display: none; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + align-items: center; + justify-content: center; + z-index: 9999; +} + +#search-modal-content { + background: white; + width: 70%; + height: 60%; + box-shadow: 0px 0px 1px 0px #42474C7A inset; + box-shadow: 0px 5px 8px 2px #36363636; + border: 1px solid #efefef; + border-radius: 9px; + overflow-y: scroll; + overflow-x: hidden; +} + +article section { + margin-top: calc(var(--space) * 3); +} + +#search-modal-content::-webkit-scrollbar { + display: none; +} + +#search-modal-input { + font-size: 20px; + line-height: 3; + color: #656C78; + border: none; + outline: none; + width: 100%; + padding: 15px 30px; + border-radius: 9px; +} + +#search-modal-input::placeholder { + color: #656C78; +} + +#search-results { + margin: 0; + border-top: 1px solid #E6E7E8; + width: 100%; + font-size: 16px; + list-style-type: none; + padding: 0; +} + +#search-results .result-link { + text-decoration: none; + width: 100%; + display: flex; + gap: calc(var(--space) / 2); + padding: 0 var(--space); + text-overflow: ellipsis; + white-space: nowrap; +} + +#search-results .result-link:hover, +#search-results .result-link:focus { + background-color: #F6F6F9; + outline: none; +} + +#search-results .result-link pre { + background-color: inherit; + margin: 16px 16px 16px 0; + padding: 0; + color: #828282; +} + +#search-results .result-link p { + color: #828282; +} + +#search-results .result-link .result-title { + margin: 16px 16px 16px 0; + flex-basis: 20%; + overflow: hidden; + text-overflow: ellipsis; + text-align: right; + color: #212121; +} + +/* Ride side-bar */ +@media screen and (max-width: 1100px) { + .right-section { + display: none !important; + } +} + +.right-side-bar-title { + font-size: 1em; + text-transform: uppercase; +} + +.right-section { + min-width: 300px; + height: 90vh; + padding: 1em; + padding-left: 2em; + overflow-y: scroll; + font-size: 0.8em; + color: #424242; + position: sticky; + top: 20px; +} + +.right-section nav a { + color: inherit; + text-decoration: none; +} + +.right-section nav a:hover { + color: var(--red); +} + +.right-section nav ul { + list-style-type: none; + padding: 0; +} + +.right-section nav ul li { + overflow-x: hidden; + text-overflow: ellipsis; + margin-bottom: 0.5em; +} + +.right-section nav ul ul { + padding-left: 1em; + border-left: #E3E7EC solid 1px; +} + +.right-section nav ul ul li { + padding: 1em 0 0 0; + margin-bottom: 0.25em; +} + +.right-side-bar-class { + text-transform: capitalize; +} + +.right-side-bar-class * { + text-transform: none; +} + +.right-side-bar-section { + text-transform: capitalize; +} + +.method-name { + margin: 0; + color: black; + font-weight: 400; +} + +.method-entry { + background-color: #F6F6F9; + border-radius: 5px; + margin: 25px 0 25px 0; + color: #4E5260; +} + +.method-info { + padding: 10px; +} + +.method-source { + font-family: var(--font-mono); + margin: 0; + border-top-left-radius: 0; + border-top-right-radius: 0; + background-color: white; +} + +hr { + border: 1px solid #E3E7EC; + margin-top: 15px; +} + +.description { + color: #4E5260; +} + +.attribute-type { + color: #656C78; +} + +.show-source { + outline: none; + border: none; + border-radius: 7px; + padding: 8px; + background-color: #F6F6F9; +} + +.section-title { + color: #47484A; + text-transform: uppercase; + font-size: 12px; + margin-bottom: 25px; +} + +.show-source:hover { + background-color: #DFDFE8; +} + +.method-name { + display: flex; + justify-content: space-between; + align-items: center; +} + +.hidden { + display: none; +} + +/* Code blocks syntax highlighting */ +.ruby-constant { + color: #4b82e9; +} + +.ruby-keyword { + color: #dd5555; + font-weight: bold; +} + +.ruby-ivar { + color: #837c7c; +} + +.ruby-operator { + color: black; +} + +.ruby-identifier { + color: black; +} + +.ruby-identifier.ruby-title { + color: #d464eb; +} + +.ruby-node { + color: black; +} + +.ruby-comment { + color: #bea17f; + font-style: italic; +} + +.ruby-regexp { + color: #a6cc5f; +} + +.ruby-value { + color: #6bb7b7; +} + +.ruby-string { + color: #5ac16c; +} diff --git a/docs/definition.gif b/docs/definition.gif new file mode 100644 index 00000000..3852854c Binary files /dev/null and b/docs/definition.gif differ diff --git a/docs/document_symbol.gif b/docs/document_symbol.gif new file mode 100644 index 00000000..afdfce4c Binary files /dev/null and b/docs/document_symbol.gif differ diff --git a/docs/hover.gif b/docs/hover.gif new file mode 100644 index 00000000..66a7bbfd Binary files /dev/null and b/docs/hover.gif differ diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 00000000..725f8420 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,182 @@ + + + + + + + RDoc Documentation + + + + + + + + + +
+ + + +
+ + +

+ +

Ruby LSP Rails

+ +

Ruby LSP Rails is a Ruby LSP addon for extra Rails editor features, such as:

+ + +

Installation

+ +

If you haven’t already done so, you’ll need to first set up Ruby LSP.

+ +

As of v0.3.0, Ruby LSP will automatically include the Ruby LSP Rails addon in its custom bundle when a Rails app is detected. There is no need to add the gem to your bundle.

+ +

Documentation

+ +

See the documentation for more in-depth details about the supported features.

+ +

How Runtime Introspection Works

+ +

LSP tooling is typically based on static analysis, but ruby-lsp-rails actually communicates with your Rails app for some features.

+ +

When Ruby LSP Rails starts, it spawns a rails runner instance which runs {server.rb}. The addon communicates with this process over a pipe (i.e. stdin and stdout) to fetch runtime information about the application.

+ +

When extension is stopped (e.g. by quitting the editor), the server instance is shut down.

+ +
+

[!NOTE] Prior to v0.3.0, ruby-lsp-rails used a different approach which involved mounting a Rack application within the Rails app. That approach was brittle and susceptible to the application’s configuration, such as routing and middleware.

+
+ +

Contributing

+ +

See CONTRIBUTING.md

+ +

License

+ +

The gem is available as open source under the terms of the MIT License.

+ +
+ +
+ +
+ +
+ +
+
+ + +
+
+ + + + + diff --git a/docs/js/search_index.js b/docs/js/search_index.js new file mode 100644 index 00000000..bce2141d --- /dev/null +++ b/docs/js/search_index.js @@ -0,0 +1 @@ +let searchIndex = {"code_of_conduct":{"title":"CODE_OF_CONDUCT","namespace":"","path":"CODE_OF_CONDUCT_md.html","snippet":"

Contributor Covenant Code of Conduct\n

Our Pledge\n

In the interest of fostering an open and welcoming environment, …\n"},"contributing":{"title":"CONTRIBUTING","namespace":"","path":"CONTRIBUTING_md.html","snippet":"

CONTRIBUTING\n

Bug reports and pull requests are welcome on GitHub at github.com/Shopify/ruby-lsp-rails …\n"},"readme":{"title":"README","namespace":"","path":"README_md.html","snippet":"

\n

Ruby LSP Rails\n

Ruby LSP Rails …\n"},"rubylsp::rails::activesupporttestcasehelper#extract_test_case_name()":{"title":"extract_test_case_name","namespace":"RubyLsp::Rails::ActiveSupportTestCaseHelper","path":"RubyLsp/Rails/ActiveSupportTestCaseHelper.html#method-i-extract_test_case_name","snippet":""},"rubylsp::rails::addon::new()":{"title":"new","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-c-new","snippet":""},"rubylsp::rails::addon#activate()":{"title":"activate","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-i-activate","snippet":""},"rubylsp::rails::addon#deactivate()":{"title":"deactivate","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-i-deactivate","snippet":""},"rubylsp::rails::addon#create_code_lens_listener()":{"title":"create_code_lens_listener","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-i-create_code_lens_listener","snippet":""},"rubylsp::rails::addon#create_hover_listener()":{"title":"create_hover_listener","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-i-create_hover_listener","snippet":""},"rubylsp::rails::addon#create_document_symbol_listener()":{"title":"create_document_symbol_listener","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-i-create_document_symbol_listener","snippet":""},"rubylsp::rails::addon#create_definition_listener()":{"title":"create_definition_listener","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-i-create_definition_listener","snippet":""},"rubylsp::rails::addon#workspace_did_change_watched_files()":{"title":"workspace_did_change_watched_files","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-i-workspace_did_change_watched_files","snippet":""},"rubylsp::rails::addon#register_additional_file_watchers()":{"title":"register_additional_file_watchers","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-i-register_additional_file_watchers","snippet":""},"rubylsp::rails::addon#name()":{"title":"name","namespace":"RubyLsp::Rails::Addon","path":"RubyLsp/Rails/Addon.html#method-i-name","snippet":""},"rubylsp::rails::codelens::new()":{"title":"new","namespace":"RubyLsp::Rails::CodeLens","path":"RubyLsp/Rails/CodeLens.html#method-c-new","snippet":""},"rubylsp::rails::codelens#on_call_node_enter()":{"title":"on_call_node_enter","namespace":"RubyLsp::Rails::CodeLens","path":"RubyLsp/Rails/CodeLens.html#method-i-on_call_node_enter","snippet":""},"rubylsp::rails::codelens#on_def_node_enter()":{"title":"on_def_node_enter","namespace":"RubyLsp::Rails::CodeLens","path":"RubyLsp/Rails/CodeLens.html#method-i-on_def_node_enter","snippet":""},"rubylsp::rails::codelens#on_class_node_enter()":{"title":"on_class_node_enter","namespace":"RubyLsp::Rails::CodeLens","path":"RubyLsp/Rails/CodeLens.html#method-i-on_class_node_enter","snippet":""},"rubylsp::rails::codelens#on_class_node_leave()":{"title":"on_class_node_leave","namespace":"RubyLsp::Rails::CodeLens","path":"RubyLsp/Rails/CodeLens.html#method-i-on_class_node_leave","snippet":""},"rubylsp::rails::codelens#on_module_node_enter()":{"title":"on_module_node_enter","namespace":"RubyLsp::Rails::CodeLens","path":"RubyLsp/Rails/CodeLens.html#method-i-on_module_node_enter","snippet":""},"rubylsp::rails::codelens#on_module_node_leave()":{"title":"on_module_node_leave","namespace":"RubyLsp::Rails::CodeLens","path":"RubyLsp/Rails/CodeLens.html#method-i-on_module_node_leave","snippet":""},"rubylsp::rails::definition::new()":{"title":"new","namespace":"RubyLsp::Rails::Definition","path":"RubyLsp/Rails/Definition.html#method-c-new","snippet":""},"rubylsp::rails::definition#on_symbol_node_enter()":{"title":"on_symbol_node_enter","namespace":"RubyLsp::Rails::Definition","path":"RubyLsp/Rails/Definition.html#method-i-on_symbol_node_enter","snippet":""},"rubylsp::rails::definition#on_string_node_enter()":{"title":"on_string_node_enter","namespace":"RubyLsp::Rails::Definition","path":"RubyLsp/Rails/Definition.html#method-i-on_string_node_enter","snippet":""},"rubylsp::rails::definition#handle_possible_dsl()":{"title":"handle_possible_dsl","namespace":"RubyLsp::Rails::Definition","path":"RubyLsp/Rails/Definition.html#method-i-handle_possible_dsl","snippet":""},"rubylsp::rails::definition#on_call_node_enter()":{"title":"on_call_node_enter","namespace":"RubyLsp::Rails::Definition","path":"RubyLsp/Rails/Definition.html#method-i-on_call_node_enter","snippet":""},"rubylsp::rails::documentsymbol::new()":{"title":"new","namespace":"RubyLsp::Rails::DocumentSymbol","path":"RubyLsp/Rails/DocumentSymbol.html#method-c-new","snippet":""},"rubylsp::rails::documentsymbol#on_call_node_enter()":{"title":"on_call_node_enter","namespace":"RubyLsp::Rails::DocumentSymbol","path":"RubyLsp/Rails/DocumentSymbol.html#method-i-on_call_node_enter","snippet":""},"rubylsp::rails::documentsymbol#on_class_node_enter()":{"title":"on_class_node_enter","namespace":"RubyLsp::Rails::DocumentSymbol","path":"RubyLsp/Rails/DocumentSymbol.html#method-i-on_class_node_enter","snippet":""},"rubylsp::rails::documentsymbol#on_class_node_leave()":{"title":"on_class_node_leave","namespace":"RubyLsp::Rails::DocumentSymbol","path":"RubyLsp/Rails/DocumentSymbol.html#method-i-on_class_node_leave","snippet":""},"rubylsp::rails::documentsymbol#on_module_node_enter()":{"title":"on_module_node_enter","namespace":"RubyLsp::Rails::DocumentSymbol","path":"RubyLsp/Rails/DocumentSymbol.html#method-i-on_module_node_enter","snippet":""},"rubylsp::rails::documentsymbol#on_module_node_leave()":{"title":"on_module_node_leave","namespace":"RubyLsp::Rails::DocumentSymbol","path":"RubyLsp/Rails/DocumentSymbol.html#method-i-on_module_node_leave","snippet":""},"rubylsp::rails::hover::new()":{"title":"new","namespace":"RubyLsp::Rails::Hover","path":"RubyLsp/Rails/Hover.html#method-c-new","snippet":""},"rubylsp::rails::hover#on_constant_path_node_enter()":{"title":"on_constant_path_node_enter","namespace":"RubyLsp::Rails::Hover","path":"RubyLsp/Rails/Hover.html#method-i-on_constant_path_node_enter","snippet":""},"rubylsp::rails::hover#on_constant_read_node_enter()":{"title":"on_constant_read_node_enter","namespace":"RubyLsp::Rails::Hover","path":"RubyLsp/Rails/Hover.html#method-i-on_constant_read_node_enter","snippet":""},"rubylsp::rails::hover#on_call_node_enter()":{"title":"on_call_node_enter","namespace":"RubyLsp::Rails::Hover","path":"RubyLsp/Rails/Hover.html#method-i-on_call_node_enter","snippet":""},"rubylsp::rails::indexingenhancement#on_call_node()":{"title":"on_call_node","namespace":"RubyLsp::Rails::IndexingEnhancement","path":"RubyLsp/Rails/IndexingEnhancement.html#method-i-on_call_node","snippet":""},"rubylsp::rails::runnerclient::create_client()":{"title":"create_client","namespace":"RubyLsp::Rails::RunnerClient","path":"RubyLsp/Rails/RunnerClient.html#method-c-create_client","snippet":""},"rubylsp::rails::runnerclient::new()":{"title":"new","namespace":"RubyLsp::Rails::RunnerClient","path":"RubyLsp/Rails/RunnerClient.html#method-c-new","snippet":""},"rubylsp::rails::runnerclient#model()":{"title":"model","namespace":"RubyLsp::Rails::RunnerClient","path":"RubyLsp/Rails/RunnerClient.html#method-i-model","snippet":""},"rubylsp::rails::runnerclient#association_target_location()":{"title":"association_target_location","namespace":"RubyLsp::Rails::RunnerClient","path":"RubyLsp/Rails/RunnerClient.html#method-i-association_target_location","snippet":""},"rubylsp::rails::runnerclient#route_location()":{"title":"route_location","namespace":"RubyLsp::Rails::RunnerClient","path":"RubyLsp/Rails/RunnerClient.html#method-i-route_location","snippet":""},"rubylsp::rails::runnerclient#route()":{"title":"route","namespace":"RubyLsp::Rails::RunnerClient","path":"RubyLsp/Rails/RunnerClient.html#method-i-route","snippet":""},"rubylsp::rails::runnerclient#trigger_reload()":{"title":"trigger_reload","namespace":"RubyLsp::Rails::RunnerClient","path":"RubyLsp/Rails/RunnerClient.html#method-i-trigger_reload","snippet":""},"rubylsp::rails::runnerclient#shutdown()":{"title":"shutdown","namespace":"RubyLsp::Rails::RunnerClient","path":"RubyLsp/Rails/RunnerClient.html#method-i-shutdown","snippet":""},"rubylsp::rails::runnerclient#stopped?()":{"title":"stopped?","namespace":"RubyLsp::Rails::RunnerClient","path":"RubyLsp/Rails/RunnerClient.html#method-i-stopped-3F","snippet":""},"rubylsp::rails::runnerclient::nullclient::new()":{"title":"new","namespace":"RubyLsp::Rails::RunnerClient::NullClient","path":"RubyLsp/Rails/RunnerClient/NullClient.html#method-c-new","snippet":""},"rubylsp::rails::runnerclient::nullclient#shutdown()":{"title":"shutdown","namespace":"RubyLsp::Rails::RunnerClient::NullClient","path":"RubyLsp/Rails/RunnerClient/NullClient.html#method-i-shutdown","snippet":""},"rubylsp::rails::runnerclient::nullclient#stopped?()":{"title":"stopped?","namespace":"RubyLsp::Rails::RunnerClient::NullClient","path":"RubyLsp/Rails/RunnerClient/NullClient.html#method-i-stopped-3F","snippet":""},"rubylsp::rails::runnerclient::nullclient#rails_root()":{"title":"rails_root","namespace":"RubyLsp::Rails::RunnerClient::NullClient","path":"RubyLsp/Rails/RunnerClient/NullClient.html#method-i-rails_root","snippet":""},"rubylsp::rails::server::new()":{"title":"new","namespace":"RubyLsp::Rails::Server","path":"RubyLsp/Rails/Server.html#method-c-new","snippet":""},"rubylsp::rails::server#start()":{"title":"start","namespace":"RubyLsp::Rails::Server","path":"RubyLsp/Rails/Server.html#method-i-start","snippet":""},"rubylsp::rails::server#execute()":{"title":"execute","namespace":"RubyLsp::Rails::Server","path":"RubyLsp/Rails/Server.html#method-i-execute","snippet":""},"rubylsp::rails::support::locationbuilder::line_location_from_s()":{"title":"line_location_from_s","namespace":"RubyLsp::Rails::Support::LocationBuilder","path":"RubyLsp/Rails/Support/LocationBuilder.html#method-c-line_location_from_s","snippet":""},"rubylsp::rails::support::railsdocumentclient::generate_rails_document_urls()":{"title":"generate_rails_document_urls","namespace":"RubyLsp::Rails::Support::RailsDocumentClient","path":"RubyLsp/Rails/Support/RailsDocumentClient.html#method-c-generate_rails_document_urls","snippet":""},"rubylsp":{"title":"RubyLsp","namespace":"","path":"RubyLsp.html","snippet":"

typed: strict\n

typed: strict\n

typed: strict\n"},"rubylsp::rails":{"title":"RubyLsp::Rails","namespace":"","path":"RubyLsp/Rails.html","snippet":"

Supported features\n

Hover\n

CodeLens\n"},"rubylsp::rails::activesupporttestcasehelper":{"title":"RubyLsp::Rails::ActiveSupportTestCaseHelper","namespace":"","path":"RubyLsp/Rails/ActiveSupportTestCaseHelper.html","snippet":""},"rubylsp::rails::addon":{"title":"RubyLsp::Rails::Addon","namespace":"","path":"RubyLsp/Rails/Addon.html","snippet":""},"rubylsp::rails::codelens":{"title":"RubyLsp::Rails::CodeLens","namespace":"","path":"RubyLsp/Rails/CodeLens.html","snippet":"

\n

This feature adds Code Lens features for Rails applications.\n

For Active …\n"},"rubylsp::rails::definition":{"title":"RubyLsp::Rails::Definition","namespace":"","path":"RubyLsp/Rails/Definition.html","snippet":"

\n

The definition request jumps to the\ndefinition of the symbol under the ...\n"},"rubylsp::rails::documentsymbol":{"title":"RubyLsp::Rails::DocumentSymbol","namespace":"","path":"RubyLsp/Rails/DocumentSymbol.html","snippet":"

\n

The document symbol\nrequest allows users to navigate between associations, ...\n"},"rubylsp::rails::hover":{"title":"RubyLsp::Rails::Hover","namespace":"","path":"RubyLsp/Rails/Hover.html","snippet":"

\n

Augment hover with\ninformation about a model.\n

Example\n"},"rubylsp::rails::indexingenhancement":{"title":"RubyLsp::Rails::IndexingEnhancement","namespace":"","path":"RubyLsp/Rails/IndexingEnhancement.html","snippet":""},"rubylsp::rails::railtie":{"title":"RubyLsp::Rails::Railtie","namespace":"","path":"RubyLsp/Rails/Railtie.html","snippet":""},"rubylsp::rails::runnerclient":{"title":"RubyLsp::Rails::RunnerClient","namespace":"","path":"RubyLsp/Rails/RunnerClient.html","snippet":""},"rubylsp::rails::runnerclient::emptymessageerror":{"title":"RubyLsp::Rails::RunnerClient::EmptyMessageError","namespace":"","path":"RubyLsp/Rails/RunnerClient/EmptyMessageError.html","snippet":""},"rubylsp::rails::runnerclient::incompletemessageerror":{"title":"RubyLsp::Rails::RunnerClient::IncompleteMessageError","namespace":"","path":"RubyLsp/Rails/RunnerClient/IncompleteMessageError.html","snippet":""},"rubylsp::rails::runnerclient::initializationerror":{"title":"RubyLsp::Rails::RunnerClient::InitializationError","namespace":"","path":"RubyLsp/Rails/RunnerClient/InitializationError.html","snippet":""},"rubylsp::rails::runnerclient::nullclient":{"title":"RubyLsp::Rails::RunnerClient::NullClient","namespace":"","path":"RubyLsp/Rails/RunnerClient/NullClient.html","snippet":""},"rubylsp::rails::server":{"title":"RubyLsp::Rails::Server","namespace":"","path":"RubyLsp/Rails/Server.html","snippet":""},"rubylsp::rails::support":{"title":"RubyLsp::Rails::Support","namespace":"","path":"RubyLsp/Rails/Support.html","snippet":""},"rubylsp::rails::support::associations":{"title":"RubyLsp::Rails::Support::Associations","namespace":"","path":"RubyLsp/Rails/Support/Associations.html","snippet":""},"rubylsp::rails::support::callbacks":{"title":"RubyLsp::Rails::Support::Callbacks","namespace":"","path":"RubyLsp/Rails/Support/Callbacks.html","snippet":""},"rubylsp::rails::support::locationbuilder":{"title":"RubyLsp::Rails::Support::LocationBuilder","namespace":"","path":"RubyLsp/Rails/Support/LocationBuilder.html","snippet":""},"rubylsp::rails::support::railsdocumentclient":{"title":"RubyLsp::Rails::Support::RailsDocumentClient","namespace":"","path":"RubyLsp/Rails/Support/RailsDocumentClient.html","snippet":""}} \ No newline at end of file diff --git a/docs/js/search_index.js.gz b/docs/js/search_index.js.gz new file mode 100644 index 00000000..298fe81f Binary files /dev/null and b/docs/js/search_index.js.gz differ diff --git a/docs/js/snapper.js b/docs/js/snapper.js new file mode 100644 index 00000000..05f2b9c9 --- /dev/null +++ b/docs/js/snapper.js @@ -0,0 +1,119 @@ +"use strict"; + +let searchModal; +let searchModalContent; +let sideSearchInput; +let searchInput; +let searchResults; +let mainContainer; + +function hideSearchModal() { + searchModal.style.display = "none"; + mainContainer.style.filter = "none"; +} + +function showSearchModal() { + searchModal.style.display = "flex"; + mainContainer.style.filter = "blur(8px)"; + + if (searchResults.innerHTML === "") { + // Populate the search modal with the first 10 items to start + const keys = Object.keys(searchIndex).slice(0, 10); + const initialEntries = keys.map((key) => { + return searchIndex[key]; + }); + searchResults.innerHTML = htmlForResults(initialEntries); + } + + searchInput.value = ""; + searchInput.focus(); +} + +function htmlForResults(results) { + // The solo closing p tag is intentional. The snippet is HTML and includes only the opening of the tag + return results.map((result) => { + let name = result.title; + + if (result.namespace) { + name += ` (${result.namespace})`; + } + const escapedPath = result.path.replace(/[&<>"`']/g, (c) => `&#${c.charCodeAt(0)};`); + + return `

  • + + ${name} + ${result.snippet}

    +
    +
  • `; + }).join(""); +} + +function setupSearch() { + searchModal = document.getElementById("search-modal"); + searchModalContent = document.getElementById("search-modal-content"); + sideSearchInput = document.getElementById("side-search"); + mainContainer = document.getElementById("main-container"); + searchInput = document.getElementById("search-modal-input"); + searchResults = document.getElementById("search-results"); + + // Toggle the search modal on CMD|CTRL + K + document.addEventListener("keydown", (event) => { + if (event.metaKey && event.key === "k") { + if (searchModal.style.display === "flex") { + hideSearchModal(); + } else { + showSearchModal(); + } + } else if (event.key === "Escape") { + hideSearchModal(); + } + }); + + // Show the search modal when clicking on the side search input. Hide it when clicking anywhere outside of the modal + document.addEventListener("click", (event) => { + if (event.target === sideSearchInput) { + showSearchModal(); + } else if (!searchModalContent.contains(event.target)) { + hideSearchModal(); + } + }); + + // Search submission + let debounceTimerId; + + searchInput.addEventListener("input", (event) => { + clearTimeout(debounceTimerId); + + debounceTimerId = setTimeout(() => { + if (event.target.value === "") { + searchResults.innerHTML = ""; + return; + } + + const regex = new RegExp(event.target.value, "i"); + const results = Object.keys(searchIndex).filter((key) => regex.test(key)).map((key) => searchIndex[key]); + + if (results.length === 0) { + searchResults.innerHTML = "
  • No results found

  • "; + return; + } + + searchResults.innerHTML = htmlForResults(results); + }, 500); + }); +} + +function setupShowSource() { + const showSourceButtons = document.getElementsByClassName("show-source"); + + for (const button of showSourceButtons) { + const parentEntry = button.closest(".method-entry"); + const methodSource = parentEntry.getElementsByClassName("method-source")[0]; + button.addEventListener("click", (_event) => methodSource.classList.toggle("hidden")); + }; +} + +window.addEventListener("DOMContentLoaded", (_event) => { + setupSearch(); + setupShowSource(); +}); diff --git a/docs/js/snapper.js.gz b/docs/js/snapper.js.gz new file mode 100644 index 00000000..e6709313 Binary files /dev/null and b/docs/js/snapper.js.gz differ