add vscode tf snippets, fix tf tree-sitter

This commit is contained in:
Noah Masur 2023-07-06 12:07:29 -06:00
parent 38480e0c0c
commit d4e203a04c
6 changed files with 38 additions and 3 deletions

17
flake.lock generated
View File

@ -413,6 +413,7 @@
"telescope-nvim-src": "telescope-nvim-src",
"telescope-project-nvim-src": "telescope-project-nvim-src",
"toggleterm-nvim-src": "toggleterm-nvim-src",
"vscode-terraform-snippets": "vscode-terraform-snippets",
"wallpapers": "wallpapers",
"wsl": "wsl"
}
@ -522,6 +523,22 @@
"type": "github"
}
},
"vscode-terraform-snippets": {
"flake": false,
"locked": {
"lastModified": 1688666727,
"narHash": "sha256-qw6/N1nDPgZXQ2T0DRK2WoNC2KLkNTJRVm5yNqzMcIg=",
"owner": "nmasur",
"repo": "vscode-terraform-snippets",
"rev": "6e37735ef6fdd72352e4b73e2bfaa3706fcff7e0",
"type": "github"
},
"original": {
"owner": "nmasur",
"repo": "vscode-terraform-snippets",
"type": "github"
}
},
"wallpapers": {
"flake": false,
"locked": {

View File

@ -103,6 +103,10 @@
url = "github:kyazdani42/nvim-tree.lua";
flake = false;
};
vscode-terraform-snippets = {
url = "github:nmasur/vscode-terraform-snippets";
flake = false;
};
};

View File

@ -135,6 +135,13 @@
};
lua = ''
-- Load snippets
-- Check status: :lua require("luasnip").log.open()
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "${
builtins.toString pkgs.vscode-terraform-snippets
}" } })
-- Use buffer source for `/`
require('cmp').setup.cmdline("/", {
sources = {

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{ pkgs, lib, ... }: {
plugins = [
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins:
@ -49,4 +49,10 @@
};
};
# Use mkAfter to ensure tree-sitter is already loaded
lua = lib.mkAfter ''
-- Use HCL parser with .tf files
vim.treesitter.language.register('hcl', 'terraform')
'';
}

View File

@ -4,8 +4,8 @@
vim.filetype.add({
pattern = {
[".*%.tfvars"] = "hcl",
[".*%.tf"] = "hcl",
[".*%.tfvars"] = "terraform",
[".*%.tf"] = "terraform",
[".*%.rasi"] = "css",
},
})

View File

@ -17,6 +17,7 @@ let
in {
nil = inputs.nil.packages.${prev.system}.nil;
vscode-terraform-snippets = inputs.vscode-terraform-snippets;
nvim-lspconfig =
(withSrc prev.vimPlugins.nvim-lspconfig inputs.nvim-lspconfig);