From febbbad7bdba5d0c62e6b1d89cb408c7991a609f Mon Sep 17 00:00:00 2001 From: Mariano Lambir <117318+mlambir@users.noreply.github.com> Date: Thu, 13 Jul 2023 08:57:26 -0300 Subject: [PATCH] feat(pack): add wgsl pack (#415) * feat(pack): add wgsl pack * Restructure treesitter dependencies --------- Co-authored-by: Micah Halter --- lua/astrocommunity/pack/wgsl/README.md | 6 ++++++ lua/astrocommunity/pack/wgsl/init.lua | 28 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 lua/astrocommunity/pack/wgsl/README.md create mode 100644 lua/astrocommunity/pack/wgsl/init.lua diff --git a/lua/astrocommunity/pack/wgsl/README.md b/lua/astrocommunity/pack/wgsl/README.md new file mode 100644 index 000000000..a92988d1a --- /dev/null +++ b/lua/astrocommunity/pack/wgsl/README.md @@ -0,0 +1,6 @@ +# wgsl Language Pack + +This plugin pack does the following: + +- Adds `wgsl` Treesitter parser: +- Adds `wgsl` language server diff --git a/lua/astrocommunity/pack/wgsl/init.lua b/lua/astrocommunity/pack/wgsl/init.lua new file mode 100644 index 000000000..068fea4da --- /dev/null +++ b/lua/astrocommunity/pack/wgsl/init.lua @@ -0,0 +1,28 @@ +local utils = require "astronvim.utils" +return { + { + "nvim-treesitter/nvim-treesitter", + optional = true, + dependencies = { + { + "szebniok/tree-sitter-wgsl", + build = "cp -r queries ../nvim-treesitter/queries/wgsl", + init = function() vim.filetype.add { extension = { wgsl = "wgsl" } } end, + config = function() + require("nvim-treesitter.parsers").get_parser_configs().wgsl = { + install_info = { + url = vim.fn.stdpath "data" .. "/lazy/tree-sitter-wgsl", + files = { "src/parser.c", "src/scanner.c" }, + }, + filetype = "wgsl", + } + end, + }, + }, + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "wgsl") end, + }, + { + "williamboman/mason-lspconfig.nvim", + opts = function(_, opts) opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, "wgsl_analyzer") end, + }, +}