Skip to content

Commit 515e289

Browse files
authored
Improve schema designer tool post-open steering (#21478)
* Improve schema designer tool post-open steering * Remove unused showSchemaToolSuccessMessage constant * Use placeholders for schema designer tool identifiers in localized message
1 parent b032adb commit 515e289

5 files changed

Lines changed: 41 additions & 7 deletions

File tree

extensions/mssql/l10n/bundle.l10n.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2646,7 +2646,14 @@
26462646
"comment": ["{0} is the connection ID"]
26472647
},
26482648
"Unknown Connection": "Unknown Connection",
2649-
"Schema visualization opened.": "Schema visualization opened.",
2649+
"Schema designer opened. For schema mutations, continue with {0} operations ({1}/{2})./{0} is the command identifier 'mssql_schema_designer' and must not be translated{1} is the operation name 'get_overview' and must not be translated{2} is the operation name 'apply_edits' and must not be translated": {
2650+
"message": "Schema designer opened. For schema mutations, continue with {0} operations ({1}/{2}).",
2651+
"comment": [
2652+
"{0} is the command identifier 'mssql_schema_designer' and must not be translated",
2653+
"{1} is the operation name 'get_overview' and must not be translated",
2654+
"{2} is the operation name 'apply_edits' and must not be translated"
2655+
]
2656+
},
26502657
"Execute '{0}' operation on the schema designer?/{0} is the operation name": {
26512658
"message": "Execute '{0}' operation on the schema designer?",
26522659
"comment": ["{0} is the operation name"]

extensions/mssql/src/constants/locConstants.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,16 @@ export class MssqlChatAgent {
20212021
});
20222022
};
20232023
public static unknownConnection = l10n.t("Unknown Connection");
2024-
public static showSchemaToolSuccessMessage = l10n.t("Schema visualization opened.");
2024+
public static schemaDesignerToolShowSuccessMessage = l10n.t({
2025+
message:
2026+
"Schema designer opened. For schema mutations, continue with {0} operations ({1}/{2}).",
2027+
args: ["mssql_schema_designer", "get_overview", "apply_edits"],
2028+
comment: [
2029+
"{0} is the command identifier 'mssql_schema_designer' and must not be translated",
2030+
"{1} is the operation name 'get_overview' and must not be translated",
2031+
"{2} is the operation name 'apply_edits' and must not be translated",
2032+
],
2033+
});
20252034
public static schemaDesignerToolConfirmationTitle = l10n.t("Schema Designer");
20262035
public static schemaDesignerToolConfirmationMessage = (operation: string) => {
20272036
return l10n.t({

extensions/mssql/src/copilot/tools/schemaDesignerTool.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,15 @@ export class SchemaDesignerTool extends ToolBase<SchemaDesignerToolParams> {
295295
withTarget(
296296
{
297297
success: true,
298-
message: loc.showSchemaToolSuccessMessage,
298+
message: loc.schemaDesignerToolShowSuccessMessage,
299299
version,
300+
recommendedTool: this.toolName,
301+
recommendedNextCall: {
302+
operation: "get_overview",
303+
options: { includeColumns: "namesAndTypes" },
304+
},
305+
schemaMutationPath:
306+
"use apply_edits for schema mutations in active designer",
300307
},
301308
designer,
302309
),

extensions/mssql/test/unit/schemaDesignerTool.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,16 @@ suite("SchemaDesignerTool Tests", () => {
255255
const parsedResult = JSON.parse(result);
256256

257257
expect(parsedResult.success).to.be.true;
258-
expect(parsedResult.message).to.equal(loc.showSchemaToolSuccessMessage);
258+
expect(parsedResult.message).to.equal(loc.schemaDesignerToolShowSuccessMessage);
259259
expect(parsedResult.version).to.equal(computeSchemaVersion(mockSchema));
260+
expect(parsedResult.recommendedTool).to.equal("mssql_schema_designer");
261+
expect(parsedResult.recommendedNextCall).to.deep.equal({
262+
operation: "get_overview",
263+
options: { includeColumns: "namesAndTypes" },
264+
});
265+
expect(parsedResult.schemaMutationPath).to.equal(
266+
"use apply_edits for schema mutations in active designer",
267+
);
260268
expect(parsedResult.server).to.equal(sampleServer);
261269
expect(parsedResult.database).to.equal(sampleDatabase);
262270
expect(showSchemaStub).to.have.been.calledOnceWith(sampleConnectionId, sampleDatabase);

localization/xliff/vscode-mssql.xlf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5180,6 +5180,12 @@
51805180
<trans-unit id="++CODE++bcfd627eae48fe0460c71c47de6ce52a35780136e70593d6f17da5f3ba3ec894">
51815181
<source xml:lang="en">Schema designer is not initialized.</source>
51825182
</trans-unit>
5183+
<trans-unit id="++CODE++bb752783460568a627729df83424ba6dc42ba33b3a2ba1a4573572d03d801b77">
5184+
<source xml:lang="en">Schema designer opened. For schema mutations, continue with {0} operations ({1}/{2}).</source>
5185+
<note>{0} is the command identifier &apos;mssql_schema_designer&apos; and must not be translated
5186+
{1} is the operation name &apos;get_overview&apos; and must not be translated
5187+
{2} is the operation name &apos;apply_edits&apos; and must not be translated</note>
5188+
</trans-unit>
51835189
<trans-unit id="++CODE++fcc1609bd956a758207d72b215d69f60b29e8624fe879bf9ff721384783cc455">
51845190
<source xml:lang="en">Schema designer state changed. Fetch the latest schema and retry the operation.</source>
51855191
</trans-unit>
@@ -5192,9 +5198,6 @@
51925198
<trans-unit id="++CODE++c55acbc843338cecc106d5428a6c2c6cd65129c6b5c440b6477f06206d844ded">
51935199
<source xml:lang="en">Schema is required</source>
51945200
</trans-unit>
5195-
<trans-unit id="++CODE++625f64194868ec34a2b8b5b02385d3999fc9cdddbb2e823e10a1d965574d8e6c">
5196-
<source xml:lang="en">Schema visualization opened.</source>
5197-
</trans-unit>
51985201
<trans-unit id="++CODE++26336e4216dbda9c374906c54ade398c597b59facd87fba0be1758fc497bde2a">
51995202
<source xml:lang="en">Schema/Object Type</source>
52005203
</trans-unit>

0 commit comments

Comments
 (0)