Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
Fix documentation fragment processing (#4)
Browse files Browse the repository at this point in the history
Implementation expected an array for `extends_documentation_fragment`.
Now it also accepts a singular element in YAML flow style.
  • Loading branch information
tomaciazek authored Jul 15, 2021
1 parent 69a0bec commit 18a2a7f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@ All notable changes to the Ansible VS Code extension will be documented in this
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.1] - 2021-07-15
### Fixed
- Documentation fragments are now also correctly processed in case only one is
provided, using YAML flow style. The `file` module is a prominent example.

## [1.0.0] - 2021-07-14
- Initial release
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Ansible language support",
"author": "Tomasz Maciążek",
"license": "MIT",
"version": "1.0.0",
"version": "1.0.1",
"repository": {
"type": "git",
"url": "https://github.com/tomaciazek/vscode-ansible.git"
Expand Down
10 changes: 6 additions & 4 deletions server/src/utils/docsParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ export function processDocumentationFragments(
): void {
module.fragments = [];
if (
hasOwnProperty(module.rawDocumentation, 'extends_documentation_fragment') &&
module.rawDocumentation.extends_documentation_fragment instanceof Array
hasOwnProperty(module.rawDocumentation, 'extends_documentation_fragment')
) {
const docFragmentNames =
module.rawDocumentation.extends_documentation_fragment instanceof Array
? module.rawDocumentation.extends_documentation_fragment
: [module.rawDocumentation.extends_documentation_fragment];
const resultContents = {};
for (const docFragmentName of module.rawDocumentation
.extends_documentation_fragment) {
for (const docFragmentName of docFragmentNames) {
const docFragment =
docFragments.get(docFragmentName) ||
docFragments.get(`ansible.builtin.${docFragmentName}`);
Expand Down

0 comments on commit 18a2a7f

Please sign in to comment.