plugin-php icon indicating copy to clipboard operation
plugin-php copied to clipboard

___PSEUDO_INLINE_PLACEHOLDER___ added to EOD string

Open myieye opened this issue 2 years ago • 2 comments

Prettier 2.7.1

PHP Plugin 0.19.1

# Options (if any):
printWidth: 120

Input:

    const liftDataWithInlineRanges = <<<EOD
<?xml version="1.0" encoding="UTF-8" ?>
<?oxygen RNGSchema="lift.rng" type="xml"?>
<?blueprint schema="lift.rng"?>

<lift version="0.13" producer="LexiquePro.3.6">
...

Output:

    const liftDataWithInlineRanges = <<<EOD
<?xml version="1.0" encoding="UTF-8" ?>
___PSEUDO_INLINE_PLACEHOLDER___<?oxygen RNGSchema="lift.rng" type="xml"?>
___PSEUDO_INLINE_PLACEHOLDER___<?blueprint schema="lift.rng"?>

<lift version="0.13" producer="LexiquePro.3.6">
...

Expected behavior: No ___PSEUDO_INLINE_PLACEHOLDER___ strings getting added to the output.

Original code: https://github.com/sillsdev/web-languageforge/blob/e32600219a99030914cad7d4a9a430058800a4ea/test/php/model/languageforge/lexicon/Import/LiftImportTest.php#L1623

myieye avatar Oct 17 '22 12:10 myieye

It looks like it was designed to handle some cases where inline or short tags have only a newline between them:

https://github.com/prettier/plugin-php/blob/9917045bab9723056a813879eb75dc092bb6f33b/src/parser.js#L11-L12

I don't know why it's leaking into your heredoc though, or the best way to remove it.

cseufert avatar Oct 18 '22 04:10 cseufert

My current workaround was to add a space ( ) at the beginning of the two problematic lines.

myieye avatar Oct 18 '22 10:10 myieye