Skip to content

Commit 00d02cc

Browse files
authored
Prevent migration code lens from failing in unsaved files (#450)
1 parent 28a6f65 commit 00d02cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ruby_lsp/ruby_lsp_rails/code_lens.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def on_class_node_enter(node)
151151
@group_id += 1
152152
end
153153

154-
if superclass_name&.start_with?("ActiveRecord::Migration")
154+
if @path && superclass_name&.start_with?("ActiveRecord::Migration")
155155
command = "#{migrate_command} VERSION=#{migration_version}"
156156
add_migrate_code_lens(node, name: class_name, command: command)
157157
end

0 commit comments

Comments
 (0)