Is there a color theme that actually understands Clojure?
Most color themes don't understand macros and treat all constants as the same
I don't think that has to do with the theme? It sounds more like something to do with the syntax highlighting rules for Clojure. (Haven't looked at it. I don't know where those rules are provided, but it could be something Calva can amend.)
It does have to do with the theme. The theme dictates which category gets the color. It can be more generic like constant { "foreground": "<color>" }
or more specific like constant.keyword.clojure { "foreground": "<color>" }
Now the question is how you could determine something is a macro over a function because grammatically there is no difference
For indentation Calva uses a list of known macro forms.
So that would be a problem for macros that aren't in the std lib
If the theme could follow the code definition it could then search for defmacro
at the start of the expression
But I don't know if that's possible as I've never written a theme
We will probably add a configuration option where people can add whatever macros for the indentation case.
Who is "we" and add to what?
We, as in we who make Calva.
My question has nothing to do with Calva
I'm also not talking about indentation
I am aware of that. 😃 I am merely relating to a similar problem with macros. Since they should indent specially.
And, just maybe the theming can use a similar approach.
Well manually adding symbols would not be a good solution
But, macros seem to highlight nicely for me, using the default dark theme. At least the stdlib ones, and anything that starts with def
.
Currently std lib macros are identified by keyword.control
and 3rd party macros are misidentified as entity.name.function
The issue isn't std lib macros
So that's why ns
and macros look the same?
Yes
So that's where Calva would come in. Macros should be something like keyword.macro
or something
Or I guess it would be entity.name.macro
?
nRepl (or some of the middleware in there) has some method for identifying macros, I have seen it. But I am unsure wheter a theme could take advantage of that.
Same
With a REPL it would be as simple as looking for defmacro
in the definition
Themes seem to be just grammar based from what I understand
But if the grammar can be dynamically amended then Calva could do it, I guess. It already does definition lookup.
Well right, but that's outside of the context of theming
But again grammatically there isn't any difference between calling a function or a macro
There's two parts of it, right? The grammar and the theme.
The theme utilizes the grammar
Right, I will have to look closer at it to understand.
The grammar is different for definition, but not calling
So that's with Atom One Dark
It is aware that defroutes
is a macro, but not GET
, POST
, PUT
, DELETE
, and even ->
(which it should since that is std lib)
And I'm assuming it is aware of defroutes
because Calva is looking for anything that starts with def
So if it was called def-GET
it would work, but that looks clunky
Well no, as it is looking for no '-'
closed https://github.com/PEZ/clojure4vscode/issues/29... my fault. i had forgotten i had added venantius/ultra to my leiningen profile a while ago...
Btw use Developer: Inspect TM Scopes
to see the token categories
That's great @shooodooken!
What do you use for better highlight syntax? Default one is poor. It is not about theme. I have impression it is more about how syntax is detect. For example my favourite theme Darcula from intellij look so different in VBS. Readability in Intellij is so much better. Did you solve it? Somebody work on better highlight syntax for Clojure?
It's a combination of how the language support defines tokens and how the theme uses them
Still I didn’t find any syntax which make code readable for me. Can i set it in some easy way? Do you feel like me current situation is poor?
I don't have the knowledge required to answer that
@pez Do you consider to improve syntax highlight for Clojure? To better describe what i have in my mind:
i like this one
this one is poor for me
There is no theme which can highlight nice keys, name of functions, values, string, etc. like in Curisve. At least for me it doesn’t work.
Read up. We talked about that
@kwladyka I probably won’t be able to not look into how it can be improved. 😃 But there seems to be a lot I need to learn before I can wrap my mind around it.
The second one of your screenshots seems to make a distinction between macros and function. While the first one highlights keys.
first one is from intellij Darukala theme, second one is from VSC
I would say if Darcula theme in VSC will look the same like Darcula in intellij it should mean syntax is done right. Colours will be the preference then.
You are the only one who can handle it 🙂 I don’t know anybody else 😉
IntelliJ and VSC implement it differently
yes, unfortunately I see 🙂
But it doesn’t seems to be theme issue
But who know… I don’t have any idea how it works in editor.
I know only one is readable for me and in VSC i can’t find any theme which make code readable for me 🙂
but it looks very promising
much better than atom editor
Just I want to say I appreciate your work @pez
❤️
BTW I found Darcula Extended
looks much better. (I installed all of them). So it probably depend on theme.
afk, touchpad battery discharge 😞
Seems we need to start with the grammar, right?
Do you know where the clojure grammar is contributed, @whoneedszzz?
I don't
I’ll try to track it down.