-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to do custom code formatting (#147)
- Loading branch information
Showing
5 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: source_gen | ||
version: 0.5.7 | ||
version: 0.5.8 | ||
author: Dart Team <[email protected]> | ||
description: Automatic sourcecode generation for Dart | ||
homepage: https://github.com/dart-lang/source_gen | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:analyzer/dart/element/element.dart'; | ||
import 'package:source_gen/source_gen.dart'; | ||
|
||
/// Generates a single-line of unformatted code. | ||
class UnformattedCodeGenerator extends Generator { | ||
const UnformattedCodeGenerator(); | ||
|
||
@override | ||
Future<String> generate(Element element, _) async { | ||
return unformattedCode; | ||
} | ||
|
||
static const formattedCode = ''' | ||
void hello() => print('hello'); | ||
'''; | ||
|
||
static const unformattedCode = ''' | ||
void hello ()=> print('hello'); | ||
'''; | ||
} |