Merge pull request #4892 from Microsoft/updateSnippets

Update AL snippets
This commit is contained in:
Alexandru Toader 2019-04-12 13:40:54 +02:00 коммит произвёл GitHub
Родитель 8f40a5ccc7 52e93efdb9
Коммит 01c4d55e05
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
11 изменённых файлов: 340 добавлений и 81 удалений

Просмотреть файл

@ -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;"
@ -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"
@ -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"
@ -182,7 +180,7 @@
"end;"
],
"description": "Snippet: If Table Empty Else"
},
},
"Snippet: If Table Empty": {
"prefix": "tisempty",
"body": [

32
snippets/dotnet.json Normal file
Просмотреть файл

@ -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
snippets/enum.json Normal file
Просмотреть файл

@ -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"
}
}

Просмотреть файл

@ -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"
}
}

Просмотреть файл

@ -2,20 +2,23 @@
"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}",
@ -23,20 +26,22 @@
"\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"
@ -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",
@ -80,7 +77,9 @@
"body": [
"usercontrol(${1:ControlName}; ${2:AddInName})",
"{",
"\ttrigger ${3:MyTrigger()}",
"\tApplicationArea = ${3|All,Basic,Suite,Advanced|};",
"\t",
"\ttrigger ${4:MyTrigger()}",
"\tbegin",
"\t\t$0",
"\tend;",
@ -88,38 +87,68 @@
],
"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",
@ -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"
}
}

Просмотреть файл

@ -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};",
"}"

Просмотреть файл

@ -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"
}
}

Просмотреть файл

@ -4,13 +4,16 @@
"body": [
"report ${1:Id} ${2:MyReport}",
"{",
"\tUsageCategory = ${3|Administration,Documents,History,Lists,None,ReportsAndAnalysis,Tasks|};",
"\tApplicationArea = ${4|All,Basic,Suite,Advanced|};",
"\t",
"\tdataset",
"\t{",
"\t\tdataitem(${4:DataItemName}; ${3:SourceTableName})",
"\t\tdataitem(${6:DataItemName}; ${5:SourceTableName})",
"\t\t{",
"\t\t\tcolumn(${6:ColumnName}; ${5:SourceFieldName})",
"\t\t\tcolumn(${8:ColumnName}; ${7:SourceFieldName})",
"\t\t\t{",
"\t\t\t\t${7}",
"\t\t\t\t${9}",
"\t\t\t}",
"\t\t}",
"\t}",
@ -19,13 +22,14 @@
"\t{",
"\t\tlayout",
"\t\t{",
"\t\t\tarea(content)",
"\t\t\tarea(Content)",
"\t\t\t{",
"\t\t\t\tgroup(${8:GroupName})",
"\t\t\t\tgroup(${10:GroupName})",
"\t\t\t\t{",
"\t\t\t\t\tfield(${10:Name}; ${9:SourceExpression})",
"\t\t\t\t\tfield(${12:Name}; ${11:SourceExpression})",
"\t\t\t\t\t{",
"\t\t\t\t\t\t${11}",
"\t\t\t\t\t\tApplicationArea = ${4};",
"\t\t\t\t\t\t${13}",
"\t\t\t\t\t}",
"\t\t\t\t}",
"\t\t\t}",
@ -33,18 +37,19 @@
"\t",
"\t\tactions",
"\t\t{",
"\t\t\tarea(${12:processing})",
"\t\t\tarea(${14:processing})",
"\t\t\t{",
"\t\t\t\taction(${13:ActionName})",
"\t\t\t\taction(${15:ActionName})",
"\t\t\t\t{",
"\t\t\t\t\t${14}",
"\t\t\t\t\tApplicationArea = ${4};",
"\t\t\t\t\t${16}",
"\t\t\t\t}",
"\t\t\t}",
"\t\t}",
"\t}",
"\t",
"\tvar",
"\t\t${15:myInt}: ${0:Integer};",
"\t\t${17:myInt}: ${0:Integer};",
"}"
],
"description": "Snippet: Report"

30
snippets/ruleset.json Normal file
Просмотреть файл

@ -0,0 +1,30 @@
{
"Snippet: RuleSet": {
"prefix": "truleset",
"body": [
"{",
"\t\"name\": \"${1:Name}\",",
"\t\"description\": \"${2:Description}\",",
"\t\"rules\": [",
"\t\t{",
"\t\t\t\"id\": \"${3:DiagnosticId}\",",
"\t\t\t\"action\": \"${4|Error,Warning,Info,Hidden,None|}\",",
"\t\t\t\"justification\": \"${0:Justification}\"",
"\t\t}",
"\t]",
"}"
],
"description": "Snippet: RuleSet"
},
"Snippet: Rule": {
"prefix": "trule",
"body": [
"{",
"\t\"id\": \"${1:DiagnosticId}\",",
"\t\"action\": \"${2|Error,Warning,Info,Hidden,None|}\",",
"\t\"justification\": \"${0:Justification}\"",
"}"
],
"description": "Snippet: RuleSet"
}
}

Просмотреть файл

@ -4,39 +4,41 @@
"body": [
"table ${1:id} ${2:MyTable}",
"{",
"\tDataClassification = ${3|ToBeClassified,CustomerContent,EndUserIdentifiableInformation,AccountData,EndUserPseudonymousIdentifiers,OrganizationIdentifiableInformation,SystemMetadata|};",
"\t",
"\tfields",
"\t{",
"\t\tfield(1;${3:MyField}; ${4:Integer})",
"\t\tfield(1;${4:MyField}; ${5:Integer})",
"\t\t{",
"\t\t\t$5",
"\t\t\tDataClassification = ${6|ToBeClassified,CustomerContent,EndUserIdentifiableInformation,AccountData,EndUserPseudonymousIdentifiers,OrganizationIdentifiableInformation,SystemMetadata|};",
"\t\t\t$7",
"\t\t}",
"\t}",
"\t",
"\tkeys",
"\t{",
"\t\tkey(${6:PK}; ${3:MyField})",
"\t\tkey(${8:PK}; ${4:MyField})",
"\t\t{",
"\t\t\tClustered = ${7|true,false|};",
"\t\t\tClustered = ${9|true,false|};",
"\t\t}",
"\t}",
"\t",
"\tvar",
"\t\t${8:myInt}: ${9:Integer};",
"\t\t${10:myInt}: ${11:Integer};",
"\t",
"\ttrigger OnInsert()",
"\tbegin",
"\t\t$10",
"\t\t$12",
"\tend;",
"\t",
"\ttrigger OnModify()",
"\tbegin",
"\t\t$11",
"\t\t$13",
"\tend;",
"\t",
"\ttrigger OnDelete()",
"\tbegin",
"\t\t$12",
"\t\t$14",
"\tend;",
"\t",
"\ttrigger OnRename()",
@ -53,7 +55,8 @@
"body": [
"field(${1:id}; ${2:MyField}; ${3|Blob,BigInteger,Boolean,Code[50],Date,DateFormula,Decimal,Duration,Integer,Guid,Media,MediaSet,Option,RecordID,TableFilter,Text[50],Time|})",
"{",
"\t${4:FieldPropertyName} = ${0:FieldPropertyValue};",
"\tDataClassification = ${4|ToBeClassified,CustomerContent,EndUserIdentifiableInformation,AccountData,EndUserPseudonymousIdentifiers,OrganizationIdentifiableInformation,SystemMetadata|};",
"\t${5:FieldPropertyName} = ${0:FieldPropertyValue};",
"}"
],
"description": "Snippet: Table Field"
@ -63,6 +66,7 @@
"body": [
"field(${1:id}; ${2:MyField}; Option)",
"{",
"\tDataClassification = ${3|ToBeClassified,CustomerContent,EndUserIdentifiableInformation,AccountData,EndUserPseudonymousIdentifiers,OrganizationIdentifiableInformation,SystemMetadata|};",
"\tOptionMembers = ${0:Default};",
"}"
],
@ -73,6 +77,7 @@
"body": [
"field(${1:id}; ${2:MyField}; Code[${3:Length}])",
"{",
"\tDataClassification = ${4|ToBeClassified,CustomerContent,EndUserIdentifiableInformation,AccountData,EndUserPseudonymousIdentifiers,OrganizationIdentifiableInformation,SystemMetadata|};",
"\t$0",
"}"
],
@ -83,6 +88,7 @@
"body": [
"field(${1:id}; ${2:MyField}; Text[${3:Length}])",
"{",
"\tDataClassification = ${4|ToBeClassified,CustomerContent,EndUserIdentifiableInformation,AccountData,EndUserPseudonymousIdentifiers,OrganizationIdentifiableInformation,SystemMetadata|};",
"\t$0",
"}"
],
@ -97,26 +103,5 @@
"}"
],
"description": "Snippet: Table Key"
},
"Snippet: Table PK Key": {
"prefix": "tkey",
"body": [
"key(PK; ${1:MyField})",
"{",
"\tClustered = true;",
"}",
"$0"
],
"description": "Snippet: Table Key"
},
"Snippet: Table Field Groups": {
"prefix": "tfieldgroups",
"body": [
"fieldgroups {",
"\tfieldgroup(DropDown; ${1:MyField}) {}",
"\tfieldgroup(Brick; ${1:MyField}) {}",
"}",
"$0"
]
}
}

70
snippets/xml.json Normal file
Просмотреть файл

@ -0,0 +1,70 @@
{
"Snippet: WebService": {
"prefix": "twebservice",
"body": [
"<TenantWebService>",
"\t<ObjectType>${1|Page,CodeUnit,Query|}</ObjectType>",
"\t<ServiceName>${2:serviceName}</ServiceName>",
"\t<ObjectID>${3:objectId}</ObjectID>",
"\t<Published>${4|false,true|}</Published>",
"</TenantWebService>"
],
"description": "Snippet: Web Service"
},
"Snippet: WebServices": {
"prefix": "twebservices",
"body": [
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
"<ExportedData>",
"\t<TenantWebServiceCollection>",
"\t\t<TenantWebService>",
"\t\t\t<ObjectType>${1|Page,CodeUnit,Query|}</ObjectType>",
"\t\t\t<ServiceName>${2:serviceName}</ServiceName>",
"\t\t\t<ObjectID>${3:objectId}</ObjectID>",
"\t\t\t<Published>${4|false,true|}</Published>",
"\t\t</TenantWebService>",
"\t</TenantWebServiceCollection>",
"</ExportedData>"
],
"description": "Snippet: Web Services File"
},
"Snippet: PermissionSet": {
"prefix": "tpermset",
"body": [
"<PermissionSet RoleID=\"${1:roleId}\" RoleName=\"${2:roleName}\">",
"\t<Permission>",
"\t\t<ObjectType>${3|0,1,2,3,4,5,6,7,8,9,10,11|}</ObjectType>",
"\t\t<ObjectID>${4:objectId}</ObjectID>",
"\t\t<ReadPermission>${5|0,1|}</ReadPermission>",
"\t\t<InsertPermission>${6|0,1|}</InsertPermission>",
"\t\t<ModifyPermission>${7|0,1|}</ModifyPermission>",
"\t\t<DeletePermission>${8|0,1|}</DeletePermission>",
"\t\t<ExecutePermission>${9|0,1|}</ExecutePermission>",
"\t\t<SecurityFilter />",
"\t</Permission>",
"</PermissionSet>"
],
"description": "Snippet: Permission Set"
},
"Snippet: PermissionSets": {
"prefix": "tpermsets",
"body": [
"<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>",
"<PermissionSets>",
"\t<PermissionSet RoleID=\"${1:roleId}\" RoleName=\"${2:roleName}\">",
"\t\t<Permission>",
"\t\t\t<ObjectType>${3|0,1,2,3,4,5,6,7,8,9,10,11|}</ObjectType>",
"\t\t\t<ObjectID>${4:objectId}</ObjectID>",
"\t\t\t<ReadPermission>${5|0,1|}</ReadPermission>",
"\t\t\t<InsertPermission>${6|0,1|}</InsertPermission>",
"\t\t\t<ModifyPermission>${7|0,1|}</ModifyPermission>",
"\t\t\t<DeletePermission>${8|0,1|}</DeletePermission>",
"\t\t\t<ExecutePermission>${9|0,1|}</ExecutePermission>",
"\t\t\t<SecurityFilter />",
"\t\t</Permission>",
"\t</PermissionSet>",
"</PermissionSets>"
],
"description": "Snippet: Permission Sets File"
}
}