From cbd8ace969afb9b8c6d1cc41b8311d3e5c9437e1 Mon Sep 17 00:00:00 2001 From: Vinicius Stock Date: Thu, 13 Jul 2023 15:03:50 -0600 Subject: [PATCH] Migrate inlay hint --- lib/ruby_lsp/executor.rb | 1 - lib/ruby_lsp/requests/inlay_hints.rb | 5 +- sorbet/rbi/shims/yarp.rbi | 125 +++++++++++++++++++++++++++ 3 files changed, 127 insertions(+), 4 deletions(-) diff --git a/lib/ruby_lsp/executor.rb b/lib/ruby_lsp/executor.rb index 42a0ec15c..4718bdf4b 100644 --- a/lib/ruby_lsp/executor.rb +++ b/lib/ruby_lsp/executor.rb @@ -309,7 +309,6 @@ def document_highlight(uri, position) sig { params(uri: URI::Generic, range: Document::RangeShape).returns(T.nilable(T::Array[Interface::InlayHint])) } def inlay_hint(uri, range) document = @store.get(uri) - return if document.syntax_error? start_line = range.dig(:start, :line) end_line = range.dig(:end, :line) diff --git a/lib/ruby_lsp/requests/inlay_hints.rb b/lib/ruby_lsp/requests/inlay_hints.rb index 752580899..6da77baa0 100644 --- a/lib/ruby_lsp/requests/inlay_hints.rb +++ b/lib/ruby_lsp/requests/inlay_hints.rb @@ -39,10 +39,9 @@ def initialize(range, emitter, message_queue) emitter.register(self, :on_rescue) end - sig { params(node: SyntaxTree::Rescue).void } + sig { params(node: YARP::RescueNode).void } def on_rescue(node) - exception = node.exception - return unless exception.nil? || exception.exceptions.nil? + return unless node.exceptions.empty? loc = node.location return unless visible?(node, @range) diff --git a/sorbet/rbi/shims/yarp.rbi b/sorbet/rbi/shims/yarp.rbi index e26ab34a9..bd1554adc 100644 --- a/sorbet/rbi/shims/yarp.rbi +++ b/sorbet/rbi/shims/yarp.rbi @@ -57,4 +57,129 @@ module YARP sig { returns(ConstantPathNode) } def constant_path; end end +<<<<<<< HEAD +||||||| parent of 9e19894 (Migrate inlay hint) + + class DefNode + sig { returns(String) } + def name; end + + sig { returns(T.nilable(YARP::Node)) } + def receiver; end + + sig { returns(Location) } + def name_loc; end + end + + class CallNode + sig { returns(String) } + def name; end + + sig { returns(T.nilable(ArgumentsNode)) } + def arguments; end + + sig { returns(T.nilable(YARP::Node)) } + def receiver; end + end + + class ArgumentsNode + sig { returns(T::Array[YARP::Node]) } + def arguments; end + end + + class StringNode + sig { returns(String) } + def content; end + end + + class ConstantPathWriteNode + sig { returns(YARP::Node) } + def target; end + end + + class SymbolNode + sig { returns(String) } + def value; end + end + + class InstanceVariableWriteNode + sig { returns(String) } + def name; end + + sig { returns(Location) } + def name_loc; end + end + + class ClassVariableWriteNode + sig { returns(String) } + def name; end + + sig { returns(Location) } + def name_loc; end + end +======= + + class DefNode + sig { returns(String) } + def name; end + + sig { returns(T.nilable(YARP::Node)) } + def receiver; end + + sig { returns(Location) } + def name_loc; end + end + + class CallNode + sig { returns(String) } + def name; end + + sig { returns(T.nilable(ArgumentsNode)) } + def arguments; end + + sig { returns(T.nilable(YARP::Node)) } + def receiver; end + end + + class ArgumentsNode + sig { returns(T::Array[YARP::Node]) } + def arguments; end + end + + class StringNode + sig { returns(String) } + def content; end + end + + class ConstantPathWriteNode + sig { returns(YARP::Node) } + def target; end + end + + class SymbolNode + sig { returns(String) } + def value; end + end + + class InstanceVariableWriteNode + sig { returns(String) } + def name; end + + sig { returns(Location) } + def name_loc; end + end + + class ClassVariableWriteNode + sig { returns(String) } + def name; end + + sig { returns(Location) } + def name_loc; end + end + + class RescueNode + sig { returns(T::Array[YARP::Node]) } + def exceptions; end + end +>>>>>>> 9e19894 (Migrate inlay hint) end