Module: RuboCop::Server Private
Overview
The bootstrap module for server.
Constant Summary
-
IN_PROCESS_PROTOCOL_OPTIONS =
# File 'lib/rubocop/server.rb', line 23
Options that start a long-lived protocol server on stdio in the current process. They must never be forwarded to the server process, which would run them as a lint request and silently produce no protocol response.
%w[--lsp --mcp].freeze
-
TIMEOUT =
# File 'lib/rubocop/server.rb', line 1820
Class Attribute Summary
- .running? ⇒ Boolean readonly Internal use only
- .support_server? ⇒ Boolean readonly Internal use only
Class Method Summary
-
.forward_to_server?(argv = ARGV) ⇒ Boolean
Internal use only
Whether the invocation should be forwarded to the running server process.
- .wait_for_running_status!(expected) Internal use only
Class Attribute Details
.running? ⇒ Boolean (readonly)
# File 'lib/rubocop/server.rb', line 38
def running? return false unless support_server? # Never running. Cache.pid_running? end
.support_server? ⇒ Boolean (readonly)
Class Method Details
.forward_to_server?(argv = ARGV) ⇒ Boolean
Whether the invocation should be forwarded to the running server process.
--lsp and --mcp always run in the current process even when the server is running:
they serve a protocol on stdio, which the server’s exec command cannot do.
# File 'lib/rubocop/server.rb', line 47
def forward_to_server?(argv = ARGV) return false unless running? (IN_PROCESS_PROTOCOL_OPTIONS & argv).empty? end