You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/07/28 20:53:48 UTC
[GitHub] [netbeans] Chris2011 opened a new pull request, #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Chris2011 opened a new pull request, #4448:
URL: https://github.com/apache/netbeans/pull/4448
The motivation about this was to implement those missing folding blocks in java editor. This was just implemented for imports, classes, inner classes, methods but not for stuff inside methods like if/else if/else, try/catch and loops because all of them are treated like as code blocks.
Please bare with me and my knowledge of the stuff. Unfortunately I dunno why the if statement was implemented, that I removed from JavaElementFoldVisitor but this prevents it from adding folding rectangle to those blocks. This is the only line that I need to change in general but, now I changed the method code block to general code-blocks because now it is not only for methods anymore.
Before:
<img width="686" alt="image" src="https://user-images.githubusercontent.com/795658/181634976-87444df2-b598-417b-8b2a-99858e48fb4c.png">
After:
<img width="720" alt="image" src="https://user-images.githubusercontent.com/795658/181635432-5d2c7d91-59bd-47e3-828b-ea46999c17a5.png">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#issuecomment-1295341454
So everything is back green. @sdedic can you please have a look again :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1026970605
##########
java/java.editor.lib/src/org/netbeans/editor/ext/java/JavaFoldManager.java:
##########
@@ -43,6 +43,8 @@ public abstract class JavaFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = JavaElementFoldManager.JAVADOC_FOLD_TYPE;
public static final FoldType CODE_BLOCK_FOLD_TYPE = JavaElementFoldManager.CODE_BLOCK_FOLD_TYPE;
Review Comment:
Is there anything what I can do more? Honestly I don't want to decide, because I don't know how much developers are still using the old java.editor.lib but I mean as I mentioned before, it is deprecated. So I don't see a problem there to change this and to make an help article or smth else to show them the alternative when they want to update. Just my 2 cents.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien commented on pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
mbien commented on PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#issuecomment-1304902488
lets wait for #4931 before merging this. Since this PR enables the tests of `java.editor`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] dbalek commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
dbalek commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1019251585
##########
java/java.editor.lib/src/org/netbeans/editor/ext/java/JavaFoldManager.java:
##########
@@ -43,6 +43,8 @@ public abstract class JavaFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = JavaElementFoldManager.JAVADOC_FOLD_TYPE;
public static final FoldType CODE_BLOCK_FOLD_TYPE = JavaElementFoldManager.CODE_BLOCK_FOLD_TYPE;
Review Comment:
Not sure what is better - to preserve the backward semantic compatibility and potentially cause a confusion from non intuitive names or otherwise.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1027285887
##########
java/java.editor.lib/src/org/netbeans/editor/ext/java/JavaFoldManager.java:
##########
@@ -43,6 +43,8 @@ public abstract class JavaFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = JavaElementFoldManager.JAVADOC_FOLD_TYPE;
public static final FoldType CODE_BLOCK_FOLD_TYPE = JavaElementFoldManager.CODE_BLOCK_FOLD_TYPE;
Review Comment:
So I understand your point of backward compatibilty. For me I just want to know exactly, what I need to do to get this PR merged. As far as I understand you correct, I need to change some code to map some behavior from the generic code_block_fold_type to the more specific method_block_fold_type, didn't I do this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1019366868
##########
java/java.editor.lib/src/org/netbeans/editor/ext/java/JavaFoldManager.java:
##########
@@ -43,6 +43,8 @@ public abstract class JavaFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = JavaElementFoldManager.JAVADOC_FOLD_TYPE;
public static final FoldType CODE_BLOCK_FOLD_TYPE = JavaElementFoldManager.CODE_BLOCK_FOLD_TYPE;
Review Comment:
Ok, I understand the concerns. Do we have some numbers how many people are still using java.editor.lib? I mean isn't it correct to remove deprecated stuff after years of new releases? Since when is the java.editor.lib deprecated?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1027149107
##########
java/java.editor.lib/src/org/netbeans/editor/ext/java/JavaFoldManager.java:
##########
@@ -43,6 +43,8 @@ public abstract class JavaFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = JavaElementFoldManager.JAVADOC_FOLD_TYPE;
public static final FoldType CODE_BLOCK_FOLD_TYPE = JavaElementFoldManager.CODE_BLOCK_FOLD_TYPE;
Review Comment:
@Chris2011 - even though APIs get deprecated, I don't remember a situation when an API was actually *dropped*, breaking backward compatibility - at least not in such (semantically) 'central' module as java editor. In the past some APIs were broken (see that many modules have /1 or /2 suffixes, which indicates a breaking change), but even during "headless split" (cca NetBeans 8.2) we did not actually drop APIs: see the `*.compat` modules that contain compatibility layer for old applications. Sadly the (deprecated) `java.editor.lib` is such official API with 'forever' commitment.
But I have made a mistake in my reasoning ! If I suppose that an ancient unmantained and useful module still uses the old `editor.lib` APIs, it won't ship that library. So if we leave the (deprecated, misnamed) `JavaFoldManager.CODE_BLOCK_FOLD_TYPE` and relay it to the new, proper-named (but nonpublic) JavaElementFoldManager.METHOD_BLOCK_FOLD_TYPE. So the ancient client links to the misnamed symbol - but from a 'new version of deprecated `java.editor.lib`, thus getting the fold still labeled "method". No semantic change, no settings change. And NB codebase can now use properly named `CODE_BLOCK` and `METHOD_BLOCK`. Old code lives with past sins, new code uses proper names and even can correctly read the old settings !
Re FoldCreator: the `createCodeBlockFold` seems to be also now called for initializers and static initializers: we should preserve the fold behaviour here IMHO - that an initializer's fold is controlled by method's settings - but then `createMethodFold` would be awkward for an initializer - wouldn't it ? BTW - isn't there a typo ? The other `FoldCreator` methods use singular nouns but `createMethodsFold` uses plural.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#issuecomment-1291693033
Ok, I see the failing build is related to my code changes. Will try to fix them first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien commented on pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
mbien commented on PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#issuecomment-1382712027
@Chris2011 would be good to rebase this PR so we get a fresh CI run on the new config.
Should we move this to NB18? what do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] mbien commented on pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
mbien commented on PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#issuecomment-1200152769
wanted to suggest to add a test case for it but the code folding tests don't work anyway and probably haven't been run for a long time, so I suppose its fine ;)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1027149107
##########
java/java.editor.lib/src/org/netbeans/editor/ext/java/JavaFoldManager.java:
##########
@@ -43,6 +43,8 @@ public abstract class JavaFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = JavaElementFoldManager.JAVADOC_FOLD_TYPE;
public static final FoldType CODE_BLOCK_FOLD_TYPE = JavaElementFoldManager.CODE_BLOCK_FOLD_TYPE;
Review Comment:
@Chris2011 - even though APIs get deprecated, I don't remember a situation when an API was actually *dropped*, breaking backward compatibility - at least not in such (semantically) 'central' module as java editor. In the past some APIs were broken (see that many modules have /1 or /2 suffixes, which indicates a breaking change), but even during "headless split" (cca NetBeans 8.2) we did not actually drop APIs: see the `*.compat` modules that contain compatibility layer for old applications. Sadly the (deprecated) `java.editor.lib` is such official API with 'forever' commitment.
But I have made a mistake in my reasoning ! If I suppose that an ancient unmantained and useful module still uses the old `editor.lib` APIs, it won't ship that library. So if we leave the (deprecated, misnamed) `JavaFoldManager.CODE_BLOCK_FOLD_TYPE` and relay it to the new, proper-named (but nonpublic) JavaElementFoldManager.METHOD_BLOCK_FOLD_TYPE. So the ancient client links to the misnamed symbol - but from a 'new version of deprecated java.editor.lib`, thus getting the fold still labeled "method". No semantic change, no settings change. And NB codebase can now use properly named `CODE_BLOCK` and `METHOD_BLOCK`. Old code lives with past sins, new code uses proper names and even can correctly read the old settings !
Re FoldCreator: the 'createCodeBlockFold` seems to be also now called for initializers and static initializers: we should preserve the fold behaviour here IMHO - that an initializer's fold is controlled by method's settings - but then `createMethodFold` would be awkward for an initializer - wouldn't it ? BTW - isn't there a typo ? The other `FoldCreator` methods use singular nouns but `createMethodsFold` uses plural.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1019221823
##########
java/java.editor.lib/src/org/netbeans/editor/ext/java/JavaFoldManager.java:
##########
@@ -43,6 +43,8 @@ public abstract class JavaFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = JavaElementFoldManager.JAVADOC_FOLD_TYPE;
public static final FoldType CODE_BLOCK_FOLD_TYPE = JavaElementFoldManager.CODE_BLOCK_FOLD_TYPE;
Review Comment:
Maybe I did not express the concerns well: The point here is that before the change the user of `JavaFoldManager.CODE_BLOCK_FOLD_TYPE` gets a `FoldType` instance whose `code() == "method"`. That affects e.g. what setting controls the fold type's default expansion state. The user may have `fold.method.defaultCollapsed=true` (just example name) in his settings.
Now with this PR mergd, that unchanged fold producing code that link to `JavaFoldManager.CODE_BLOCK_FOLD_TYPE` will start to receive a `FoldType` with 'code() == "code-block"` ... which means the saved settings won't have suddenly the same effects.
By changing the (potentially) shared definition of `CODE_BLOCK_FOLD_TYPE`, we're breaking settings / semantic compatibility. Yes, it's very frustrating, as a constant named CODE_ was misused for actually method level folds...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1018406752
##########
java/java.editor/src/org/netbeans/modules/java/editor/fold/JavaElementFoldManager.java:
##########
@@ -273,6 +277,11 @@ public FoldInfo createInnerClassFold(int start, int end) {
return FoldInfo.range(start, end, INNERCLASS_TYPE);
}
+ @Override
+ public FoldInfo createMethodsFold(int start, int end) {
Review Comment:
I already thought about this. I mean a method is also a code block as you said. But yeah at the end I'm fine with this and not to add for really each case a method to have also an option for if, for for, etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by "Chris2011 (via GitHub)" <gi...@apache.org>.
Chris2011 commented on PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#issuecomment-1537161361
Hey @sdedic for now I hope that I understood what you mean so I changed the mapping in the deprecated Java Editor Lib to the method block and hope that this is what you requested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by "Chris2011 (via GitHub)" <gi...@apache.org>.
Chris2011 commented on PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#issuecomment-1537219485
To test the old implementation, if necessary, do anyone know an old Platform Application, using the old Java Editor Lib to test my stuff?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1017547161
##########
java/java.editor/src/org/netbeans/modules/java/editor/fold/JavaElementFoldManager.java:
##########
@@ -76,7 +76,11 @@ public class JavaElementFoldManager implements FoldManager {
new org.netbeans.api.editor.fold.FoldTemplate(3, 2, "/**...*/")); // NOI18N
@NbBundle.Messages("FoldType_Methods=Methods")
- public static final FoldType CODE_BLOCK_FOLD_TYPE = FoldType.MEMBER.derive("method", Bundle.FoldType_Methods(),
+ public static final FoldType METHOD_BLOCK_FOLD_TYPE = FoldType.MEMBER.derive("method", Bundle.FoldType_Methods(),
+ new org.netbeans.api.editor.fold.FoldTemplate(1, 1, "{...}")); // NOI18N
+
+ @NbBundle.Messages("FoldType_CodeBlocks=Code Blocks")
Review Comment:
Please also change the reference in `java.editor.lib` - class `org.netbeans.editor.ext.java.JavaFoldManager`. This is a deprecated support for ancient modules that reference symbolically `CODE_BLOCK_FOLD_TYPE` (uses implementation dependency on `java.editor`) - otherwise the old modules would change their folding semantics.
##########
java/java.editor/src/org/netbeans/modules/java/editor/fold/JavaElementFoldManager.java:
##########
@@ -273,6 +277,11 @@ public FoldInfo createInnerClassFold(int start, int end) {
return FoldInfo.range(start, end, INNERCLASS_TYPE);
}
+ @Override
+ public FoldInfo createMethodsFold(int start, int end) {
Review Comment:
I know that it may be awkward - given the 'createCodeBlockFold` really does not describe 'method-level' folds well (although it has been its purpose) -- but since there are known implementation dependencies, maybe the `Creator`'s method could rremain as it is - and the **real** code blocks could get a new name ?
cc @dbalek -- what's your opinion ? Impl dependencies usually do not deserve any compatibility attention (especially if this PR refactors all known ones in the codebase), but still - this support incl. the misnamed code block (both constant and the Creator method) is used for long time by plugins.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r934335074
##########
java/java.editor/src/org/netbeans/modules/java/editor/fold/JavaElementFoldManager.java:
##########
@@ -75,8 +75,8 @@ public class JavaElementFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = FoldType.DOCUMENTATION.derive("javadoc", Bundle.FoldType_Javadoc(),
new org.netbeans.api.editor.fold.FoldTemplate(3, 2, "/**...*/")); // NOI18N
- @NbBundle.Messages("FoldType_Methods=Methods")
- public static final FoldType CODE_BLOCK_FOLD_TYPE = FoldType.MEMBER.derive("method", Bundle.FoldType_Methods(),
Review Comment:
You are completly right, I thought so too. I will change this to Draft and will work on it further. Thx.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r934034526
##########
java/java.editor/src/org/netbeans/modules/java/editor/fold/JavaElementFoldManager.java:
##########
@@ -75,8 +75,8 @@ public class JavaElementFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = FoldType.DOCUMENTATION.derive("javadoc", Bundle.FoldType_Javadoc(),
new org.netbeans.api.editor.fold.FoldTemplate(3, 2, "/**...*/")); // NOI18N
- @NbBundle.Messages("FoldType_Methods=Methods")
- public static final FoldType CODE_BLOCK_FOLD_TYPE = FoldType.MEMBER.derive("method", Bundle.FoldType_Methods(),
Review Comment:
Please do not **rename** an existing fold type -- this will break user settings. Instead, add an additional FoldType - derive from nothing or FoldType.CODE_BLOCK.
Then adjust the code to use the new fold type for blocks, fors, ...
Such setup allows the user to control inner code folds and method-level folds separately, i.e. if one sets methods to be collapsed by default, the code blocks won't be initially collapsed when the user expands a method element.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1018400958
##########
java/java.editor/src/org/netbeans/modules/java/editor/fold/JavaElementFoldManager.java:
##########
@@ -76,7 +76,11 @@ public class JavaElementFoldManager implements FoldManager {
new org.netbeans.api.editor.fold.FoldTemplate(3, 2, "/**...*/")); // NOI18N
@NbBundle.Messages("FoldType_Methods=Methods")
- public static final FoldType CODE_BLOCK_FOLD_TYPE = FoldType.MEMBER.derive("method", Bundle.FoldType_Methods(),
+ public static final FoldType METHOD_BLOCK_FOLD_TYPE = FoldType.MEMBER.derive("method", Bundle.FoldType_Methods(),
+ new org.netbeans.api.editor.fold.FoldTemplate(1, 1, "{...}")); // NOI18N
+
+ @NbBundle.Messages("FoldType_CodeBlocks=Code Blocks")
Review Comment:
I added it as requested. Hope this was the right and only place where I need to add it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1004981222
##########
java/java.editor/src/org/netbeans/modules/java/editor/fold/JavaElementFoldManager.java:
##########
@@ -75,8 +75,8 @@ public class JavaElementFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = FoldType.DOCUMENTATION.derive("javadoc", Bundle.FoldType_Javadoc(),
new org.netbeans.api.editor.fold.FoldTemplate(3, 2, "/**...*/")); // NOI18N
- @NbBundle.Messages("FoldType_Methods=Methods")
- public static final FoldType CODE_BLOCK_FOLD_TYPE = FoldType.MEMBER.derive("method", Bundle.FoldType_Methods(),
Review Comment:
Here is what I did:
* Fixed the visitBlock method and add check for ignoring method because visitMethod is already available
* Change code for visitMethod similar to visitClass but just for methodfolding
* Introduce new option for code block
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#issuecomment-1304912690
Sure, thx for the info.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 merged pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by "Chris2011 (via GitHub)" <gi...@apache.org>.
Chris2011 merged PR #4448:
URL: https://github.com/apache/netbeans/pull/4448
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on a diff in pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by "Chris2011 (via GitHub)" <gi...@apache.org>.
Chris2011 commented on code in PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#discussion_r1186915046
##########
java/java.editor.lib/src/org/netbeans/editor/ext/java/JavaFoldManager.java:
##########
@@ -43,6 +43,8 @@ public abstract class JavaFoldManager implements FoldManager {
public static final FoldType JAVADOC_FOLD_TYPE = JavaElementFoldManager.JAVADOC_FOLD_TYPE;
public static final FoldType CODE_BLOCK_FOLD_TYPE = JavaElementFoldManager.CODE_BLOCK_FOLD_TYPE;
Review Comment:
@sdedic hopefully resolved.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] Chris2011 commented on pull request #4448: #4447 - Fix missing code folding blocks in java editor for conditions, loops and try/catch
Posted by GitBox <gi...@apache.org>.
Chris2011 commented on PR #4448:
URL: https://github.com/apache/netbeans/pull/4448#issuecomment-1383137578
> @Chris2011 would be good to rebase this PR so we get a fresh CI run on the new config.
>
> Should we move this to NB18? what do you think?
We can move this to NB18, but I'm still waiting for feedback what I should do now. I dunno whether I still should change smth or we need to have a discussion about this. I dunno unfortunately.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists