Skip to content

Support specializing snippet definitions by containing scope #1487

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

Conversation

pokey
Copy link
Member

@pokey pokey commented May 19, 2023

I thought this one would be a quick win, but deciding which matching snippet should apply turned out to be complex

Note that we don't support scope specialisation for custom snippets; should be a fairly easy follow-up PR building on this machinery.

Checklist

@pokey pokey force-pushed the pokey/support-specializing-snippet-definitions-by-containing-scope branch from 3e8bf83 to f7b1958 Compare May 19, 2023 15:39
// We don't want snippets from all files to stop working if there is
// a parse error in one file, so we just effectively ignore this file
// once we've shown an error message
this.userSnippets = await Promise.all(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't merge here; we handle things more carefully now, when we do the final merge below

@pokey pokey force-pushed the pokey/support-specializing-snippet-definitions-by-containing-scope branch 2 times, most recently from 42828ac to 46114e1 Compare May 19, 2023 15:52
@pokey pokey force-pushed the pokey/support-specializing-snippet-definitions-by-containing-scope branch 3 times, most recently from e4759c3 to 760ca9b Compare May 19, 2023 16:10
@pokey pokey added the to discuss Plan to discuss at meet-up label May 19, 2023
@pokey pokey force-pushed the pokey/support-specializing-snippet-definitions-by-containing-scope branch from 760ca9b to a0ad4f6 Compare May 19, 2023 16:37
@pokey pokey removed the to discuss Plan to discuss at meet-up label May 20, 2023
@pokey pokey marked this pull request as ready for review May 20, 2023 15:06
@pokey pokey requested a review from AndreasArvidsson May 20, 2023 15:06
@pokey pokey force-pushed the pokey/support-specializing-snippet-definitions-by-containing-scope branch from 55bbf67 to e8a7509 Compare May 20, 2023 15:09
{
body: [""],
scope: {
scopeTypes: ["anonymousFunction"],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change precedence:

  1. have language at all wins out over having scope type but no language
  2. but having scope type with two languages wins out over having no scope type with one language

@AndreasArvidsson AndreasArvidsson added this pull request to the merge queue May 24, 2023
Merged via the queue into main with commit b48f14a May 24, 2023
@AndreasArvidsson AndreasArvidsson deleted the pokey/support-specializing-snippet-definitions-by-containing-scope branch May 24, 2023 17:22
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

Successfully merging this pull request may close these issues.

Support context-specific snippet definitions
2 participants