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

feat: add custom editor / visualizer to vscode extension #1243

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

Conversation

GideonKoenig
Copy link
Contributor

Giant Pull Request - All in one - I'm sorry

GideonKoenigJukabo and others added 30 commits January 27, 2024 14:08
@GideonKoenig GideonKoenig added enhancement 💡 New feature or request vscode 🔨 Issues regarding tools like the VS Code extension labels Oct 21, 2024
Copy link

github-actions bot commented Oct 21, 2024

🦙 MegaLinter status: ⚠️ WARNING

Descriptor Linter Files Fixed Errors Elapsed time
✅ CSS stylelint 3 0 0 1.54s
✅ JAVASCRIPT eslint 4 0 0 2.96s
⚠️ JAVASCRIPT prettier 4 0 1 0.61s
✅ JSON jsonlint 10 0 0.2s
✅ JSON npm-package-json-lint yes no 0.85s
⚠️ JSON prettier 79 0 1 1.48s
✅ JSON v8r 10 0 16.3s
✅ MARKDOWN markdown-link-check 1 0 0.72s
✅ REPOSITORY git_diff yes no 0.26s
✅ TSX eslint 66 0 0 13.51s
✅ TYPESCRIPT eslint 41 0 0 10.1s
⚠️ TYPESCRIPT prettier 41 0 1 0.53s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@lars-reimann
Copy link
Member

@GideonKoenig Please start by fixing the failing checks (builds, lint, PR title).

@GideonKoenig GideonKoenig changed the title Custom editor / Visualization feat: add custom editor / visualization to vscode extension Oct 29, 2024
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 31.32530% with 1026 lines in your changes missing coverage. Please review.

Project coverage is 94.86%. Comparing base (3d9d4db) to head (cafa613).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...lang/src/language/custom-editor/ast-parser/call.ts 15.18% 268 Missing ⚠️
...src/language/custom-editor/ast-parser/statement.ts 22.31% 94 Missing ⚠️
.../src/language/custom-editor/getGlobalReferences.ts 18.69% 87 Missing ⚠️
...ang/src/language/custom-editor/ast-parser/utils.ts 33.33% 86 Missing ⚠️
...-lang/src/language/custom-editor/getSyncChannel.ts 26.66% 66 Missing ⚠️
...g/src/language/custom-editor/getNodeDescription.ts 21.95% 64 Missing ⚠️
...uage/custom-editor/ast-parser/tools/debug-utils.ts 22.36% 59 Missing ⚠️
...lang/src/language/custom-editor/ast-parser/main.ts 25.45% 41 Missing ⚠️
...lang/src/language/custom-editor/ast-parser/edge.ts 42.85% 40 Missing ⚠️
...rc/language/custom-editor/ast-parser/expression.ts 35.00% 39 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1243      +/-   ##
==========================================
- Coverage   99.79%   94.86%   -4.94%     
==========================================
  Files         110      128      +18     
  Lines       19247    20741    +1494     
  Branches     4110     4111       +1     
==========================================
+ Hits        19207    19675     +468     
- Misses         40     1066    +1026     

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

@GideonKoenig GideonKoenig changed the title feat: add custom editor / visualization to vscode extension feat: add custom editor / visualizer to vscode extension Oct 29, 2024
@GideonKoenig GideonKoenig marked this pull request as ready for review October 29, 2024 14:28
Copy link
Member

@lars-reimann lars-reimann left a comment

Choose a reason for hiding this comment

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

First batch of comments about the stub changes.

lars-reimann added a commit that referenced this pull request Nov 14, 2024
### Summary of Changes

Modifies the language stubs in preparation for the Custom
Editor/Visualization PR #1243.
Defines/Adjusts the DataScienceCategories and assigns them to a sample
amount of functions and classes from the Safe-Ds language.

---------

Co-authored-by: Lars Reimann <[email protected]>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lars-reimann
Apparently I missed this change in the PR before. Should I extract the two remaining category assignments into a separate branch?

Copy link
Member

Choose a reason for hiding this comment

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

I think this would make sense, so these changes quickly end up on main.

Copy link
Member

Choose a reason for hiding this comment

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

Should not be included in the repo. Code should look consistent, regardless of the sub-project.

Locally, you can of course reformat the (TypeScript) code, however you want.

Comment on lines +28 to +34
{
files: ['packages/safe-ds-editor/src/**'],
rules: {
'import/no-default-export': 'off',
'no-console': 'off',
},
},
Copy link
Member

Choose a reason for hiding this comment

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

I don't see a reason to disable these rules completely for this folder.

  • Default exports are rarely needed, and using named exports throughout leads to more consistent code and a more consistent API. Moreover, we provide names for the exported elements, which already indicate their purpose. Default exports are unnamed, so users must always refer to documentation or the module that exports them.
  • Console statements are very easy to forget in the code. You are better off disabling the error for the few lines where you need them by adding a comment directly above the affected lines (https://eslint.org/docs/latest/use/configure/rules#disabling-rules).

@@ -0,0 +1,5 @@
{
"files.associations": {
"*.css": "tailwindcss"
Copy link
Member

Choose a reason for hiding this comment

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

Does this require any extension to be installed?

Copy link
Member

Choose a reason for hiding this comment

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

See other comment about updating prettierrc. Should not be included in the repo.

Copy link
Member

Choose a reason for hiding this comment

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

What does this do?

Copy link
Member

@lars-reimann lars-reimann Nov 14, 2024

Choose a reason for hiding this comment

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

I'd greatly prefer this to be included in ESBuild script in the safe-ds-vscode project (packages\safe-ds-vscode\esbuild.mjs). It's always better if a project manages its dependencies rather than its dependents.

Copy link
Member

Choose a reason for hiding this comment

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

If default exports are unavoidable here, add a comment to disable the error for the next line.

Copy link
Member

Choose a reason for hiding this comment

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

The next step would be to extract the custom-editor service into its own PR. It also requires unit tests. Finally, "custom-editor" is a very general name, maybe something like "graphical-editor" is better (or currently "graphical-view", though then we'd have to rename it eventually). I'm open for suggestions here.

static callList: Call[];
static genericExpressionList: GenericExpression[];
static edgeList: Edge[];
static safeDsServices: SafeDsServices;
Copy link
Member

@lars-reimann lars-reimann Nov 14, 2024

Choose a reason for hiding this comment

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

Anything that needs services should be made a service, so everything gets wired up properly. Here, Utils is in an invalid state before initialize is called.

Likewise, it should not have static state/methods but instance state/methods, since multiple instances of SafeDsServices might be in use at the same time, e.g. when running tests. Using static state here, can quickly lead to subtle bugs.

Comment on lines +113 to +122
export const zip = <A, B>(arrayA: A[], arrayB: B[]): [A, B][] => {
const minLength = Math.min(arrayA.length, arrayB.length);
const result: [A, B][] = [];

for (let i = 0; i < minLength; i++) {
result.push([arrayA[i]!, arrayB[i]!]);
}

return result;
};
Copy link
Member

Choose a reason for hiding this comment

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

Would be a useful addition to packages\safe-ds-lang\src\helpers\collections.ts.

lars-reimann pushed a commit that referenced this pull request Nov 24, 2024
## [0.22.0](v0.21.1...v0.22.0) (2024-11-24)

### Features

* categorize API elements ([#1263](#1263)) ([d0d971e](d0d971e)), closes [#1243](#1243)
* disable inlay hints for assignee types by default ([#1260](#1260)) ([a651ade](a651ade))
* improve error messages from linker ([#1272](#1272)) ([eddd868](eddd868)), closes [#1268](#1268)
* output statement ([#1262](#1262)) ([011ba31](011ba31)), closes [#1259](#1259)
* remove schema concept from grammar ([#1273](#1273)) ([1a3bf80](1a3bf80)), closes [#1133](#1133)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 💡 New feature or request vscode 🔨 Issues regarding tools like the VS Code extension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants