> On Dec 11, 2019, at 7:53 AM, Eric Bresie <ebresie...@gmail.com> wrote:
> 
> Would this be as simple as a stack with the current line indentation added 
> and then continue to peek at current and then pop off when a change of 
> indentation change may occur (i.e. end of block of code, new statement, new 
> expression, etc.)?

I think actually doing the indentation with the plugin may be more work than 
needed for this plugin. It may be simpler to just figure out what the 
indentation should be and then change the NetBeans indentation preferences to 
the values you figured out. NetBeans already has indentation code so let 
NetBeans do the work.

>>>>>> For any indentation
>>>>>> info that can not be gleaned
>>>>>> from the file, it should fall back to the preferences
> 
> Not sure what is meant here? Assume this would be on an empty file or a case 
> when no indentation is present on the line.
> 
> How is this different from current Netbeans indentation capabilities?


Yep, for a new file, it would just use the NetBeans preferences for 
indentation. But there are also "in between" cases where some information is 
available from the file being edited but some is not. For example, consider 
opening this file:


package foo;
public class Bar {
        public int wazoo;
}


There is enough Information to know that the standard indentation is 1 tab, but 
you don’t have enough information to know what the label indentation or 
continuation indentation should be. The plugin would need to fall back to the 
NetBeans prefs to "figure out" sensible values for these.

While not rocket science, this isn’t entirely straightforward because you can’t 
just copy the NetBeans prefs. Continuing the example above, if NetBeans 
specifies that the standard indentation is 2 spaces and the continuation 
indentation is also 2 spaces, you can figure out that the continuation 
indentation for this file should be one tab. If in NetBeans the continuation 
indentation was 4 spaces (twice the standard indentation), the continuation 
indentation for this file should be 2 tabs.

-Alvin

Reply via email to