prettier / prettier/plugin-php

Cursor jumps to start of file after formatting javascript inside of a php file.

未关闭
#2,148 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
PHP
星标
1.9k
派生
139
PR 合并指标
30 天内没有已合并 PR

描述

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!

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用列出的 Prettier 和 Prettier-PHP 版本,通过包含 HTML、PHP 和 script 标签的 PHP 文件复现该问题,然后检查插件对 Prettier 的 formatWithCursor 光标 API 的使用情况。当格式化 PHP 文件中的 JavaScript 不再将光标移动到文档开头时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, php
领域
tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。