mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 01:25:37 -05:00
Export to Markdown (#20661)
* Give saveAsExcel its own config options * Wired up correctly * Merge conflicts * PR comments 1 Co-authored-by: Ben Russell <russellben@microsoft.com>
This commit is contained in:
@@ -52,6 +52,10 @@ export class SaveResultAction extends Action {
|
||||
public static SAVEJSON_LABEL = localize('saveAsJson', "Save As JSON");
|
||||
public static SAVEJSON_ICON = 'saveJson';
|
||||
|
||||
public static SAVEMARKDOWN_ID = 'grid.saveAsMarkdown';
|
||||
public static SAVEMARKDOWN_LABEL = localize('saveAsMarkdown', "Save As Markdown");
|
||||
public static SAVEMARKDOWN_ICON = 'saveMarkdown';
|
||||
|
||||
public static SAVEEXCEL_ID = 'grid.saveAsExcel';
|
||||
public static SAVEEXCEL_LABEL = localize('saveAsExcel', "Save As Excel");
|
||||
public static SAVEEXCEL_ICON = 'saveExcel';
|
||||
|
||||
@@ -953,6 +953,7 @@ class GridTable<T> extends GridTableBase<T> {
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVECSV_ID, SaveResultAction.SAVECSV_LABEL, SaveResultAction.SAVECSV_ICON, SaveFormat.CSV),
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVEEXCEL_ID, SaveResultAction.SAVEEXCEL_LABEL, SaveResultAction.SAVEEXCEL_ICON, SaveFormat.EXCEL),
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVEJSON_ID, SaveResultAction.SAVEJSON_LABEL, SaveResultAction.SAVEJSON_ICON, SaveFormat.JSON),
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVEMARKDOWN_ID, SaveResultAction.SAVEMARKDOWN_LABEL, SaveResultAction.SAVEMARKDOWN_ICON, SaveFormat.MARKDOWN),
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVEXML_ID, SaveResultAction.SAVEXML_LABEL, SaveResultAction.SAVEXML_ICON, SaveFormat.XML),
|
||||
this.instantiationService.createInstance(ChartDataAction)
|
||||
);
|
||||
@@ -969,6 +970,7 @@ class GridTable<T> extends GridTableBase<T> {
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVECSV_ID, SaveResultAction.SAVECSV_LABEL, SaveResultAction.SAVECSV_ICON, SaveFormat.CSV),
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVEEXCEL_ID, SaveResultAction.SAVEEXCEL_LABEL, SaveResultAction.SAVEEXCEL_ICON, SaveFormat.EXCEL),
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVEJSON_ID, SaveResultAction.SAVEJSON_LABEL, SaveResultAction.SAVEJSON_ICON, SaveFormat.JSON),
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVEMARKDOWN_ID, SaveResultAction.SAVEMARKDOWN_LABEL, SaveResultAction.SAVEMARKDOWN_ICON, SaveFormat.MARKDOWN),
|
||||
this.instantiationService.createInstance(SaveResultAction, SaveResultAction.SAVEXML_ID, SaveResultAction.SAVEXML_LABEL, SaveResultAction.SAVEXML_ICON, SaveFormat.XML),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -287,6 +287,14 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
handler: gridCommands.saveAsJson
|
||||
});
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GRID_SAVEMARKDOWN_ID,
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
when: ResultsGridFocusCondition,
|
||||
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyR, KeyMod.CtrlCmd | KeyCode.KeyM),
|
||||
handler: gridCommands.saveAsMarkdown
|
||||
});
|
||||
|
||||
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
||||
id: gridActions.GRID_SAVEEXCEL_ID,
|
||||
weight: KeybindingWeight.EditorContrib,
|
||||
@@ -384,6 +392,21 @@ const queryEditorConfiguration: IConfigurationNode = {
|
||||
'description': localize('queryEditor.results.saveAsCsv.encoding', "File encoding used when saving results as CSV"),
|
||||
'default': 'utf-8'
|
||||
},
|
||||
'queryEditor.results.saveAsMarkdown.encoding': {
|
||||
'type': 'string',
|
||||
'description': localize('queryEditor.results.saveAsMarkdown.encoding', "File encoding used when saving results as Markdown"),
|
||||
'default': 'utf-8'
|
||||
},
|
||||
'queryEditor.results.saveAsMarkdown.includeHeaders': {
|
||||
'type': 'boolean',
|
||||
'description': localize('queryEditor.results.saveAsMarkdown.includeHeaders', "When true, column headers are included when saving results as a Markdown file"),
|
||||
'default': true
|
||||
},
|
||||
'queryEditor.results.saveAsMarkdown.lineSeparator': {
|
||||
'type': 'string',
|
||||
'description': localize('queryEditor.results.saveAsMarkdown.lineSeparator', "Character(s) to use to separate lines when exporting to Markdown, defaults to system line endings"),
|
||||
'default': null
|
||||
},
|
||||
'queryEditor.results.saveAsXml.formatted': {
|
||||
'type': 'boolean',
|
||||
'description': localize('queryEditor.results.saveAsXml.formatted', "When true, XML output will be formatted when saving results as XML"),
|
||||
|
||||
Reference in New Issue
Block a user