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
#Requires doesn't require separation #9097
Comments
Isn't the error message helpful ? |
More fundamentally, the issue is that it is problematic that the syntactic form of a comment was chosen to implement "preprocessor directives" (statements evaluated at script/module parse time), which invites confusion. I suggest either reframing this issue accordingly or creating a new issue to suggest a distinct syntax form. |
I just think that I do realize that this is a case of error one way or the other, but I think because its based on a comment marker, the error should be in the direction of ignoring anything that isn't exactly right. Its a comment, and instead let the user figure out why his very badly malformed Background, I am working on a PR over at PowerShell/EditorSyntax, PowerShell/EditorSyntax#156, and trying to make sure it mostly matches what PowerShell really expects. |
On purely technical grounds I'd agree: if something isn't a syntactically valid However, falling back to the other construct that shares the My sense is that this quiet ignoring would be worse than the current behavior, as a script author may not notice that a directive they meant to put in place wasn't. If they didn't mean to create a As simple as that workaround is - and if we stick with the current behavior the error message should be amended to suggest it - it highlights the fundamental problem: Comment syntax should never have been overloaded to serve as directive syntax too, and a proper solution requires a distinct syntax form for directives. |
In general I tend to lean towards always having a leading space on my comments following the I'm sure it was intended to reflect back on C#'s preprocessor-directive syntax, but that might have been a bad idea. Not sure if it can really be changed now, though? I guess it wouldn't be the end of the world, as changing it would essentially mean that all current Not sure what we could really use instead. Any thoughts on viable alternatives @mklement0? 🤔 |
The
I'm pretty sure that an RFC is needed to propose something of that magnitude. In the current situation, my recommendation is to merely amend the error message so that if someone writes |
A couple thoughts:
In actuality, most of the work of I can implement the current syntax in the tmlanguage grammar, it will just be the odd one out, in all the rules, and is why I bring this up. I think its better to have a good understanding of the grammar than to just assume it works a certain way, hence my investigation in to it in the first place. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
2 similar comments
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
Steps to reproduce
The
#Requires
directive doesn't seem to require some kind of separation from its keyword to the next token, but not providing that separation causes an error anyway.I am just not sure this is right. A inexperienced user could stumble across this by accident thinking he's just entering a comment. I have seen plenty of reports already of new users who are confused when the editor starts highlighting items in a comment, turning them in as bug reports.
The text was updated successfully, but these errors were encountered: