Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

handle commands on the client side #49

@aspeddro

Description

@aspeddro

Some commands on the ltex lsp are resolved on the client side.

Example:

  • _ltex.addToDictionary
  • _ltex.disableRules
  • _ltex.hideFalsePositives

Docs: ltex commands

local lspconfig = require 'lspconfig'
local opts = {
  root_dir = function(filename)
    return lspconfig.util.path.dirname(filename)
  end,
  on_init = function(client, _)
    vim.lsp.commands['_ltex.addToDictionary'] = function(cmd, ctx)
      print(vim.inspect { cmd, ctx })
    end
  end,
  settings = {
    ltex = {
      completionEnabled = true,
      language = 'en-US',
      checkFrequency = 'edit',
      setenceCacheSize = 5000,
      additionalRules = {
        enablePickyRules = true,
        motherTongue = 'en-US',
      },
      dictionary = {
        ['en-US'] = { 'Hello', 'Neovim' },
      },
    },
  },
}
lspconfig.ltex.setup(opts)

Using :CodeActionMenu not run the command _ltex.addToDictionary. But using :lua vim.lsp.buf.code_action() works.

2022-03-29_17-44_42.mp4

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

    Issue actions