Repository navigation
Add unsupported languages
Nguyễn Hoàng Nam edited this page Sep 18, 2022
·
1 revision
You can add unsupported languages by follow these steps.
If Treesitter supports your language, then you can run this command to install syntax highlight.
:TSInstall <language>
You can find server for your language Here.
After you've installed the LSP, you need to create a file in after/ftplugin,
lua/languages.
-- lua/langauges/your-language.lua
local lsp = require('languages.lsp')
local M = {}
M.lsp_server = '<name of LSP>'
M.lsp = {
capabilities = lsp.capabilities,
on_attach = lsp.on_attach,
-- Any extra configuration should put there
}
return M-- after/ftplugin/your-language.lua
vim.opt.indentexpr = 'nvim_treesitter#indent()' -- Optional, If you use indent of treesitter
require('cmp').setup.buffer({
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' }, -- Optional, If you use snippet
{ name = 'path' }, -- Optional, If your language need path
{ name = 'nvim_lsp_signature_help' }, -- Optional, If your language has signature
},
})You also need to add your language to /lua/settings.lua
-- /lua/settings.lua
return {
lspconfigs = {
filetypes = {
...,
'<your lanugage>',
...,
},
},
}You need to install these tools first then go to /lua/languages/<your language>.lua
-- /lua/languages/<your language>.lua
M.efm = {
{
formatCommand = 'formatter1',
formatStdin = true,
},
{
formatCommand = 'formatter2',
formatStdin = true,
},
{
lintCommand = 'linter1',
lintIgnoreExitCode = true,
lintStdin = true,
lintFormats = {
'Your linter format',
},
},
}
M.all_format = { efm = 'Formatter1 Formatter2 Linter1' }
M.default_format = 'efm'You can check debug server here
You can check test tools here