Skip to content

Commit

Permalink
Migrate inlay hint
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock authored and andyw8 committed Aug 15, 2023
1 parent 183ef0a commit cbd8ace
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 4 deletions.
1 change: 0 additions & 1 deletion lib/ruby_lsp/executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions lib/ruby_lsp/requests/inlay_hints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
125 changes: 125 additions & 0 deletions sorbet/rbi/shims/yarp.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cbd8ace

Please sign in to comment.