Skip to content

Commit

Permalink
Remove RPC filesystem. (#1358)
Browse files Browse the repository at this point in the history
This was a protocol we used with Toit v1. The 'toit' executable would
proxy LSP calls to the LSP server and take over reading of the file
system. This was necessary, as the Toit LSP server wasn't yet able to
read files on Windows.
  • Loading branch information
floitsch authored Jan 23, 2023
1 parent a8dddfb commit 8d5aea4
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 360 deletions.
1 change: 0 additions & 1 deletion tests/lsp/fail.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUAL
tests/lsp/export_summary_compiler_test.toit
tests/lsp/incomplete_compiler_test.toit
tests/lsp/invalid_symbol_compiler_test.toit
tests/lsp/lsp_filesystem_compiler_test.toit
tests/lsp/lsp_ubjson_rpc_compiler_test.toit
tests/lsp/null_char_compiler_test.toit
tests/lsp/open_many_compiler_test.toit
Expand Down
4 changes: 0 additions & 4 deletions tests/lsp/lsp_client.toit
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ run_client_test
[test_fun]
--supports_config=true
--needs_server_args=(not supports_config)
--use_rpc_filesystem=false
--use_mock=false
--exit=true
--spawn_process=true
Expand All @@ -50,7 +49,6 @@ run_client_test
--toitlsp_exe=toitlsp_exe
--supports_config=supports_config
--needs_server_args=needs_server_args
--use_rpc_filesystem=use_rpc_filesystem
--spawn_process=spawn_process
--pre_initialize=: | client args |
client.configuration["reproDir"] = repro_dir
Expand All @@ -64,7 +62,6 @@ run_client_test
[test_fun]
--supports_config=true
--needs_server_args=(not supports_config)
--use_rpc_filesystem=false
--use_mock=false
--exit=true
--spawn_process=true
Expand All @@ -74,7 +71,6 @@ run_client_test
test_fun
--supports_config=supports_config
--needs_server_args=needs_server_args
--use_rpc_filesystem=use_rpc_filesystem
--pre_initialize=: null
--use_mock=use_mock
--spawn_process=spawn_process
Expand Down
186 changes: 0 additions & 186 deletions tests/lsp/lsp_filesystem_compiler_test.toit

This file was deleted.

12 changes: 1 addition & 11 deletions tools/lsp/server/client.toit
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ with_lsp_client [block]
--toitlsp_exe/string?=null
--supports_config=true
--needs_server_args=(not supports_config)
--use_rpc_filesystem=false
--spawn_process=false:
with_lsp_client block
--toitc=toitc
--lsp_server=lsp_server
--compiler_exe=compiler_exe
--supports_config=supports_config
--needs_server_args=needs_server_args
--use_rpc_filesystem=use_rpc_filesystem
--spawn_process=spawn_process
--pre_initialize=(:null)

Expand All @@ -51,7 +49,6 @@ with_lsp_client [block]
--compiler_exe/string = toitc
--supports_config=true
--needs_server_args=(not supports_config)
--use_rpc_filesystem=false
--spawn_process=true
[--pre_initialize]:
server_args := [lsp_server]
Expand All @@ -61,15 +58,13 @@ with_lsp_client [block]
if toitlsp_exe:
server_cmd = toitlsp_exe
server_args = ["--toitc", compiler_exe, "--sdk", (sdk_path_from_compiler toitc)]
use_rpc_filesystem = false
else:
server_cmd = toitc

client := LspClient.start
server_cmd
server_args
--supports_config=supports_config
--use_rpc_filesystem=use_rpc_filesystem
--compiler_exe=compiler_exe
--spawn_process=spawn_process
client.initialize pre_initialize
Expand Down Expand Up @@ -122,9 +117,7 @@ class LspClient:
"timeoutMs": 10_000, // Increase the timeout to avoid flaky tests.
}

static start_server_ cmd args compiler_exe --spawn_process/bool --use_rpc_filesystem/bool -> List:
if use_rpc_filesystem:
args += ["--rpc-filesystem"]
static start_server_ cmd args compiler_exe --spawn_process/bool -> List:
print "starting the server $cmd with $args"
if spawn_process:
pipes := pipe.fork
Expand All @@ -143,7 +136,6 @@ class LspClient:
server_to := FakePipe
server_rpc_connection := RpcConnection (BufferedReader server_to) server_from
server := LspServer server_rpc_connection compiler_exe UriPathTranslator
--use_rpc_filesystem=use_rpc_filesystem
task::
server.run
return [server_to, server_from, server, null]
Expand All @@ -153,12 +145,10 @@ class LspClient:
server_cmd/string
server_args/List
--supports_config/bool
--use_rpc_filesystem/bool
--compiler_exe=server_cmd
--spawn_process:
start_result := start_server_ server_cmd server_args compiler_exe
--spawn_process=spawn_process
--use_rpc_filesystem=use_rpc_filesystem
server_to := start_result[0]
server_from := start_result[1]
server := start_result[2]
Expand Down
Loading

0 comments on commit 8d5aea4

Please sign in to comment.