-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
(def s "a string") font locks "a string" as a docstring #445
Comments
(def s "a string")
font locks "a string"
as a docstring
Your proposed fix works for me. |
Relatedly in (s/def :some/keyword (some-spec))
|
@vspinu That one should be easier to fix. Just a minor regexp tweak. |
@oskarkv File a PR and we can discuss the potential fix there. I'm a bit concerned about potential performance implications on larger buffers, but overall the approach seems reasonable, although it seems to be it won't work for |
e.g. |
|
That's what I meant. :-) |
Perhaps this should just check for a list of specific forms (with semantics similar to |
…t can have... strings and docstrings highlighted differently
…t can have... strings and docstrings highlighted differently
…ord) forms added tests as well
[Fix comment in #445] Proper font lock in (s/def ::keyword)
[Fix clojure-emacs#445] def form with strings and docstrings
Expected behavior
Font lock the string
"a string"
as a string in(def s "a string")
.Actual behavior
The string
"a string"
is font locked as a docstring in(def s "a string")
.clojure-mode version information
Proposed solution
I played around with this, and it can be solved by adding a check in this
and
https://github.com/clojure-emacs/clojure-mode/blob/master/clojure-mode.el#L898 in the functionclojure-font-lock-syntactic-face-function
. For exampleThis, of course, checks for a closing paren after the string, and if so, it is not considered a docstring, except for
defprotocol
, which is the only kind of form that can have a docstring in the last position. Instead of checking for a paren, one could of course check for another element, but it is more involved.Opinions, suggestions, etc?
The text was updated successfully, but these errors were encountered: