From daa1c60b90b455c5dee139738e942d90150606ea Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Fri, 26 Apr 2024 16:36:24 +0200 Subject: [PATCH] fix: improve LSInvalidFile printing --- src/exception_types.jl | 3 ++- src/textdocument.jl | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/exception_types.jl b/src/exception_types.jl index ae5302d0..c653f71d 100644 --- a/src/exception_types.jl +++ b/src/exception_types.jl @@ -64,8 +64,9 @@ end struct LSInvalidFile <: Exception msg::AbstractString + uri::URI end function Base.showerror(io::IO, ex::LSInvalidFile) - print(io, ex.msg) + print(io, ex.msg, " File: '", uri2filepath(ex.uri), "'") end diff --git a/src/textdocument.jl b/src/textdocument.jl index 3c972ff1..95faa96c 100644 --- a/src/textdocument.jl +++ b/src/textdocument.jl @@ -8,7 +8,7 @@ struct TextDocument function TextDocument(uri::URI, text::AbstractString, version::Int, lid = nothing) # TODO Remove this check eventually - occursin('\0', text) && throw(LSInvalidFile("Tried to set a text with an embedded NULL as the document content.")) + occursin('\0', text) && throw(LSInvalidFile("Tried to set a text with an embedded NULL as the document content.", uri)) line_offsets = _compute_line_offsets(text) line_indices = _compute_line_indices(text)