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

handle commands on the client side #49

Open
aspeddro opened this issue Mar 29, 2022 · 1 comment
Open

handle commands on the client side #49

aspeddro opened this issue Mar 29, 2022 · 1 comment

Comments

@aspeddro
Copy link

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
@weilbith
Copy link
Owner

weilbith commented Mar 30, 2022

Hey 👋🏾
Thanks for the detailed issue report. 🙏🏾

I guess I somehow need to apply this part of what NeoVim core does. Unfortunately it is inside a not accessible function. 😑

I would be happy if you would open a PR which adds this functionality I linked. You have already the perfect test environment for this "feature", so a contribution would be the optimal case for me. Else I'll try to find some time. But usually if I find the time and motivation to rather work on version 2.0 of this plugin...

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

Successfully merging a pull request may close this issue.

2 participants