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

(feat) ts import user preferences #681

Merged
merged 7 commits into from
Dec 2, 2020

Conversation

jasonlyu123
Copy link
Member

@jasonlyu123 jasonlyu123 commented Nov 20, 2020

Add the ability to config import user preference: importModuleSpecifierPreference and importModuleSpecifierEnding.
The former is shortened to importModuleSpecifier in the config to make it consistent with vscode's "javascript.preferences.importModuleSpecifier" setting.

Auto-import can now be configured to always use path alias (importModuleSpecifierPreference: 'non-relative' ) like this

<script>
import {} from '~/utils/abc'
</script>

The default behavior is to use the shorter path, for example:

<script>
import {} from '~/utils/abc'
import {} from './abc'
</script>

in this case, it would use relative.

@dummdidumm
Copy link
Member

Nice feature! But I think it would be better if we would reuse the vscode settings for js/ts. After all, js/ts is embedded into the Svelte script blog so for me it makes sense to reuse its settings, too, then. What do you think?

@jasonlyu123
Copy link
Member Author

That would also be ok. It's just there are separate settings for ts and js. Which one should we use? if both who take priority?

@dummdidumm
Copy link
Member

Why vscode, whyyyyy 😄 if we got access to the document we also got access to whether or not it's lang=ts, so we could branch on that.

@jasonlyu123
Copy link
Member Author

Since it's using ts/js preferences config of vscode now, should we also check quoteStyle?

@dummdidumm
Copy link
Member

Where would we check it?

@jasonlyu123
Copy link
Member Author

it's also a preference config in vscode javascript.preferences.quoteStyle

@dummdidumm
Copy link
Member

And where would we use it? Since it's part of the preferences object, don't we now use it already then?

@jasonlyu123
Copy link
Member Author

I added it. The config name of vscode is different from the UserPreferences of typescript.

@dummdidumm dummdidumm merged commit ffde2b6 into sveltejs:master Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants