-
Notifications
You must be signed in to change notification settings - Fork 483
Snippets for dart-mode #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: aclass | ||
| # key: acls | ||
| # -- | ||
| abstract class ${1:Name} { | ||
| $0 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: class | ||
| # key: cls | ||
| # -- | ||
| class ${1:Name} { | ||
| $0 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: ext | ||
| # key: ext | ||
| # -- | ||
| extends ${1:Name}$0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: for | ||
| # key: for | ||
| # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region nil)) | ||
| # -- | ||
| for(var i = ${1:0}; i ${2:< 10}; i${3:++}) { | ||
| $0 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: fori | ||
| # key: fori | ||
| # expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region nil)) | ||
| # -- | ||
| for(var ${1:obj} in ${2:collection}) { | ||
| $0 | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: fun | ||
| # key: fun | ||
| # -- | ||
| ${1:Type} ${2:Name}($3) { | ||
| $0 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: funca | ||
| # key: afun | ||
| # -- | ||
| ${1:Type} ${2:Name}($3) async { | ||
| $0 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: getset | ||
| # key: getset | ||
| # -- | ||
| ${1:Type} _${2:Name}; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that such a common pattern to have it this way?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, getters are commonly used. This is generic pattern but it applies pretty well in this case.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And if you mean '_Name' notation - '_' in Dart means 'private' in C like programming languages, so it has to be like that. |
||
| $1 get $2 => _$2; | ||
| set $2($1 $2) => _$2 = $2;$0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: getter | ||
| # key: get | ||
| # -- | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
| ${1:Type} _${2:Name}; | ||
| $1 get $2 => _$2;$0 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: impl | ||
| # key: impl | ||
| # -- | ||
| implements ${1:Name}$0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: import | ||
| # key: imp | ||
| # -- | ||
| import '${1:Library}';$0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: main | ||
| # key: main | ||
| # -- | ||
| main(List<String> args) { | ||
| $0 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: part | ||
| # key: part | ||
| # -- | ||
| part of ${1:Part}$0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # -*- mode: snippet -*- | ||
| # name: setter | ||
| # key: set | ||
| # -- | ||
| ${1:Type} _${2:Name}; | ||
| set $2($1 $2) => _$2 = $2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same thing here