Skip to content

Commit

Permalink
Move notebooks file association to Calva Spritz
Browse files Browse the repository at this point in the history
* Fixes #1850
  • Loading branch information
PEZ committed Mar 17, 2023
1 parent ffb958f commit 1ee3b16
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 17 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changes to Calva.

## [Unreleased]

- Workaround: [LiveShare participants incorrectly opening every Clojure file as if via "Open with Notebook"](https://github.com/BetterThanTomorrow/calva/issues/1850)

## [2.0.339] - 2023-03-16

- Fix: [Stopping Jacked-in REPL process doesn't kill Unix Java process](https://github.com/BetterThanTomorrow/calva/issues/2116)
Expand Down
10 changes: 10 additions & 0 deletions docs/site/live-share.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ programming, for example.
An extra nice thing is that each participant is using their own VSCode configuration, including fonts, colors,
keyboard shortcuts, etc.

!!! Note "Disable Calva Spritz to get rid of Notebooks interference"
The headline below **Calva Supports Live Share** is true. However, due to [a bug in LiveShare](https://github.com/MicrosoftDocs/live-share/issues/4765), Guest participants always get their Clojure files opened in the Calva [Clojure Notebooks](notebooks.md) editor. To workaround this issue Calva uses a ”side-car” extension named **Calva Spritz** for the Notebooks associations of Clojure files. You can disable that extension when participating in LiveShare sessions.

## Calva Supports Live Share

When using Calva, you can use Live Share as well. Editing works exactly the same
Expand Down Expand Up @@ -91,3 +94,10 @@ visibility][visibility] of the Live Share documentation.

[liveshare]: https://docs.microsoft.com/en-us/visualstudio/liveshare/
[visibility]: https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/security#controlling-file-access-and-visibility

## Calva Spritz

Together with Calva there is an extension called **Calva Spritz** installed. It only provides the association of Clojure file types to Clojure Notebooks. This is due to the LiveShare issues mentioned above. So that you can disable the Notebook association when participating as a guest in LiveShare sessions. The issue is tracked here:

* Calva issue: [LiveShare participants incorrectly opening every Clojure file as if via "Open with Notebook"](https://github.com/BetterThanTomorrow/calva/issues/1850)
* LiveShare issue: [Guest opens Clojure file as a notebook (incorrectly)](https://github.com/MicrosoftDocs/live-share/issues/4765)
18 changes: 13 additions & 5 deletions docs/site/notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@ search:
---

!!! Warning "WIP: Notebook support is very basic and experimental"
* You might experience loss of file contents when saving a Clojure Notebook. _Have backups of any files you open as notebooks._
* Tooling around autocomplete, go to def, linting and such does not work at all yet.
* There is no Markdown support.
* Etcetera.
* You might experience loss of file contents when saving a Clojure Notebook. _Have backups of any files you open as notebooks._
* Tooling around autocomplete, go to def, linting and such does not work at all yet.
* There is no Markdown support.
* Etcetera.
As if this was not enough, notebooks can also interfere with [LiveShare support](live-share.md).

Please help test the feature. We're looking forward to your feedback!
Please help test the feature. We're looking forward to your feedback!

You can open any Clojure file as a notebook by right clicking the file -> `Open with...` -> `Clojure Notebook`.

Running cells sends them to the REPL and pretty prints the results. If the return is a string that starts with `<html` it will be displayed in an html webview.

Forms inside `(comment)` blocks get shown as their own cells. When adding code blocks in between those cells they get saved with the same indentation as the first form.

## Calva Spritz

Together with Calva there is an extension called **Calva Spritz** installed. It only provides the association of Clojure file types to Clojure Notebooks. This is due to the LiveShare issues mentioned above. So that you can disable the Notebook association when participating as a guest in LiveShare sessions. The issue is tracked here:

* Calva issue: [LiveShare participants incorrectly opening every Clojure file as if via "Open with Notebook"](https://github.com/BetterThanTomorrow/calva/issues/1850)
* LiveShare issue: [Guest opens Clojure file as a notebook (incorrectly)](https://github.com/MicrosoftDocs/live-share/issues/4765)
10 changes: 10 additions & 0 deletions notebooks-spritz/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.vscode/**
.vscode-test/**
src/**
.gitignore
.yarnrc
vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
3 changes: 3 additions & 0 deletions notebooks-spritz/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# LICENSE

Spritz is free to use as you wish.
13 changes: 13 additions & 0 deletions notebooks-spritz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Spritz

A bubbly connection between Clojure file types and Notebooks in VS Code, effervescently crafted to support Calva users.

Because of an issue with LiveShare in VS Code making all Notebook associated files open in Notebooks we have this side-car extension to go with Calva. It is a workaround until the issue is fixed by the LiveShare team.

The issue is tracked here:

* Calva issue: [LiveShare participants incorrectly opening every Clojure file as if via "Open with Notebook"](https://github.com/BetterThanTomorrow/calva/issues/1850)
* LiveShare issue: [Guest opens Clojure file as a notebook (incorrectly)](https://github.com/MicrosoftDocs/live-share/issues/4765)

This extension only provides the notebook file association of Clojure files. All notebook supporting code lives in Calva. As a Calva user you will get this extension automatically installed and enabled together with Calva. As long as you have it enabled you will have Clojure Notebooks in VS Code when using Calva. To disable Notebook association and make LiveShare sessions work better (without Notebooks, sadly).

Binary file added notebooks-spritz/calva-spritz-1.0.0.vsix
Binary file not shown.
44 changes: 44 additions & 0 deletions notebooks-spritz/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "calva-spritz",
"displayName": "Calva Spritz",
"publisher": "betterthantomorrow",
"description": "A bubbly connection between Clojure files and Notebooks in VS Code, effervescently crafted to support Calva users.",
"icon": "spritz-icon.png",
"repository": {
"type": "git",
"url": "https://github.com/BetterThanTomorrow/calva.git"
},
"version": "1.0.0",
"license": "MIT",
"bugs": {
"url": "https://github.com/BetterThanTomorrow/calva/issues"
},
"engines": {
"vscode": "^1.76.0"
},
"sponsor": {
"url": "https://calva.io/sponsors/"
},
"categories": [
"Notebooks"
],
"keywords": [
"Notebooks",
"Clojure",
"Calva"
],
"contributes": {
"notebooks": [
{
"type": "calva-clojure-notebook",
"displayName": "Clojure Notebook",
"priority": "option",
"selector": [
{
"filenamePattern": "*.{clj,cljc,cljs,cljx}"
}
]
}
]
}
}
Binary file added notebooks-spritz/spritz-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 3 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
"description": "With Calva you might evaluate any code in the project."
}
},
"extensionPack": [
"betterthantomorrow.calva-spritz"
],
"contributes": {
"debuggers": [
{
Expand Down Expand Up @@ -2858,18 +2861,6 @@
}
]
},
"notebooks": [
{
"type": "calva-clojure-notebook",
"displayName": "Clojure Notebook",
"priority": "option",
"selector": [
{
"filenamePattern": "*.{clj,cljc,cljs,cljx}"
}
]
}
],
"colors": [
{
"id": "calva.inlineForegroundColor",
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
"sourceMap": true,
"rootDir": "src"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "src/webview", "src/webview.ts", ".vscode-test"]
}

0 comments on commit 1ee3b16

Please sign in to comment.