vscode

Quiet in here? Check #calva-dev out :smiley:
WhoNeedszZz 2018-05-03T05:38:33.000079Z

Is there a color theme that actually understands Clojure?

WhoNeedszZz 2018-05-03T05:38:49.000077Z

Most color themes don't understand macros and treat all constants as the same

pez 2018-05-03T06:54:36.000165Z

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.)

WhoNeedszZz 2018-05-03T07:05:55.000346Z

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>" }

WhoNeedszZz 2018-05-03T07:06:50.000171Z

Now the question is how you could determine something is a macro over a function because grammatically there is no difference

pez 2018-05-03T07:08:18.000222Z

For indentation Calva uses a list of known macro forms.

WhoNeedszZz 2018-05-03T07:09:50.000073Z

So that would be a problem for macros that aren't in the std lib

WhoNeedszZz 2018-05-03T07:10:55.000263Z

If the theme could follow the code definition it could then search for defmacro at the start of the expression

WhoNeedszZz 2018-05-03T07:11:12.000011Z

But I don't know if that's possible as I've never written a theme

pez 2018-05-03T07:11:48.000366Z

We will probably add a configuration option where people can add whatever macros for the indentation case.

WhoNeedszZz 2018-05-03T07:12:05.000304Z

Who is "we" and add to what?

pez 2018-05-03T07:12:24.000158Z

We, as in we who make Calva.

WhoNeedszZz 2018-05-03T07:12:40.000279Z

My question has nothing to do with Calva

WhoNeedszZz 2018-05-03T07:13:43.000373Z

I'm also not talking about indentation

pez 2018-05-03T07:13:51.000306Z

I am aware of that. 😃 I am merely relating to a similar problem with macros. Since they should indent specially.

pez 2018-05-03T07:14:17.000080Z

And, just maybe the theming can use a similar approach.

WhoNeedszZz 2018-05-03T07:14:45.000253Z

Well manually adding symbols would not be a good solution

pez 2018-05-03T07:16:12.000404Z

But, macros seem to highlight nicely for me, using the default dark theme. At least the stdlib ones, and anything that starts with def.

WhoNeedszZz 2018-05-03T07:16:54.000403Z

Currently std lib macros are identified by keyword.control and 3rd party macros are misidentified as entity.name.function

WhoNeedszZz 2018-05-03T07:17:17.000273Z

The issue isn't std lib macros

pez 2018-05-03T07:17:24.000206Z

So that's why nsand macros look the same?

WhoNeedszZz 2018-05-03T07:17:33.000427Z

Yes

WhoNeedszZz 2018-05-03T07:18:16.000105Z

So that's where Calva would come in. Macros should be something like keyword.macro or something

WhoNeedszZz 2018-05-03T07:18:39.000042Z

Or I guess it would be entity.name.macro?

pez 2018-05-03T07:18:52.000301Z

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.

WhoNeedszZz 2018-05-03T07:19:14.000283Z

Same

WhoNeedszZz 2018-05-03T07:19:34.000222Z

With a REPL it would be as simple as looking for defmacro in the definition

WhoNeedszZz 2018-05-03T07:19:56.000103Z

Themes seem to be just grammar based from what I understand

pez 2018-05-03T07:20:59.000288Z

But if the grammar can be dynamically amended then Calva could do it, I guess. It already does definition lookup.

WhoNeedszZz 2018-05-03T07:21:22.000059Z

Well right, but that's outside of the context of theming

WhoNeedszZz 2018-05-03T07:21:46.000125Z

But again grammatically there isn't any difference between calling a function or a macro

pez 2018-05-03T07:21:54.000275Z

There's two parts of it, right? The grammar and the theme.

WhoNeedszZz 2018-05-03T07:22:31.000100Z

The theme utilizes the grammar

pez 2018-05-03T07:22:49.000082Z

Right, I will have to look closer at it to understand.

WhoNeedszZz 2018-05-03T07:23:07.000039Z

The grammar is different for definition, but not calling

WhoNeedszZz 2018-05-03T07:25:12.000176Z

So that's with Atom One Dark

WhoNeedszZz 2018-05-03T07:26:05.000146Z

It is aware that defroutes is a macro, but not GET, POST, PUT, DELETE, and even -> (which it should since that is std lib)

WhoNeedszZz 2018-05-03T07:27:54.000240Z

And I'm assuming it is aware of defroutes because Calva is looking for anything that starts with def

WhoNeedszZz 2018-05-03T07:28:36.000386Z

So if it was called def-GET it would work, but that looks clunky

WhoNeedszZz 2018-05-03T07:30:47.000318Z

Well no, as it is looking for no '-'

shooodooken 2018-05-03T13:28:43.000100Z

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...

WhoNeedszZz 2018-05-03T13:32:06.000678Z

Btw use Developer: Inspect TM Scopes to see the token categories

pez 2018-05-03T13:57:04.000631Z

That's great @shooodooken!

kwladyka 2018-05-03T18:19:11.000652Z

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?

WhoNeedszZz 2018-05-03T18:20:09.000068Z

It's a combination of how the language support defines tokens and how the theme uses them

kwladyka 2018-05-03T18:30:29.000359Z

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?

WhoNeedszZz 2018-05-03T18:32:26.000602Z

I don't have the knowledge required to answer that

kwladyka 2018-05-03T18:51:37.000446Z

@pez Do you consider to improve syntax highlight for Clojure? To better describe what i have in my mind:

kwladyka 2018-05-03T18:51:55.000080Z

i like this one

kwladyka 2018-05-03T18:52:09.000462Z

this one is poor for me

kwladyka 2018-05-03T18:53:22.000418Z

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.

WhoNeedszZz 2018-05-03T18:55:05.000725Z

Read up. We talked about that

pez 2018-05-03T18:59:21.000751Z

@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.

pez 2018-05-03T19:01:18.000633Z

The second one of your screenshots seems to make a distinction between macros and function. While the first one highlights keys.

kwladyka 2018-05-03T19:05:45.000314Z

first one is from intellij Darukala theme, second one is from VSC

kwladyka 2018-05-03T19:06:50.000212Z

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.

kwladyka 2018-05-03T19:07:28.000752Z

You are the only one who can handle it 🙂 I don’t know anybody else 😉

WhoNeedszZz 2018-05-03T19:10:59.000024Z

IntelliJ and VSC implement it differently

kwladyka 2018-05-03T19:11:41.000688Z

yes, unfortunately I see 🙂

kwladyka 2018-05-03T19:11:50.000441Z

But it doesn’t seems to be theme issue

kwladyka 2018-05-03T19:13:01.000521Z

But who know… I don’t have any idea how it works in editor.

kwladyka 2018-05-03T19:13:46.000311Z

I know only one is readable for me and in VSC i can’t find any theme which make code readable for me 🙂

kwladyka 2018-05-03T19:14:19.000290Z

but it looks very promising

kwladyka 2018-05-03T19:14:34.000586Z

much better than atom editor

kwladyka 2018-05-03T19:18:22.000589Z

Just I want to say I appreciate your work @pez

pez 2018-05-03T19:22:29.000633Z

❤️

kwladyka 2018-05-03T19:23:11.000241Z

BTW I found Darcula Extended looks much better. (I installed all of them). So it probably depend on theme.

kwladyka 2018-05-03T19:23:28.000357Z

afk, touchpad battery discharge 😞

pez 2018-05-03T19:23:55.000270Z

Seems we need to start with the grammar, right?

pez 2018-05-03T19:24:29.000186Z

Do you know where the clojure grammar is contributed, @whoneedszzz?

WhoNeedszZz 2018-05-03T19:26:38.000752Z

I don't

pez 2018-05-03T19:43:25.000413Z

I’ll try to track it down.