Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE #1303

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions src/LanguageServer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ using PrecompileTools

export LanguageServerInstance, runserver

const TEMPDEBUG = Ref{Vector{String}}()

function __init__()
TEMPDEBUG[] = String[]
end

JSON.lower(uri::URI) = string(uri)

include("exception_types.jl")
Expand Down
7 changes: 6 additions & 1 deletion src/requests/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@

if server.workspaceFolders !== nothing
for i in server.workspaceFolders
JuliaWorkspaces.add_folder_from_disc!(server.workspace, i)
diag_files = JuliaWorkspaces.add_folder_from_disc!(server.workspace, i)

Check warning on line 201 in src/requests/init.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/init.jl#L201

Added line #L201 was not covered by tests

for i in diag_files
push!(TEMPDEBUG[], "$(i.uri) ADDED initialized_notification loop")
end

Check warning on line 205 in src/requests/init.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/init.jl#L203-L205

Added lines #L203 - L205 were not covered by tests
end

# Add project files separately in case they are not in a workspace folder
Expand All @@ -209,6 +213,7 @@
# Only add again if outside of the workspace folders
if all(i->!startswith(file_full_path, i), server.workspaceFolders)
JuliaWorkspaces.add_file_from_disc!(server.workspace, file_full_path)
push!(TEMPDEBUG[], "$(filepath2uri(file_full_path)) ADDED initialized_notification project handling")

Check warning on line 216 in src/requests/init.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/init.jl#L216

Added line #L216 was not covered by tests
end
# But we do want to track, in case the workspace folder is removed
push!(server._extra_tracked_files, filepath2uri(file_full_path))
Expand Down
1 change: 1 addition & 0 deletions src/requests/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
# Only add again if outside of the workspace folders
if all(i->!startswith(file_full_path, i), server.workspaceFolders)
JuliaWorkspaces.add_file_from_disc!(server.workspace, file_full_path)
push!(TEMPDEBUG[], "$(filepath2uri(file_full_path)) ADDED julia_activateenvironment_notification")

Check warning on line 93 in src/requests/misc.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/misc.jl#L93

Added line #L93 was not covered by tests
end
push!(server._extra_tracked_files, filepath2uri(file_full_path))
end
Expand Down
2 changes: 2 additions & 0 deletions src/requests/textdocument.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function textDocument_didOpen_notification(params::DidOpenTextDocumentParams, se
JuliaWorkspaces.update_file!(server.workspace, new_text_file)
else
JuliaWorkspaces.add_file!(server.workspace, new_text_file)
push!(TEMPDEBUG[], "$uri ADDED textDocument_didOpen_notification")
end
server._open_file_versions[uri] = params.textDocument.version

Expand Down Expand Up @@ -63,6 +64,7 @@ function textDocument_didClose_notification(params::DidCloseTextDocumentParams,
file_path = uri2filepath(uri)
if file_path===nothing || !isfile(file_path)
JuliaWorkspaces.remove_file!(server.workspace, uri)
push!(TEMPDEBUG[], "$uri REMOVED textDocument_didClose_notification")
if !ismissing(server.initialization_options) && get(server.initialization_options, "julialangTestItemIdentification", false)
JSONRPC.send(conn, textDocument_publishTests_notification_type, PublishTestsParams(uri, missing, TestItemDetail[], TestSetupDetail[], TestErrorDetail[]))
end
Expand Down
9 changes: 8 additions & 1 deletion src/requests/workspace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@

if change.type == FileChangeTypes.Created || change.type == FileChangeTypes.Changed
if change.type == FileChangeTypes.Created
JuliaWorkspaces.add_file_from_disc!(server.workspace, uri2filepath(uri))
if !haskey(server._open_file_versions, uri)
JuliaWorkspaces.add_file_from_disc!(server.workspace, uri2filepath(uri))
push!(TEMPDEBUG[], "$uri ADDED workspace_didChangeWatchedFiles_notification")

Check warning on line 11 in src/requests/workspace.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/workspace.jl#L9-L11

Added lines #L9 - L11 were not covered by tests
end
elseif change.type == FileChangeTypes.Changed
if !haskey(server._open_file_versions, uri)
JuliaWorkspaces.update_file_from_disc!(server.workspace, uri2filepath(uri))
Expand Down Expand Up @@ -56,6 +59,7 @@
elseif change.type == FileChangeTypes.Deleted
if !haskey(server._open_file_versions, uri)
JuliaWorkspaces.remove_file!(server.workspace, uri)
push!(TEMPDEBUG[], "$uri REMOVED workspace_didChangeWatchedFiles_notification")

Check warning on line 62 in src/requests/workspace.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/workspace.jl#L62

Added line #L62 was not covered by tests
if !ismissing(server.initialization_options) && get(server.initialization_options, "julialangTestItemIdentification", false)
JSONRPC.send(conn, textDocument_publishTests_notification_type, PublishTestsParams(uri, missing, TestItemDetail[], TestSetupDetail[], TestErrorDetail[]))
end
Expand Down Expand Up @@ -166,6 +170,8 @@
end

JuliaWorkspaces.remove_file!(server.workspace, uri)
push!(TEMPDEBUG[], "$uri REMOVED gc_files_from_workspace")

Check warning on line 173 in src/requests/workspace.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/workspace.jl#L173

Added line #L173 was not covered by tests

if !ismissing(server.initialization_options) && get(server.initialization_options, "julialangTestItemIdentification", false)
JSONRPC.send(server.jr_endpoint, textDocument_publishTests_notification_type, PublishTestsParams(uri, missing, TestItemDetail[], TestSetupDetail[], TestErrorDetail[]))
end
Expand All @@ -183,6 +189,7 @@
for i in files
if !haskey(server._open_file_versions, i.uri)
JuliaWorkspaces.add_file!(server.workspace, i)
push!(TEMPDEBUG[], "$(i.uri) ADDED workspace_didChangeWorkspaceFolders_notification")

Check warning on line 192 in src/requests/workspace.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/workspace.jl#L192

Added line #L192 was not covered by tests
end
end
end
Expand Down