aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authormineo <euonymuslke@gmail.com>2025-01-05 17:33:52 +0900
committerGitHub <noreply@github.com>2025-01-05 16:33:52 +0800
commitacb88a4872033fddd8c2fe7e6251bc17ee4d2168 (patch)
treef8fed821cdedbfb5995ecabec31597dbc15b5a90 /lua
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-acb88a4872033fddd8c2fe7e6251bc17ee4d2168.tar
nvim-lspconfig-acb88a4872033fddd8c2fe7e6251bc17ee4d2168.tar.gz
nvim-lspconfig-acb88a4872033fddd8c2fe7e6251bc17ee4d2168.tar.bz2
nvim-lspconfig-acb88a4872033fddd8c2fe7e6251bc17ee4d2168.tar.lz
nvim-lspconfig-acb88a4872033fddd8c2fe7e6251bc17ee4d2168.tar.xz
nvim-lspconfig-acb88a4872033fddd8c2fe7e6251bc17ee4d2168.tar.zst
nvim-lspconfig-acb88a4872033fddd8c2fe7e6251bc17ee4d2168.zip
feat: atlas language server (#3539)
* feat: atlas added autocmd add stdio option * docs: added vim.filetype.add pattern
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/configs/atlas.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/lua/lspconfig/configs/atlas.lua b/lua/lspconfig/configs/atlas.lua
new file mode 100644
index 00000000..b862f3d7
--- /dev/null
+++ b/lua/lspconfig/configs/atlas.lua
@@ -0,0 +1,54 @@
+local util = require 'lspconfig.util'
+
+return {
+ default_config = {
+ cmd = { 'atlas', 'tool', 'lsp', '--stdio' },
+ filetypes = {
+ 'atlas-*',
+ },
+ root_dir = function(fname)
+ return util.root_pattern('atlas.hcl')(fname)
+ end,
+ single_file_support = true,
+ },
+ docs = {
+ description = [[
+https://github.com/ariga/atlas
+
+Language server for Atlas config and scheme files.
+
+You may also need to configure the filetype for *.hcl files:
+
+`autocmd BufNewFile,BufRead atlas.hcl set filetype=atlas-config`
+`autocmd BufNewFile,BufRead *.my.hcl set filetype=atlas-schema-mysql`
+`autocmd BufNewFile,BufRead *.pg.hcl set filetype=atlas-schema-postgresql`
+`autocmd BufNewFile,BufRead *.lt.hcl set filetype=atlas-schema-sqlite`
+`autocmd BufNewFile,BufRead *.ch.hcl set filetype=atlas-schema-clickhouse`
+`autocmd BufNewFile,BufRead *.ms.hcl set filetype=atlas-schema-mssql`
+`autocmd BufNewFile,BufRead *.rs.hcl set filetype=atlas-schema-redshift`
+`autocmd BufNewFile,BufRead *.test.hcl set filetype=atlas-test`
+`autocmd BufNewFile,BufRead *.plan.hcl set filetype=atlas-plan`
+
+or
+
+```lua
+vim.filetype.add({
+ filename = {
+ ['atlas.hcl'] = 'atlas-config',
+ },
+ pattern = {
+ ['.*/*.my.hcl'] = 'atlas-schema-mysql',
+ ['.*/*.pg.hcl'] = 'atlas-schema-postgresql',
+ ['.*/*.lt.hcl'] = 'atlas-schema-sqlite',
+ ['.*/*.ch.hcl'] = 'atlas-schema-clickhouse',
+ ['.*/*.ms.hcl'] = 'atlas-schema-mssql',
+ ['.*/*.rs.hcl'] = 'atlas-schema-redshift',
+ ['.*/*.test.hcl'] = 'atlas-test',
+ ['.*/*.plan.hcl'] = 'atlas-plan',
+ },
+})
+```
+
+]],
+ },
+}