This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-31
Channels
- # aleph (8)
- # announcements (11)
- # aws (1)
- # babashka (7)
- # beginners (104)
- # calva (52)
- # clara (1)
- # clj-kondo (28)
- # cljdoc (8)
- # cljsrn (2)
- # clojure (20)
- # clojure-europe (8)
- # clojure-uk (1)
- # clojurescript (26)
- # core-typed (3)
- # datomic (6)
- # holy-lambda (1)
- # jobs (1)
- # jobs-discuss (14)
- # malli (7)
- # pathom (31)
- # polylith (19)
- # re-frame (8)
- # reitit (1)
- # releases (1)
- # shadow-cljs (5)
- # tools-build (92)
When working with clojurescript , sometimes when I do clojure -A:fig:build
sometimes I see a message to open a browser
when doing that the repl do not show up and I do not see any error messages.
I see this on FF and Chrome
This is the output I see
4676ms to org.eclipse.jetty.util.log.StdErrLog
[Figwheel] Validating figwheel-main.edn
[Figwheel] figwheel-main.edn is valid \(ツ)/
[Figwheel] Compiling build dev to "target/public/cljs-out/dev-main.js"
[Figwheel] Successfully compiled build dev to "target/public/cljs-out/dev-main.js" in 1.526 seconds.
[Figwheel] Outputting main file: target/public/cljs-out/dev-main-auto-testing.js
[Figwheel] Watching paths: ("src") to compile build - dev
[Figwheel] Starting Server at
[Figwheel] Starting REPL
Prompt will show when REPL connects to evaluation environment (i.e. a REPL hosting webpage)
Figwheel Main Controls:
(figwheel.main/stop-builds id ...) ;; stops Figwheel autobuilder for ids
(figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
(figwheel.main/reset) ;; stops, cleans, reloads config, and starts autobuilder
(figwheel.main/build-once id ...) ;; builds source one time
(figwheel.main/clean id ...) ;; deletes compiled cljs target files
(figwheel.main/status) ;; displays current state of system
Figwheel REPL Controls:
(figwheel.repl/conns) ;; displays the current connections
(figwheel.repl/focus session-name) ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
[Rebel readline] Type :repl/help for online help info
Opening URL
Failed to open browser:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
Failed to open browser
and the X11 DISPLAY thing… So if the app is never opened in the browser you will not get a REPL connection, since that is where the REPL runs. Can you open http://localhost:9500 manually in a browser and see if you get a REPL then?
maybe put the project on github so you can try and see what happens ? @U0ETXRFEW
Do you have an earlier commit you can try, when things worked? The answer should be in the changes since then.
@U0ETXRFEW any idea ?
I have only changed this method
(defn update-output [_]
(prn "event fired")
(cond
(and (= \C (get-input-target))
(= \F (get-output-target)))
(do (set-output-temp (c->f (get-input-temp)))
(gdom/setTextContent display-unit-target "F"))
(and (= \F (get-input-target))
(= \C (get-output-target)))
(do (set-output-temp (f->c (get-input-temp)))
(gdom/setTextContent display-unit-target "C"))
:else
(do (set-output-temp (get-input-temp))
(gdom/setTextContent display-unit-target(get-input-target)))))
It is probably something else, but you can rule out this function by making the function body empty. Seem only to be side-effecting, so already returns nil
, I think…
Try shortcurcuit the app so that it does nothing at all. Somewhere where it starts, do as little as possible to just ensure that you can see if it starts or not.
hmm, I have to think how to do that here
(ns learn-cljs.temp-converter
(:require [goog.dom :as gdom]
[goog.events :as gevents]))
(defn f->c [deg-f]
(/ (- deg-f 32) 1.8))
(defn c->f [deg-c]
(+ (* deg-c 1.8) 32))
(def input-target (gdom/getElement "selectInputDegreeType"))
(def temp-input (gdom/getElement "inputDegree"))
(def output-target (gdom/getElement "convertedDegree"))
(def output-unit-target (gdom/getElement "selectConversionType"))
(def display-unit-target (gdom/getElement "convertedUnit"))
(defn get-input-temp []
(js/parseInt (.-value temp-input)))
(defn set-output-temp [temp]
(gdom/setTextContent output-target
(.toFixed temp 2)))
(defn get-input-target []
(.-value input-target))
(defn get-output-target []
(.-value output-target))
(defn update-output [_]
(prn "event fired")
(cond
(and (= \C (get-input-target))
(= \F (get-output-target)))
(do (set-output-temp (c->f (get-input-temp)))
(gdom/setTextContent display-unit-target "F"))
(and (= \F (get-input-target))
(= \C (get-output-target)))
(do (set-output-temp (f->c (get-input-temp)))
(gdom/setTextContent display-unit-target "C"))
:else
(do (set-output-temp (get-input-temp))
(gdom/setTextContent display-unit-target(get-input-target)))))
(gevents/listen output-unit-target "change" update-output)
Do you have another, similar, project that works? Otherwise create one from scratch. If that works, you know that the infrastructure works. Then “lifting” over things from the broken project, piece by small piece, should find you the problem.
It’s awful that you don’t get any errors anywhere. I don’t understand why that happens. I haven’t used figwheel in a long time so am not the best person to advice on that particular thing. I can only offer general advice and that I share your frustration of getting stuck like that. It’s never fun when that happens!
> I can make this project again with the original code Yeah, it is like when you are lost during orienteering. Try find your way back to the last place where you could make the map match your surroundings. To keep running while lost only gets you more lost.
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Convert Temperature</title>
<link rel="icon" type="image/png" href="./assets/icon.png" />
<link
rel="stylesheet"
href=""
/>
<!-- -----------------------------Bootstrap 4.6----------------------------------------- -->
<link
rel="stylesheet"
href=""
integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l"
crossorigin="anonymous"
/>
<!-- -------------------------------Custom CSS Style---------------------------------------- -->
<link rel="stylesheet" href="css/style.css" />
</head>
<body class="d-flex justify-content-center align-items-center min-vh-100">
<div class="container">
<div class="row">
<div class="card-group col-12 col-md-10 offset-md-1 my-md-auto">
<div class="card inputSection col-12 col-md-6">
<div class="card-body">
<form>
<div class="row px-3">
<div class="col-12 col-md-11 px-4">
<span class="card-title d-block">Enter Temperature</span>
<label for="degreeInput" class="py-sm-2">Degree</label>
<div class="input-group">
<input
type="number"
class="form-control"
id="inputDegree"
name="inputDegree"
placeholder="Enter Degree"
value="0"
/>
<div class="input-group-append">
<select class="form-control" id="selectInputDegreeType">
<option value="C" selected>°C</option>
<option value="F">°F</option>
<option value="K">K</option>
</select>
</div>
</div>
<label for="selectConversionType" class="py-sm-2"
>Convert In</label
>
<div class="input-group d-inline-block">
<div class="input-group-append">
<select class="form-control" id="selectConversionType">
<option value="F" selected>
Fahrenheit (°F)
</option>
<option value="C">Celcius (°C)</option>
<option value="K">Kelvin (K)</option>
</select>
</div>
</div>
<button
type="submit"
class="convertBtn btn btn-lg col-12 col-md-6 offset-md-3 mt-4 rounded-pill d-flex justify-content-center align-items-center text-white"
>
Convert
</button>
</div>
</div>
</form>
</div>
</div>
<div class="card resultSection col-12 col-md-6">
<div
class="card-body d-flex justify-content-center align-items-center"
>
<div id="resultValueSection">
<div id="convertedDegree">32</div>
<h3 id="degree">°</h3>
<h3 id="convertedUnit">F</h3>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- -----------------------------JQuery Plugins------------------------------------------ -->
<script
src=""
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"
></script>
<script
src=""
integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns"
crossorigin="anonymous"
></script>
<!-- -------------------------------Custom JS Script---------------------------------------- -->
</body>
</html>
you mean this part : <script src="cljs-out/dev-main.js" type="text/javascript"></script>
No problem. I am happy I could help! I don’t think it is noisy when we keep it in a thread.
I live in a suburb south of Stockholm, Sweden. In a residential area by a lake. It’s pitch dark outside. We don’t have any street lights on the strip outside our house. Because I like to see the stars and planets better. But it has the downside that the small monsters think it is a bit scary to visit the house, so my youngest ones don’t get many (or even any) monster visits. 😃
Dear Calva friends. Here’s a fun VSIX to put to some testing: https://15632-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.223-689-clojuredocs-command-c09c9e54.vsix. It adds:
• ClojureDocs examples in the hover-lookup of symbols. So that you can at a glance see neat ways and caveats about Clojure core-ish symbols. Each example have two buttons/links:
◦ To Rich Comment, prints the example to a rich comment below the top level form you are editing/viewing
◦ To Output Window, prints the example to the REPL/Output window
• A command for printing all clojuredocs examples for the symbol under the cusror to a Rich Comment, default bound to ctrl+alt+r d
(to go well with the command for opening a new rich comment block).
• A command for printing all clojuredocs examples for the symbol under the cursor to the Output/REPL window, ctrl+alt+o d
You can see earlier versions of this change in these tweets:
• https://twitter.com/pappapez/status/1452325865933746185
• https://twitter.com/pappapez/status/1452409528511762444
Please help test this. This VSIX will work even better (more coverage) when the next version of clojure-lsp is released, but I like to test that it works and doesn’t misbehave with the current clojure-lsp as well, so please don’t wait with your testing! 🙏 ❤️
Just checked it out, the clojureDocs integration is awesome! is there any way to increase the hover space(or maybe have the docs in a new file itself?)