From 1ffaed8770122e04af782139316b437b9d6ca3fb Mon Sep 17 00:00:00 2001 From: Tobias Fenster Date: Tue, 27 Mar 2018 19:22:54 +0200 Subject: [PATCH] 3.1.0: include xlf conversion --- README.md | 7 ++++++- package.json | 9 +++++++-- src/extension.ts | 10 ++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e7c51ae..11fc64e 100644 --- a/README.md +++ b/README.md @@ -7,13 +7,14 @@ The third part of AL Runner gives you a quick and easy way to get started with t ## Features -Provides six commands: +Provides eight commands: - "ALRunner: Run selection" or Alt+R which runs the object in the currently selected line, if that is a page or report object - "ALRunner: Run object on first line" or Shift+Alt+R which runs the object on the first line of the current file, if that is a page or report object - "ALRunner: Publish and run selection" or Alt+P which publishes your extension and runs the object in the currently selected line, if that is a page object. Note: This changes your launch config - "ALRunner: Publish and run object on first line" or Shift+Alt+P which publishes your extension and runs the object on the first line of the current file, if that is a page object. Note: This changes your launch config - "ALRunner: Generate objects by parsing a JSON object from a URL" asks you for a URL, which should return a JSON file (authentication currently not supported) and then for the name of the entity represented by that JSON file. It then generates a table structured like the JSON file, a page showing that table and a codeunit with a function to refresh that data - "ALRunner: Generate objects by parsing a JSON object in the current selection" does the same as the previous command but uses the currently selected text as data for parsing. This als asks you for a URL, which is only used for generating the AL code do download data and then for the name of the entity represented by that JSON file. With this command you code download a JSON object using authentication and then put the result into VS Code, select the relevant part and let generation run. For nested objects you could do the same but would need to handle linking parent and child objects +- "ALRunner: Convert generated xlf to real one" takes a generated projectname.g.xlf file and copies the source tags into target tags so that the file becomes a valid xlf file. Keep in mind that this is really only the starting point for translating your extension - "ALRunner: Go API on Azure!" asks you to log in to your Azure account and select the subscription and resource group you want to use. It then uses an ARM template to create a Azure Container Instance for NAV 2018 with enabld Connect API and generates a sample client for it @@ -52,6 +53,10 @@ Provides six commands: Notes for the released versions +### 3.1.0 + +Add xlf conversion + ### 3.0.0 Add the ability to create a running Azure Container Instace for NAV 2018 with enabled Connect API and generate a sample client diff --git a/package.json b/package.json index 3ddb220..5255940 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "alrunner", "displayName": "ALRunner", - "description": "Can run AL objects", - "version": "3.0.0", + "description": "Can run AL objects and a bit more", + "version": "3.1.0", "publisher": "tfenster", "repository": "https://github.com/tfenster/ALRunner", "engines": { @@ -19,6 +19,7 @@ "onCommand:extension.generateObjectsFromURL", "onCommand:extension.generateObjectsFromEditor", "onCommand:extension.goAzure", + "onCommand:extension.convertXlf", "workspaceContains:initializeme.alrunner" ], "main": "./out/src/extension", @@ -51,6 +52,10 @@ { "command": "extension.goAzure", "title": "ALRunner: Go API on Azure!" + }, + { + "command": "extension.convertXlf", + "title": "ALRunner: Convert generated xlf to real one" } ], "keybindings": [ diff --git a/src/extension.ts b/src/extension.ts index 1c7c6ba..8daa431 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -47,6 +47,10 @@ export function activate(context: ExtensionContext) { alr.goAzure(); }); + let disp8 = commands.registerCommand('extension.convertXlf', () => { + alr.convertXlf(window.activeTextEditor); + }); + context.subscriptions.push(disp); context.subscriptions.push(disp2); context.subscriptions.push(disp3); @@ -54,6 +58,7 @@ export function activate(context: ExtensionContext) { context.subscriptions.push(disp5); context.subscriptions.push(disp6); context.subscriptions.push(disp7); + context.subscriptions.push(disp8); workspace.findFiles('initializeme.alrunner').then( r => { @@ -340,6 +345,11 @@ class ALRunner { } + public convertXlf(editor: TextEditor) { + var re = /(([^<]*)<\/source>)/; + this.generateAndOpenFile(editor.document.getText().replace(re, '$1\n\t\t\t\t\t$2')); + } + private DoGenerate(jsonText: string, entity: string, url: string) { let jsonObject = JSON.parse(jsonText);