Git Product home page Git Product logo

Comments (4)

mniewrzal avatar mniewrzal commented on September 17, 2024

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.

from php-language-server.

felixfbecker avatar felixfbecker commented on September 17, 2024

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 :)

from php-language-server.

mniewrzal avatar mniewrzal commented on September 17, 2024

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.

from php-language-server.

felixfbecker avatar felixfbecker commented on September 17, 2024

We could customize it by subclassing it. Or doing a PR to support some options :)
But I would like to get basic features out as quick as possible, customization can be added later.

from php-language-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.