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: Source Maps for Code Generation #714

Merged
merged 21 commits into from
Nov 2, 2023
Merged

Conversation

WinPlay02
Copy link
Contributor

Closes #30

Summary of Changes

  • changed code generation to return traced nodes instead of text
  • add option to generate source maps by providing an optional path

Copy link

github-actions bot commented Oct 31, 2023

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ JSON eslint-plugin-jsonc 2 0 0 1.57s
✅ JSON jsonlint 2 0 0.19s
✅ JSON npm-package-json-lint yes no 0.6s
✅ JSON prettier 2 0 0 1.05s
✅ JSON v8r 2 0 5.6s
✅ REPOSITORY git_diff yes no 0.09s
✅ TYPESCRIPT eslint 7 0 0 7.58s
✅ TYPESCRIPT prettier 7 0 0 1.82s

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

Copy link

codecov bot commented Oct 31, 2023

Codecov Report

Merging #714 (666ef96) into main (ac6d42a) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              main      #714    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           73        73            
  Lines         9808     10002   +194     
  Branches      2102      2133    +31     
==========================================
+ Hits          9808     10002   +194     
Files Coverage Δ
...rc/language/generation/safe-ds-python-generator.ts 100.00% <100.00%> (ø)

@WinPlay02
Copy link
Contributor Author

@lars-reimann
How should source maps be tested? Should they be added to the generation tests as an additional file to be generated?

@lars-reimann
Copy link
Member

@lars-reimann How should source maps be tested? Should they be added to the generation tests as an additional file to be generated?

That seems reasonable.

@lars-reimann
Copy link
Member

TypeFox also published a series of blog posts about the code generation with Langium:

The third one specifically talks about source maps.

@WinPlay02 WinPlay02 marked this pull request as ready for review November 2, 2023 09:22
WinPlay02 and others added 9 commits November 2, 2023 16:11
refactor: changed listTestPythonJsonFiles to listTestFilesWithExtensions

Co-authored-by: Lars Reimann <mail@larsreimann.com>
…source-maps

# Conflicts:
#	package-lock.json
#	packages/safe-ds-lang/package.json
…eOptions for cli to CliGenerateOptions

feat: accept --sourcemaps parameter, to enable sourcemap generation
…into generator-source-maps

# Conflicts:
#	packages/safe-ds-lang/tests/helpers/testResources.ts
#	packages/safe-ds-lang/tests/language/generation/safe-ds-python-generator.test.ts
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.

Looks great, just one tiny change left.

packages/safe-ds-lang/tests/helpers/testResources.test.ts Outdated Show resolved Hide resolved
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.

Thanks a lot!

@lars-reimann lars-reimann merged commit 64b9e07 into main Nov 2, 2023
7 checks passed
@lars-reimann lars-reimann deleted the generator-source-maps branch November 2, 2023 19:00
lars-reimann pushed a commit that referenced this pull request Nov 12, 2023
## [0.3.0](v0.2.0...v0.3.0) (2023-11-12)

### Features

* annotations for the purity of functions ([#709](#709)) ([9d342e4](9d342e4)), closes [#559](#559)
* call hierarchy provider ([#735](#735)) ([168d098](168d098)), closes [#680](#680)
* compute type of elvis operators with nullable left operand ([#715](#715)) ([376b083](376b083)), closes [#541](#541)
* customize rendering of `[@param](https://github.com/param)`, `[@Result](https://github.com/result)`, and `[@type](https://github.com/type)Param` tags ([#764](#764)) ([e049148](e049148)), closes [#669](#669)
* ensure an overriding member matches the overridden one ([#758](#758)) ([a698a6a](a698a6a)), closes [#639](#639)
* error if callable type is used in wrong context ([#763](#763)) ([9b1522f](9b1522f)), closes [#713](#713)
* error if type parameter is used in nested named type declaration ([#750](#750)) ([52374aa](52374aa)), closes [#748](#748)
* info if overriding member is not needed ([#759](#759)) ([23b340e](23b340e)), closes [#25](#25)
* mark constraint lists as experimental ([#752](#752)) ([d48e1e0](d48e1e0)), closes [#18](#18)
* mark type parameter lists and type argument lists as experimental ([#755](#755)) ([f1a052a](f1a052a)), closes [#753](#753)
* mark unused internal/private segments as unnecessary ([#710](#710)) ([3ba8698](3ba8698)), closes [#682](#682)
* minor improvements for purity info ([#728](#728)) ([8d59607](8d59607))
* partially evaluate lambdas and segments ([#734](#734)) ([c40347c](c40347c)), closes [#603](#603)
* scoping for inherited members ([#706](#706)) ([4518aee](4518aee)), closes [#540](#540)
* scoping for member access on literals and literal types ([#754](#754)) ([e60e456](e60e456)), closes [#80](#80)
* scoping for references to containing declarations ([#708](#708)) ([3762c36](3762c36)), closes [#540](#540)
* show an error if a pure parameter does not have a callable type ([#736](#736)) ([6c52868](6c52868)), closes [#729](#729)
* show error if own declaration has same name as core one ([#762](#762)) ([8cb2120](8cb2120)), closes [#760](#760)
* signature help ([#724](#724)) ([ed33676](ed33676)), closes [#24](#24)
* Source Maps for Code Generation ([#714](#714)) ([64b9e07](64b9e07)), closes [#30](#30)
* tooltips for inlay hints ([#721](#721)) ([3e71cad](3e71cad))
* type checker service ([#722](#722)) ([daad5c4](daad5c4)), closes [#666](#666)
* type checking ([#723](#723)) ([a9eb3bb](a9eb3bb)), closes [#666](#666)
* type checking for list & map literals ([#751](#751)) ([dc14223](dc14223)), closes [#712](#712)
* type hierarchy provider ([#737](#737)) ([9fd5f0c](9fd5f0c)), closes [#681](#681)
* VS Code snippets ([#757](#757)) ([fd6f432](fd6f432)), closes [#756](#756)

### Bug Fixes

* assignability of static type to callable type ([#725](#725)) ([1d17900](1d17900))
* NPEs during validation ([#727](#727)) ([4b8196f](4b8196f))
* prevent overwriting core declarations ([#761](#761)) ([36663ca](36663ca))
* prevent references to following parameters from default values ([#707](#707)) ([182d64b](182d64b)), closes [#540](#540)
* setup of CLI ([#698](#698)) ([0b5d90d](0b5d90d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate source map
3 participants