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

Update test item detection protocol #1321

Draft
wants to merge 1 commit 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
30 changes: 15 additions & 15 deletions src/extensions/extensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,45 @@ end
id::String
label::String
range::Range
code::Union{Nothing,String}
code_range::Union{Nothing,Range}
option_default_imports::Union{Nothing,Bool}
option_tags::Union{Nothing,Vector{String}}
option_setup::Union{Nothing,Vector{String}}
code::String
codeRange::Range
optionDefaultImports::Bool
optionTags::Vector{String}
optionSetup::Vector{String}
end

@dict_readable struct TestSetupDetail <: Outbound
name::String
kind::String
range::Range
code::Union{Nothing,String}
code_range::Union{Nothing,Range}
code::String
codeRange::Range
end

@dict_readable struct TestErrorDetail <: Outbound
id::String
label::Union{Nothing,String}
label::String
range::Range
error::String
end

struct PublishTestsParams <: Outbound
uri::DocumentUri
version::Union{Int,Missing}
testitemdetails::Vector{TestItemDetail}
testsetupdetails::Vector{TestSetupDetail}
testerrordetails::Vector{TestErrorDetail}
testItemDetails::Vector{TestItemDetail}
testSetupDetails::Vector{TestSetupDetail}
testErrorDetails::Vector{TestErrorDetail}
end

@dict_readable struct GetTestEnvRequestParams <: Outbound
uri::URI
end

@dict_readable struct GetTestEnvRequestParamsReturn <: Outbound
package_name::String
package_uri::Union{URI,Nothing}
project_uri::Union{URI,Nothing}
env_content_hash::Union{UInt,Nothing}
packageName::String
packageUri::Union{URI,Missing}
projectUri::Union{URI,Missing}
envContentHash::Union{UInt,Missing}
end

include("messagedefs.jl")
6 changes: 3 additions & 3 deletions src/requests/testing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ function julia_get_test_env_request(params::GetTestEnvRequestParams, server::Lan

return GetTestEnvRequestParamsReturn(
r.package_name,
r.package_uri,
r.project_uri,
r.env_content_hash
something(r.package_uri, missing),
something(r.project_uri, missing),
something(r.env_content_hash, missing)
)
end
32 changes: 29 additions & 3 deletions src/requests/textdocument.jl
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,35 @@
testitems_results = JuliaWorkspaces.get_test_items(server.workspace, uri)
st = JuliaWorkspaces.get_text_file(server.workspace, uri).content

testitems = TestItemDetail[TestItemDetail(i.id, i.name, Range(st, i.range), st.content[i.code_range], Range(st, i.code_range), i.option_default_imports, string.(i.option_tags), string.(i.option_setup)) for i in testitems_results.testitems]
testsetups= TestSetupDetail[TestSetupDetail(string(i.name), string(i.kind), Range(st, i.range), st.content[i.code_range], Range(st, i.code_range), ) for i in testitems_results.testsetups]
testerrors = TestErrorDetail[TestErrorDetail(te.id, te.name, Range(st, te.range), te.message) for te in testitems_results.testerrors]
testitems = TestItemDetail[

Check warning on line 474 in src/requests/textdocument.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/textdocument.jl#L474

Added line #L474 was not covered by tests
TestItemDetail(
id = i.id,
label = i.name,
range = Range(st, i.range),
code = st.content[i.code_range],
codeRange = Range(st, i.code_range),
optionDefaultImports = i.option_default_imports,
optionTags = string.(i.option_tags),
optionSetup = string.(i.option_setup)
) for i in testitems_results.testitems
]
testsetups= TestSetupDetail[

Check warning on line 486 in src/requests/textdocument.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/textdocument.jl#L486

Added line #L486 was not covered by tests
TestSetupDetail(
name = string(i.name),
kind = string(i.kind),
range = Range(st, i.range),
code = st.content[i.code_range],
codeRange = Range(st, i.code_range)
) for i in testitems_results.testsetups
]
testerrors = TestErrorDetail[

Check warning on line 495 in src/requests/textdocument.jl

View check run for this annotation

Codecov / codecov/patch

src/requests/textdocument.jl#L495

Added line #L495 was not covered by tests
TestErrorDetail(
id = te.id,
label = te.name,
range = Range(st, te.range),
error = te.message
) for te in testitems_results.testerrors
]

version = get(server._open_file_versions, uri, missing)

Expand Down
Loading