Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #17 from HugoOM/Fix_XMLSupportForAuraCmp
Browse files Browse the repository at this point in the history
Fix: Added xml support for aura cmp
  • Loading branch information
HugoOM committed Jun 7, 2019
2 parents ac75169 + 932c8ca commit 67bffcf
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
- File header update regardless of settings (for header inserted through command)
- Finer grain tuning of the method header tags through settings

## [0.5.2]

- Added support for XML language binding under Aura .cmp files

## [0.5.1]

- Fixed an issue where two spaces would be added between a param type and it's name, for method headers
Expand Down
15 changes: 13 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "sfdx-autoheader",
"displayName": "Salesforce Documenter",
"description": "Automated Code Documentation Generation for Salesforce",
"version": "0.5.1",
"version": "0.5.2",
"publisher": "HugoOM",
"license": "MIT",
"badges": [
Expand Down Expand Up @@ -42,7 +42,8 @@
"onLanguage:apex",
"onLanguage:visualforce",
"onLanguage:javascript",
"onLanguage:html"
"onLanguage:html",
"onLanguage:xml"
],
"main": "./out/documenter.js",
"contributes": {
Expand Down Expand Up @@ -72,6 +73,11 @@
"command": "extension.insertFileHeader",
"group": "SFDoc",
"when": "editorLangId == javascript"
},
{
"command": "extension.insertFileHeader",
"group": "SFDoc",
"when": "editorLangId == xml"
}
],
"commandPalette": [
Expand Down Expand Up @@ -99,6 +105,11 @@
"command": "extension.insertFileHeader",
"group": "SFDoc",
"when": "editorLangId == javascript"
},
{
"command": "extension.insertFileHeader",
"group": "SFDoc",
"when": "editorLangId == xml"
}
]
},
Expand Down
6 changes: 5 additions & 1 deletion src/extension/documenter.file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default class FileDocumenter {
if (languageId === "visualforce") return true;
if (languageId === "html") return true;
if (languageId === "javascript") return true;
if (languageId === "xml") return true;

return false;
}
Expand Down Expand Up @@ -167,14 +168,17 @@ export default class FileDocumenter {
if (lang === "html")
return enabledForLightMarkup && this.isLightning(document);

if (lang === "xml")
return enabledForLightMarkup && this.isLightning(document);

if (lang === "javascript")
return enabledForLightningJavaScript && this.isLightning(document);

return false;
}

private isLightning(document: TextDocument): boolean {
const validExtensions: string[] = ["htm", "html", "cmp", "js"];
const validExtensions: string[] = ["htm", "html", "cmp", "js", "xml"];
const validSalesforceFolderNames = ["aura", "lwc"];
const pathTokens = document.uri.path.split("/");
const folderName = pathTokens[pathTokens.length - 2];
Expand Down
14 changes: 14 additions & 0 deletions src/templates/templates.file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ module.exports = {
==============================================================================
1.0 ${currentTime} ${userName} Initial Version
-->
`,
xml: (fileName: string, userName: string, currentTime: string) => `<!--
@Component Name : ${fileName}
@Description :
@Author : ${userName}
@Group :
@Last Modified By : ${userName}
@Last Modified On : ${currentTime}
@Modification Log :
==============================================================================
Ver Date Author Modification
==============================================================================
1.0 ${currentTime} ${userName} Initial Version
-->
`,
javascript: (fileName: string, userName: string, currentTime: string) => `/**
* @File Name : ${fileName}
Expand Down

0 comments on commit 67bffcf

Please sign in to comment.