Skip to content

[Bug] Cannot read property 'capabilities' of null when running GHDL-LS LSP Server #73

@pidgeon777

Description

@pidgeon777

We're trying to run ghdl-ls on Neovim with coc.nvim, one of its LSP clients.

An error occurs when doing that, we're trying to understand if this is a bug coc.nvim side or ghdl-ls side.

Here is the necessary info:

Result from CocInfo

## versions

vim version: NVIM v0.4.4
node version: v14.15.4
coc.nvim version: 0.0.80-50544406f0
coc.nvim directory: C:\Neovim\config\nvim\plugged\coc.nvim
term: undefined
platform: win32

## Log of coc.nvim

2021-01-31T15:54:27.641 INFO (pid:24080) [services] - registered service "languageserver.ghdlLS"
2021-01-31T15:54:27.883 INFO (pid:24080) [plugin] - coc.nvim 0.0.80-50544406f0 initialized with node: v14.15.4 after 308ms
2021-01-31T15:54:30.772 INFO (pid:24080) [attach] - receive notification: showInfo []

Describe the bug

I defined a LSP entry in the coc-settings.json file, this involve running the ghdl-ls executable when analyzing VHDL files.
When one of those VHDL files is opened, coc.nvim detect it and start the ghdl-ls LSP Server, but an error is generated, the following:

Cannot read property 'capabilities' of null

I'm using other VHDL LSP Servers with success, which are currently disabled, but this issue only occurs when using ghdl-ls.

Reproduce the bug

  • Create file mini.vim with:
" -----------------------------
" Paths
" -----------------------------

let s:ghdl_p      = 'C:\GHDL\bin'
let s:ghdl_ls_p   = 'C:\Users\pcuser\.local\bin'

if (has('win32') || has('win64'))
 if !executable('ghdl')
   if (isdirectory(s:ghdl_p))
     let $PATH .= ';' . s:ghdl_p
   endif
 endif

 if !executable('ghdl-ls')
   if (isdirectory(s:ghdl_ls_p))
     let $PATH .= ';' . s:ghdl_ls_p
   endif
 endif

endif

" -----------------------------

set nocompatible
set runtimepath^=C:\Neovim\config\nvim\plugged\coc.nvim
filetype plugin indent on
syntax on
set hidden
  • Start (neo)vim with command: vim -u mini.vim

  • Operate vim.

My coc-settings.json:

{
	"suggest.autoTrigger": "always",

	"diagnostic.messageDelay": 0,

	"suggest.triggerCompletionWait" : 30,
	"signature.triggerSignatureWait": 200,

	"languageserver": {
		"ghdlLS": {
			"enable": true,
			"trace.server": "verbose",
			"command": "ghdl-ls",
			"filetypes": [
				"vhdl"
			],
                        "trace.server": "verbose"
		}
	},

	"snippets.userSnippetsDirectory": "$VIMCONFIG/UltiSnips"
}

LSP server config file hdl-prj.json:

{
    "options": {
        "ghdl_analysis": [
            "--workdir=work",
            "--ieee=synopsys",
            "-fexplicit"
        ]
    },
    "files": [
        { "file": "C:/VHDL/entity.vhd", "language": "vhdl" }
    ]
}

hdl-prj.json path:

C:\Test\hdl-prj.json

set pwd? result in Neovim:

C:\Test

ghdl-ls manual execution test in Neovim:

:!ghdl-ls --version
ghdl-ls 1.0-dev

The Issue

It occurs when I load the file added to the LSP config project, or any file of the VHDL type.

Coc.nvim returns:

[coc.nvim] Caught exception while handling initialize, see VHDL language server output for details.
[coc.nvim] Cannot read property 'capabilities' of null
[coc.nvim] Server languageserver.ghdlLS failed to start: TypeError: Cannot read property 'capabilities' of null

CocCommand workspace.showOutput shows an empty buffer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions