Git Product home page Git Product logo

calva's Introduction

Calva: A Clojure & ClojureScript IDE in Visual Studio Code

Calva logo

Distilled from CIDER*.

Welcome to Calva, an integrated, REPL powered, development environment for enjoyable and productive Clojure and ClojureScript programming in Visual Studio Code. It includes:

A lot of effort has been put into making Calva a good choice to start if you are new to Clojure. Calva is open source and free to use.

(*) Calva is short for Calvados, a liquid gifted to humanity from God. Calvas's REPL power is harvested from the produce of The Orchard.

Please give the Calva repository a star!

Users Like it 😍

Crispin Bennett's review:

This is great, and makes VS Code a truly viable IDE/editor for clojure development. It has great REPL support (including inline evaluation), an extensive Paredit implementation, and excellent linting (care of the bundled clj-kondo). Calva is being improved on at an impressive clip by maintainers who appear solidly committed to its ongoing development. It's well-documented, and manages to be both approachable and capable. A no-brainer if you're already a VS Code user, and well worth a look if you're not.

It's Easy to Get Started

Get Started with Clojure in VS Code in 20 seconds

There is Documentation

Head over to calva.io to learn more about how to use Calva. The most important stuff would be:

Why Calva?

From The Tao of Calva:

Calva's raison d´être is to provide Visual Studio Code users with an easy to use and productive environment for Clojure and ClojureScript development.

From the same page you can also learn that we want Calva to be a good choice for VS Code users asking:

How do I use my favorite code editor for Clojure development?

We also hope that Calva will contribute to making it easier to pick up Clojure as a new language.

Getting Started with Calva

Go to the documentation to find info on how to connect Calva to your project and start evaluating code and such. The documentation is built from this repository, and the source files are located in docs/site. So if you know about workarounds or gotchas or anything that is good to know about when using Calva, please edit the appropriate page (or create a new page) by PR.

Features

  • Syntax highlighting, plus:
    • Rainbow parens
    • Rainbow indent guides
    • Highlight active indent guide
    • Highlights misplaced brackets
    • LISP friendly bracket matching
    • Ignore form (#_) dimming and (comment) form highlighting
  • Code formatting and autoindent according to The Clojure Style Guide
  • Structural Editing (via Paredit)
  • Linting
  • Intellisense
  • Go to / peek at definition
  • Find all references
  • Rename symbol
  • Change all occurrences
  • References code lens (enable in settings)
  • Outline view
  • View doc strings on hover
  • View function signatures on hover, including help with knowing which argument you are typing
  • Debugger
  • Support for Clojure tools/deps, Leiningen, shadow-cljs, Figwheel Main, lein-figwheel, Clojurephant (Gradle) and the built-in ClojureScript browser/node repls. (For Boot, only Connect scenarios work, there is no Jack-in there.)
  • Your Custom Connect Sequences, including fully customized ClojureScript REPLs.
  • Switch the ClojureScript REPL connection between your different builds at will.
  • When editing cljc files, easily choose if REPL commands should go to the clj or cljs REPL by clicking the cljc/clj[s] indicator in the status bar.
  • And more

Powered in Part by Clojure-lsp

Calva uses a mix of static and dynamic analysis to power the experience. A lot of the static abilities come from clojure-lsp, and you can read more about Calva's integration of clojure-lsp in the documentation.

Demo: Evaluate top level forms inside (comment...)

Top level comment eval

The gif demos several more features, apart from the in-comment evaluation, like:

  • Signature help while typing function calls
  • Evaluation result display is a bit sticky (so you can examine several evaluations at once)
  • There is a richer display of results in the hover of the evaluated expression. (From where you can also copy the results to the clipboard)
    • Edit: This feature has been removed in favor of using peek definition. See here. This decision was made due to high memory usage from storing results, but may be added back at some point if it's desired by many users over the peek definition feature. Please let us know here if you'd like this added back.
  • Some structural editing

Demo: Signature Help, while Typing

It is pretty educational using the signature help hover to see which argument you are typing when the argument list is using destructuring, or when an argument is threaded in first before the arguments you provide inside the form.

Signature Help

Demo: Syntax highlighting, rainbow parens and guides

Dimming ignored forms

Demo: Syntax highlighting, dimming ignored forms

Dimming ignored forms

Demo: Peek at definitions, etcetera

Features

Demo: switch between clj and cljs repl sessions for cljc files

CLJC repl switching

Demo: References code lens (enable in settings)

References code lens

Demo: Outline

Outline view

How to contribute

I'm glad you are reading this section! There are many ways and you are welcome to combine them at will. Be creative 😄:

  • Give us feedback.
    • Via #calva at the Clojurians Slack.
    • Via filing issues.
  • Fix issues. PRs welcome! Calva is built using a combination of TypeScript and ClojureScript. The ClojureScript part uses the shadow-cljs tool chain. See the How to Contribute page on the wiki for instructions on how to hack on Calva. TL;DR It is super easy to get started!
  • Fix typos in the UI and in the docs. It might seem like a small enough thing to not bother about it, but really, typos get in the way of comprehension. Typos are bad, uhm?
  • Become a GitHub sponsor. Read on.

Calva Sponsors ❤️

A considerable amount of time, creativity, energy, worries, sweat, and tears (well, no tears, but anyway 😄), is being spent on Calva. Please consider sponsoring us to show us that extra level of appreciation. Here are the ways you can do it:

Please see this statement from Cognitect about the importance of supporting open source developers.

Significant additions to Calva has been made possible by funding from Clojurists Together. And this has often been transformational for the whole project.

The following people are helping to keep Calva maintained and improved by sponsoring with their hard earned money. It is fantastic. Thank you!

Patrons, Gold, and Silver sponsors are also displayed here: https://calva.io/#sponsors.

Calva Patrons

Agical

Calva Gold Sponsors

Liftoff Cognitect ThorTech Solutions

Calva Silver Sponsors

😭

Calva Pro Fans

lambdaschmiede GmbH

Calva Super Fans

Aram Zadikian 180° Insurance Peter Strömberg Simon Accascina Aaron Iba

Calva Fans

Bozhidar Batsov Clay Hopperdietzel Matthew Lyon Brian Scaturro Jochen Bedersdorfer Janne Sauvala ajoberstar glebovmaksim Chris Smothers Eugene Pakhomov

Calva Friends

Martin Klepsch Pedro Girardi Terje Scott Archer Norman Eckstein Sergei Udris Filipe Silva Snorre Magnus Davøen Nick A Nichols Ryan Jerue Tim Zöller Kailashnath Russell Matney Bertrand Cachet José Diaz Seng Nick Cernis Steve Ashton Christian Meter Repath Netdava Christophe Pelé

The Calva Team

We are Clojure and Visual Studio Code fans who care about the ergonomics of using our favorite programming language with our editor of choice.

Current Maintainers

Alumni

Code Contributors

Calva is an open source project with surprisingly many code contributors. We take great care to keep it easy and fun to contribute. See the Calva Development Wiki for more on this.

Telemetry

If the setting telemetry.telemetryLevel is set to "all", Calva will collect some telemetry. It is basically some key events, like that Calva is started, a repl connected, something is evaluated. Currently it is 10 events. For an up-to-date, and full, list of events, see: https://github.com/BetterThanTomorrow/calva/blob/published/src/analytics.ts and the calls to that module.

Happy Coding

We hope you will find good use for Calva. Please let us know what you think. PRs welcome, file an issue or chat us up in the #calva channel in the Clojurians Slack.

calva's People

Contributors

bpringe avatar cfehse avatar corasaurus-hex avatar crispinb avatar cyrik avatar dependabot[bot] avatar diegovdc avatar ericdallo avatar gerdint avatar ingydotnet avatar jj-atkinson avatar julienvincent avatar kstehn avatar marcomorain avatar mathieuroblin avatar mrkam2 avatar mseddon avatar nbardiuk avatar nickcernis avatar pedrorgirardi avatar pez avatar riotrah avatar rjerue avatar rogererens avatar sillycoon avatar sivertsenstian avatar stefan-toubia avatar svdo avatar tonsky avatar xfthhxk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calva's Issues

VS Code doesn't connect to nREPL

I'm having a problem to use the extension. I'm using the following workflow:

  1. Start a nREPL with lein repl or lein repl :headless.
  2. Open VS Code
  3. Waiting to connect

But the only message that shows is nrepl - trying to connect, and when I gave the command for evaluate the form it doesn't respond.
My environment is Ubuntu 16.04 with leningen.

I'm lost in how to proceed, maybe I'm using it in the wrong way, any help is welcome.

Thanks

[feature] highlight syntax in REPL

Again i will compare it to Cursive.

screen shot 2018-05-04 at 09 25 20

First part is input, next is output. On the bottom I pressed arrow up to display last input to show it work even during writing in REPL.

Format-on-save only works some of the time

Format-on-save used to work perfectly, but lately for some reason it only works some of the time. Most times when I save nothing happens, and I have to manually save a couple more times before the formatting actually happens.

Any idea if this may be an issue with calva or if there's something else I should look into?

print output when evaling

Where does the results of print goto? currently, I'm not able to see the printed results of the in-editor eval:

screen shot 2018-08-04 at 8 55 54 am

IntelliSense for requiring macros not showing

Macros are not shown in the IntelliSense list when attempting to require a macro. Behavior is working as expected for functions.

Example:
(require [compojure.core :refer [defrou...]]) should show defroutes as an option, but doesn't.

Calva will fail if no active file on startup

If I open up VSCode like this:

$ cd my-cljs-proj
$ code .

VS Code will have the Welcome page active. If I then try to connect with Calva, I'll get the error command 'calva.connect' not found

It seems to be this line:

return document.hasOwnProperty('fileName') ? document : vscode.window.activeTextEditor.document;

that is the issue. Having run the debugger on Calva, I think the reason is that vscode.window.activeTextEditor is undefined when only the welcome page is showing.

Edit:

 $ code --version
1.26.1
493869ee8e8a846b0855873886fc79d480d342de
x64

BUG: vscode displaying literal ansi color code on windows

Bug report coming from conversation in #vscode in clojurians slack on April 28/29/30.

When evaluating code in VSCode, ansi color codes are printed in terminal.

For example, instead of just outputting nil, it will output ?[36mnil?[0m
vscode-nrel-ansi-codes-in-terminal-output

In other (Windows) clients which use lein repl which support color output in terminal, the response text would be colorized correctly(with the ansi color information then removed after use).
Noticable, issue seems to be fundamental to Windows as cmd.exe, Powershell & VSCode terminal all suffer from this issue,

image

##Other Info
similar to clojure-emacs/cider#275 which was solved client side.

Peek and Go to definition: No definition found

I have a brand-new install of VS Code, Calva and Calva Paredit (installed yesterday).

The REPL seems to work ok (see screenshot - not sure if that is required for Peek and Go to to work)
screen shot 2018-06-04 at 11 03 49 am

I get "No definition found" when control-clicking on the function name and choosing either Go to or Peek:
screen shot 2018-06-04 at 5 53 09 pm

screen shot 2018-06-04 at 11 04 12 am

Hovering also doesn't work. I've tried this for both clj and cljs files. Any suggestions?

Requires with `:refer :all` cause unresolved symbols and unused namespace errors

I'm finding that if I use :refer :all in a namespace require, that Calva shows me some unexpected errors around unresolved symbols and unused namespace. For example, if I have:

(ns my.thing.user-test
  (:require [clojure.test :refer :all]))

Then assuming I have some tests defined, I will get the following errors:

Parse error: Unable to resolve symbol: deftest
Parse error: Unable to resolve symbol: is
Parse warning: unused namespace clojure.test

If I change my requires to use :as, or to list the referred items (e.g. [clojure.test :refer [deftest is testing use-fixtures]]), then the errors go away. I'm relatively new to Clojure, but these tests run fine, so it seems like a Calva parsing issue?

My environment:

  • MacOS
  • Calva 1.3.16
  • Joker 0.9.1
  • Clojure 1.9.0
  • Leiningen 2.8.1
  • cider/cider-nrepl 0.16.0
  • org.clojure/tools.nrepl 0.2.12

Trying to locate Joker even when linting is disabled

Hi, there!

Calva is trying to locate Joker on my path even when linting is disabled. Is this the expected behavior?

screen shot 2018-04-18 at 7 34 06 pm

*Many thanks for making this extension. This is so good for JavaScript programmers coming to ClojureScript. Super nice!

Pasted code doesn't indent correctly

Keep up the great work, Peter! I noticed a few format-as-you-go issues as I've been using the extension for a while, but most of it is working nicely.

Here's one, and I might file a couple more when I get around to it.

Take the following code snippet:

(ns testapp.core
  (:require
   [clojure.string :as string]))

If you want to add paste in [clojure.set :as set] in as a new required namespace, do the following:

  1. Copy the text [clojure.set :as set]
  2. Put your cursor after string] and hit ENTER, which correctly lines up your cursor with the first [
  3. Paste [clojure.set :as set]

The auto-indentation indents the new code an extra space:

(ns testapp.core
  (:require
   [clojure.string :as string]
    [clojure.set :as set]))

An example with slightly different behavior. Start with this:

(let [var1 :test]
  (do-something))
  1. Copy the text var1 :test
  2. Put your cursor after :test to add a new binding to the binding list and hit ENTER, which correctly aligns your cursor under var1
  3. Paste the text.

The pasted text this time gets un-indented in a strange way:

(let [var1 :test
  var1 :test]
  (do-something))

Do we need to show the output panel on initialization?

What concerns do you have about changing this behavior to not showing the output panel? What I like about Calva is that it 'just works'. Once the programmer has Calva installed one doesn't need to think much about it.

Automatically sync namespace in repl terminal to file

Hey guys i have been enjoying watching this project grow and would like to contribute, im just going to dump my ideas for how the ux could be improved and ill try and implement the simplest ones over the coming weeks if you think they make sense. Anyway firstly....

You added a nice switch current repl namespace to the current file command. This is handy but it would be even better if whenever the active window changes and it starts with a valid ns form it automatically does this

Can't connect to new REPL if VSCode was started first

I really enjoy using the integrated terminal in VSCode, so I tend to start my repl using lein repl from there.

I've noticed that clojure4vscode allows you to connect to a new REPL port if it was able to connect to some REPL at startup. But if you start VSCode first, there's no way to connect to a newly started REPL.

This is what I have to do to get it to work, which isn't ideal:

  • Start a REPL on your clojure project from a terminal somewhere
  • Open your clojure project in VSCode
  • Notice that clojure4vscode connects to the REPL successfully
  • Start a REPL from VSCode's integrated terminal
  • Click on the nrepl address in the task bar and it pops up a text box that allows you to connect to the REPL in the integrated terminal

This is what I would like to work:

  • Open your clojure project in VSCode
  • Start a REPL from VSCode's integrated terminal
  • Click on the nrepl - trying to connect label in the task bar, which pops up the text box that allows you to put in your newly-started REPL address

If this is supposed to work already and I'm doing something wrong, please let me know!

Really liking what you've done with this plugin so far. Nice work!

Calva + shadow.cljs throws an error when hot reload in some cases

Hi. Thank you for calva, it's awesome.

I found a very weird bug. In some cases when we run server or watch task in shadow-cljs, start the browser and only then connect calva to the nRepl, browser console throws the error every time we hot reload the code.

Here the steps to reproduce:

  1. Clone this repo https://github.com/quangv/shadow-re-frame-simple-example
  2. npm install or yarn
  3. npx shadow-cljs watch app
  4. open the http://localhost:8020 page, open the console
  5. open the project in VS Studio, connect it to the app build
  6. change anything in the code

expected result: console is clear
actual result: the error in the browser console

env.cljs:114 Uncaught TypeError: Cannot read property 'cljs$core$IFn$_invoke$arity$1' of null
    at core.cljs:4199
    at Object.cljs$core$some [as some] (core.cljs:4199)
    at browser.cljs:205
    at Function.G__24106__1 [as cljs$core$IFn$_invoke$arity$1] (core.cljs:4222)
    at core.cljs:5120
    at cljs.core.filter.cljs$core$IFn$_invoke$arity$2 (core.cljs:5120)
    at cljs.core.LazySeq.sval (core.cljs:3394)
    at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (core.cljs:3448)
    at Object.cljs$core$seq [as seq] (core.cljs:1210)
    at Function.cljs.core.seq_reduce.cljs$core$IFn$_invoke$arity$3 (core.cljs:2445)

The same error happens every time shadow-cljs reloads the code

If we first do 5 and then 4 - everything works fine.

I also tried the same steps in Emacs Cider and it works perfectly fine there.

Ideal Beginner Editor+REPL Setup

The editor + REPL is a significant hurdle to beginners. There are plenty of people advocating for Clojure and REPL-driven development and showing results, but those are people who already get it. They were either really persistent or had peers to help them navigate all of the incidental complexity of setting up an app, editor and REPL to become productive. If Clojurist want broader adoption, we need to simplify the setup.

I would consider myself a Clojure beginner - I've read books, watched videos, done all of the 4Clojure problems, made simle Re-frame apps. Often with a REPL. But it's been a struggle - not from the language but from the setup. So I'm going to take my beginner mindset and lay out some of the problems I've run into and imagine the setup that I would have loved to discover when I started (and would still probably use).

Alternate Universe Beginning Clojure Experience

  1. Create a re-frame or backend app scaffolding from command line. Just like we have now with lein new [TEMPLATE] NAME. We might consider this done.
  2. With a single command-line command, handle with dependencies and start the app and REPL. Right now, this can happen but often is at odds with working with the code in an editor.
  3. Open the project in an editor (VSCode?). Execute code inline or send to a REPL - no explicit dependencies, no profiles.clj, no magic incantations in the command line, no confusion of starting the REPL in a terminal or editor. It just works.
  4. When you change files, the REPL changes it's namespace automatically. You could switch to another ns just like you can now with (in-ns '...). As an experienced user, you can also turn off the auto-tracking the files. But the default REPL always represents the file you are working in.
  5. The new REPL doesn't care if the file is CLJ or CLJS code. As a user, you don't really care - you just want to execute the code you're working on.
  6. The REPL never gets out of sync or stale compared with the file you're working on. As soon as the file is saved, the REPL's namespace updates to reflect that.

I'm sure this may be too inflexible for some experienced users. But they already have very customizable, complicated tools that they use. And that's not really VSCode+Calva's target audience. Calva could expose options to turn some of these features off. But the idea is that beginners would get an amazing, productive experience right away.

It's steps 2 and 3 that gloss over so many implementation details and potential problems. Some things, as a beginner, that I don't want (yet) to know or care about:

  • Do I start the REPL from the command line or from the editor?
  • What's Piggyback? What is fighweel sidecar?
  • What's the difference between nRepl and figwheel? Do I care about socket REPLs?
  • What's the REPL port that I need to connect to?
  • What commands from the REPL (nREPL?) do I need to issue to start the CLJS REPL?
  • What's Cider?
  • What's my .lein/profiles.clj file and how do I get that set up to begin working in Clojure?

I don't know how you would implement step 3. Maybe it's a single dependency that is added to either profiles.clj or the project. If that was all that would be cool. Or maybe that dependency is effectively built into the editor. I really don't know.

Part of the problem is that there is a lot of mixed information out there that is out-of-date. For example:

  • Create a re-frame template from these: https://github.com/Day8/re-frame-template then run lein dev. But that's not actually how most people would do it - they want REPL integration with their editor. Which requires you to not run lein dev but run something else that is editor dependent.
  • Here's how to set up an nREPL with Figwheel: https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl. It's very long and there is old and new ways to do it. They keep saying it's "super advanced". It's not actually that hard, but requires a lot of trial and error and filtering out many outdated sources on the web. And REPL-driven development one of the greatest strengths of Clojure, so ideally it shouldn't be advanced at all.

There are a lot of people who put a lot of time into tools to make things easier. Like you guys. But it's still hard. I have a sense of why - the REPL(S) run independently of the editor, even though that's not how people generally use it. But there is still the editor/REPL divide. How do we cross it? How do we make professional tools that are easy to get started with?

It seems like you guys are thinking of similar issues and why you are putting so much work into Calva. So I thought I would share these ideas and see what you think. Are steps 1-3 unrealistic? Are 4-6 something beginners would want?

Is this an idealized version of a Clojure/Clojurescript beginner experience? Or does it look like something else?

Thanks for all of your hard work.

Can't click through to definition of syntax-quoted fn

I have a fix for this, but I'm logging the issue for tracking purposes.

Not an indentation issue, but cmd-click doesn't take you to the function definition of functions that use the syntax-quote macro (a backtick), which is convention in a certain method of defining routes in the pedestal framework. (See http://pedestal.io/reference/routing-quick-reference#_table_syntax)

In this case, I can cmd-click through to map in the first println, but I can't when it's syntax-quoted with a ` in the second println:

(println map)
;; => #function[clojure.core/map]
(println `map)
;; => clojure.core/map

REPL connection fails for cljc files

There seems to be a problem with the REPL connection when editing cljc files. It's the session that is undefined in these cases. I'm looking in to it.

Keyboard shortcuts on Mac broken

The alt-v prefix in the international Mac KB inserts (ˇ), and although the command is recognized, the character's already been inserted.

Connecting to REPL twice kills all new bash prompts

This is a pretty odd issue, but I've been able to reproduce it pretty simply in multiple clojure projects, and it took me quite a while to trace it back to this extension. I'd like someone else to try as a sanity check for me, though the repro steps are simple enough that I'm pretty sure it's a Calva problem.

Repro steps:

  • Start a repl for a clojure project with lein repl
  • Open VSCode
  • Click the nREPL button in the status bar and use the pre-populated host:port
  • Wait a few seconds for it to connect
  • Click the nREPL button in the status bar again to "re-do" the connection to that same host:port
  • All subsequent terminals everywhere (in VSCode, in macOS Terminal app, in iTerm2) won't load a bash prompt for me

I noticed this several times yesterday during the work day. If I ever have code changes that require a repl restart, I will often reconnect Calva to that repl in order to get all its functionality. So it's a pretty common workflow for me. Restarting my computer is the only way I've been able to get a bash prompt in any new terminal windows. I tried restarting the terminal, restarting VSCode, killing processes.... nothing seemed to work except a restart.

My System Details:
macOS High Sierra Version 10.13.6
VSCode 1.26.1
Leiningen 2.8.1 on Java 1.8.0_152 Java HotSpot(TM) 64-Bit Server VM
Project dependencies:
:dependencies [[org.clojure/clojure "1.8.0"]
[ring/ring "1.1.6"]]

Indentation on save not working

Saving the file with these examples doesn't fix the indentation:
screen shot 2018-06-04 at 6 13 32 pm

  • Parinfer is not installed
  • I've tried it with editor.formatOnSave both as true and false
  • REPL is working
  • Calva Paredit: 0.1.7
  • Calva: 1.3.23
  • VS Code: 1.23.1

My settings are here:

{
    "atomKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": true,
    "editor.minimap.enabled": false,
    "calva.lintOnSave": true,
    "calva.autoAdjustIndent": true
}

Thanks

[bug] "Run all tests" doesn't give feedback

Hi there,

Thank you for making this tool! It's been a great improvement for me over other Clojure plugins I've tried.

I'm unable to successfully use "Calva: Run all tests". I'm running a Clojure service inside a Docker container and connecting to that with Calva. In the docker server logs, I can see logging related to my tests, but Calva/VSCode doesn't report on any passes or failures.

In the VSCode output for "Calva says", all I see is:

Running all tests

At the time the tests appear to stop running (the server stops logging anything), nothing more is printed out, and I don't see any visual feedback over my code (like failing tests highlighted).

Could this be an issue with my dev machine configuration? Or is this an unsupported use case?

Linting failing

Something has broken linting. Joker recently updated to 0.9.2 so it could be the culprit, but the update didn't include anything major.

Trace:
TypeError: Cannot read property 'getDocument' of undefined at Object.lintDocument$$module$calva$repl$middleware$lint [as lintDocument]

Running the contributed command:'calva.evaluateSelection' failed.

I tried uninstalling/reinstalling, but its not working. The strange thing is, it was working, and then upon closing and reopening code, starting and entering the new repl, it stopped working.

Any way to troubleshoot the exception when this happens?

I am using 1.24.0.

Thanks--

Calva in CLJS

We don't want to throw all the existing JavaScript code away, that's not very practical. So let's try to incrementally 'migrate' existing functionalities to ClojureScript. But...where should we start? 🤔

Command not found

I am getting a "command not found" message for each calva function. vscode reinstallation and deleting ~ / .vscode folder does not help.

Linux 4.16.14-2-MANJARO

Version 1.24.1
Commit 24f62626b222e9a8313213fb64b10d741a326288
Date 2018-06-13T17:47:35.732Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

VS Code doesn't connect to nREPL - Part 2

I have Calva working fine on my Linux machine but when I try the same setup on my Mac VS Code Calva does not connect to the running nREPL. The Calva commands can't seem to be found. Please see screenshot:

screen shot 2018-05-14 at 8 42 53 pm

I've attached my ~/.lein/profiles.clj file (which works fine on Linux).

Any idea what's wrong?

Thank you for your help,

Eric

profiles.txt

setting up emacs-like keybindings for calva

I really like this project, the fact that cljc files have an option to switch between repls is great.

However, I'm finding the combination of ctrl-alt-v, e really awkward to use and would like to set up alternate keybindings such as ctrl-x, ctrl-e instead of ctrl-alt-v, e. Is there a guide on how this can be done?

Format on save not working

I am not sure this is always the case, but clojure4vscode should format the code upon saving if the user has that feature enabled. But it looks to me like it doesn't right now.

Namespace outline support

Hello Peter and Pedro, my name is Piotr ^^

I've been willing to give this awesome project a try, but it looks like the outline doesn't work yet with Clojure(Script) files. What do you think it would take to add outline support to calva?

Thanks

[bug] sync files in REPL

In Cursive there is a function "Sync files in REPL". It reloads all namespaces which changed (files edited).

So during coding after changes I can reload whole app (all modified namespaces / files) in REPL by shift+cmd+m.

It would be great to see this option here. I use it all the time to test my code after each part of changes.

State of Clojure in VS Code

This is a very exciting project! I have been waiting for Clojure to get better support in VS Code and this looks to be a very strong start in the right direction! Inline code evaluation is huge and its really nice to see an editor other than emacs finally adopt this :)

After reading #44 and some of the other discussions, I am wanting to open this issue as a more general discussion about the current state of Clojure tooling in VS Code and how this project fits in to all of that.

Personally I use VS Code for all my development work except Clojure for which I use Cursive on Intellij. Cursive is fantastic, but intellij is slow and resource hungry and ideally I would like to do all my development on the same editor. Here are the major areas I feel need to be addressed before the productivity loss from moving to VS Code would be small enough that the benefits of VS Code would out-weight. This is coming from the perspective of a 'mediumly' experience Clojurian and I don't know if these points will match the goal of this project or the pain points of the majority of Clojurians :) It will be nice to hear your thoughts on this.

Parinfer

This is huge - it is perhaps the biggest reason why I am unwilling to move to VS Code as it directly affects my productivity while writing Clojure. There is currently a project (https://github.com/shaunlebron/vscode-parinfer) to try add support for this in VS Code but it's integration right now really isn't great.

Perhaps a possible route is for this repo to also replace the existing parinfer extension and make it work (well). I'm not sure about the viability of this?

Custom User Commands

This is already a point on your readme about planned future work which is nice to see. This would make usage of the reloaded workflow much more viable in VS Code.


I will be trying out Calva more and will add to this if I find anything else I feel is key. I am very keen to see this project make Clojure great in VS Code and I'll try to dedicate some time to contributing! Custom user commands seems like a good place to start, perhaps we can chat on slack about what that will entail.

Keep up the good work!

Fix indentation for following forms: deftest, testing, defn-

deftest, testing, and defn- should be added to the oneIndentForms array in ontype_formatter.js.

deftest and testing should have the form:

(deftest my-test
  (testing "some subtest description"
    (test-functions-here)))

But auto-indent is doing this:

(deftest my-test
         (testing "some subtest description"
                  (test-functions-here)))

Similarly, defining a function with defn- should behave the same as defn with regards to indentation. Should look like this:

(defn- private-fn [arg]
  (indents-two-spaces))

Actual behavior:

(defn- private-fn [arg]
       (this-is-indented-to-far))

This is one I could have fixed myself, but I haven't yet gotten ramped up on how to build and test an extension locally :)

Keep inline evaluation results until dismissed or the evaluated code is deleted

Currently when evaluating code and showing the results inline the results disappear when the selection changes/cursor is moved.

Other editors/plugins let the evaluation results stay and you can evaluate some other piece of code and have those results displayed inline too.

This would call for another way for the user to be able to dismiss the results.

Simple node repl for Clojurescript, without Figwheel or Shadow-cljs

Hi there,

I am working on some Clojurescript projects that are just simple command line apps, targeting Node js.. as such, I don't need the all the features of Figwheel or Shadow-cljs e.g. reloading and browser support.

I did manage to get the repl working for Figwheel and Shadow-cljs, but it was a bit cumbersome since I needed to create and compile a 'main' cljs script first, and then manually run the resulting js script with Node before the Figwheel or Shadow-cljs would connect (in addition running to the nrepl server with lein repl). Even then I had (Figwheel) issues, such as not being able to evaluate code with ctrl-alt-v e in a different namespace, until said namespace had been loaded by Figwheel.. but the only way I could get that to work was by changing the file in the other namespace and saving it. This all seemed a bit complex for what I needed, so I wondered if there was a simpler solution.

I wondered if it would be possible to avoid the manual invocation of Node, and also be able to start coding from scratch without needing to create a 'main' cljs script first, by using the Node repl in Clojure 1.9. Then I found the following article describing a process that worked for Cider/Emacs, and I thought I'd try it with Calva:

https://oli.me.uk/2018-03-04-clojure-and-clojurescript-nrepl-with-clojure-cli/

The result is that it 'nearly' worked.. after starting an nrepl server with lein repl and the needed project.clj config (see below), I could start a Clojurescript repl (backed by Node) from the Clojure repl in Calva by running

(cider.piggieback/cljs-repl (cljs.repl.node/repl-env))

I then updated the Calva calva.startCLJSREPLCommand setting to use this command for starting a Clojurescript repl. The result was promising, and Calva seemed to think the cljs repl was running!

However, when I tried to evaluate cljs code with ctrl-alt-v e I got various errors, for example when evaluating (ns my-app.main) I get

Evaluating:
my-app.main
Error: repl:13
throw e__9740__auto___19169;
^

ReferenceError: my_app is not defined
    at repl:1:59
    at repl:9:3
    at ContextifyScript.Script.runInThisContext (vm.js:50:33)
    at Object.runInThisContext (vm.js:139:38)
    at Domain.<anonymous> ([stdin]:56:38)
    at Domain.run (domain.js:242:14)
    at Socket.<anonymous> ([stdin]:55:29)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)

And when evaluating (def my-vals ["a" "b" "c"]) I get

Evaluating:
my-vals
Error: WARNING: Use of undeclared Var /my-vals at line 1 <cljs repl>

repl:1
try{cljs.core.pr_str((function (){var ret__9739__auto__ = .my_vals;
                                                          ^

SyntaxError: Unexpected token .
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Domain.<anonymous> ([stdin]:56:38)
    at Domain.run (domain.js:242:14)
    at Socket.<anonymous> ([stdin]:55:29)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:246:13)
    at Socket.Readable.push (_stream_readable.js:208:10)

Am I wrong in expecting this solution to work for Cider/Calva? I was kind of hopeful since it's working for Cider/Emacs...

Thanks!

My project.clj config:

(defproject my-app "0.1.0-SNAPSHOT"
  :description "my-app"
  :dependencies [[org.clojure/clojure "1.9.0"]
                 [org.clojure/clojurescript "1.10.64"]]
  :profiles {
             :repl {:plugins [[cider/cider-nrepl "0.18.0"]]
                    :dependencies [[org.clojure/tools.nrepl "0.2.13"]
                                   [cider/piggieback "0.3.8"]]
                    :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}}})

Auto-indent according to guidelines

In issue #2, @tjbrandt writes:

For formatting/indenting, a good example is using a let form.

Consider the following snippet:

(let [x :first-val
      y :second-val]
  (println x y))

As you're typing that out, hitting the return key after :first-val should, if honoring the style guide, put your cursor directly below x, so that when you then type y, the x and y should be vertically aligned. However, VSCode instead either puts you back at the beginning of the next line (if auto-indent is off) or indents you only 2 spaces (if auto-indent is on).

But then, hitting return after typing the closing bracket ] after :second-val, the cursor should then be placed on the next line and indented two spaces, according to the style guide. But VSCode "intelligently" decides that you're trying to indent everything at the same indentation as the last couple variables, so it then puts you directly under the y, even though this time that's not what you wanted.

Go to / peek at definition not working

I'm using Clojure, and I've been using this extension for a few weeks now and have never had the go to / peek definition working. I was thinking it would be nice if this extension had this feature, and then I noticed in the readme that it does, but mine is not working.

I noticed a closed issue related to this problem. I'm not sure if it's back with recent versions of VS Code or something else is going on with my setup. I have a fresh lein project open with no dependencies besides Clojure 1.8. My VS Code version is 1.25.1.

If I right click on a symbol and click peek definition I get "No definition found for..." My file is evaluated before trying this as well, and in the repl if I type the symbol in it shows it exists.

Branding

What you think about the idea of working a little bit on Calva's branding? What about presenting Calva more like a product?

What you think about this: Calva: Clojure & ClojureScript IDE for VSCode

Equivalent of Intellij show parameters (cmd+p)

One feature i notice lacking in the intelli-sense is displaying the expected params to function

I get auto completion and documentation in line like so:

image

But it would be nice to have the different arity's of the methods show up when the cursor is in the arguments position (ie after you have selected a specific function), something like this:

image

Cannot connect to repl created by lein in vs code 1.24.0

Hello, here is my system and what I am running into.
OS: Windows 10 64 bit
Shell: 1.7.12
VS Code Version: 1.24.0
Clojure 1.8.0
REPL-y 0.3.7, nRPL 0.2.12
Java HotSpot(TM) Client VM 1.8.0_144-b01

I took the steps that were previously working, that is navigate to the root directory of my project. Create a rpl with lein repl. Use CTRL + Shift + P and then use Calva: Connect, enter in localhost:(port number shown in repl), and nothing happens. I cannot execute code with CTRL + Shift + V and E. It does not give any errors but is also not seemingly connecting to the repl.

So far I have tried restarting the computer, starting repl's in different sub directories but to no avail. Any ideas or suggestions?

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.