zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.71k stars 3.06k forks source link

.svelte typescript definitions not updating live #4598

Closed MatthiasGrandl closed 1 month ago

MatthiasGrandl commented 1 year ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Just tried out the preview channel for the Svelte support. So far things are working mostly fine, however when I add a new export to an existing file and then try to import this new export in an open .svelte file, it says "file has no exported members.

To reproduce:

Create 2 files:

// exports.ts
export const foo = "foo";
<script lang="ts">
// test.svelte
import { foo } from "./export.ts"
</script>

save the files and keep the buffers open. Then add another export to exports.ts

export const bar = "bar";

Now when you try to add the import for bar in test.svelte you will see the error: Module './export.ts' has no exported member 'bar'.

Environment

Zed: v0.96.2 (preview) OS: macOS 13.4.1 Memory: 16 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

chrisbrown-io commented 1 year ago

Encountering the same issue using 0.96.2.

After a bit of preliminary digging, this seems like a problem within the svelte-language-server itself (https://github.com/sveltejs/language-tools/issues/550).

It seems as though the svelte-vscode plugin that uses the language server has an additional option to allow loading the plugin, which supposedly fixes this.

I tried fiddling around with the Zed lsp settings to see if I could load the plugin, but to no avail.

The following is my hypothesis, although the lsp side of things is far outside my expertise, so I am prepared to be told otherwise:

As svelte files use the svelte-language-server instead of the typescript-language-server in Zed, you can't make use of the plugins option within the ts language server and it doesn't seem as though the svelte one exposes any similar initialisation option that could be hooked into through Zed?

chrisbrown-io commented 1 year ago

Further to the above, it seems as though svelte-language-server might support passing typescript language server configuration/options, that could presumably be passed via the "lsp" setting in Zed?

The language server also accepts configuration for Emmet (key: emmet; settings reference), Prettier (key: prettier), CSS (key: css / less / scss; settings reference) and TypeScript (keys: javascript and typescript for JS/TS config; settings reference).

After a few different attempts/configrations though, I still can't get it to load the plugin.

These lines in the svelte-language-server seem most of interest: https://github.com/sveltejs/language-tools/blob/master/packages/language-server/src/server.ts#L130

mikayla-maki commented 1 year ago

Thanks for the links @chrisbrown-io. Unfortunately, it looks like all of the behavior you're referencing is implemented at the VSCode plugin level, instead of in either of the relevant LSPs. We currently don't have the bandwidth to implement these kinds of cross-language one-off patches so it might be a bit before we can get to this :)

github-actions[bot] commented 1 month ago

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. Are you able to reproduce this issue in the latest version of Zed? If so, please let us know by commenting on this issue and we will keep it open; otherwise, we'll close it in a week. Feel free to open a new issue if you're seeing this message after the issue has been closed. Thanks for your help!

github-actions[bot] commented 1 month ago

This issue was closed due to inactivity; feel free to open a new issue if you're still experiencing this problem!