Skip to content

Commit

Permalink
Expose version of the package and use it for the LspServer
Browse files Browse the repository at this point in the history
  • Loading branch information
ekacnet committed Jan 15, 2024
1 parent 7fe177d commit 5bbcbca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions salt_lsp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from importlib import metadata

try:
__version__ = metadata.version(__package__)
except:
__version__ = "dev"

del metadata # avoid polluting the main namespace
5 changes: 4 additions & 1 deletion salt_lsp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
)
from pygls.server import LanguageServer

from salt_lsp import __version__
from salt_lsp import utils
from salt_lsp.base_types import StateNameCompletion, SLS_LANGUAGE_ID
from salt_lsp.workspace import SaltLspProto, SlsFileWorkspace
Expand All @@ -39,7 +40,9 @@ class SaltServer(LanguageServer):
LINE_START_REGEX = re.compile(r"^(\s*)\b", re.MULTILINE)

def __init__(self) -> None:
super().__init__(protocol_cls=SaltLspProto)
super().__init__(
name="SaltStack", version=__version__, protocol_cls=SaltLspProto
)

self._state_name_completions: Dict[str, StateNameCompletion] = {}

Expand Down

0 comments on commit 5bbcbca

Please sign in to comment.