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

[Feature request] improve Hot Reload feature #4313

Open
BachiMjavanadze opened this issue Apr 27, 2024 · 11 comments
Open

[Feature request] improve Hot Reload feature #4313

BachiMjavanadze opened this issue Apr 27, 2024 · 11 comments

Comments

@BachiMjavanadze
Copy link

BachiMjavanadze commented Apr 27, 2024

At the moment, if we want to use the hot reload functionality, then we need to write this to the VSCode settings.json:

"files.autoSave": "afterDelay",

and run this command:

npm run serve

This functionality is well suited for those cases when we edit html or css but when we write a logic of the app, this is not the optimal option, because during the software development process there is constant and unnecessary compilation of code.

The solution to this problem could be if we write in settings.json this:

"files.autoSave": "onFocusChange",

or even this:

"files.autoSave": "off",

But it's a compromise, why compromise if you don't have to compromise?

There are two solutions; One is a button on the taskbar, how this is done in the Visual Studio IDE 2022

image

and another solution is Flutter extension for VSCode:

Flutter.demo.mp4

As you can see from the video, Flutter developers have not disabled the coolest VSCode feature:

"files.autoSave": "afterDelay"

It would be good if we combine these two methods and do this: let's write again in settings.json:

"files.autoSave": "afterDelay",

then let's create a small menu on the VSCode taskbar:

1

run the command:

npm run serve

Then if we select Hot Reload, everything happens as before: the system looks at the changes in the files and compilation occurs instantly but if we select Reaload on Click:

2

then compilation occurs only when the Ctrl+S buttons on keyboard (or triangle button on taskbar) are clicked.

So, my request is not only about Hot Reload but smooth switching between Hot Reload and Reload on Click.

@so1ve
Copy link
Member

so1ve commented Apr 28, 2024

Wrong repo?

@BachiMjavanadze
Copy link
Author

Wrong repo?

which is correct repo?

@so1ve
Copy link
Member

so1ve commented Apr 28, 2024

Do you mean the vue extension should integrate with the bundler and hot-reload when you change your code?

@BachiMjavanadze
Copy link
Author

Yes, it would be better if we got this functionality out of the box.

@codymikol
Copy link
Contributor

I think that's just added complexity for no real gain, the dev server can just watch the filesystem imo.

@BachiMjavanadze
Copy link
Author

BachiMjavanadze commented Apr 29, 2024

I think that's just added complexity

come on, bro... for Visual Studio IDE 2022 and for Flutter this does not add complexity, but for Vue it does?!

no real gain

for me as .Net developer and for my Flutter developer friend this has a gain :)

@so1ve
Copy link
Member

so1ve commented Apr 30, 2024

Honestly this "hot reload" feature is provided by your bundler, such as vite and webpack, right? All you need is to save the file and wait for it to reload.

@BachiMjavanadze
Copy link
Author

BachiMjavanadze commented Apr 30, 2024

@so1ve bro, don't you see my Flutter video example above? The Flutter developers do not disable coolest feature of VSCode:

"files.autoSave": "afterDelay"

and Vue.js developer should disable this feature and manually save and this is not safe and not comfortable... I suggest solution when you can switch between the to modes: existing behavior and new one... You need to test it to understand.

@RayGuo-ergou
Copy link
Contributor

regardless of this setting

"files.autoSave": "afterDelay"

if you config your bundle right, the hot reload is an out of box thing.

@BachiMjavanadze
Copy link
Author

BachiMjavanadze commented Apr 30, 2024

if you config your bundle right, the hot reload is an out of box thing.

first:

my request is not only about Hot reload but smooth switching between Hot reload and Reload on Click.

second:

in my vue.config.js I have:

module.exports = { devServer: { webSocketServer: false } }

and this does not reload browser ( I need to manually reload browser), but comipation still happens, it is compromise... Please give me your solution. hope I will get the experience that I described above.

@RayGuo-ergou
Copy link
Contributor

RayGuo-ergou commented Apr 30, 2024

but smooth switching between Hot reload and Reload on Click.

In vue or any frontend frame work what you want is very unlikely to be supported. You start a server for development, you have to restart the server to "switch" things.

Here's webpack reference https://webpack.js.org/configuration/watch/ since you are using webpack.

Either way, this is totally out of scope of a language server tools/extension. And to me the request is kinda weird, if you only want the page reload when hit <C-c>, just turn off auto save and only save if you want to see the changes.

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

No branches or pull requests

4 participants