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

特定の構文で括弧を使うとprettier-ignoreで一部が消える #4

Open
uzmoi opened this issue Aug 14, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@uzmoi
Copy link
Owner

uzmoi commented Aug 14, 2024

postfixの構文(call, prop, index)のパーサーがtargetの分を含まないようにloc.startを偽っているせい。
locStartで差し替えれば良さそう。

@uzmoi uzmoi added the bug Something isn't working label Aug 14, 2024
@uzmoi uzmoi changed the title locで嘘をついているノードにprettier-ignoreすると嘘をついた分が消える 特定のノードにprettier-ignoreすると一部が消える Aug 14, 2024
@uzmoi uzmoi closed this as completed in 9213545 Aug 17, 2024
@uzmoi
Copy link
Owner Author

uzmoi commented Aug 17, 2024

二点考慮漏れで直ってなかった。
一つは二項演算子の糖衣構文で、これは.args[0]を読めばいい。
二つ目が厄介で、今みたいに子要素の位置を読んでると、括弧が含まれない。

// prettier-ignore
(1 + 2) * 3

こういうコードを入れると、1の左の括弧のみ消える。

@uzmoi uzmoi reopened this Aug 17, 2024
uzmoi added a commit that referenced this issue Aug 17, 2024
括弧には対応できないが取り敢えず。
@uzmoi uzmoi changed the title 特定のノードにprettier-ignoreすると一部が消える 特定の構文で括弧を使うとprettier-ignoreで一部が消える Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant