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

Not using active syntax theme #5

Closed
batjko opened this issue Jul 14, 2014 · 24 comments
Closed

Not using active syntax theme #5

batjko opened this issue Jul 14, 2014 · 24 comments

Comments

@batjko
Copy link

batjko commented Jul 14, 2014

Hi,

This is a great package.
One little issue to note would be that the preview doesn't seem to use the actual syntax theme, in terms of the font and colors:
image

Any chance this can be adopted?

@Glavin001
Copy link
Owner

Any chance this can be adopted?

Absolutely. I originally tried to get https://github.com/atom/highlights working however it complained with errors when I installed it so I used another package, see #1. Maybe @kevinsawicki could give me a hand in where I should look for how the EditorView renders syntax highlighting :).

@kevinsawicki
Copy link

There is an API on the EditorView to build HTML for a given text chunk using the current theme.

The Markdown preview package uses it to colorize code blocks in markdown files.

You can get the JS grammar by doing atom.syntax.grammarForScopeName('source.js') and then do the following to build the HTML: https://github.com/atom/markdown-preview/blob/17dd86ede2d6a270fecc39b696282937c67fb3ae/lib/renderer.coffee#L97-L100

Is this what you are looking for?

@Glavin001
Copy link
Owner

Looks like exactly what I need! Thank you @kevinsawicki!
I should be able to whip this up quickly later tonight :).

@kevinsawicki
Copy link

Great, let me know if you have any issues, very cool package 👍

@batjko
Copy link
Author

batjko commented Jul 14, 2014

Great stuff! Thank you both.

@Glavin001 Glavin001 self-assigned this Jul 14, 2014
@Glavin001
Copy link
Owner

Pushed :).
screenshot

@batjko
Copy link
Author

batjko commented Jul 14, 2014

Yup, that looks pretty now!

The font size isn't catching up yet, but the theme is working very nicely now!
image

@Glavin001
Copy link
Owner

Whaaat? I even fixed the font-size before I pushed. It updates the font-size every time it renders the new preview.
https://github.com/Glavin001/atom-coffeescript-preview/blob/master/lib/coffeescript-preview-view.coffee#L135-L141

@kevinsawicki any ideas / alternatives to syncing the font-size?

@batjko
Copy link
Author

batjko commented Jul 14, 2014

Sorry, mate.
I tried closing the preview, then changing the coffee's size, then re-loading the preview, still not adapting.

No errors in the console, btw.

@Glavin001
Copy link
Owner

Just tried it with mine. It is working, because the tab change event is triggered when I got back from Atom Settings tab back to the coffeescript editor, and it reloads the view and re-applies the font-size.

How are you setting the font size?

@Glavin001
Copy link
Owner

@batjko I think I may have found the problem. And also a solution. Continuing with issue #6

@batjko
Copy link
Author

batjko commented Jul 14, 2014

Ah, yea I'm not using the settings view for it, rather the Ctrl+= and Ctrl+- key binding for adjusting the size.
But even changing it in the Settings View doesn't do it for the preview.

@Glavin001
Copy link
Owner

@batjko I have pushed and published a patch that fixes the issues you described and I tested with Ctrl+= and Ctrl+- key binding for adjusting the size. Hope it works well for you, too :).

@batjko
Copy link
Author

batjko commented Jul 14, 2014

Yup, now it changes font size as I change it. Purrs like a kitten!
Well done, and thanks for the quick turn-around!

@Glavin001
Copy link
Owner

You're very welcome! Thank you for your support and let me know if you have any other ideas to make it even better!

@violet-athena
Copy link

Hi guys, this works fine for the inbuilt themes of Atom, but when trying something different (Monokai) it just shows grey text. Any idea where the problem might be?

@Glavin001
Copy link
Owner

@daniocean, like this?
image

@violet-athena
Copy link

Yes, exactly :)

@Glavin001
Copy link
Owner

I have been using the editor-colors class, and these other themes that are not working appear to be just using editor with editor-colors. However, it could also be an issue with the latest Atom updates -- I am finding that the font-size is also incorrectly rendered now even though the CSS says font-size: 16px for both.

image

@Glavin001
Copy link
Owner

Tested Themes:

  • Atom Dark
  • Base16
  • Monokai
  • Solarized Dark

Glavin001 added a commit that referenced this issue Jul 24, 2014
@Glavin001
Copy link
Owner

@daniocean just published a patch. Let me know if it works for you as well.

@Glavin001
Copy link
Owner

Also, I recommend everyone slowly migrates over to using https://github.com/Glavin001/atom-preview :).

@violet-athena
Copy link

Works great, thanks!

I'll probably move to "preview" as soon as this fix is in it :)

Cheers!

@Glavin001
Copy link
Owner

Excellent!

Sounds good. I'll have to make the fix on Preview later tonight after work.

Continued development will likely only continue on with Preview and deprecate CoffeeScript-Preview very soon.

Thanks for your support! Enjoy.

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

No branches or pull requests

4 participants