diff --git a/lib/Handler/TextDocument/FormattingHandler.php b/lib/Handler/TextDocument/FormattingHandler.php index e50ef90..fd61c30 100644 --- a/lib/Handler/TextDocument/FormattingHandler.php +++ b/lib/Handler/TextDocument/FormattingHandler.php @@ -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; @@ -33,12 +33,12 @@ public function methods(): array /** * @return Promise|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);