@@ -113,6 +113,7 @@ function _hl_annotations!(highlights::Vector{Tuple{UnitRange{Int}, Pair{Symbol,
113
113
(; node, parent) = lineage
114
114
(; content, offset, lnode, pdepths) = ctx
115
115
region = firstindex (content)+ offset: node. span+ offset
116
+ regionstr = view (content, firstindex (content)+ offset: prevind (content, node. span+ offset+ 1 ))
116
117
nkind = node. head. kind
117
118
pnode = if ! isnothing (parent) parent. node end
118
119
pkind = if ! isnothing (parent) kind (parent. node) end
@@ -129,7 +130,7 @@ function _hl_annotations!(highlights::Vector{Tuple{UnitRange{Int}, Pair{Symbol,
129
130
if pkind == K " curly"
130
131
:julia_type
131
132
else
132
- name = Symbol (view (content, region) )
133
+ name = Symbol (regionstr )
133
134
if name in SINGLETON_IDENTIFIERS
134
135
:julia_singleton_identifier
135
136
elseif name == :NaN
@@ -220,14 +221,14 @@ function _hl_annotations!(highlights::Vector{Tuple{UnitRange{Int}, Pair{Symbol,
220
221
if isnothing (arg1)
221
222
elseif kind (arg1) == K " Identifier"
222
223
region = first (region): first (region)+ argoffset- 1
223
- name = Symbol (view (content, region) )
224
+ name = Symbol (regionstr )
224
225
ifelse (name in BUILTIN_FUNCTIONS, :julia_builtin , :julia_funcall )
225
226
elseif kind (arg1) == K " ." && length (arg1. args) == 3 &&
226
227
kind (arg1. args[end ]) == K " quote" &&
227
228
length (arg1. args[end ]. args) == 1 &&
228
229
kind (arg1. args[end ]. args[1 ]) == K " Identifier"
229
230
region = first (region)+ argoffset- arg1. args[end ]. args[1 ]. span: first (region)+ argoffset- 1
230
- name = Symbol (view (content, region) )
231
+ name = Symbol (regionstr )
231
232
ifelse (name in BUILTIN_FUNCTIONS, :julia_builtin , :julia_funcall )
232
233
end
233
234
elseif JuliaSyntax. is_error (nkind); :julia_error
@@ -254,13 +255,13 @@ function _hl_annotations!(highlights::Vector{Tuple{UnitRange{Int}, Pair{Symbol,
254
255
if nkind == K " Comment"
255
256
for match in eachmatch (
256
257
r" (?:^|[(\[ {[:space:]-])`([^[:space:]](?:.*?[^[:space:]])?)`(?:$|[!,\- .:;?\[\] [:space:]])" ,
257
- view (content, region) )
258
+ regionstr )
258
259
code = first (match. captures)
259
260
push! (highlights, (firstindex (content)+ offset+ code. offset: firstindex (content)+ offset+ code. offset+ code. ncodeunits- 1 ,
260
261
:face => :code ))
261
262
end
262
263
elseif nkind == K " String"
263
- for match in eachmatch (r" \\ ." , view (content, region) )
264
+ for match in eachmatch (r" \\ ." , regionstr )
264
265
push! (highlights, (firstindex (content)+ offset+ match. offset- 1 : firstindex (content)+ offset+ match. offset+ ncodeunits (match. match)- 2 ,
265
266
:face => :julia_backslash_literal ))
266
267
end
0 commit comments