Skip to content
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

Javascript #1273

Open
wants to merge 110 commits into
base: main
Choose a base branch
from
Open

Javascript #1273

wants to merge 110 commits into from

Conversation

davidfig
Copy link
Collaborator

@davidfig davidfig commented Apr 9, 2024

  • basic javascript computation
  • typescript support using esbuild-wasm
  • allow async operations in javascript
  • getCell/getCells in javascript (requires await)
  • map errors to proper line number (for execution errors)
  • show an error when trying to import modules
  • ensure good errors during esbuild transform
  • add code highlighting and language server support (comes out of the box with monaco for typescript)
  • add output type information to results
  • getPos and get relative cells
  • JS logo in code editor
  • add icons/prettify UI
  • better console.log support for formatting Objects, Arrays, DateTime, and boolean
  • return line numbers
  • handle Infinity and NaN
  • import ESM modules
  • reimplement return line numbers
  • output png from OffscreenCanvas
  • merge conflicts with main
  • corner resize
  • return Canvas instead of Blob to make it easier on user
  • tests for getCells without y1
  • Address Jim & Luke's comments
  • Better handling of import errors (it fails silently w/o reporting the error)
  • CodeRunning cell indicator

Out of scope for this PR

  • Typescript support (requires a bit of work around packaging)
  • better console colors/highlighting
  • cancel JS / better UI around controlling what GC is doing--especially around code runs

@cla-bot cla-bot bot added the cla-signed label Apr 9, 2024
Copy link

vercel bot commented Apr 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quadratic ✅ Ready (Inspect) Visit Preview May 10, 2024 8:36pm

Copy link

codecov bot commented Apr 9, 2024

Codecov Report

Attention: Patch coverage is 88.08743% with 109 lines in your changes are missing coverage. Please review.

Project coverage is 89.12%. Comparing base (6f5438b) to head (7351006).

Files Patch % Lines
quadratic-core/src/controller/send_render.rs 23.52% 26 Missing ⚠️
...atic-core/src/controller/execution/run_code/mod.rs 32.35% 23 Missing ⚠️
...rc/controller/execution/run_code/run_javascript.rs 96.34% 20 Missing ⚠️
quadratic-core/src/grid/sheet/rendering.rs 79.16% 15 Missing ⚠️
quadratic-core/src/grid/file/current.rs 0.00% 6 Missing ⚠️
...ler/execution/execute_operation/execute_formats.rs 61.53% 5 Missing ⚠️
quadratic-core/src/values/cellvalue.rs 80.76% 5 Missing ⚠️
...roller/execution/execute_operation/execute_code.rs 0.00% 3 Missing ⚠️
quadratic-core/src/values/convert.rs 0.00% 2 Missing ⚠️
quadratic-core/src/controller/transaction_types.rs 88.88% 1 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1273      +/-   ##
==========================================
- Coverage   89.15%   89.12%   -0.03%     
==========================================
  Files         159      160       +1     
  Lines       26240    27051     +811     
==========================================
+ Hits        23395    24110     +715     
- Misses       2845     2941      +96     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1273 April 10, 2024 16:06 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1273 April 10, 2024 16:14 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1273 April 10, 2024 19:00 Inactive
@jimniels jimniels temporarily deployed to quadratic-api-dev-pr-1273 May 3, 2024 22:42 Inactive
@jimniels
Copy link
Collaborator

jimniels commented May 3, 2024

We should update the cell type menu for JavaScript so it reads like the others and includes a link to the JS docs

Example:

CleanShot 2024-05-03 at 16 45 46@2x

}}
/>
{language === 'Python' && (
{['Python', 'Javascript'].includes(language as string) && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought: would be nice to have a standard definition for these keys. Just looking at this PR, I see javascript, Javascript (and the UI display of JavaScript) and have a hard time keeping track of when to use which ha.

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1273 May 6, 2024 12:12 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1273 May 6, 2024 12:15 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1273 May 6, 2024 12:27 Inactive
@@ -50,7 +50,8 @@
"prisma:migrate": "cd quadratic-api && npm run prisma:migrate",
"docker:up": "docker compose up -d --wait && npm run prisma:migrate --workspace=quadratic-api",
"docker:down": "docker compose down",
"docker:down:kill-volumes": "docker compose down -v"
"docker:down:kill-volumes": "docker compose down -v",
"copy:esbuild": "cp -f node_modules/esbuild-wasm/esbuild.wasm quadratic-client/public/"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to quadratic-client?

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1273 May 7, 2024 13:07 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1273 May 7, 2024 13:07 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-1273 May 10, 2024 20:12 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Charts - Followup Issues
5 participants