-
Notifications
You must be signed in to change notification settings - Fork 150
Add possibility to define language defaults #189
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
Comments
Hey @dummdidumm 👋 I'm not completely against being able to define default processors, but as stated in #184 it's something that can negatively affect the DX of svelte projects. How do you see the |
Oh, I did not see that issue, sorry about that 🤦 It either would need its own settings in |
No worries 😀 This is an even stronger signal that this feature is wanted / useful. We have to find the most frictionless way of doing this with the My brainstorming thoughts:
const defaults = {
script: 'typescript',
styles: 'less'
}
module.exports = {
preprocess: preprocess({ defaults })
}
exports.defaults = defaults Would this only work in auto preprocessing? Or standalone processors should also respect these default configs? I'm not sure what would be the benefit of using each processor separately and wanting to set default languages (apart from not having to type the language attribute). |
Good thought about the interoperability with other preprocessors. I think the best way would be to just duplicate it then like you proposed, so there is a separate setting for the language server and the preprocessor, so they don't have to know of each other. In the docs on both sides it then needs to be made clear that this can only be used when both the preprocessor and the IDE Svelte extension support this setting, which would be the case for |
I like this idea. It'd be good to have something like |
I agree. If either |
Had sometime today to tackle this one and I think I've managed to do it in a good way. Default languages will be |
Hi, I have a use case to add to this. Although I think it might have some slightly new contexts. I'm using pHTML in my projects which allows me to preprocess HTML. It's a bit similar to PostCSS in the respect that it's not a replacement for things like SASS. It works in tandem. So in this case pHTML really ought to work 1. After all other preprocessors and 2. Work without a template tag. This way anything which is processed by say something like Pug can be passed next to the pHTML preprocessor. |
@limitlessloop Hey 👋 I don't think this is related to being able to define default languages. Could you create a specific issue for |
@kaisermann ah I see, ok. Thanks I'll raise an issue to see if you can advice how to set it up. Thank you. |
Is your feature request related to a problem? Please describe.
If a project settles on a specific language for scripts/styles/markup, it usually wants to use that in ALL scripts/styles/markup. Yet we have to define the language explicitely each time.
Describe the solution you'd like
A new settings through which you can set defaults for script/styles/markup, something like this:
This means every tag would be preprocessed with said language, even if I don't specify
lang="typescript"
for example. If I specifiy eithertype
orlang
on the tag, that one is used instead.Describe alternatives you've considered
None.
How important is this feature to you?
Would help saving typing that 20 characters each file, but not a deal breaker.
Additional context
If this gets implemented, the
language-tools
-repo needs to update its doc accordingly.The text was updated successfully, but these errors were encountered: