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

Clojure support #98

Open
PEZ opened this issue Jan 14, 2023 · 4 comments
Open

Clojure support #98

PEZ opened this issue Jan 14, 2023 · 4 comments

Comments

@PEZ
Copy link

PEZ commented Jan 14, 2023

Thanks for providing Blockman!

I would love for it to have Clojure support. Clojure is a LISP, so therefore structured, similar to XML, but using only (), [], and {} to mark start and end of forms (a.k.a. S-expressions).

In this screenshot you can see that Blockman does the right thing (afaiu) on {} forms, but doesn't mark up the two other form types:

image

At line 29 I have tried to trick Blockman by putting } inside a string, and also in a line comment, but Blockman handles it. Leading me to think that at least basic Clojure support might be in close reach for it (speculation, but anyway 😄).

If you think you need a ”real” Clojure tokenizer, I have one in Calva to use for inspiration, and if that one is not a good fit, I think I know where to find two other JavaScript implementations. But hopefully a naïve ”if Clojure or other LISP, do whatever is currently done with {} with () and [] too” could work.

Cheers!

@PEZ
Copy link
Author

PEZ commented Jan 14, 2023

Another option for the tokenization is that we add an API to Calva to get the tokens it has already lexed out. For larger documents it might save performance to not tokenize several times.

@leodevbro
Copy link
Owner

Hello, thanks for creating this issue. Well, I guess I have good news. Blockman has disabled square bracket ([]) and round bracket (()) block rendering by default, because I think most languages does not need other than only curly bracket block rendering (otherwise it may look too overloaded) as a visual help for most users. So you can enable square and round brackets:

Go to VS Code settings, and search:
blockman n23 analyze square brackets
make it true
then search:
blockman n24 analyze round brackets
make it true
That's it.

I hope it will work. If not, please let me know.

@PEZ
Copy link
Author

PEZ commented Jan 14, 2023

Awesome! It works great for Clojure. Looks like so now:

image

It doesn't start highlighting blocks in JS and JSON files for me. Which is good, but a bit strange, since I enabled it.

Is there a way you can make it possible to scope Blockman settings by language? Then users could do:

    "[clojure]": {
        "blockman.n23AnalyzeSquareBrackets": true,
        "blockman.n24AnalyzeRoundBrackets": true
    },

That currently is marked as a problem with the message: ”This setting cannot be applied because it is not registered as language override setting.” Indicating that we can registering settings as being overridable by language. And then Blockman could provide configurationDefaults for [clojure], making it work out of the box.

@leodevbro
Copy link
Owner

Thanks, I'll try that soon.

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

No branches or pull requests

2 participants