Skip to content

Commit 35aae8b

Browse files
committed
Only use charcol() when the function is available
1 parent 2723b5a commit 35aae8b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

autoload/OmniSharp/stdio.vim

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,13 @@ function! OmniSharp#stdio#Request(command, opts) abort
129129
else
130130
let bufnr = bufnr('%')
131131
let lnum = get(a:opts, 'LineNum', line('.'))
132-
let cnum = get(a:opts, 'ColNum', charcol('.'))
132+
if exists('*charcol')
133+
" charcol() gives the character index of the cursor column, instead of the
134+
" byte index. The OmniSharp-roslyn server uses character-based indices.
135+
let cnum = get(a:opts, 'ColNum', charcol('.'))
136+
else
137+
let cnum = get(a:opts, 'ColNum', col('.'))
138+
endif
133139
endif
134140
let host = OmniSharp#GetHost(bufnr)
135141
let job = host.job

0 commit comments

Comments
 (0)