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

Semantic snippets - while snippet #64893

Merged
merged 8 commits into from
Oct 26, 2022
Merged

Semantic snippets - while snippet #64893

merged 8 commits into from
Oct 26, 2022

Conversation

DoctorKrolic
Copy link
Contributor

I noticed that if and while statements are very similar, but there was a semantic snippet only for if. I tried to abstract as lot of logic as possible, but unfortunately IfStatementSyntax and WhileStatementSyntax don't have a common ancestor, so there is still some amount of code duplication(

@akhera99 You are the master here, waiting for your review)

@DoctorKrolic DoctorKrolic requested a review from a team as a code owner October 21, 2022 17:25
@ghost ghost added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Oct 21, 2022
return newIndentation.GetIndentationString(parsedDocument.Text, syntaxFormattingOptions.UseTabs, syntaxFormattingOptions.TabSize) + newLine;
}

protected override async Task<Document> AddIndentationToDocumentAsync(Document document, int position, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken)
Copy link
Member

Choose a reason for hiding this comment

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

The indentation should probably be abstracted out for every block - since most of them are exactly the same. I'll do that in a follow-up PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The vast majority of snippets have such block, so this definitely needs an abstraction. I am only not sure how it will work if semantic snippets become a VB thing as well

@akhera99
Copy link
Member

From a cursory glance, this looks really good! I'll do a more in depth review by the beginning of the week

@DoctorKrolic
Copy link
Contributor Author

@akhera99 ?

@akhera99
Copy link
Member

Looks good to me with the fixes I suggested!

DoctorKrolic and others added 2 commits October 27, 2022 00:17
Co-authored-by: Ankita Khera <40616383+akhera99@users.noreply.github.com>
Co-authored-by: Ankita Khera <40616383+akhera99@users.noreply.github.com>
@DoctorKrolic DoctorKrolic requested a review from akhera99 October 26, 2022 21:27
@akhera99 akhera99 enabled auto-merge (squash) October 26, 2022 21:29
@akhera99
Copy link
Member

Looks good, thanks for contributing!

@akhera99 akhera99 merged commit 15e7005 into dotnet:main Oct 26, 2022
@ghost ghost added this to the Next milestone Oct 26, 2022
@DoctorKrolic DoctorKrolic deleted the while-semantic-snippet branch October 27, 2022 05:37
@allisonchou allisonchou modified the milestones: Next, 17.5 P2 Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants