Ruby Symbol Search
Ruby Symbol Search is a Visual Studio Code extension designed to enhance productivity by providing lightning-fast, real-time search and navigation of Ruby symbols across your workspace. With this extension, you gain access to powerful features like Workspace-wide Ruby Symbol Search, Fuzzy Search, Go to Definition, File-level Symbol Navigation, and an Outline View of the current Ruby file — all without requiring the resource-heavy Ruby LSP.
Features
Search Ruby Symbols Across Workspace
Quickly search for and navigate to any Ruby symbol across your entire workspace.
How to Use:
- Press Ctrl + T (Windows/Linux) or Cmd + T (macOS), type the initials of the symbol, and press Enter.
- Optionally, filter results by file name.
Filtered results:
Go to Definition
Easily navigate to the definition of any Ruby symbol in your workspace.
How to Use:
- Press F12 to go to the definition.
- Additional shortcuts:
- Ctrl + Click or Cmd + Click: Jump to definition.
- Ctrl + Alt + Click or Cmd + Option + Click: Open definition in a split view.
- Alt + F12 or Option + F12: Peek definition.
Outline View
Get an overview of all symbols in the current Ruby file with the Outline View, accessible in the Explorer sidebar. Symbols are displayed in a tree structure for better navigation.
Go to Symbol in File
Easily navigate to any symbol within the currently open Ruby file.
How to Use:
- Press Ctrl + Shift + O (Windows/Linux) or Cmd + Shift + O (macOS).
- Type
:
to group symbols by category.
Fuzzy Search
Search for Ruby symbols across your workspace using fuzzy matching.
How to Use:
- Press Ctrl + Shift + R (Windows/Linux) or Cmd + Shift + R (macOS).
- Filter results by appending the file name after
@
.
Filtered by file:
Note: To customize the key binding:
- Open Keyboard Shortcuts (Ctrl + K Ctrl + S or Cmd + K Cmd + S).
- Search for
rubySymbolSearch.search
.
- Modify the key binding as desired.
List Symbols of a File
List symbols of any Ruby file in your workspace without opening the file.
How to Use:
- Press Ctrl + Shift + R (Windows/Linux) or Cmd + Shift + R (macOS).
- Type
@
followed by the file name to display the symbols.
Lightning-Fast Indexing
- Instant Indexing: Quickly scans all Ruby files in the workspace to index symbols such as classes, modules, and methods.
- Real-Time Updates: Keeps the index in sync with changes to files.
- Status Feedback: Provides real-time indexing status in the status bar.
Supported Ruby Symbols
The Ruby Symbol Search extension supports detection of the following Ruby symbols:
Symbol Type |
Recognized Patterns |
Classes |
class ClassName class << ClassName |
Modules |
module ModuleName |
Methods |
def method_name |
Constants |
CONSTANT_NAME = value |
Scopes |
scope :scope_name |
Aliases |
alias alias_name original_name alias_method :alias_name, :original_name alias_attribute :alias_name, :attribute_name |
Attributes |
attr_reader :attribute attr_writer :attribute attr_accessor :attribute mattr_reader :attribute mattr_writer :attribute mattr_accessor :attribute thread_mattr_accessor :attribute attribute :attribute date_attribute :attribute class_attribute :attribute attributes :attribute delegate :method |
Associations |
belongs_to :association_name has_one :association_name has_many :association_name has_and_belongs_to_many :association_name |
Namespaces |
namespace :namespace_name |
Rake Tasks |
task :task_name |
Commands
Access these commands from the Command Palette (Ctrl + Shift + P or Cmd + Shift + P):
Command |
Description |
Ruby Symbol Search: Index Files |
Re-index all Ruby files manually. |
Ruby Symbol Search: Search Symbols |
Open global Ruby symbol search. |
Installation
- Install Ruby Symbol Search from the Visual Studio Code Marketplace.
- Open a Ruby project in VS Code.
- Indexing starts automatically if
autoIndex
is enabled (see Configuration).
Configuration
Customize the extension settings:
rubySymbolSearch.autoIndex
(default: true
):
Automatically index Ruby symbols when opening a workspace.
rubySymbolSearch.excludedFolders
(default: ["node_modules", "log"]
):
Exclude specific folders from indexing.
Troubleshooting
If you encounter issues with duplicate symbols appearing in global search or file search, this could be caused by conflicting extensions. Please try the following steps:
Disable Ruby LSP Extension:
- Ruby LSP will index symbols separately, leading to duplication.
- Disable it by navigating to the Extensions view (Ctrl + Shift + X or Cmd + Shift + X) and deactivating the Ruby LSP extension.
Disable Ruby-Symbols Extension:
- If installed, this extension might conflict with Ruby Symbol Search.
- Follow the same steps to disable it in the Extensions view.
Contributing
We welcome contributions!
If you encounter issues or have feature suggestions, please file an issue or a pull request in the GitHub repository.
License
This project is licensed under the MIT License.