Skip to content

Commit a60af82

Browse files
add tabular.data.createTableSchemaConfig option and support (#52)
1 parent 03ca60a commit a60af82

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@
178178
"type": "boolean",
179179
"default": true,
180180
"description": "Convert numeric and boolean data fields when parsing CSV data. Disable this option to speed up large datasets parsing and loading."
181+
},
182+
"tabular.data.createTableSchemaConfig": {
183+
"type": "boolean",
184+
"default": true,
185+
"description": "Create table *.schema.json configuration file when parsing CSV data."
181186
}
182187
}
183188
}

src/configuration/settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
*/
44
export enum Settings {
55
dataPageSize = 'pageSize',
6-
dynamicDataTyping = 'parser.dynamicTyping'
6+
dynamicDataTyping = 'parser.dynamicTyping',
7+
createTableSchemaConfig = 'createTableSchemaConfig'
78
}

src/views/tableView.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,7 @@ export class TableView {
436436
* @param tableSchema Table schema object to save.
437437
*/
438438
private async saveTableSchema(tableSchema: any): Promise<void> {
439-
if (tableSchema) {
440-
// TODO: add tabular.data.saveTableSchema boolean setting check
439+
if (tableSchema && this.createTableSchemaConfig) {
441440
// save updated table schema from tableschema infer call
442441
fileUtils.createJsonFile(this._fileInfo.tableSchemaFilePath, tableSchema);
443442
}
@@ -578,6 +577,13 @@ export class TableView {
578577
return <boolean>config.get(Settings.dynamicDataTyping);
579578
}
580579

580+
/**
581+
* Gets create table schema configuration setting for CSV data parsing.
582+
*/
583+
get createTableSchemaConfig(): boolean {
584+
return <boolean>config.get(Settings.createTableSchemaConfig);
585+
}
586+
581587
/**
582588
* Creates webview html content for the webview panel display.
583589
*

0 commit comments

Comments
 (0)