class TypeProf::LSP::Server
Attributes
              open_texts[R]
            
            
              root_uri[RW]
            
            
              running_requests_from_client[R]
            
            
              signature_enabled[RW]
            
            
              sigs[R]
            
            
              typeprof_config[R]
            
            Public Class Methods
                              new(config, reader, writer)
                              click to toggle source
                            
                            # File typeprof-0.21.9/lib/typeprof/lsp.rb, line 843 def initialize(config, reader, writer) @typeprof_config = config @reader = reader @writer = writer @tx_mutex = Mutex.new @request_id = 0 @running_requests_from_client = {} @running_requests_from_server = {} @open_texts = {} @sigs = {} # tmp @signature_enabled = true end
Public Instance Methods
                              exclusive_write(**json)
                              click to toggle source
                            
                            # File typeprof-0.21.9/lib/typeprof/lsp.rb, line 903 def exclusive_write(**json) @tx_mutex.synchronize do @writer.write(**json) end end
                              run()
                              click to toggle source
                            
                            # File typeprof-0.21.9/lib/typeprof/lsp.rb, line 859 def run @reader.read do |json| if json[:method] # request or notification msg = Message.find(json[:method]).new(self, json) @running_requests_from_client[json[:id]] = msg if json[:id] msg.run else callback = @running_requests_from_server.delete(json[:id]) callback&.call(json[:params]) end end rescue Exit rescue => e msg = "Tyeprof fatal error: #{e.message}" send_notification( 'window/showMessage', type: MessageType::Error, message: msg ) send_notification( 'window/logMessage', type: MessageType::Error, message: "#{msg} Backtrace: #{e.backtrace}" ) send_notification('typeprof.showErrorStatus') retry end
                              send_notification(method, params = nil)
                              click to toggle source
                            
                            # File typeprof-0.21.9/lib/typeprof/lsp.rb, line 893 def send_notification(method, params = nil) exclusive_write(method: method, params: params) end
                              send_request(method, **params, &blk)
                              click to toggle source
                            
                            # File typeprof-0.21.9/lib/typeprof/lsp.rb, line 897 def send_request(method, **params, &blk) id = @request_id += 1 @running_requests_from_server[id] = blk exclusive_write(id: id, method: method, params: params) end
                              send_response(**msg)
                              click to toggle source
                            
                            # File typeprof-0.21.9/lib/typeprof/lsp.rb, line 888 def send_response(**msg) @running_requests_from_client.delete(msg[:id]) exclusive_write(**msg) end