Skip to content

Commit 5467b77

Browse files
committed
MRS SQL Changes
Change-Id: I1803584f8d3222d3f3007702e81e5e9cbb0e405c
1 parent 3fee144 commit 5467b77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2196
-2008
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION=1.13.5
1+
VERSION=1.13.6

gui/backend/gui_plugin/general.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from mysqlsh.plugin_manager import plugin_function
2323

2424
# Define plugin version
25-
VERSION = "1.13.5"
25+
VERSION = "1.13.6"
2626

2727
@plugin_function('gui.info', shell=True, cli=True, web=True)
2828
def info():

gui/extension/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# MySQL Shell for VS Code Change Log
22

3+
## Changes in 1.13.6+8.1.1
4+
5+
### Fixes
6+
7+
- Improved language switching of code blocks on DB Notebook
8+
- Updated MRS SQL grammar with new, improved syntax
9+
- Replaced MRS SQL @REDUCETO() decorator with @UNNEST for 1:n references
10+
311
## Changes in 1.13.5+8.1.1
412

513
### Fixes

gui/extension/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MySQL Shell for VS Code 1.13.5+8.1.1 Preview
1+
# MySQL Shell for VS Code 1.13.6+8.1.1 Preview
22

33
This extension enables interactive editing and execution of SQL for MySQL Databases and the MySQL HeatWave Service. It integrates the MySQL Shell directly into VS Code development workflows.
44

gui/extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"color": "#2789e1",
88
"theme": "dark"
99
},
10-
"version": "1.13.5",
10+
"version": "1.13.6",
1111
"publisher": "Oracle",
1212
"license": "SEE LICENSE IN LICENSE.txt",
1313
"repository": {

gui/extension/src/web-views/DBConnectionViewProvider.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ export class DBConnectionViewProvider extends WebviewProvider {
4545
*/
4646
public readonly currentSchemas = new Map<number, string>();
4747

48+
#lastNotebookUri?: Uri;
49+
4850
/**
4951
* Shows the given module page.
5052
*
@@ -348,6 +350,7 @@ export class DBConnectionViewProvider extends WebviewProvider {
348350
this.requisitions.register("closeInstance", this.closeInstance);
349351
this.requisitions.register("showInfo", this.showInfo);
350352
this.requisitions.register("editorSaveNotebook", this.editorSaveNotebook);
353+
this.requisitions.register("editorSaveNotebookInPlace", this.editorSaveNotebookInPlace);
351354
this.requisitions.register("editorLoadNotebook", this.editorLoadNotebook);
352355
this.requisitions.register("showOpenDialog", this.showOpenDialog);
353356
this.requisitions.register("sqlSetCurrentSchema", this.setCurrentSchema);
@@ -423,15 +426,46 @@ export class DBConnectionViewProvider extends WebviewProvider {
423426
};
424427

425428
void window.showSaveDialog(dialogOptions).then((uri: Uri) => {
426-
const path = uri.fsPath;
429+
if (uri !== undefined) {
430+
this.#lastNotebookUri = uri;
431+
432+
const path = uri.fsPath;
433+
writeFile(path, content).then(() => {
434+
window.setStatusBarMessage(`DB Notebook saved to ${path}`, 5000);
435+
436+
return resolve(true);
437+
}).catch(() => {
438+
void window.showErrorMessage(`Could not save notebook to ${path}.`);
439+
440+
return resolve(false);
441+
});
442+
} else {
443+
return resolve(false);
444+
}
445+
});
446+
} else {
447+
return resolve(false);
448+
}
449+
});
450+
};
451+
452+
private editorSaveNotebookInPlace = (content?: string): Promise<boolean> => {
453+
return new Promise((resolve) => {
454+
if (content) {
455+
if (this.#lastNotebookUri === undefined) {
456+
void this.editorSaveNotebook(content);
457+
} else {
458+
const path = this.#lastNotebookUri.fsPath;
427459
writeFile(path, content).then(() => {
460+
window.setStatusBarMessage(`DB Notebook saved to ${path}`, 5000);
461+
428462
return resolve(true);
429463
}).catch(() => {
430464
void window.showErrorMessage(`Could not save notebook to ${path}.`);
431465

432466
return resolve(false);
433467
});
434-
});
468+
}
435469
} else {
436470
return resolve(false);
437471
}
@@ -463,6 +497,7 @@ export class DBConnectionViewProvider extends WebviewProvider {
463497

464498
void window.showOpenDialog(dialogOptions).then((paths?: Uri[]) => {
465499
if (paths && paths.length > 0) {
500+
this.#lastNotebookUri = paths[0];
466501
const path = paths[0].fsPath;
467502
readFile(path, { encoding: "utf-8" }).then((content) => {
468503
this.requisitions?.executeRemote("editorLoadNotebook", { content, standalone: false });

gui/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mysql-shell-gui",
3-
"version": "1.13.5",
3+
"version": "1.13.6",
44
"publisher": "Oracle",
55
"type": "module",
66
"scripts": {

gui/frontend/src/components/Theming/assets/default-dark-color-theme.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,8 +1284,8 @@
12841284
{
12851285
"scope": "command",
12861286
"settings": {
1287-
"foreground": "#dadfbd",
1288-
"fontStyle": "bold underline"
1287+
"foreground": "#db8f00",
1288+
"fontStyle": ""
12891289
}
12901290
}
12911291
]

gui/frontend/src/components/Theming/assets/default-light-color-theme.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,8 +1215,8 @@
12151215
{
12161216
"scope": "command",
12171217
"settings": {
1218-
"foreground": "#7f8464",
1219-
"fontStyle": "bold underline"
1218+
"foreground": "#db8f00",
1219+
"fontStyle": ""
12201220
}
12211221
}
12221222
]

gui/frontend/src/components/ui/CodeEditor/CodeCompletionProvider.ts

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -222,62 +222,6 @@ export class CodeCompletionProvider implements languages.CompletionItemProvider
222222

223223
default: {
224224
return [
225-
{
226-
label: "\\sql",
227-
kind: languages.CompletionItemKind.Keyword,
228-
range,
229-
insertText: "\\sql",
230-
detail: "Command to switch the editor to SQL mode",
231-
},
232-
{
233-
label: "\\ts",
234-
kind: languages.CompletionItemKind.Keyword,
235-
range,
236-
insertText: "\\ts",
237-
detail: "Command to switch the editor to TypeScript mode",
238-
},
239-
{
240-
label: "\\typescript",
241-
kind: languages.CompletionItemKind.Keyword,
242-
range,
243-
insertText: "\\typescript",
244-
detail: "Command to switch the editor to TypeScript mode",
245-
},
246-
{
247-
label: "\\js",
248-
kind: languages.CompletionItemKind.Keyword,
249-
range,
250-
insertText: "\\js",
251-
detail: "Command to switch the editor to JavaScript mode",
252-
},
253-
{
254-
label: "\\javascript",
255-
kind: languages.CompletionItemKind.Keyword,
256-
range,
257-
insertText: "\\javascript",
258-
detail: "Command to switch the editor to JavaScript mode",
259-
},
260-
{
261-
label: "\\?",
262-
kind: languages.CompletionItemKind.Keyword,
263-
range,
264-
insertText: "\\?",
265-
detail: "Command to show some help information",
266-
},
267-
{
268-
label: "\\help",
269-
kind: languages.CompletionItemKind.Keyword,
270-
range,
271-
insertText: "\\help",
272-
detail: "Command to show some help information",
273-
},
274-
{
275-
label: "\\h",
276-
kind: languages.CompletionItemKind.Keyword,
277-
range,
278-
insertText: "\\h",
279-
detail: "Command to show some help information",
280-
},
281225
{
282226
label: "\\about",
283227
kind: languages.CompletionItemKind.Keyword,

gui/frontend/src/components/ui/CodeEditor/CodeEditor.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
display: block;
155155

156156
margin-left: 13px;
157+
padding-top: 1px;
157158

158159
font-size: 0.9rem;
159160

@@ -209,6 +210,7 @@
209210
display: block;
210211

211212
margin-left: 13px;
213+
padding-top: 1px;
212214

213215
font-size: 0.9rem;
214216

@@ -264,6 +266,7 @@
264266
content: "sql>";
265267
display: block;
266268
margin-left: 4px;
269+
padding-top: 1px;
267270
font-size: 0.9rem;
268271
color: var(--editorPrompt-primary-sql);
269272
}
@@ -377,7 +380,7 @@
377380
height: 4px;
378381

379382
right: 4px;
380-
top: 50%;
383+
top: calc(50% - 1px);
381384
background: #0096FF;
382385
}
383386

gui/frontend/src/components/ui/CodeEditor/CodeEditor.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ export class CodeEditor extends ComponentBase<ICodeEditorProperties> {
321321
const compilerOptions: languages.typescript.CompilerOptions = {
322322
allowNonTsExtensions: true,
323323
target: languages.typescript.ScriptTarget.ESNext,
324-
lib: ["esnext"],
325324
module: languages.typescript.ModuleKind.ESNext,
326325
strictNullChecks: true,
327326
};
@@ -1036,6 +1035,28 @@ export class CodeEditor extends ComponentBase<ICodeEditorProperties> {
10361035
precondition,
10371036
}));
10381037

1038+
this.disposables.push(editor.addAction({
1039+
id: "saveAs",
1040+
label: "Save As ...",
1041+
contextMenuGroupId: "10_save",
1042+
keybindings: [KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.KeyS],
1043+
run: () => {
1044+
void requisitions.execute("editorSaveNotebook", undefined);
1045+
},
1046+
precondition,
1047+
}));
1048+
1049+
this.disposables.push(editor.addAction({
1050+
id: "save",
1051+
label: "Save",
1052+
contextMenuGroupId: "10_save",
1053+
keybindings: [KeyMod.CtrlCmd | KeyCode.KeyS],
1054+
run: () => {
1055+
void requisitions.execute("editorSaveNotebook", "viaKeyboardShortcut");
1056+
},
1057+
precondition,
1058+
}));
1059+
10391060
this.disposables.push(editor.addAction({
10401061
id: "acceptSuggestion",
10411062
label: "Accept Selected Suggestion",

gui/frontend/src/modules/db-editor/DBConnectionTab.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,10 +872,12 @@ Execute \\help or \\? for help;`;
872872
* This can either be handled by the browser (not allowing to specify a target path) or by the host application
873873
* which has more freedom to allow the user to select a target path.
874874
*
875+
* @param source If set to "viaKeyboardShortcut" the requisition was sent from a keyboard shortcut
876+
*
875877
* @returns A promise that resolves to true if the notebook was saved, false if the request could not be fulfilled.
876878
*
877879
*/
878-
private editorSaveNotebook = async (): Promise<boolean> => {
880+
private editorSaveNotebook = async (source?: string): Promise<boolean> => {
879881
const openState = this.findActiveEditor();
880882

881883
if (openState) {
@@ -900,7 +902,11 @@ Execute \\help or \\? for help;`;
900902
}, 4);
901903

902904
if (appParameters.embedded) {
903-
requisitions.executeRemote("editorSaveNotebook", text);
905+
if (source === undefined) {
906+
requisitions.executeRemote("editorSaveNotebook", text);
907+
} else {
908+
requisitions.executeRemote("editorSaveNotebookInPlace", text);
909+
}
904910
} else {
905911
// TODO: make the file name configurable.
906912
const { caption } = this.props;

0 commit comments

Comments
 (0)