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

Run URL helpers compiler when routes are modified #2165

Merged

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Jan 23, 2025

Motivation

Start generating URL helper DSLs upon route modifications. This is one of the compiler cases where there's not a constant, but rather a file pattern that triggers generation.

Implementation

  1. Started noticing modifications to any routes.rb file and then triggering a delegate notification
  2. The server add-on side will collect relevant constants and then pass those to the DSL method. Note that the constants collected by the compiler are a mix of application constants and artificial ones created by Tapioca itself for the URL helper modules

Tests

Added tests and made some adjustments to make them more deterministic and avoid sleeping.

EDIT: couldn't avoid sleeping for some reason. Tests could use some future improvement.

@vinistock vinistock added the enhancement New feature or request label Jan 23, 2025 — with Graphite App
@vinistock vinistock self-assigned this Jan 23, 2025
Copy link
Member Author

vinistock commented Jan 23, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock marked this pull request as ready for review January 23, 2025 22:20
@vinistock vinistock requested a review from a team as a code owner January 23, 2025 22:20
lib/ruby_lsp/tapioca/addon.rb Show resolved Hide resolved
lib/ruby_lsp/tapioca/server_addon.rb Outdated Show resolved Hide resolved
@vinistock vinistock changed the base branch from 01-23-upgrade_rails_add-on_to_v0.3.31 to graphite-base/2165 January 23, 2025 22:50
@vinistock vinistock force-pushed the 01-23-run_url_helpers_compiler_when_routes_is_modified branch from 1f16c3b to f707030 Compare January 23, 2025 22:51
@vinistock vinistock changed the base branch from graphite-base/2165 to main January 23, 2025 22:51
@vinistock vinistock force-pushed the 01-23-run_url_helpers_compiler_when_routes_is_modified branch from f707030 to a15d632 Compare January 23, 2025 22:51
lib/ruby_lsp/tapioca/addon.rb Outdated Show resolved Hide resolved
lib/ruby_lsp/tapioca/server_addon.rb Show resolved Hide resolved
spec/tapioca/addon_spec.rb Show resolved Hide resolved
@vinistock vinistock changed the base branch from main to graphite-base/2165 January 24, 2025 15:00
@vinistock vinistock force-pushed the 01-23-run_url_helpers_compiler_when_routes_is_modified branch from a15d632 to 574ce80 Compare January 24, 2025 15:00
@vinistock vinistock changed the base branch from graphite-base/2165 to 01-24-avoid_naming_conflict_for_uri_source_ January 24, 2025 15:00
@vinistock vinistock changed the base branch from 01-24-avoid_naming_conflict_for_uri_source_ to graphite-base/2165 January 24, 2025 15:29
@vinistock vinistock force-pushed the 01-23-run_url_helpers_compiler_when_routes_is_modified branch from 574ce80 to 5339596 Compare January 24, 2025 15:29
@vinistock vinistock changed the base branch from graphite-base/2165 to main January 24, 2025 15:29
@vinistock vinistock force-pushed the 01-23-run_url_helpers_compiler_when_routes_is_modified branch from 5339596 to 8f1d2cb Compare January 24, 2025 15:30
@vinistock vinistock force-pushed the 01-23-run_url_helpers_compiler_when_routes_is_modified branch 3 times, most recently from db4cd60 to 2162522 Compare January 24, 2025 18:40
@vinistock vinistock requested a review from KaanOzkan January 24, 2025 18:41
@vinistock vinistock force-pushed the 01-23-run_url_helpers_compiler_when_routes_is_modified branch from 2162522 to bc94e4d Compare January 24, 2025 19:14
@vinistock vinistock merged commit 45835f2 into main Jan 24, 2025
35 checks passed
@vinistock vinistock deleted the 01-23-run_url_helpers_compiler_when_routes_is_modified branch January 24, 2025 20:17
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.

3 participants