Skip to content

Feat: panda theme#367

Merged
riccardoperra merged 4 commits into
riccardoperra:mainfrom
TGlide:feat/panda-theme
Oct 6, 2022
Merged

Feat: panda theme#367
riccardoperra merged 4 commits into
riccardoperra:mainfrom
TGlide:feat/panda-theme

Conversation

@TGlide

@TGlide TGlide commented Oct 6, 2022

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: Closes #366

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[X] No

Other information

@TGlide TGlide requested a review from riccardoperra as a code owner October 6, 2022 17:29
@codesandbox

codesandbox Bot commented Oct 6, 2022

Copy link
Copy Markdown

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@changeset-bot

changeset-bot Bot commented Oct 6, 2022

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1ffc073

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@codeimage/highlight Patch
@codeimage/app Patch
@codeimage/config Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@riccardoperra

riccardoperra commented Oct 6, 2022

Copy link
Copy Markdown
Owner

reply to #366 (comment)

Hey @riccardoperra ! I've just submitted the PR, though I ran into an issue. I was unable to correctly theme some properties, as there were no available options defined in StyledHighlightOptions for them. e.g. I couldn't stylize the return keyword independently.

Hey @TGlide, in this case you can use the default api from CodeMirror.

You should be able to call directly the syntaxHighlighting function as I did in github-dark theme

syntaxHighlighting(
HighlightStyle.define([
{
tag: t.definition(t.variableName),
color: libColors.prettylights.syntax.constant,
},
]),
),
];

I don't think there is a return keyword only in the Lezer parser so you may need to use the controlKeyword tag.
https://github.com/lezer-parser/javascript/blob/00173306dc20e2b1f364cc30b6de0398156e8f42/src/highlight.js#L5

In this case I imagine you have to do something like this:

syntaxHighlighting(
    HighlightStyle.define([
      {
        tag: t.controlKeyword,
        color: yourColor,
      },
    ]),
  ),

Anyway, probably there will be to extend the Lezer parser to create an unique tag for this keyword, but it's something that it's not planned right now.

Doing a perfect copy is impossible so don't worry, it's fine even if the return matches the color of the generic keywords 😄

@TGlide

TGlide commented Oct 6, 2022

Copy link
Copy Markdown
Contributor Author

@riccardoperra Thanks for the help! It worked, although I had to put the syntaxHighlighting before defineEditorTheme for it to work.

@riccardoperra

riccardoperra commented Oct 6, 2022

Copy link
Copy Markdown
Owner

Oops, probably this is because defineEditorTheme already use that tag, but it's fine 😄

Anyway, everything seems ok 😄 I just reverted only the pnpm-lock since I don't know if it's ok that modules are resolved correctly.

Since the main branch now contains also the newest 1.0 version, the deploy will be the next weeks. Thanks again

@TGlide

TGlide commented Oct 6, 2022

Copy link
Copy Markdown
Contributor Author

Thanks for the merge @riccardoperra! Glad I could help.

Would you mind adding the hacktoberfest-accepted label? Thanks!!

@riccardoperra

Copy link
Copy Markdown
Owner

Done 😃 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 - Add Panda theme

2 participants