Skip to content

Commit

Permalink
refactor: rename Server to JsonRPCServer
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Aug 22, 2024
1 parent 554494b commit b327c8d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
15 changes: 15 additions & 0 deletions docs/source/howto/migrate-to-v2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,18 @@ As part of the update to ``lsprotocol v2024``, the following types have been ren
``WorkspaceWorkspaceFoldersRequest`` ``WorkspaceFoldersRequest``
``WorkspaceWorkspaceFoldersResponse`` ``WorkspaceFoldersResponse``
=================================================================================== ==============

Low Level Changes
-----------------

The following changes are unlikely to affect you directly, but have been included for completeness.

``LanguageServer.lsp`` is now ``LanguageServer.protocol``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you need to access the underlying protocol object this is now via the ``protocol`` attribute.

``pygls.server.Server`` is now ``pygls.server.JsonRPCServer``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

pygls' base server class has been renamed
4 changes: 2 additions & 2 deletions pygls/lsp/_base_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from lsprotocol import types
from pygls.protocol import LanguageServerProtocol
from pygls.protocol import default_converter
from pygls.server import Server
from pygls.server import JsonRPCServer
import typing
from typing import Any
from typing import Callable
Expand All @@ -14,7 +14,7 @@
from typing import Type


class BaseLanguageServer(Server):
class BaseLanguageServer(JsonRPCServer):

protocol: LanguageServerProtocol

Expand Down
4 changes: 2 additions & 2 deletions pygls/protocol/json_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

if TYPE_CHECKING:
from cattrs import Converter
from pygls.server import Server, WebSocketTransportAdapter
from pygls.server import JsonRPCServer, WebSocketTransportAdapter


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -121,7 +121,7 @@ class JsonRPCProtocol(asyncio.Protocol):

VERSION = "2.0"

def __init__(self, server: Server, converter: Converter):
def __init__(self, server: JsonRPCServer, converter: Converter):
self._server = server
self._converter = converter

Expand Down
2 changes: 1 addition & 1 deletion pygls/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def write(self, data: Any) -> None:
asyncio.ensure_future(self._ws.send(data))


class Server:
class JsonRPCServer:
"""Base server class
Parameters
Expand Down

0 comments on commit b327c8d

Please sign in to comment.