From 00b1e6bb96d0a277bc56c04fe65482985404cded Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Tue, 21 Jun 2022 00:26:16 +0300 Subject: [PATCH 1/4] basic language-configuration --- .../vscode-ext/language-configuration.json | 18 ++++++++++++++++++ packages/vscode-ext/package.json | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 packages/vscode-ext/language-configuration.json diff --git a/packages/vscode-ext/language-configuration.json b/packages/vscode-ext/language-configuration.json new file mode 100644 index 00000000..727d0444 --- /dev/null +++ b/packages/vscode-ext/language-configuration.json @@ -0,0 +1,18 @@ +{ + "comments": { + "lineComment": "//", + "blockComment": ["/*", "*/"] + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "'", "close": "'", "notIn": ["string", "comment"] }, + { "open": "\"", "close": "\"", "notIn": ["string", "comment"] } + ] +} diff --git a/packages/vscode-ext/package.json b/packages/vscode-ext/package.json index fdac88a3..051e41de 100644 --- a/packages/vscode-ext/package.json +++ b/packages/vscode-ext/package.json @@ -31,7 +31,8 @@ ], "aliases": [ "Squiggle" - ] + ], + "configuration": "./language-configuration.json" } ], "grammars": [ From a81c0aae0ba196ed0ec4ec144c0d4a2a262360c4 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Tue, 21 Jun 2022 00:43:50 +0300 Subject: [PATCH 2/4] fix vscode-uri dependency --- packages/vscode-ext/package.json | 7 +++++-- yarn.lock | 14 +++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/vscode-ext/package.json b/packages/vscode-ext/package.json index 051e41de..2e3c50ea 100644 --- a/packages/vscode-ext/package.json +++ b/packages/vscode-ext/package.json @@ -126,7 +126,10 @@ "@typescript-eslint/parser": "^5.27.0", "eslint": "^8.18.0", "glob": "^8.0.3", - "typescript": "^4.7.4", - "js-yaml": "^4.1.0" + "js-yaml": "^4.1.0", + "typescript": "^4.7.4" + }, + "dependencies": { + "vscode-uri": "^3.0.3" } } diff --git a/yarn.lock b/yarn.lock index 162cad5c..58d044d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4344,7 +4344,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^18.0.1", "@types/react@^18.0.9": +"@types/react@*", "@types/react@^18.0.9": version "18.0.14" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.14.tgz#e016616ffff51dba01b04945610fe3671fdbe06d" integrity sha512-x4gGuASSiWmo0xjDLpm5mPb52syZHJx02VKbqUKdLmKtAwIh63XClGsiTI1K6DO5q7ox4xAsQrU+Gl3+gGXF9Q== @@ -14791,7 +14791,7 @@ react-vega@^7.5.1: prop-types "^15.8.1" vega-embed "^6.5.1" -react@^18.0.0, react@^18.1.0: +react@^18.1.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ== @@ -18638,16 +18638,16 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yallist@*, yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - yallist@^3.0.2: version "3.1.1" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + yaml@^1.10.0, yaml@^1.10.2, yaml@^1.7.2: version "1.10.2" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" From 9aa97f66b0b0cdb22c013d6fd64a2221c2d01f2b Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Tue, 21 Jun 2022 00:46:12 +0300 Subject: [PATCH 3/4] vscode: some docs, squiggleU support --- packages/vscode-ext/README.md | 11 +++++++++++ packages/vscode-ext/package.json | 15 +++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/packages/vscode-ext/README.md b/packages/vscode-ext/README.md index afedd282..9d23c1e2 100644 --- a/packages/vscode-ext/README.md +++ b/packages/vscode-ext/README.md @@ -4,6 +4,17 @@ _[marketplace](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-s This extension provides support for [Squiggle](https://www.squiggle-language.com/) in VS Code. +Features: + +- Preview `.squiggle` files in a preview pane +- Syntax highlighting for `.squiggle` and `.squiggleU` files + +# Configuration + +Some preview settings, e.g. whether to show the summary table or types of outputs, can be configurable on in the VS Code settings and persist between different preview sessions. + +Check out the full list of Squiggle settings in the main VS Code settings. + # Build locally We assume you ran `yarn` at the monorepo level for all dependencies. diff --git a/packages/vscode-ext/package.json b/packages/vscode-ext/package.json index 2e3c50ea..db6dcfa6 100644 --- a/packages/vscode-ext/package.json +++ b/packages/vscode-ext/package.json @@ -33,6 +33,16 @@ "Squiggle" ], "configuration": "./language-configuration.json" + }, + { + "id": "squiggleU", + "extensions": [ + ".squiggleU" + ], + "aliases": [ + "SquiggleU" + ], + "configuration": "./language-configuration.json" } ], "grammars": [ @@ -40,6 +50,11 @@ "language": "squiggle", "scopeName": "source.squiggle", "path": "./syntaxes/squiggle.tmLanguage.json" + }, + { + "language": "squiggleU", + "scopeName": "source.squiggle", + "path": "./syntaxes/squiggle.tmLanguage.json" } ], "customEditors": [ From f7bf1681d62cbb372abee9b2c4d0c3c5d2213ed4 Mon Sep 17 00:00:00 2001 From: Vyacheslav Matyukhin Date: Tue, 21 Jun 2022 01:07:27 +0300 Subject: [PATCH 4/4] remove vscode-uri dep, release 0.1.2 ext version --- packages/vscode-ext/package.json | 5 +---- packages/vscode-ext/src/preview.ts | 4 ++-- yarn.lock | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/vscode-ext/package.json b/packages/vscode-ext/package.json index db6dcfa6..af70abda 100644 --- a/packages/vscode-ext/package.json +++ b/packages/vscode-ext/package.json @@ -3,7 +3,7 @@ "displayName": "Squiggle", "description": "Squiggle language support", "license": "MIT", - "version": "0.1.0", + "version": "0.1.2", "publisher": "QURI", "repository": { "type": "git", @@ -143,8 +143,5 @@ "glob": "^8.0.3", "js-yaml": "^4.1.0", "typescript": "^4.7.4" - }, - "dependencies": { - "vscode-uri": "^3.0.3" } } diff --git a/packages/vscode-ext/src/preview.ts b/packages/vscode-ext/src/preview.ts index 04c57c86..81e4da47 100644 --- a/packages/vscode-ext/src/preview.ts +++ b/packages/vscode-ext/src/preview.ts @@ -1,12 +1,12 @@ import * as vscode from "vscode"; -import * as uri from "vscode-uri"; +import * as path from "path"; import { getWebviewContent } from "./utils"; export const registerPreviewCommand = (context: vscode.ExtensionContext) => { context.subscriptions.push( vscode.commands.registerTextEditorCommand("squiggle.preview", (editor) => { // Create and show a new webview - const title = `Preview ${uri.Utils.basename(editor.document.uri)}`; + const title = `Preview ${path.basename(editor.document.uri.path)}`; const panel = vscode.window.createWebviewPanel( "squigglePreview", diff --git a/yarn.lock b/yarn.lock index 58d044d6..b1c89aa7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4344,7 +4344,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@^18.0.9": +"@types/react@*", "@types/react@^18.0.1", "@types/react@^18.0.9": version "18.0.14" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.14.tgz#e016616ffff51dba01b04945610fe3671fdbe06d" integrity sha512-x4gGuASSiWmo0xjDLpm5mPb52syZHJx02VKbqUKdLmKtAwIh63XClGsiTI1K6DO5q7ox4xAsQrU+Gl3+gGXF9Q== @@ -14791,7 +14791,7 @@ react-vega@^7.5.1: prop-types "^15.8.1" vega-embed "^6.5.1" -react@^18.1.0: +react@^18.0.0, react@^18.1.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==