Comments (24)
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 :).
from atom-coffeescript-preview.
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?
from atom-coffeescript-preview.
Looks like exactly what I need! Thank you @kevinsawicki!
I should be able to whip this up quickly later tonight :).
from atom-coffeescript-preview.
Great, let me know if you have any issues, very cool package 👍
from atom-coffeescript-preview.
Great stuff! Thank you both.
from atom-coffeescript-preview.
from atom-coffeescript-preview.
Yup, that looks pretty now!
The font size isn't catching up yet, but the theme is working very nicely now!
from atom-coffeescript-preview.
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?
from atom-coffeescript-preview.
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.
from atom-coffeescript-preview.
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?
from atom-coffeescript-preview.
@batjko I think I may have found the problem. And also a solution. Continuing with issue #6
from atom-coffeescript-preview.
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.
from atom-coffeescript-preview.
@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 :).
from atom-coffeescript-preview.
Yup, now it changes font size as I change it. Purrs like a kitten!
Well done, and thanks for the quick turn-around!
from atom-coffeescript-preview.
You're very welcome! Thank you for your support and let me know if you have any other ideas to make it even better!
from atom-coffeescript-preview.
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?
from atom-coffeescript-preview.
from atom-coffeescript-preview.
Yes, exactly :)
from atom-coffeescript-preview.
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.
from atom-coffeescript-preview.
Tested Themes:
- Atom Dark
- Base16
- Monokai
- Solarized Dark
from atom-coffeescript-preview.
@daniocean just published a patch. Let me know if it works for you as well.
from atom-coffeescript-preview.
Also, I recommend everyone slowly migrates over to using https://github.com/Glavin001/atom-preview :).
from atom-coffeescript-preview.
Works great, thanks!
I'll probably move to "preview" as soon as this fix is in it :)
Cheers!
from atom-coffeescript-preview.
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.
from atom-coffeescript-preview.
Related Issues (16)
- Use Hightlights HOT 3
- Deprecate in favour of Atom Preview
- Font size larger than editor HOT 2
- Display Deprecation message on run HOT 2
- Uncaught TypeError: undefined is not a function HOT 2
- Failed to load the coffeescript-preview package HOT 1
- Package.activateResources is deprecated. HOT 4
- Use the `atom-workspace` tag instead of the `workspace` class. HOT 1
- Package Loading slow HOT 3
- Update preview when change tab HOT 13
- Follow scroll of CoffeeScript tab and sync to JS tab HOT 7
- Update Font-Size
- Toggle command opens a new preview tab instead of closing the current one HOT 2
- Implement a delay for Update On Tab Change HOT 5
- Possible modularity? HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atom-coffeescript-preview.