-
Notifications
You must be signed in to change notification settings - Fork 54
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
Disabling import statement collapsing #895
Comments
Then it seems more like it's a LS issue. In general, LSs are expected to be fast. The default behavior must best serve fast/good language servers. |
I am using the typescript LS that comes with wild web developer. |
A possible workaround here is to apply te folding of imports only if the response is received in the ~2 seconds after the editor gets opened. |
its for me not een the problem once after opening this is really annoying behavior that for me makes it almost impossible to really work in ts files at this moment |
In the latest LSP4E update, it's a bit worse than only after opening, I believe this is what @jcompagner was referring to - trying to type directly in the import area results in constants fold/unfold flicker, and if you're trying to type in a multi-line import, you end up with something else entirely; have demonstrated both these in the attached GIF. This was fold/unfold behavior was not an issue in |
Can the comimit that causes this not be reverted for a while. Make a release with that. Then reopen or make a new case for folding support? Because the current state is really not workable, I am forced to use VSC |
I have confirmed that the code in @jcompagner what version of the |
@sebthom , I also think that adding an UI option would be nice. Regarding the particular problem, should the behaviour not be similar to the JDT, that is, if the user uncollapses the folded region (as he would do for editing the region), the region stays uncollapsed until the user collapses it again? Also before collapsing the first time, we could also check that the cursor is not positioned in the region that will be collapsed. Would that fix your problem of constants fold/unfold flicker, @brianvfernandes? |
i have installed now: 0.18.7.202403091716 (that is what installed plugins says) but that doesn't seem to be the one that the install itself reports |
@rubenporras having it work just like JDT would be great. I can't say I've ever had to think about JDT's folding behavior, "it just worked" for me always. I don't believe it suffers from the issue where folding could occur later, it seems to open with the sections correctly folded on open itself (not sure if it's designed in this way, or it's just too fast for me to catch). This would possibly be the ideal solution, but I realize it may not be possible / viable for LSP editors. Definitely +1 to not automatically folding sections after they have been explicitly unfolded. Coming to your point about not collapsing if the cursor is within the region that will be collapsed, even if the cursor is below the region, possibly even pages below, wouldn't any folding / unfolding behavior cause the editor to "jump" or flicker as the effective line changes as a result? The original issue reported by @sebthom would remain. |
ok i did an update and now i am on 0.18.7.202404031149 that one seems a bit better, it still flickers a bit but at least as long as i am not in the import section its not that i am suddenly all over the place. (at first testing) But changing something in the import area itself, is pretty much impossible because of always collapses again at pretty much every keystroke |
actually, it looks like we are not recognizing the import section as existing, because we are only collapsing be default new regions in |
@rubenporras I won't have time to look into this in the near future as I am mostly away from keyboard the next weeks. |
@jcompagner , @brianvfernandes , would you have time to add an option so that you would be able to disable import statement collapsing? If you do not have time for the UI, you could even start with just an option that can be set in the .ini file. |
@rubenporras I'd be happy to take a look but must admit (looking at |
@brianvfernandes , the configuration option is more flexible. I think #971 should be enough to disable it by default. It does not provide an UI but the user can still enable it in the .ini file. Would you like to test it? |
I think the current path towards resolution is the wrong one. |
Yes, I agree that offering an option to disable it is not the solution to the problem reported by @jcompagner and @brianvfernandes, rather a poor man solution for them, but I have looked at the code not quite understand why it happens in the first place. I understand that it can happen once if the server is slow to answer (as you point out), but I do understand the flicker: it looks to me that the code will not collapse existing folding regions, only new ones. I do not have time to investigate further, neither anyone else, and since I think that it is nevertheless not wrong to have the option to disable it (one might dislike collapsing no anyway) we can offer it in case it is already useful instead of a real fix. I hope this explains better my reasoning for adding the configuration option. |
In my opinion, collapsing imports by default is not necessarily desirable. Whilst this is useful for languages like Java, this is not the case for JavaScript, see eclipse-wildwebdeveloper/wildwebdeveloper#1513 (comment). I don't believe IDEs like VSCode collapse by default for most languages. |
I was on a short vacation, so couldn't jump in last week, but i do agree with @PyvesB i think i don't need that folding that doesn't really bring me anything, so a preference that is default off is fine by me |
I'm experiencing the same problem using WildWebDeveloper in an Angular Project. Is there any workaround yet ? This is really annoying. |
While I prefer to have imports folded by default, I'm fine with LSP4E obeying the most consensual request here and just skip default import folding. |
Is there any configuration I can do to disable this in order to avoid the problem ? |
@nelson777 , if you just want it disabled, you can upgrade to the release done two days ago. Regards |
@sebthom , I leave the issue open because the UI option is still lacking. |
With #818 import statements are collapsed automatically. However since this is an async operation, it happens with a certain delay depending on how fast your LS starts/responds.
This means the moment you open a file imports are not yet collapsed. Then you start working on the source code and suddenly auto collapsing kicks in and rearranges the lines in the editor - this is very irritating.
I therefore suggest to disable auto folding by default and add a UI option to enable it.
The text was updated successfully, but these errors were encountered: