editor: auto-import style
Check for existing issues
- [X] Completed
Describe the feature
There's an option in VS Code called "import module specifier" which allows to choose how the auto-imports are written.
This would be great in order to not waste time rewriting all auto-imports to match the desired import style.
If applicable, add mockups / screenshots to help present your vision of the feature
No response
Seconding this - this is the main blocker for me to switch fully to Zed
Adding this in settings is working for me:
{
...
"lsp": {
"typescript-language-server": {
"initialization_options": {
"preferences": {
"importModuleSpecifierPreference": "non-relative"
}
}
}
}
}
This solution is no longer working with vtsls typescript LSP
Adding this in settings is working for me:
{ ... "lsp": { "typescript-language-server": { "initialization_options": { "preferences": { "importModuleSpecifierPreference": "non-relative" } } } } }
FWIW, this works for me after running into the same issue as @antoyne7:
{
...
"language_servers": ["...", "!vtsls", "typescript-language-server"],
"lsp": {
"typescript-language-server": {
"initialization_options": {
"preferences": {
"importModuleSpecifierPreference": "non-relative"
}
}
}
}
}
I tried all kinds of different ways to configure the vtsls language server but I can't seem to get it working :sob:
"lsp": {
"vtsls": {
"initialization_options": {
"typescript": {
"preferences": {
"importModuleSpecifier": "non-relative",
"importModuleSpecifierEnding": "js"
}
}
}
}
}
Or like so
"lsp": {
"vtsls": {
"initialization_options": {
"preferences": {
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.preferences.importModuleSpecifierEnding": "js"
}
}
}
}
I have looked at the docs of this vtsls language server but I can't seem to get it working. The answer of @pcalves by switching to the typescript-language-server is working but I would like to keep using the standard language server for typescript that Zed offers instead of working around it, if possible
After trying a good amount of permutations, this ended up doing the work for me with vtsls:
"lsp": {
"vtsls": {
"initialization_options": {
"typescript": {
"preferences": {
"importModuleSpecifier": "relative"
}
}
}
}
}
^ this did it. P.S. Don't forget to change it to "non-relative".
In zed version 0.154.2 it's not work
@tp6gw94 Replace initialization_options with settings.
@tp6gw94 Replace
initialization_optionswithsettings.
@giannisp It's work! Thank you.
"vtsls": {
"settings": {
"typescript": {
"preferences": {
"importModuleSpecifier": "non-relative"
}
}
}
},
Hi all! Is there a documentation for all this magic words?
@procopym You can look into the configuration options of the language server for further tinkering
Does anyone has an idea how to enable the relative option for .vue files? With this config:
{
"lsp": {
"vtsls": {
"settings": {
"typescript": {
"preferences": {
"importModuleSpecifier": "relative"
}
},
}
}
}
}
It works for .ts files but in .vue it behaves like when the value is "non-relative"