Skip to content

Commit

Permalink
Merge pull request #70 from tmr232/vscode-vite
Browse files Browse the repository at this point in the history
Unify VSCode & JetBrains WebView Code
  • Loading branch information
tmr232 authored Jan 17, 2025
2 parents 406e9af + 1b51738 commit dfa4ed7
Show file tree
Hide file tree
Showing 30 changed files with 422 additions and 645 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2

- run: bun install --production
- run: bun install

- run: bun build-webview

- run: bun run package

Expand All @@ -59,9 +61,9 @@ jobs:
- uses: oven-sh/setup-bun@v2

- run: bun install
- run: bun build-jetbrains
- run: bun build-webview

- uses: actions/upload-artifact@v4
with:
name: "Jetbrains"
path: "./dist/jetbrains/"
path: "./dist/webview/"
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"tasks": [
{
"type": "bun",
"script": "bun run --cwd ${workspaceFolder} ./scripts/build-with-esbuild.ts",
"script": "bun run --cwd ${workspaceFolder} ./scripts/build-with-esbuild.ts && bun build-webview",
"problemMatcher": [],
"label": "bun: build",
"detail": "bun run ./scripts/build-with-esbuild.ts - package.json",
Expand Down
2 changes: 0 additions & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,5 @@
!CHANGELOG.md
!LICENSE.txt
!README.md
!webview-content/*
!parsers/*
!media/icon.png
!media/svg/view-icon.svg
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
### Fixed

- `finally` blocks are now supported in TypeScript.
- Methods are now supported in TypeScript.

### Changed

- VSCode and JetBrains now use the same WebView content.
- Placeholder ("Hello, World!") graph colors are now determined by the color scheme.
- VSCode settings now applied instantly to the graph.

## [0.0.13] - 2025-01-06

Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default tseslint.config(
"dist",
"webview-content",
"src/frontend",
"src/jetbrains",
"src/webview",
"src/render",
"src/demo",
"src/components",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"demo": "bun run --cwd ./src/demo/ vite",
"build-demo": "bun run --cwd ./src/demo/ vite build",
"build-render": "bun run --cwd ./src/render/ vite build",
"build-jetbrains": "bun run --cwd ./src/jetbrains/ vite build",
"build-webview": "bun run --cwd src/webview/ vite build",
"oxlint-fix": "bunx oxlint --ignore-path=oxlint-ignore.txt --fix -D correctness -D perf -D suspicious -A no-await-in-loop",
"oxlint-ci": "bunx oxlint --ignore-path=oxlint-ignore.txt -D correctness -D perf -D suspicious -A no-await-in-loop",
"prettier-format": "bunx prettier **/*.svelte --write",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,17 @@
options: RenderOptions,
colorList: ColorList,
) {
console.log("Rendering!", codeAndOffset, colorList);
const bgcolor = colorList.find(
({ name }) => name === "graph.background",
).hex;
const color = colorList.find(({ name }) => name === "node.highlight").hex;
try {
if (codeAndOffset === null) {
svg = graphviz.dot(`digraph G {
bgcolor="#2B2D30"
node [color="#e0e0e0", fontcolor="#e0e0e0"]
edge [color="#e0e0e0"]
svg = graphviz.dot(/*DOT*/ `digraph G {
bgcolor="${bgcolor}"
node [color="${color}", fontcolor="${color}"]
edge [color="${color}"]
Hello -> World
}`);
} else {
Expand Down Expand Up @@ -146,10 +151,6 @@
offset: cfg.graph.getNodeAttribute(target.id, "startOffset"),
});
}
export function applyColors(colors: ColorList) {
colorList = colors;
}
</script>

{#await initialize() then}
Expand Down
12 changes: 5 additions & 7 deletions src/control-flow/cfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ export const functionNodeTypes: { [language in Language]: string[] } = {
TypeScript: [
"function_declaration",
"arrow_function",
"method_definition",
"function_expression",
"generator_function",
"generator_function_declaration",
],
TSX: [
"function_declaration",
"arrow_function",
"function_expression",
"generator_function",
"generator_function_declaration",
],
// We copy the TypeScript values here
TSX: [],
};

functionNodeTypes.TSX = functionNodeTypes.TypeScript;
9 changes: 0 additions & 9 deletions src/jetbrains/README.md

This file was deleted.

92 changes: 0 additions & 92 deletions src/jetbrains/src/App.svelte

This file was deleted.

Loading

0 comments on commit dfa4ed7

Please sign in to comment.