-
Notifications
You must be signed in to change notification settings - Fork 185
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
formatDocument #8
Comments
Method 'textDocument/formatting' needs as response TextEdit array. PHPParser's pretty printer returns always formatted string and simplest solution is to create one TextEdit to replace whole document. If you don't plan to implement it in near future I can try to do this :) or maybe you have different idea how utilize PHPParser. |
Yes, I think that is the easiest solution. We currently also sync all textdocuments with full content, it doesn't seem to have significant perf impact, but it reduces complexity. We can adjust the implementation later. Using PHPParser is of course not required for this, we could look at other formatting tools for PHP. But we already have the AST, so it is easier to just use the formatter, and the pretty printer comes included. I'm super short on free time atm so yeah I would be more than happy if you implement it :) |
I was looking for alternative but I didn't found anything actively developed/maintained. For now PHPParser's pretty printer is easy to use but is not customizable. I think it will be easy to replace it with different formatting library if something will came up in the future. |
We could customize it by subclassing it. Or doing a PR to support some options :) |
It can use the PHPParser's pretty printer
The text was updated successfully, but these errors were encountered: