Skip to content

Commit 6805636

Browse files
committed
wip
1 parent c552c44 commit 6805636

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

lib/ruby_lsp/ruby_lsp_rails/definition.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Rails
1111
#
1212
# Currently supported targets:
1313
# - Callbacks
14-
# - Routes
14+
# - Named routes
1515
#
1616
# # Example
1717
#

lib/ruby_lsp/ruby_lsp_rails/runner_client.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ def model(name)
9797

9898
sig { params(name: String).returns(T.nilable(T::Hash[Symbol, T.untyped])) }
9999
def route_location(name)
100-
$stderr.puts("Ruby LSP Rails getting route location for: #{name}")
101100
make_request("route_location", name: name)
102-
# $stderr.puts("after")
103101
rescue IncompleteMessageError
104102
$stderr.puts("Ruby LSP Rails failed to get route location: #{@stderr.read}")
105103
nil
@@ -168,7 +166,7 @@ def read_response
168166
return
169167
end
170168

171-
$stderr.puts(response.fetch(:result))
169+
$stderr.puts("***Result: " + response.fetch(:result).to_s)
172170
response.fetch(:result)
173171
end
174172
end

lib/ruby_lsp/ruby_lsp_rails/server.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def route_location(name)
106106

107107
{
108108
result: {
109-
location: ::Rails.root.join(route.source_location),
109+
location: ::Rails.root.join(route.source_location).to_s,
110110
},
111111
}
112112
end

test/ruby_lsp_rails/definition_test.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def generate_definitions_for_source(source, position)
140140
method: "textDocument/definition",
141141
params: { textDocument: { uri: uri }, position: position },
142142
)
143+
143144
server.pop_response.response
144145
end
145146
end

test/ruby_lsp_rails/server_test.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class ServerTest < ActiveSupport::TestCase
3535

3636
test "route location" do
3737
response = @server.execute("route_location", { name: "user_path" })
38-
assert_equal("config/routes.rb:5", response)
38+
location = response[:result][:location]
39+
assert location.ends_with?("test/dummy/config/routes.rb:5")
3940
end
4041
end

0 commit comments

Comments
 (0)