Skip to content

Commit

Permalink
Substitute by function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jwortmann committed Aug 28, 2024
1 parent bad360d commit 6a66fb9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 57 deletions.
33 changes: 1 addition & 32 deletions src/requests/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,38 +245,7 @@ function initialized_notification(params::InitializedParams, server::LanguageSer
end
end

# Add project files separately in case they are not in a workspace folder
if server.env_path != ""
for file in ["Project.toml", "JuliaProject.toml", "Manifest.toml", "JuliaManifest.toml"]
file_full_path = joinpath(server.env_path, file)
uri = filepath2uri(file_full_path)
if isfile(file_full_path)
@static if Sys.iswindows()
# Normalize drive letter to lowercase
if length(file_full_path) > 1 && isletter(file_full_path[1]) && file_full_path[2] == ':'
file_full_path = lowercasefirst(file_full_path)
end
end
# Only add again if outside of the workspace folders
if all(i->!startswith(file_full_path, i), server.workspaceFolders)
if haskey(server._files_from_disc, uri)
error("This should not happen")
end

text_file = JuliaWorkspaces.read_text_file_from_uri(uri, return_nothing_on_io_error=true)
text_file === nothing && continue

server._files_from_disc[uri] = text_file

if !haskey(server._open_file_versions, uri)
JuliaWorkspaces.add_file!(server.workspace, text_file)
end
end
# But we do want to track, in case the workspace folder is removed
push!(server._extra_tracked_files, filepath2uri(file_full_path))
end
end
end
track_project_files!(server)

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

View check run for this annotation

Codecov / codecov/patch

src/requests/init.jl#L248

Added line #L248 was not covered by tests

JuliaWorkspaces.set_input_fallback_test_project!(server.workspace.runtime, isempty(server.env_path) ? nothing : filepath2uri(server.env_path))

Expand Down
26 changes: 1 addition & 25 deletions src/requests/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,31 +82,7 @@ function julia_activateenvironment_notification(params::NamedTuple{(:envPath,),T

empty!(server._extra_tracked_files)

# Add project files separately in case they are not in a workspace folder
if server.env_path != ""
for file in ["Project.toml", "JuliaProject.toml", "Manifest.toml", "JuliaManifest.toml"]
file_full_path = joinpath(server.env_path, file)
uri = filepath2uri(file_full_path)
if isfile(file_full_path)
# Only add again if outside of the workspace folders
if all(i->!startswith(file_full_path, i), server.workspaceFolders)
if haskey(server._files_from_disc, uri)
error("This should not happen")
end

text_file = JuliaWorkspaces.read_text_file_from_uri(uri, return_nothing_on_io_error=true)
text_file===nothing || continue

server._files_from_disc[uri] = text_file

if !haskey(server._open_file_versions, uri)
JuliaWorkspaces.add_file!(server.workspace, text_file)
end
end
push!(server._extra_tracked_files, filepath2uri(file_full_path))
end
end
end
track_project_files!(server)

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

View check run for this annotation

Codecov / codecov/patch

src/requests/misc.jl#L85

Added line #L85 was not covered by tests

JuliaWorkspaces.set_input_fallback_test_project!(server.workspace.runtime, isempty(server.env_path) ? nothing : filepath2uri(server.env_path))

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

View check run for this annotation

Codecov / codecov/patch

src/requests/misc.jl#L87

Added line #L87 was not covered by tests

Expand Down

0 comments on commit 6a66fb9

Please sign in to comment.