Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline strings break indentation #60

Closed
LaserMoai opened this issue Sep 23, 2017 · 4 comments
Closed

Multiline strings break indentation #60

LaserMoai opened this issue Sep 23, 2017 · 4 comments
Assignees

Comments

@LaserMoai
Copy link

LaserMoai commented Sep 23, 2017

The last line there doesn't get indented properly.

<?php
if ($v) {
        echo "
";
echo "";

Version 1.62

@2072
Copy link
Owner

2072 commented Sep 24, 2017

I'm unable to reproduce this issue.

Could you install the new 1.63 version and try again?

With 1.63 version you can type the following command to check if the indent script was indeed loaded:

:echo GetPhpIndentVersion()

this should print 1.63

@2072
Copy link
Owner

2072 commented Sep 24, 2017

I was able to reproduce a similar problem but you should check issue #47 as this is related. I'll fix it when I'll have some time but you really should be using heredoc notation instead of multi-line strings...

@LaserMoai
Copy link
Author

I'm just following examples from "PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide."

@h3xx
Copy link

h3xx commented Jan 29, 2018

Can confirm.

Given the following file:

<?php

class Foo
    public function bar() {
        $foo = "
";
    }
}

Pressing Enter in insert mode after the ; on the "; line puts the insertion point TWO sw to the left of where it should be. I would expect it to be aligned with the $ in the $foo line.

Oddly enough:

  • entering a new one-line statement on the line after the "; then pressing == indents the line correctly.
  • pressing cc on an empty line after the "; results in the insertion point being set correctly.

A related issue:

Given the following file:

<?php

class Foo
    public function bar() {
        $foo = "
";
$baz = "bar";
    }
}
  • Pressing =ap in command mode when the cursor is on any point in the class NOT indent the $baz line correctly.
  • But pressing == on the $baz line indents it correctly.

Expected indenting in this case would be to align the $ of the $baz line to the $ in the $foo line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants