Giter VIP home page Giter VIP logo

cljfmt-graalvm's Introduction

cljfmt-graalvm

Note

This fork and enhancement for bsless/cljfmt-graalvm is because that repo is archived as of 2022-10-17

This is a re-packaging of weavejester/cljfmt as a fast-starting, native CLI tool for formatting Clojure code idiomatically. cljfmt has its own native-image packaging, but doesn't offer a stdio interface for use from editor tools like format-all.

Code vendored from weavejester/cljfmt or from clojure.stacktrace was to type hint class types the native image could not figure out.

The compile script is based on clj-kondo's

All credit goes to Weavejester (James Reeves, cljfmt) and Borkdude (Michiel Borkent, clj-kondo) Stuart Sierra (stacktrace) and their respective contributors.

Prerequisites

  • Get GraalVM
  • Set GRAALVM_HOME to the unpacked archive or add $GRAALVM_HOME/bin to your path
  • Clone this repo

Installation

  • run script/compile
  • copy target/cljfmt to someplace in your $PATH

Usage

  • drop-in replacement for the deprecated node-cljfmt, reading *in* and writing formatted clojure code to *out*. This is the interface used by format-all for Emacs.

    • stdio
  • also replicates the options of the original cljfmt lein task.

    • fix
    • check

Emacs

If you are using doom emacs, add this to your ~/.doom.d/config.el.

(set-formatter! 'cljfmt "cljfmt stdio")

As of 2023-01-03, Doom emacs has its format module pinned to format-all 0.5.0. If you are using a later version of format-all, use zprint or set zprint.

(set-formatter! 'zprint "cljfmt stdio")

zprint is an alternative to cljfmt.

Options

Just like lein cljfmt

--file-pattern FILE_PATTERN            \.clj[csx]?$
--indents INDENTS_PATH
--alias-map ALIAS_MAP_PATH
--project-root PROJECT_ROOT            .
--[no-]ansi
--[no-]indentation
--[no-]remove-surrounding-whitespace
--[no-]remove-trailing-whitespace
--[no-]insert-missing-whitespace
--[no-]remove-consecutive-blank-lines

License

Copyright © 2023 Paul Bauer

Copyright © 2020 Ben Sless

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.

cljfmt-graalvm's People

Contributors

bsless avatar pmbauer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.