Skip to content

Commit

Permalink
Merge pull request #377 from julia-vscode/sp/catch-loadfile
Browse files Browse the repository at this point in the history
feat: print file path on failure in loadfile
  • Loading branch information
pfitzseb authored Sep 27, 2023
2 parents 74ec406 + 6a7c5fd commit 7ac64c7
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ function setfile(server::FileServer, path::String, file::File)
end
getfile(server::FileServer, path::String) = server.files[path]
function loadfile(server::FileServer, path::String)
source = read(path, String)
cst = CSTParser.parse(source, true)
f = File(path, source, cst, nothing, server)
setroot(f, f)
setfile(server, path, f)
return getfile(server, path)
try
source = read(path, String)
cst = CSTParser.parse(source, true)
f = File(path, source, cst, nothing, server)
setroot(f, f)
setfile(server, path, f)
return getfile(server, path)
catch
@info "Could not load $(path) from disk."
rethrow()
end
end

getsymbols(env::ExternalEnv) = env.symbols
Expand Down

0 comments on commit 7ac64c7

Please sign in to comment.