From dc7709887710d17ca353bc42199572c4a9455ad8 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Mon, 22 May 2023 17:54:53 -0500 Subject: [PATCH] feat(nvim): better attach azure pipelines ls for azure pipeline files --- .../nvim/after/ftplugin/azure-pipelines.lua | 4 ++++ dots/.config/nvim/lua/core/filetypes.lua | 9 ++++++++- dots/.config/nvim/lua/plugins/configs/lsp.lua | 20 ++++++------------- 3 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 dots/.config/nvim/after/ftplugin/azure-pipelines.lua diff --git a/dots/.config/nvim/after/ftplugin/azure-pipelines.lua b/dots/.config/nvim/after/ftplugin/azure-pipelines.lua new file mode 100644 index 00000000..c7b84cb5 --- /dev/null +++ b/dots/.config/nvim/after/ftplugin/azure-pipelines.lua @@ -0,0 +1,4 @@ +local opt_local = vim.opt_local + +opt_local.tabstop = 2 +opt_local.shiftwidth = 2 diff --git a/dots/.config/nvim/lua/core/filetypes.lua b/dots/.config/nvim/lua/core/filetypes.lua index e23e371b..6368838c 100644 --- a/dots/.config/nvim/lua/core/filetypes.lua +++ b/dots/.config/nvim/lua/core/filetypes.lua @@ -2,11 +2,18 @@ local M = {} M.setup = function() vim.filetype.add({ + filename = { + ['.dockerignore'] = "dockerignore" + }, pattern = { [".*%.dockerfile"] = "dockerfile", - [".*%.dockerignore"] = "gitignore", + [".*/Azure%-Pipelines/.*%.yml"] = "azure-pipelines", + [".*/Azure%-Pipelines/.*%.yaml"] = "azure-pipelines", }, }) + + vim.treesitter.language.register("yaml", "azure-pipelines") + vim.treesitter.language.register("gitignore", "dockerignore") end return M diff --git a/dots/.config/nvim/lua/plugins/configs/lsp.lua b/dots/.config/nvim/lua/plugins/configs/lsp.lua index 2a8fca1c..ae506668 100755 --- a/dots/.config/nvim/lua/plugins/configs/lsp.lua +++ b/dots/.config/nvim/lua/plugins/configs/lsp.lua @@ -254,23 +254,15 @@ lspconfig.azure_pipelines_ls.setup({ }, }, yaml = { - schemas = require("schemastore").yaml.schemas({ - replace = { - ["Azure Pipelines"] = { - description = "Azure Pipelines override", - fileMatch = { - "/azure-pipeline*.y*l", - "/*.azure*", - "Azure-Pipelines/**/*.y*l", - "Pipelines/*.y*l", - }, - name = "Azure Pipelines", - url = "https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json", - }, + schemas = { + ["https://raw.githubusercontent.com/microsoft/azure-pipelines-vscode/master/service-schema.json"] = { + "*.yml", + "*.yaml", }, - }), + }, }, }, + filetypes = "azure-pipelines", capabilities = lsp_capabilities, on_attach = on_attach, })