add proper angular support
This commit is contained in:
parent
ae9aa49359
commit
33a5bd4b2a
3 changed files with 14 additions and 3 deletions
|
|
@ -32,16 +32,29 @@ return {
|
|||
'astro',
|
||||
'vue',
|
||||
'java',
|
||||
'angular',
|
||||
}
|
||||
|
||||
for _, parser in ipairs(parsers) do
|
||||
ts.install(parser)
|
||||
end
|
||||
|
||||
-- Detect Angular HTML templates and set filetype to htmlangular
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = 'html',
|
||||
callback = function(ev)
|
||||
local root = vim.fs.root(ev.buf, { 'angular.json' })
|
||||
if root then
|
||||
vim.bo[ev.buf].filetype = 'htmlangular'
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Filetypes whose name differs from the parser name
|
||||
local ft_to_parser = {
|
||||
typescriptreact = 'tsx',
|
||||
javascriptreact = 'jsx',
|
||||
htmlangular = 'angular',
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
|
|
|
|||
|
|
@ -47,5 +47,3 @@ vim.diagnostic.config({
|
|||
update_in_insert = false, -- update diagnostics in insert mod
|
||||
severity_sort = true, -- sort diagnostics by severity
|
||||
})
|
||||
|
||||
require('vim._core.ui2').enable({})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue