Hi there,
I’m hoping for .svelte files (from Svelte framework) to be better supported in the editor via syntax highlighting, potentially formatting and other error handling.
You can see a setup I’m starting to build out here, which supports live-reloading:
Combining automated deployment, instant hosting & collaborative editing, Glitch gets you straight to coding so you can build full-stack web apps, fast
Thanks
Hey @mattdesl ,
Glitch is using CodeMirror for syntax highlighting and Prettier for code formatting. So for it to work, you’ll have to make sure that both CodeMirror and Prettier supports Svelte.
Yup, this is possible — Svelte’s own REPL uses CodeMirror, and you can find how it is set up here:
<script context="module">
import { is_browser } from './env.js';
let codemirror_promise;
let _CodeMirror;
if (is_browser) {
codemirror_promise = import('./codemirror.js');
codemirror_promise.then(mod => {
_CodeMirror = mod.default;
});
}
</script>
<script>
import { onMount, createEventDispatcher } from 'svelte';
import Message from './Message.svelte';
const dispatch = createEventDispatcher();
This file has been truncated. show original
And Prettier formatter plugin:
1 Like
Hehe, but Glitch needs to install it as well. @glitch_support ???
markmk
April 18, 2020, 4:32pm
5
+1 for Svelte syntax highlighting and formatting. Is there a way to enable codemirror by setting a project config?
Adding another vote to this. I’d like to get syntax highlight too.
chance
April 21, 2020, 3:43pm
7
hi everyone! we have enabled syntax highlighting for svelte. it isn’t great yet, but we’re looking to improve it. thanks for the feedback!
chance
April 21, 2020, 3:53pm
9
@khalby786 not glitch support, but i work on the code editor here at glitch
2 Likes
Sorry, I didn’t know that!
Thats really cool! Thanks for the update!
thank you so much for this
Hello, can somebody write what to do to enable svelte formatting step by step? Simple installing prettier-plugin-svelte is not enough
Any updates on this? I couldn’t get this to work. Even installing the Svelte Prettier package with the .prettierrc
file doesn’t work.
Was it enabled and then later turn off by the dev? @chance @glitch_support
jenn
February 18, 2022, 4:53pm
15
Hi there - we just added syntax highlighting back to .svelte files!
1 Like