Code Monkey home page Code Monkey logo

Comments (8)

scottchiefbaker avatar scottchiefbaker commented on May 30, 2024

I should also note that you can also have an array like:

$foo = ['one','two','three'];

from splitjoin.vim.

AndrewRadev avatar AndrewRadev commented on May 30, 2024

As I mentioned in a different issue, I don't really know perl, so it would have been very useful to have an example of how they would be split. I made a guess that it would look like this:

my @var = ['one', 'two', 'three'];
my @var = [
  'one',
  'two',
  'three'
];

But, for instance, the word-list example, qw(one two three) doesn't indent nicely that way. Note that I usually just use the standard filetype's indentation unless there's a very good reason not to (for instance, whitespace-sensitive languages like python or coffeescript).

The code is in the perl-lists branch. Could you check it out and let me know if it looks good to you?

from splitjoin.vim.

AndrewRadev avatar AndrewRadev commented on May 30, 2024

As a side note, I also want to point out that I disagree with the title of the issue. Perl support for lists is not "broken", it simply doesn't exist :). Phrasing it this way implies that this is a bug request to "fix" perl support. Actually, it's a feature request.

Which is still fine, but, as a developer, you'll agree that naming things with their right names is important. I hope I'm not being too nitpicky, but next time, please try to word the issue a bit better :).

from splitjoin.vim.

AndrewRadev avatar AndrewRadev commented on May 30, 2024

Did you have time to try out the arrays? I'm considering just merging the logic to master, but I'm still not 100% sure I've got it right :).

from splitjoin.vim.

scottchiefbaker avatar scottchiefbaker commented on May 30, 2024

I'm sorry, somehow I missed this message. I just checked out the code and it looks perfect. In fact, it does MORE than I was expecting, this should work great.

One small complaint, in examples/test.pl line #20, the qw() example does not indent the items after the split. All the other examples indent the items except for that one.

Otherwise I'm more than pleased with this. Great work!

from splitjoin.vim.

AndrewRadev avatar AndrewRadev commented on May 30, 2024

I just checked out the code and it looks perfect. In fact, it does MORE than I was expecting, this should work great.

Awesome :)

the qw() example does not indent the items after the split.

The problem with qw() is that it's just not handled by the default indentation. Splitjoin leaves the indentation to the built-in = operation. Sometimes, I make an exception, mostly for indent-based languages like coffeescript or python, but I don't think I should do this for perl -- if the built-in indent doesn't take care of it, I don't think I should override it.

You could open an issue on the vim-perl project: https://github.com/vim-perl/vim-perl. From what I see, the qw() problem is in a TODO item in the indent file, so they're probably aware, but giving them a request may push them to implement it sooner rather than later.

from splitjoin.vim.

scottchiefbaker avatar scottchiefbaker commented on May 30, 2024

Did this fix land in master?

from splitjoin.vim.

AndrewRadev avatar AndrewRadev commented on May 30, 2024

Oops. Sorry about that, forgot to merge :). Should be in master now.

from splitjoin.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.