diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-26 18:50:05 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-26 21:56:35 +0100 |
commit | 9ae0a8f4646ac3520ed4d52e4d464687b115c089 (patch) | |
tree | 908703bb948adc750bb10059c7f410245526eaff /pyGHDL/lsp | |
parent | 85fab1d4d93587643eed9d76bd9d601e3c563656 (diff) | |
download | ghdl-9ae0a8f4646ac3520ed4d52e4d464687b115c089.tar.gz ghdl-9ae0a8f4646ac3520ed4d52e4d464687b115c089.tar.bz2 ghdl-9ae0a8f4646ac3520ed4d52e4d464687b115c089.zip |
pyGHDL/lsp: add comments
Diffstat (limited to 'pyGHDL/lsp')
-rw-r--r-- | pyGHDL/lsp/document.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pyGHDL/lsp/document.py b/pyGHDL/lsp/document.py index eec5c5bee..57351497a 100644 --- a/pyGHDL/lsp/document.py +++ b/pyGHDL/lsp/document.py @@ -216,12 +216,17 @@ class Document(object): res = None else: 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: - txt += file_comments.Get_Comment(t_fe, comm) + '\n' + # Add a comment in 'preformatted' mode + 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' newtext = buffer[:buf_len].decode(Document.encoding) txt += "```vhdl\n" + newtext + "\n```" res = {'contents': { 'kind': 'markdown', 'value': txt }} |