Class: RubyLsp::Requests::BaseRequest
- Inherits:
-
SyntaxTree::Visitor
- Object
- SyntaxTree::Visitor
- RubyLsp::Requests::BaseRequest
- Defined in:
- lib/ruby_lsp/requests/base_request.rb
Overview
:nodoc:
Direct Known Subclasses
DocumentHighlight, DocumentSymbol, FoldingRanges, SelectionRanges, SemanticHighlighting
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(document) ⇒ BaseRequest
constructor
A new instance of BaseRequest.
- #range_from_syntax_tree_node(node) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(document) ⇒ BaseRequest
Returns a new instance of BaseRequest.
12 13 14 15 16 |
# File 'lib/ruby_lsp/requests/base_request.rb', line 12 def initialize(document) @document = document super() end |
Class Method Details
.run(document) ⇒ Object
8 9 10 |
# File 'lib/ruby_lsp/requests/base_request.rb', line 8 def self.run(document) new(document).run end |
Instance Method Details
#range_from_syntax_tree_node(node) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/ruby_lsp/requests/base_request.rb', line 22 def range_from_syntax_tree_node(node) loc = node.location LanguageServer::Protocol::Interface::Range.new( start: LanguageServer::Protocol::Interface::Position.new(line: loc.start_line - 1, character: loc.start_column), end: LanguageServer::Protocol::Interface::Position.new(line: loc.end_line - 1, character: loc.end_column), ) end |
#run ⇒ Object
18 19 20 |
# File 'lib/ruby_lsp/requests/base_request.rb', line 18 def run raise NotImplementedError, "#{self.class}#run must be implemented" end |