Skip to content

unable to initialize vale-ls with custom config location #4

@augustomelo

Description

@augustomelo

I have vale installed on my machine and the config are on $XDG_CONFIG_HOME, since vale only looks for vale.ini under $HOME the usual way that run vale is for example vale sync --config='$XDG_CONFIG_HOME/vale/vale.ini'.

So I am currently trying to run vale-ls and say that the way to pass the config location is through initializationOptions.configPath and I am doing so (example bellow with neovim lspconfig)

  require('lspconfig').vale_ls.setup{
      capabilities = capabilities,
      filetypes = { 'gitcommit', 'markdown', 'text' },
      init_options = {
        configPath = vim.env.XDG_CONFIG_HOME .. '/vale/vale.ini'
      },
    }

I also tried to pass a path (vim.env.XDG_CONFIG_HOME .. '/vale/) on the configPath, but I keep getting the following error (log from nvim):

[DEBUG][2023-07-14 09:07:14] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = "initialized!",    type = 3  }}
[TRACE][2023-07-14 09:07:14] .../lua/vim/lsp.lua:1053	"notification"	"window/logMessage"	{  message = "initialized!",  type = 3}
[TRACE][2023-07-14 09:07:14] ...lsp/handlers.lua:618	"default_handler"	"window/logMessage"	{  ctx = '{\n  client_id = 1,\n  method = "window/logMessage"\n}',  result = {    message = "initialized!",    type = 3  }}
[INFO][2023-07-14 09:07:14] ...lsp/handlers.lua:539	"initialized!"
[DEBUG][2023-07-14 09:07:15] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/logMessage",  params = {    message = 'Parsing error: Msg("{\\n  \\"Code\\": \\"E100\\",\\n  \\"Text\\": \\"E100 [.vale.ini not found] Runtime error\\\\n\\\\nopen : no such file or directory\\\\n\\\\nExecution stopped with code 1.\\"\\n}\\n")',    type = 1  }}
[TRACE][2023-07-14 09:07:15] .../lua/vim/lsp.lua:1053	"notification"	"window/logMessage"	{  message = 'Parsing error: Msg("{\\n  \\"Code\\": \\"E100\\",\\n  \\"Text\\": \\"E100 [.vale.ini not found] Runtime error\\\\n\\\\nopen : no such file or directory\\\\n\\\\nExecution stopped with code 1.\\"\\n}\\n")',  type = 1}
[TRACE][2023-07-14 09:07:15] ...lsp/handlers.lua:618	"default_handler"	"window/logMessage"	{  ctx = '{\n  client_id = 1,\n  method = "window/logMessage"\n}',  result = {    message = 'Parsing error: Msg("{\\n  \\"Code\\": \\"E100\\",\\n  \\"Text\\": \\"E100 [.vale.ini not found] Runtime error\\\\n\\\\nopen : no such file or directory\\\\n\\\\nExecution stopped with code 1.\\"\\n}\\n")',    type = 1  }}
[ERROR][2023-07-14 09:07:15] ...lsp/handlers.lua:535	'Parsing error: Msg("{\\n  \\"Code\\": \\"E100\\",\\n  \\"Text\\": \\"E100 [.vale.ini not found] Runtime error\\\\n\\\\nopen : no such file or directory\\\\n\\\\nExecution stopped with code 1.\\"\\n}\\n")'
[DEBUG][2023-07-14 09:07:15] .../vim/lsp/rpc.lua:387	"rpc.receive"	{  jsonrpc = "2.0",  method = "window/showMessage",  params = {    message = "missing field `Path` at line 4 column 1",    type = 1  }}
[TRACE][2023-07-14 09:07:15] .../lua/vim/lsp.lua:1053	"notification"	"window/showMessage"	{  message = "missing field `Path` at line 4 column 1",  type = 1}
[TRACE][2023-07-14 09:07:15] ...lsp/handlers.lua:618	"default_handler"	"window/showMessage"	{  ctx = '{\n  client_id = 1,\n  method = "window/showMessage"\n}',  result = {    message = "missing field `Path` at line 4 column 1",    type = 1  }}

I believe the error is coming form a couple a functions that runs the vale command without taking the --config into consideration.

Edit: updated hypothesis

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions