all repos

dotfiles @ 1225f8c7c5ed20201254ada5a440695bea084ff1

i use rach linux btw

dotfiles/config/nvim/after/lsp/ts_ls.lua (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
move nvim config in here, 1 month ago
1
---@return vim.lsp.Config
2
return {
3
  cmd = { "typescript-language-server", "--stdio" },
4
  root_markers = { "tsconfig.json", "jsconfig.json", "package.json" },
5
  filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" },
6
  init_options = { hostInfo = "neovim" },
7
  handlers = {
8
    -- handle rename request for certain code actions like extracting functions / types
9
    ["_typescript.rename"] = function(_, result, ctx)
10
      local client = assert(vim.lsp.get_client_by_id(ctx.client_id))
11
      vim.lsp.util.show_document({
12
        uri = result.textDocument.uri,
13
        range = { start = result.position, ["end"] = result.position },
14
      }, client.offset_encoding)
15
      vim.lsp.buf.rename()
16
      return vim.NIL
17
    end,
18
  },
19
}