Clojure-lsp: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY

Created on 12 Oct 2020  路  5Comments  路  Source: clojure-lsp/clojure-lsp

vim version: NVIM v0.4.4
node version: v14.13.1
coc.nvim version: 0.0.79-8da7b2139d
coc.nvim directory: /home/david/.env/vim/bundle/coc.nvim
term: xterm-kitty
platform: linux
clojure-lsp: release-20201009T224414

Hi, I'm experiencing a strange issue that I cannot quite get to the bottom of. I have this function in my vim configuration.

function! Expand(exp) abort
    let l:result = expand(a:exp)
    return l:result ==# '' ? '' : "file://" . l:result
endfunction

then this mapping:

nnoremap <silent> crcn :call CocRequest('clojure-lsp', 'workspace/executeCommand', {'command': 'clean-ns', 'arguments': [Expand('%:p'), line('.') - 1, col('.') - 1]})<CR>

When I invoke crcn, I get this error:

Error on request (sendRequest): Vim(return):Error invoking 'sendRequest' on channel 3 (coc):                                 
Message could not be parsed.

CocInfo shows this:

[Trace - 19:09:13] Sending request 'workspace/executeCommand - (2)'.
Params: [
    {
        "arguments": [
            "file:///home/david/development/clojure/foo.clj",
            29,
            21
        ],
        "command": "clean-ns"
    },
    null
]


[Trace - 19:09:13] Received response 'workspace/executeCommand - (2)' in 1ms. Request failed: Message could not be parsed. (-32700).
Error data: {
    "message": "java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 71 path $.params"
}

Am I doing something wrong?

All 5 comments

I'm not sure, but testing on emacs works and seems to send a different data for the executeCommand:

[Trace - 03:17:19 PM] Sending request 'workspace/executeCommand - (49)'.
Params: {
  "command": "clean-ns",
  "arguments": [
    "file:///home/greg/dev/clojure-sample/src/clojure_sample/a.clj",
    6,
    6
  ]
}

That null on you log seems to be the problem, maybe @snoe could confirm if it's an issue on client side (vim)

That's very interesting. I did wonder about that null...

Okay,

Doing some investigation. It looks like there is a breaking change somewhere post CoC v0.0.79. Using that particular release works. At some point past that, breakage.

This commit, seems to be the culprit:

fd27cb712b58d144dc60b08f60f26317220c0f16 is the first bad commit
commit fd27cb712b58d144dc60b08f60f26317220c0f16
Author: Qiming Zhao <[email protected]>
Date:   Thu Oct 8 16:13:50 2020 +0800

    Revert "feat: add CocStop"

    This reverts commit 2ee86b914fc047b81fd61bd2156e062a9c0d5533.

 autoload/coc/util.vim |   7 +
 build/index.js        | 592 +++++++++++++++++++++++---------------------------
 doc/coc.txt           |   2 +-
 plugin/coc.vim        |   1 +
 4 files changed, 278 insertions(+), 324 deletions(-)

Looks like this has been fixed. I'll try it out once it hits the RELEASE branch on CoC.

Fixed and available on the latest (release) CoC

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ericdallo picture ericdallo  路  4Comments

fuadsaud picture fuadsaud  路  3Comments

FongHou picture FongHou  路  5Comments

andreyorst picture andreyorst  路  4Comments

alxdb picture alxdb  路  4Comments