Skip to content

Commit

Permalink
Fix a problem
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff committed Jul 20, 2024
1 parent f3a02bd commit fbde895
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/JuliaWorkspaces.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module JuliaWorkspaces

import UUIDs, JuliaSyntax, TestItemDetection
using UUIDs: UUID
using UUIDs: UUID, uuid4
using JuliaSyntax: SyntaxNode
using Salsa

Expand Down
4 changes: 2 additions & 2 deletions src/inputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ Salsa.@declare_input input_files(rt)::Set{URI}
Salsa.@declare_input input_text_file(rt, uri)::TextFile
Salsa.@declare_input input_notebook_file(rt, uri)::NotebookFile
Salsa.@declare_input input_fallback_test_project(rt)::Union{URI,Nothing}
Salsa.@declare_input input_marked_diagnostics(rt)::Dict{URI,Vector{Diagnostic}}
Salsa.@declare_input input_marked_testitems(rt)::Dict{URI,TestDetails}
Salsa.@declare_input input_marked_diagnostics(rt)::DiagnosticsMark
Salsa.@declare_input input_marked_testitems(rt)::TestitemsMark
10 changes: 5 additions & 5 deletions src/layer_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Salsa.@derived function derived_diagnostics(rt, uri)
return results
end

Salsa.@derived function derived_diagnostics(rt)
Salsa.@derived function derived_all_diagnostics(rt)
files = derived_text_files(rt)

results = Diagnostic[]
Expand All @@ -96,9 +96,9 @@ Salsa.@derived function derived_diagnostics(rt)
end

Salsa.@derived function derived_diagnostic_updated_since_mark(rt)
marked_versions = input_marked_diagnostics(rt)
marked_versions = input_marked_diagnostics(rt).data

old_text_files = keys(marked_versions)
old_text_files = collect(keys(marked_versions))
current_text_files = derived_text_files(rt)

deleted_files = setdiff(old_text_files, current_text_files)
Expand All @@ -124,7 +124,7 @@ function get_diagnostic(jw::JuliaWorkspace, uri::URI)
end

function get_diagnostics(jw::JuliaWorkspace)
return derived_diagnostics(jw.runtime)
return derived_all_diagnostics(jw.runtime)
end

function mark_current_diagnostics(jw::JuliaWorkspace)
Expand All @@ -135,7 +135,7 @@ function mark_current_diagnostics(jw::JuliaWorkspace)
for f in files
results[f] = derived_diagnostics(jw.runtime, f)
end
set_input_marked_diagnostics!(jw.runtime, results)
set_input_marked_diagnostics!(jw.runtime, DiagnosticsMark(uuid4(), results))
end

function get_files_with_updated_diagnostics(jw::JuliaWorkspace)
Expand Down
4 changes: 2 additions & 2 deletions src/layer_testitems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ end

Salsa.@derived function derived_testitems_updated_since_mark(rt)
current_text_files = derived_julia_files(rt)
marked_versions = input_marked_testitems(rt)
marked_versions = input_marked_testitems(rt).data

old_text_files = collect(keys(marked_versions))

Expand Down Expand Up @@ -173,7 +173,7 @@ function mark_current_testitems(jw::JuliaWorkspace)
results[f] = derived_testitems(jw.runtime, f)
end

set_input_marked_testitems!(jw.runtime, results)
set_input_marked_testitems!(jw.runtime, TestitemsMark(uuid4(), results))
end

function get_files_with_updated_testitems(jw::JuliaWorkspace)
Expand Down
10 changes: 10 additions & 0 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ struct JuliaWorkspace
end
end

struct DiagnosticsMark
id::UUID
data::Dict{URI,Vector{Diagnostic}}
end

struct TestitemsMark
id::UUID
data::Dict{URI,TestDetails}
end

function get_test_items(jw::JuliaWorkspace, uri::URI)
derived_testitems(jw.runtime, uri)
end
Expand Down

0 comments on commit fbde895

Please sign in to comment.