Class: RubyLsp::Requests::Support::HighlightTarget

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/ruby_lsp/requests/support/highlight_target.rb

Defined Under Namespace

Classes: HighlightMatch

Constant Summary collapse

READ =
LanguageServer::Protocol::Constant::DocumentHighlightKind::READ
WRITE =
LanguageServer::Protocol::Constant::DocumentHighlightKind::WRITE

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ HighlightTarget

Returns a new instance of HighlightTarget.



19
20
21
22
# File 'lib/ruby_lsp/requests/support/highlight_target.rb', line 19

def initialize(node)
  @node = node
  @value = T.let(value(node), T.nilable(String))
end

Instance Method Details

#highlight_type(other) ⇒ Object



25
26
27
# File 'lib/ruby_lsp/requests/support/highlight_target.rb', line 25

def highlight_type(other)
  matched_highlight(other) if other.is_a?(SyntaxTree::Params) || (@value && @value == value(other))
end