Skip to content

Commit

Permalink
Ensure schema link is rendered with column information (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock authored Oct 4, 2024
1 parent c5043be commit 23216d1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/ruby_lsp/ruby_lsp_rails/hover.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def generate_column_content(name)
schema_file = model[:schema_file]

@response_builder.push(
"[Schema](#{URI::Generic.from_path(path: schema_file)})",
category: :links,
"[Schema](#{URI::Generic.from_path(path: schema_file)})\n",
category: :documentation,
) if schema_file

@response_builder.push(
Expand Down
9 changes: 6 additions & 3 deletions test/ruby_lsp_rails/hover_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ class User < ApplicationRecord
```
**Definitions**: [fake.rb](file:///fake.rb#L1,1-2,4)
[Schema](#{URI::Generic.from_path(path: dummy_root + "/db/schema.rb")})
[Schema](#{URI::Generic.from_path(path: dummy_root + "/db/schema.rb")})
**id**: integer (PK)
**first_name**: string
Expand Down Expand Up @@ -83,9 +84,10 @@ class User < ApplicationRecord
```
**Definitions**: [fake.rb](file:///fake.rb#L2,3-3,6)
[Schema](#{URI::Generic.from_path(path: dummy_root + "/db/schema.rb")})
[Schema](#{URI::Generic.from_path(path: dummy_root + "/db/schema.rb")})
**id**: integer (PK)
**first_name**: string
Expand Down Expand Up @@ -128,9 +130,10 @@ class CompositePrimaryKey < ApplicationRecord
```
**Definitions**: [fake.rb](file:///fake.rb#L1,1-2,4)
[Schema](#{URI::Generic.from_path(path: dummy_root + "/db/schema.rb")})
[Schema](#{URI::Generic.from_path(path: dummy_root + "/db/schema.rb")})
**order_id**: integer (PK)
**product_id**: integer (PK)
Expand Down

0 comments on commit 23216d1

Please sign in to comment.