File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
lib/ruby_lsp/ruby_lsp_rails Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -152,8 +152,9 @@ def on_class_node_enter(node)
152
152
end
153
153
154
154
if superclass_name &.start_with? ( "ActiveRecord::Migration" )
155
- command = "#{ migrate_command } VERSION=#{ migration_version } "
156
- add_migrate_code_lens ( node , name : class_name , command : command )
155
+ version = migration_version
156
+ command = "#{ migrate_command } VERSION=#{ version } "
157
+ add_migrate_code_lens ( node , name : class_name , command : command ) if version
157
158
end
158
159
end
159
160
@@ -241,7 +242,9 @@ def migrate_command
241
242
242
243
sig { returns ( T . nilable ( String ) ) }
243
244
def migration_version
244
- File . basename ( T . must ( @path ) ) . split ( "_" ) . first
245
+ return unless @path
246
+
247
+ File . basename ( @path ) . split ( "_" ) . first
245
248
end
246
249
247
250
sig { params ( node : Prism ::Node , name : String , command : String ) . void }
You can’t perform that action at this time.
0 commit comments