draivin / hsnips

HyperSnips: a powerful snippet engine for VS Code, inspired by vim's UltiSnips
MIT License
148 stars 23 forks source link

Snippets suddenly not activating #143

Closed Oskar-Idland closed 1 year ago

Oskar-Idland commented 1 year ago

I have previously not have had any issues with this extension when suddenly, none of my snippets would activate. I have snippets for LaTeX, Julia and Python. I tried to create an all.hsnips file which surprisingly works, but this is of course very unpractical. When i use the command "Open snippets directory" i get to the right location: C:\Users\oskar\AppData\Roaming\Code\User\hsnips. I tried to reload the snippet file and i got the following error: image

This is the current directory i have used in settings: image

I also tried playing around with this path, which did not work, but removing the "hsnips" at the end allowed me to reload the snippets. I then tried to "open snippet file" which then prompted me to chose a folder in my User folder as expected as I changed the path. You can see this below: image

When i tried to open the hsnips folder i then got the following error message: image which makes sense if its trying to open a file, but is met with a folder instead. This makes me doubt removing the "hnsips" was a solution and there must be something else.

Using the command "Open snippet directory" opened the assigned directory correctly in both cases. If it is on any relevance, here is my setup: vscode version 1.74.2 windows 11 HyperSnips v0.2.8

This is definitely the greatest extension in vscode so any help is greatly appreciated!

draivin commented 1 year ago

This looks to be some error when parsing your hsnips files, could you upload one of your snippet files that aren't working so I can take a look?

Oskar-Idland commented 1 year ago

My shortest one is the julia.hsnips file

snippet alpha "alpha" A
α
endsnippet

snippet beta "beta" A
β
endsnippet

snippet gamma "gama" A
γ
endsnippet

snippet Gamma "Gama" A
Γ
endsnippet

snippet delta "delta" A
δ
endsnippet

snippet Delta "Delta" A
Δ
endsnippet

snippet eps "epsilon" A
ϵ
endsnippet

snippet zeta "zeta" A
ζ
endsnippet

snippet theta "theta" A
θ
endsnippet

snippet eta "eta" A
η
endsnippet

snippet Theta "Theta" A
Θ
endsnippet

snippet iota "iota" A
ι
endsnippet

snippet kappa "kappa" A
κ
endsnippet

snippet lam "labda" A
λ
endsnippet

snippet Lam "Labda" A
Λ
endsnippet

snippet mu "mu" A
μ
endsnippet

snippet nu "nu" A
ν
endsnippet

snippet xi "xi" A
ξ
endsnippet

snippet Xi "Xi" A
Ξ
endsnippet

snippet pi "pi" A
π
endsnippet

snippet Pi "Pi" A
Π
endsnippet

snippet rho "rho" A
ρ
endsnippet

snippet sigma "sigma" A
σ
endsnippet

snippet Sigma "Sigma" A
Σ
endsnippet

snippet tau "tau" A
τ
endsnippet

snippet upsilon "upsilon" A
υ
endsnippet

snippet phi "phi" A
ϕ
endsnippet

snippet Phi "Phi" A
Φ
endsnippet

snippet chi "chi" A
χ
endsnippet

snippet psi "psi" A
ψ
endsnippet

snippet Psi "Psi" A
Ψ
endsnippet

snippet omega "omega" A
ω
endsnippet

snippet Omega "Omega" A
Ω
endsnippet

snippet pi "π" iA
π
endsnippet

snippet ^^ "Exponent" A
\^
endsnippet

snippet Pkg "Pkg" A
using Pkg 
Pkg.add("$0")
endsnippet
Oskar-Idland commented 1 year ago

I solved it! The last snippet in my previous comment was the problem. The old version:

snippet Pkg "Pkg" A
using Pkg 
Pkg.add("$0")
endsnippet

The new version:

snippet Pkg "Pkg" A
``rv = "Using Pkg \nPkg.add(\"$0\")"``
endsnippet

I used the quotation symbol wrong it seems. Supprisingly, this also affected the latex.hsnips file, but not the all.hsnips file. So it seems syntax errors can affect all custom files except the all.hsnips file. I believe this can be closed now.