diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2022-11-28 00:32:17 +0100 |
---|---|---|
committer | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2022-11-30 23:32:47 +0100 |
commit | 51f0ead16d60c63d1b069f807e3513bba11d8947 (patch) | |
tree | 50094f57aeb7f9562341908864624199f4d7bc4a /pyGHDL/lsp | |
parent | 473ed87bb505916e74441f01508c109bf39b30a7 (diff) | |
download | ghdl-51f0ead16d60c63d1b069f807e3513bba11d8947.tar.gz ghdl-51f0ead16d60c63d1b069f807e3513bba11d8947.tar.bz2 ghdl-51f0ead16d60c63d1b069f807e3513bba11d8947.zip |
Converted string formatting to f-strings.
Diffstat (limited to 'pyGHDL/lsp')
-rw-r--r-- | pyGHDL/lsp/lsp.py | 6 | ||||
-rw-r--r-- | pyGHDL/lsp/symbols.py | 2 | ||||
-rw-r--r-- | pyGHDL/lsp/workspace.py | 12 |
3 files changed, 10 insertions, 10 deletions
diff --git a/pyGHDL/lsp/lsp.py b/pyGHDL/lsp/lsp.py index 03b4c38e4..0b392ea84 100644 --- a/pyGHDL/lsp/lsp.py +++ b/pyGHDL/lsp/lsp.py @@ -139,7 +139,7 @@ class LanguageProtocolServer(object): log.exception("Caught exception while handling %s with params %s:", method, params) self.show_message( MessageType.Error, - ("Caught exception while handling {}, see VHDL language server output for details.").format(method), + f"Caught exception while handling {method}, see VHDL language server output for details.", ) response = None if tid is None: @@ -163,14 +163,14 @@ class LanguageProtocolServer(object): "id": tid, "error": { "code": JSONErrorCodes.MethodNotFound, - "message": "unknown method {}".format(method), + "message": f"unknown method {method}", }, } return rbody def write_output(self, body): output = json.dumps(body, separators=(",", ":")) - self.conn.write("Content-Length: {}\r\n".format(len(output))) + self.conn.write(f"Content-Length: {len(output)}\r\n") self.conn.write("\r\n") self.conn.write(output) diff --git a/pyGHDL/lsp/symbols.py b/pyGHDL/lsp/symbols.py index fdb090221..332436e5e 100644 --- a/pyGHDL/lsp/symbols.py +++ b/pyGHDL/lsp/symbols.py @@ -93,7 +93,7 @@ def get_symbols(fe, n): return get_symbols(fe, nodes.Get_Library_Unit(n)) m = SYMBOLS_MAP.get(k, None) if m is None: - raise AssertionError("get_symbol: unhandled {}".format(pyutils.kind_image(k))) + raise AssertionError(f"get_symbol: unhandled {pyutils.kind_image(k)}") kind = m["kind"] if kind is None: return None diff --git a/pyGHDL/lsp/workspace.py b/pyGHDL/lsp/workspace.py index c3a575e5d..88200bc49 100644 --- a/pyGHDL/lsp/workspace.py +++ b/pyGHDL/lsp/workspace.py @@ -158,7 +158,7 @@ class Workspace(object): sfe = document.Document.load(fd.read(), self._root_path, name) fd.close() except OSError as err: - self._server.show_message(lsp.MessageType.Error, "cannot load {}: {}".format(name, err.strerror)) + self._server.show_message(lsp.MessageType.Error, f"cannot load {name}: {err.strerror}") return doc = self.create_document_from_sfe(sfe, absname) doc.parse_document() @@ -173,7 +173,7 @@ class Workspace(object): except OSError as err: self._server.show_message( lsp.MessageType.Error, - "cannot open project file {}: {}".format(prj_file, err.strerror), + f"cannot open project file {prj_file}: {err.strerror}", ) return log.info("reading project file %s", prj_file) @@ -183,7 +183,7 @@ class Workspace(object): log.info("error in project file") self._server.show_message( lsp.MessageType.Error, - "json error in project file {}:{}:{}".format(prj_file, e.lineno, e.colno), + f"json error in project file {prj_file}:{e.lineno}:{e.colno}", ) f.close() @@ -204,9 +204,9 @@ class Workspace(object): log.info("Using options: %s", ghdl_opts) for opt in ghdl_opts: if not libghdl.set_option(opt): - self._server.show_message(lsp.MessageType.Error, "error with option: {}".format(opt)) + self._server.show_message(lsp.MessageType.Error, f"error with option: {opt}") except ProjectError as e: - self._server.show_message(lsp.MessageType.Error, "error in project file: {}".format(e.msg)) + self._server.show_message(lsp.MessageType.Error, f"error in project file: {e.msg}") def read_files_from_project(self): try: @@ -223,7 +223,7 @@ class Workspace(object): if lang == "vhdl": self.add_vhdl_file(name) except ProjectError as e: - self._server.show_message(lsp.MessageType.Error, "error in project file: {}".format(e.msg)) + self._server.show_message(lsp.MessageType.Error, f"error in project file: {e.msg}") def get_configuration(self): self._server.configuration([{"scopeUri": "", "section": "vhdl.maxNumberOfProblems"}]) |