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

Support for Editor: Format On Save Mode when set to modifications or modificationsIfAvailable #3096

Open
Andrii-Antoniuk opened this issue Oct 21, 2024 · 2 comments

Comments

@Andrii-Antoniuk
Copy link

Feature description or problem with existing feature
The formatter to work as expected on save if the mode is set to modifications or modificationsIfAvailable

Additional context
Example file:

It's expected that __construct method will be formatted and fixed, since it's part of the modification.

<?php

namespace BKGroup\CheckoutRemarks\Observer;

use Magento\Framework\App\ResourceConnection;

class SaveRemarksToOrder implements \Magento\Framework\Event\ObserverInterface
{
    public function __construct(
        private ResourceConnection $resourceConnection
    ) {


        
    }

    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        /** @var string $data */
        $order = $observer->getData('order');
        $quote = $observer->getData('quote');
        $quoteId = $quote->getId();

        $connection = $this->resourceConnection->getConnection();
        $tableName = $this->resourceConnection->getTableName('order_remarks');

        $data = [
            'quote_id' => $quoteId,
            'order_id' => $order->getEntityId(),
        ];

        $connection->insertOnDuplicate($tableName, $data);
    }
}

image

@bmewburn
Copy link
Owner

bmewburn commented Oct 21, 2024

Is the file under source control? I think that is a requirement for this in VSCode. Intelephense has no understanding of format modes, it provides a document and range format provider, it is up to the editor to call these providers.

@Andrii-Antoniuk
Copy link
Author

Yes, it is.

I will check with other languages and resolve this issue if it's a vscode problem

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

No branches or pull requests

2 participants