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

fix: respec special characters inside string #57

Closed
wants to merge 1 commit into from
Closed

fix: respec special characters inside string #57

wants to merge 1 commit into from

Conversation

alexander-akait
Copy link
Member

@alexander-akait alexander-akait commented Feb 19, 2018

Fixes #29

Why parse by default don't escape special characters 😕

@mgrip
Copy link
Contributor

mgrip commented Feb 19, 2018

Awesome! @evilebottnawi do you think its worth opening an issue on the parser repo? Not sure if this is something that should eventually be changed there or not

@alexander-akait
Copy link
Member Author

@mgrip looks on other parsers https://astexplorer.net/#/gist/070b3c0b39f0af268d909e3ba9efa2a3/2ba4c9d3ab6b3e3cf31f6148a28966c638948790
They always have value and rawValue for this

@alexander-akait
Copy link
Member Author

@mgrip i am not familiar with php-parser maybe some option(s) missed?

@mgrip
Copy link
Contributor

mgrip commented Feb 19, 2018

Ah got it, that makes sense. In that case I think it just makes sense to do this here

@mgrip mgrip self-requested a review February 19, 2018 17:54
Copy link
Contributor

@mgrip mgrip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome!

@@ -11,6 +11,20 @@ const indent = docBuilders.indent;
const hardline = docBuilders.hardline;
const softline = docBuilders.softline;

const makeString = util.makeString;

function stringEscape(str) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you just add a comment explaining why we need to do this? 🙏

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgrip I think I will first create the problem in php parser, let's wait answer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to push this just with a comment w/ a link to the issue in the parser repo that works for me - that way we dont have to wait for it to get fixed on their end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgrip I think we will do this if we do not receive an answer at the earliest acceptable time

@alexander-akait
Copy link
Member Author

Ref: glayzzle/php-parser#116

@alexander-akait
Copy link
Member Author

/cc @mgrip @czosel
I suggest you such a strategy:

  1. If parser have problem.
  2. Determine whether it is possible to solve it at the level of parser/printer inside plugin
  3. If yes - add solution with @Todo comments with reference on issue in php-parser, If no - sorry

This will allow you to adapt the prettier in the early stages to understand where improvements are possible, at this time this and inline problem don't adapt prettier on popular code bases.

@mgrip
Copy link
Contributor

mgrip commented Feb 26, 2018

Def agree. I think we've pretty much been doing this already for the most part but I think it makes sense to formalize a plan going forward

@mgrip
Copy link
Contributor

mgrip commented Feb 26, 2018

@evilebottnawi does that mean you're going to get this ready to deploy, to workaround the parser? I think in terms of outstanding issues this is one of the most glaring breaking issues

@alexander-akait
Copy link
Member Author

@mgrip I do not quite understand, i want just add in util some function with workaround parser problem, today i am do this and we will review this 👍

@mgrip
Copy link
Contributor

mgrip commented Feb 27, 2018

Yup, sounds good! I was just voicing my desire to get a fix deployed for this, if not in the parser then a work-around on our end 😄

@alexander-akait
Copy link
Member Author

Close in favor #136

@alexander-akait alexander-akait deleted the issue-29 branch March 1, 2018 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants