Skip to content

Extract out subsystem for allowing embedded languages to export language services.#25985

Merged
jmarolf merged 391 commits intodotnet:features/embeddedJsonfrom
CyrusNajmabadi:embeddedLanguageServices2
Apr 10, 2018
Merged

Extract out subsystem for allowing embedded languages to export language services.#25985
jmarolf merged 391 commits intodotnet:features/embeddedJsonfrom
CyrusNajmabadi:embeddedLanguageServices2

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Apr 6, 2018

[jcouv]
Implements part of #25939 (embedded json)
Implements part of #25940 (embedded regex)

{
Debug.Assert(token.Kind() == SyntaxKind.StringLiteralToken);

var languageProvider = CSharpEmbeddedLanguageProvider.Instance;
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.

Same thing here. Should we try to prune to the right language?
Or could we at least bail out as soon as one matched?

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.

looking to see what we could do better here.

Copy link
Copy Markdown
Contributor Author

@CyrusNajmabadi CyrusNajmabadi Apr 8, 2018

Choose a reason for hiding this comment

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

we now bail out after one language succeeds.


Public Overrides ReadOnly Property SyntaxTokenKinds As ImmutableArray(Of Integer) = ImmutableArray.Create(Of Integer)(SyntaxKind.StringLiteralToken)

Public Overrides Sub AddClassifications(workspace As Workspace, token As SyntaxToken, semanticModel As SemanticModel, result As ArrayBuilder(Of ClassifiedSpan), cancellationToken As CancellationToken)
Copy link
Copy Markdown
Member

@jcouv jcouv Apr 8, 2018

Choose a reason for hiding this comment

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

Consider breaking this extra long line, and maybe the line above too.

Copy link
Copy Markdown
Member

@jcouv jcouv Apr 8, 2018

Choose a reason for hiding this comment

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

Maybe this method could be pulled into the parent type (AbstractSyntaxClassifier) and only having a language-specific implementation for VisualBasicEmbeddedLanguageProvider.Instance?

Never mind. AbstractSyntaxClassifier should not have logic for embedded languages. And it doesn't seem worthwhile to introduce another abstract type just for this.

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.

Maybe this method could be pulled into the parent type (AbstractSyntaxClassifier)

So, unfortunately "AbstractSyntaxClassifier" is not what is sounds like. it's not an abstract impl shared across VB and C#. Instead, there are two AbstractSyntaxClassifiers. Once defined in VB and one defined in C#. They're more appropriately thought of as AbstractCSharpSyntaxClassifier and AbstractVisualBasicSyntaxClassifier. They don't have anything in common to share.

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.

ok. i think i can make this better. give me a few minutes.

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.

Ok. i my understanding was correct, but the design here was due to the classifier stuff being written long before we had any shared compiler code between C#/VB. Turns out there was no need for separate langauge versions, so i merged them and just took your good suggestion. Thanks!

@CyrusNajmabadi CyrusNajmabadi requested review from a team as code owners April 8, 2018 05:06
Copy link
Copy Markdown
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

@dotnet/roslyn-ide Please review. These small feature-branch PRs make will help make it easier to get in the json and regex support into the IDE. Thanks!

@jcouv
Copy link
Copy Markdown
Member

jcouv commented Apr 8, 2018

The PR seems to be garbled with a bunch of other changes from merge.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

Ooops. Merged master into this. darnit.

@CyrusNajmabadi CyrusNajmabadi force-pushed the embeddedLanguageServices2 branch from b5a5019 to c324363 Compare April 8, 2018 19:01
@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

Ok. undid bad merge.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

@dotnet/roslyn-infrastructure

Disk has run out of space and cannot get latest changes. Please contact netciadmin@microsoft.com. IOException: No space left on device
Indication 1

@mmitche
Copy link
Copy Markdown
Member

mmitche commented Apr 9, 2018

@dotnet-bot test ubuntu_16_debug

@mmitche
Copy link
Copy Markdown
Member

mmitche commented Apr 9, 2018

@dotnet-bot test ubuntu_16_debug_prtest

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

@jmarolf can you take a look? I've used this for both the Regex and Json features, and it's worked great, allowing me to only have to update each roslyn feature (like brace-matching, classification,etc.) once, instead of having to make each one know about regex and json.

CSharpVSResources.Report_invalid_placeholders_in_string_dot_format_calls;
CSharpVSResources.Report_invalid_placeholders_in_string_dot_format_calls;
}
}
Copy link
Copy Markdown
Contributor

@jmarolf jmarolf Apr 10, 2018

Choose a reason for hiding this comment

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

Doesn't look like there are any non-whitespace changes in this file

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

Comment added @jmarolf Feel free to merge when convenient!

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

ok @jmarolf . ready to merge in. thanks!

@jmarolf jmarolf merged commit 1eb364e into dotnet:features/embeddedJson Apr 10, 2018
@CyrusNajmabadi
Copy link
Copy Markdown
Contributor Author

Thanks!

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.

4 participants