Class: Solargraph::LanguageServer::Message::TextDocument::OnTypeFormatting

Inherits:
Base
  • Object
show all
Defined in:
lib/solargraph/language_server/message/text_document/on_type_formatting.rb

Instance Attribute Summary

Attributes inherited from Base

#filename

Attributes inherited from Base

#error, #host, #id, #method, #params, #request, #result

Instance Method Summary collapse

Methods inherited from Base

#post_initialize

Methods included from UriHelpers

decode, encode, file_to_uri, uri_to_file

Methods inherited from Base

#initialize, #post_initialize, #send_response, #set_error, #set_result

Constructor Details

This class inherits a constructor from Solargraph::LanguageServer::Message::Base

Instance Method Details

#processObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/solargraph/language_server/message/text_document/on_type_formatting.rb', line 8

def process
  # @todo Temporarily disabled due to conflicts with VSCode formatting on type
  # src = host.send(:library).checkout(uri_to_file(params['textDocument']['uri']))
  # fragment = src.fragment_at(params['position']['line'], params['position']['character'] - 1)
  # offset = fragment.send(:offset)
  # if fragment.string? and params['ch'] == '{' and src.code[offset - 1, 2] == '#{'
  #   set_result(
  #     [
  #       {
  #         range: {
  #           start: params['position'],
  #           end: params['position']
  #         },
  #         newText: '}'
  #       }
  #     ]
  #   )
  # else
  #   # @todo Is `nil` or `[]` more appropriate here?
  #   set_result nil
  # end
end