Skip to content

Commit aa6572b

Browse files
authored
Merge pull request #873 from julia-vscode/more-diag
Add more diagnostics
2 parents 2823832 + 7844396 commit aa6572b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/document.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,18 @@ function get_offset2(doc::Document, line::Integer, character::Integer)
113113
pos = line_offset
114114

115115
while character > 0
116-
if UInt32(text[pos]) >= 0x010000
117-
character -= 2
118-
else
119-
character -= 1
116+
try
117+
if UInt32(text[pos]) >= 0x010000
118+
character -= 2
119+
else
120+
character -= 1
121+
end
122+
catch err
123+
if err isa BoundsError
124+
throw(LSOffsetError("get_offset2 crashed at location 3. More diagnostics:\nline=$line\nline_offsets='$line_offsets'\ncharacter=$character\npos=$pos\nlastindex=$(lastindex(text))"))
125+
else
126+
rethrow(err)
127+
end
120128
end
121129
pos = nextind(text, pos)
122130
end

0 commit comments

Comments
 (0)