fix(lsp): Properly recognize wgsl files

This commit is contained in:
kalmenn 2024-02-29 18:55:10 +01:00
parent d8f258ef41
commit 570e79b076
Signed by: kalmenn
GPG key ID: F500055C44BC3834

View file

@ -1,3 +1,17 @@
--- Automatically set the filetype for all buffers matching a pattern.
--- Uses an autocommand under the hood
--- @param pattern string|string[] What buffers to match on.
--- @see vim.api.nvim_create_autocmd
--- @param filetype string The filetype to set for the matching buffers
local function bind_filetype(pattern, filetype)
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
pattern = pattern,
callback = function()
vim.bo.filetype = filetype
end,
})
end
return { return {
{ import = "plugins/languages" }, { import = "plugins/languages" },
{ {
@ -50,6 +64,8 @@ return {
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
bind_filetype("*.wgsl", "wgsl")
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
handlers = { handlers = {
-- default handler -- default handler