Skip to content

Commit 0c5e25f

Browse files
committed
Change endianness setting type to string
1 parent 39355e6 commit 0c5e25f

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ Default values are bolded.
4545
| **"size"** | Size with 3 decimal places (if a unit is bigger than byte). |
4646

4747
- `hexinspector.endianness`
48-
Indentifier | Description |
48+
| Indentifier | Description |
4949
|----------------|---------------|
50-
| **true** | Little Endian |
51-
| false | Big Endian |
50+
| **little** | Little Endian |
51+
| **big** | Big Endian |
5252

5353

5454
## License

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
]
5151
},
5252
"hexinspector.endianness": {
53-
"type": "boolean",
54-
"default": true,
55-
"description": "Little Endian (true) or Big Endian (false)?"
53+
"type": "string",
54+
"default": "little",
55+
"description": "Little Endian or Big Endian?"
5656
}
5757
}
5858
},

src/extension.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ export function activate(context: vscode.ExtensionContext) {
1010

1111
let inputDataTypes: string[] = vscode.workspace.getConfiguration('hexinspector').get('inputDataTypes');
1212
let forms: string[] = vscode.workspace.getConfiguration('hexinspector').get('hoverContent');
13-
let littleEndian: boolean = vscode.workspace.getConfiguration('hexinspector').get('endianness');
13+
let endianness: string = vscode.workspace.getConfiguration('hexinspector').get('endianness');
14+
15+
endianness = endianness.charAt(0).toUpperCase() + endianness.slice(1).toLowerCase() + ' Endian';
1416

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

31-
bytes = inputHandler.convert(parsed, littleEndian);
33+
bytes = inputHandler.convert(parsed, endianness == 'Little Endian');
3234
formsMap = inputHandler.getFormsMap();
3335
}
3436

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

4143
if (bytes) {
4244
let length = bytes.length;
43-
let endianness = (littleEndian ? 'Little' : 'Big') + ' Endian';
44-
4545
let message = 'HexInspector: ' + word + ' (' + length + 'B)\n\n';
4646
for (let form of forms) {
4747
if (!(form in formsMap))

0 commit comments

Comments
 (0)