Skip to content
12 changes: 12 additions & 0 deletions script/tool/lib/src/update_excerpts_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,12 @@ class UpdateExcerptsCommand extends PackageLoopingCommand {
case '.cpp':
language = 'c++';
break;
case '.m':
language = 'objectivec';
break;
Comment on lines 146 to +151
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan Seems like we don't have support for header files for either language. I'm not sure there's a simple solution though.

Copy link
Collaborator

@stuartmorgan-g stuartmorgan-g Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. That would need either more special casing here, or a more generalized solution (like a mapping from extensions to the set of allowed languages).

case '.gradle':
language = 'groovy';
break;
default:
language = extension.substring(1);
break;
Expand Down Expand Up @@ -239,6 +245,9 @@ class UpdateExcerptsCommand extends PackageLoopingCommand {
case 'js':
case 'kotlin':
case 'rfwtxt':
case 'java':
case 'groovy':
case 'objectivec':
case 'swift':
prefix = '// ';
break;
Expand All @@ -255,6 +264,9 @@ class UpdateExcerptsCommand extends PackageLoopingCommand {
case 'yaml':
prefix = '# ';
break;
case 'sh':
prefix = '# ';
break;
}
final String startRegionMarker = '$prefix#docregion $section$suffix';
final String endRegionMarker = '$prefix#enddocregion $section$suffix';
Expand Down
Loading