diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-27 07:51:46 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-27 07:51:46 +0100 |
commit | 756b1fd183ab96edd0f330fcc2b411f6e71577f1 (patch) | |
tree | 7314e88a29eaa3d72bb18662c37ed68dd7eda17b | |
parent | 1e6bc1de7196b5b9d9aa771124632f46f620be1a (diff) | |
download | ghdl-756b1fd183ab96edd0f330fcc2b411f6e71577f1.tar.gz ghdl-756b1fd183ab96edd0f330fcc2b411f6e71577f1.tar.bz2 ghdl-756b1fd183ab96edd0f330fcc2b411f6e71577f1.zip |
pyGHDL: reformatting
-rw-r--r-- | pyGHDL/libghdl/vhdl/prints.py | 6 | ||||
-rw-r--r-- | pyGHDL/lsp/document.py | 8 | ||||
-rw-r--r-- | pyGHDL/lsp/references.py | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/pyGHDL/libghdl/vhdl/prints.py b/pyGHDL/libghdl/vhdl/prints.py index 5e7559fea..d5f976536 100644 --- a/pyGHDL/libghdl/vhdl/prints.py +++ b/pyGHDL/libghdl/vhdl/prints.py @@ -65,7 +65,7 @@ def Allocate_Handle() -> c_void_p: @export @BindToLibGHDL("vhdl__prints__get_length") -def Get_Length(Handle : c_void_p) -> int: +def Get_Length(Handle: c_void_p) -> int: """ .. todo:: Undocumented in Ada code. @@ -76,7 +76,7 @@ def Get_Length(Handle : c_void_p) -> int: @export @BindToLibGHDL("vhdl__prints__get_c_string") -def Get_C_String(Handle : c_void_p) -> c_char_p: +def Get_C_String(Handle: c_void_p) -> c_char_p: """ .. todo:: Undocumented in Ada code. @@ -87,7 +87,7 @@ def Get_C_String(Handle : c_void_p) -> c_char_p: @export @BindToLibGHDL("vhdl__prints__free_handle") -def Free_Handle(Handle : c_void_p) -> None: +def Free_Handle(Handle: c_void_p) -> None: """ .. todo:: Undocumented in Ada code. diff --git a/pyGHDL/lsp/document.py b/pyGHDL/lsp/document.py index 57351497a..ff7227301 100644 --- a/pyGHDL/lsp/document.py +++ b/pyGHDL/lsp/document.py @@ -215,21 +215,21 @@ class Document(object): if buf_len == 0: res = None else: - txt = '' + txt = "" # Extract comments t_loc = nodes.Get_Location(t) t_fe = files_map.Location_To_File(t_loc) comm = file_comments.Find_First_Comment(t_fe, t) while comm != file_comments.No_Comment_Index: # Add a comment in 'preformatted' mode - txt += ' ' + file_comments.Get_Comment(t_fe, comm) + '\n' + txt += " " + file_comments.Get_Comment(t_fe, comm) + "\n" comm = file_comments.Get_Next_Comment(t_fe, comm) if txt: # Add a separation line between comments and declaration. - txt += '---\n' + txt += "---\n" newtext = buffer[:buf_len].decode(Document.encoding) txt += "```vhdl\n" + newtext + "\n```" - res = {'contents': { 'kind': 'markdown', 'value': txt }} + res = {"contents": {"kind": "markdown", "value": txt}} prints.Free_Handle(hand) return res diff --git a/pyGHDL/lsp/references.py b/pyGHDL/lsp/references.py index 2adde0fed..db72865b1 100644 --- a/pyGHDL/lsp/references.py +++ b/pyGHDL/lsp/references.py @@ -135,12 +135,14 @@ def find_def(n, loc): return None + def find_node_by_loc(n, loc): """Return the denoting node for :param loc: or None.""" ref = find_def(n, loc) log.debug("for loc %u found node %s", loc, ref) return ref + def find_definition_by_loc(n, loc): """Return the declaration (as a node) under :param loc: or None.""" ref = find_node_by_loc(n, loc) |