Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Languagetool Linter Throws Error #60

Closed
0drai opened this issue Jul 27, 2021 · 2 comments · Fixed by #98
Closed

Languagetool Linter Throws Error #60

0drai opened this issue Jul 27, 2021 · 2 comments · Fixed by #98

Comments

@0drai
Copy link

0drai commented Jul 27, 2021

languagetool throws an error:

Here is a minimal working example

local fn = vim.fn
local install_path = '/tmp/nvim/site/pack/packer/start/packer.nvim'

vim.cmd [[set packpath=/tmp/nvim/site]]

local function load_plugins()
    local use = require('packer').use
    require('packer').startup {
        function()
            use {
                'mfussenegger/nvim-lint',
                config = function()
                    local lint = require('lint')
                    lint.linters_by_ft = {text = {'languagetool'}}
                    vim.cmd(
                        [[au BufEnter <buffer> lua require('lint').try_lint() ]])
                    vim.cmd(
                        [[au BufWritePost <buffer> lua require('lint').try_lint() ]])
                end
            }
        end,
        config = {package_root = '/tmp/nvim/site/pack'}
    }
end

-- install packer
if fn.isdirectory(install_path) == 0 then
    fn.system {
        'git', 'clone', 'https://github.com/wbthomason/packer.nvim',
        install_path
    }
    load_plugins()
    require('packer').sync()
    vim.cmd 'autocmd User PackerComplete ++once lua load_config()'
else
    load_plugins()
end

This is the error message

Error executing vim.schedule lua callback: ...vim/site/pack/packer/start/nvim-lint/lua/lint
/parser.lua:114: Vim:E474: Unidentified byte: Working on /tmp/words.txt...
Using English for file /tmp/words.txt

This is my languagetool wrapper script

#!/bin/env bash

LT=~/.local/share/LanguageTool-5.4/languagetool-commandline.jar

java -jar $LT $@

It seems like it tries to parse JSON on the first chunk of the response, i.e., “Working on …”.

@0drai
Copy link
Author

0drai commented Sep 9, 2021

An alternative to nvim-lint + languagetool, is to use the ltex-ls.

@mfussenegger
Copy link
Owner

Should be fixed with #98

Not entirely sure if the offset -> line/col conversion is solid, I think it could break if there are \r\n instead of \n within the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants