Skip to content

Error when applying fix to last error in file #109

@DanRoscigno

Description

@DanRoscigno

Thanks for Grammarous, I really like using it. When I am working in a file and applying the recommended fixes the final fix causes an error:

Error detected while processing function grammarous#info_win#action_fixit[1]
..grammarous#fixit[27]..function grammarous#info_win#action_fixit[1]..gramma
rous#fixit[21]..grammarous#remove_error[7]..grammarous#info_win#close[17]..C
ursorMoved Autocommands for "<buffer=1>"..function <SNR>52_do_auto_preview[1
6]..grammarous#create_update_info_window_of[9]..grammarous#info_win#open:   
line    1:                                                                  
E242: Can't split a window while closing another 

This happens whether I am applying the fix from the window where my text is, or if I am in the Grammarous info window. When I am in the window where my text is, I am using grammarous-fixit, and if I switch to the Grammarous info window I am using f.

Note: The fix is applied, and a few :q commands gets me out of vi and everything is fine.

Activity

kikofmas

kikofmas commented on Jan 12, 2024

@kikofmas

I am encountering the same issue, did you manage to fix it?

DanRoscigno

DanRoscigno commented on Jan 12, 2024

@DanRoscigno
Author

Hi @kikofmas I didn't. I am now using this config:

-- configure ltex-ls
require 'ltex-ls'.setup {
  on_attach = on_attach,
  capabilities = capabilities,
  use_spellfile = false,
  filetypes = { "latex", "tex", "bib", "markdown", "gitcommit", "text" },
  settings = {
    ltex = {
      enabled = { "latex", "tex", "bib", "markdown", },
      language = "en",
      diagnosticSeverity = "information",
      sentenceCacheSize = 2000,
      additionalRules = {
        -- download ngrams from
        -- https://dev.languagetool.org/finding-errors-using-n-gram-data.html
        languageModel = '~/ngrams/',
        enablePickyRules = true,
        motherTongue = "en",
      },
      disabledRules = {
        en = { "EN_QUOTES" }
      },
      dictionary = (function()
        ---- For dictionary, search for files in the runtime to have
        ---- and include them as externals the format for them is
        ---- dict/{LANG}.txt
        ----
        ---- Also add dict/default.txt to all of them
        local files = {}
        for _, file in ipairs(vim.api.nvim_get_runtime_file("dict/*", true)) do
          local lang = vim.fn.fnamemodify(file, ":t:r")
          local fullpath = vim.fs.normalize(file, ":p")
          files[lang] = { ":" .. fullpath }
        end
--
        if files.default then
          for lang, _ in pairs(files) do
            if lang ~= "default" then
              vim.list_extend(files[lang], files.default)
            end
          end
          files.default = nil
        end
        return files
      end)(),
    },
  },
}
kikofmas

kikofmas commented on Jan 17, 2024

@kikofmas

Hi @DanRoscigno, thank you for your reply! Unfortunately, it didn't have the exact functionality I wanted.
So I did create a fork to fix this and other issues I found. I managed to fix them, here's the link if you feel like checking it out: https://github.com/kikofmas/grammarous.nvim

The goal is to transition it to Lua as a way for me to learn both vim script and Lua.

DanRoscigno

DanRoscigno commented on Jan 17, 2024

@DanRoscigno
Author

Thanks @kikofmas , I may give it a try. Unfortunately my team uses VS Code, so I am trying to use that to be in sync with the rest of the team, so neovim does not get much use by me lately :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @DanRoscigno@kikofmas

        Issue actions

          Error when applying fix to last error in file · Issue #109 · rhysd/vim-grammarous