Skip to content

Commit

Permalink
lsp: Expose converter via property
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Nov 17, 2023
1 parent ee3d1d3 commit 3be0d1b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/esbonio/esbonio/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from typing import TypeVar
from uuid import uuid4

import cattrs
from lsprotocol import types
from pygls.capabilities import get_capability
from pygls.server import LanguageServer
Expand Down Expand Up @@ -80,15 +81,17 @@ def __init__(self, logger: Optional[logging.Logger] = None, *args, **kwargs):
self.logger = logger or logging.getLogger(__name__)
"""The logger instance to use."""

self.converter = self.lsp._converter
"""The cattrs converter instance we should use."""

self.configuration = Configuration(self)
"""Manages the fetching of configuration values."""

def __iter__(self):
return iter(self._features.items())

@property
def converter(self) -> cattrs.Converter:
"""The cattrs converter instance we should use."""
return self.lsp._converter

def initialize(self, params: types.InitializeParams):
self.logger.info("Initialising esbonio v%s", __version__)
if (client := params.client_info) is not None:
Expand Down

0 comments on commit 3be0d1b

Please sign in to comment.