Class: RubyLsp::RBSDocument
- Extended by:
- T::Generic, T::Sig
- Defined in:
- lib/ruby_lsp/rbs_document.rb
Constant Summary collapse
- ParseResultType =
type_member { { fixed: T::Array[RBS::AST::Declarations::Base] } }
Instance Attribute Summary
Attributes inherited from Document
#encoding, #parse_result, #source, #uri, #version
Instance Method Summary collapse
-
#initialize(source:, version:, uri:, encoding: Encoding::UTF_8) ⇒ RBSDocument
constructor
A new instance of RBSDocument.
- #language_id ⇒ Object
- #parse ⇒ Object
- #syntax_error? ⇒ Boolean
Methods inherited from Document
#==, #cache_fetch, #cache_get, #cache_set, #create_scanner, #push_edits
Constructor Details
#initialize(source:, version:, uri:, encoding: Encoding::UTF_8) ⇒ RBSDocument
Returns a new instance of RBSDocument.
12 13 14 15 |
# File 'lib/ruby_lsp/rbs_document.rb', line 12 def initialize(source:, version:, uri:, encoding: Encoding::UTF_8) @syntax_error = T.let(false, T::Boolean) super end |
Instance Method Details
#language_id ⇒ Object
37 38 39 |
# File 'lib/ruby_lsp/rbs_document.rb', line 37 def language_id LanguageId::RBS end |
#parse ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruby_lsp/rbs_document.rb', line 18 def parse return @parse_result unless @needs_parsing @needs_parsing = false _, _, declarations = RBS::Parser.parse_signature(@source) @syntax_error = false @parse_result = declarations rescue RBS::ParsingError @syntax_error = true @parse_result end |
#syntax_error? ⇒ Boolean
32 33 34 |
# File 'lib/ruby_lsp/rbs_document.rb', line 32 def syntax_error? @syntax_error end |