Skip to content

Commit

Permalink
Update AL snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Toader committed Apr 12, 2019
1 parent 8f40a5c commit 52e93ef
Show file tree
Hide file tree
Showing 11 changed files with 340 additions and 81 deletions.
14 changes: 6 additions & 8 deletions snippets/al.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@
"Snippet: Event Subscriber": {
"prefix": "teventsub",
"body": [
"[EventSubscriber(ObjectType::${1:ObjectType}, ${2:ObjectId}, ${3:'OnSomeEvent'}, '${4:ElementName}', ${5:SkipOnMissingLicense}, ${6:SkipOnMissingPermission})]",
"local procedure ${7:MyProcedure}()",
"[EventSubscriber(ObjectType::${1|Codeunit,Page,Query,Report,Table,XmlPort|}, ${2|Codeunit::,Database::,Page::,Query::,Report::,XmlPort::|}, ${3:'OnSomeEvent'}, ${4:'ElementName'}, ${5:SkipOnMissingLicense}, ${6:SkipOnMissingPermission})]",
"local procedure ${7:MyProcedure}(${8})",
"begin",
"\t$0",
"end;"
Expand All @@ -137,10 +137,9 @@
"Snippet: Integration Event": {
"prefix": "teventint",
"body": [
"[IntegrationEvent(${1:IncludeSender},${2:GlobalVarAccess})]",
"local procedure ${3:MyProcedure}()",
"[IntegrationEvent(${1:IncludeSender}, false)]",
"local procedure ${0:MyProcedure}()",
"begin",
"\t$0",
"end;"
],
"description": "Snippet: Integration Event"
Expand All @@ -149,9 +148,8 @@
"prefix": "teventbus",
"body": [
"[BusinessEvent(${1:IncludeSender})]",
"local procedure ${2:MyProcedure}()",
"local procedure ${0:MyProcedure}()",
"begin",
"\t$0",
"end;"
],
"description": "Snippet: Business Event"
Expand Down Expand Up @@ -182,7 +180,7 @@
"end;"
],
"description": "Snippet: If Table Empty Else"
},
},
"Snippet: If Table Empty": {
"prefix": "tisempty",
"body": [
Expand Down
32 changes: 32 additions & 0 deletions snippets/dotnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"Snippet: DotNetPackage": {
"prefix": "tdotnet",
"body": [
"dotnet",
"{",
"\tassembly(${1:AssemblyName})",
"\t{",
"\t\ttype(${2:TypeName};${0:AliasName}){}",
"\t}",
"}"
],
"description": "Snippet: DotNet Package"
},
"Snippet: DotNetAssembly": {
"prefix": "tdotnetassembly",
"body": [
"assembly(${1:AssemblyName})",
"{",
"\ttype(${2:TypeName};${0:AliasName}){}",
"}"
],
"description": "Snippet: DotNet Assembly"
},
"Snippet: DotNetType": {
"prefix": "tdotnettype",
"body": [
"type(${1:TypeName};${0:AliasName}){}"
],
"description": "Snippet: DotNet Type"
}
}
25 changes: 25 additions & 0 deletions snippets/enum.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Snippet: Enum": {
"prefix": "tenum",
"body": [
"enum ${1:id} ${2:MyEnum}",
"{",
"\tExtensible = ${3|true,false|};",
"\t",
"\tvalue(0; ${0:MyValue})",
"\t{",
"\t}",
"}"
],
"description": "Snippet: Enum"
},
"Snippet: Enum Value": {
"prefix": "tenumvalue",
"body": [
"value(${1:ValueId}; ${0:MyValue})",
"{",
"}"
],
"description": "Snippet: Enum Value"
}
}
14 changes: 14 additions & 0 deletions snippets/enumextension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Snippet: Enum Extension": {
"prefix": "tenumext",
"body": [
"enumextension ${1:Id} ${2:MyEnumExtension} extends ${3:MyTargetEnum}",
"{",
"\tvalue(${4:ValueId}; ${0:MyValue})",
"\t{",
"\t}",
"}"
],
"description": "Snippet: Enum Extension"
}
}
122 changes: 92 additions & 30 deletions snippets/page.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,46 @@
"Page": {
"prefix": "tpage",
"body": [
"page ${1:Id} ${2:PageName}",
"page ${1:Id} ${2:MyPage}",
"{",
"\tPageType = ${3|Card,List,RoleCenter,CardPart,ListPart,Document,Worksheet,ListPlus,ConfirmationDialog,NavigatePage,StandardDialog,API,ReportPreview,ReportProcessingOnly,XmlPort|};",
"\tSourceTable = ${4:TableName};",
"\tApplicationArea = ${4|All,Basic,Suite,Advanced|};",
"\tUsageCategory = ${5|Administration,Documents,History,Lists,None,ReportsAndAnalysis,Tasks|};",
"\tSourceTable = ${6:TableName};",
"\t",
"\tlayout",
"\t{",
"\t\tarea(content)",
"\t\tarea(Content)",
"\t\t{",
"\t\t\tgroup(${5:GroupName})",
"\t\t\tgroup(${7:GroupName})",
"\t\t\t{",
"\t\t\t\tfield(${7:Name}; ${6:NameSource})",
"\t\t\t\tfield(${9:Name}; ${8:NameSource})",
"\t\t\t\t{",
"\t\t\t\t\t${8}",
"\t\t\t\t\tApplicationArea = ${4};",
"\t\t\t\t\t${10}",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}",
"\t}",
"\t",
"\tactions",
"\t{",
"\t\tarea(${9:processing})",
"\t\tarea(${11:Processing})",
"\t\t{",
"\t\t\taction(${10:ActionName})",
"\t\t\taction(${12:ActionName})",
"\t\t\t{",
"\t\t\t\tApplicationArea = ${4};",
"\t\t\t\t",
"\t\t\t\ttrigger OnAction()",
"\t\t\t\tbegin",
"\t\t\t\t\t${11}",
"\t\t\t\t\t${13}",
"\t\t\t\tend;",
"\t\t\t}",
"\t\t}",
"\t}",
"\t",
"\tvar",
"\t\t${12:myInt}: ${0:Integer};",
"\t\t${14:myInt}: ${0:Integer};",
"}"
],
"description": "Snippet: Page"
Expand All @@ -52,21 +57,13 @@
],
"description": "Snippet: Page Field"
},
"Snippet: Part": {
"prefix": "tpart",
"body": [
"part(${1:MyPart}; ${2:PartSource})",
"{",
"\t${0}",
"}"
],
"description": "Snippet: Page Part"
},
"Snippet: Action": {
"prefix": "taction",
"body": [
"action(${1:ActionName})",
"{",
"\tApplicationArea = ${2|All,Basic,Suite,Advanced|};",
"\t",
"\ttrigger OnAction()",
"\tbegin",
"\t\t$0",
Expand All @@ -80,46 +77,78 @@
"body": [
"usercontrol(${1:ControlName}; ${2:AddInName})",
"{",
"\ttrigger ${3:MyTrigger()}",
"\tApplicationArea = ${3|All,Basic,Suite,Advanced|};",
"\t",
"\ttrigger ${4:MyTrigger()}",
"\tbegin",
"\t\t$0",
"\tend;",
"}"
],
"description": "Snippet: Page User Control"
},
"Snippet: View": {
"prefix": "tview",
"body": [
"view(${1:ViewName})",
"{",
"\tCaption = '${2:ViewCaption}';",
"\t",
"\tlayout",
"\t{",
"\t\t$0",
"\t}",
"}"
],
"description": "Snippet: Page View"
},
"Snippet: Part": {
"prefix": "tpart",
"body": [
"part(${1:PartName}; ${2:PartSource})",
"{",
"\t${0}",
"}"
],
"description": "Snippet: Page Part"
},
"Page of type list": {
"prefix": "tpage",
"body": [
"page ${1:Id} ${2:PageName}",
"{",
"\tPageType = List;",
"\tSourceTable = ${3:TableName};",
"\tApplicationArea = ${3|All,Basic,Suite,Advanced|};",
"\tUsageCategory = Lists;",
"\tSourceTable = ${4:TableName};",
"\t",
"\tlayout",
"\t{",
"\t\tarea(content)",
"\t\tarea(Content)",
"\t\t{",
"\t\t\trepeater(${4:Group})",
"\t\t\trepeater(${5:GroupName})",
"\t\t\t{",
"\t\t\t\tfield(${6:Name}; ${5:NameSource})",
"\t\t\t\tfield(${7:Name}; ${6:NameSource})",
"\t\t\t\t{",
"\t\t\t\t\t${7}",
"\t\t\t\t\tApplicationArea = ${3};",
"\t\t\t\t\t${8}",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}",
"\t\tarea(factboxes)",
"\t\tarea(Factboxes)",
"\t\t{",
"\t\t\t${8}",
"\t\t\t${9}",
"\t\t}",
"\t}",
"\t",
"\tactions",
"\t{",
"\t\tarea(${9:processing})",
"\t\tarea(${10:Processing})",
"\t\t{",
"\t\t\taction(${10:ActionName})",
"\t\t\taction(${11:ActionName})",
"\t\t\t{",
"\t\t\t\tApplicationArea = ${3};",
"\t\t\t\t",
"\t\t\t\ttrigger OnAction();",
"\t\t\t\tbegin",
"\t\t\t\t\t$0",
Expand All @@ -130,5 +159,38 @@
"}"
],
"description": "Snippet: Page of type list"
},
"Page of type API": {
"prefix": "tpage",
"body": [
"page ${1:Id} ${2:ApiPageName}",
"{",
"\tPageType = API;",
"\tCaption = '${3:apiPageName}';",
"\tAPIPublisher = '${4:publisherName}';",
"\tAPIGroup = '${5:groupName}';",
"\tAPIVersion = '${6:VersionList}';",
"\tEntityName = '${7:entityName}';",
"\tEntitySetName = '${8:entitySetName}';",
"\tSourceTable = ${9:TableName};",
"\tDelayedInsert = true;",
"\t",
"\tlayout",
"\t{",
"\t\tarea(Content)",
"\t\t{",
"\t\t\trepeater(${10:GroupName})",
"\t\t\t{",
"\t\t\t\tfield(${12:fieldName}; ${11:NameSource})",
"\t\t\t\t{",
"\t\t\t\t\tCaption = '${13:fieldCaption}';",
"\t\t\t\t\t${0}",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}",
"\t}",
"}"
],
"description": "Snippet: Page of type API"
}
}
4 changes: 2 additions & 2 deletions snippets/profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"Snippet: Profile": {
"prefix": "tprofile",
"body": [
"profile ${1:MyNewProfile} ",
"profile ${1:MyProfile} ",
"{",
"\tDescription = ${2:'My Description'};",
"\tDescription = ${2:'Profile Display Name'};",
"\tRoleCenter = ${3:RoleCenter};",
"\tCustomizations = ${0:Customizations};",
"}"
Expand Down
38 changes: 38 additions & 0 deletions snippets/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,43 @@
"}"
],
"description": "Snippet: Query"
},
"Query of type API": {
"prefix": "tquery",
"body": [
"query ${1:Id} ${2:MyQuery}",
"{",
"\tQueryType = API;",
"\tAPIPublisher = '${3:PublisherName}';",
"\tAPIGroup = '${4:GroupName}';",
"\tAPIVersion = '${5:VersionList}';",
"\tEntityName = '${6:EntityName}';",
"\tEntitySetName = '${7:EntitySetName}';",
"\t",
"\telements",
"\t{",
"\t\tdataitem(${10:DataItemName}; ${9:SourceTableName})",
"\t\t{",
"\t\t\tcolumn(${12:ColumnName}; ${11:SourceFieldName})",
"\t\t\t{",
"\t\t\t\t${13}",
"\t\t\t}",
"\t\t\tfilter(${15:FilterName}; ${14:SourceFieldName})",
"\t\t\t{",
"\t\t\t\t${16}",
"\t\t\t}",
"\t\t}",
"\t}",
"\t",
"\tvar",
"\t\t${17:myInt}: ${18:Integer};",
"\t",
"\ttrigger ${19:OnBeforeOpen}()",
"\tbegin",
"\t\t$0",
"\tend;",
"}"
],
"description": "Snippet: Query of type API"
}
}
Loading

0 comments on commit 52e93ef

Please sign in to comment.