Class: RubyLsp::Standard::WrapsBuiltinLspStandardizer

Inherits:
Object
  • Object
show all
Includes:
Requests::Support::Formatter
Defined in:
lib/ruby_lsp/standard/wraps_built_in_lsp_standardizer.rb

Instance Method Summary collapse

Constructor Details

#initializeWrapsBuiltinLspStandardizer

Returns a new instance of WrapsBuiltinLspStandardizer.



5
6
7
# File 'lib/ruby_lsp/standard/wraps_built_in_lsp_standardizer.rb', line 5

def initialize
  init!
end

Instance Method Details

#init!Object



9
10
11
12
13
# File 'lib/ruby_lsp/standard/wraps_built_in_lsp_standardizer.rb', line 9

def init!
  @standardizer = ::Standard::Lsp::Standardizer.new(
    ::Standard::BuildsConfig.new.call([])
  )
end

#run_diagnostic(uri, document) ⇒ Object



19
20
21
# File 'lib/ruby_lsp/standard/wraps_built_in_lsp_standardizer.rb', line 19

def run_diagnostic(uri, document)
  @standardizer.offenses(uri_to_path(uri), document.source, document.encoding)
end

#run_formatting(uri, document) ⇒ Object



15
16
17
# File 'lib/ruby_lsp/standard/wraps_built_in_lsp_standardizer.rb', line 15

def run_formatting(uri, document)
  @standardizer.format(uri_to_path(uri), document.source)
end

#run_range_formatting(_uri, _partial_source, _base_indentation) ⇒ Object



23
24
25
26
27
28
# File 'lib/ruby_lsp/standard/wraps_built_in_lsp_standardizer.rb', line 23

def run_range_formatting(_uri, _partial_source, _base_indentation)
  # Not yet supported. Should return the formatted version of `partial_source` which is a partial selection of the
  # entire document. For example, it should not try to add a frozen_string_literal magic comment and all style
  # corrections should start from the `base_indentation`
  nil
end