Watch creation of .svelte files
Closed this issue · 0 comments
Description
I like to write out my HTML in a top-down direction. I start with a Parent component (say BarGraph.svelte
) and then write out something like this:
<div id="bargraph">
<Bar height="1"/>
<Bar height="0.5"/>
<Bar height="0.75"/>
</div>
(Let's ignore the fact that in this case it might make more sense to use <slot/>
to include the Bar
components, this is just an illustrative example.)
At this point, Bar.svelte
does not exist, so I rightfully encounter the errors 'Bar' is not defined
and Cannot find name 'Bar'
.
At this point, since there is no code action to create and import the newly created file ( see #2392 ) , I have to manually create the file. However, since .svelte
files are currently not being watched, my code actions
don't update to reflect the new import.
Right now, before I get the option the option to import the newly created Bar.svelte
file I have to either
A) close out of neovim and reboot it
B) run :LspRestart
C) open the Bar.svelte
file to get the language server to know of the creation of the Bar.svelte
file, and then hop back to the Chart.svelte
file
These are all slowing down my workflow. For now, my best bet is to bind :LspRestart
to a keybind or setup an autocmd that takes care of it for me.
Proposed solution
Add watch support for .svelte
files (just as there is watch support for js/ts files), so that I don't have to manually update the language server to offer code actions to import a newly added .svelte file.
Alternatives
No response
Additional Information, eg. Screenshots
This gif shows that the code actions are not updated when adding a new .svelte file. I then exit neovim and enter the Parent file again, and the code action shows up.