Browse Source

fix(langs,javascript,typescript): tsserver crashing when switching between js/ts file.

my-config
connorgmeean 3 years ago
parent
commit
9ae483043e
  1. 33
      lua/doom/modules/langs/javascript/init.lua
  2. 4
      lua/doom/modules/langs/typescript/init.lua

33
lua/doom/modules/langs/javascript/init.lua

@ -1,30 +1,3 @@
local javascript = {}
javascript.settings = {}
javascript.autocmds = {
{
"FileType",
"javascript,javascriptreact",
function()
local langs_utils = require('doom.modules.langs.utils')
langs_utils.use_lsp('tsserver')
require("nvim-treesitter.install").ensure_installed("javascript,javascriptreact")
-- Setup null-ls
if doom.modules.linter then
local null_ls = require("null-ls")
langs_utils.use_null_ls_source({
null_ls.builtins.formatting.eslint_d,
null_ls.builtins.code_actions.eslint_d,
null_ls.builtins.diagnostics.eslint_d,
})
end
end,
once = true,
},
}
return javascript
-- Because javascript and typescript use the same tooling,
-- this module is just an alias for the typescript module.
return require('doom.modules.langs.typescript')

4
lua/doom/modules/langs/typescript/init.lua

@ -8,7 +8,7 @@ typescript.settings = {
typescript.autocmds = {
{
"FileType",
"typescript,typescriptreact",
"typescript,typescriptreact,javascript,javascriptreact",
utils.make_run_once_function(function()
print('Configuring typescript')
local langs_utils = require('doom.modules.langs.utils')
@ -16,7 +16,7 @@ typescript.autocmds = {
vim.defer_fn(function()
local ts_install = require("nvim-treesitter.install")
ts_install.ensure_installed("typescript")
ts_install.ensure_installed("typescript", "javascript")
end, 0)
-- Setup null-ls

Loading…
Cancel
Save