clojure-mode icon indicating copy to clipboard operation
clojure-mode copied to clipboard

Protocol method docstrings are not font-locked as docstrings

Open raxod502 opened this issue 9 years ago • 3 comments

Expected behavior

All docstrings should be shown in the docstring font-lock color (in my color scheme, a darker green than the green used for regular strings).

Actual behavior

This does not work for the docstrings of protocol methods. The docstring for an entire protocol is colored correctly, but the docstrings for the individual protocol methods are not.

Steps to reproduce the problem

You can see the behavior in the following image:

20160807101248

Simply pasting the code into a clj file should produce the same result.

(defprotocol Foo
  "Here is a
  multiline
  docstring."
  (bar [this baz]
    "Here is a
  multiline
  docstring."))

Environment & Version information

clojure-mode version information

clojure-mode (version 5.5.2)

Emacs version

GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
 of 2015-04-10 on builder10-9.porkrind.org

Operating system

OS X El Capitan 10.11.6

raxod502 avatar Aug 07 '16 16:08 raxod502

Since clojure-in-docstring-p appears to check the font-lock color in order to determine whether you are in a docstring or not, I think the relevant code to modify is in clojure-font-lock-syntactic-face-function.

raxod502 avatar Aug 07 '16 16:08 raxod502

Well, the problem is that currently docstrings are all considered to be positional relative to the beginning of some form. See https://github.com/clojure-emacs/clojure-mode/blob/464c9de6734cb4b426137674041d695c2a7c7ef9/clojure-mode.el#L854

We've got no code that can actually pinpoint dynamically whether something is a docstring. Obviously something like this can be implemented, but it would be breaking new ground. This is part of our lisp-mode legacy - there this wasn't an issue and much of the original clojure-mode code was was simply copied from lisp-mode.

bbatsov avatar Dec 31 '16 08:12 bbatsov

autogenerated with https://github.com/MalloZup/doghub: issue inactive since 450 days. Please update the issue or close it

MalloZup avatar Aug 05 '19 21:08 MalloZup