Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

DirectiveDescriptorBuild should throw for directives that wouldn't be parsed correctly #981

Closed
pranavkm opened this issue Feb 8, 2017 · 7 comments
Assignees

Comments

@pranavkm
Copy link
Contributor

pranavkm commented Feb 8, 2017

For instance DirectiveDescriptorBuilder.Create("my-directive").Build() works correctly, but the parser requires an identifier token to be a descriptor name.

@rynowak
Copy link
Member

rynowak commented Feb 9, 2017

Wouldn't this parse as @my-directive? This seems totally legal and reasonable to me.

@NTaylorMullen
Copy link
Contributor

It could, but that's not what we've allowed in Razor in the past. We should enforce a convention. Up till today we've followed the camel case convention for Razor directives, i.e. @addTagHelper not @add-tag-helper

@pranavkm
Copy link
Contributor Author

pranavkm commented Feb 9, 2017

I think it parsed it as two separate tokens when I tried this in a test. We should either support it in the parser or throw ahead of time. I assumed we were 🐫 casers, hence the work item.

@pranavkm
Copy link
Contributor Author

pranavkm commented Feb 9, 2017

tl,dr: 🐫 > 🐍

@rynowak
Copy link
Member

rynowak commented Feb 9, 2017

Ah I see. We should define the set of characters that are allowed in directives and validate that. Conventions are just conventions, not rules.

@rynowak
Copy link
Member

rynowak commented May 12, 2017

For now I'm only going to allow letters here. If someone comes up with a killer use case later we can make it full c# identifiers.

@rynowak
Copy link
Member

rynowak commented May 12, 2017

b17e506

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants