mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-03 15:49:07 -04:00
lsp: Decompile empty XML docs to empty strings
This commit is contained in:
parent
4e02c34a5b
commit
f526cfa4d9
1 changed files with 13 additions and 10 deletions
|
@ -292,16 +292,19 @@ class LanguageServer:
|
|||
def decompile(self, id, params):
|
||||
text = params.get("text")
|
||||
blp = None
|
||||
|
||||
try:
|
||||
blp = decompiler.decompile_string(text)
|
||||
except decompiler.UnsupportedError as e:
|
||||
self._send_error(id, ErrorCode.RequestFailed, e.message)
|
||||
return
|
||||
except:
|
||||
printerr(traceback.format_exc())
|
||||
self._send_error(id, ErrorCode.RequestFailed, "Invalid input")
|
||||
return
|
||||
if text.strip() == "":
|
||||
blp = ""
|
||||
printerr("Decompiled to empty blueprint because input was empty")
|
||||
else:
|
||||
try:
|
||||
blp = decompiler.decompile_string(text)
|
||||
except decompiler.UnsupportedError as e:
|
||||
self._send_error(id, ErrorCode.RequestFailed, e.message)
|
||||
return
|
||||
except:
|
||||
printerr(traceback.format_exc())
|
||||
self._send_error(id, ErrorCode.RequestFailed, "Invalid input")
|
||||
return
|
||||
|
||||
self._send_response(id, {"blp": blp})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue