@@ -25,9 +25,7 @@ function! lsp#ui#vim#utils#locations_to_loc_list(result) abort
25
25
for l: location in l: locations
26
26
if s: is_file_uri (l: location [l: uri ])
27
27
let l: path = lsp#utils#uri_to_path (l: location [l: uri ])
28
- let l: line = l: location [l: range ][' start' ][' line' ] + 1
29
- let l: char = l: location [l: range ][' start' ][' character' ]
30
- let l: col = lsp#utils#to_col (l: path , l: line , l: char )
28
+ let [l: line , l: col ] = lsp#utils#position#_lsp_to_vim (l: path , l: location [l: range ][' start' ])
31
29
32
30
let l: index = l: line - 1
33
31
if has_key (l: cache , l: path )
@@ -107,9 +105,7 @@ let s:diagnostic_severity = {
107
105
108
106
function ! s: symbols_to_loc_list_children (server, path , list , symbols, depth) abort
109
107
for l: symbol in a: symbols
110
- let l: line = l: symbol [' range' ][' start' ][' line' ] + 1
111
- let l: char = l: symbol [' range' ][' start' ][' character' ]
112
- let l: col = lsp#utils#to_col (a: path , l: line , l: char )
108
+ let [l: line , l: col ] = lsp#utils#position#_lsp_to_vim (a: path , l: symbol [' range' ][' start' ])
113
109
114
110
call add (a: list , {
115
111
\ ' filename' : a: path ,
@@ -138,9 +134,7 @@ function! lsp#ui#vim#utils#symbols_to_loc_list(server, result) abort
138
134
let l: location = l: symbol [' location' ]
139
135
if s: is_file_uri (l: location [' uri' ])
140
136
let l: path = lsp#utils#uri_to_path (l: location [' uri' ])
141
- let l: line = l: location [' range' ][' start' ][' line' ] + 1
142
- let l: char = l: location [' range' ][' start' ][' character' ]
143
- let l: col = lsp#utils#to_col (l: path , l: line , l: char )
137
+ let [l: line , l: col ] = lsp#utils#position#_lsp_to_vim (l: path , l: location [' range' ][' start' ])
144
138
call add (l: list , {
145
139
\ ' filename' : l: path ,
146
140
\ ' lnum' : l: line ,
@@ -152,9 +146,7 @@ function! lsp#ui#vim#utils#symbols_to_loc_list(server, result) abort
152
146
let l: location = a: result [' request' ][' params' ][' textDocument' ][' uri' ]
153
147
if s: is_file_uri (l: location )
154
148
let l: path = lsp#utils#uri_to_path (l: location )
155
- let l: line = l: symbol [' range' ][' start' ][' line' ] + 1
156
- let l: char = l: symbol [' range' ][' start' ][' character' ]
157
- let l: col = lsp#utils#to_col (l: path , l: line , l: char )
149
+ let [l: line , l: col ] = lsp#utils#position#_lsp_to_vim (l: path , l: symbol [' range' ][' start' ])
158
150
call add (l: list , {
159
151
\ ' filename' : l: path ,
160
152
\ ' lnum' : l: line ,
@@ -196,9 +188,7 @@ function! lsp#ui#vim#utils#diagnostics_to_loc_list(result) abort
196
188
let l: text .= l: item [' code' ] . ' :'
197
189
endif
198
190
let l: text .= l: item [' message' ]
199
- let l: line = l: item [' range' ][' start' ][' line' ] + 1
200
- let l: char = l: item [' range' ][' start' ][' character' ]
201
- let l: col = lsp#utils#to_col (l: path , l: line , l: char )
191
+ let [l: line , l: col ] = lsp#utils#position#_lsp_to_vim (l: path , l: item [' range' ])
202
192
call add (l: list , {
203
193
\ ' filename' : l: path ,
204
194
\ ' lnum' : l: line ,
0 commit comments