Skip to content

add TypeScript keywords + future reserved keywords #11

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

Closed
wants to merge 1 commit into from

Conversation

leoortizz
Copy link

add the following keywords:

  • enum
  • implements
  • interface
  • package
  • private
  • protected
  • public
  • type

@marijnh I think that ideally some should be TypeScript only, also some should be scoped to the strict mode per the spec, but that would require greater changes. In the meantime I think that these should be added sooner rather than later as currently they can't be styled.

@marijnh marijnh closed this in d248838 Jul 5, 2023
@marijnh
Copy link
Member

marijnh commented Jul 5, 2023

I think that these should be added sooner rather than later as currently they can't be styled.

What does that mean? If you turn on TypeScript, these should all be highlighted correctly. Adding them as completions does not affect whether they are styled or not.

Attached patch adds this in a way where it only takes effect when TypeScript is actually enabled, and using snippets where appropriate.

@leoortizz leoortizz deleted the add-keywords branch July 5, 2023 14:13
@leoortizz
Copy link
Author

I think that these should be added sooner rather than later as currently they can't be styled.

What does that mean? If you turn on TypeScript, these should all be highlighted correctly. Adding them as completions does not affect whether they are styled or not.

I'm defining my own syntax highlighting styles with syntaxHighlighting(HighlightStyle.define(TagStyle[])), then using tags as {tag: tags.keyword, color: 'var(--code-keyword)'}.

I meant that before this change these keywords were being identified as something else, then we had to style them as something else, not keywords as they are.

Attached patch adds this in a way where it only takes effect when TypeScript is actually enabled, and using snippets where appropriate.

Thanks!

@marijnh
Copy link
Member

marijnh commented Jul 5, 2023

I meant that before this change these keywords were being identified as something else, then we had to style them as something else, not keywords as they are.

Right. But that's not accurate (that array you changed has no effect at all on the parse tree or highlighting).

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.

2 participants