neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.16k stars 954 forks source link

bitbake-language-server crashing when editing insert mode #4920

Closed jclsn closed 4 months ago

jclsn commented 4 months ago

Output from :CocCommand workspace.showOutput:

{"loaded rules":"oelint.append.protvars\n\toelint.append.protvars.LICENSE\n\toelint.append.protvars.LIC_FILES
Error: Header must provide a Content-Length property. 
{"loaded rules":"oelint.append.protvars\n\toelint.append.protvars.LICENSE\n\toelint.append.protvars.LIC_FILES
    at Dx.onData (/home/jan/.vim/plugged/coc.nvim/build/index.js:22:21240)                                   
    at Socket.<anonymous> (/home/jan/.vim/plugged/coc.nvim/build/index.js:22:20954)                          
    at Socket.emit (node:events:517:28)                                                                      
    at addChunk (node:internal/streams/readable:335:12)                                                      
    at readableAddChunk (node:internal/streams/readable:308:9)                                               
    at Readable.push (node:internal/streams/readable:245:10)                                                 
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)                                          
[Error - 18:07:06.912] Connection to server bitbake is erroring, Header must provide a Content-Length propert
{"{\"params\"":"{\"uri\": \"file:///home/jan/.vim/test.bb\", \"diagnostics\": []}, \"method\": \"textDocument
Error: Header must provide a Content-Length property.                                                        
{"{\"params\"":"{\"uri\": \"file:///home/jan/.vim/test.bb\", \"diagnostics\": []}, \"method\": \"textDocument
    at Dx.onData (/home/jan/.vim/plugged/coc.nvim/build/index.js:22:21240)                                   
    at Socket.<anonymous> (/home/jan/.vim/plugged/coc.nvim/build/index.js:22:20954)                          
    at Socket.emit (node:events:517:28)                                                                      
    at addChunk (node:internal/streams/readable:335:12)                                                      
    at readableAddChunk (node:internal/streams/readable:308:9)                                               
    at Readable.push (node:internal/streams/readable:245:10)                                                 
    at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)                                          

Result from CocInfo

## versions

vim version: VIM - Vi IMproved 9.1 9010080
node version: v18.18.2
coc.nvim version: 0.0.82-00bd79e0 2024-02-28 12:40:55 +0800
coc.nvim directory: /home/jan/.vim/plugged/coc.nvim
term: dumb
platform: linux

## Log of coc.nvim

2024-03-02T18:08:33.845 INFO (pid:475857) [extension:coc-git] - Looking for git in: git
2024-03-02T18:08:33.997 INFO (pid:475857) [plugin] - coc.nvim initialized with node: v18.18.2 after 441
2024-03-02T18:08:34.001 INFO (pid:475857) [services] - LanguageClient bitbake state change: stopped => starting
2024-03-02T18:08:34.013 INFO (pid:475857) [language-client-index] - Language server "languageserver.bitbake" started with 475880
2024-03-02T18:08:34.562 INFO (pid:475857) [services] - LanguageClient bitbake state change: starting => running
2024-03-02T18:08:34.567 INFO (pid:475857) [services] - service languageserver.bitbake started
2024-03-02T18:08:36.032 INFO (pid:475857) [attach] - receive notification: showInfo []
2024-03-02T18:08:36.056 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:36.544 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:37.421 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:39.484 INFO (pid:475857) [services] - LanguageClient bitbake state change: running => stopped
2024-03-02T18:08:39.722 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:43.383 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:44.548 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:48.045 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:48.558 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:48.759 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:49.085 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:50.059 INFO (pid:475857) [attach] - receive notification: highlight []
2024-03-02T18:08:51.892 INFO (pid:475857) [attach] - receive notification: showInfo []

Describe the bug

The language server starts up fine, but as soon as insert mode is entered and something is edited, the server crashes with Error: Header must provide a Content-Length property. To rule out the server is faulty, I have set it up in https://github.com/yegappan/lsp and there is no issue here. There are similar issues here and here

Related issue: https://github.com/Freed-Wu/bitbake-language-server/issues/6

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't reproduce it

set encoding=utf-8

call plug#begin('~/.vim/plugged')
    Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()

coc-settings.json

}
  "languageserver": {

    "bitbake": {
      "command": "bitbake-language-server",
      "filetypes": ["bitbake"]
    },
  }
}

Open a Bitbake file, e.g. https://raw.githubusercontent.com/openembedded/meta-openembedded/master/meta-oe/recipes-support/btop/btop_1.3.2.bb

Screenshots (optional)

grafik

If applicable, add screenshots to help explain your problem.

fannheyward commented 4 months ago

Reproduced, the bitbake-language-server response didn't provide Content-Length property, vscode-jsonrpc was failed to get content-length value, this is must needed.

https://github.com/microsoft/vscode-languageserver-node/blob/46f6f9038fee60dbdfeb5307201397adc8feb3cb/jsonrpc/src/common/messageReader.ts#L223-L227

@Freed-Wu

Freed-Wu commented 4 months ago

Content-Length property

I'll take a look at my leisure.