diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b9ad1e..3bd2f9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ## [Unreleased] +## [0.0.10] + ### Added - Added JetBrains frontend for use in JetBrains IDE plugin diff --git a/README.md b/README.md index 03296ed..5435a89 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Custom color schems are created via the [interactive demo](https://tmr232.github - [Go](https://tmr232.github.io/function-graph-overview/?language=0) - [C](https://tmr232.github.io/function-graph-overview/?language=1) +- [C++](https://tmr232.github.io/function-graph-overview/?language=3) - [Python](https://tmr232.github.io/function-graph-overview/?language=2) ## Development diff --git a/package.json b/package.json index 58c12dc..36a3950 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "//": "START EXTENSION ATTRIBUTES", "publisher": "tamir-bahar", "name": "function-graph-overview", - "version": "0.0.9", + "version": "0.0.10", "description": "Function Graph Overview", "displayName": "Function Graph Overview", "icon": "./media/icon.png", diff --git a/src/components/CodeSegmentation.svelte b/src/components/CodeSegmentation.svelte index 4f4c94e..df34639 100644 --- a/src/components/CodeSegmentation.svelte +++ b/src/components/CodeSegmentation.svelte @@ -116,7 +116,7 @@ } -{#await initialize() then} +{#await initialize() then _}
{@html renderWrapper(code, language, { simplify, trim })}{/await} diff --git a/src/components/Demo.svelte b/src/components/Demo.svelte index 3b3efb4..8efbebf 100644 --- a/src/components/Demo.svelte +++ b/src/components/Demo.svelte @@ -10,11 +10,20 @@ import ColorScheme from "./ColorSchemeEditor.svelte"; import { getSystemColorList, toggleTheme, isDark } from "./lightdark.ts"; import type { LanguageSupport } from "@codemirror/language"; + import { evolve } from "../control-flow/evolve.ts"; + + // ADD-LANGUAGES-HERE + const defaultCodeSamples: { [language in Language]?: string } = { + Go: "func Example() {\n\tif x {\n\t\treturn\n\t}\n}", + C: "void main() {\n\tif (x) {\n\t\treturn;\n\t}\n}", + "C++": "void main() {\n\tif (x) {\n\t\treturn;\n\t}\n}", + Python: "def example():\n if x:\n return", + }; + + export let code: { [language in Language]?: string } = {}; + + const languageCode = evolve(defaultCodeSamples, code); - export let codeGo = "func Example() {\n\tif x {\n\t\treturn\n\t}\n}"; - export let codeC = "void main() {\n\tif (x) {\n\t\treturn;\n\t}\n}"; - export let codeCpp = "void main() {\n\tif (x) {\n\t\treturn;\n\t}\n}"; - export let codePython = "def example():\n if x:\n return"; let offsetToHighlight: number | undefined = undefined; let colorList = getSystemColorList(); // ADD-LANGUAGES-HERE @@ -37,13 +46,6 @@ }, ] as const; - const languageCode: { [language in Language]: string } = { - Go: codeGo, - C: codeC, - Python: codePython, - "C++": codeCpp, - }; - const urlParams = new URLSearchParams(window.location.search); if (urlParams.has("go")) { languageCode.Go = LZString.decompressFromEncodedURIComponent( diff --git a/src/demo/src/App.svelte b/src/demo/src/App.svelte index 6a9f760..5f7690f 100644 --- a/src/demo/src/App.svelte +++ b/src/demo/src/App.svelte @@ -3,8 +3,10 @@ import demoCodeGo from "./assets/demo.go?raw"; import demoCodeC from "./assets/demo.c?raw"; import demoCodePython from "./assets/demo.py?raw"; + import demoCodeCpp from "./assets/demo.cpp?raw"; import { isDark } from "../../components/lightdark"; import { onDestroy } from "svelte"; + import type { Language } from "../../control-flow/cfg.ts"; document.body.dataset.theme = isDark ? "dark" : "light"; @@ -12,11 +14,19 @@ document.body.dataset.theme = isDark ? "dark" : "light"; }); + // ADD-LANGUAGES-HERE + const code: { [language in Language]?: string } = { + C: demoCodeC, + Python: demoCodePython, + Go: demoCodeGo, + "C++": demoCodeCpp, + }; + onDestroy(unsubscribe);