Skip to content

Commit ee03b76

Browse files
authored
Remove usage of present? from hover (#509)
We cannot use `present?` in the add-on side of the code because that method is defined by `activesupport` and that gem is not required on the LSP side. It's only safe to use it in the runtime server side. This is currently breaking hover. Note: tests won't catch this because in tests the Rails context is loaded through the dummy application, which makes tests pass despite this code breaking every time in real scenarios.
1 parent 4285c2b commit ee03b76

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/ruby_lsp/ruby_lsp_rails/hover.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def generate_column_content(name)
7171
primary_key_suffix = " (PK)" if model[:primary_keys].include?(name)
7272
suffixes = []
7373
suffixes << "default: #{format_default(default_value, type)}" if default_value
74-
suffixes << "not null" unless nullable || primary_key_suffix.present?
74+
suffixes << "not null" unless nullable || primary_key_suffix
7575
suffix_string = " - #{suffixes.join(" - ")}" if suffixes.any?
7676
"**#{name}**: #{type}#{primary_key_suffix}#{suffix_string}\n"
7777
end.join("\n"),

0 commit comments

Comments
 (0)