coc-clojure
Noah Bogartcoc.nvim wrapper for clojure-lsp
Published Package Summary
coc-clojure
coc.nvim wrapper for clojure-lsp. Heavily inspired by and some code borrowed from calva.
Install
:CocInstall coc-clojure
Keymaps
By default, every command is bound to <leader>cl[SHORTCUT], as defined by the
clojure-lsp website. This can be disabled in the configuration with
clojure.keymaps.enable.
If desired, these can be bound manually any way you want by relying on coc.nvim's
built-in CocAsyncAction function:
" Keymap
nmap <silent> rtl :call CocAsyncAction('runCommand', 'lsp-clojure-thread-last-all')<CR>
" Command
command! -nargs=0 RTL :call CocAsyncAction('runCommand', 'lsp-clojure-thread-last-all')
License
MPL 2.0
- coc.nvim wrapper for clojure-lsp
- onLanguage:clojure
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.
Contributed Commands
All contributes.commands entries from the published package manifest for coc-clojure@0.0.17.
| Command (:CocCommand) | Description |
|---|---|
| lsp-clojure-add-missing-import | Add Java import for symbol under cursor to current namespace declaration |
| lsp-clojure-add-missing-libspec | Add require form for symbol under cursor to current namespace declaration |
| lsp-clojure-add-require-suggestion | Add suggested require to ns form |
| lsp-clojure-backward-barf | Paredit: backward barf |
| lsp-clojure-backward-slurp | Paredit: backward slurp |
| lsp-clojure-change-coll | Choose new type of collection |
| lsp-clojure-change-collection | Choose new type of collection |
| lsp-clojure-clean-ns | Sort and remove unused required libraries in namespace declaration |
| lsp-clojure-create-function | Create a function from the current form |
| lsp-clojure-create-test | Creates a test somewhere, who knows |
| lsp-clojure-cursor-info | Show debugging information for the symbol at cursor |
| lsp-clojure-cycle-coll | Cycle the kind of collection: list -> map -> vector -> set -> list |
| lsp-clojure-cycle-privacy | Cycle the privacy of current function definition |
| lsp-clojure-demote-fn | Demote fn to #() |
| lsp-clojure-destructure-keys | Destructure keys |
| lsp-clojure-docs | Read the docs for a given symbol (in given namespace) |
| lsp-clojure-drag-backward | Move coll entry backward in collection |
| lsp-clojure-drag-forward | Move coll entry forward in collection |
| lsp-clojure-drag-param-backward | Move param backwards in function definition (and all call sites) |
| lsp-clojure-drag-param-forward | Move param forward in function definition (and all call sites) |
| lsp-clojure-expand-let | Move current let form up a level |
| lsp-clojure-extract-function | Move current form into new top-level function |
| lsp-clojure-extract-to-def | Move current form into new top-level def |
| lsp-clojure-forward-barf | Paredit: forward barf |
| lsp-clojure-forward-slurp | Paredit: forward slurp |
| lsp-clojure-get-in-all | Replace current and all nested forms with get-in form |
| lsp-clojure-get-in-less | Replace first form in current get-in form with nested form |
| lsp-clojure-get-in-more | Move current form to current get-in form |
| lsp-clojure-get-in-none | Replace entire current get-in form with nested form |
| lsp-clojure-inline-symbol | Replace all instances of symbol with symbol definition |
| lsp-clojure-introduce-let | Move current form to let-bound variable |
| lsp-clojure-kill-sexp | Paredit: Kill sexp |
| lsp-clojure-move-coll-entry-down | Move coll entry forward in collection |
| lsp-clojure-move-coll-entry-up | Move coll entry backward in collection |
| lsp-clojure-move-form | Move form under cursor to specified file |
| lsp-clojure-move-to-let | Move current form into surrounding let block |
| lsp-clojure-project-tree | Show project source-paths and external dependencies |
| lsp-clojure-promote-fn | Promote #() to fn, or fn to defn |
| lsp-clojure-raise-sexp | Paredit: Raise sexp |
| lsp-clojure-replace-refer-all-with-alias | Replace ':refer :all' with alias |
| lsp-clojure-replace-refer-all-with-refer | Replace ':refer :all' with ':refer [...]' |
| lsp-clojure-resolve-macro-as | Add entry to .clj-kondo/config.edn to resolve macro as another macro |
| lsp-clojure-restructure-keys | Inline destructured keys with nested calls |
| lsp-clojure-server-info | Show server configuration information |
| lsp-clojure-sort-clauses | Sort entries within current clauses/list/map/set/vector |
| lsp-clojure-sort-map | Sort entries within current clauses/list/map/set/vector |
| lsp-clojure-suppress-diagnostic | Add a :clj-kondo/ignore to suppress linting current line |
| lsp-clojure-test-tree | Show tests as tree of data for potential UI |
| lsp-clojure-thread-first | Replace current form with thread-first expession |
| lsp-clojure-thread-first-all | Replace current and all nested forms with thread-first form |
| lsp-clojure-thread-last | Replace current form with thread-last expession |
| lsp-clojure-thread-last-all | Replace current and all nested forms with thread-last form |
| lsp-clojure-unwind-all | Replace entire current threaded form with nested form |
| lsp-clojure-unwind-thread | Replace first two forms in current threaded form with nested form |
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Enable/disable coc-clojure extension"
}Raw JSON Schema
{
"type": "string",
"default": "clojure-lsp",
"description": "Path to executable"
}Raw JSON Schema
{
"type": "string",
"default": "latest",
"description": "The version of clojure-lsp to install, aka '2022.05.31-17.35.50'. Can also be 'latest' or 'nightly'"
}Raw JSON Schema
{
"enum": [
"off",
"messages",
"verbose"
],
"type": "string",
"default": "verbose",
"description": "Trace level between vim and clojure-lsp. Trace messages can be seen by calling CocCommand workspace.showOutput."
}Raw JSON Schema
{
"type": "array",
"deprecationMessage": "Please use 'clojure.executable-args'"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Create normal-mode mappings for clojure-lsp commands"
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"description": "Executable args"
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Enable/disable coc-clojure's message on startup"
}Raw JSON Schema
{
"type": "string",
"default": "<leader>cl",
"description": "The keyboard shortcut that will prepend the created commands"
}Raw JSON Schema
{
"type": "string",
"description": "Where to install clojure-lsp. If blank, defaults to coc's data folder"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Check for newer versions of clojure-lsp on start"
}Raw JSON Schema
{
"type": "object",
"properties": {
"exit-on-errors?": {
"type": "boolean",
"default": true,
"description": "Whether to exit the clojure-lsp process during api/cli call if any error is found, like classpath scan failure."
}
},
"description": "API-specific settings"
}Raw JSON Schema
{
"type": "object",
"properties": {
"home-path": {
"type": "string",
"default": null,
"description": "Whether to use this path to find JDK source and cache after startup for JDK classes java support."
},
"jdk-source-uri": {
"type": "string",
"default": "https://raw.githubusercontent.com/clojure-lsp/jdk-source/main/openjdk-19/reduced/source.zip",
"description": "URI containing the JDK source to be used."
},
"download-jdk-source?": {
"type": "boolean",
"default": false,
"description": "Whether to download JDK source from :java :jdk-source-download-uri and cache after startup for JDK classes java support."
},
"decompile-jar-as-project?": {
"type": "boolean",
"default": true,
"description": "Whether to decompile the whole jar as a java project when finding the definition of a java class."
}
},
"description": "Options related to java/jdk"
}Raw JSON Schema
{
"type": "object",
"properties": {
"sort": {
"type": "object",
"properties": {
"ns": {
"type": "boolean",
"description": "Whether to enable sort of ns children like require/import forms"
},
"refer": {
"type": "object",
"properties": {
"max-line-length": {
"type": "number",
"description": "the max refers to keep at same line before breaking the line."
}
},
"description": "Whether to enable sort of :refer form."
},
"import": {
"type": "boolean",
"description": "Whether to enable sort of :import form."
},
"require": {
"enum": [
true,
false,
"lexicographically"
],
"description": "Whether to enable sort of :require form. true to sort according to the Clojure Style Guide, :lexicographically to do a lexicographic sort that places unwrapped namespaces last."
}
},
"description": "How to sort various forms."
},
"ns-inner-blocks-indentation": {
"enum": [
"same-line",
"next-line",
"keep"
],
"type": "string",
"description": "Where to place first require/import."
}
},
"description": "Settings related to clean-ns refactoring."
}Raw JSON Schema
{
"type": "object",
"properties": {
"clojuredocs": {
"type": "boolean",
"default": true,
"description": "Whether to get clojuredocs information on hover, the clojuredocs content is cached."
},
"arity-on-same-line?": {
"type": "boolean",
"default": false,
"description": "Whether to keep the arity on the same line of the function on hover, useful for Emacs users."
},
"hide-file-location?": {
"type": "boolean",
"default": false,
"description": "Whether to show the full filename and path on hover."
}
},
"description": "Options related to hovering"
}Raw JSON Schema
{
"type": "object",
"default": {
"extra-dirs": [],
"generation": {
"namespaces": [],
"output-dir": ".lsp/.cache/stubs",
"java-command": "java"
}
},
"properties": {
"extra-dirs": {
"type": "array",
"items": {
"type": "string"
},
"description": "dirs to analyze to consider as part of manual generated stubs."
},
"generation": {
"type": "object",
"properties": {
"namespaces": {
"type": "array",
"items": {
"type": "string"
},
"description": "The namespaces to generate and analyze stubs, empty by default disabling stub generation."
},
"output-dir": {
"type": "string",
"description": "The output where to generate the stubs, by default .lsp/.cache/stubs"
},
"java-command": {
"type": "string",
"description": "the path to java command to spawn the stub process, default use java from $PATH."
}
},
"description": "Auto stubs generation"
}
},
"description": "Stub generation related settings."
}Raw JSON Schema
{
"type": "object",
"default": {},
"description": "Used for formatting, json encoded configuration for cljfmt."
}Raw JSON Schema
{
"type": "object",
"properties": {
"clean": {
"type": "object",
"properties": {
"sort": {
"type": "object",
"properties": {
"ns": {
"type": "boolean",
"default": true,
"description": ""
},
"refer": {
"type": "object",
"properties": {
"max-line-length": {
"type": "integer",
"default": 80
}
},
"description": ""
},
"import": {
"type": "boolean",
"default": true,
"description": ""
},
"require": {
"type": "boolean",
"default": true,
"description": ""
},
"import-classes": {
"type": "object",
"properties": {
"classes-per-line": {
"type": "integer",
"default": 3,
"description": "-1 for all lines"
}
},
"description": ""
}
},
"description": "Call clean-ns on the namespace after applying any refactor to it?"
},
"ns-inner-blocks-indentation": {
"enum": [
"next-line",
"same-line",
"keep"
],
"type": "string",
"default": "keep",
"description": "How to indent ns children forms like require and import."
},
"ns-import-classes-indentation": {
"enum": [
"next-line",
"same-line"
],
"type": "string",
"default": "next-line",
"description": "How to indent classes inside package imports from :import form."
},
"automatically-after-ns-refactor": {
"type": "boolean",
"default": true,
"description": "Call clean-ns on the namespace after applying any refactor to it?"
}
},
"description": "Settings related to cleaning files"
},
"clj-kondo": {
"type": "object",
"properties": {
"level": {
"enum": [
"off",
"on"
],
"default": "on",
"description": "Enable or disable clj-kondo linting"
},
"ns-exclude-regex": {
"type": "string",
"default": "",
"description": "Exclude the diagnostics/findings for namespaces that match this regex."
},
"report-duplicates": {
"type": "boolean",
"default": true,
"description": "Shows all linters of the same symbol instead of showing only the first spot."
}
},
"description": "clj-kondo specific settings"
}
},
"description": "clojure-lsp custom linters"
}Raw JSON Schema
{
"type": "string",
"description": "A absolute path to a file where clojure-lsp should log."
}Raw JSON Schema
{
"type": "object",
"properties": {
"segregate-test-references": {
"type": "boolean",
"default": true
}
},
"description": "Segregate main references from test references with option to disable."
}Raw JSON Schema
{
"type": "string",
"default": ".lsp/.cache",
"description": "Where to store the project's analysis cache, used to speed up next clojure-lsp startup. A path relative to project root or an absolute path."
}Raw JSON Schema
{
"type": "object",
"properties": {
"additional-edits-warning-text": {
"type": "string",
"default": null
}
},
"description": "A warning to show when the completion will perform additional edits, such as requiring a new alias."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [
"src",
"test"
],
"description": "Project-local directories to look for clj/cljc/cljs files. If using deps.edn, use :source-aliases instead."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "object",
"properties": {
"required": [
"project-path",
"classpath-cmd"
],
"project-path": {
"type": "string",
"description": "The file root file (project.clj, deps.edn, etc)."
},
"classpath-cmd": {
"type": "array",
"items": {
"type": "string"
},
"description": "The command to run to generate the project's classpath"
}
},
"description": "Project spec"
},
"description": "For defining how clojure-lsp should find your project classpath. The project-path should be a file and the classpath-cmd the command to run to get the classpath."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [
"dev",
"test"
],
"description": "Used for deps.edn projects, the aliases which clojure-lsp should get the source-paths besides the root level :paths and :extra-paths."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Whether to enable LSP semantic tokens server support for syntax highlighting."
}Raw JSON Schema
{
"enum": [
"zipfile",
"jar"
],
"default": "zipfile",
"description": "How the dependencies should be linked, jar will make urls compatible with java's JarURLConnection."
}Raw JSON Schema
{
"type": "object",
"default": ".cljfmt.edn",
"description": "Where to find cljfmt configuration for formatting. A path relative to project root or an absolute path. Use #re for regex inside the cljfmt configuration file."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"detail": {
"type": "string"
},
"snippet": {
"type": "string"
}
}
},
"description": "Additional user snippets to be available during completing."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Whether to copy clj-kondo hooks configs exported by libs on classpath during startup lint."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "if true or not present, document formatting is provided."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [],
"description": "List of extra configurations to load from classpath."
}Raw JSON Schema
{
"enum": [
":incremental",
":full"
],
"default": ":full",
"description": "The sync kind during document changes, if client should send whole buffer or just related changes."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Whether to automatically add the ns form in new blank files."
}Raw JSON Schema
{
"type": "array",
"items": {
"type": "string"
},
"default": [
"resources.*",
"target.*"
],
"description": "list of regex to filter source-paths. By default, source-paths are retrieved from classpath, and usually the classpath contains folders that are not directly project code or it's auto-generated like cljs resources or target folders but it's inside your project."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Whether to use ^:private metadata for refactorings instead of defn-"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "if true or not present, document range formatting is provided."
}Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Whether to keep parenthesis when threading single arity functions."
}Raw JSON Schema
{
"type": "boolean",
"deprecationMessage": "Please use 'clojure.initialization-options.source-paths-ignore-regex'"
}Raw JSON Schema
{
"type": "boolean",
"deprecationMessage": "Use 'clojure.initialization-options.hover.arity-on-same-line?'"
}Raw JSON Schema
{
"type": "boolean",
"deprecationMessage": "Use 'clojure.initialization-options.code-lens.segregate-test-references'"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Whether to update diagnostics of the changed references when editing files, avoiding outdated diagnostics in other files."
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Whether to async lint all project only files after startup to make features like List project errors work."
}