crystal-lang-tools/scry

External files diagnostic are not cleared

faustinoaq opened this issue · 0 comments

After working on amberframework source code for a few days I notice the diagnostic for external files is not clean, so, I always see these errors, until the editor is reloaded.

External file Untitled-4.cr located in home directory, and opened from a Project folder

screenshot_20180414_105558

I think this code is causing the issue:

# Reset all diagnostics in the current project
def clean_diagnostic
Dir.glob("#{@workspace.root_uri}/**/*.cr").map do |file|
@diagnostic.clean("file://#{file}")
end
end

So, we need to send clean diagnostics to all files in @text_document.text.map and not only to files inside src/ folder.

IMPORTANT: We're sending clean diagnostics to all files because some errors are not located in the same file, and because we support implicit requires now, the files scope is a bit bigger and needs to be clean.