Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/Capability/CapabilityNegotiator.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private function resolveSessionCapabilities(Message $message): SessionCapabiliti
return new SessionCapabilities(
hoverMarkupKind: self::negotiateHoverMarkupKind(self::readMap($textDocument, 'hover')),
snippetSupport: ($completionItem['snippetSupport'] ?? false) === true,
positionEncoding: self::negotiatePositionEncoding(self::readMap($params, 'general')),
positionEncoding: self::negotiatePositionEncoding(self::readMap($capabilities, 'general')),
watchedFilesDynamicRegistration: self::readsWatchedFileEvents($workspace),
);
}
Expand All @@ -84,7 +84,7 @@ private static function readsWatchedFileEvents(array $workspace): bool
}

/**
* Per [LSP] `InitializeParams`, `general.positionEncodings` lists the
* Per [LSP] `ClientCapabilities`, `general.positionEncodings` lists the
* encodings the client supports; the server returns the first of its own
* supported encodings the client offered. UTF-16 is always assumable, so a
* client that offers nothing the server supports still resolves to it.
Expand Down
4 changes: 1 addition & 3 deletions tests/Capability/CapabilityNegotiatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,9 @@ public function testAdvertisesTheNegotiatedPositionEncoding(): void
#[DataProvider('positionEncodingCases')]
public function testPositionEncodingIsNegotiated(array $general, PositionEncoding $expected): void
{
$message = new RequestMessage(id: 1, method: 'initialize', params: ['general' => $general]);

self::assertSame(
$expected,
self::resolve($message)->positionEncoding,
self::resolve(self::initializeWith(['general' => $general]))->positionEncoding,
'the server selects a supported encoding the client offered, else the [LSP] mandatory UTF-16',
);
}
Expand Down
Loading