QueryEvent range -> batchRanges (#19890)

* Switch query events to just send ranges instead of full query text

* undo azdata changes

* fix type

* comment + remove unneeded ?

* range -> batchRanges

* undo
This commit is contained in:
Charles Gagnon
2022-06-29 11:28:09 -07:00
committed by GitHub
parent f3b40059fc
commit bb20ea0e92
5 changed files with 15 additions and 15 deletions

View File

@@ -36,7 +36,7 @@ export class QueryHistoryProvider implements vscode.TreeDataProvider<QueryHistor
return;
}
// Combine all the text from the batches back together
const queryText = queryInfo.range.map(r => textDocument.getText(r) ?? '').join(EOL);
const queryText = queryInfo.batchRanges.map(r => textDocument.getText(r) ?? '').join(EOL);
const connProfile = await azdata.connection.getConnection(document.uri);
const isError = queryInfo.messages.find(m => m.isError) ? false : true;
// Add to the front of the list so the new item appears at the top

View File

@@ -1568,7 +1568,7 @@ declare module 'azdata' {
/**
* The ranges for each batch that has executed so far
*/
range: vscode.Range[];
batchRanges: vscode.Range[];
}
export interface QueryEventListener {

View File

@@ -15,7 +15,7 @@ export namespace QueryInfo {
}
return {
messages: queryInfo.messages,
range: queryInfo.range.map(r => typeConverters.Range.to(r))
batchRanges: queryInfo.batchRanges.map(r => typeConverters.Range.to(r))
};
}
}

View File

@@ -38,7 +38,7 @@ export interface IExecutionPlanInfo {
}
export interface IQueryInfo {
range: IRange[];
batchRanges: IRange[];
messages: IQueryMessage[];
}

View File

@@ -36,7 +36,7 @@ export class QueryInfo {
public queryRunner?: EditQueryRunner;
public dataService?: DataService;
public queryEventQueue: QueryEvent[] = [];
public range: Array<IRange> = [];
public batchRanges: Array<IRange> = [];
public selectionSnippet?: string;
// Notes if the angular components have obtained the DataService. If not, all messages sent
@@ -228,7 +228,7 @@ export class QueryModelService implements IQueryModelService {
// If the query is not in progress, we can reuse the query runner
queryRunner = existingRunner!;
info.range = [];
info.batchRanges = [];
info.selectionSnippet = undefined;
} else {
// We do not have a query runner for this editor, so create a new one
@@ -271,7 +271,7 @@ export class QueryModelService implements IQueryModelService {
text: strings.format(nls.localize('runQueryBatchStartLine', "Line {0}"), b.range.startLineNumber)
};
}
info.range.push(b.range);
info.batchRanges.push(b.range);
}
let message = {
message: messageText,
@@ -293,7 +293,7 @@ export class QueryModelService implements IQueryModelService {
uri: queryRunner.uri,
queryInfo:
{
range: info.range,
batchRanges: info.batchRanges,
messages: info.queryRunner!.messages
}
};
@@ -311,7 +311,7 @@ export class QueryModelService implements IQueryModelService {
uri: queryRunner.uri,
queryInfo:
{
range: info.range,
batchRanges: info.batchRanges,
messages: info.queryRunner!.messages
}
};
@@ -327,7 +327,7 @@ export class QueryModelService implements IQueryModelService {
uri: queryRunner.uri,
queryInfo:
{
range: info.range,
batchRanges: info.batchRanges,
messages: info.queryRunner!.messages
}
};
@@ -343,7 +343,7 @@ export class QueryModelService implements IQueryModelService {
uri: planInfo.fileUri,
queryInfo:
{
range: info.range,
batchRanges: info.batchRanges,
messages: info.queryRunner!.messages
},
params: planInfo
@@ -358,7 +358,7 @@ export class QueryModelService implements IQueryModelService {
uri: qp2Info.fileUri,
queryInfo:
{
range: info.range,
batchRanges: info.batchRanges,
messages: info.queryRunner!.messages
},
params: qp2Info.planGraphs
@@ -372,7 +372,7 @@ export class QueryModelService implements IQueryModelService {
uri: queryRunner.uri,
queryInfo:
{
range: info.range,
batchRanges: info.batchRanges,
messages: info.queryRunner!.messages
},
params: resultSetInfo
@@ -514,7 +514,7 @@ export class QueryModelService implements IQueryModelService {
uri: ownerUri,
queryInfo:
{
range: info.range,
batchRanges: info.batchRanges,
messages: info.queryRunner!.messages
},
};
@@ -531,7 +531,7 @@ export class QueryModelService implements IQueryModelService {
uri: ownerUri,
queryInfo:
{
range: info.range,
batchRanges: info.batchRanges,
messages: info.queryRunner!.messages
},
};