Skip to content

Commit

Permalink
Change endianness setting type to string
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszchudyk committed Aug 9, 2022
1 parent 39355e6 commit 0c5e25f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ Default values are bolded.
| **"size"** | Size with 3 decimal places (if a unit is bigger than byte). |

- `hexinspector.endianness`
Indentifier | Description |
| Indentifier | Description |
|----------------|---------------|
| **true** | Little Endian |
| false | Big Endian |
| **little** | Little Endian |
| **big** | Big Endian |


## License
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
]
},
"hexinspector.endianness": {
"type": "boolean",
"default": true,
"description": "Little Endian (true) or Big Endian (false)?"
"type": "string",
"default": "little",
"description": "Little Endian or Big Endian?"
}
}
},
Expand Down
8 changes: 4 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export function activate(context: vscode.ExtensionContext) {

let inputDataTypes: string[] = vscode.workspace.getConfiguration('hexinspector').get('inputDataTypes');
let forms: string[] = vscode.workspace.getConfiguration('hexinspector').get('hoverContent');
let littleEndian: boolean = vscode.workspace.getConfiguration('hexinspector').get('endianness');
let endianness: string = vscode.workspace.getConfiguration('hexinspector').get('endianness');

endianness = endianness.charAt(0).toUpperCase() + endianness.slice(1).toLowerCase() + ' Endian';

if (inputDataTypes.length == 0 || forms.length == 0) {
return undefined;
Expand All @@ -28,7 +30,7 @@ export function activate(context: vscode.ExtensionContext) {
if (!parsed)
continue;

bytes = inputHandler.convert(parsed, littleEndian);
bytes = inputHandler.convert(parsed, endianness == 'Little Endian');
formsMap = inputHandler.getFormsMap();
}

Expand All @@ -40,8 +42,6 @@ export function activate(context: vscode.ExtensionContext) {

if (bytes) {
let length = bytes.length;
let endianness = (littleEndian ? 'Little' : 'Big') + ' Endian';

let message = 'HexInspector: ' + word + ' (' + length + 'B)\n\n';
for (let form of forms) {
if (!(form in formsMap))
Expand Down

0 comments on commit 0c5e25f

Please sign in to comment.