Skip to content

Commit

Permalink
Add new option for custom field identifiers and record types
Browse files Browse the repository at this point in the history
  • Loading branch information
Lixfeld committed Aug 8, 2021
1 parent 521f58f commit 5f6363c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,21 @@ Example:
}
}
```
### Tooltip descriptions
English and german tooltip descriptions for field and record types:
### Field identifiers and record types
**Select language and add custom descriptions or overwrite existing ones:**
File -> Preferences -> Settings -> Extensions -> GDT

**Tooltip descriptions**
English and german tooltip descriptions for field identifiers and record types:

![Tooltip_Screenshoot](https://github.com/Lixfeld/VSCode-GDT-Extension/raw/master/images/Tooltip.PNG)

The descriptions should load and update automatically for GDT files but you can also run the command manually.

**Select language:** File -> Preferences -> Settings -> Extensions -> GDT

### Fix length of line
A command to change the length of line variables (first three digits) to the actual line length **(including whitespaces) + 2** (*CR LF*).

### Display message
**Display message**
Show messsage with fields and descriptions in output channel:

![Output_channel_Screenshoot](https://github.com/Lixfeld/VSCode-GDT-Extension/raw/master/images/Output_channel.PNG)

### Fix length of line
A command to change the length of line variables (first three digits) to the actual line length **(including whitespaces) + 2** (*CR LF*).
18 changes: 17 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,23 @@
"default": "English",
"enum": ["German", "English"],
"description": "Language for field/tooltip descriptions"
}
},
"gdt.CustomRecordTypes": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"default": {},
"description": "Add new record types or overwrite existing ones"
},
"gdt.CustomFieldIdentifiers": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"default": {},
"description": "Add new field identifiers or overwrite existing ones"
}
}
}
},
Expand Down
12 changes: 12 additions & 0 deletions src/lib/LanguageDictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import * as EnglishDictionary from './EnglishDictionary';
const GDT = 'gdt';
const German = 'German';
const Language = 'Language';
const CustomRecordTypes = 'CustomRecordTypes';
const CustomFieldIdentifiers = 'CustomFieldIdentifiers';
export const RecordIdentification = '8000';

interface LanguageDictionary {
Expand All @@ -19,6 +21,11 @@ interface LanguageDictionary {
*/
export function GetFieldTypeDescription(key: string): string {
let languageDictionary = GetLanguageDictionary();
let customFieldIdentifiers = vscode.workspace.getConfiguration(GDT)[CustomFieldIdentifiers];

// Copy custom field identifiers and overwrite existing ones
Object.assign(languageDictionary.fieldIdentifiers, customFieldIdentifiers);

let fieldIdentifiers = languageDictionary.fieldIdentifiers;
return fieldIdentifiers[key];
}
Expand All @@ -28,6 +35,11 @@ export function GetFieldTypeDescription(key: string): string {
*/
export function GetRecordTypeDescription(key: string): string {
let languageDictionary = GetLanguageDictionary();
let customRecordTypes = vscode.workspace.getConfiguration(GDT)[CustomRecordTypes];

// Copy custom record types and overwrite existing ones
Object.assign(languageDictionary.recordTypes, customRecordTypes);

let recordTypes = languageDictionary.recordTypes;
return recordTypes[key];
}
Expand Down

0 comments on commit 5f6363c

Please # to comment.