Giter Site home page Giter Site logo

vale-ls's People

Contributors

antonkesy avatar augustomelo avatar jdkato avatar just1602 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vale-ls's Issues

unable to initialize vale-ls with custom config location

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.

  • vale-ls/src/vale.rs

    Lines 167 to 178 in 5b4f792

    if filter != "" {
    args.push(format!("--filter={}", filter));
    }
    args.push(fp.to_string());
    let exe = self.exe_path(false)?;
    let out = Command::new(exe.as_os_str())
    .current_dir(cwd)
    .args(args)
    .output()?;
    self.parse_output(out)
  • let out = Command::new(exe.as_os_str()).arg("-v").output()?;

Edit: updated hypothesis

nvim: code actions not working

I've set up vale-ls on my machine for nvim. I get the diagnostics but code actions aren't there. Am I missing something?

vale-ls doesn't work on Windows (fix included)

uri.path() will return /C:/file.txt on windows and call to vale.exe will fail.
uri.path() is returning uri component called "path" (not what we want), i think it's better to use uri.to_file_path() to get file path in correct format.

diff --git a/src/server.rs b/src/server.rs
index c84f874..a3242c0 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -380,7 +380,7 @@ impl Backend {
 
         self.update(params.clone());
         if self.cli.is_installed() {
-            match self.cli.run(uri.path(), self.config_path(), self.config_filter()) {
+            match self.cli.run(uri.to_file_path().unwrap().to_str().unwrap(), self.config_path(), self.config_filter()) {
                 Ok(result) => {
                     let mut diagnostics = Vec::new();
                     for (_, v) in result.iter() {

value-ls Cargo.toml package version (and edition) out-of-sync with actual release

Looking at the latest release:
https://github.com/errata-ai/vale-ls/blob/v0.3.5/Cargo.toml

Why in Cargo.toml, do I see this:

[package]
edition = "2021"
version = "0.1.0"

instead of this?

[package]
edition = "2023"
version = "0.3.5"

Shouldn't those values align with the version of vale-ls?

Background of how this came to my attention:

I'm using mason.nvim inside neovim to install LSP servers for me, and it is clearly downloading v0.3.5:
https://github.com/mason-org/mason-registry/blob/main/packages/vale-ls/package.yaml#L14

However when it reports upon the version of value-ls, 0.1.0 gets returned. This is very misleading, and makes you think you're using an ancient version of vale-ls.

Bug: LSP does not update correctly

In some cases, the diagnostics are updated correctly (move the line up/down), in other cases like deleting the line, the diagnostics stays there even though it is already obsolete.

Pasted.image.2023-12-07.at.03.08.41.mp4

edit: this also occurs when adding an ignore comment:
<!-- vale Google.FirstPerson = NO -->

BUG(Neovim): Late diagnostic updates interfere with autosave and autoformat

The Vale LSP on Neovim is peculiar in that it only updates diagnostics in the buffer after modified files are saved to disk.

Other LSP servers on Neovim usually update diagnostics in near real-time, or when the Editor exits Insert mode.

Vale's LSP behavior breaks things like autosave or autoformat, which are often configured to run when no diagnostic errors are found in the buffer.

It'd be nice to have real-time diagnostics on Neovim to prevent the issue above.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.