Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/Handler/TextDocument/FormattingHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Phpactor\LanguageServer\Handler\TextDocument;

use Amp\CancellationToken;
use Amp\Promise;
use Phpactor\LanguageServerProtocol\FormattingOptions;
use Phpactor\LanguageServerProtocol\DocumentFormattingParams;
use Phpactor\LanguageServerProtocol\ServerCapabilities;
use Phpactor\LanguageServerProtocol\TextDocumentIdentifier;
use Phpactor\LanguageServerProtocol\TextEdit;
use Phpactor\LanguageServer\Core\Formatting\Formatter;
use Phpactor\LanguageServer\Core\Handler\CanRegisterCapabilities;
Expand Down Expand Up @@ -33,12 +33,12 @@ public function methods(): array
/**
* @return Promise<array<int,TextEdit[]>|null>
*/
public function formatting(TextDocumentIdentifier $textDocument, FormattingOptions $options): Promise
public function formatting(DocumentFormattingParams $params, CancellationToken $canellation): Promise
{
return call(function () use ($textDocument) {
return call(function () use ($params) {
$token = WorkDoneToken::generate();
yield $this->notifier->create($token);
$document = $this->workspace->get($textDocument->uri);
$document = $this->workspace->get($params->textDocument->uri);
$this->notifier->begin($token, 'Formatting document');
try {
$formatted = yield $this->formatter->format($document);
Expand Down
Loading