prettier / prettier/plugin-php
Cursor jumps to start of file after formatting javascript inside of a php file.
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 139
- PR merge metrics
- No merged PRs in 30d
Description
prettier version: 2.8.3
Prettier-PHP version: 0.19.3
Steps to reproduce the behavior:
open a .php file with html, php, and a script tag in it
go down to the script tag
save the document
your cursor will jump to the start of the document.
I'm using Sublime, so I'm using the JsPrettier plugin. Here are my JsPrettier settings:
{
"debug": true,
"auto_format_on_save": true,
"additional_cli_args": { "--config-precedence": "file-override" },
"custom_file_extensions": ["php"],
"allow_inline_formatting": true,
}
The maintainer of prettier on sublime seems to think it's because the Prettier-PHP plugin isn't following the cursor API.
Anyone else run into this issue? It's super annoying!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with a PHP file containing HTML, PHP, and a script tag using the listed Prettier and Prettier-PHP versions, then inspect the plugin's use of Prettier's formatWithCursor cursor API. Done means formatting JavaScript inside the PHP file no longer moves the cursor to the start of the document.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100