Class: Steep::Drivers::Langserver
- Includes:
- Utils::DriverHelper
- Defined in:
- lib/steep/drivers/langserver.rb
Instance Attribute Summary collapse
-
#jobs_option ⇒ Object
readonly
Returns the value of attribute jobs_option.
-
#refork ⇒ Object
Returns the value of attribute refork.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdin ⇒ Object
readonly
Returns the value of attribute stdin.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
-
#type_check_queue ⇒ Object
readonly
Returns the value of attribute type_check_queue.
-
#type_check_thread ⇒ Object
readonly
Returns the value of attribute type_check_thread.
-
#write_mutex ⇒ Object
readonly
Returns the value of attribute write_mutex.
Attributes included from Utils::DriverHelper
#disable_install_collection, #steepfile
Instance Method Summary collapse
-
#initialize(stdout:, stderr:, stdin:) ⇒ Langserver
constructor
A new instance of Langserver.
- #project ⇒ Object
- #reader ⇒ Object
- #run ⇒ Object
- #writer ⇒ Object
Methods included from Utils::DriverHelper
#install_collection, #keep_diagnostic?, #load_config, #request_id, #shutdown_exit, #wait_for_message, #wait_for_response_id
Constructor Details
#initialize(stdout:, stderr:, stdin:) ⇒ Langserver
Returns a new instance of Langserver.
15 16 17 18 19 20 21 22 23 |
# File 'lib/steep/drivers/langserver.rb', line 15 def initialize(stdout:, stderr:, stdin:) @stdout = stdout @stderr = stderr @stdin = stdin @write_mutex = Mutex.new @type_check_queue = Queue.new @jobs_option = Utils::JobsOption.new(jobs_count_modifier: -1) @refork = false end |
Instance Attribute Details
#jobs_option ⇒ Object (readonly)
Returns the value of attribute jobs_option.
10 11 12 |
# File 'lib/steep/drivers/langserver.rb', line 10 def jobs_option @jobs_option end |
#refork ⇒ Object
Returns the value of attribute refork.
11 12 13 |
# File 'lib/steep/drivers/langserver.rb', line 11 def refork @refork end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
5 6 7 |
# File 'lib/steep/drivers/langserver.rb', line 5 def stderr @stderr end |
#stdin ⇒ Object (readonly)
Returns the value of attribute stdin.
6 7 8 |
# File 'lib/steep/drivers/langserver.rb', line 6 def stdin @stdin end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
4 5 6 |
# File 'lib/steep/drivers/langserver.rb', line 4 def stdout @stdout end |
#type_check_queue ⇒ Object (readonly)
Returns the value of attribute type_check_queue.
8 9 10 |
# File 'lib/steep/drivers/langserver.rb', line 8 def type_check_queue @type_check_queue end |
#type_check_thread ⇒ Object (readonly)
Returns the value of attribute type_check_thread.
9 10 11 |
# File 'lib/steep/drivers/langserver.rb', line 9 def type_check_thread @type_check_thread end |
#write_mutex ⇒ Object (readonly)
Returns the value of attribute write_mutex.
7 8 9 |
# File 'lib/steep/drivers/langserver.rb', line 7 def write_mutex @write_mutex end |
Instance Method Details
#project ⇒ Object
33 34 35 |
# File 'lib/steep/drivers/langserver.rb', line 33 def project @project or raise "Empty #project" end |
#reader ⇒ Object
29 30 31 |
# File 'lib/steep/drivers/langserver.rb', line 29 def reader @reader ||= LanguageServer::Protocol::Transport::Io::Reader.new(stdin) end |
#run ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/steep/drivers/langserver.rb', line 37 def run @project = load_config() interaction_worker = Server::WorkerProcess.start_worker(:interaction, name: "interaction", steepfile: project.steepfile_path, steep_command: jobs_option.steep_command) typecheck_workers = Server::WorkerProcess.start_typecheck_workers(steepfile: project.steepfile_path, args: [], steep_command: jobs_option.steep_command, count: jobs_option.jobs_count_value) master = Server::Master.new( project: project, reader: reader, writer: writer, interaction_worker: interaction_worker, typecheck_workers: typecheck_workers, refork: refork, ) master.typecheck_automatically = true master.start() 0 end |
#writer ⇒ Object
25 26 27 |
# File 'lib/steep/drivers/langserver.rb', line 25 def writer @writer ||= LanguageServer::Protocol::Transport::Io::Writer.new(stdout) end |