Skip to content

Detect more def* forms in Clojure syntax - #25546

Closed
Nikita Prokopov (tonsky) wants to merge 2 commits into
microsoft:masterfrom
tonsky:patch-1
Closed

Nikita Prokopov (tonsky) wants to merge 2 commits into
microsoft:masterfrom
tonsky:patch-1

Conversation

@tonsky

@tonsky Nikita Prokopov (tonsky) commented Apr 27, 2017 •

Copy link
Copy Markdown

It’s a convention in Clojure to use macros whose name starts with def to define something. Libraries often define their own custom macros for this:

  • defroutes (Compojure)
  • defc (Rum)
  • etc

This is why whitelisting only def macros from clojure.core isn’t working: it will detect standard vars and functions but will fail to detect custom def*-like macros.

This PR adds regular expression that treats all forms whose name starts with def (with optional namespace) similarly.

This convention is very well established so it shouldn’t hurt anyone.

@msftclas

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request.
Thanks,
Microsoft Pull Request Bot

@mjbvz

Copy link
Copy Markdown
Contributor

Thanks for looking into this.

Our clojure grammar actually comes from https://github.com/atom/language-clojure . Could you please resubmit this PR against that repo. That way any improvements will benefit other editors and tools as well. Once the PR is merged into language-clojure, back in the vscode Clojure extension, simply run npm run update-grammar to pick up the changes

@tonsky

Copy link
Copy Markdown
Author

done atom/language-clojure#65

@mjbvz Matt Bierner (mjbvz) added this to the May 2017 milestone May 2, 2017
@mjbvz

Copy link
Copy Markdown
Contributor

Thanks! I've pulled in these changes from language/clojure with 0ddd558 They should be in VSCode 1.13 insiders once those start up again

Closing but marking as part of the May milestone so that it is clear this change was picked up, just not through this PR

@tonsky

Copy link
Copy Markdown
Author

awesome! Thank you!

@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants