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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vale-ls's Issues

Panic in code_action()

initialized!
configuration changed!
stderr: thread 'main' panicked at src/server.rs:318:61:
stderr: called `Option::unwrap()` on a `None` value
stderr: stack backtrace:
stderr: 0: rust_begin_unwind
stderr: 1: core::panicking::panic_fmt
stderr: 2: core::panicking::panic
stderr: 3: core::option::unwrap_failed
stderr: 4: <vale_ls::server::Backend as tower_lsp::LanguageServer>::code_action::{{closure}}
stderr: 5: tower_lsp::jsonrpc::router::Router<S,E>::method::{{closure}}::{{closure}}::{{closure}}
stderr: 6: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
stderr: 7: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
stderr: 8: <futures_util::future::either::Either<A,B> as core::future::future::Future>::poll
stderr: 9: <core::pin::Pin<P> as core::future::future::Future>::poll
stderr: 10: <tower_lsp::service::LspService<S> as tower_service::Service<tower_lsp::jsonrpc::Request>>::call::{{closure}}
stderr: 11: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll
stderr: 12: <futures_util::stream::futures_unordered::FuturesUnordered<Fut> as futures_core::stream::Stream>::poll_next
stderr: 13: <futures_util::stream::stream::buffer_unordered::BufferUnordered<St> as futures_core::stream::Stream>::poll_next
stderr: 14: <futures_util::stream::stream::map::Map<St,F> as futures_core::stream::Stream>::poll_next
stderr: 15: <futures_util::stream::stream::forward::Forward<St,Si,Item> as core::future::future::Future>::poll
stderr: 16: <futures_util::future::maybe_done::MaybeDone<Fut> as core::future::future::Future>::poll
stderr: 17: <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
stderr: 18: tokio::runtime::context::runtime::enter_runtime
stderr: 19: tokio::runtime::runtime::Runtime::block_on
stderr: 20: vale_ls::main
stderr: note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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() {

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 -->

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?

sublimetext - vale-ls: thread 'main' panicked

Fedora Linux 39 (Workstation Edition)
Linux 6.8.11-200.fc39.x86_64
Sublime version 4175

vale-ls suddenly stopped working. I have tried installing and reinstalling, nothing seems to work. Vale-ls does not lint in the Sublime editor.

I see errors like this in the LSP log:

:: [11:21:21.735] --> vale-ls initialize (1): {'processId': 28627, 'clientInfo': {'name': 'Sublime Text LSP', 'version': '2.1.0'}, 'rootUri': 'file://home/aireilly/openshift-docs', 'rootPath': '//home/aireilly/openshift-docs', 'workspaceFolders': [{'name': 'openshift-docs', 'uri': 'file://home/aireilly/openshift-docs'}], 'capabilities': {'general': {'regularExpressions': {'engine': 'ECMAScript'}, 'markdown': {'parser': 'Python-Markdown', 'version': '3.2.2'}}, 'textDocument': {'synchronization': {'dynamicRegistration': True, 'didSave': True, 'willSave': True, 'willSaveWaitUntil': True}, 'hover': {'dynamicRegistration': True, 'contentFormat': [<MarkupKind.Markdown: 'markdown'>, <MarkupKind.PlainText: 'plaintext'>]}, 'completion': {'dynamicRegistration': True, 'completionItem': {'snippetSupport': True, 'deprecatedSupport': True, 'documentationFormat': [<MarkupKind.Markdown: 'markdown'>, <MarkupKind.PlainText: 'plaintext'>], 'tagSupport': {'valueSet': [1]}, 'resolveSupport': {'properties': ['detail', 'documentation', 'additionalTextEdits']}, 'insertReplaceSupport': True, 'insertTextModeSupport': {'valueSet': [2]}, 'labelDetailsSupport': True}, 'completionItemKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]}, 'insertTextMode': 2, 'completionList': {'itemDefaults': ['editRange', 'insertTextFormat', 'data']}}, 'signatureHelp': {'dynamicRegistration': True, 'contextSupport': True, 'signatureInformation': {'activeParameterSupport': True, 'documentationFormat': [<MarkupKind.Markdown: 'markdown'>, <MarkupKind.PlainText: 'plaintext'>], 'parameterInformation': {'labelOffsetSupport': True}}}, 'references': {'dynamicRegistration': True}, 'documentHighlight': {'dynamicRegistration': True}, 'documentSymbol': {'dynamicRegistration': True, 'hierarchicalDocumentSymbolSupport': True, 'symbolKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}, 'tagSupport': {'valueSet': [1]}}, 'documentLink': {'dynamicRegistration': True, 'tooltipSupport': True}, 'formatting': {'dynamicRegistration': True}, 'rangeFormatting': {'dynamicRegistration': True, 'rangesSupport': True}, 'declaration': {'dynamicRegistration': True, 'linkSupport': True}, 'definition': {'dynamicRegistration': True, 'linkSupport': True}, 'typeDefinition': {'dynamicRegistration': True, 'linkSupport': True}, 'implementation': {'dynamicRegistration': True, 'linkSupport': True}, 'codeAction': {'dynamicRegistration': True, 'codeActionLiteralSupport': {'codeActionKind': {'valueSet': [<CodeActionKind.QuickFix: 'quickfix'>, <CodeActionKind.Refactor: 'refactor'>, <CodeActionKind.RefactorExtract: 'refactor.extract'>, <CodeActionKind.RefactorInline: 'refactor.inline'>, <CodeActionKind.RefactorRewrite: 'refactor.rewrite'>, <CodeActionKind.SourceFixAll: 'source.fixAll'>, <CodeActionKind.SourceOrganizeImports: 'source.organizeImports'>]}}, 'dataSupport': True, 'isPreferredSupport': True, 'resolveSupport': {'properties': ['edit']}}, 'rename': {'dynamicRegistration': True, 'prepareSupport': True, 'prepareSupportDefaultBehavior': 1}, 'colorProvider': {'dynamicRegistration': True}, 'publishDiagnostics': {'relatedInformation': True, 'tagSupport': {'valueSet': [1, 2]}, 'versionSupport': True, 'codeDescriptionSupport': True, 'dataSupport': True}, 'diagnostic': {'dynamicRegistration': True, 'relatedDocumentSupport': True}, 'selectionRange': {'dynamicRegistration': True}, 'foldingRange': {'dynamicRegistration': True, 'foldingRangeKind': {'valueSet': [<FoldingRangeKind.Comment: 'comment'>, <FoldingRangeKind.Imports: 'imports'>, <FoldingRangeKind.Region: 'region'>]}}, 'codeLens': {'dynamicRegistration': True}, 'inlayHint': {'dynamicRegistration': True, 'resolveSupport': {'properties': ['textEdits', 'label.command']}}, 'semanticTokens': {'dynamicRegistration': True, 'requests': {'range': True, 'full': {'delta': True}}, 'tokenTypes': [<SemanticTokenTypes.Namespace: 'namespace'>, <SemanticTokenTypes.Type: 'type'>, <SemanticTokenTypes.Class: 'class'>, <SemanticTokenTypes.Enum: 'enum'>, <SemanticTokenTypes.Interface: 'interface'>, <SemanticTokenTypes.Struct: 'struct'>, <SemanticTokenTypes.TypeParameter: 'typeParameter'>, <SemanticTokenTypes.Parameter: 'parameter'>, <SemanticTokenTypes.Variable: 'variable'>, <SemanticTokenTypes.Property: 'property'>, <SemanticTokenTypes.EnumMember: 'enumMember'>, <SemanticTokenTypes.Event: 'event'>, <SemanticTokenTypes.Function: 'function'>, <SemanticTokenTypes.Method: 'method'>, <SemanticTokenTypes.Macro: 'macro'>, <SemanticTokenTypes.Keyword: 'keyword'>, <SemanticTokenTypes.Modifier: 'modifier'>, <SemanticTokenTypes.Comment: 'comment'>, <SemanticTokenTypes.String: 'string'>, <SemanticTokenTypes.Number: 'number'>, <SemanticTokenTypes.Regexp: 'regexp'>, <SemanticTokenTypes.Operator: 'operator'>, <SemanticTokenTypes.Decorator: 'decorator'>], 'tokenModifiers': [<SemanticTokenModifiers.Declaration: 'declaration'>, <SemanticTokenModifiers.Definition: 'definition'>, <SemanticTokenModifiers.Readonly: 'readonly'>, <SemanticTokenModifiers.Static: 'static'>, <SemanticTokenModifiers.Deprecated: 'deprecated'>, <SemanticTokenModifiers.Abstract: 'abstract'>, <SemanticTokenModifiers.Async: 'async'>, <SemanticTokenModifiers.Modification: 'modification'>, <SemanticTokenModifiers.Documentation: 'documentation'>, <SemanticTokenModifiers.DefaultLibrary: 'defaultLibrary'>], 'formats': [<TokenFormat.Relative: 'relative'>], 'overlappingTokenSupport': False, 'multilineTokenSupport': True, 'augmentsSyntaxTokens': True}, 'callHierarchy': {'dynamicRegistration': True}, 'typeHierarchy': {'dynamicRegistration': True}}, 'workspace': {'applyEdit': True, 'didChangeConfiguration': {'dynamicRegistration': True}, 'executeCommand': {}, 'workspaceEdit': {'documentChanges': True, 'failureHandling': <FailureHandlingKind.Abort: 'abort'>}, 'workspaceFolders': True, 'symbol': {'dynamicRegistration': True, 'resolveSupport': {'properties': ['location.range']}, 'symbolKind': {'valueSet': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]}, 'tagSupport': {'valueSet': [1]}}, 'configuration': True, 'codeLens': {'refreshSupport': True}, 'inlayHint': {'refreshSupport': True}, 'semanticTokens': {'refreshSupport': True}, 'diagnostics': {'refreshSupport': True}}, 'window': {'showDocument': {'support': True}, 'showMessage': {'messageActionItem': {'additionalPropertiesSupport': True}}, 'workDoneProgress': True}}, 'initializationOptions': {'RUST_BACKTRACE': 1, 'configPath': '', 'filter': '', 'installVale': True, 'syncOnStartup': True}}

vale-ls: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', src/server.rs:38:18
vale-ls: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Server diagnostics

Troubleshooting: vale-ls

Version

  • LSP: 2.1.0
  • Sublime Text: 4175

Server Test Run

  • exit code: 0
  • output

Server Configuration

  • command
[
  "${storage_path}/LSP-vale-ls/vale-ls"
]
  • shell command
"/home/aireilly/.cache/sublime-text/Package Storage/LSP-vale-ls/vale-ls"
  • selector
source.ini | source.yaml | text.html.markdown | text.restructuredtext | text.asciidoc
  • priority_selector
source.ini | source.yaml | text.html.markdown | text.restructuredtext | text.asciidoc
  • init_options
{
  "RUST_BACKTRACE": 1,
  "configPath": "",
  "filter": "",
  "installVale": true,
  "syncOnStartup": true
}
  • settings
{}
  • env
{}

Active view

  • File name
//home/aireilly/openshift-docs/edge_computing/ztp-advanced-install-ztp.adoc
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
  "lsp_active": null,
  "syntax": "Packages/ST3-Asciidoctor/Syntaxes/Asciidoctor.sublime-syntax"
}
  • base scope
text.asciidoc

Project / Workspace

  • folders
[
  "//home/aireilly/openshift-docs"
]
  • is project: True
  • project data:
{
  "folders": [
    {
      "follow_symlinks": false,
      "path": "."
    }
  ],
  "settings": {
    "source_folder": "."
  }
}

LSP configuration

{
  "clients": {},
  "diagnostics_gutter_marker": "circle",
  "diagnostics_highlight_style": {
    "error": "squiggly",
    "hint": "squiggly",
    "info": "stippled",
    "warning": "squiggly"
  },
  "log_debug": true,
  "lsp_format_on_save": false,
  "show_code_lens": "annotation",
  "show_diagnostics_panel_on_save": 0
}

System PATH

  • /home/aireilly/.nvm/versions/node/v20.9.0/bin
  • /home/aireilly/.local/bin
  • /usr/local/bin
  • /home/aireilly/bin
  • /usr/local/bin
  • /usr/local/sbin
  • /usr/bin
  • /usr/sbin
  • /home/aireilly/bin/dita-ot-4.2.3/bin
  • /usr/local/go/bin
  • /home/aireilly/.rvm/bin

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.

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

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.

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.