LuaSnip icon indicating copy to clipboard operation
LuaSnip copied to clipboard

Failing to import from_vscode snippets using ~/ syntax

Open pedromarquetti opened this issue 1 year ago • 1 comments

When running

my init.lua

...
require('luasnip.loaders.from_vscode').lazy_load {
  paths = {
  '~/.config/Code/User/snippets/',
}
...

it does not import from the specified path.

if I

  1. clone my .config/Code snippets folder to my .config/nvim
  2. do require('luasnip.loaders.from_vscode').lazy_load()

It works normally.

I also tried creating a symbolic link to the original config, it works, but would be nice if i didn't have to do that

After reading the docs, it should accept ~/... paths. Am I doing something wrong?

pedromarquetti avatar Oct 02 '24 23:10 pedromarquetti

Hi :) Could you insert ls.log.set_loglevel("info") before the call to lazy_load, open a new instance of neovim, and then call :lua ls.log.open()? There should be some information about lazy-loading, and which path exactly is looked at, I think that should help here :D

L3MON4D3 avatar Oct 23 '24 13:10 L3MON4D3

Sorry for the delayed response, after reading the logs and re-reading the documentation (Files with the extension jsonc will be parsed as jsonc, json with comments, while *.json are parsed with a regular json parser), I found my problem:

VSCode generates regular .json files WITH comments... that i don't delete, so from_vscode fails trying to read regular jsonc as json.

I'll be closing the issue since it was my fault for not reading the docs properly lol

pedromarquetti avatar Feb 19 '25 17:02 pedromarquetti