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.)?

> > > > > 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?

Eric Bresie
[email protected]
> On December 10, 2019 at 1:12:12 PM CST, Laszlo Kishalmi 
> <[email protected]> wrote:
>
> On 12/10/19 11:08 AM, Laszlo Kishalmi wrote:
> > Well I'd:
> >
> > 1. convert tab to spaces (however I hope no one using tabs by now)
> > 2. Create a histogram from the leading spaces
> > 3. Start some division test.
> > Let say we test with indent: IND
> > for each all leading space number in the histogram with IND then
> > multiple the remainder with the number of lines which that leading
> > space is used that would be DEV
> > summarize of these DEV values (deviations)
> >
> > The deviation for IND=1 shall be 0. Start to increase IND, the largest
> > number while IND is 0 the indent of the file.
> Actually do not just increase the IND but test a few like 2-8 spaces and
> where the max IND which below that threshold would be the detected
> indenting.
> >
> >
> > For miss formatted files you might allow a threshold somewhat above 0
> > as well. This threshold could be a function of the number of lines in
> > the file.
> >
> > On 12/10/19 10:50 AM, Emilian Bold wrote:
> > > Well, this is some original idea! If somebody needs help with such a
> > > thing, I would do it just to learn.
> > >
> > > But honestly for an existing file I believe you could detect the
> > > indentation style just looking at the AST. Heuristics would work imho.
> > > But, of course, a neural network would be the cool way of solving it.
> > >
> > > --emi
> > >
> > > On Tue, Dec 10, 2019 at 8:44 PM Siddhesh Rane
> > > <[email protected]> wrote:
> > > > Glad to see someone interested in this feature.
> > > > A long time ago I came across a blog post[1] by Andrej Karpathy (AI
> > > > guru) in which a neural network was trained on variety of text
> > > > datasets and then used as a content generator. When trained on Linux
> > > > and Apache source code, the generator could reproduce pseudo code,
> > > > that was not valid code, but was very well formatted. It was quite
> > > > cool to see the network had learned several things, indentation
> > > > being one of them. Do check out the Source Code section of the blog
> > > > to know what I am talking about.
> > > >
> > > > The most straightforward way I see to do this is some frequency
> > > > model of a predefined set of indentation rules.
> > > > But if anyone is interested to create a small fast neural network
> > > > with limited features, it would be great to see the possibilities.
> > > >
> > > > +1 for this.
> > > >
> > > > Regards
> > > > Siddhesh
> > > >
> > > > [1] http://karpathy.github.io/2015/05/21/rnn-effectiveness/
> > > >
> > > > December 10, 2019 11:16 PM, "Alvin Thompson"
> > > > <[email protected]> wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > Assuming that this email doesn't get flagged as spam due to the
> > > > > subject line, this is just a
> > > > > reminder that I have a bounty for anyone who creates a NetBeans
> > > > > plugin that detects and uses the
> > > > > existing indentation of the file being edited. For any indentation
> > > > > info that can not be gleaned
> > > > > from the file, it should fall back to the preferences. This really
> > > > > is an absolute must team work
> > > > > these days.
> > > > >
> > > > > You get $100 for coming up with the plugin, and another $100 if it
> > > > > gets donated and makes it into
> > > > > NetBeans itself. But I imagine most people will want to do this so
> > > > > that I have a slightly higher
> > > > > opinion of them.
> > > > >
> > > > > I would do this myself but I am very, very lazy.
> > > > >
> > > > > That is all,
> > > > > Alvin
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [email protected]
> > > > > For additional commands, e-mail: [email protected]
> > > > >
> > > > > For further information about the NetBeans mailing lists, visit:
> > > > > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [email protected]
> > > > For additional commands, e-mail: [email protected]
> > > >
> > > > For further information about the NetBeans mailing lists, visit:
> > > > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> > > >
> > > >
> > > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > > For further information about the NetBeans mailing lists, visit:
> > > https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> > >
> > >
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>
>

Reply via email to