-
Notifications
You must be signed in to change notification settings - Fork 93
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
Proposal: ERB Support #1409
Comments
tk0miya
added a commit
to tk0miya/steep
that referenced
this issue
Jan 3, 2025
To support ERB, this allows to change the extension of the source files via `ext` setting in Steepfile. refs: soutaro#1409
tk0miya
added a commit
to tk0miya/steep
that referenced
this issue
Jan 3, 2025
To support ERB, this allows to change the extension of the source files via `ext` setting in Steepfile. Example: ``` target :views do check "app/views" ext ".erb" end ``` refs: soutaro#1409
tk0miya
added a commit
to tk0miya/steep
that referenced
this issue
Jan 3, 2025
To support ERB, this allows to change the extension of the source files via `ext` setting in Steepfile. Example: ``` target :views do check "app/views" ext ".erb" end ``` refs: soutaro#1409
tk0miya
added a commit
to tk0miya/steep
that referenced
this issue
Jan 3, 2025
To support ERB, this allows to annotate "self" on the top level context. It effects to the whole of the file. It will also help to support other DSLs (ex. Gemfile, Rakefile, and so on). Example: ``` # @type self: Gemfile group :develop do gem 'steep' gem 'rbs' end ``` ``` # @type self: Raketask namespace :my_group do desc "My Task" task :my_task do ... end end ``` refs: soutaro#1409
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ERB is a widely used template library in Ruby. It is adopted as the default view library in Ruby on Rails. It is one of the popular template libraries in Ruby. I believe it's valuable to support it in Steep.
Three enhancements are necessary to let Steep support ERB.
Allow to change the target file extension
At present, Steep expects the target source code to be ".rb". It is hard-coded in some modules.
steep/lib/steep/project/dsl.rb
Lines 105 to 107 in 81da4a1
steep/lib/steep/server/master.rb
Lines 422 to 425 in 81da4a1
It would be better to specify file extension in Steepfile:
Convert ERB code into Ruby before type-checking
ERB to Ruby code conversion is needed to type-check ERB.
Input:
Output: (replace HTML tags with whitespace)
Allow to change the "self" context via global-level annotation
In the Rails application, some instance variables and helper methods are given from other components (controllers, helpers, ActionView, and so on).
Therefore, it is needed to switch the "self" context at the global level.
It must be helpful if we'll support other DSLs.
For example, we'll also be able to support Gemfile and Raketask:
The text was updated successfully, but these errors were encountered: