ruby-lsp 0.23.14 → 0.23.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/exe/ruby-lsp-launcher +9 -1
- data/lib/ruby_indexer/lib/ruby_indexer/configuration.rb +2 -2
- data/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +6 -3
- data/lib/ruby_indexer/lib/ruby_indexer/entry.rb +4 -2
- data/lib/ruby_indexer/lib/ruby_indexer/index.rb +60 -30
- data/lib/ruby_indexer/lib/ruby_indexer/prefix_tree.rb +5 -4
- data/lib/ruby_indexer/lib/ruby_indexer/reference_finder.rb +5 -1
- data/lib/ruby_indexer/test/class_variables_test.rb +14 -14
- data/lib/ruby_indexer/test/classes_and_modules_test.rb +65 -40
- data/lib/ruby_indexer/test/configuration_test.rb +6 -4
- data/lib/ruby_indexer/test/constant_test.rb +34 -34
- data/lib/ruby_indexer/test/enhancements_test.rb +1 -1
- data/lib/ruby_indexer/test/index_test.rb +139 -135
- data/lib/ruby_indexer/test/instance_variables_test.rb +37 -37
- data/lib/ruby_indexer/test/method_test.rb +118 -118
- data/lib/ruby_indexer/test/prefix_tree_test.rb +13 -13
- data/lib/ruby_indexer/test/rbs_indexer_test.rb +64 -70
- data/lib/ruby_indexer/test/test_case.rb +2 -2
- data/lib/ruby_lsp/document.rb +6 -1
- data/lib/ruby_lsp/erb_document.rb +12 -4
- data/lib/ruby_lsp/global_state.rb +1 -1
- data/lib/ruby_lsp/listeners/code_lens.rb +3 -3
- data/lib/ruby_lsp/listeners/completion.rb +24 -11
- data/lib/ruby_lsp/listeners/definition.rb +1 -1
- data/lib/ruby_lsp/listeners/document_link.rb +3 -1
- data/lib/ruby_lsp/listeners/document_symbol.rb +3 -3
- data/lib/ruby_lsp/listeners/folding_ranges.rb +8 -4
- data/lib/ruby_lsp/listeners/hover.rb +2 -2
- data/lib/ruby_lsp/listeners/semantic_highlighting.rb +12 -5
- data/lib/ruby_lsp/listeners/signature_help.rb +5 -1
- data/lib/ruby_lsp/listeners/spec_style.rb +1 -1
- data/lib/ruby_lsp/listeners/test_style.rb +8 -8
- data/lib/ruby_lsp/requests/code_action_resolve.rb +14 -15
- data/lib/ruby_lsp/requests/completion_resolve.rb +1 -1
- data/lib/ruby_lsp/requests/hover.rb +2 -2
- data/lib/ruby_lsp/requests/on_type_formatting.rb +4 -2
- data/lib/ruby_lsp/requests/prepare_type_hierarchy.rb +1 -2
- data/lib/ruby_lsp/requests/references.rb +2 -1
- data/lib/ruby_lsp/requests/rename.rb +8 -5
- data/lib/ruby_lsp/requests/selection_ranges.rb +1 -1
- data/lib/ruby_lsp/requests/semantic_highlighting.rb +4 -4
- data/lib/ruby_lsp/requests/show_syntax_tree.rb +2 -2
- data/lib/ruby_lsp/requests/support/common.rb +3 -1
- data/lib/ruby_lsp/requests/support/rubocop_formatter.rb +2 -2
- data/lib/ruby_lsp/requests/support/source_uri.rb +5 -3
- data/lib/ruby_lsp/response_builders/document_symbol.rb +3 -2
- data/lib/ruby_lsp/response_builders/hover.rb +1 -1
- data/lib/ruby_lsp/response_builders/semantic_highlighting.rb +1 -1
- data/lib/ruby_lsp/ruby_document.rb +2 -2
- data/lib/ruby_lsp/scripts/compose_bundle.rb +6 -4
- data/lib/ruby_lsp/server.rb +14 -5
- data/lib/ruby_lsp/setup_bundler.rb +7 -3
- data/lib/ruby_lsp/static_docs.rb +8 -1
- data/lib/ruby_lsp/store.rb +3 -2
- data/lib/ruby_lsp/test_reporters/lsp_reporter.rb +164 -0
- data/lib/ruby_lsp/test_reporters/minitest_reporter.rb +105 -0
- data/lib/ruby_lsp/test_reporters/test_unit_reporter.rb +94 -0
- data/lib/ruby_lsp/type_inferrer.rb +4 -1
- data/lib/ruby_lsp/utils.rb +12 -2
- metadata +6 -6
- data/lib/ruby_lsp/ruby_lsp_reporter_plugin.rb +0 -109
- data/lib/ruby_lsp/test_reporter.rb +0 -207
- data/lib/ruby_lsp/test_unit_test_runner.rb +0 -98
| @@ -15,11 +15,11 @@ module RubyIndexer | |
| 15 15 | 
             
                    end
         | 
| 16 16 | 
             
                  RUBY
         | 
| 17 17 |  | 
| 18 | 
            -
                  entries = @index["Foo"]
         | 
| 18 | 
            +
                  entries = @index["Foo"] #: as !nil
         | 
| 19 19 | 
             
                  assert_equal(2, entries.length)
         | 
| 20 20 |  | 
| 21 21 | 
             
                  @index.delete(URI::Generic.from_path(path: "/fake/path/other_foo.rb"))
         | 
| 22 | 
            -
                  entries = @index["Foo"]
         | 
| 22 | 
            +
                  entries = @index["Foo"] #: as !nil
         | 
| 23 23 | 
             
                  assert_equal(1, entries.length)
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| @@ -29,7 +29,7 @@ module RubyIndexer | |
| 29 29 | 
             
                    end
         | 
| 30 30 | 
             
                  RUBY
         | 
| 31 31 |  | 
| 32 | 
            -
                  entries = @index["Foo"]
         | 
| 32 | 
            +
                  entries = @index["Foo"] #: as !nil
         | 
| 33 33 | 
             
                  assert_equal(1, entries.length)
         | 
| 34 34 |  | 
| 35 35 | 
             
                  @index.delete(URI::Generic.from_path(path: "/fake/path/foo.rb"))
         | 
| @@ -52,21 +52,21 @@ module RubyIndexer | |
| 52 52 | 
             
                    end
         | 
| 53 53 | 
             
                  RUBY
         | 
| 54 54 |  | 
| 55 | 
            -
                  entries = @index.resolve("Something", ["Foo", "Baz"])
         | 
| 55 | 
            +
                  entries = @index.resolve("Something", ["Foo", "Baz"]) #: as !nil
         | 
| 56 56 | 
             
                  refute_empty(entries)
         | 
| 57 | 
            -
                  assert_equal("Foo::Baz::Something", entries.first | 
| 57 | 
            +
                  assert_equal("Foo::Baz::Something", entries.first&.name)
         | 
| 58 58 |  | 
| 59 | 
            -
                  entries = @index.resolve("Bar", ["Foo"])
         | 
| 59 | 
            +
                  entries = @index.resolve("Bar", ["Foo"]) #: as !nil
         | 
| 60 60 | 
             
                  refute_empty(entries)
         | 
| 61 | 
            -
                  assert_equal("Foo::Bar", entries.first | 
| 61 | 
            +
                  assert_equal("Foo::Bar", entries.first&.name)
         | 
| 62 62 |  | 
| 63 | 
            -
                  entries = @index.resolve("Bar", ["Foo", "Baz"])
         | 
| 63 | 
            +
                  entries = @index.resolve("Bar", ["Foo", "Baz"]) #: as !nil
         | 
| 64 64 | 
             
                  refute_empty(entries)
         | 
| 65 | 
            -
                  assert_equal("Foo::Bar", entries.first | 
| 65 | 
            +
                  assert_equal("Foo::Bar", entries.first&.name)
         | 
| 66 66 |  | 
| 67 | 
            -
                  entries = @index.resolve("Foo::Bar", ["Foo", "Baz"])
         | 
| 67 | 
            +
                  entries = @index.resolve("Foo::Bar", ["Foo", "Baz"]) #: as !nil
         | 
| 68 68 | 
             
                  refute_empty(entries)
         | 
| 69 | 
            -
                  assert_equal("Foo::Bar", entries.first | 
| 69 | 
            +
                  assert_equal("Foo::Bar", entries.first&.name)
         | 
| 70 70 |  | 
| 71 71 | 
             
                  assert_nil(@index.resolve("DoesNotExist", ["Foo"]))
         | 
| 72 72 | 
             
                end
         | 
| @@ -86,9 +86,9 @@ module RubyIndexer | |
| 86 86 | 
             
                    end
         | 
| 87 87 | 
             
                  RUBY
         | 
| 88 88 |  | 
| 89 | 
            -
                  entries = @index["::Foo::Baz::Something"]
         | 
| 89 | 
            +
                  entries = @index["::Foo::Baz::Something"] #: as !nil
         | 
| 90 90 | 
             
                  refute_empty(entries)
         | 
| 91 | 
            -
                  assert_equal("Foo::Baz::Something", entries.first | 
| 91 | 
            +
                  assert_equal("Foo::Baz::Something", entries.first&.name)
         | 
| 92 92 | 
             
                end
         | 
| 93 93 |  | 
| 94 94 | 
             
                def test_fuzzy_search
         | 
| @@ -140,7 +140,7 @@ module RubyIndexer | |
| 140 140 | 
             
                    end
         | 
| 141 141 | 
             
                  RUBY
         | 
| 142 142 |  | 
| 143 | 
            -
                  assert_equal(["path/ | 
| 143 | 
            +
                  assert_equal(["path/other_foo", "path/foo"], @index.search_require_paths("path").map(&:require_path))
         | 
| 144 144 | 
             
                end
         | 
| 145 145 |  | 
| 146 146 | 
             
                def test_searching_for_entries_based_on_prefix
         | 
| @@ -157,10 +157,10 @@ module RubyIndexer | |
| 157 157 | 
             
                  RUBY
         | 
| 158 158 |  | 
| 159 159 | 
             
                  results = @index.prefix_search("Foo", []).map { |entries| entries.map(&:name) }
         | 
| 160 | 
            -
                  assert_equal([["Foo:: | 
| 160 | 
            +
                  assert_equal([["Foo::Bizt"], ["Foo::Bizw", "Foo::Bizw"]], results)
         | 
| 161 161 |  | 
| 162 162 | 
             
                  results = @index.prefix_search("Biz", ["Foo"]).map { |entries| entries.map(&:name) }
         | 
| 163 | 
            -
                  assert_equal([["Foo:: | 
| 163 | 
            +
                  assert_equal([["Foo::Bizt"], ["Foo::Bizw", "Foo::Bizw"]], results)
         | 
| 164 164 | 
             
                end
         | 
| 165 165 |  | 
| 166 166 | 
             
                def test_resolve_normalizes_top_level_names
         | 
| @@ -172,15 +172,15 @@ module RubyIndexer | |
| 172 172 | 
             
                    end
         | 
| 173 173 | 
             
                  RUBY
         | 
| 174 174 |  | 
| 175 | 
            -
                  entries = @index.resolve("::Foo::Bar", [])
         | 
| 175 | 
            +
                  entries = @index.resolve("::Foo::Bar", []) #: as !nil
         | 
| 176 176 | 
             
                  refute_nil(entries)
         | 
| 177 177 |  | 
| 178 | 
            -
                  assert_equal("Foo::Bar", entries.first | 
| 178 | 
            +
                  assert_equal("Foo::Bar", entries.first&.name)
         | 
| 179 179 |  | 
| 180 | 
            -
                  entries = @index.resolve("::Bar", ["Foo"])
         | 
| 180 | 
            +
                  entries = @index.resolve("::Bar", ["Foo"]) #: as !nil
         | 
| 181 181 | 
             
                  refute_nil(entries)
         | 
| 182 182 |  | 
| 183 | 
            -
                  assert_equal("Bar", entries.first | 
| 183 | 
            +
                  assert_equal("Bar", entries.first&.name)
         | 
| 184 184 | 
             
                end
         | 
| 185 185 |  | 
| 186 186 | 
             
                def test_resolving_aliases_to_non_existing_constants_with_conflicting_names
         | 
| @@ -195,7 +195,7 @@ module RubyIndexer | |
| 195 195 | 
             
                    end
         | 
| 196 196 | 
             
                  RUBY
         | 
| 197 197 |  | 
| 198 | 
            -
                  entry = @index.resolve("BAZ", ["Foo", "Bar"]) | 
| 198 | 
            +
                  entry = @index.resolve("BAZ", ["Foo", "Bar"])&.first
         | 
| 199 199 | 
             
                  refute_nil(entry)
         | 
| 200 200 |  | 
| 201 201 | 
             
                  assert_instance_of(Entry::UnresolvedConstantAlias, entry)
         | 
| @@ -233,9 +233,10 @@ module RubyIndexer | |
| 233 233 | 
             
                    end
         | 
| 234 234 | 
             
                  RUBY
         | 
| 235 235 |  | 
| 236 | 
            -
                  entries =  | 
| 237 | 
            -
                  assert_equal("baz", entries.first | 
| 238 | 
            -
                   | 
| 236 | 
            +
                  entries = @index.resolve_method("baz", "Foo::Bar") #: as !nil
         | 
| 237 | 
            +
                  assert_equal("baz", entries.first&.name)
         | 
| 238 | 
            +
                  owner = entries.first&.owner #: as !nil
         | 
| 239 | 
            +
                  assert_equal("Foo::Bar", owner.name)
         | 
| 239 240 | 
             
                end
         | 
| 240 241 |  | 
| 241 242 | 
             
                def test_resolve_method_with_class_name_conflict
         | 
| @@ -248,9 +249,10 @@ module RubyIndexer | |
| 248 249 | 
             
                    end
         | 
| 249 250 | 
             
                  RUBY
         | 
| 250 251 |  | 
| 251 | 
            -
                  entries =  | 
| 252 | 
            -
                  assert_equal("Array", entries.first | 
| 253 | 
            -
                   | 
| 252 | 
            +
                  entries = @index.resolve_method("Array", "Foo") #: as !nil
         | 
| 253 | 
            +
                  assert_equal("Array", entries.first&.name)
         | 
| 254 | 
            +
                  owner = entries.first&.owner #: as !nil
         | 
| 255 | 
            +
                  assert_equal("Foo", owner.name)
         | 
| 254 256 | 
             
                end
         | 
| 255 257 |  | 
| 256 258 | 
             
                def test_resolve_method_attribute
         | 
| @@ -260,9 +262,10 @@ module RubyIndexer | |
| 260 262 | 
             
                    end
         | 
| 261 263 | 
             
                  RUBY
         | 
| 262 264 |  | 
| 263 | 
            -
                  entries =  | 
| 264 | 
            -
                  assert_equal("bar", entries.first | 
| 265 | 
            -
                   | 
| 265 | 
            +
                  entries = @index.resolve_method("bar", "Foo") #: as !nil
         | 
| 266 | 
            +
                  assert_equal("bar", entries.first&.name)
         | 
| 267 | 
            +
                  owner = entries.first&.owner #: as !nil
         | 
| 268 | 
            +
                  assert_equal("Foo", owner.name)
         | 
| 266 269 | 
             
                end
         | 
| 267 270 |  | 
| 268 271 | 
             
                def test_resolve_method_with_two_definitions
         | 
| @@ -278,15 +281,17 @@ module RubyIndexer | |
| 278 281 | 
             
                    end
         | 
| 279 282 | 
             
                  RUBY
         | 
| 280 283 |  | 
| 281 | 
            -
                  first_entry, second_entry =  | 
| 284 | 
            +
                  first_entry, second_entry = @index.resolve_method("bar", "Foo") #: as !nil
         | 
| 282 285 |  | 
| 283 | 
            -
                  assert_equal("bar", first_entry | 
| 284 | 
            -
                   | 
| 285 | 
            -
                   | 
| 286 | 
            +
                  assert_equal("bar", first_entry&.name)
         | 
| 287 | 
            +
                  owner = first_entry&.owner #: as !nil
         | 
| 288 | 
            +
                  assert_equal("Foo", owner.name)
         | 
| 289 | 
            +
                  assert_includes(first_entry&.comments, "Hello from first `bar`")
         | 
| 286 290 |  | 
| 287 | 
            -
                  assert_equal("bar", second_entry | 
| 288 | 
            -
                   | 
| 289 | 
            -
                   | 
| 291 | 
            +
                  assert_equal("bar", second_entry&.name)
         | 
| 292 | 
            +
                  owner = second_entry&.owner #: as !nil
         | 
| 293 | 
            +
                  assert_equal("Foo", owner.name)
         | 
| 294 | 
            +
                  assert_includes(second_entry&.comments, "Hello from second `bar`")
         | 
| 290 295 | 
             
                end
         | 
| 291 296 |  | 
| 292 297 | 
             
                def test_resolve_method_inherited_only
         | 
| @@ -300,9 +305,8 @@ module RubyIndexer | |
| 300 305 | 
             
                    end
         | 
| 301 306 | 
             
                  RUBY
         | 
| 302 307 |  | 
| 303 | 
            -
                  entry =  | 
| 304 | 
            -
             | 
| 305 | 
            -
                  assert_equal("Bar", T.must(entry.owner).name)
         | 
| 308 | 
            +
                  entry = @index.resolve_method("baz", "Foo", inherited_only: true)&.first #: as !nil
         | 
| 309 | 
            +
                  assert_equal("Bar", entry.owner&.name)
         | 
| 306 310 | 
             
                end
         | 
| 307 311 |  | 
| 308 312 | 
             
                def test_resolve_method_inherited_only_for_prepended_module
         | 
| @@ -338,7 +342,7 @@ module RubyIndexer | |
| 338 342 | 
             
                  entries = @index.prefix_search("qz")
         | 
| 339 343 | 
             
                  refute_empty(entries)
         | 
| 340 344 |  | 
| 341 | 
            -
                  entry =  | 
| 345 | 
            +
                  entry = entries.first&.first #: as !nil
         | 
| 342 346 | 
             
                  assert_equal("qzx", entry.name)
         | 
| 343 347 | 
             
                end
         | 
| 344 348 |  | 
| @@ -739,13 +743,13 @@ module RubyIndexer | |
| 739 743 | 
             
                    end
         | 
| 740 744 | 
             
                  RUBY
         | 
| 741 745 |  | 
| 742 | 
            -
                  entry =  | 
| 746 | 
            +
                  entry = @index.resolve_method("baz", "Wow")&.first #: as !nil
         | 
| 743 747 | 
             
                  assert_equal("baz", entry.name)
         | 
| 744 | 
            -
                  assert_equal("Foo",  | 
| 748 | 
            +
                  assert_equal("Foo", entry.owner&.name)
         | 
| 745 749 |  | 
| 746 | 
            -
                  entry =  | 
| 750 | 
            +
                  entry = @index.resolve_method("qux", "Wow")&.first #: as !nil
         | 
| 747 751 | 
             
                  assert_equal("qux", entry.name)
         | 
| 748 | 
            -
                  assert_equal("Bar",  | 
| 752 | 
            +
                  assert_equal("Bar", entry.owner&.name)
         | 
| 749 753 | 
             
                end
         | 
| 750 754 |  | 
| 751 755 | 
             
                def test_resolving_an_inherited_method_lands_on_first_match
         | 
| @@ -765,12 +769,12 @@ module RubyIndexer | |
| 765 769 | 
             
                    end
         | 
| 766 770 | 
             
                  RUBY
         | 
| 767 771 |  | 
| 768 | 
            -
                  entries =  | 
| 772 | 
            +
                  entries = @index.resolve_method("qux", "Wow") #: as !nil
         | 
| 769 773 | 
             
                  assert_equal(1, entries.length)
         | 
| 770 774 |  | 
| 771 | 
            -
                  entry =  | 
| 775 | 
            +
                  entry = entries.first #: as !nil
         | 
| 772 776 | 
             
                  assert_equal("qux", entry.name)
         | 
| 773 | 
            -
                  assert_equal("Foo",  | 
| 777 | 
            +
                  assert_equal("Foo", entry.owner&.name)
         | 
| 774 778 | 
             
                end
         | 
| 775 779 |  | 
| 776 780 | 
             
                def test_handle_change_clears_ancestor_cache_if_tree_changed
         | 
| @@ -800,7 +804,8 @@ module RubyIndexer | |
| 800 804 | 
             
                        end
         | 
| 801 805 | 
             
                      RUBY
         | 
| 802 806 |  | 
| 803 | 
            -
                       | 
| 807 | 
            +
                      path = uri.full_path #: as !nil
         | 
| 808 | 
            +
                      @index.handle_change(uri, File.read(path))
         | 
| 804 809 | 
             
                      assert_empty(@index.instance_variable_get(:@ancestors))
         | 
| 805 810 | 
             
                      assert_equal(["Bar", "Object", "Kernel", "BasicObject"], @index.linearized_ancestors_of("Bar"))
         | 
| 806 811 | 
             
                    end
         | 
| @@ -837,7 +842,8 @@ module RubyIndexer | |
| 837 842 | 
             
                        end
         | 
| 838 843 | 
             
                      RUBY
         | 
| 839 844 |  | 
| 840 | 
            -
                       | 
| 845 | 
            +
                      path = uri.full_path #: as !nil
         | 
| 846 | 
            +
                      @index.handle_change(uri, File.read(path))
         | 
| 841 847 | 
             
                      refute_empty(@index.instance_variable_get(:@ancestors))
         | 
| 842 848 | 
             
                      assert_equal(["Bar", "Foo", "Object", "Kernel", "BasicObject"], @index.linearized_ancestors_of("Bar"))
         | 
| 843 849 | 
             
                    end
         | 
| @@ -870,7 +876,8 @@ module RubyIndexer | |
| 870 876 | 
             
                        end
         | 
| 871 877 | 
             
                      RUBY
         | 
| 872 878 |  | 
| 873 | 
            -
                       | 
| 879 | 
            +
                      path = uri.full_path #: as !nil
         | 
| 880 | 
            +
                      @index.handle_change(uri, File.read(path))
         | 
| 874 881 | 
             
                      assert_empty(@index.instance_variable_get(:@ancestors))
         | 
| 875 882 | 
             
                      assert_equal(["Bar", "Object", "Kernel", "BasicObject"], @index.linearized_ancestors_of("Bar"))
         | 
| 876 883 | 
             
                    end
         | 
| @@ -904,7 +911,7 @@ module RubyIndexer | |
| 904 911 | 
             
                    CONST = 4
         | 
| 905 912 | 
             
                  RUBY
         | 
| 906 913 |  | 
| 907 | 
            -
                  entry =  | 
| 914 | 
            +
                  entry = @index.resolve("CONST", ["Namespace", "Bar"])&.first #: as !nil
         | 
| 908 915 | 
             
                  assert_equal(14, entry.location.start_line)
         | 
| 909 916 | 
             
                end
         | 
| 910 917 |  | 
| @@ -925,10 +932,10 @@ module RubyIndexer | |
| 925 932 | 
             
                    end
         | 
| 926 933 | 
             
                  RUBY
         | 
| 927 934 |  | 
| 928 | 
            -
                  entry =  | 
| 935 | 
            +
                  entry = @index.resolve("Foo::CONST::TARGET", [])&.first #: as !nil
         | 
| 929 936 | 
             
                  assert_equal(2, entry.location.start_line)
         | 
| 930 937 |  | 
| 931 | 
            -
                  entry =  | 
| 938 | 
            +
                  entry = @index.resolve("Namespace::Bar::CONST::TARGET", [])&.first #: as !nil
         | 
| 932 939 | 
             
                  assert_equal(2, entry.location.start_line)
         | 
| 933 940 | 
             
                end
         | 
| 934 941 |  | 
| @@ -946,10 +953,10 @@ module RubyIndexer | |
| 946 953 | 
             
                    end
         | 
| 947 954 | 
             
                  RUBY
         | 
| 948 955 |  | 
| 949 | 
            -
                  entry =  | 
| 956 | 
            +
                  entry = @index.resolve("CONST", ["Namespace", "Child"])&.first #: as !nil
         | 
| 950 957 | 
             
                  assert_equal(2, entry.location.start_line)
         | 
| 951 958 |  | 
| 952 | 
            -
                  entry =  | 
| 959 | 
            +
                  entry = @index.resolve("Namespace::Child::CONST", [])&.first #: as !nil
         | 
| 953 960 | 
             
                  assert_equal(5, entry.location.start_line)
         | 
| 954 961 | 
             
                end
         | 
| 955 962 |  | 
| @@ -975,13 +982,13 @@ module RubyIndexer | |
| 975 982 | 
             
                    end
         | 
| 976 983 | 
             
                  RUBY
         | 
| 977 984 |  | 
| 978 | 
            -
                  entry =  | 
| 985 | 
            +
                  entry = @index.resolve("CONST", ["Foo"])&.first #: as !nil
         | 
| 979 986 | 
             
                  assert_equal(6, entry.location.start_line)
         | 
| 980 987 |  | 
| 981 | 
            -
                  entry =  | 
| 988 | 
            +
                  entry = @index.resolve("Foo::CONST", [])&.first #: as !nil
         | 
| 982 989 | 
             
                  assert_equal(6, entry.location.start_line)
         | 
| 983 990 |  | 
| 984 | 
            -
                  entry =  | 
| 991 | 
            +
                  entry = @index.resolve("Bar::CONST", [])&.first #: as !nil
         | 
| 985 992 | 
             
                  assert_equal(15, entry.location.start_line)
         | 
| 986 993 | 
             
                end
         | 
| 987 994 |  | 
| @@ -1005,7 +1012,7 @@ module RubyIndexer | |
| 1005 1012 | 
             
                    end
         | 
| 1006 1013 | 
             
                  RUBY
         | 
| 1007 1014 |  | 
| 1008 | 
            -
                  entry =  | 
| 1015 | 
            +
                  entry = @index.resolve("CONST", ["First", "Second"])&.first #: as !nil
         | 
| 1009 1016 | 
             
                  assert_equal(6, entry.location.start_line)
         | 
| 1010 1017 | 
             
                end
         | 
| 1011 1018 |  | 
| @@ -1017,11 +1024,11 @@ module RubyIndexer | |
| 1017 1024 | 
             
                    end
         | 
| 1018 1025 | 
             
                  RUBY
         | 
| 1019 1026 |  | 
| 1020 | 
            -
                  foo_entry =  | 
| 1027 | 
            +
                  foo_entry = @index.resolve("FOO", ["Namespace"])&.first #: as !nil
         | 
| 1021 1028 | 
             
                  assert_equal(2, foo_entry.location.start_line)
         | 
| 1022 1029 | 
             
                  assert_instance_of(Entry::ConstantAlias, foo_entry)
         | 
| 1023 1030 |  | 
| 1024 | 
            -
                  bar_entry =  | 
| 1031 | 
            +
                  bar_entry = @index.resolve("BAR", ["Namespace"])&.first #: as !nil
         | 
| 1025 1032 | 
             
                  assert_equal(3, bar_entry.location.start_line)
         | 
| 1026 1033 | 
             
                  assert_instance_of(Entry::ConstantAlias, bar_entry)
         | 
| 1027 1034 | 
             
                end
         | 
| @@ -1035,15 +1042,15 @@ module RubyIndexer | |
| 1035 1042 | 
             
                    end
         | 
| 1036 1043 | 
             
                  RUBY
         | 
| 1037 1044 |  | 
| 1038 | 
            -
                  foo_entry =  | 
| 1045 | 
            +
                  foo_entry = @index.resolve("FOO", ["Namespace"])&.first #: as !nil
         | 
| 1039 1046 | 
             
                  assert_equal(2, foo_entry.location.start_line)
         | 
| 1040 1047 | 
             
                  assert_instance_of(Entry::ConstantAlias, foo_entry)
         | 
| 1041 1048 |  | 
| 1042 | 
            -
                  bar_entry =  | 
| 1049 | 
            +
                  bar_entry = @index.resolve("BAR", ["Namespace"])&.first #: as !nil
         | 
| 1043 1050 | 
             
                  assert_equal(3, bar_entry.location.start_line)
         | 
| 1044 1051 | 
             
                  assert_instance_of(Entry::ConstantAlias, bar_entry)
         | 
| 1045 1052 |  | 
| 1046 | 
            -
                  baz_entry =  | 
| 1053 | 
            +
                  baz_entry = @index.resolve("BAZ", ["Namespace"])&.first #: as !nil
         | 
| 1047 1054 | 
             
                  assert_equal(4, baz_entry.location.start_line)
         | 
| 1048 1055 | 
             
                  assert_instance_of(Entry::ConstantAlias, baz_entry)
         | 
| 1049 1056 | 
             
                end
         | 
| @@ -1065,7 +1072,7 @@ module RubyIndexer | |
| 1065 1072 | 
             
                    end
         | 
| 1066 1073 | 
             
                  RUBY
         | 
| 1067 1074 |  | 
| 1068 | 
            -
                  entry =  | 
| 1075 | 
            +
                  entry = @index.resolve("Other::ALIAS::CONST", ["Third"])&.first #: as !nil
         | 
| 1069 1076 | 
             
                  assert_kind_of(Entry::Constant, entry)
         | 
| 1070 1077 | 
             
                  assert_equal("Original::Something::CONST", entry.name)
         | 
| 1071 1078 | 
             
                end
         | 
| @@ -1080,7 +1087,7 @@ module RubyIndexer | |
| 1080 1087 | 
             
                    FOO::CONST
         | 
| 1081 1088 | 
             
                  RUBY
         | 
| 1082 1089 |  | 
| 1083 | 
            -
                  entry =  | 
| 1090 | 
            +
                  entry = @index.resolve("FOO::CONST", [])&.first #: as !nil
         | 
| 1084 1091 | 
             
                  assert_kind_of(Entry::Constant, entry)
         | 
| 1085 1092 | 
             
                  assert_equal("Foo::CONST", entry.name)
         | 
| 1086 1093 | 
             
                end
         | 
| @@ -1091,7 +1098,7 @@ module RubyIndexer | |
| 1091 1098 | 
             
                    end
         | 
| 1092 1099 | 
             
                  RUBY
         | 
| 1093 1100 |  | 
| 1094 | 
            -
                  foo_entry =  | 
| 1101 | 
            +
                  foo_entry = @index.resolve("Foo::Bar", [])&.first #: as !nil
         | 
| 1095 1102 | 
             
                  assert_equal(1, foo_entry.location.start_line)
         | 
| 1096 1103 | 
             
                  assert_instance_of(Entry::Class, foo_entry)
         | 
| 1097 1104 | 
             
                end
         | 
| @@ -1117,7 +1124,7 @@ module RubyIndexer | |
| 1117 1124 | 
             
                    end
         | 
| 1118 1125 | 
             
                  RUBY
         | 
| 1119 1126 |  | 
| 1120 | 
            -
                  foo_entry =  | 
| 1127 | 
            +
                  foo_entry = @index.resolve("A::B::Foo::CONST", ["A", "B"])&.first #: as !nil
         | 
| 1121 1128 | 
             
                  assert_equal(2, foo_entry.location.start_line)
         | 
| 1122 1129 | 
             
                end
         | 
| 1123 1130 |  | 
| @@ -1135,7 +1142,7 @@ module RubyIndexer | |
| 1135 1142 | 
             
                    end
         | 
| 1136 1143 | 
             
                  RUBY
         | 
| 1137 1144 |  | 
| 1138 | 
            -
                  foo_entry =  | 
| 1145 | 
            +
                  foo_entry = @index.resolve("Entry::CONST", ["Namespace", "Index"])&.first #: as !nil
         | 
| 1139 1146 | 
             
                  assert_equal(3, foo_entry.location.start_line)
         | 
| 1140 1147 | 
             
                end
         | 
| 1141 1148 |  | 
| @@ -1154,7 +1161,7 @@ module RubyIndexer | |
| 1154 1161 | 
             
                    end
         | 
| 1155 1162 | 
             
                  RUBY
         | 
| 1156 1163 |  | 
| 1157 | 
            -
                  foo_entry =  | 
| 1164 | 
            +
                  foo_entry = @index.resolve("CONST", ["Namespace", "Index"])&.first #: as !nil
         | 
| 1158 1165 | 
             
                  assert_equal(6, foo_entry.location.start_line)
         | 
| 1159 1166 | 
             
                end
         | 
| 1160 1167 |  | 
| @@ -1171,7 +1178,7 @@ module RubyIndexer | |
| 1171 1178 | 
             
                    end
         | 
| 1172 1179 | 
             
                  RUBY
         | 
| 1173 1180 |  | 
| 1174 | 
            -
                  foo_entry =  | 
| 1181 | 
            +
                  foo_entry = @index.resolve("CONST", ["Namespace", "Index"])&.first #: as !nil
         | 
| 1175 1182 | 
             
                  assert_equal(1, foo_entry.location.start_line)
         | 
| 1176 1183 | 
             
                end
         | 
| 1177 1184 |  | 
| @@ -1190,9 +1197,9 @@ module RubyIndexer | |
| 1190 1197 | 
             
                    end
         | 
| 1191 1198 | 
             
                  RUBY
         | 
| 1192 1199 |  | 
| 1193 | 
            -
                  entry =  | 
| 1200 | 
            +
                  entry = @index.instance_variable_completion_candidates("@", "Bar").first #: as !nil
         | 
| 1194 1201 | 
             
                  assert_equal("@bar", entry.name)
         | 
| 1195 | 
            -
                  assert_equal("Bar",  | 
| 1202 | 
            +
                  assert_equal("Bar", entry.owner&.name)
         | 
| 1196 1203 | 
             
                end
         | 
| 1197 1204 |  | 
| 1198 1205 | 
             
                def test_resolving_a_qualified_reference
         | 
| @@ -1213,7 +1220,7 @@ module RubyIndexer | |
| 1213 1220 | 
             
                    end
         | 
| 1214 1221 | 
             
                  RUBY
         | 
| 1215 1222 |  | 
| 1216 | 
            -
                  foo_entry =  | 
| 1223 | 
            +
                  foo_entry = @index.resolve("Third::CONST", ["Foo"])&.first #: as !nil
         | 
| 1217 1224 | 
             
                  assert_equal(9, foo_entry.location.start_line)
         | 
| 1218 1225 | 
             
                end
         | 
| 1219 1226 |  | 
| @@ -1226,9 +1233,9 @@ module RubyIndexer | |
| 1226 1233 | 
             
                    class Object; end
         | 
| 1227 1234 | 
             
                  RUBY
         | 
| 1228 1235 |  | 
| 1229 | 
            -
                  entries = @index["Object"]
         | 
| 1236 | 
            +
                  entries = @index["Object"] #: as !nil
         | 
| 1230 1237 | 
             
                  assert_equal(2, entries.length)
         | 
| 1231 | 
            -
                  reopened_entry = entries.last
         | 
| 1238 | 
            +
                  reopened_entry = entries.last #: as Entry::Class
         | 
| 1232 1239 | 
             
                  assert_equal("::BasicObject", reopened_entry.parent_class)
         | 
| 1233 1240 | 
             
                  assert_equal(["Object", "Kernel", "BasicObject"], @index.linearized_ancestors_of("Object"))
         | 
| 1234 1241 | 
             
                end
         | 
| @@ -1238,9 +1245,9 @@ module RubyIndexer | |
| 1238 1245 | 
             
                    class BasicObject; end
         | 
| 1239 1246 | 
             
                  RUBY
         | 
| 1240 1247 |  | 
| 1241 | 
            -
                  entries = @index["BasicObject"]
         | 
| 1248 | 
            +
                  entries = @index["BasicObject"] #: as !nil
         | 
| 1242 1249 | 
             
                  assert_equal(2, entries.length)
         | 
| 1243 | 
            -
                  reopened_entry = entries.last
         | 
| 1250 | 
            +
                  reopened_entry = entries.last #: as Entry::Class
         | 
| 1244 1251 | 
             
                  assert_nil(reopened_entry.parent_class)
         | 
| 1245 1252 | 
             
                  assert_equal(["BasicObject"], @index.linearized_ancestors_of("BasicObject"))
         | 
| 1246 1253 | 
             
                end
         | 
| @@ -1318,10 +1325,9 @@ module RubyIndexer | |
| 1318 1325 | 
             
                    end
         | 
| 1319 1326 | 
             
                  RUBY
         | 
| 1320 1327 |  | 
| 1321 | 
            -
                  entry = @index.resolve_method("found_me!", "Foo::Bar::<Class:Bar>::Baz::<Class:Baz>")&.first
         | 
| 1328 | 
            +
                  entry = @index.resolve_method("found_me!", "Foo::Bar::<Class:Bar>::Baz::<Class:Baz>")&.first #: as !nil
         | 
| 1322 1329 | 
             
                  refute_nil(entry)
         | 
| 1323 | 
            -
             | 
| 1324 | 
            -
                  assert_equal("found_me!", T.must(entry).name)
         | 
| 1330 | 
            +
                  assert_equal("found_me!", entry.name)
         | 
| 1325 1331 | 
             
                end
         | 
| 1326 1332 |  | 
| 1327 1333 | 
             
                def test_resolving_constants_in_singleton_contexts
         | 
| @@ -1344,9 +1350,9 @@ module RubyIndexer | |
| 1344 1350 | 
             
                    end
         | 
| 1345 1351 | 
             
                  RUBY
         | 
| 1346 1352 |  | 
| 1347 | 
            -
                  entry = @index.resolve("CONST", ["Foo", "Bar", "<Class:Bar>", "Baz", "<Class:Baz>"])&.first
         | 
| 1353 | 
            +
                  entry = @index.resolve("CONST", ["Foo", "Bar", "<Class:Bar>", "Baz", "<Class:Baz>"])&.first #: as !nil
         | 
| 1348 1354 | 
             
                  refute_nil(entry)
         | 
| 1349 | 
            -
                  assert_equal(9,  | 
| 1355 | 
            +
                  assert_equal(9, entry.location.start_line)
         | 
| 1350 1356 | 
             
                end
         | 
| 1351 1357 |  | 
| 1352 1358 | 
             
                def test_resolving_instance_variables_in_singleton_contexts
         | 
| @@ -1366,17 +1372,17 @@ module RubyIndexer | |
| 1366 1372 | 
             
                    end
         | 
| 1367 1373 | 
             
                  RUBY
         | 
| 1368 1374 |  | 
| 1369 | 
            -
                  entry = @index.resolve_instance_variable("@a", "Foo::Bar::<Class:Bar>")&.first
         | 
| 1375 | 
            +
                  entry = @index.resolve_instance_variable("@a", "Foo::Bar::<Class:Bar>")&.first #: as !nil
         | 
| 1370 1376 | 
             
                  refute_nil(entry)
         | 
| 1371 | 
            -
                  assert_equal("@a",  | 
| 1377 | 
            +
                  assert_equal("@a", entry.name)
         | 
| 1372 1378 |  | 
| 1373 | 
            -
                  entry = @index.resolve_instance_variable("@b", "Foo::Bar::<Class:Bar>")&.first
         | 
| 1379 | 
            +
                  entry = @index.resolve_instance_variable("@b", "Foo::Bar::<Class:Bar>")&.first #: as !nil
         | 
| 1374 1380 | 
             
                  refute_nil(entry)
         | 
| 1375 | 
            -
                  assert_equal("@b",  | 
| 1381 | 
            +
                  assert_equal("@b", entry.name)
         | 
| 1376 1382 |  | 
| 1377 | 
            -
                  entry = @index.resolve_instance_variable("@c", "Foo::Bar::<Class:Bar>::<Class:<Class:Bar>>")&.first
         | 
| 1383 | 
            +
                  entry = @index.resolve_instance_variable("@c", "Foo::Bar::<Class:Bar>::<Class:<Class:Bar>>")&.first #: as !nil
         | 
| 1378 1384 | 
             
                  refute_nil(entry)
         | 
| 1379 | 
            -
                  assert_equal("@c",  | 
| 1385 | 
            +
                  assert_equal("@c", entry.name)
         | 
| 1380 1386 | 
             
                end
         | 
| 1381 1387 |  | 
| 1382 1388 | 
             
                def test_instance_variable_completion_in_singleton_contexts
         | 
| @@ -1422,7 +1428,7 @@ module RubyIndexer | |
| 1422 1428 |  | 
| 1423 1429 | 
             
                  results = @index.fuzzy_search("Zwq")
         | 
| 1424 1430 | 
             
                  assert_equal(1, results.length)
         | 
| 1425 | 
            -
                  assert_equal("Zwq", results.first | 
| 1431 | 
            +
                  assert_equal("Zwq", results.first&.name)
         | 
| 1426 1432 | 
             
                end
         | 
| 1427 1433 |  | 
| 1428 1434 | 
             
                def test_resolving_method_aliases
         | 
| @@ -1444,39 +1450,39 @@ module RubyIndexer | |
| 1444 1450 | 
             
                  RUBY
         | 
| 1445 1451 |  | 
| 1446 1452 | 
             
                  # baz
         | 
| 1447 | 
            -
                  methods = @index.resolve_method("baz", "Bar")
         | 
| 1453 | 
            +
                  methods = @index.resolve_method("baz", "Bar") #: as !nil
         | 
| 1448 1454 | 
             
                  refute_nil(methods)
         | 
| 1449 1455 |  | 
| 1450 | 
            -
                  entry =  | 
| 1456 | 
            +
                  entry = methods.first #: as Entry::MethodAlias
         | 
| 1451 1457 | 
             
                  assert_kind_of(Entry::MethodAlias, entry)
         | 
| 1452 1458 | 
             
                  assert_equal("bar", entry.target.name)
         | 
| 1453 | 
            -
                  assert_equal("Foo",  | 
| 1459 | 
            +
                  assert_equal("Foo", entry.target.owner&.name)
         | 
| 1454 1460 |  | 
| 1455 1461 | 
             
                  # qux
         | 
| 1456 | 
            -
                  methods = @index.resolve_method("qux", "Bar")
         | 
| 1462 | 
            +
                  methods = @index.resolve_method("qux", "Bar") #: as !nil
         | 
| 1457 1463 | 
             
                  refute_nil(methods)
         | 
| 1458 1464 |  | 
| 1459 | 
            -
                  entry =  | 
| 1465 | 
            +
                  entry = methods.first #: as Entry::MethodAlias
         | 
| 1460 1466 | 
             
                  assert_kind_of(Entry::MethodAlias, entry)
         | 
| 1461 1467 | 
             
                  assert_equal("hello", entry.target.name)
         | 
| 1462 | 
            -
                  assert_equal("Bar",  | 
| 1468 | 
            +
                  assert_equal("Bar", entry.target.owner&.name)
         | 
| 1463 1469 |  | 
| 1464 1470 | 
             
                  # double
         | 
| 1465 | 
            -
                  methods = @index.resolve_method("double", "Bar")
         | 
| 1471 | 
            +
                  methods = @index.resolve_method("double", "Bar") #: as !nil
         | 
| 1466 1472 | 
             
                  refute_nil(methods)
         | 
| 1467 1473 |  | 
| 1468 | 
            -
                  entry =  | 
| 1474 | 
            +
                  entry = methods.first #: as Entry::MethodAlias
         | 
| 1469 1475 | 
             
                  assert_kind_of(Entry::MethodAlias, entry)
         | 
| 1470 1476 |  | 
| 1471 | 
            -
                  target = entry.target
         | 
| 1477 | 
            +
                  target = entry.target #: as Entry::MethodAlias
         | 
| 1472 1478 | 
             
                  assert_equal("double_alias", target.name)
         | 
| 1473 1479 | 
             
                  assert_kind_of(Entry::MethodAlias, target)
         | 
| 1474 | 
            -
                  assert_equal("Foo",  | 
| 1480 | 
            +
                  assert_equal("Foo", target.owner&.name)
         | 
| 1475 1481 |  | 
| 1476 1482 | 
             
                  final_target = target.target
         | 
| 1477 1483 | 
             
                  assert_equal("bar", final_target.name)
         | 
| 1478 1484 | 
             
                  assert_kind_of(Entry::Method, final_target)
         | 
| 1479 | 
            -
                  assert_equal("Foo",  | 
| 1485 | 
            +
                  assert_equal("Foo", final_target.owner&.name)
         | 
| 1480 1486 | 
             
                end
         | 
| 1481 1487 |  | 
| 1482 1488 | 
             
                def test_resolving_circular_method_aliases
         | 
| @@ -1490,7 +1496,7 @@ module RubyIndexer | |
| 1490 1496 | 
             
                  methods = @index.resolve_method("bar", "Foo")
         | 
| 1491 1497 | 
             
                  assert_nil(methods)
         | 
| 1492 1498 |  | 
| 1493 | 
            -
                  entry =  | 
| 1499 | 
            +
                  entry = @index["bar"]&.first
         | 
| 1494 1500 | 
             
                  assert_kind_of(Entry::UnresolvedMethodAlias, entry)
         | 
| 1495 1501 | 
             
                end
         | 
| 1496 1502 |  | 
| @@ -1505,7 +1511,7 @@ module RubyIndexer | |
| 1505 1511 | 
             
                  methods = @index.resolve_method("bar", "Foo")
         | 
| 1506 1512 | 
             
                  assert_nil(methods)
         | 
| 1507 1513 |  | 
| 1508 | 
            -
                  entry =  | 
| 1514 | 
            +
                  entry = @index["bar"]&.first
         | 
| 1509 1515 | 
             
                  assert_kind_of(Entry::UnresolvedMethodAlias, entry)
         | 
| 1510 1516 | 
             
                end
         | 
| 1511 1517 |  | 
| @@ -1521,18 +1527,18 @@ module RubyIndexer | |
| 1521 1527 | 
             
                    end
         | 
| 1522 1528 | 
             
                  RUBY
         | 
| 1523 1529 |  | 
| 1524 | 
            -
                  methods = @index.resolve_method("decorated_name", "Foo")
         | 
| 1530 | 
            +
                  methods = @index.resolve_method("decorated_name", "Foo") #: as !nil
         | 
| 1525 1531 | 
             
                  refute_nil(methods)
         | 
| 1526 1532 |  | 
| 1527 | 
            -
                  entry =  | 
| 1533 | 
            +
                  entry = methods.first #: as Entry::MethodAlias
         | 
| 1528 1534 | 
             
                  assert_kind_of(Entry::MethodAlias, entry)
         | 
| 1529 1535 |  | 
| 1530 1536 | 
             
                  target = entry.target
         | 
| 1531 1537 | 
             
                  assert_equal("name", target.name)
         | 
| 1532 1538 | 
             
                  assert_kind_of(Entry::Accessor, target)
         | 
| 1533 | 
            -
                  assert_equal("Foo",  | 
| 1539 | 
            +
                  assert_equal("Foo", target.owner&.name)
         | 
| 1534 1540 |  | 
| 1535 | 
            -
                  other_decorated_name =  | 
| 1541 | 
            +
                  other_decorated_name = @index["decorated_name"]&.find { |e| e.is_a?(Entry::UnresolvedMethodAlias) }
         | 
| 1536 1542 | 
             
                  assert_kind_of(Entry::UnresolvedMethodAlias, other_decorated_name)
         | 
| 1537 1543 | 
             
                end
         | 
| 1538 1544 |  | 
| @@ -1557,7 +1563,7 @@ module RubyIndexer | |
| 1557 1563 | 
             
                    end
         | 
| 1558 1564 | 
             
                  RUBY
         | 
| 1559 1565 |  | 
| 1560 | 
            -
                  entry =  | 
| 1566 | 
            +
                  entry = @index.first_unqualified_const("Bar")&.first #: as !nil
         | 
| 1561 1567 | 
             
                  assert_equal("Foo::Bar", entry.name)
         | 
| 1562 1568 | 
             
                end
         | 
| 1563 1569 |  | 
| @@ -1574,7 +1580,7 @@ module RubyIndexer | |
| 1574 1580 | 
             
                    end
         | 
| 1575 1581 | 
             
                  RUBY
         | 
| 1576 1582 |  | 
| 1577 | 
            -
                  entry =  | 
| 1583 | 
            +
                  entry = @index.first_unqualified_const("Type")&.first #: as !nil
         | 
| 1578 1584 | 
             
                  assert_equal("Namespace::Type", entry.name)
         | 
| 1579 1585 | 
             
                end
         | 
| 1580 1586 |  | 
| @@ -1591,7 +1597,7 @@ module RubyIndexer | |
| 1591 1597 |  | 
| 1592 1598 | 
             
                  entries = @index.method_completion_candidates("bar", "Baz")
         | 
| 1593 1599 | 
             
                  assert_equal(["bar"], entries.map(&:name))
         | 
| 1594 | 
            -
                  assert_equal("Baz",  | 
| 1600 | 
            +
                  assert_equal("Baz", entries.first&.owner&.name)
         | 
| 1595 1601 | 
             
                end
         | 
| 1596 1602 |  | 
| 1597 1603 | 
             
                def test_completion_does_not_duplicate_methods_overridden_by_aliases
         | 
| @@ -1607,7 +1613,7 @@ module RubyIndexer | |
| 1607 1613 |  | 
| 1608 1614 | 
             
                  entries = @index.method_completion_candidates("bar", "Baz")
         | 
| 1609 1615 | 
             
                  assert_equal(["bar"], entries.map(&:name))
         | 
| 1610 | 
            -
                  assert_equal("Baz",  | 
| 1616 | 
            +
                  assert_equal("Baz", entries.first&.owner&.name)
         | 
| 1611 1617 | 
             
                end
         | 
| 1612 1618 |  | 
| 1613 1619 | 
             
                def test_decorated_parameters
         | 
| @@ -1618,11 +1624,10 @@ module RubyIndexer | |
| 1618 1624 | 
             
                    end
         | 
| 1619 1625 | 
             
                  RUBY
         | 
| 1620 1626 |  | 
| 1621 | 
            -
                  methods = @index.resolve_method("bar", "Foo")
         | 
| 1627 | 
            +
                  methods = @index.resolve_method("bar", "Foo") #: as !nil
         | 
| 1622 1628 | 
             
                  refute_nil(methods)
         | 
| 1623 1629 |  | 
| 1624 | 
            -
                  entry =  | 
| 1625 | 
            -
             | 
| 1630 | 
            +
                  entry = methods.first #: as Entry::Method
         | 
| 1626 1631 | 
             
                  assert_equal("(a, b = <default>, c: <default>)", entry.decorated_parameters)
         | 
| 1627 1632 | 
             
                end
         | 
| 1628 1633 |  | 
| @@ -1634,11 +1639,10 @@ module RubyIndexer | |
| 1634 1639 | 
             
                    end
         | 
| 1635 1640 | 
             
                  RUBY
         | 
| 1636 1641 |  | 
| 1637 | 
            -
                  methods = @index.resolve_method("bar", "Foo")
         | 
| 1642 | 
            +
                  methods = @index.resolve_method("bar", "Foo") #: as !nil
         | 
| 1638 1643 | 
             
                  refute_nil(methods)
         | 
| 1639 1644 |  | 
| 1640 | 
            -
                  entry =  | 
| 1641 | 
            -
             | 
| 1645 | 
            +
                  entry = methods.first #: as Entry::Method
         | 
| 1642 1646 | 
             
                  assert_equal("()", entry.decorated_parameters)
         | 
| 1643 1647 | 
             
                end
         | 
| 1644 1648 |  | 
| @@ -1707,9 +1711,9 @@ module RubyIndexer | |
| 1707 1711 | 
             
                  RUBY
         | 
| 1708 1712 |  | 
| 1709 1713 | 
             
                  ["bar", "baz"].product(["Foo", "Foo::<Class:Foo>"]).each do |method, receiver|
         | 
| 1710 | 
            -
                    entry = @index.resolve_method(method, receiver)&.first
         | 
| 1714 | 
            +
                    entry = @index.resolve_method(method, receiver)&.first #: as !nil
         | 
| 1711 1715 | 
             
                    refute_nil(entry)
         | 
| 1712 | 
            -
                    assert_equal(method,  | 
| 1716 | 
            +
                    assert_equal(method, entry.name)
         | 
| 1713 1717 | 
             
                  end
         | 
| 1714 1718 |  | 
| 1715 1719 | 
             
                  assert_equal(
         | 
| @@ -1888,7 +1892,7 @@ module RubyIndexer | |
| 1888 1892 | 
             
                    end
         | 
| 1889 1893 | 
             
                  RUBY
         | 
| 1890 1894 |  | 
| 1891 | 
            -
                  method = @index.resolve_method("==", "Foo") | 
| 1895 | 
            +
                  method = @index.resolve_method("==", "Foo")&.first #: as Entry::Method
         | 
| 1892 1896 | 
             
                  assert_kind_of(Entry::Method, method)
         | 
| 1893 1897 | 
             
                  assert_equal("==", method.name)
         | 
| 1894 1898 |  | 
| @@ -1906,13 +1910,13 @@ module RubyIndexer | |
| 1906 1910 | 
             
                    end
         | 
| 1907 1911 | 
             
                  RUBY
         | 
| 1908 1912 |  | 
| 1909 | 
            -
                  entries = @index.entries_for("file:///fake/path/foo.rb", Entry)
         | 
| 1913 | 
            +
                  entries = @index.entries_for("file:///fake/path/foo.rb", Entry) #: as !nil
         | 
| 1910 1914 | 
             
                  assert_equal(["Foo", "Bar", "my_def", "Bar::<Class:Bar>", "my_singleton_def"], entries.map(&:name))
         | 
| 1911 1915 |  | 
| 1912 | 
            -
                  entries = @index.entries_for("file:///fake/path/foo.rb", RubyIndexer::Entry::Namespace)
         | 
| 1916 | 
            +
                  entries = @index.entries_for("file:///fake/path/foo.rb", RubyIndexer::Entry::Namespace) #: as !nil
         | 
| 1913 1917 | 
             
                  assert_equal(["Foo", "Bar", "Bar::<Class:Bar>"], entries.map(&:name))
         | 
| 1914 1918 |  | 
| 1915 | 
            -
                  entries = @index.entries_for("file:///fake/path/foo.rb")
         | 
| 1919 | 
            +
                  entries = @index.entries_for("file:///fake/path/foo.rb") #: as !nil
         | 
| 1916 1920 | 
             
                  assert_equal(["Foo", "Bar", "my_def", "Bar::<Class:Bar>", "my_singleton_def"], entries.map(&:name))
         | 
| 1917 1921 | 
             
                end
         | 
| 1918 1922 |  | 
| @@ -1945,14 +1949,14 @@ module RubyIndexer | |
| 1945 1949 | 
             
                  result = @index.constant_completion_candidates("X", ["Namespace", "Baz"])
         | 
| 1946 1950 |  | 
| 1947 1951 | 
             
                  result.each do |entries|
         | 
| 1948 | 
            -
                    name = entries.first | 
| 1952 | 
            +
                    name = entries.first&.name
         | 
| 1949 1953 | 
             
                    assert(entries.all? { |e| e.name == name })
         | 
| 1950 1954 | 
             
                  end
         | 
| 1951 1955 |  | 
| 1952 | 
            -
                  assert_equal(["Namespace::XQRK", "Bar::XQRK", "XQRK"], result.map { |entries| entries.first | 
| 1956 | 
            +
                  assert_equal(["Namespace::XQRK", "Bar::XQRK", "XQRK"], result.map { |entries| entries.first&.name })
         | 
| 1953 1957 |  | 
| 1954 1958 | 
             
                  result = @index.constant_completion_candidates("::X", ["Namespace", "Baz"])
         | 
| 1955 | 
            -
                  assert_equal(["XQRK"], result.map { |entries| entries.first | 
| 1959 | 
            +
                  assert_equal(["XQRK"], result.map { |entries| entries.first&.name })
         | 
| 1956 1960 | 
             
                end
         | 
| 1957 1961 |  | 
| 1958 1962 | 
             
                def test_constant_completion_candidates_for_empty_name
         | 
| @@ -1967,7 +1971,7 @@ module RubyIndexer | |
| 1967 1971 | 
             
                  RUBY
         | 
| 1968 1972 |  | 
| 1969 1973 | 
             
                  result = @index.constant_completion_candidates("Baz::", [])
         | 
| 1970 | 
            -
                  assert_includes(result.map { |entries| entries.first | 
| 1974 | 
            +
                  assert_includes(result.map { |entries| entries.first&.name }, "Foo::Bar")
         | 
| 1971 1975 | 
             
                end
         | 
| 1972 1976 |  | 
| 1973 1977 | 
             
                def test_follow_alias_namespace
         | 
| @@ -2025,7 +2029,7 @@ module RubyIndexer | |
| 2025 2029 | 
             
                    end
         | 
| 2026 2030 | 
             
                  RUBY
         | 
| 2027 2031 |  | 
| 2028 | 
            -
                  entry = @index.resolve("Namespace::Foo::CONST", ["First", "Namespace", "Foo", "InnerNamespace"])&.first
         | 
| 2032 | 
            +
                  entry = @index.resolve("Namespace::Foo::CONST", ["First", "Namespace", "Foo", "InnerNamespace"])&.first #: as !nil
         | 
| 2029 2033 | 
             
                  assert_equal("Parent::CONST", entry.name)
         | 
| 2030 2034 | 
             
                  assert_instance_of(Entry::Constant, entry)
         | 
| 2031 2035 | 
             
                end
         | 
| @@ -2093,7 +2097,7 @@ module RubyIndexer | |
| 2093 2097 | 
             
                    end
         | 
| 2094 2098 | 
             
                  RUBY
         | 
| 2095 2099 |  | 
| 2096 | 
            -
                  entry = @index["Foo"]&.first
         | 
| 2100 | 
            +
                  entry = @index["Foo"]&.first #: as !nil
         | 
| 2097 2101 | 
             
                  refute_nil(entry, "Expected indexer to be able to handle unsaved URIs")
         | 
| 2098 2102 | 
             
                  assert_equal("untitled:Untitled-1", entry.uri.to_s)
         | 
| 2099 2103 | 
             
                  assert_equal("Untitled-1", entry.file_name)
         | 
| @@ -2105,7 +2109,7 @@ module RubyIndexer | |
| 2105 2109 | 
             
                    end
         | 
| 2106 2110 | 
             
                  RUBY
         | 
| 2107 2111 |  | 
| 2108 | 
            -
                  entry = @index["Foo"]&.first
         | 
| 2112 | 
            +
                  entry = @index["Foo"]&.first #: as !nil
         | 
| 2109 2113 | 
             
                  refute_nil(entry, "Expected indexer to be able to handle unsaved URIs")
         | 
| 2110 2114 | 
             
                  assert_equal("I added this comment!", entry.comments)
         | 
| 2111 2115 | 
             
                end
         | 
| @@ -2124,13 +2128,13 @@ module RubyIndexer | |
| 2124 2128 | 
             
                    end
         | 
| 2125 2129 | 
             
                  RUBY
         | 
| 2126 2130 |  | 
| 2127 | 
            -
                   | 
| 2131 | 
            +
                  adf, abc = @index.instance_variable_completion_candidates("@", "Child::<Class:Child>")
         | 
| 2128 2132 |  | 
| 2129 2133 | 
             
                  refute_nil(abc)
         | 
| 2130 2134 | 
             
                  refute_nil(adf)
         | 
| 2131 2135 |  | 
| 2132 | 
            -
                  assert_equal("@@abc", abc | 
| 2133 | 
            -
                  assert_equal("@@adf", adf | 
| 2136 | 
            +
                  assert_equal("@@abc", abc&.name)
         | 
| 2137 | 
            +
                  assert_equal("@@adf", adf&.name)
         | 
| 2134 2138 | 
             
                end
         | 
| 2135 2139 |  | 
| 2136 2140 | 
             
                def test_class_variable_completion_from_singleton_context
         | 
| @@ -2156,7 +2160,7 @@ module RubyIndexer | |
| 2156 2160 | 
             
                    end
         | 
| 2157 2161 | 
             
                  RUBY
         | 
| 2158 2162 |  | 
| 2159 | 
            -
                  candidates = @index.resolve_class_variable("@@hello", "Foo::<Class:Foo>")
         | 
| 2163 | 
            +
                  candidates = @index.resolve_class_variable("@@hello", "Foo::<Class:Foo>") #: as !nil
         | 
| 2160 2164 | 
             
                  refute_empty(candidates)
         | 
| 2161 2165 |  | 
| 2162 2166 | 
             
                  assert_equal("@@hello", candidates.first&.name)
         |