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

Could component mode be detected and shown? #2418

Closed
brunnerh opened this issue Jun 25, 2024 · 5 comments
Closed

Could component mode be detected and shown? #2418

brunnerh opened this issue Jun 25, 2024 · 5 comments
Labels
feature request New feature or request Fixed Fixed in master branch. Pending production release.

Comments

@brunnerh
Copy link
Member

Description

During the transition to Svelte 5, if the mode is not globally enforced, unintentionally being in one mode or the other could be undesirable.
E.g. legacy mode leads to coarse grained reactivity which can cause issues and just has worse performance.

Seen unintended mode switches happen when people refactored the last variable using a rune into a separate file.

Proposed solution

If mode is detectable, show mode via CodeLens at the top of the file.

image

Ideally this would be configurable, e.g. via an array specifying the modes one is interested in.
Something like:

{
  "svelte.showComponentMode": ["legacy", "runes"],
}

Alternatives

There might be other ways of making users aware of the mode or mode switches happening.
E.g. on switch a notification could be shown, but this seems too intrusive.

Additional Information, eg. Screenshots

No response

@dummdidumm dummdidumm added the feature request New feature or request label Jun 25, 2024
@jasonlyu123
Copy link
Member

jasonlyu123 commented Oct 19, 2024

Now we have a command to migrate components into rune mode maybe we can also make this component mode codelens a button for migrating. Kind of like the one in the REPL. Either replace the "LEGCAY MODE" with "Migrate to rune" or a separate one for migration.

ezgif-5-9261a48225

@dummdidumm
Copy link
Member

I'll implement the code lens for the legacy/runes mode indicator. The migration lens not for now, because it might have false positives (i.e. not do anything or fail)

dummdidumm added a commit that referenced this issue Oct 31, 2024
adds a runes mode indicator atop of the file via a code lens. Will show "runes mode" if the components is in that mode, "legacy mode" if not, and nothing if it's not Svelte 5

#2418
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Oct 31, 2024
dummdidumm added a commit that referenced this issue Oct 31, 2024
adds a runes mode indicator atop of the file via a code lens. Will show "runes mode" if the components is in that mode, "legacy mode" if not, and nothing if it's not Svelte 5

#2418
@brunnerh
Copy link
Member Author

brunnerh commented Nov 8, 2024

@dummdidumm It seems like the mode lens overwrites the component references lens (#2378), could those be combined?

@adwher
Copy link

adwher commented Nov 9, 2024

@dummdidumm How can I disable the indicator? There's an option like svelte.disableRuneModeIndicator?

@dummdidumm
Copy link
Member

I added an option, will release early next week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

4 participants