From 19d9ebf364ef4c814ef8df65af3d55d3dd86f0cd Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Thu, 17 Jul 2025 21:12:30 -0400 Subject: [PATCH 1/7] Add CLAUDE.md --- CLAUDE.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..0194b038 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,81 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +Ruby LSP Rails is a Ruby Language Server Protocol (LSP) add-on that provides Rails-specific editor features. It's designed to work with the Ruby LSP to enhance Rails development experience in supported editors. + +## Development Commands + +### Testing +- `bundle exec rake` - Run full test suite (sets up dummy app database and runs all tests) +- `bin/rails test test/my_test.rb` - Run a specific test file +- `bundle exec rake test` - Alternative way to run tests + +### Linting and Code Quality +- `bin/rubocop` - Run RuboCop linting +- `bundle exec srb tc` - Run Sorbet type checking + +### Development Server (for dummy app) +- `bin/rails server` - Start Rails server for the dummy app in test/dummy + +### Database +- Database setup is handled automatically when running the full test suite +- The dummy Rails app is located in `test/dummy/` and is used for testing + +## Architecture + +### Core Components + +**Main Entry Point**: `lib/ruby-lsp-rails.rb` - Simple entry point that requires the version file + +**Addon System**: `lib/ruby_lsp/ruby_lsp_rails/addon.rb` - Main addon class that extends RubyLsp::Addon +- Manages lifecycle (activate/deactivate) +- Coordinates feature listeners (hover, completion, definition, etc.) +- Handles Rails-specific functionality like migration prompts +- Uses background thread to initialize Rails runner client + +**Server Component**: `lib/ruby_lsp/ruby_lsp_rails/server.rb` - Separate Rails process server +- Runs as isolated process to handle Rails-specific queries +- Provides database schema information, model details, associations +- Handles route information and migration status +- Communicates via JSON-RPC over stdin/stdout + +**Feature Modules**: +- `hover.rb` - Provides hover information for Rails concepts +- `definition.rb` - Go-to-definition for Rails constructs +- `completion.rb` - Rails-specific autocompletion +- `code_lens.rb` - Code lens features +- `document_symbol.rb` - Document symbol provider +- `indexing_enhancement.rb` - Enhanced indexing for Rails + +**Support Modules**: +- `support/associations.rb` - ActiveRecord associations handling +- `support/callbacks.rb` - Rails callbacks support +- `support/location_builder.rb` - Location utilities +- `runner_client.rb` - Client for communicating with server process + +### Test Structure + +**Dummy Rails App**: `test/dummy/` contains a minimal Rails 8.0 application for testing +- Standard Rails structure with models, controllers, views +- Database migrations and schema +- Used to test Rails-specific features in realistic environment + +**Test Files**: Located in `test/ruby_lsp_rails/` with corresponding `_test.rb` files for each feature module + +### Type System + +The project uses Sorbet for static typing: +- `# typed: strict` annotations on most files +- Type signatures using RBI format +- Sorbet configuration in `sorbet/config` +- Generated RBI files in `sorbet/rbi/` + +### Development Tools + +- **Dev.yml**: Shopify's development configuration for streamlined setup +- **Tapioca**: For RBI generation (`bin/tapioca`) +- **Bundler**: Standard Ruby dependency management +- **Rake**: Build automation and test running \ No newline at end of file From c0984ebd2a4041b03e5917273278282318701c97 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Fri, 18 Jul 2025 11:23:42 -0400 Subject: [PATCH 2/7] Manually adjust CLAUDE.md --- CLAUDE.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 0194b038..2a34be82 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,14 +4,13 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -Ruby LSP Rails is a Ruby Language Server Protocol (LSP) add-on that provides Rails-specific editor features. It's designed to work with the Ruby LSP to enhance Rails development experience in supported editors. +Ruby LSP Rails is a Ruby LSP add-on that provides Rails-specific editor features. It's designed to work with the Ruby LSP to enhance Rails development experience in supported editors. ## Development Commands ### Testing -- `bundle exec rake` - Run full test suite (sets up dummy app database and runs all tests) +- `bundle exec rake test` - Run full test suite - `bin/rails test test/my_test.rb` - Run a specific test file -- `bundle exec rake test` - Alternative way to run tests ### Linting and Code Quality - `bin/rubocop` - Run RuboCop linting @@ -21,16 +20,16 @@ Ruby LSP Rails is a Ruby Language Server Protocol (LSP) add-on that provides Rai - `bin/rails server` - Start Rails server for the dummy app in test/dummy ### Database -- Database setup is handled automatically when running the full test suite +- Database setup is handled by `bundle exec rails db:setup` - The dummy Rails app is located in `test/dummy/` and is used for testing ## Architecture ### Core Components -**Main Entry Point**: `lib/ruby-lsp-rails.rb` - Simple entry point that requires the version file +**Main Entry Point**: `lib/ruby_lsp/ruby_lsp_rails/addon.rb` -**Addon System**: `lib/ruby_lsp/ruby_lsp_rails/addon.rb` - Main addon class that extends RubyLsp::Addon +**Add-on System**: `lib/ruby_lsp/ruby_lsp_rails/addon.rb` - Main add-on class that extends RubyLsp::Addon - Manages lifecycle (activate/deactivate) - Coordinates feature listeners (hover, completion, definition, etc.) - Handles Rails-specific functionality like migration prompts @@ -42,9 +41,12 @@ Ruby LSP Rails is a Ruby Language Server Protocol (LSP) add-on that provides Rai - Handles route information and migration status - Communicates via JSON-RPC over stdin/stdout +**Client Component**: `lib/ruby_lsp/ruby_lsp_rails/runner_client.rb` +- Client for communicating with server process + **Feature Modules**: - `hover.rb` - Provides hover information for Rails concepts -- `definition.rb` - Go-to-definition for Rails constructs +- `definition.rb` - Go-to-definition for Rails constructs - `completion.rb` - Rails-specific autocompletion - `code_lens.rb` - Code lens features - `document_symbol.rb` - Document symbol provider @@ -54,7 +56,6 @@ Ruby LSP Rails is a Ruby Language Server Protocol (LSP) add-on that provides Rai - `support/associations.rb` - ActiveRecord associations handling - `support/callbacks.rb` - Rails callbacks support - `support/location_builder.rb` - Location utilities -- `runner_client.rb` - Client for communicating with server process ### Test Structure @@ -63,7 +64,7 @@ Ruby LSP Rails is a Ruby Language Server Protocol (LSP) add-on that provides Rai - Database migrations and schema - Used to test Rails-specific features in realistic environment -**Test Files**: Located in `test/ruby_lsp_rails/` with corresponding `_test.rb` files for each feature module +**Test Files**: Located in `test/ruby_lsp_rails/` ### Type System @@ -78,4 +79,4 @@ The project uses Sorbet for static typing: - **Dev.yml**: Shopify's development configuration for streamlined setup - **Tapioca**: For RBI generation (`bin/tapioca`) - **Bundler**: Standard Ruby dependency management -- **Rake**: Build automation and test running \ No newline at end of file +- **Rake**: Build automation and test running From eff64b224ecd8e6b222d54ed2b28ae17f415af72 Mon Sep 17 00:00:00 2001 From: Andy Waite Date: Mon, 21 Jul 2025 12:28:25 -0400 Subject: [PATCH 3/7] Update CLAUDE.md Co-authored-by: Vinicius Stock --- CLAUDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 2a34be82..5b1f8ab6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -59,7 +59,7 @@ Ruby LSP Rails is a Ruby LSP add-on that provides Rails-specific editor features ### Test Structure -**Dummy Rails App**: `test/dummy/` contains a minimal Rails 8.0 application for testing +**Dummy Rails App**: `test/dummy/` contains a minimal Rails application for testing - Standard Rails structure with models, controllers, views - Database migrations and schema - Used to test Rails-specific features in realistic environment From 5cec36e12a6cd01c01c1b725f9b94d3be2bf7432 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 21 Jul 2025 12:26:42 -0400 Subject: [PATCH 4/7] Add symlink for copilot-instructions.md --- .github/copilot-instructions.md | 1 + 1 file changed, 1 insertion(+) create mode 120000 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 120000 index 00000000..681311eb --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1 @@ +CLAUDE.md \ No newline at end of file From 9559a6777a849a950cbbd1258b20d4cdd1ab4729 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 21 Jul 2025 12:30:31 -0400 Subject: [PATCH 5/7] Remove development server mention --- CLAUDE.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5b1f8ab6..2674bd2d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,9 +16,6 @@ Ruby LSP Rails is a Ruby LSP add-on that provides Rails-specific editor features - `bin/rubocop` - Run RuboCop linting - `bundle exec srb tc` - Run Sorbet type checking -### Development Server (for dummy app) -- `bin/rails server` - Start Rails server for the dummy app in test/dummy - ### Database - Database setup is handled by `bundle exec rails db:setup` - The dummy Rails app is located in `test/dummy/` and is used for testing From ad2d016a33c569f44f08e5cf8bd949e35eb3d4d4 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 21 Jul 2025 12:31:22 -0400 Subject: [PATCH 6/7] Mention RBS comments --- CLAUDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index 2674bd2d..5a6e90fc 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -67,7 +67,7 @@ Ruby LSP Rails is a Ruby LSP add-on that provides Rails-specific editor features The project uses Sorbet for static typing: - `# typed: strict` annotations on most files -- Type signatures using RBI format +- Type signatures using Sorbet RBS comments (https://sorbet.org/docs/rbs-support) - Sorbet configuration in `sorbet/config` - Generated RBI files in `sorbet/rbi/` From 89ada8fb59ba363db988d19e0f28a08b2cab8c13 Mon Sep 17 00:00:00 2001 From: Andy Waite <13400+andyw8@users.noreply.github.com> Date: Mon, 21 Jul 2025 12:31:53 -0400 Subject: [PATCH 7/7] Remove development tools section --- CLAUDE.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5a6e90fc..c7877542 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -70,10 +70,3 @@ The project uses Sorbet for static typing: - Type signatures using Sorbet RBS comments (https://sorbet.org/docs/rbs-support) - Sorbet configuration in `sorbet/config` - Generated RBI files in `sorbet/rbi/` - -### Development Tools - -- **Dev.yml**: Shopify's development configuration for streamlined setup -- **Tapioca**: For RBI generation (`bin/tapioca`) -- **Bundler**: Standard Ruby dependency management -- **Rake**: Build automation and test running