Skip to content

davidosomething/coc-diagnostics-shim.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

coc-diagnostics-shim.nvim

This neovim plugin provides ale#other_source#ShowResults so coc.nvim with diagnostic.displayByAle can pipe diagnostics directly to vim.diagnostic without installing the entirety of dense-analysis/ale

This plugin conflicts with dense-analysis/ale so make sure you don't have both!

Installation

Lazy.nvim add:

{
    "davidosomething/coc-diagnostics-shim.nvim"
}

coc-settings.json add:

{
  ...
  "diagnostic.displayByAle": true,
  ...
}

Tips

You can configure the plugin with formatters, i.e. with

  {
    "neoclide/coc.nvim",
    branch = "release",
    dependencies = {
      "davidosomething/format-ts-errors.nvim",
      "davidosomething/coc-diagnostics-shim.nvim",
    },
    init = function()
      vim.g.coc_start_at_startup = true
      vim.g.coc_global_extensions = {
        "coc-json",
        "coc-tsserver",
        -- "coc-pretty-ts-errors" -- using format-ts-errors instead, remove and uninstall this!
      }

      require("coc-diagnostics-shim").setup({
        formatters = {
          coctsserver = {
            ---@diagnostic disable-next-line: unused-local
            function(linter_name, item, formatted)
              local prettifier = require("format-ts-errors")[item.code]
              if not prettifier then
                vim.print("no prettifier for " .. item.code)
                return formatted
              end
              local prettified = prettifier(item.text)
              return ("%s%s"):format(
                prettified,
                "ꜰᴏʀᴍᴀᴛᴛᴇᴅ ᴡɪᴛʜ ꜰᴏʀᴍᴀᴛ-ᴛs-ᴇʀʀᴏʀs.ɴᴠɪᴍ"
              )
            end,
          },
        },
      })
    end,
  },

License

MIT

About

Provide ale diagnostics handler for coc.nvim without ale itself

Topics

Resources

License

Stars

Watchers

Forks