Skip to content

Commit

Permalink
Merge branch 'main' into cb/desktop-app
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrekker committed Apr 10, 2024
2 parents ce258b7 + 50582a1 commit 596c299
Show file tree
Hide file tree
Showing 76 changed files with 1,833 additions and 620 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Thank you for reporting an issue about Pluto! Let's get it fixed!
3. 🤕 Try to clearly explain what the problem is, it might not be obvious to others! Instead of saying: "This does not work.", try to say: "I expected ..., but instead I am seeing ..."


🙋 But my issue is really simple, I don't want to make a screen recording / notebook!
🙋 But my issue is really simple, I don't want to make a screen recording / notebook! And why do you need a notebook file?

> **Please do it anyways!** It is really difficult to know exactly what information we will need to solve the issue, and a video recording can save a lot of follow-up questions.
> Similarly, a notebook file means that we can start testing the problem immediately, saving Pluto's developers a lot of time.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/Bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
trigger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# We use that PAT token instead of GITHUB_TOKEN because we are triggering another github action on the 'release' event.
# Triggering a workflow from a workflow is only allowed if the relaying event is signed with a PAT.
# See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
Expand All @@ -42,11 +42,11 @@ jobs:
git reset --hard $GITHUB_SHA
# if this is a PR. then just checkout without fanciness
- uses: actions/checkout@v3
- uses: actions/checkout@v4
if: github.event_name == 'pull_request'

# Do the actual bundling
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 17.x
cache: "npm"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/FrontendTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Makes thes `julia` command available
- uses: julia-actions/setup-julia@v1
Expand All @@ -34,7 +34,7 @@ jobs:
run: |
julia --project=$GITHUB_WORKSPACE -e "using Pkg; Pkg.instantiate()"
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18.x"

Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true"
PUPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome-stable"

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: test-screenshot-artifacts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/IntegrationTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ jobs:
- { user: JuliaPluto, repo: PlutoSliderServer.jl }

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
arch: x64
- uses: julia-actions/julia-buildpkg@v1
- name: Clone Downstream
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ matrix.package.user }}/${{ matrix.package.repo }}
path: downstream
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/LaunchTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Makes thes `julia` command available
- uses: julia-actions/setup-julia@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ReleaseTriggers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
repository: ['fonsp/pluto-on-binder', 'JuliaPluto/sample-notebook-previews']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
curl \
-X POST \
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ jobs:
fail-fast: false
matrix:
# We test quite a lot of versions because we do some OS and version specific things unfortunately
julia-version: ["1.6", "1.8", "1.10", "nightly"] # "~1.11.0-0"]
julia-version: ["1.6", "1.10", "~1.11.0-0"] #, "nightly"] # "~1.12.0-0"]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Makes the `julia` command available
- uses: julia-actions/setup-julia@v1
Expand All @@ -51,3 +51,9 @@ jobs:
- uses: julia-actions/julia-runtest@v1
with:
coverage: false

- uses: actions/upload-artifact@v4
if: failure()
with:
name: test-snapshots-${{ matrix.julia-version }}-${{ matrix.os }}
path: ${{ github.workspace }}/test/snapshots/*.html
2 changes: 1 addition & 1 deletion .github/workflows/TestBundledExport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: julia-actions/setup-julia@v1
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/TypeScriptCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18.x"
node-version: "21.x"

- run: npm install typescript@5.0.4 -g
- run: npm install typescript@5.4.3 -g

- run: npm install
working-directory: frontend
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ frontend/package-lock.json

# PProf
profile.pb.gz

test/snapshots
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name = "Pluto"
uuid = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
license = "MIT"
authors = ["Fons van der Plas <[email protected]>"]
version = "0.19.39"
version = "0.19.40"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down Expand Up @@ -42,7 +42,7 @@ Dates = "0, 1"
Downloads = "1"
ExpressionExplorer = "0.5, 0.6, 1"
FileWatching = "1"
FuzzyCompletions = "0.3, 0.4, 0.5"
FuzzyCompletions = "=0.5.4"
HTTP = "^1.5.2"
HypertextLiteral = "0.7, 0.8, 0.9"
InteractiveUtils = "1"
Expand All @@ -55,7 +55,7 @@ MsgPack = "1.1"
Pkg = "1"
PlutoDependencyExplorer = "~1.0"
PrecompileSignatures = "3"
PrecompileTools = "1"
PrecompileTools = "=1.2.1"
REPL = "1"
RegistryInstances = "0.1"
RelocatableFolders = "0.1, 0.2, 0.3, 1"
Expand Down
38 changes: 38 additions & 0 deletions frontend/common/parse_launch_params.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
*
* @return {import("../components/Editor.js").LaunchParameters}
*/
export const parse_launch_params = () => {
const url_params = new URLSearchParams(window.location.search)

return {
//@ts-ignore
notebook_id: url_params.get("id") ?? window.pluto_notebook_id,
//@ts-ignore
statefile: url_params.get("statefile") ?? window.pluto_statefile,
//@ts-ignore
statefile_integrity: url_params.get("statefile_integrity") ?? window.pluto_statefile_integrity,
//@ts-ignore
notebookfile: url_params.get("notebookfile") ?? window.pluto_notebookfile,
//@ts-ignore
notebookfile_integrity: url_params.get("notebookfile_integrity") ?? window.pluto_notebookfile_integrity,
//@ts-ignore
disable_ui: !!(url_params.get("disable_ui") ?? window.pluto_disable_ui),
//@ts-ignore
preamble_html: url_params.get("preamble_html") ?? window.pluto_preamble_html,
//@ts-ignore
isolated_cell_ids: url_params.has("isolated_cell_id") ? url_params.getAll("isolated_cell_id") : window.pluto_isolated_cell_ids,
//@ts-ignore
binder_url: url_params.get("binder_url") ?? window.pluto_binder_url,
//@ts-ignore
pluto_server_url: url_params.get("pluto_server_url") ?? window.pluto_pluto_server_url,
//@ts-ignore
slider_server_url: url_params.get("slider_server_url") ?? window.pluto_slider_server_url,
//@ts-ignore
recording_url: url_params.get("recording_url") ?? window.pluto_recording_url,
//@ts-ignore
recording_url_integrity: url_params.get("recording_url_integrity") ?? window.pluto_recording_url_integrity,
//@ts-ignore
recording_audio_url: url_params.get("recording_audio_url") ?? window.pluto_recording_audio_url,
}
}
2 changes: 1 addition & 1 deletion frontend/common/useEventListener.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useEffect } from "../imports/Preact.js"

export const useEventListener = (
/** @type {Document | HTMLElement | Window | null} */ element,
/** @type {Document | HTMLElement | Window | EventSource | MediaQueryList | null} */ element,
/** @type {string} */ event_name,
/** @type {EventListenerOrEventListenerObject} */ handler,
/** @type {any[] | undefined} */ deps
Expand Down
14 changes: 12 additions & 2 deletions frontend/components/CellInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import { moveLineDown } from "../imports/CodemirrorPlutoSetup.js"

export const ENABLE_CM_MIXED_PARSER = window.localStorage.getItem("ENABLE_CM_MIXED_PARSER") === "true"
export const ENABLE_CM_SPELLCHECK = window.localStorage.getItem("ENABLE_CM_SPELLCHECK") === "true"
export const ENABLE_CM_AUTOCOMPLETE_ON_TYPE = window.localStorage.getItem("ENABLE_CM_AUTOCOMPLETE_ON_TYPE") === "true"

if (ENABLE_CM_MIXED_PARSER) {
console.log(`YOU ENABLED THE CODEMIRROR MIXED LANGUAGE PARSER
Expand All @@ -85,6 +86,12 @@ window.PLUTO_TOGGLE_CM_SPELLCHECK = (val = !ENABLE_CM_SPELLCHECK) => {
window.location.reload()
}

// @ts-ignore
window.PLUTO_TOGGLE_CM_AUTOCOMPLETE_ON_TYPE = (val = !ENABLE_CM_AUTOCOMPLETE_ON_TYPE) => {
window.localStorage.setItem("ENABLE_CM_AUTOCOMPLETE_ON_TYPE", String(val))
window.location.reload()
}

export const pluto_syntax_colors = HighlightStyle.define(
[
/* The following three need a specific version of the julia parser, will add that later (still messing with it 😈) */
Expand Down Expand Up @@ -414,15 +421,17 @@ export const CellInput = ({
}, [on_change])
)

useLayoutEffect(() => {
useLayoutEffect(function cellinput_setup_codemirror() {
if (dom_node_ref.current == null) return

const keyMapSubmit = () => {
const keyMapSubmit = (/** @type {EditorView} */ cm) => {
autocomplete.closeCompletion(cm)
on_submit()
return true
}
let run = async (fn) => await fn()
const keyMapRun = (/** @type {EditorView} */ cm) => {
autocomplete.closeCompletion(cm)
run(async () => {
// we await to prevent an out-of-sync issue
await on_add_after()
Expand Down Expand Up @@ -742,6 +751,7 @@ export const CellInput = ({
results: message.results,
}
},
request_special_symbols: () => pluto_actions.send("complete_symbols").then(({ message }) => message),
on_update_doc_query: on_update_doc_query,
}),

Expand Down
4 changes: 1 addition & 3 deletions frontend/components/CellInput/LiveDocsFromCursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ export let get_selected_doc_from_state = (/** @type {EditorState} */ state, verb
if (
cursor.name === "Identifier" &&
parent.name === "ArgumentList" &&
(parent.parent.parent.name === "FunctionAssignmentExpression" ||
parent.parent.name === "FunctionDefinition")
(parent.parent.parent.name === "FunctionAssignmentExpression" || parent.parent.name === "FunctionDefinition")
) {
continue
}
Expand Down Expand Up @@ -297,7 +296,6 @@ export let get_selected_doc_from_state = (/** @type {EditorState} */ state, verb

if (VALID_DOCS_TYPES.includes(cursor.name) || keywords_that_have_docs_and_are_cool.includes(cursor.name)) {
if (!is_docs_searchable(cursor)) {
console.log("NOT DOCS SEARCHABLE")
return undefined
}

Expand Down
7 changes: 2 additions & 5 deletions frontend/components/CellInput/cell_movement_plugin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { EditorView, autocomplete, EditorState, keymap } from "../../imports/CodemirrorPlutoSetup.js"

// Why am I like this?
let completionState = autocomplete.autocompletion()[0]

/**
* Cell movement plugin!
*
Expand Down Expand Up @@ -148,8 +145,8 @@ export let prevent_holding_a_key_from_doing_things_across_cells = EditorView.dom

// Because of the "hacky" way this works, we need to check if autocompletion is open...
// else we'll block the ability to press ArrowDown for autocomplete....
// Adopted from https://github.com/codemirror/autocomplete/blob/a53f7ff19dc3a0412f3ce6e2751b08b610e1d762/src/view.ts#L15
let autocompletion_open = view.state.field(completionState, false)?.open ?? false

let autocompletion_open = autocomplete.completionStatus(view.state) === "active"

// If we have a cursor instead of a multicharacter selection:
if (event.key === "ArrowUp" && !autocompletion_open) {
Expand Down
Loading

0 comments on commit 596c299

Please sign in to comment.