diff --git a/blueprintcompiler/language/values.py b/blueprintcompiler/language/values.py index 63cf4fc..96787ee 100644 --- a/blueprintcompiler/language/values.py +++ b/blueprintcompiler/language/values.py @@ -211,12 +211,12 @@ class Flag(AstNode): return self.tokens["value"] @property - def value(self) -> T.Optional[int]: + def value(self) -> T.Optional[str]: type = self.context[ValueTypeCtx].value_type if not isinstance(type, Enumeration): return None elif member := type.members.get(self.name): - return member.value + return member.nick else: return None diff --git a/blueprintcompiler/lsp.py b/blueprintcompiler/lsp.py index 0659154..c4076b4 100644 --- a/blueprintcompiler/lsp.py +++ b/blueprintcompiler/lsp.py @@ -118,6 +118,7 @@ class LanguageServer: self.client_capabilities = {} self.client_supports_completion_choice = False self._open_files: T.Dict[str, OpenFile] = {} + self._exited = False def run(self): # Read tags from gir files. During normal compilation these are @@ -125,7 +126,7 @@ class LanguageServer: xml_reader.PARSE_GIR.add("doc") try: - while True: + while not self._exited: line = "" content_len = -1 while content_len == -1 or (line != "\n" and line != "\r\n"): @@ -221,6 +222,14 @@ class LanguageServer: }, ) + @command("shutdown") + def shutdown(self, id, params): + self._send_response(id, None) + + @command("exit") + def exit(self, id, params): + self._exited = True + @command("textDocument/didOpen") def didOpen(self, id, params): doc = params.get("textDocument") diff --git a/tests/samples/flags.ui b/tests/samples/flags.ui index 2f0a26e..44eb2c4 100644 --- a/tests/samples/flags.ui +++ b/tests/samples/flags.ui @@ -7,7 +7,7 @@ corresponding .blp file and regenerate this file with blueprint-compiler. - 1|4 + is-service|handles-open 1