Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove debug_mode field from LanguageServerInstance
There are no longer any uses of this field inside
LanguageServer.jl. If the vs-code extension still sends
"julia/toggle-log" methods, it should be removed since it functionally
changes nothing currently.

Closes #421
  • Loading branch information
non-Jedi committed May 6, 2020
commit 34d5bc697c0ecf20ffef48a1ee04e72e71bef6fb
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Instantiate an instance of the language server with
```julia
using LanguageServer

server = LanguageServerInstance(stdin, stdout, false, "/path/to/environment")
server = LanguageServerInstance(stdin, stdout, "/path/to/environment")
run(server)
```
6 changes: 1 addition & 5 deletions contrib/languageserver.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

JULIABIN="julia"
DEBUG="false"

while [[ $# -gt 0 ]]
do
Expand All @@ -12,9 +11,6 @@ while [[ $# -gt 0 ]]
JULIABIN="$2"
shift
;;
--debug)
DEBUG="true"
;;
*)
echo "unknown option: $key" >&2
exit
Expand All @@ -24,7 +20,7 @@ while [[ $# -gt 0 ]]
done

$JULIABIN --startup-file=no --history-file=no -e \
"using LanguageServer; import SymbolServer; server = LanguageServer.LanguageServerInstance(stdin, stdout, $DEBUG); server.runlinter = true; run(server);" \
"using LanguageServer; import SymbolServer; server = LanguageServer.LanguageServerInstance(stdin, stdout); server.runlinter = true; run(server);" \
<&0 >&1 &

PID=$!
Expand Down
7 changes: 2 additions & 5 deletions src/languageserverinstance.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
T = 0.0

"""
LanguageServerInstance(pipe_in, pipe_out, debug=false, env="", depot="", err_handler=nothing, symserver_store_path=nothing)
LanguageServerInstance(pipe_in, pipe_out, env="", depot="", err_handler=nothing, symserver_store_path=nothing)

Construct an instance of the language server.

Expand All @@ -14,7 +14,6 @@ For normal usage, the language server can be instantiated with
# Arguments
- `pipe_in::IO`: Pipe to read JSON-RPC from.
- `pipe_out::IO`: Pipe to write JSON-RPC to.
- `debug::Bool`: Whether to log debugging information with `Base.CoreLogging`.
- `env::String`: Path to the
[environment](https://docs.julialang.org/en/v1.2/manual/code-loading/#Environments-1)
for which the language server is running. An empty string uses julia's
Expand All @@ -33,7 +32,6 @@ mutable struct LanguageServerInstance
workspaceFolders::Set{String}
_documents::Dict{URI2,Document}

debug_mode::Bool
runlinter::Bool
ignorelist::Set{String}
isrunning::Bool
Expand Down Expand Up @@ -62,12 +60,11 @@ mutable struct LanguageServerInstance
clientcapability_window_workdoneprogress::Bool
clientcapability_workspace_didChangeConfiguration::Bool

function LanguageServerInstance(pipe_in, pipe_out, debug_mode::Bool = false, env_path = "", depot_path = "", err_handler=nothing, symserver_store_path=nothing)
function LanguageServerInstance(pipe_in, pipe_out, env_path = "", depot_path = "", err_handler=nothing, symserver_store_path=nothing)
new(
JSONRPCEndpoints.JSONRPCEndpoint(pipe_in, pipe_out, err_handler),
Set{String}(),
Dict{URI2,Document}(),
debug_mode,
true,
Set{String}(),
false,
Expand Down
5 changes: 0 additions & 5 deletions src/requests/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ function process(r::JSONRPC.Request{Val{Symbol("julia/reload-modules")},Nothing}
JSONRPC.parse_params(::Type{Val{Symbol("julia/toggleFileLint")}}, params) = params
function process(r::JSONRPC.Request{Val{Symbol("julia/toggleFileLint")}}, server) end

function JSONRPC.parse_params(::Type{Val{Symbol("julia/toggle-log")}}, params) end
function process(r::JSONRPC.Request{Val{Symbol("julia/toggle-log")},Nothing}, server)
server.debug_mode = !server.debug_mode
end


JSONRPC.parse_params(::Type{Val{Symbol("julia/getCurrentBlockRange")}}, params) = TextDocumentPositionParams(params)
function process(r::JSONRPC.Request{Val{Symbol("julia/getCurrentBlockRange")},TextDocumentPositionParams}, server)
Expand Down
1 change: 0 additions & 1 deletion test/test_bruteforce.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ init_request = """

process(LanguageServer.parse(Request, LanguageServer.JSON.parse(init_request)), server)
process(LanguageServer.parse(Request, LanguageServer.JSON.parse("""{"jsonrpc":"2.0","method":"initialized","params":{}}""")), server)
server.debug_mode = false

# Workspace Symbols
r = parse(Request, LanguageServer.JSON.parse("""{"jsonrpc":"2.0","id":59,"method":"workspace/symbol","params":{"query":""}}"""))
Expand Down