Closed ctf0 closed 4 years ago
@Gruntfuggly any news on this ?
Sorry - I hadn't seen this - must of missed the email. I'll look into it...
Not seeing the error here (with 1.41.1). Where did you define the snippet? It seems to work OK for me if I put it in a global snippets or the PHP snippets.
There is a debug output channel (auto-snippets.debug
). Can you enable it and see what is displayed in there?
i found the issue.
when u create an empty php file, even if the syntax in the status bar says its PHP
the scope is actually still html
using inspect tm scope
cmnd
until u add the php tag <?php
then the snippet will show up.
not sure why they did it like that, but is there a way around that ?
believe it or not checking inspect context key
shows resourceLangId: "php" & editorLangId: "php"
lol 😞
Are you sure there isn't another extension interfering? Or have you added something to files.associations
?
nop, have u tried the steps i described to repro ?
You don't have to use the language to generate the snippet - you can use a glob pattern instead. Try "pattern":"*.php"
instead?
Yes - I used your config and snippet.
Or maybe "**/*.php"
nothing changed, r u using the same editor version ?
I'm on 1.41.1, the stable version. Maybe is insiders? Hold on...
Just tried on 1.42.0-insiders, and it was OK too.
Output window shows:
Opened empty file /Users/nige/Projects/vscode-extensions/auto-snippet/empty.php
Matched language php
Inserting snippet basic-php
Running command: namespaceResolver.generateNamespace
i've tried many things but all remain the same, other from the bug i described i dont know how to solve it 😢 .
still thanx for ur help.
Did you try the glob pattern as an alternative?
yeap, non works
Whats displayed in the debug log? If I use the pattern above I get:
Opened empty file /Users/nige/Projects/vscode-extensions/auto-snippet/chips.php
Matched pattern **/*.php
Inserting snippet basic-php
Running command: namespaceResolver.generateNamespace
i keep getting
Opened empty file /Users/koka/Public/GitHub/demos/app/asd.php
Matched language php
Inserting snippet basic-php
Opened empty file /Users/koka/Public/GitHub/demos/app/asd.php.git
No snippet found
but nothing is added to the file, also not sure where asd.php.git
came from
That's because vscode opens a background file for version control, but you can ignore it.
I've realised one thing - there is a timeout when inserting a snippet, which generates the error you are seeing. It basically gives it 1 second to insert the snippet, and shows the error if it doesn't happen. It doesn't explain why you're not seeing the snippet, but it makes sense that it's not finding the snippet and inserting it. So it looks like it can't find it for some reason?
Could there be a syntax error in your snippets file?
its exactly as above, also it works well when i manually initiate it
Did you ever get to the bottom of this or is it still an issue?
sadly no, i stopped using it because of the side effect 😢
Sorry we couldn't work out what the problem was. If you ever decide to investigate it again, let me know.
env
snippet
config
error
if there is something i could do on my end, plz tell me and i can send a PR 👍