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

refactor: build template.json grammar from typescript source files #581

Merged

Conversation

dannymcgee
Copy link
Contributor

As discussed in #571:

  • Added ts-node as a dev dependency
  • Added TypeScript build system for generating JSON gramar files from more legible/organized source code
  • Added npm script for building grammars (yarn build:syntaxes)
  • Refactored Template grammar to TypeScript
  • Rebuilt template.json from source

@dannymcgee dannymcgee requested a review from ayazhafiz January 25, 2020 21:11
@ayazhafiz
Copy link
Member

Thanks for the PR! I will take a look tonight; apologies for the tardiness.

@dannymcgee
Copy link
Contributor Author

Thanks for the PR! I will take a look tonight; apologies for the tardiness.

No worries, and no rush!

Copy link
Member

@ayazhafiz ayazhafiz left a comment

Choose a reason for hiding this comment

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

Additionally, could you add a rule to the build script that builds the template grammars from source?

syntaxes/src/build.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
syntaxes/src/build.ts Outdated Show resolved Hide resolved
syntaxes/src/build.ts Outdated Show resolved Hide resolved
syntaxes/src/template/index.ts Outdated Show resolved Hide resolved
syntaxes/src/types.ts Outdated Show resolved Hide resolved
@dannymcgee dannymcgee requested a review from ayazhafiz January 26, 2020 21:12
Copy link
Member

@ayazhafiz ayazhafiz left a comment

Choose a reason for hiding this comment

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

If you write to syntaxes/out, I believe you will need to change the grammar contribution file in package.json as well.

@dannymcgee
Copy link
Contributor Author

If you write to syntaxes/out, I believe you will need to change the grammar contribution file in package.json as well.

The grammars are actually copied from syntaxes/out to dist/syntaxes as part of the build script, per ad747b9

@dannymcgee dannymcgee requested a review from ayazhafiz January 28, 2020 03:34
Copy link
Member

@ayazhafiz ayazhafiz left a comment

Choose a reason for hiding this comment

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

This is big, thanks @dannymcgee!

if (typeof value === 'string') {
processedGrammar[key] = value;
} else if (value instanceof RegExp) {
// Escape backslashes/quote marks and trim the demarcating `/` characters from a regex literal
Copy link
Member

Choose a reason for hiding this comment

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

oh, i see. nice!

@ayazhafiz ayazhafiz merged commit 2d4fd87 into angular:master Jan 28, 2020
@dannymcgee dannymcgee deleted the refactor-grammars-to-ts-build-system branch January 28, 2020 17:02
ayazhafiz added a commit to ayazhafiz/vscode-ng-language-service that referenced this pull request Jan 29, 2020
This commit refactors remaining existing grammars to use TS definitions
as started in angular#581.
ayazhafiz added a commit that referenced this pull request Jan 29, 2020
* refactor: move syntax grammars to TS definitions

This commit refactors remaining existing grammars to use TS definitions
as started in #581.

* fixup! refactor: move syntax grammars to TS definitions
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants