aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pyGHDL/lsp/document.py7
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 }}