-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Document drracket:comment-delimiters #635
Document drracket:comment-delimiters #635
Conversation
The documentation portion of racket#634. Note that this commit does /not/ add to the documented list of keys read by Dr Racket, because this commit does not add the behavior of Dr Dracket doing that and using the comment styles to drive its (un)comment commands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resyntax analyzed 0 files in this pull request and found no issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resyntax analyzed 0 files in this pull request and found no issues.
I think it probably makes sense to clarify how newlines are going to be treated. Right now it reads like the empty string is a special case for newline handling. Is that right? I am realizing now that I may have misunderstood a detail from the previous discussion. If we're expecting tools to (for now at least) always put these in at the start and end of lines then we would not expect newlines to be inserted but instead the closing one to be inserted at the end of each line, right before the newline. If that's the case, then it probably helps to explain that in the docs so people understand better what characters to put in there. If it isn't the case (ie these are more general) then we might explain how they are going to be used but point out that they might be used in a more general way in the future. Also, do we want to include some examples? |
Yes.
I thought the default value was a good enough example, but I can add more. |
p.s. I think the trickiest case is when both of the following are true:
Now the tool needs to deal with stuff like nested comments, and selections spanning already-commented and not-commented spans. Probably it must use color-lexer tokens to get it right. But if DrR sticks with entire-line selections for comment commands, then I think even region comment delimiters are straightforward. Comment always adds a start to BOL and an end before EOL. Un-comment always peels off the outermost pair if any. However if that's not quite true, then DrR can just... ignore region comment delimiters entirely. Only use line comment delimiters. That would be no worse than today. It would be mildly better because at least it would use the line comment start supplied by each lang. TL;DR I think the info key proposal is about supplying the info only the lang knows. Then it's up to each tool (its author and users) what or how much to do with that information. More isn't necessarily better, definitely not obligatory. |
Okay, this is all making sense to me. Thanks for the slow (repeated!) explanation. Also, it looks like Sublime Text also rounds-up when doing line comments. (I wonder if Emacs has a configuration parameter to get that behavior?) Also, would it be clearer if we used two element lists to mean line comments and three element lists to be region comments? That way the empty string might be less confusing to the documentation reader? |
Would it be a good idea to tag the "style" (inline vs region) explicitly in the list? I'm thinking about forward compatibility where we might want to extend the list even longer to accommodate e.g. whether nested region comment is supported, and if we use the list length as a way to distinguish style, it might be more difficult to do this extension. |
@rfindler @sorawee I think that sounds good. To make sure I understand, were you thinking something like:
? And, I could add a bit in the doc to summarize some of what's in the thread above about line vs. region comments, as well as tool choices? |
yes, this sounds great;
Especially this part! |
I just pushed a commit trying to incorporate this feedback. Please let me know if this seems better, and any corrections/suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resyntax analyzed 0 files in this pull request and found no issues.
This was discussed earlier but got left out. This is relevant for a tool that allows "filling" comments (i.e. adding/removing line breaks to fit a maximum column), as does Emacs, where this is the value of the "comment-continue" variable. For line comments this can obviously just be set to the same value as comment-start, but for region comments it may differ (e.g. C++ might use " *" and Scheme might use " ").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resyntax analyzed 0 files in this pull request and found no issues.
It would be nice to include contracts to make things a bit more precise. Maybe where it says "list of comment styles" it can instead have the contract there? (That's kinds of far away from where they are discussed; maybe repetition is okay or maybe it is better to do a different change.) I was inspired to think of this by wondering if |
Use item list to break up run-on sentence. Clarify combination of padding with other elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resyntax analyzed 0 files in this pull request and found no issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resyntax analyzed 0 files in this pull request and found no issues.
This looks great to me. I can squash and rebase if we're ready. |
On the one hand there might still be some error/omission that will turn up through active dog-fooding. (Which I'm doing; I was using On the other hand, we're not close to a release, so it would probably be OK if this is merged now, and another commit ends up tweaking it in (say) a few days/weeks? |
Okay, I've squashed and pushed to master here. |
The documentation portion of #634.
Note that this commit does /not/ add to the documented list of keys read by Dr Racket, because this commit does not add the behavior of Dr Dracket doing that and using the comment styles to drive its (un)comment commands.