Skip to content

Break out embedded language classification (MEF side)#59905

Merged
CyrusNajmabadi merged 10 commits intodotnet:release/dev17.3from
CyrusNajmabadi:embeddedClassification3
Mar 7, 2022
Merged

Break out embedded language classification (MEF side)#59905
CyrusNajmabadi merged 10 commits intodotnet:release/dev17.3from
CyrusNajmabadi:embeddedClassification3

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Mar 3, 2022

Followup to #59896

This moves to exporting embeded language classifiers using standard MEF mechanisms.

WIth this, a 3rd party (like ASP) would be able to add their own classifier for their own dsl strings.

Next followup will be to autodetect strings that have // lang=lang_name on it or which have the StringSyntaxAttribute. We'll allow lang classifiers to specify the string-name that they are exported for, and we'll auto call into them if we find these codemarkers.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review March 4, 2022 05:21
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 4, 2022 05:21
new JsonEmbeddedLanguageEditorFeatures(info),
new RegexEmbeddedLanguageEditorFeatures(this, info),
new FallbackEmbeddedLanguage(info));
new RegexEmbeddedLanguageEditorFeatures(this, info));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

intentional. the fallbackembeddedlanguage went away. it was only there for classification, and now classification is handled using a normal MEF registration path.

@@ -11,9 +11,5 @@ namespace Microsoft.CodeAnalysis.EmbeddedLanguages.LanguageServices
/// </summary>
internal interface IEmbeddedLanguage
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

questionable if IEmbeddedLanguage serves any purpose now. a followup PR will try to remove it.

@CyrusNajmabadi CyrusNajmabadi requested a review from genlu March 4, 2022 05:25
internal static class PredefinedEmbeddedLanguageClassifierNames
{
/// <summary>
/// A special built-in classifier for classifying escapes in strings and character literals if no other embedded
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be nice if there was an [Order(After = OrderAttribute.AllOthers)] or something, and then this could be "just" another classifier, and be given a better name (EscapeCharacterClassifier perhaps)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm actually even removing this fromthis list, and we'll just have this baked in as something special :)

@davidwengier
Copy link
Copy Markdown
Member

followup will be to autodetect strings that have // lang=lang_name on it or which have the StringSyntaxAttribute. We'll allow lang classifiers to specify the string-name that they are exported for, and we'll auto call into them if we find these codemarkers.

I really like the direction here

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

I really like the direction here

Coming in next PR which i'm working on now :)

@CyrusNajmabadi CyrusNajmabadi merged commit 51103e5 into dotnet:release/dev17.3 Mar 7, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the embeddedClassification3 branch March 7, 2022 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants