From 9ae0a8f4646ac3520ed4d52e4d464687b115c089 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 26 Jan 2023 18:50:05 +0100 Subject: pyGHDL/lsp: add comments --- pyGHDL/lsp/document.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pyGHDL/lsp/document.py') 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 }} -- cgit v1.2.3