Skip to content

fix: register user_commands with LspAttach augroup instead of ftplugin #358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ftplugin/javascript.lua

This file was deleted.

1 change: 0 additions & 1 deletion ftplugin/javascriptreact.lua

This file was deleted.

1 change: 0 additions & 1 deletion ftplugin/typescript.lua

This file was deleted.

1 change: 0 additions & 1 deletion ftplugin/typescriptreact.lua

This file was deleted.

3 changes: 3 additions & 0 deletions lua/typescript-tools/autocommands/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local diagnostics = require "typescript-tools.autocommands.diagnostics"
local code_lens = require "typescript-tools.autocommands.code_lens"
local config = require "typescript-tools.config"
local jsx_close_tag = require "typescript-tools.autocommands.jsx_close_tag"
local user_commands = require "typescript-tools.autocommands.user_commands"

local M = {}

Expand All @@ -16,6 +17,8 @@ function M.setup_autocommands(dispatchers)
if config.jsx_close_tag.enable then
jsx_close_tag.setup_jsx_close_tag_autocmds()
end

user_commands.autosetup_user_commands()
end

return M
14 changes: 14 additions & 0 deletions lua/typescript-tools/autocommands/user_commands.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
local api = vim.api
local common = require "typescript-tools.autocommands.common"

local M = {}

function M.autosetup_user_commands()
local augroup = api.nvim_create_augroup("TypescriptToolsUserCommandsGroup", { clear = true })

common.create_lsp_attach_augcmd(function()
require("typescript-tools.user_commands").setup_user_commands()
end, augroup)
end

return M