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

Fontifies documentation comments #64

Closed

Conversation

davazp
Copy link

@davazp davazp commented May 18, 2015

I have implemented fontification of both line (/// and //!) and block (/* and /!) comments. It uses the font-lock-doc-face, which does not look very pretty in some themes. We could change this if necessary. It includes unit tests and it fixes #61.

See a couple of screenshots:

example

test

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pnkfelix (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see CONTRIBUTING.md for more information.


(defun rust-look-for-line-doc-comment (bound)
;; Find documentation comments starging with //! or ///. It will
;; only match it if it is inside a non-nestable comment.
Copy link
Member

Choose a reason for hiding this comment

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

typo: "starging" should be "starting"

@davazp
Copy link
Author

davazp commented May 18, 2015

I use Emacs 24.4.1. I haven't test it at all with other versions.

@pnkfelix
Copy link
Member

@davazp I assume your response means that you noticed that travis CI says that emacs23 build is failing with this change?

In Emacs>=24, it is possible to use the macros by prefixing them with
cl-, (e.g: cl-loop), and it is not necessary to require the
library. However, this is still necessary for Emacs23.
@davazp
Copy link
Author

davazp commented May 18, 2015

Actually I didn't notice, but I read about emacs23 in the README.md and I supposed things could go wrong. It was easy to fix. I have switched cl-loop to loop (after requiring cl at compile time) and now it builds.

@Wilfred
Copy link
Contributor

Wilfred commented Jun 4, 2015

I'd love to see this merged -- is it missing anything? Looks good to me, other than one minor comment.

@@ -374,6 +381,51 @@
("fn" . font-lock-function-name-face)
("static" . font-lock-constant-face)))))


(defun rust-extend-region-nested-comment ()
;; Extend the region given by `font-lock-beg' and `font-lock-end' to
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these should be docstrings, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree they should be docstrings.

I opened an issue to run checkdoc as part of the test suite. I think checkdoc-compliance is a must for any elisp package. #70

birkenfeld added a commit to birkenfeld/rust-mode that referenced this pull request Jun 7, 2015
Using the syntactic-face-function, we can assign the proper
`font-lock-doc-face' to doc comments ("///", "//!", "/**", "/*!").

Test changes graciously copied from rust-lang#64
@davazp
Copy link
Author

davazp commented Jun 10, 2015

I close this pull request as #71 is a better solution.

@davazp davazp closed this Jun 10, 2015
birkenfeld added a commit to birkenfeld/rust-mode that referenced this pull request Jul 5, 2015
Using the syntactic-face-function, we can assign the proper
`font-lock-doc-face' to doc comments ("///", "//!", "/**", "/*!").

Test changes graciously copied from rust-lang#64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation String Highlight
5 participants