diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94e5c796..59e83d0d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,7 @@ jobs: should_skip_lang: ${{ steps.skip_lang_check.outputs.should_skip }} should_skip_components: ${{ steps.skip_components_check.outputs.should_skip }} should_skip_website: ${{ steps.skip_website_check.outputs.should_skip }} + should_skip_vscodeext: ${{ steps.skip_vscodeext_check.outputs.should_skip }} steps: - id: skip_lang_check name: Check if the changes are about squiggle-lang src files @@ -35,6 +36,11 @@ jobs: uses: fkirc/skip-duplicate-actions@v3.4.1 with: paths: '["packages/website/**"]' + - id: skip_vscodeext_check + name: Check if the changes are about vscode extension src files + uses: fkirc/skip-duplicate-actions@v3.4.1 + with: + paths: '["packages/vscode-ext/**"]' lang-lint: name: Language lint @@ -158,3 +164,35 @@ jobs: run: cd ../components && yarn build - name: Build website assets run: yarn build + + vscode-ext-lint: + name: VS Code extension lint + runs-on: ubuntu-latest + needs: pre_check + if: ${{ needs.pre_check.outputs.should_skip_vscodeext != 'true' }} + defaults: + run: + shell: bash + working-directory: packages/vscode-ext + steps: + - uses: actions/checkout@v2 + - name: Install dependencies from monorepo level + run: cd ../../ && yarn + - name: Lint the VSCode Extension source code + run: yarn lint + + vscode-ext-build: + name: VS Code extension build + runs-on: ubuntu-latest + needs: pre_check + if: ${{ (needs.pre_check.outputs.should_skip_components != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') }} || (needs.pre_check.outputs.should_skip_vscodeext != 'true') }} + defaults: + run: + shell: bash + working-directory: packages/vscode-ext + steps: + - uses: actions/checkout@v2 + - name: Install dependencies from monorepo level + run: cd ../../ && yarn + - name: Build + run: yarn compile diff --git a/.prettierignore b/.prettierignore index 903390ad..8090b3f3 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,3 +12,4 @@ packages/squiggle-lang/coverage/ packages/squiggle-lang/.cache/ packages/website/build/ packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.js +packages/vscode-ext/media/vendor/ diff --git a/README.md b/README.md index dafdc4cc..e0b224c2 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ _An estimation language_. - [Known bugs](https://www.squiggle-language.com/docs/Discussions/Bugs) - [Original lesswrong sequence](https://www.lesswrong.com/s/rDe8QE5NvXcZYzgZ3) - [Author your squiggle models as Observable notebooks](https://observablehq.com/@hazelfire/squiggle) +- [Use squiggle in VS Code](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle) ## Our deployments @@ -39,6 +40,7 @@ the packages can be found in `packages`. of the calculation. - `packages/website` is the main descriptive website for squiggle, it is hosted at `squiggle-language.com`. +- `packages/vscode-ext` is the VS Code extension for writing estimation functions. # Develop diff --git a/packages/cli/README.md b/packages/cli/README.md index d1ec4b8b..7b0d0038 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -2,19 +2,21 @@ This package can be used to incorporate a very simple `import` system into Squiggle. -To use, write special files with a ``.squiggleU`` file type. In these files, you can write lines like, +To use, write special files with a `.squiggleU` file type. In these files, you can write lines like, ``` @import(models/gdp_over_time.squiggle, gdpOverTime) gdpOverTime(2.5) ``` -The imports will be replaced with the contents of the file in `models/gdp_over_time.squiggle` upon compilation. The ``.squiggleU`` file will be converted into a ``.squiggle`` file with the ``import`` statement having this replacement. +The imports will be replaced with the contents of the file in `models/gdp_over_time.squiggle` upon compilation. The `.squiggleU` file will be converted into a `.squiggle` file with the `import` statement having this replacement. ## Running ### `npx squiggle-cli-experimental compile` + Runs compilation in the current directory and all of its subdirectories. ### `npx squiggle-cli-experimental watch` -Watches ``.squiggleU`` files in the current directory (and subdirectories) and rebuilds them when they are saved. Note that this will *not* rebuild files when their dependencies are changed, just when they are changed directly. \ No newline at end of file + +Watches `.squiggleU` files in the current directory (and subdirectories) and rebuilds them when they are saved. Note that this will _not_ rebuild files when their dependencies are changed, just when they are changed directly. diff --git a/packages/cli/index.js b/packages/cli/index.js old mode 100644 new mode 100755 diff --git a/packages/cli/package.json b/packages/cli/package.json index 1206f8d8..053d8096 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,22 +1,21 @@ { - "name": "squiggle-cli-experimental", - "version": "0.0.3", - "main": "index.js", - "homepage": "https://squiggle-language.com", - "author": "Quantified Uncertainty Research Institute", - "bin": "index.js", - "type": "module", - "scripts": { - "start": "node ." - }, - "license": "MIT", - "dependencies": { - "chalk": "^5.0.1", - "chokidar": "^3.5.3", - "commander": "^9.3.0", - "fs": "^0.0.1-security", - "glob": "^8.0.3", - "indent-string": "^5.0.0" - } + "name": "squiggle-cli-experimental", + "version": "0.0.3", + "main": "index.js", + "homepage": "https://squiggle-language.com", + "author": "Quantified Uncertainty Research Institute", + "bin": "index.js", + "type": "module", + "scripts": { + "start": "node ." + }, + "license": "MIT", + "dependencies": { + "chalk": "^5.0.1", + "chokidar": "^3.5.3", + "commander": "^9.3.0", + "fs": "^0.0.1-security", + "glob": "^8.0.3", + "indent-string": "^5.0.0" } - \ No newline at end of file +} diff --git a/packages/components/src/styles/base.css b/packages/components/src/styles/base.css index e0a33a56..a5922d5e 100644 --- a/packages/components/src/styles/base.css +++ b/packages/components/src/styles/base.css @@ -1,5 +1,5 @@ .squiggle { -/* + /* This file contains: 1) Base Tailwind preflight styles 2) Base https://github.com/tailwindlabs/tailwindcss-forms styles @@ -7,365 +7,390 @@ This file contains: (Both are wrapped in .squiggle) */ -/* + /* 1. Use a consistent sensible line-height in all browsers. 2. Prevent adjustments of font size after orientation changes in iOS. 3. Use a more readable tab size. 4. Use the user's configured `sans` font-family by default. */ -/* html { */ + /* html { */ line-height: 1.5; /* 1 */ -webkit-text-size-adjust: 100%; /* 2 */ -moz-tab-size: 4; /* 3 */ tab-size: 4; /* 3 */ - font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */ -/* } */ + font-family: theme( + "fontFamily.sans", + ui-sans-serif, + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + Roboto, + "Helvetica Neue", + Arial, + "Noto Sans", + sans-serif, + "Apple Color Emoji", + "Segoe UI Emoji", + "Segoe UI Symbol", + "Noto Color Emoji" + ); /* 4 */ + /* } */ -/* + /* 1. Remove the margin in all browsers. 2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. */ -/* body { */ + /* body { */ margin: 0; /* 1 */ line-height: inherit; /* 2 */ -/* } */ + /* } */ - -/* + /* 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) */ -*, -::before, -::after { - box-sizing: border-box; /* 1 */ - border-width: 0; /* 2 */ - border-style: solid; /* 2 */ - border-color: theme('borderColor.DEFAULT', currentColor); /* 2 */ -} + *, + ::before, + ::after { + box-sizing: border-box; /* 1 */ + border-width: 0; /* 2 */ + border-style: solid; /* 2 */ + border-color: theme("borderColor.DEFAULT", currentColor); /* 2 */ + } -::before, -::after { - --tw-content: ''; -} + ::before, + ::after { + --tw-content: ""; + } -/* + /* 1. Add the correct height in Firefox. 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) 3. Ensure horizontal rules are visible by default. */ -hr { - height: 0; /* 1 */ - color: inherit; /* 2 */ - border-top-width: 1px; /* 3 */ -} + hr { + height: 0; /* 1 */ + color: inherit; /* 2 */ + border-top-width: 1px; /* 3 */ + } -/* + /* Add the correct text decoration in Chrome, Edge, and Safari. */ -abbr:where([title]) { - text-decoration: underline dotted; -} + abbr:where([title]) { + text-decoration: underline dotted; + } -/* + /* Remove the default font size and weight for headings. */ -h1, -h2, -h3, -h4, -h5, -h6 { - font-size: inherit; - font-weight: inherit; -} + h1, + h2, + h3, + h4, + h5, + h6 { + font-size: inherit; + font-weight: inherit; + } -/* + /* Reset links to optimize for opt-in styling instead of opt-out. */ -a { - color: inherit; - text-decoration: inherit; -} + a { + color: inherit; + text-decoration: inherit; + } -/* + /* Add the correct font weight in Edge and Safari. */ -b, -strong { - font-weight: bolder; -} + b, + strong { + font-weight: bolder; + } -/* + /* 1. Use the user's configured `mono` font family by default. 2. Correct the odd `em` font sizing in all browsers. */ -code, -kbd, -samp, -pre { - font-family: theme('fontFamily.mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace); /* 1 */ - font-size: 1em; /* 2 */ -} + code, + kbd, + samp, + pre { + font-family: theme( + "fontFamily.mono", + ui-monospace, + SFMono-Regular, + Menlo, + Monaco, + Consolas, + "Liberation Mono", + "Courier New", + monospace + ); /* 1 */ + font-size: 1em; /* 2 */ + } -/* + /* Add the correct font size in all browsers. */ -small { - font-size: 80%; -} + small { + font-size: 80%; + } -/* + /* Prevent `sub` and `sup` elements from affecting the line height in all browsers. */ -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} + sub, + sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + } -sub { - bottom: -0.25em; -} + sub { + bottom: -0.25em; + } -sup { - top: -0.5em; -} + sup { + top: -0.5em; + } -/* + /* 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) 3. Remove gaps between table borders by default. */ -table { - text-indent: 0; /* 1 */ - border-color: inherit; /* 2 */ - border-collapse: collapse; /* 3 */ -} + table { + text-indent: 0; /* 1 */ + border-color: inherit; /* 2 */ + border-collapse: collapse; /* 3 */ + } -/* + /* 1. Change the font styles in all browsers. 2. Remove the margin in Firefox and Safari. 3. Remove default padding in all browsers. */ -button, -input, -optgroup, -select, -textarea { - font-family: inherit; /* 1 */ - font-size: 100%; /* 1 */ - font-weight: inherit; /* 1 */ - line-height: inherit; /* 1 */ - color: inherit; /* 1 */ - margin: 0; /* 2 */ - padding: 0; /* 3 */ -} + button, + input, + optgroup, + select, + textarea { + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + font-weight: inherit; /* 1 */ + line-height: inherit; /* 1 */ + color: inherit; /* 1 */ + margin: 0; /* 2 */ + padding: 0; /* 3 */ + } -/* + /* Remove the inheritance of text transform in Edge and Firefox. */ -button, -select { - text-transform: none; -} + button, + select { + text-transform: none; + } -/* + /* 1. Correct the inability to style clickable types in iOS and Safari. 2. Remove default button styles. */ -button, -[type='button'], -[type='reset'], -[type='submit'] { - -webkit-appearance: button; /* 1 */ - background-color: transparent; /* 2 */ - background-image: none; /* 2 */ -} + button, + [type="button"], + [type="reset"], + [type="submit"] { + -webkit-appearance: button; /* 1 */ + background-color: transparent; /* 2 */ + background-image: none; /* 2 */ + } -/* + /* Use the modern Firefox focus style for all focusable elements. */ -:-moz-focusring { - outline: auto; -} + :-moz-focusring { + outline: auto; + } -/* + /* Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) */ -:-moz-ui-invalid { - box-shadow: none; -} + :-moz-ui-invalid { + box-shadow: none; + } -/* + /* Add the correct vertical alignment in Chrome and Firefox. */ -progress { - vertical-align: baseline; -} + progress { + vertical-align: baseline; + } -/* + /* Correct the cursor style of increment and decrement buttons in Safari. */ -::-webkit-inner-spin-button, -::-webkit-outer-spin-button { - height: auto; -} + ::-webkit-inner-spin-button, + ::-webkit-outer-spin-button { + height: auto; + } -/* + /* 1. Correct the odd appearance in Chrome and Safari. 2. Correct the outline style in Safari. */ -[type='search'] { - -webkit-appearance: textfield; /* 1 */ - outline-offset: -2px; /* 2 */ -} + [type="search"] { + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ + } -/* + /* Remove the inner padding in Chrome and Safari on macOS. */ -::-webkit-search-decoration { - -webkit-appearance: none; -} + ::-webkit-search-decoration { + -webkit-appearance: none; + } -/* + /* 1. Correct the inability to style clickable types in iOS and Safari. 2. Change font properties to `inherit` in Safari. */ -::-webkit-file-upload-button { - -webkit-appearance: button; /* 1 */ - font: inherit; /* 2 */ -} + ::-webkit-file-upload-button { + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ + } -/* + /* Add the correct display in Chrome and Safari. */ -summary { - display: list-item; -} + summary { + display: list-item; + } -/* + /* Removes the default spacing and border for appropriate elements. */ -blockquote, -dl, -dd, -h1, -h2, -h3, -h4, -h5, -h6, -hr, -figure, -p, -pre { - margin: 0; -} + blockquote, + dl, + dd, + h1, + h2, + h3, + h4, + h5, + h6, + hr, + figure, + p, + pre { + margin: 0; + } -fieldset { - margin: 0; - padding: 0; -} + fieldset { + margin: 0; + padding: 0; + } -legend { - padding: 0; -} + legend { + padding: 0; + } -ol, -ul, -menu { - list-style: none; - margin: 0; - padding: 0; -} + ol, + ul, + menu { + list-style: none; + margin: 0; + padding: 0; + } -/* + /* Prevent resizing textareas horizontally by default. */ -textarea { - resize: vertical; -} + textarea { + resize: vertical; + } -/* + /* 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) 2. Set the default placeholder color to the user's configured gray 400 color. */ -input::placeholder, -textarea::placeholder { - opacity: 1; /* 1 */ - color: theme('colors.gray.400', #9ca3af); /* 2 */ -} + input::placeholder, + textarea::placeholder { + opacity: 1; /* 1 */ + color: theme("colors.gray.400", #9ca3af); /* 2 */ + } -/* + /* Set the default cursor for buttons. */ -button, -[role="button"] { - cursor: pointer; -} + button, + [role="button"] { + cursor: pointer; + } -/* + /* Make sure disabled buttons don't get the pointer cursor. */ -:disabled { - cursor: default; -} + :disabled { + cursor: default; + } -/* + /* 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) This can trigger a poorly considered lint error in some tools but is included by design. */ -img, -svg, -video, -canvas, -audio, -iframe, -embed, -object { - display: block; /* 1 */ - vertical-align: middle; /* 2 */ -} + img, + svg, + video, + canvas, + audio, + iframe, + embed, + object { + display: block; /* 1 */ + vertical-align: middle; /* 2 */ + } -/* + /* Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) */ -img, -video { - max-width: 100%; - height: auto; -} + img, + video { + max-width: 100%; + height: auto; + } } diff --git a/packages/components/src/styles/forms.css b/packages/components/src/styles/forms.css index 60b4075d..0a54ab22 100644 --- a/packages/components/src/styles/forms.css +++ b/packages/components/src/styles/forms.css @@ -1,102 +1,130 @@ /* Fork of https://github.com/tailwindlabs/tailwindcss-forms styles, see the comment in main.css for details. */ .squiggle { -.form-input,.form-textarea,.form-select,.form-multiselect { -appearance: none; -background-color: #fff; -border-color: #6b7280; -border-width: 1px; -border-radius: 0px; -padding-top: 0.5rem; -padding-right: 0.75rem; -padding-bottom: 0.5rem; -padding-left: 0.75rem; -font-size: 1rem; -line-height: 1.5rem; ---tw-shadow: 0 0 #0000; -} -.form-input:focus, .form-textarea:focus, .form-select:focus, .form-multiselect:focus { -outline: 2px solid transparent; -outline-offset: 2px; ---tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); ---tw-ring-offset-width: 0px; ---tw-ring-offset-color: #fff; ---tw-ring-color: #2563eb; ---tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); ---tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); -box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); -border-color: #2563eb; -} -.form-input::placeholder,.form-textarea::placeholder { -color: #6b7280; -opacity: 1; -} -.form-input::-webkit-datetime-edit-fields-wrapper { -padding: 0; -} -.form-input::-webkit-date-and-time-value { -min-height: 1.5em; -} -.form-input::-webkit-datetime-edit,.form-input::-webkit-datetime-edit-year-field,.form-input::-webkit-datetime-edit-month-field,.form-input::-webkit-datetime-edit-day-field,.form-input::-webkit-datetime-edit-hour-field,.form-input::-webkit-datetime-edit-minute-field,.form-input::-webkit-datetime-edit-second-field,.form-input::-webkit-datetime-edit-millisecond-field,.form-input::-webkit-datetime-edit-meridiem-field { -padding-top: 0; -padding-bottom: 0; -} -.form-checkbox,.form-radio { -appearance: none; -padding: 0; --webkit-print-color-adjust: exact; - print-color-adjust: exact; -display: inline-block; -vertical-align: middle; -background-origin: border-box; --webkit-user-select: none; - user-select: none; -flex-shrink: 0; -height: 1rem; -width: 1rem; -color: #2563eb; -background-color: #fff; -border-color: #6b7280; -border-width: 1px; ---tw-shadow: 0 0 #0000; -} -.form-checkbox { -border-radius: 0px; -} -.form-checkbox:focus,.form-radio:focus { -outline: 2px solid transparent; -outline-offset: 2px; ---tw-ring-inset: var(--tw-empty,/*!*/ /*!*/); ---tw-ring-offset-width: 2px; ---tw-ring-offset-color: #fff; ---tw-ring-color: #2563eb; ---tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); ---tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); -box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow); -} -.form-checkbox:checked,.form-radio:checked { -border-color: transparent; -background-color: currentColor; -background-size: 100% 100%; -background-position: center; -background-repeat: no-repeat; -} -.form-checkbox:checked { -background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e"); -} -.form-checkbox:checked:hover,.form-checkbox:checked:focus,.form-radio:checked:hover,.form-radio:checked:focus { -border-color: transparent; -background-color: currentColor; -} -.form-checkbox:indeterminate { -background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e"); -border-color: transparent; -background-color: currentColor; -background-size: 100% 100%; -background-position: center; -background-repeat: no-repeat; -} -.form-checkbox:indeterminate:hover,.form-checkbox:indeterminate:focus { -border-color: transparent; -background-color: currentColor; -} + .form-input, + .form-textarea, + .form-select, + .form-multiselect { + appearance: none; + background-color: #fff; + border-color: #6b7280; + border-width: 1px; + border-radius: 0px; + padding-top: 0.5rem; + padding-right: 0.75rem; + padding-bottom: 0.5rem; + padding-left: 0.75rem; + font-size: 1rem; + line-height: 1.5rem; + --tw-shadow: 0 0 #0000; + } + .form-input:focus, + .form-textarea:focus, + .form-select:focus, + .form-multiselect:focus { + outline: 2px solid transparent; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty, /*!*/ /*!*/); + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 + var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 + calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), + var(--tw-shadow); + border-color: #2563eb; + } + .form-input::placeholder, + .form-textarea::placeholder { + color: #6b7280; + opacity: 1; + } + .form-input::-webkit-datetime-edit-fields-wrapper { + padding: 0; + } + .form-input::-webkit-date-and-time-value { + min-height: 1.5em; + } + .form-input::-webkit-datetime-edit, + .form-input::-webkit-datetime-edit-year-field, + .form-input::-webkit-datetime-edit-month-field, + .form-input::-webkit-datetime-edit-day-field, + .form-input::-webkit-datetime-edit-hour-field, + .form-input::-webkit-datetime-edit-minute-field, + .form-input::-webkit-datetime-edit-second-field, + .form-input::-webkit-datetime-edit-millisecond-field, + .form-input::-webkit-datetime-edit-meridiem-field { + padding-top: 0; + padding-bottom: 0; + } + .form-checkbox, + .form-radio { + appearance: none; + padding: 0; + -webkit-print-color-adjust: exact; + print-color-adjust: exact; + display: inline-block; + vertical-align: middle; + background-origin: border-box; + -webkit-user-select: none; + user-select: none; + flex-shrink: 0; + height: 1rem; + width: 1rem; + color: #2563eb; + background-color: #fff; + border-color: #6b7280; + border-width: 1px; + --tw-shadow: 0 0 #0000; + } + .form-checkbox { + border-radius: 0px; + } + .form-checkbox:focus, + .form-radio:focus { + outline: 2px solid transparent; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty, /*!*/ /*!*/); + --tw-ring-offset-width: 2px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 + var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 + calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), + var(--tw-shadow); + } + .form-checkbox:checked, + .form-radio:checked { + border-color: transparent; + background-color: currentColor; + background-size: 100% 100%; + background-position: center; + background-repeat: no-repeat; + } + .form-checkbox:checked { + background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e"); + } + .form-checkbox:checked:hover, + .form-checkbox:checked:focus, + .form-radio:checked:hover, + .form-radio:checked:focus { + border-color: transparent; + background-color: currentColor; + } + .form-checkbox:indeterminate { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e"); + border-color: transparent; + background-color: currentColor; + background-size: 100% 100%; + background-position: center; + background-repeat: no-repeat; + } + .form-checkbox:indeterminate:hover, + .form-checkbox:indeterminate:focus { + border-color: transparent; + background-color: currentColor; + } } diff --git a/packages/vscode-ext/.eslintrc.json b/packages/vscode-ext/.eslintrc.json index f9b22b79..5dfecab7 100644 --- a/packages/vscode-ext/.eslintrc.json +++ b/packages/vscode-ext/.eslintrc.json @@ -1,24 +1,18 @@ { - "root": true, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" - }, - "plugins": [ - "@typescript-eslint" - ], - "rules": { - "@typescript-eslint/naming-convention": "warn", - "@typescript-eslint/semi": "warn", - "curly": "warn", - "eqeqeq": "warn", - "no-throw-literal": "warn", - "semi": "off" - }, - "ignorePatterns": [ - "out", - "dist", - "**/*.d.ts" - ] + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "plugins": ["@typescript-eslint"], + "rules": { + "@typescript-eslint/naming-convention": "warn", + "@typescript-eslint/semi": "warn", + "curly": "warn", + "eqeqeq": "warn", + "no-throw-literal": "warn", + "semi": "off" + }, + "ignorePatterns": ["out", "dist", "**/*.d.ts"] } diff --git a/packages/vscode-ext/.vscode/extensions.json b/packages/vscode-ext/.vscode/extensions.json index 3ac9aeb6..c0a2258b 100644 --- a/packages/vscode-ext/.vscode/extensions.json +++ b/packages/vscode-ext/.vscode/extensions.json @@ -1,7 +1,5 @@ { - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "dbaeumer.vscode-eslint" - ] + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": ["dbaeumer.vscode-eslint"] } diff --git a/packages/vscode-ext/.vscode/launch.json b/packages/vscode-ext/.vscode/launch.json index 670d6e66..1210201d 100644 --- a/packages/vscode-ext/.vscode/launch.json +++ b/packages/vscode-ext/.vscode/launch.json @@ -3,32 +3,26 @@ // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 { - "version": "0.2.0", - "configurations": [ - { - "name": "Run Extension", - "type": "extensionHost", - "request": "launch", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" - ], - "outFiles": [ - "${workspaceFolder}/out/**/*.js" - ], - "preLaunchTask": "${defaultBuildTask}" - }, - { - "name": "Extension Tests", - "type": "extensionHost", - "request": "launch", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}", - "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" - ], - "outFiles": [ - "${workspaceFolder}/out/test/**/*.js" - ], - "preLaunchTask": "${defaultBuildTask}" - } - ] + "version": "0.2.0", + "configurations": [ + { + "name": "Run Extension", + "type": "extensionHost", + "request": "launch", + "args": ["--extensionDevelopmentPath=${workspaceFolder}"], + "outFiles": ["${workspaceFolder}/out/**/*.js"], + "preLaunchTask": "${defaultBuildTask}" + }, + { + "name": "Extension Tests", + "type": "extensionHost", + "request": "launch", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}", + "--extensionTestsPath=${workspaceFolder}/out/test/suite/index" + ], + "outFiles": ["${workspaceFolder}/out/test/**/*.js"], + "preLaunchTask": "${defaultBuildTask}" + } + ] } diff --git a/packages/vscode-ext/.vscode/settings.json b/packages/vscode-ext/.vscode/settings.json index 30bf8c2d..ffeaf91c 100644 --- a/packages/vscode-ext/.vscode/settings.json +++ b/packages/vscode-ext/.vscode/settings.json @@ -1,11 +1,11 @@ // Place your settings in this file to overwrite default and user settings. { - "files.exclude": { - "out": false // set this to true to hide the "out" folder with the compiled JS files - }, - "search.exclude": { - "out": true // set this to false to include "out" folder in search results - }, - // Turn off tsc task auto detection since we have the necessary tasks as npm scripts - "typescript.tsc.autoDetect": "off" -} \ No newline at end of file + "files.exclude": { + "out": false // set this to true to hide the "out" folder with the compiled JS files + }, + "search.exclude": { + "out": true // set this to false to include "out" folder in search results + }, + // Turn off tsc task auto detection since we have the necessary tasks as npm scripts + "typescript.tsc.autoDetect": "off" +} diff --git a/packages/vscode-ext/.vscode/tasks.json b/packages/vscode-ext/.vscode/tasks.json index 3b17e53b..078ff7e0 100644 --- a/packages/vscode-ext/.vscode/tasks.json +++ b/packages/vscode-ext/.vscode/tasks.json @@ -1,20 +1,20 @@ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format { - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "watch", - "problemMatcher": "$tsc-watch", - "isBackground": true, - "presentation": { - "reveal": "never" - }, - "group": { - "kind": "build", - "isDefault": true - } - } - ] + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "watch", + "problemMatcher": "$tsc-watch", + "isBackground": true, + "presentation": { + "reveal": "never" + }, + "group": { + "kind": "build", + "isDefault": true + } + } + ] } diff --git a/packages/vscode-ext/README.md b/packages/vscode-ext/README.md index 9d89ab8d..afedd282 100644 --- a/packages/vscode-ext/README.md +++ b/packages/vscode-ext/README.md @@ -1,3 +1,11 @@ # Squiggle For VS Code +_[marketplace](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle)_ + This extension provides support for [Squiggle](https://www.squiggle-language.com/) in VS Code. + +# Build locally + +We assume you ran `yarn` at the monorepo level for all dependencies. + +Then, simply `yarn compile` at the `vscode-ext` package level. It will build `squiggle-lang`, `squiggle-components`, and the VS Code extension source code. diff --git a/packages/vscode-ext/package.json b/packages/vscode-ext/package.json index 021a65f7..23f3c8d1 100644 --- a/packages/vscode-ext/package.json +++ b/packages/vscode-ext/package.json @@ -43,7 +43,8 @@ "compile": "yarn run compile:tsc && yarn run compile:vendor", "watch": "tsc -watch -p ./", "pretest": "yarn run compile && yarn run lint", - "lint": "eslint src --ext ts" + "lint": "eslint src --ext ts", + "format": "eslint src --ext ts --fix" }, "devDependencies": { "@types/vscode": "^1.68.0", diff --git a/packages/vscode-ext/tsconfig.json b/packages/vscode-ext/tsconfig.json index 29fc0a52..aed48ef9 100644 --- a/packages/vscode-ext/tsconfig.json +++ b/packages/vscode-ext/tsconfig.json @@ -1,17 +1,15 @@ { - "compilerOptions": { - "module": "commonjs", - "target": "ES2020", - "outDir": "out", - "lib": [ - "ES2020", "dom" - ], - "sourceMap": true, - "rootDir": "src", - "strict": true, /* enable all strict type-checking options */ - /* Additional Checks */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - } + "compilerOptions": { + "module": "commonjs", + "target": "ES2020", + "outDir": "out", + "lib": ["ES2020", "dom"], + "sourceMap": true, + "rootDir": "src", + "strict": true /* enable all strict type-checking options */ + /* Additional Checks */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + } }