Skip to content

Conversation

@l7ssha
Copy link
Contributor

@l7ssha l7ssha commented Jun 17, 2018

Hello,
I've added few snippets for dart-mode. For now there no dart-mode snippets.

# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region nil))
# --
for(var i = ${1:0}; i ${2:< 10}; i${3:++}) {
${4:Body}
Copy link
Owner

Choose a reason for hiding this comment

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

could we not put $0 here instead of at the end of the for?

# key: fori
# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region nil))
# --
for(var ${1:obj} in ${2:collection}) {
Copy link
Owner

Choose a reason for hiding this comment

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

same thing here

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: func
# key: func
Copy link
Owner

Choose a reason for hiding this comment

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

maybe fun or even just f is better?

@@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: funca
# key: funca
Copy link
Owner

Choose a reason for hiding this comment

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

considering it's an async function, maybe afun / af would seem more mnemonic to me, what do you think?

# name: getset
# key: getset
# --
${1:Type} _${2:Name};
Copy link
Owner

Choose a reason for hiding this comment

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

is that such a common pattern to have it this way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

@l7ssha l7ssha Jun 19, 2018

Choose a reason for hiding this comment

The 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.

# -*- mode: snippet -*-
# name: getter
# key: get
# --
Copy link
Owner

Choose a reason for hiding this comment

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

same question here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here

@AndreaCrotti
Copy link
Owner

Great thanks @l7ssha left a few comments and questions

@l7ssha
Copy link
Contributor Author

l7ssha commented Jun 19, 2018

I've applied some of your notes @AndreaCrotti . Thanks for review.

@AndreaCrotti
Copy link
Owner

Great thanks

@AndreaCrotti AndreaCrotti merged commit d153af6 into AndreaCrotti:master Jul 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants