@@ -2,16 +2,31 @@ function! lsc#params#textDocument() abort
2
2
return {' textDocument' : {' uri' : lsc#uri#documentUri ()}}
3
3
endfunction
4
4
5
- function ! lsc#params#documentPosition () abort
6
- return { ' textDocument' : {' uri' : lsc#uri#documentUri ()},
7
- \ ' position' : {' line' : line (' .' ) - 1 , ' character' : col (' .' ) - 1 }
8
- \ }
9
- endfunction
10
-
11
- function ! lsc#params#documentRange () abort
12
- return { ' textDocument' : {' uri' : lsc#uri#documentUri ()},
13
- \ ' range' : {
14
- \ ' start' : {' line' : line (' .' ) - 1 , ' character' : col (' .' ) - 1 },
15
- \ ' end' : {' line' : line (' .' ) - 1 , ' character' : col (' .' )}},
16
- \ }
17
- endfunction
5
+ if exists (' *charcol' )
6
+ function ! lsc#params#documentPosition () abort
7
+ return { ' textDocument' : {' uri' : lsc#uri#documentUri ()},
8
+ \ ' position' : {' line' : line (' .' ) - 1 , ' character' : charcol (' .' ) - 1 }
9
+ \ }
10
+ endfunction
11
+ function ! lsc#params#documentRange () abort
12
+ return { ' textDocument' : {' uri' : lsc#uri#documentUri ()},
13
+ \ ' range' : {
14
+ \ ' start' : {' line' : line (' .' ) - 1 , ' character' : charcol (' .' ) - 1 },
15
+ \ ' end' : {' line' : line (' .' ) - 1 , ' character' : charcol (' .' )}},
16
+ \ }
17
+ endfunction
18
+ else
19
+ " TODO - this is broken following multibyte characters.
20
+ function ! lsc#params#documentPosition () abort
21
+ return { ' textDocument' : {' uri' : lsc#uri#documentUri ()},
22
+ \ ' position' : {' line' : line (' .' ) - 1 , ' character' : col (' .' ) - 1 }
23
+ \ }
24
+ endfunction
25
+ function ! lsc#params#documentRange () abort
26
+ return { ' textDocument' : {' uri' : lsc#uri#documentUri ()},
27
+ \ ' range' : {
28
+ \ ' start' : {' line' : line (' .' ) - 1 , ' character' : col (' .' ) - 1 },
29
+ \ ' end' : {' line' : line (' .' ) - 1 , ' character' : col (' .' )}},
30
+ \ }
31
+ endfunction
32
+ endif
0 commit comments