From 1df800cd0617d38a1f7d26d4bc9f42b9cb4d47c2 Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Thu, 20 Jun 2024 14:23:09 -0400 Subject: [PATCH] Address PR feedback --- DESIGN_AND_ROADMAP.md | 2 +- lib/ruby_lsp/listeners/hover.rb | 3 +-- lib/ruby_lsp/listeners/signature_help.rb | 3 +-- lib/ruby_lsp/requests/completion_resolve.rb | 3 +-- lib/ruby_lsp/utils.rb | 1 + 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/DESIGN_AND_ROADMAP.md b/DESIGN_AND_ROADMAP.md index b4bc4e3eb..4e6d36630 100644 --- a/DESIGN_AND_ROADMAP.md +++ b/DESIGN_AND_ROADMAP.md @@ -221,7 +221,7 @@ Interested in contributing? Check out the issues tagged with [help-wanted] or [g ## Guessed types -Guessed types is an experimental features where the Ruby LSP attempts to identify the type of a receiver based on its +Guessed types is an experimental feature where the Ruby LSP attempts to identify the type of a receiver based on its identifier name. For example: ```ruby diff --git a/lib/ruby_lsp/listeners/hover.rb b/lib/ruby_lsp/listeners/hover.rb index 56b6c2fe1..8997e8b16 100644 --- a/lib/ruby_lsp/listeners/hover.rb +++ b/lib/ruby_lsp/listeners/hover.rb @@ -116,8 +116,7 @@ def on_call_node_enter(node) if type.is_a?(TypeInferrer::GuessedType) title << " | guessed receiver: #{type.name}" - link = "https://github.com/Shopify/ruby-lsp/blob/main/DESIGN_AND_ROADMAP.md#guessed-types" - @response_builder.push("[Learn more about guessed types](#{link})\n", category: :links) + @response_builder.push("[Learn more about guessed types](#{GUESSED_TYPES_URL})\n", category: :links) end categorized_markdown_from_index_entries(title, methods).each do |category, content| diff --git a/lib/ruby_lsp/listeners/signature_help.rb b/lib/ruby_lsp/listeners/signature_help.rb index e2538f979..4c2304c48 100644 --- a/lib/ruby_lsp/listeners/signature_help.rb +++ b/lib/ruby_lsp/listeners/signature_help.rb @@ -65,8 +65,7 @@ def on_call_node_enter(node) extra_links = if type.is_a?(TypeInferrer::GuessedType) title << "guessed receiver: #{type.name}" - link = "https://github.com/Shopify/ruby-lsp/blob/main/DESIGN_AND_ROADMAP.md#guessed-types" - "[Learn more about guessed types](#{link})" + "[Learn more about guessed types](#{GUESSED_TYPES_URL})" end signature_help = Interface::SignatureHelp.new( diff --git a/lib/ruby_lsp/requests/completion_resolve.rb b/lib/ruby_lsp/requests/completion_resolve.rb index f273e4d6a..dec13709a 100644 --- a/lib/ruby_lsp/requests/completion_resolve.rb +++ b/lib/ruby_lsp/requests/completion_resolve.rb @@ -65,8 +65,7 @@ def perform extra_links = if @item.dig(:data, :guessed_type) label << " | guessed receiver: #{owner_name}" - link = "https://github.com/Shopify/ruby-lsp/blob/main/DESIGN_AND_ROADMAP.md#guessed-types" - "[Learn more about guessed types](#{link})" + "[Learn more about guessed types](#{GUESSED_TYPES_URL})" end @item[:labelDetails] = Interface::CompletionItemLabelDetails.new( diff --git a/lib/ruby_lsp/utils.rb b/lib/ruby_lsp/utils.rb index 8fb6758f1..ecdeea048 100644 --- a/lib/ruby_lsp/utils.rb +++ b/lib/ruby_lsp/utils.rb @@ -25,6 +25,7 @@ module RubyLsp end, String, ) + GUESSED_TYPES_URL = "https://github.com/Shopify/ruby-lsp/blob/main/DESIGN_AND_ROADMAP.md#guessed-types" # A notification to be sent to the client class Message