lib/ruby_lsp/requests/base_request.rb in ruby-lsp-0.0.4 vs lib/ruby_lsp/requests/base_request.rb in ruby-lsp-0.1.0
- old
+ new
@@ -1,25 +1,27 @@
-# typed: true
+# typed: strict
# frozen_string_literal: true
module RubyLsp
module Requests
# :nodoc:
class BaseRequest < SyntaxTree::Visitor
- def self.run(document)
- new(document).run
- end
+ extend T::Sig
+ extend T::Helpers
+ abstract!
+
+ sig { params(document: Document).void }
def initialize(document)
@document = document
super()
end
- def run
- raise NotImplementedError, "#{self.class}#run must be implemented"
- end
+ sig { abstract.returns(Object) }
+ def run; end
+ sig { params(node: SyntaxTree::Node).returns(LanguageServer::Protocol::Interface::Range) }
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,