-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add node location info in dev mode #1499
Comments
@Rich-Harris looking forward to sapper studio. If you are there are a lot of goodies provided by svelte-dev-helper under Just check it out in the console. There is also more info here: https://github.com/ekhaled/svelte-dev-helper/blob/master/README.md |
@ekhaled thanks, that could be handy. Yep, it's using webpack — it's essentially doing |
From what I can see in the short video clip, it assumes a component-per-page workflow. Say you had multiple components on a page. You would need UI to display a list of all rendered components, and their instances. This is where you can leverage Ping me if any questions. |
I'm working on an Electron app called Sapper Studio, which is sort of a specialised IDE for building Sapper apps. Currently, while you're navigating around in the in-app browser, you can click an 'edit' icon and it will open that page in the editor (e.g. if you're on
/blog/some-post
it will openroutes/blog/[slug].html
), and you can do the same by clicking on filenames in the diagnostics panel to locate the sources of errors and warnings. It's pretty slick!What would be even slicker is if you could target individual elements. In order to do this, the compiler would need to decorate elements with location info. Something like this:
then later...
function create_main_fragment(component, ctx) { var h1, text, text_1, text_2; return { c: function create() { h1 = createElement("h1"); + addLoc(h1, 0, 0); text = createText("Hello "); text_1 = createText(ctx.name); text_2 = createText("!"); },
This would allow dev tooling like Sapper Studio (but also in-browser dev tools, when we get round to it) to present a UI for targeting nodes that were created by Svelte. (This is sort of what we were exploring in #973.)
Any thoughts before I go ahead and implement this? Is
__source
the right property, or do we need to bikeshed that?The text was updated successfully, but these errors were encountered: