Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion shared/language-specs/cpp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,17 @@ export const cppSpec: LanguageSpec = {
'pc', // Pro-C by Oracle RDBMS
'pcc', // Pro-C by Oracle RDBMS
],
commentStyles: [cStyleComment],
commentStyles: [
{
...cStyleComment,
// Ignore identifiers between definition line and doc block. This enables
// correctly finding doc strings for function definitions that span multiple
// lines (return type and function name separated by a newline). We'll only
// enable this for C-family languages as it seems to be the most pervasive
// language with this style.
...{ docstringIgnore: /^[\s\w]+/ },
},
],
filterDefinitions,
lsifSupport: LSIFSupport.Experimental,
}
Expand Down
2 changes: 1 addition & 1 deletion shared/search/docstrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function findDocstringInBlockComment({
docstringIgnore?: RegExp
}): string[] | undefined {
// Drop any leading ignored content between the definition and the docstring
const cleanLines = dropWhile(lines, line => docstringIgnore?.test(line))
const cleanLines = dropWhile(lines, line => docstringIgnore?.test(line) || line.trim() === '')

// Check for starting delimiter
if (!cleanLines[0] || !startRegex.test(cleanLines[0])) {
Expand Down