Indentation script for R

Pierre de Villemereuil pierre.de.villemereuil at mailoo.org
Mon Dec 11 01:42:22 UTC 2017


Hi,

I've now tested the indent script against Kate5 and the KF5-based version of RKWard (openSUSE R project switched to that branch for dependencies reasons) and it seems to be working there (although a slightly different header is needed with the KF5 version).

What I realised however, is that the script requires the r.xml syntax file to be installed so that Kate knows about a language named R. Yet, this file is packaged with RKWard, not KatePart.

So, Thomas, regarding your suggestion to submit the script to KTextEdit, this is a problem: without the r.xml file, it's basically useless. So I'd say there is three possibilities from there:
- give up and just let people individually download the script online on my github repo
- submit both r.xml and this indent script to KTextEdit
- include this indent script to RKWard rather than KTextEdit

What do you think?

Cheers,
Pierre

On Thursday, 9 November 2017 12:39:40 NZDT Pierre de Villemereuil wrote:
> Hi,
> 
> > thanks a lot for sharing your work, and sorry for the delayed reply!
> 
> No problem.
> 
> > Personally I could never get used to automatic indentation at all, and
> > just turn it off. So I am not really qualified to test and comment.
> 
> No problem either! ;)
> 
> > By the same token, I never tried to develop an indentation script, and
> > would not be able to spot even obvious omissions. But what I can say is
> > that your script looks cleanly written. As a random nitpick, I suggest
> > merging the common portion "!lastLine.endsWith('<-')" of the two ifs
> > around line 197.
> 
> Yes, those were latest commits and not quite cleaned up... I've now changed this whole to basically two lines of code! I don't know much about Javascript but the way, so there might be huge mistakes in there (although any cases I've found where the code doesn't work are understandable corner cases, not syntax error -- for now!).
> 
> > All that said, the proper place for your script _is_ the "ktexteditor"
> > component, i.e. the component used by Kate _and_ RKWard (and many
> > others). While arguably, it will matter to RKWard, most, there are
> > also people coding R in kate, for instance. Also, more importantly, this
> > is where developers will find it, in case they need to do maintenance /
> > improvements on _all_ indentation scripts.
> 
> That would require me to test this against Kate5, but I'm yet to find the new place where these scripts are stored by Kate5 (currently, RKWard is looking into /usr/share/kde4/kateparts/, but I guess this is old news for Kate5 and the yet-to-come KF5 port of RKWard).
> 
> > If this is not too much to ask, then, I suggest you submit your work as
> > a review request on
> > https://phabricator.kde.org/differential/diff/create/, against the
> > ktexteditor repoistory. This will get the right people to look at it.
> > Consider adding "RKWard-Devel-list" in CC of your request. Should this
> > be rejected as "too specialized for ktexteditor" (I do _not_ think that
> > will happen), we'll include it in RKWard, instead.
> 
> I'll work through some remaining issues and test with Kate5 once I figured out how it works now with KF5. Then, I'll consider opening a request on Phabricator (don't you need a KDE dev account for this?).
> 
> Cheers,
> Pierre.



More information about the rkward-devel mailing list