Skip to content

Added support and info for custom formatters in Firefox #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# CLJS DevTools Installation

## Enable Custom formatters in Chrome
## Enable Custom formatters in the browser

Available in [**Chrome 47 and higher**](http://googlechromereleases.blogspot.cz/2015/12/stable-channel-update.html).
### In Chrome and Edge

~~**WARNING**: Custom formatters will be probably removed from Chrome 86 (or later).~~
Available in [**Chrome 47 and higher**](https://googlechromereleases.blogspot.cz/2015/12/stable-channel-update.html) and **Edge 79 and higher**.

~~**WARNING**: Custom formatters will be probably removed from Chrome 86 (or later).~~
~~Please read recent news in [issue 55](https://github.com/binaryage/cljs-devtools/issues/55).~~
~~Newly since Chrome 84 you have to re-enable custom formatters every time you open devtools. The setting is not sticky anymore.~~

Expand All @@ -16,7 +18,20 @@ All should work the same as before for now. If your setting is not sticky, pleas

* Open DevTools
* Go to Settings ("three dots" icon in the upper right corner of `DevTools > Menu > Settings F1 > Preferences > Console`)
* Check-in "Enable custom formatters"
* Check "Enable custom formatters"
* Close DevTools
* Open DevTools

Note: You might need to refresh the page first time you open Console panel with existing logs - custom formatters are applied
only to newly printed console messages.

### In Firefox

Available in [**Firefox 111 and higher**](https://www.mozilla.org/en-US/firefox/111.0/releasenotes/).

* Open DevTools
* Go to Settings ("three dots" icon in the upper right corner of `DevTools > Menu > Settings F1 > Advanced settings`)
* Check "Enable custom formatters"
* Close DevTools
* Open DevTools

Expand Down
4 changes: 2 additions & 2 deletions examples/deps/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</head>
<body>
<pre>
1. Please open Chrome DevTools (CMD+OPT+I / CTRL+SHIFT+I)
2. Enable custom formatters in DevTools -> Settings -> Console -> Enable custom formatters
1. Please open Chrome, Edge or Firefox DevTools (CMD+OPT+I / CTRL+SHIFT+I)
2. Enable custom formatters in DevTools -> Settings -> Console / Advanced settings -> Enable custom formatters
3. Refresh the page and see output in the DevTools Console
</pre>
<script>app.core.main()</script>
Expand Down
2 changes: 1 addition & 1 deletion examples/lein/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Build the project and start a local demo server:
Wait for compilation and when figwheel fully starts:

* A demo page should be available at [http://localhost:7000](http://localhost:7000).
* Please visit it with Google Chrome browser with [enabled custom formatters](https://github.com/binaryage/cljs-devtools).
* Please visit it with Google Chrome, Microsoft Edge or Mozilla Firefox browser with [enabled custom formatters](https://github.com/binaryage/cljs-devtools).
* Open the web development console under devtools and you should see something similar to the screenshot above.

Note: you might need to refresh the page again to force re-rendering of custom formatters after opening the console.
4 changes: 2 additions & 2 deletions examples/shadow/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</head>
<body>
<pre>
1. Please open Chrome DevTools (CMD+OPT+I / CTRL+SHIFT+I)
2. Enable custom formatters in DevTools -> Settings -> Console -> Enable custom formatters
1. Please open Chrome, Edge or Firefox DevTools (CMD+OPT+I / CTRL+SHIFT+I)
2. Enable custom formatters in DevTools -> Settings -> Console / Advanced settings -> Enable custom formatters
3. Refresh the page and see output in the DevTools Console
</pre>
</body>
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(def clojurescript-version (or (System/getenv "CANARY_CLOJURESCRIPT_VERSION") "1.11.4"))
(defproject binaryage/devtools "1.0.6"
:description "A collection of Chrome DevTools enhancements for ClojureScript developers."
:description "A collection of Chrome, Edge and Firefox DevTools enhancements for ClojureScript developers."
:url "https://github.com/binaryage/cljs-devtools"
:license {:name "MIT License"
:url "http://opensource.org/licenses/MIT"
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[![Clojars Project](https://img.shields.io/clojars/v/binaryage/devtools.svg)](https://clojars.org/binaryage/devtools)
[![Example Projects](https://img.shields.io/badge/project-examples-ff69b4.svg)](https://github.com/binaryage/cljs-devtools/tree/master/examples)

CLJS DevTools adds enhancements into Chrome DevTools for ClojureScript developers:
CLJS DevTools adds enhancements into Chrome, Edge and Firefox DevTools for ClojureScript developers:

* Better presentation of ClojureScript values in Chrome DevTools (see the [:formatters][1] feature)
* Better presentation of ClojureScript values in DevTools (see the [:formatters][1] feature)
* More informative exceptions (see the [:hints][2] feature)
* Long stack traces for chains of async calls (see the [:async][3] feature)

Expand Down
6 changes: 4 additions & 2 deletions src/lib/devtools/formatters.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns devtools.formatters
(:require-macros [devtools.oops :refer [unchecked-aget unchecked-aset]])
(:require [goog.labs.userAgent.browser :refer [isChrome isVersionOrHigher]]
(:require [goog.labs.userAgent.browser :refer [isAtLeast]]
[devtools.prefs :as prefs]
[devtools.util :refer [get-formatters-safe set-formatters-safe! in-node-context?]]
[devtools.context :as context]
Expand All @@ -14,7 +14,9 @@

(defn ^:dynamic available? []
(or (in-node-context?) ; node.js or Chrome 47+
(and (isChrome) (isVersionOrHigher 47))))
(isAtLeast "CHROMIUM" 47)
(isAtLeast "EDGE" 79) ;; First Edge to use Blink, has Blink 79.
(isAtLeast "FIREFOX" 111)))

(deftype CLJSDevtoolsFormatter [])

Expand Down