Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform snippets are missing on package.json #385

Closed
JeSappelleRoot opened this issue Dec 3, 2023 · 5 comments
Closed

Terraform snippets are missing on package.json #385

JeSappelleRoot opened this issue Dec 3, 2023 · 5 comments

Comments

@JeSappelleRoot
Copy link

JeSappelleRoot commented Dec 3, 2023

Hi there,

I'm using classic setup on my neovim, with Lazy as plugin manager, nvim-cmp as autocomplete, LuaSnip as snippets engine.

Here a quick extract of my lsp.lua that I initiate from my init.lua with a simple require('lsp')

still a newbie on Neovim (started 1 week ago, don't judge my config 😛)

-- Forcing Terraform filetype here
vim.cmd([[silent! autocmd! filetypedetect BufRead,BufNewFile *.tf]])
vim.cmd([[autocmd BufRead,BufNewFile *.hcl set filetype=hcl]])
vim.cmd([[autocmd BufRead,BufNewFile .terraformrc,terraform.rc set filetype=hcl]])
vim.cmd([[autocmd BufRead,BufNewFile *.tf,*.tfvars set filetype=terraform]])
vim.cmd([[autocmd BufRead,BufNewFile *.tfstate,*.tfstate.backup set filetype=json]])

vim.cmd([[let g:terraform_fmt_on_save=1]])
vim.cmd([[let g:terraform_align=1]])

-- Forcing filetype on Docker Compose
vim.cmd([[autocmd BufRead,BufNewFile docker-compose.yml set filetype=yaml.docker-compose]])

local capabilities = require("cmp_nvim_lsp").default_capabilities()
require("mason").setup()
require("mason-lspconfig").setup {
    ensure_installed = { "terraformls", "tflint", "dockerls", "docker_compose_language_service", "pyright" },
}
local lspconfig = require('lspconfig')


-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { "terraformls", "tflint", "dockerls", "docker_compose_language_service", "pyright" }
for _, lsp in ipairs(servers) do
  lspconfig[lsp].setup {
    -- on_attach = my_custom_on_attach,
    capabilities = capabilities,
  }
end

-- luasnip setup
local luasnip = require 'luasnip'
require('luasnip.loaders.from_vscode').lazy_load()
[...]

Snippets on markdown or even Python are working fine, however Terraform snippets seems empty

  • Python

image
image

  • Markdown

image
image

However, Terraform snippets seems empty
image

After checking on ~/.local/share/nvim/lazy/friendly-snippets files and checking logs with :lua require('luasnip').log.open() command I found that Terraform snippets declaration could be missing from package.json

Here the fix :
image

image
image

I can raise a PR with the fix, let me know 🙏
Best,

JeSappelleRoot

@armyers
Copy link

armyers commented Dec 3, 2023

I'm using LazyVim -> LuaSnip -> friendly-snippets and need to know how to enable the terraform snippets, as well.

I know it can be done by editing package.json (I tried and it worked), but If there's a way to do this without adding it to package.json (ie, some lua code), that'd be fine with me.

BTW, thank you @rafamadriz for a very useful plugin! :)

@donaldgifford
Copy link

Same issue as above. Manually set it works fine.

@JeSappelleRoot
Copy link
Author

Any update on this issue ? We could raise a PR to add necessary fix
Let us know

Best,
JeSappelleRoot

@stepan111
Copy link

Got same issue

@armyers
Copy link

armyers commented Jan 24, 2024

thank you! :)

bobbyrahmanda13 pushed a commit to bobbyrahmanda13/friendly-snippets that referenced this issue Apr 1, 2024
…et for vue

update

fix rafamadriz#385: add terraform snippets to package.json

snprintf() snippet incorrectly inserts sprintf() body

(c.json) improve function snips

Make former `fund` (-> `fun`) more universal
Also, make the prefixes more logical

(c.json) Add _GNU_SOURCE snippet

Snippet to enable GNU functions

(c.json) Update GNU_SOURCE description

Update the description to be more specific for newbies to C

Fixed for range loop in gdscript

add blade snippets (rafamadriz#374)

* add blade snippets

* fix json formatting

Add rfv for React, compatible with Vite (rafamadriz#384)

feat(global): Add UUID snippet (rafamadriz#386)

remove extra spaces in deployment and pod snippets (rafamadriz#390)

Reorder html5 document template (rafamadriz#393)

The encoding `<meta charset="UTF-8>` is usually declared before any text-containing elements such as the `<title>`.

p.s. Emmet follows this ordering too

feat: add snippet for debugpy remote attach (rafamadriz#397)

useful on remote debugging, especially on slurm

feat(kubernetes): set default container (rafamadriz#399)

* feat(kubernetes): set default container

According to https://github.com/kubernetes/enhancements/blob/master/keps/sig-cli/2227-kubectl-default-container/README.md

* feat(kubernetes): set default container for daemon set

Added Github Alerts (rafamadriz#402)

Added snippets for github alerts as in webpages

Removes snippets for vue2 (rafamadriz#396)

* vue2 is no longer supported as of December 31, 2023.

feat: add new snippet vue

fix: typo description reactive

chore: change name file vue readable

feat: add style.json, fix, refactoring snippet vue

fix: choice vue style

feat(editorconfig): add editorconfig snippets (rafamadriz#392)

* feat(editorconfig): add editorconfig snippets

feat(ruby): add binding.break snippet (rafamadriz#403)

Add PureScript snippets (rafamadriz#401)

* Add Purescript snippets

add new snippet for vue (rafamadriz#404)

* remove snippet vue 2 is dead

* feat: add new snippet vue

* fix: typo description reactive

* chore: change name file vue readable

* feat: add style.json, fix, refactoring snippet vue

* fix: choice vue style

fix: style tailwind aspec ratio

fix: error refVueTs

fix: snippet script.json

style: indent script.json

feat: add new snippet

feat: add new snippet vue

reset commit

feat: add snippet, fix code, and indent

chore: add snippet vue

style: fix indent all file vue

chore: add snippet vue

chore: fix bind :to nuxtlink

chore: add snippet script.json include js and ts

chore: add snippet vue html

chore: add defineModel to script.json

chore: add new snippet

feat: added vue snippet for nuxt and took typescript javascript snippet for vue

Remove some none (rafamadriz#409)

Co-authored-by: orion GONZALEZ (contractor) <orion.gonzalez@amadeus.com>

feat: mod test (rafamadriz#414)

- Adds the mod-test block snippet
- Updates the `match` snippet to be more general

todo instead of unimplemented (rafamadriz#415)

feat(asciidoc): add snippets (rafamadriz#419)

feat(markdown): use single space between columns in tables (rafamadriz#420)

docs(readme): update github admonition syntax (rafamadriz#422)

feat(gleam): add gleam snippets rafamadriz#418 (rafamadriz#423)

- Add snippet support for Gleam. The snippets are taken from
https://github.com/gleam-lang/vscode-gleam/blob/main/snippets.json

- Minor edit in `package.json`

feat: add snippets for most basic terraform blocks (rafamadriz#426)

* feat: add basic terraform snippets

* fix: remove periods in placeholder text

fix(markdown): use correct placeholder values for table 5x2 (rafamadriz#421)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants