GithubHelp home page GithubHelp logo

kixi / clojurevscode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from avli/clojurevscode

0.0 2.0 0.0 9.43 MB

Clojure support for Visual Studio Code

Home Page: https://avli.github.io/clojureVSCode/

License: MIT License

TypeScript 100.00%

clojurevscode's Introduction

clojureVSCode

Version Build Status

Clojure and ClojureScript support for Visual Studio Code.

If you are a ClojureScript user, please read this section carefully.

I'm trying, believe me!

Quickstart

Make sure that Leiningen is installed on your machine, open a Clojure file or project, wait until the extension starts the nREPL (see status on the bottom of the VSCode window) and connect to it - now all the goodies should work :-)

Doesn't work? Not exactly what you need? See the Manual Configuration section!

Supported Features

  • Code completion

Code completion example

  • Code navigation

Code navigationtion example

  • Interaction with REPL
  • Showing documentation on hover
  • Code formatting (cljfmt)
  • Function signatures

Code completion example

Features That Are not Supported (but Nice to Have)

Connecting to the REPL

  • Open a terminal (either the one embedded in VSCode or a separate one)
  • Change directory to the root directory of the Clojure project (where the REPL started by clojureVSCode will have updated the hidden file .nrepl-port)
  • with lein, do lein repl :connect.

Evaluating code in the REPL

Clojure: Eval (in the command palette) will compile the current file in the editor and load it in the REPL.

Manual Configuration

The method from the Quickstart section utilizes the so-called embedded nREPL that is run as an internal process. Sometimes you need more control on your development environment. In this case you can disable the automatical firing of the embedded nREPL by setting the

"clojureVSCode.autoStartNRepl": true

option in your VSCode settings globally or per-project and connect manually to whichever REPL instance you want by "Clojure: Connect to a running nREPL" command. Note, that in order to make the autocompletion, go to definition, and formatting functionality work you have to write necessary dependencies in your profiles.clj. Put the following content to your ~/.lein/profiles.clj for macOS and Linux:

{:user {:plugins  [[cider/cider-nrepl "0.15.1"]]
       :dependencies [[org.clojure/tools.nrepl "0.2.12"]
                      [cljfmt "0.5.7"]]}}

Alternetively, you can put the code above to your project project.clj file.

Contributed Configuration

The extension contributes the configuration parameters listed in the table below.

Parameter Description
clojureVSCode.autoStartNRepl Whether to start an nREPL when opening a file or project.
clojureVSCode.formatOnSave Format files with cljfmt on save.
clojureVSCode.cljfmtParameters Formatting parameters passed to cljfmt each time it runs, e.g. :indentation? true :remove-surrounding-whitespace? false

ClojureScript Project Setup

The extension has the experimental support of ClojureScript. The example of a ClojureScript project setup can be found here. Checkout the project profile.clj file to learn what dependencies you need.

The embedded nREPL does not support ClojureScript, consider to use the "clojureVSCode.autoStartNRepl" setting. You will need to run an nREPL manually and execute the following commands inside it:

(require 'cljs.repl.node)
(cemerick.piggieback/cljs-repl (cljs.repl.node/repl-env))

After that you can connect to the nREPL using the "Clojure: Connect to a running nREPL" command. Now you can evaluate you ClojureScript code and use the other extension facilities.

How to Contribute

Open an issue if you want to propose new features and ideas or to report bugs. If you want to help with some code and looking for a place to start, please check out the How to Contribute wiki page.

Thanks

License

MIT

clojurevscode's People

Contributors

avli avatar alessandrod avatar fachammer avatar yurtaev avatar marcomorain avatar mhansen avatar mikeball avatar m90 avatar jylhis avatar tonsky avatar fasfsfgs avatar vganshin avatar

Watchers

James Cloos avatar Guenter Kickinger 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.