Skip to content

Commit

Permalink
Merge pull request #5 from lejard-h/remove-import
Browse files Browse the repository at this point in the history
Remove import
  • Loading branch information
aadarshadhakalg committed Nov 12, 2020
2 parents 4667b24 + cd4b257 commit 13855de
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 40 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ All notable changes to the "adsnippets" extension will be documented in this fil

## [0.0.7]

- Remove imports from dart snippets
- Fix routes snippet
- Follow component selector when click on it (component must be open in your current workspace)
- Follow template and styles url when click on it


## [0.0.6]

- rename `adcomp` to `ad-comp`
Expand Down
45 changes: 14 additions & 31 deletions snippets/dart-snippets.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"prefix": "ad-comp",
"description": "Angular Component",
"body": [
"import 'package:angular/angular.dart';\n",
"@Component(",
"\tselector: '${1:component-selector}',",
"\ttemplateUrl: '${2:component_path}.html',",
Expand All @@ -19,12 +18,11 @@
"prefix": "ad-directive",
"description": "Angular Directive",
"body": [
"import 'package:angular/angular.dart';\n",
"@Directive(",
"\tselector: '${1:directiveSelector}',",
"\tproviders: [],",
")",
"class ${3:Name}Directive {",
"class ${2:Name}Directive {",
"\tfinal Element element;",
"",
"\t${3:Name}Directive(this.element);",
Expand All @@ -35,9 +33,7 @@
"prefix": "ad-pipe",
"description": "Angular pipe",
"body": [
"import 'package:angular/angular.dart';",
"",
"@Pipe('${1:selectorName}')",
"@Pipe('${1:pipeSelector}')",
"class ${2:Name}Pipe implements PipeTransform {",
"\ttransform(dynamic value) {",
"\t\t$0",
Expand All @@ -49,7 +45,6 @@
"prefix": "ad-comp-push",
"description": "Angular Component using OnPush change detection",
"body": [
"import 'package:angular/angular.dart';\n",
"@Component(",
"\tselector: '${1:component-selector}',",
"\ttemplateUrl: '${2:component_path}.html',",
Expand All @@ -69,20 +64,14 @@
"prefix": "ad-comp-route",
"description": "Angular Route Component",
"body": [
"import 'package:angular/angular.dart';",
"import 'package:angular_router/angular_router.dart';",
"import '$TM_FILENAME_BASE.template.dart' as template;",
"",
"final ngFactory = template.${1:Name}ComponentNgFactory;",
"",
"@Component(",
"\tselector: '${2:component-selector}',",
"\ttemplateUrl: '${3:component_path}.html',",
"\tstyleUrls: ['${3:component_path}.css'],",
"\tselector: '${1:component-selector}',",
"\ttemplateUrl: '${2:component_path}.html',",
"\tstyleUrls: ['${2:component_path}.css'],",
"\tdirectives: [coreDirectives],",
"\tproviders: [],",
")",
"class ${1:Name}Component implements OnActivate, OnDeactivate {",
"class ${3:Name}Component implements OnActivate, OnDeactivate {",
"",
"\t@override",
"\tvoid onActivate(RouterState previous, RouterState current) {",
Expand All @@ -100,27 +89,21 @@
"prefix": "ad-route",
"description": "Angular Route Definition",
"body": [
"import 'package:angular_router/angular_router.dart';",
"import '${1:component_route_path}' as ${2:name}_lib;",
"",
"final ${2:name}Route = RouteDefinition(",
"\tpath: ${3:RoutePath},",
"\tcomponent: ${2:name}_lib.ngFactory,",
"final ${1:Name}Route = RouteDefinition(",
"\troutePath: ${2:RoutePath},",
"\tcomponent: ${3:ComponentFactory},",
");",
]
},
"Angular Route Definition Lazy": {
"prefix": "ad-route-lazy",
"description": "Angular Route Definition Lazy",
"body": [
"import 'package:angular_router/angular_router.dart';",
"import '${1:component_route_path}' deferred as ${2:name}_lib;",
"",
"final ${2:name}Route = RouteDefinition.defer(",
"\tpath: ${3:RoutePath},",
"final ${1:Name}Route = RouteDefinition.defer(",
"\troutePath: ${2:RoutePath},",
"\tloader: () async {",
"\t\tawait ${2:name}_lib.loadLibrary();",
"\t\treturn ${2:name}_lib.ngFactory;",
"\t\tawait ${3:deferredLibrary}.loadLibrary();",
"\t\treturn ${3:deferredLibrary}.${4:ComponentFactory};",
"\t},",
");",
]
Expand All @@ -129,7 +112,7 @@
"prefix": "ad-trackby",
"description": "TrackBy Function",
"body": [
"${1:trackBy}(int index,, item) {",
"${1:trackBy}(int index, item) {",
"\t$0",
"}"
]
Expand Down
18 changes: 9 additions & 9 deletions snippets/html-snippets.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,64 @@
"prefix": "ad-router-link",
"description": "Router link",
"body": [
"<a [routerLink]=\"${path}\">${name}</a>$0"
"<a [routerLink]=\"${1:path}\">${2:name}</a>$0"
]
},
"Angular Dart Router Attribute": {
"prefix": "ad-router-attribute",
"description": "Router link",
"body": [
"[routerLink]=\"${path}\"$0"
"[routerLink]=\"${1:path}\"$0"
]
},
"Angular Dart Router Active Link": {
"prefix": "ad-router-linkActive",
"description": "Router active link",
"body": [
"<a [routerLink]=\"${path}\" routerLinkActive=\"active\">${name}</a>$0"
"<a [routerLink]=\"${1:path}\" routerLinkActive=\"active\">${2:name}</a>$0"
]
},
"Angular Dart Router Outlet": {
"prefix": "ad-router-outlet",
"description": "Router outlet element",
"body": [
"<router-outlet [routes]=\"${routes}\"></router-outlet>",
"<router-outlet [routes]=\"${1:routes}\"></router-outlet>",
"$0"
]
},
"Angular Dart If Directive": {
"prefix": "ad-if",
"description": "If directive: *ngIf=\"expression\"",
"body": [
"*ngIf=\"${expression}\"$0"
"*ngIf=\"${1:expression}\"$0"
]
},
"Angular Dart For-loop Directive": {
"prefix": "ad-for",
"description": "For-loop directive",
"body": [
"*ngFor=\"let ${item} of ${items}\"$0"
"*ngFor=\"let ${1:item} of ${2:items}\"$0"
]
},
"Angular Dart For-loop Directive with li element": {
"prefix": "ad-for-li",
"description": "For-loop directive with li element",
"body": [
"<li *ngFor=\"let ${item} of ${items}\">$0</li>"
"<li *ngFor=\"let ${1:item} of ${2:items}\">$0</li>"
]
},
"Angular Dart For-loop Directive with index": {
"prefix": "ad-for-index",
"description": "For-loop directive with index",
"body": [
"*ngFor=\"let ${item} of ${items}; let i=index\"$0"
"*ngFor=\"let ${1:item} of ${2:items}; let i=index\"$0"
]
},
"Angular Dart Click Event": {
"prefix": "ad-click",
"description": "Click event",
"body": [
"(click)=\"${expression}\"$0"
"(click)=\"${1:expression}\"$0"
]
},
}

0 comments on commit 13855de

Please sign in to comment.