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

Add support for @code directive #6361

Closed
rynowak opened this issue Jan 3, 2019 · 12 comments · Fixed by dotnet/razor#527
Closed

Add support for @code directive #6361

rynowak opened this issue Jan 3, 2019 · 12 comments · Fixed by dotnet/razor#527
Assignees
Labels
area-blazor Includes: Blazor, Razor Components Components Big Rock This issue tracks a big effort which can span multiple issues Done This issue has been fixed enhancement This issue represents an ask for new feature or an enhancement to an existing one

Comments

@rynowak
Copy link
Member

rynowak commented Jan 3, 2019

Do we want to use @code instead of @functions?

@rynowak rynowak added Needs: Design This issue requires design work before implementating. area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Jan 3, 2019
@rynowak rynowak added this to To do in Blazor via automation Jan 3, 2019
@rynowak rynowak moved this from To do to Design in Blazor Jan 3, 2019
@gulbanana
Copy link

also, could we move them (by convention) to before instead of after the html? :)

pure bikeshed, but i’ve been writing everything that way because it feels like the C# bits are the lower layer - you write those and then you reference them from the markup. it would also be more familiar to people coming from React because it’s akin to a render function which returns JSX.

@wanton7
Copy link

wanton7 commented Jan 4, 2019

@gulbanana also, could we move them (by convention) to before instead of after the html? I don't get this sentence?
Do you mean you would want functions/code block to be moved before HTML in dotnet/visual studio templates? Or do you think you can't move functions/code block before HTML? Because if it's that then just move your functions/code block before HTML, it works just fine.

@wanton7
Copy link

wanton7 commented Jan 4, 2019

@rynowak I don't know much about VB but isn't @Code already used in Visual Basic code blocks for Razor? Does @code cause any conflicts wit h it?

@gulbanana
Copy link

yeah, i was thinking about templates and docs - i already handwrite stuff that way, with [Parameter]s and then the markup that uses them

@gulbanana
Copy link

obviously it's incredibly unimportant where they go but this seems like the right time to make unimportant aesthetic decisions!

@wanton7
Copy link

wanton7 commented Jan 5, 2019

@gulbanana This is not a community forum so you should create another issue for that and not hijack this unrelated issue.

@gulbanana
Copy link

it's literally the issue for reviewing the design of the directive

@wanton7
Copy link

wanton7 commented Jan 5, 2019

@gulbanana no it's not. What you are describing already works. Your issue is about default templates Microsoft provides.

@RemiBou
Copy link
Contributor

RemiBou commented Jan 7, 2019

I agree "functions" is not a very good name. I don't know about "code" as html/js in the template is code as well and this is one of the most generic term out there : a google search for "blazor code error" would give results about vscode, or any code related to blazor. Maybe something that means that it's the definition of the class or the component behavior ("behavior" would be nice or "logic").

@SteveSandersonMS SteveSandersonMS added the area-blazor Includes: Blazor, Razor Components label Feb 6, 2019
@jonathanperis
Copy link

Why not do the same that aspnet Razor Pages with a nested page .csrazor to differentiate the HTML from code?

@rynowak
Copy link
Member Author

rynowak commented Feb 21, 2019

We're going to enable that as well. We still want to try and make things better overall 😄

@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Apr 5, 2019
@mkArtakMSFT mkArtakMSFT added this to the 3.0.0-preview6 milestone Apr 5, 2019
@mkArtakMSFT mkArtakMSFT added the Components Big Rock This issue tracks a big effort which can span multiple issues label Apr 19, 2019
@mkArtakMSFT mkArtakMSFT added this to To do in Blazor via automation Apr 19, 2019
@rynowak rynowak mentioned this issue Apr 19, 2019
56 tasks
@xclud
Copy link

xclud commented Apr 20, 2019

@code makes more sense to me.

Blazor automation moved this from In progress to Done May 2, 2019
@ajaybhargavb ajaybhargavb added Done This issue has been fixed and removed 2 - Working Needs: Design This issue requires design work before implementating. labels May 2, 2019
@ajaybhargavb ajaybhargavb changed the title Design Review: @code Add support for @code directive May 2, 2019
@mkArtakMSFT mkArtakMSFT removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels May 9, 2019
@dotnet dotnet locked as resolved and limited conversation to collaborators Dec 3, 2019
@jaredpar jaredpar removed this from Done in Blazor Jan 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components Components Big Rock This issue tracks a big effort which can span multiple issues Done This issue has been fixed enhancement This issue represents an ask for new feature or an enhancement to an existing one
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants