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

Snippet failing to function consecutively #20716

Closed
dburles opened this issue Feb 16, 2017 · 7 comments
Closed

Snippet failing to function consecutively #20716

dburles opened this issue Feb 16, 2017 · 7 comments
Assignees
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code) snippets

Comments

@dburles
Copy link

dburles commented Feb 16, 2017

Edit: I believe I have found the problem, typically one will realise it immediately after posting a bug report. It seems to be conflicting with an autocompletion that takes precedence:

screen shot 2017-02-16 at 9 25 09 pm

What's the workaround for that? Should the snippet be prioritised?


Possibly related to #11742

Behaviour:

feb-16-2017 21-21-14

I'm interested if anyone else can reproduce this as easily as I can, I haven't had time to dig into it any further but it's been a problem for quite a while.

This is the snippet:

	"Print to console": {
		"prefix": "log",
		"body": [
			"console.log($1);"
		],
		"description": "Log output to console"
	},
@ramya-rao-a
Copy link
Contributor

#1952 tracks the same problem for emmet snippets.

@jrieken jrieken added the info-needed Issue requires more information from poster label Feb 21, 2017
@jrieken
Copy link
Member

jrieken commented Feb 21, 2017

I actually cannot reproduce. @dburles Do you use tab completion to accept the suggestion? So type log and press Tab to insert or is this a selection from the suggestion widget?

@jrieken
Copy link
Member

jrieken commented Feb 21, 2017

Like, do you have these settings?

"editor.tabCompletion": true,
"editor.quickSuggestions": false,

@jrieken
Copy link
Member

jrieken commented Mar 10, 2017

Closing because a certain number of days have passed with a reply

@jrieken jrieken closed this as completed Mar 10, 2017
@dburles
Copy link
Author

dburles commented Mar 10, 2017

Sorry @jrieken not sure how I missed the notifications for the previous messages. My settings are the inverse of what you mentioned.

@ramya-rao-a ramya-rao-a reopened this Mar 10, 2017
@jrieken jrieken removed the info-needed Issue requires more information from poster label Mar 31, 2017
@jrieken
Copy link
Member

jrieken commented Apr 5, 2017

So this is what happens (assuming I correctly guessed this is JavaScript)

  1. file is empty or at least doesn't use console.log yet
  2. typing starts 24x7 IntelliSense (quickSuggestions: true) and further typing the word log selects the snippet with that prefix. Enter expands the snippet to console.log
  3. Now the JavaScript language service sees log being used and adds it to the global symbol completion table which is appended to each and every set of completions (notice the icon)
  4. now typing starts again, again with log. This time there is still the log-snippet but also the log symbol from the global table.
  5. because snippet completions are scored lower than other completions the "new log completion" wins

Get around around this you can add this configuration "editor.snippetSuggestions": "top" which makes sure snippets always come on top on things. Or turn off quick suggestions and enable tab completions.

screen shot 2017-04-05 at 16 33 34

@jrieken jrieken closed this as completed Apr 5, 2017
@jrieken jrieken added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Apr 5, 2017
@dburles
Copy link
Author

dburles commented Apr 12, 2017

Thanks @jrieken, works like a charm!

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*question Issue represents a question, should be posted to StackOverflow (VS Code) snippets
Projects
None yet
Development

No branches or pull requests

3 participants