Skip to content

Commit

Permalink
Change code lens order
Browse files Browse the repository at this point in the history
So `Run` and `Run In Terminal` will appear side-by-side.
  • Loading branch information
st0012 authored and vinistock committed May 4, 2023
1 parent ee0e7e3 commit b821464
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
12 changes: 6 additions & 6 deletions lib/ruby_lsp/requests/code_lens.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,22 @@ def add_code_lens(node, name:, command:)

@response << create_code_lens(
node,
title: "Debug",
command_name: "rubyLsp.debugTest",
title: "Run In Terminal",
command_name: "rubyLsp.runTestInTerminal",
path: @path,
name: name,
test_command: command,
type: "debug",
type: "test_in_terminal",
)

@response << create_code_lens(
node,
title: "Run In Terminal",
command_name: "rubyLsp.runTestInTerminal",
title: "Debug",
command_name: "rubyLsp.debugTest",
path: @path,
name: name,
test_command: command,
type: "test_in_terminal",
type: "debug",
)
end
end
Expand Down
60 changes: 30 additions & 30 deletions test/expectations/code_lens/minitest_tests.exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
}
},
"command": {
"title": "Debug",
"command": "rubyLsp.debugTest",
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"arguments": [
"/fake.rb",
"Test",
Expand All @@ -57,7 +57,7 @@
]
},
"data": {
"type": "debug"
"type": "test_in_terminal"
}
},
{
Expand All @@ -72,8 +72,8 @@
}
},
"command": {
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"title": "Debug",
"command": "rubyLsp.debugTest",
"arguments": [
"/fake.rb",
"Test",
Expand All @@ -87,7 +87,7 @@
]
},
"data": {
"type": "test_in_terminal"
"type": "debug"
}
},
{
Expand Down Expand Up @@ -132,8 +132,8 @@
}
},
"command": {
"title": "Debug",
"command": "rubyLsp.debugTest",
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"arguments": [
"/fake.rb",
"test_public",
Expand All @@ -147,7 +147,7 @@
]
},
"data": {
"type": "debug"
"type": "test_in_terminal"
}
},
{
Expand All @@ -162,8 +162,8 @@
}
},
"command": {
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"title": "Debug",
"command": "rubyLsp.debugTest",
"arguments": [
"/fake.rb",
"test_public",
Expand All @@ -177,7 +177,7 @@
]
},
"data": {
"type": "test_in_terminal"
"type": "debug"
}
},
{
Expand Down Expand Up @@ -222,8 +222,8 @@
}
},
"command": {
"title": "Debug",
"command": "rubyLsp.debugTest",
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"arguments": [
"/fake.rb",
"test_public_command",
Expand All @@ -237,7 +237,7 @@
]
},
"data": {
"type": "debug"
"type": "test_in_terminal"
}
},
{
Expand All @@ -252,8 +252,8 @@
}
},
"command": {
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"title": "Debug",
"command": "rubyLsp.debugTest",
"arguments": [
"/fake.rb",
"test_public_command",
Expand All @@ -267,7 +267,7 @@
]
},
"data": {
"type": "test_in_terminal"
"type": "debug"
}
},
{
Expand Down Expand Up @@ -312,8 +312,8 @@
}
},
"command": {
"title": "Debug",
"command": "rubyLsp.debugTest",
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"arguments": [
"/fake.rb",
"test_another_public",
Expand All @@ -327,7 +327,7 @@
]
},
"data": {
"type": "debug"
"type": "test_in_terminal"
}
},
{
Expand All @@ -342,8 +342,8 @@
}
},
"command": {
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"title": "Debug",
"command": "rubyLsp.debugTest",
"arguments": [
"/fake.rb",
"test_another_public",
Expand All @@ -357,7 +357,7 @@
]
},
"data": {
"type": "test_in_terminal"
"type": "debug"
}
},
{
Expand Down Expand Up @@ -402,8 +402,8 @@
}
},
"command": {
"title": "Debug",
"command": "rubyLsp.debugTest",
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"arguments": [
"/fake.rb",
"test_public_vcall",
Expand All @@ -417,7 +417,7 @@
]
},
"data": {
"type": "debug"
"type": "test_in_terminal"
}
},
{
Expand All @@ -432,8 +432,8 @@
}
},
"command": {
"title": "Run In Terminal",
"command": "rubyLsp.runTestInTerminal",
"title": "Debug",
"command": "rubyLsp.debugTest",
"arguments": [
"/fake.rb",
"test_public_vcall",
Expand All @@ -447,7 +447,7 @@
]
},
"data": {
"type": "test_in_terminal"
"type": "debug"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions test/requests/code_lens_expectations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class Test < Minitest::Test; end

assert_equal(response.size, 4)
assert_match("Run", response[0].command.title)
assert_match("Debug", response[1].command.title)
assert_match("Run In Terminal", response[2].command.title)
assert_match("Run In Terminal", response[1].command.title)
assert_match("Debug", response[2].command.title)
assert_match("Run Test", response[3].command.title)
ensure
RubyLsp::Requests::Hover.listeners.clear
Expand Down

0 comments on commit b821464

Please sign in to comment.