Class: SyntaxTree::LanguageServer::InlayHints

Inherits:
Visitor show all
Defined in:
lib/syntax_tree/language_server.rb

Overview

This class provides inlay hints for the language server. For more information, see the spec here: github.com/microsoft/language-server-protocol/issues/956.

Defined Under Namespace

Classes: Hint

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BasicVisitor

valid_visit_methods, #visit_all, #visit_child_nodes, visit_method, visit_methods

Constructor Details

#initializeInlayHints

Returns a new instance of InlayHints.



43
44
45
46
# File 'lib/syntax_tree/language_server.rb', line 43

def initialize
  @stack = []
  @hints = []
end

Instance Attribute Details

#hintsObject (readonly)

Returns the value of attribute hints.



41
42
43
# File 'lib/syntax_tree/language_server.rb', line 41

def hints
  @hints
end

#stackObject (readonly)

Returns the value of attribute stack.



41
42
43
# File 'lib/syntax_tree/language_server.rb', line 41

def stack
  @stack
end

Instance Method Details

#visit(node) ⇒ Object



48
49
50
51
52
53
# File 'lib/syntax_tree/language_server.rb', line 48

def visit(node)
  stack << node
  result = super
  stack.pop
  result
end