Custom snippets in Clojure LSP format (EDN). Practicalli designed snippets to encourage communication of the code purpose.
Clone the repository to the user level configuration location for Clojure LSP, either $XDG_CONFIG_HOME/clojure-lsp
or if XDG_CONFIG_HOME
is not set, $HOME/.config/clojure-lsp
Include :extra-paths
and :extra-deps
from project & user level aliases in LSP classpath. e.g. support a custom user
namespace in dev/user.clj
:source-aliases #{:dev :test :env/dev :env/test :lib/reloaded}
Include Java Sources installed via Debian / Ubuntu package openjdk-17-source
to support calls to Java Objects and Methods.
:java
{:jdk-source-uri "file:///usr/lib/jvm/openjdk-17/lib/src.zip" ;;
:home-path nil ;; jdk-source-uri takes precedence
:download-jdk-source? false}
Clean namespace ns
forms but do not sort require names
:clean {:automatically-after-ns-refactor true
:ns-inner-blocks-indentation :next-line
:ns-import-classes-indentation :next-line
:sort {:ns false
:require false
:import false
:import-classes {:classes-per-line 3} ;; -1 for all in single line
:refer {:max-line-length 80}}}
Use ^private
metadata for private function definitions rather than defn-
:use-metadata-for-privacy? true
Location of cljfmt configuration for formatting, path relative to project root. The defaults for cljfmt are used, except :remove-consecutive-blank-lines?
which is set to false to enable more readable code.
:cljfmt-config-path "cljfmt.edn"
cljfmt configuration included example
:indents
rules for clojure.core, compojure, fuzzy rules and examples used by the Clojure LSP maintainer.
Snippets created by Practicalli are documents in Practicalli Spacemacs
comment-heading
- describe purpose of the namespacecomment-separator
- logically separate code sections, helps identify opportunities to refactor to other name spacescomment-section
- logically separate large code sections with start and end line commentswrap-reader-comment
- insert reader comment macro,#_
before current form, informing Clojure reader to ignore next form
rich-comment
- comment blockrich-comment-rdd
- comment block with ignore :redefined-var for repl experimentsrich-comment-hotload
- comment block with add-libs code for hotloading libraries in Clojure CLI replwrap-rich-comment
- wrap current form with comment reader macrorequire-rdd
- add a require expression, for adding a require in a rich comment block for RDD
def
- def with docstringdef-
- private def with docstringdefn
- defn with docstringdefn-
private defn with docstringns
- namespace form with docstring
deps-alias
- add Clojure CLI aliasdeps-maven
- add a maven style dependencydeps-git
- add a git style dependency using:git/sha
deps-git-tag
- as above including:git/tag
deps-git-url
- add git style dependency using git url (url taken from dependency name as it is typed - mirrored placeholder)deps-local
- add a:local/root
dependency
require-rdd
- add a require expression, for adding a require in a rich comment block for RDDrequire
- simple requirerequire-refer
- require with:refer
require-as
- require with:as
aliasuse
- creates a require rather than the more troublesome use
deftest
- creates a deftest with testing directive and one assertiontesting
- creates a testing testing directive and one assertionis
- an assertion with placeholders for test function and expected results