|
1 | 1 | #!/bin/sh |
2 | | -python3 get-extension-settings.py <$1/integration/vscode/ada/package.json | grep ^ada. | sort >pkg.txt |
3 | | -grep '^### ' $1/doc/settings.md | sed -e 's/..../ada./' | sort >doc.txt |
| 2 | + |
| 3 | +# Fail at the first error |
| 4 | +set -e |
| 5 | + |
| 6 | +# Collect settings from package.json and remove 'ada.' prefix |
| 7 | +python3 get-extension-settings.py <"$1/integration/vscode/ada/package.json" | grep ^ada. | sed -e 's/ada\.//' | sort >pkg.txt |
| 8 | + |
| 9 | +# Collect settings from documentation |
| 10 | +grep '^### ' "$1/doc/settings.md" | sed -e 's/....//' | sort >doc.txt |
| 11 | + |
| 12 | +# Collect settings from the JSON schema for .als.json files |
| 13 | +python3 get-schema-properties.py <"$1/integration/vscode/ada/schemas/als-settings-schema.json" >schema.txt |
| 14 | + |
| 15 | +# Collect settings read in the ALS implementation |
| 16 | +grep 'if Name = "[^"]\+"' "$1/source/ada/lsp-ada_configurations.adb" | sed -e 's/.*"\([^"]\+\)"/\1/' >impl.txt |
| 17 | +# Remove the following settings from the implementation list because they are |
| 18 | +# either hidden, or nested |
| 19 | +exclude="logThreshold onTypeFormatting indentOnly" |
| 20 | +for exc in $exclude; do |
| 21 | + echo "$(grep -v "$exc" <impl.txt)" >impl.txt |
| 22 | +done |
| 23 | +# Add the following properties because they are nested |
| 24 | +add="onTypeFormatting.indentOnly" |
| 25 | +for a in $add; do |
| 26 | + echo "$a" >>impl.txt |
| 27 | +done |
| 28 | +# Sort the list |
| 29 | +echo "$(sort <impl.txt)" >impl.txt |
| 30 | + |
| 31 | +# Check that all VS Code settings are documented |
4 | 32 | diff -u pkg.txt doc.txt |
| 33 | + |
| 34 | +# The ada.trace.server setting exists only in VS Code and not in .als.json |
| 35 | +# files. So remove it before the comparison. |
| 36 | +# |
| 37 | +# We need to use a subshell because it's not allowed to read and write the same |
| 38 | +# file in one pipeline |
| 39 | +# echo "$(grep -v trace.server <doc.txt)" >doc.txt |
| 40 | +echo "$(grep -v trace.server <doc.txt)" >doc.txt |
| 41 | + |
| 42 | +# Check that all implemented settings are documented |
| 43 | +diff -u impl.txt doc.txt |
| 44 | + |
| 45 | +# Check that all implemented settings are defined in the JSON Schema |
| 46 | +diff -u impl.txt schema.txt |
| 47 | + |
| 48 | +# Check that all settings defined in the JSON Schema are documented |
| 49 | +diff -u schema.txt doc.txt |
0 commit comments