Include version number in lsp and cli

Fixes #61.
This commit is contained in:
James Westman 2022-06-02 12:34:48 -05:00
parent 6f4d458855
commit 65691dfac6
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
4 changed files with 27 additions and 10 deletions

View file

@ -151,6 +151,8 @@ class LanguageServer:
@command("initialize")
def initialize(self, id, params):
from . import main
self.client_capabilities = params.get("capabilities")
self._send_response(id, {
"capabilities": {
@ -167,7 +169,11 @@ class LanguageServer:
"completionProvider": {},
"codeActionProvider": {},
"hoverProvider": True,
}
},
"serverInfo": {
"name": "Blueprint",
"version": main.VERSION,
},
})
@command("textDocument/didOpen")

View file

@ -27,9 +27,7 @@ from . import parser, tokenizer, decompiler, interactive_port
from .utils import Colors
from .xml_emitter import XmlEmitter
VERSION = "0.1.0"
VERSION = "uninstalled"
class BlueprintApp:
def main(self):
@ -53,6 +51,8 @@ class BlueprintApp:
self.add_subcommand("help", "Show this message", self.cmd_help)
self.parser.add_argument("--version", action="version", version=VERSION)
try:
opts = self.parser.parse_args()
opts.func(opts)
@ -144,5 +144,7 @@ class BlueprintApp:
return ast.generate(), warnings
def main():
def main(version):
global VERSION
VERSION = version
BlueprintApp().main()