xylo / intellij-postfix-templates

Custom Postfix Templates for Intellij IDEA
https://plugins.jetbrains.com/plugin/9862-custom-postfix-templates
Apache License 2.0
529 stars 95 forks source link

In Intranet ,Custom postfix template stop IntelliJ #202

Open lxk696 opened 3 years ago

lxk696 commented 3 years ago

In my company, computers can't access the Internet. Each time you click Settings > editor > Custom postfix template, IntelliJ will pauses for a very long time.

version :
IntelliJ : 2021.1.2 Ultimate Custom postfix template : 2.12.0.211

FFatTiger commented 2 years ago

can fix it? or something method of temporary repair

xylo commented 2 years ago

I just tried to reproduce the bug in my local network by cutting the internet connection for some time. In my case IDEA did not hang at all, but the CPT plugin could not load the web templates from the internet. So I'm not sure why IDEA hangs in your case. Are you using a proxy or any kind of firewall which takes very long until a web request is either granted or rejected? That's the only thing I can image.

For those cases I could add an option in the settings allowing you to deactivate the automatic web templates update at all. Would that be a solution?

lihaojiee commented 1 year ago

I just tried to reproduce the bug in my local network by cutting the internet connection for some time. In my case IDEA did not hang at all, but the CPT plugin could not load the web templates from the internet. So I'm not sure why IDEA hangs in your case. Are you using a proxy or any kind of firewall which takes very long until a web request is either granted or rejected? That's the only thing I can image.

For those cases I could add an option in the settings allowing you to deactivate the automatic web templates update at all. Would that be a solution?

This button is very necessary. I also encountered such a situation. At first, I thought it was a problem for IntelliJ to respond. Ten minutes later, it still failed and I had to force IntelliJ to close. This is very frustrating.

xylo commented 1 year ago

Oh, I forgot to mention that there is now an option to deactivate the automatic downloads of the web templates. It's in the settings: grafik

xylo commented 1 year ago

However, there is still room for improvement. Since usually most of the web templates do not change it's not necessary to download those. A simple header request and a check of the modification date would therefore reduce the traffic and increase the speed of the update process. I filed a new issue for this improvement under #226.

xylo commented 1 year ago

I just tried to reproduce the bug in my local network by cutting the internet connection for some time. In my case IDEA did not hang at all, but the CPT plugin could not load the web templates from the internet. So I'm not sure why IDEA hangs in your case. Are you using a proxy or any kind of firewall which takes very long until a web request is either granted or rejected? That's the only thing I can image. For those cases I could add an option in the settings allowing you to deactivate the automatic web templates update at all. Would that be a solution?

This button is very necessary. I also encountered such a situation. At first, I thought it was a problem for IntelliJ to respond. Ten minutes later, it still failed and I had to force IntelliJ to close. This is very frustrating.

However, first time users still have to wait until all web templates got updated. So the freeze problem still persists until the user was able to uncheck this check box. To avoid a freeze for minutes, I will add a timeout to the update process. Something around 5 seconds might be acceptable I think.? If the web templates did not get loaded within 5 seconds the update process is cancelled and the user should be offered to deactivate the automatic update. (#227)

lihaojiee commented 1 year ago

I just tried to reproduce the bug in my local network by cutting the internet connection for some time. In my case IDEA did not hang at all, but the CPT plugin could not load the web templates from the internet. So I'm not sure why IDEA hangs in your case. Are you using a proxy or any kind of firewall which takes very long until a web request is either granted or rejected? That's the only thing I can image. For those cases I could add an option in the settings allowing you to deactivate the automatic web templates update at all. Would that be a solution?

This button is very necessary. I also encountered such a situation. At first, I thought it was a problem for IntelliJ to respond. Ten minutes later, it still failed and I had to force IntelliJ to close. This is very frustrating.

However, first time users still have to wait until all web templates got updated. So the freeze problem still persists until the user was able to uncheck this check box. To avoid a freeze for minutes, I will add a timeout to the update process. Something around 5 seconds might be acceptable I think.? If the web templates did not get loaded within 5 seconds the update process is cancelled and the user should be offered to deactivate the automatic update. (#227)

First, it's a good solution. However, if it is possible to not update any templates by default when the plugin is loaded for the first time, and it is up to the user to decide whether to use the network template, there may be a better user experience, which can be explained in the documentation.

xylo commented 1 year ago

Well, I guess that only a few people will read the documentation before using the plugin. So far I thought the best user experience would be "install the plugin and you immediately have hundreds of useful templates at your disposal". However, since this procedure breaks the user experience for some users like you, you have a point, but I believe only a small number of users are affected by this problem. Therefore I don't want to make the problem too complicated in use, which might break the user experience for 95% of the users. On the other hand, unsolicited access to the Internet might be something that could annoy even more people than just 5%. So in this regard it would be actually nice if the users get asked if he/she wants to enable the automatic updates of the web templates. Maybe this could be done via a notification popup similar to those which tells you that new web templates have been downloaded. I like this idea. However, it requires quite some changes to the current implementation in order to keep a good user experience for most of the users. See #228 for more details.

xylo commented 1 year ago

Maybe I could reproduce the behavior with mitmproxy. :thinking: I will try that.