Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YARP Migration: Use YARP branch with column fix #956

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ group :development do
gem "rdoc", require: false
gem "psych", "~> 5.1", require: false
end

gem "yarp", git: "https://github.com/andyw8/yarp.git", branch: "andyw8/adjust-column-behaviour"
11 changes: 9 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: https://github.com/andyw8/yarp.git
revision: 62a31fafc31f48cd024e49b979c7da4a87fe490e
branch: andyw8/adjust-column-behaviour
specs:
yarp (0.9.0)

PATH
remote: .
specs:
Expand All @@ -6,7 +13,7 @@ PATH
sorbet-runtime
syntax_tree (>= 6.1.1, < 7)
yarp (>= 0.9, < 0.10)
d

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -121,7 +128,6 @@ GEM
yard-sorbet (0.8.1)
sorbet-runtime (>= 0.5)
yard (>= 0.9)
yarp (0.9.0)

PLATFORMS
arm64-darwin
Expand All @@ -147,6 +153,7 @@ DEPENDENCIES
ruby-lsp!
sorbet-static-and-runtime
tapioca (~> 0.11)
yarp!

BUNDLED WITH
2.4.10
32 changes: 16 additions & 16 deletions lib/ruby_indexer/test/classes_and_modules_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Foo
end
RUBY

assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-2")
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-3")
end

def test_class_with_statements
Expand All @@ -21,7 +21,7 @@ def something; end
end
RUBY

assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:2-2")
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:2-3")
end

def test_colon_colon_class
Expand All @@ -30,7 +30,7 @@ class ::Foo
end
RUBY

assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-2")
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-3")
end

def test_colon_colon_class_inside_class
Expand All @@ -41,8 +41,8 @@ class ::Foo
end
RUBY

assert_entry("Bar", Index::Entry::Class, "/fake/path/foo.rb:0-0:3-2")
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:1-2:2-4")
assert_entry("Bar", Index::Entry::Class, "/fake/path/foo.rb:0-0:3-3")
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:1-2:2-5")
end

def test_namespaced_class
Expand All @@ -51,7 +51,7 @@ class Foo::Bar
end
RUBY

assert_entry("Foo::Bar", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-2")
assert_entry("Foo::Bar", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-3")
end

def test_dynamically_namespaced_class
Expand All @@ -69,7 +69,7 @@ module Foo
end
RUBY

assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-2")
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-3")
end

def test_module_with_statements
Expand All @@ -79,7 +79,7 @@ def something; end
end
RUBY

assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:2-2")
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:2-3")
end

def test_colon_colon_module
Expand All @@ -88,7 +88,7 @@ module ::Foo
end
RUBY

assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-2")
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-3")
end

def test_namespaced_module
Expand All @@ -97,7 +97,7 @@ module Foo::Bar
end
RUBY

assert_entry("Foo::Bar", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-2")
assert_entry("Foo::Bar", Index::Entry::Module, "/fake/path/foo.rb:0-0:1-3")
end

def test_dynamically_namespaced_module
Expand All @@ -124,11 +124,11 @@ class Something
end
RUBY

assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:10-2")
assert_entry("Foo::Bar", Index::Entry::Class, "/fake/path/foo.rb:1-2:2-4")
assert_entry("Foo::Baz", Index::Entry::Module, "/fake/path/foo.rb:4-2:9-4")
assert_entry("Foo::Baz::Qux", Index::Entry::Class, "/fake/path/foo.rb:5-4:8-6")
assert_entry("Foo::Baz::Qux::Something", Index::Entry::Class, "/fake/path/foo.rb:6-6:7-8")
assert_entry("Foo", Index::Entry::Module, "/fake/path/foo.rb:0-0:10-3")
assert_entry("Foo::Bar", Index::Entry::Class, "/fake/path/foo.rb:1-2:2-5")
assert_entry("Foo::Baz", Index::Entry::Module, "/fake/path/foo.rb:4-2:9-5")
assert_entry("Foo::Baz::Qux", Index::Entry::Class, "/fake/path/foo.rb:5-4:8-7")
assert_entry("Foo::Baz::Qux::Something", Index::Entry::Class, "/fake/path/foo.rb:6-6:7-9")
end

def test_deleting_from_index_based_on_file_path
Expand All @@ -137,7 +137,7 @@ class Foo
end
RUBY

assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-2")
assert_entry("Foo", Index::Entry::Class, "/fake/path/foo.rb:0-0:1-3")

@index.delete("/fake/path/foo.rb")
refute_entry("Foo")
Expand Down
22 changes: 11 additions & 11 deletions lib/ruby_indexer/test/constant_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class ::Bar
end
RUBY

assert_entry("FOO", Index::Entry::Constant, "/fake/path/foo.rb:0-0:0-6")
assert_entry("Bar::FOO", Index::Entry::Constant, "/fake/path/foo.rb:3-2:3-8")
assert_entry("FOO", Index::Entry::Constant, "/fake/path/foo.rb:0-0:0-7")
assert_entry("Bar::FOO", Index::Entry::Constant, "/fake/path/foo.rb:3-2:3-9")
end

def test_constant_or_writes
Expand All @@ -27,8 +27,8 @@ class ::Bar
end
RUBY

assert_entry("FOO", Index::Entry::Constant, "/fake/path/foo.rb:0-0:0-8")
assert_entry("Bar::FOO", Index::Entry::Constant, "/fake/path/foo.rb:3-2:3-10")
assert_entry("FOO", Index::Entry::Constant, "/fake/path/foo.rb:0-0:0-9")
assert_entry("Bar::FOO", Index::Entry::Constant, "/fake/path/foo.rb:3-2:3-11")
end

def test_constant_path_writes
Expand All @@ -45,10 +45,10 @@ module B
A::BAZ = 1
RUBY

assert_entry("A::FOO", Index::Entry::Constant, "/fake/path/foo.rb:1-2:1-8")
assert_entry("BAR", Index::Entry::Constant, "/fake/path/foo.rb:2-2:2-10")
assert_entry("A::B::FOO", Index::Entry::Constant, "/fake/path/foo.rb:5-4:5-10")
assert_entry("A::BAZ", Index::Entry::Constant, "/fake/path/foo.rb:9-0:9-9")
assert_entry("A::FOO", Index::Entry::Constant, "/fake/path/foo.rb:1-2:1-9")
assert_entry("BAR", Index::Entry::Constant, "/fake/path/foo.rb:2-2:2-11")
assert_entry("A::B::FOO", Index::Entry::Constant, "/fake/path/foo.rb:5-4:5-11")
assert_entry("A::BAZ", Index::Entry::Constant, "/fake/path/foo.rb:9-0:9-10")
end

def test_constant_path_or_writes
Expand All @@ -61,9 +61,9 @@ class A
A::BAZ ||= 1
RUBY

assert_entry("A::FOO", Index::Entry::Constant, "/fake/path/foo.rb:1-2:1-10")
assert_entry("BAR", Index::Entry::Constant, "/fake/path/foo.rb:2-2:2-12")
assert_entry("A::BAZ", Index::Entry::Constant, "/fake/path/foo.rb:5-0:5-11")
assert_entry("A::FOO", Index::Entry::Constant, "/fake/path/foo.rb:1-2:1-11")
assert_entry("BAR", Index::Entry::Constant, "/fake/path/foo.rb:2-2:2-13")
assert_entry("A::BAZ", Index::Entry::Constant, "/fake/path/foo.rb:5-0:5-12")
end

def test_comments_for_constants
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby_lsp/requests/document_symbol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def after_module(node)
sig { params(node: YARP::InstanceVariableWriteNode).void }
def on_instance_variable_write(node)
create_document_symbol(
name: node.name,
name: node.name.to_s, # ???
kind: :variable,
range_node: node,
selection_range_node: node.name_loc,
Expand Down
2 changes: 1 addition & 1 deletion test/expectations/definition/class_reference.exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"end": {
"line": 187,
"character": 4
"character": 5
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions test/expectations/document_symbol/attr_accessor.exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"end": {
"line": 0,
"character": 13
"character": 14
}
},
"selectionRange": {
Expand All @@ -20,7 +20,7 @@
},
"end": {
"line": 0,
"character": 13
"character": 14
}
},
"children": []
Expand All @@ -35,7 +35,7 @@
},
"end": {
"line": 1,
"character": 13
"character": 14
}
},
"selectionRange": {
Expand All @@ -45,7 +45,7 @@
},
"end": {
"line": 1,
"character": 13
"character": 14
}
},
"children": []
Expand All @@ -60,7 +60,7 @@
},
"end": {
"line": 1,
"character": 17
"character": 18
}
},
"selectionRange": {
Expand All @@ -70,7 +70,7 @@
},
"end": {
"line": 1,
"character": 17
"character": 18
}
},
"children": []
Expand All @@ -85,7 +85,7 @@
},
"end": {
"line": 2,
"character": 15
"character": 16
}
},
"selectionRange": {
Expand All @@ -95,7 +95,7 @@
},
"end": {
"line": 2,
"character": 15
"character": 16
}
},
"children": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"end": {
"line": 2,
"character": 2
"character": 3
}
},
"selectionRange": {
Expand All @@ -20,7 +20,7 @@
},
"end": {
"line": 0,
"character": 8
"character": 9
}
},
"children": [
Expand All @@ -34,7 +34,7 @@
},
"end": {
"line": 1,
"character": 15
"character": 16
}
},
"selectionRange": {
Expand All @@ -44,7 +44,7 @@
},
"end": {
"line": 1,
"character": 10
"character": 11
}
},
"children": []
Expand Down
16 changes: 8 additions & 8 deletions test/expectations/document_symbol/const.exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"end": {
"line": 0,
"character": 6
"character": 7
}
},
"selectionRange": {
Expand All @@ -20,7 +20,7 @@
},
"end": {
"line": 0,
"character": 1
"character": 2
}
},
"children": []
Expand All @@ -35,7 +35,7 @@
},
"end": {
"line": 1,
"character": 8
"character": 9
}
},
"selectionRange": {
Expand All @@ -45,7 +45,7 @@
},
"end": {
"line": 1,
"character": 3
"character": 4
}
},
"children": []
Expand All @@ -60,7 +60,7 @@
},
"end": {
"line": 2,
"character": 11
"character": 12
}
},
"selectionRange": {
Expand All @@ -70,7 +70,7 @@
},
"end": {
"line": 2,
"character": 6
"character": 7
}
},
"children": []
Expand All @@ -85,7 +85,7 @@
},
"end": {
"line": 3,
"character": 13
"character": 14
}
},
"selectionRange": {
Expand All @@ -95,7 +95,7 @@
},
"end": {
"line": 3,
"character": 8
"character": 9
}
},
"children": []
Expand Down
Loading
Loading