Class: Solargraph::LanguageServer::Message::Workspace::DidChangeWatchedFiles
- Inherits:
-
Base
- Object
- Base
- Solargraph::LanguageServer::Message::Workspace::DidChangeWatchedFiles
- Includes:
- UriHelpers
- Defined in:
- lib/solargraph/language_server/message/workspace/did_change_watched_files.rb
Constant Summary collapse
- CREATED =
1
- CHANGED =
2
- DELETED =
3
Instance Attribute Summary
Attributes inherited from Base
#error, #host, #id, #method, #params, #request, #result
Instance Method Summary collapse
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
#process ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/solargraph/language_server/message/workspace/did_change_watched_files.rb', line 11 def process need_catalog = false to_create = [] to_delete = [] # @param change [Hash] params['changes'].each do |change| if change['type'] == CREATED to_create << change['uri'] need_catalog = true elsif change['type'] == CHANGED next if host.open?(change['uri']) to_create << change['uri'] need_catalog = true elsif change['type'] == DELETED to_delete << change['uri'] need_catalog = true else set_error Solargraph::LanguageServer::ErrorCodes::INVALID_PARAMS, "Unknown change type ##{change['type']} for #{uri_to_file(change['uri'])}" end end host.create *to_create host.delete *to_delete # Force host to catalog libraries after file changes (see castwide/solargraph#139) host.catalog if need_catalog end |