From 2c09275388d4c88ea26bf709132b8be4a9e342bc Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 30 Jun 2022 14:19:39 -0700 Subject: Language server: extract documentation from ordinary comments (#2308) * Language server: improved documentation formatting. * Extend doc extractor to search in ordinary comments. Reuse language server instance between tests. * Fix test case. * Fix comment. * Fix crash. * Fix enum case doc extraction. * Doc extractor fixes. * Fix. * Fix. Co-authored-by: Yong He --- source/compiler-core/slang-doc-extractor.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/compiler-core/slang-doc-extractor.h') diff --git a/source/compiler-core/slang-doc-extractor.h b/source/compiler-core/slang-doc-extractor.h index 5b4c67782..fc486250e 100644 --- a/source/compiler-core/slang-doc-extractor.h +++ b/source/compiler-core/slang-doc-extractor.h @@ -42,13 +42,17 @@ public: BlockBefore, /// /** */ or /*! */. LineBangBefore, /// //! Can be multiple lines LineSlashBefore, /// /// Can be multiple lines + OrdinaryBlockBefore, + OrdinaryLineBefore, BlockAfter, /// /*!< */ or /**< */ LineBangAfter, /// //!< Can be multiple lines LineSlashAfter, /// ///< Can be multiple lines + OrdinaryLineAfter, + }; - static bool isBefore(MarkupType type) { return Index(type) >= Index(MarkupType::BlockBefore) && Index(type) <= Index(MarkupType::LineSlashBefore); } + static bool isBefore(MarkupType type) { return Index(type) >= Index(MarkupType::BlockBefore) && Index(type) <= Index(MarkupType::OrdinaryLineBefore); } static bool isAfter(MarkupType type) { return Index(type) >= Index(MarkupType::BlockAfter); } struct IndexRange @@ -121,6 +125,10 @@ public: Index lineIndex; ///< The line number for the decl }; + void setSearchInOrdinaryComments(bool val) + { + m_searchInOrindaryComments = val; + } /// Extracts 'markup' doc information for the specified input items /// The output is placed in out - with the items now in the source order *not* the order of the input items @@ -156,6 +164,8 @@ protected: static bool _isTokenOnLineIndex(SourceView* sourceView, MarkupType type, const Token& tok, Index lineIndex); DiagnosticSink* m_sink; + + bool m_searchInOrindaryComments = false; }; } // namespace Slang -- cgit v1.2.3