From f881a7264941e4525b8fa7c672058a1c601ab55b Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Tue, 23 Jul 2024 17:08:31 -0400 Subject: [PATCH] WIP --- Rakefile | 6 ++++++ lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index f8bd96087..8df39bde5 100644 --- a/Rakefile +++ b/Rakefile @@ -11,6 +11,12 @@ Rake::TestTask.new(:test) do |t| t.test_files = FileList["test/**/*_test.rb", "lib/ruby_indexer/test/**/*_test.rb"].exclude("test/fixtures/prism/**/*") end +Rake::TestTask.new(:test_indexer) do |t| + t.libs << "test" + t.libs << "lib" + t.test_files = FileList["lib/ruby_indexer/test/**/*_test.rb"].exclude("test/fixtures/prism/**/*") +end + RDoc::Task.new do |rdoc| rdoc.main = "README.md" rdoc.title = "Ruby LSP documentation" diff --git a/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb b/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb index 930c4180e..a4aa572d7 100644 --- a/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb +++ b/lib/ruby_indexer/lib/ruby_indexer/declaration_listener.rb @@ -523,7 +523,7 @@ def add_constant(node, name, value = nil) sig { params(node: Prism::Node).returns(String) } def collect_comments(node) - comments = [] + comments = +"" start_line = node.location.start_line - 1 start_line -= 1 unless @comments_by_line.key?(start_line) @@ -541,10 +541,11 @@ def collect_comments(node) comment_content.delete_prefix!("#") comment_content.delete_prefix!(" ") - comments.prepend(comment_content) + comments.prepend("#{comment_content}\n") end - comments.join("\n") + comments.chomp! + comments end sig { params(name: String).returns(String) }