Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into alanren/table-style
Browse files Browse the repository at this point in the history
  • Loading branch information
alanrenmsft committed Jun 29, 2023
2 parents 6a0b9a5 + 882bdb3 commit 9bd2bbb
Show file tree
Hide file tree
Showing 18 changed files with 332 additions and 80 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/on-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Process Label Action
uses: hramos/label-actions@v1
uses: hramos/label-actions@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion extensions/mssql/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
"version": "4.8.0.32",
"version": "4.8.0.35",
"downloadFileNames": {
"Windows_86": "win-x86-net7.0.zip",
"Windows_64": "win-x64-net7.0.zip",
Expand Down
1 change: 1 addition & 0 deletions extensions/mssql/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const providerId = 'MSSQL';
export const serviceCrashLink = 'https://github.com/Microsoft/vscode-mssql/wiki/SqlToolsService-Known-Issues';
export const extensionConfigSectionName = 'mssql';
export const telemetryConfigSectionName = 'telemetry';
export const queryEditorConfigSectionName = 'queryEditor';
export const packageName = 'Microsoft.mssql';

// DATA PROTOCOL VALUES ///////////////////////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion extensions/mssql/src/sqlToolsServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ function getClientOptions(context: AppContext): ClientOptions {
synchronize: {
configurationSection: [
Constants.extensionConfigSectionName,
Constants.telemetryConfigSectionName
Constants.telemetryConfigSectionName,
Constants.queryEditorConfigSectionName,
]
},
providerId: Constants.providerId,
Expand Down
4 changes: 0 additions & 4 deletions src/sql/azdata.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,10 +862,6 @@ declare module 'azdata' {
* Whether to include the column headers.
*/
includeHeaders: boolean
/**
* Whether to remove line breaks from the cell value.
*/
removeNewLines: boolean;
/**
* The selected ranges to be copied.
*/
Expand Down
1 change: 1 addition & 0 deletions src/sql/platform/query/common/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface IQueryEditorConfiguration {
readonly streaming: boolean;
readonly copyIncludeHeaders: boolean;
readonly copyRemoveNewLine: boolean;
readonly skipNewLineAfterTrailingLineBreak: boolean;
readonly optimizedTable: boolean;
readonly inMemoryDataProcessingThreshold: number;
readonly openAfterSave: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IDataResource, rowHasColumnNameKeys } from 'sql/workbench/services/notebook/browser/sql/sqlSessionManager';
import { getEolString, shouldIncludeHeaders, shouldRemoveNewLines } from 'sql/workbench/services/query/common/queryRunner';
import { getEolString, shouldSkipNewLineAfterTrailingLineBreak, shouldIncludeHeaders, shouldRemoveNewLines } from 'sql/workbench/services/query/common/queryRunner';
import { ResultSetSummary, ResultSetSubset, ICellValue } from 'sql/workbench/services/query/common/query';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
Expand Down Expand Up @@ -437,6 +437,9 @@ export class DataResourceDataProvider implements IGridDataProvider {
shouldRemoveNewLines(): boolean {
return shouldRemoveNewLines(this._configurationService);
}
shouldSkipNewLineAfterTrailingLineBreak(): boolean {
return shouldSkipNewLineAfterTrailingLineBreak(this._configurationService);
}

getColumnHeaders(range: Slick.Range): string[] {
let headers: string[] = this._resultSet.columnInfo.slice(range.fromCell, range.toCell + 1).map((info, i) => {
Expand Down
5 changes: 5 additions & 0 deletions src/sql/workbench/contrib/query/browser/query.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ const queryEditorConfiguration: IConfigurationNode = {
'description': localize('queryEditor.results.copyRemoveNewLine', "Configuration options for copying multi-line results from the Results View"),
'default': true
},
'queryEditor.results.skipNewLineAfterTrailingLineBreak': {
'type': 'boolean',
'description': localize('queryEditor.results.skipNewLineAfterTrailingLineBreak', "Whether to skip adding a line break between rows when copying results if the previous row already has a trailing line break. The default value is false."),
'default': false
},
'queryEditor.results.preferProvidersCopyHandler': {
'type': 'boolean',
'description': localize('queryEditor.results.preferProvidersCopyHandler', "Whether the copy result request should be handled by the query provider when it is supported. The default value is true, set this to false to force all copy handling to be done by Azure Data Studio."),
Expand Down
355 changes: 294 additions & 61 deletions src/sql/workbench/contrib/views/browser/treeView.ts

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/sql/workbench/services/query/common/gridDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export interface IGridDataProvider {

shouldRemoveNewLines(): boolean;

shouldSkipNewLineAfterTrailingLineBreak(): boolean;

getColumnHeaders(range: Slick.Range): string[] | undefined;

readonly canSerialize: boolean;
Expand Down Expand Up @@ -101,6 +103,7 @@ export async function copySelectionToClipboard(clipboardService: IClipboardServi
const eol = provider.getEolString();
const valueSeparator = '\t';
const shouldRemoveNewLines = provider.shouldRemoveNewLines();
const shouldSkipNewLineAfterTrailingLineBreak = provider.shouldSkipNewLineAfterTrailingLineBreak();

// Merge the selections to get the unique columns and unique rows.
const gridRanges = GridRange.fromSlickRanges(selections);
Expand Down Expand Up @@ -154,7 +157,9 @@ export async function copySelectionToClipboard(clipboardService: IClipboardServi
});
}
if (!cancellationTokenSource.token.isCancellationRequested) {
resultString += rowValues.join(eol);
resultString += rowValues.reduce(
(prevVal, currVal, idx) => prevVal + (idx > 0 && (!prevVal?.endsWith(eol) || !shouldSkipNewLineAfterTrailingLineBreak) ? eol : '') + currVal,
);
await clipboardService.writeText(resultString);
}
}, cancellationTokenSource);
Expand Down
15 changes: 11 additions & 4 deletions src/sql/workbench/services/query/common/queryRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,13 @@ export default class QueryRunner extends Disposable {
* @param selections The selection range to copy
* @param batchId The batch id of the result to copy from
* @param resultId The result id of the result to copy from
* @param removeNewLines Whether to remove line breaks from values.
* @param includeHeaders [Optional]: Should column headers be included in the copy selection
*/
async copyResults(selections: Slick.Range[], batchId: number, resultId: number, removeNewLines: boolean, includeHeaders?: boolean): Promise<void> {
async copyResults(selections: Slick.Range[], batchId: number, resultId: number, includeHeaders?: boolean): Promise<void> {
await this.queryManagementService.copyResults({
ownerUri: this.uri,
batchIndex: batchId,
resultSetIndex: resultId,
removeNewLines: removeNewLines,
includeHeaders: includeHeaders,
selections: selections.map(selection => {
return {
Expand Down Expand Up @@ -592,7 +590,7 @@ export class QueryGridDataProvider implements IGridDataProvider {

private async handleCopyRequestByProvider(selections: Slick.Range[], includeHeaders?: boolean): Promise<void> {
executeCopyWithNotification(this._notificationService, selections, async () => {
await this.queryRunner.copyResults(selections, this.batchId, this.resultSetId, this.shouldRemoveNewLines(), this.shouldIncludeHeaders(includeHeaders));
await this.queryRunner.copyResults(selections, this.batchId, this.resultSetId, this.shouldIncludeHeaders(includeHeaders));
});
}

Expand All @@ -614,6 +612,9 @@ export class QueryGridDataProvider implements IGridDataProvider {
shouldRemoveNewLines(): boolean {
return shouldRemoveNewLines(this._configurationService);
}
shouldSkipNewLineAfterTrailingLineBreak(): boolean {
return shouldSkipNewLineAfterTrailingLineBreak(this._configurationService);
}
getColumnHeaders(range: Slick.Range): string[] | undefined {
return this.queryRunner.getColumnHeaders(this.batchId, this.resultSetId, range);
}
Expand Down Expand Up @@ -648,6 +649,12 @@ export function shouldRemoveNewLines(configurationService: IConfigurationService
return !!removeNewLines;
}

export function shouldSkipNewLineAfterTrailingLineBreak(configurationService: IConfigurationService): boolean {
// get config skipNewLineAfterTrailingLineBreak option from vscode config
let skipNewLineAfterTrailingLineBreak = configurationService.getValue<IQueryEditorConfiguration>('queryEditor').results.skipNewLineAfterTrailingLineBreak;
return !!skipNewLineAfterTrailingLineBreak;
}

function isRangeOrUndefined(input: string | IRange | undefined): input is IRange | undefined {
return Range.isIRange(input) || types.isUndefinedOrNull(input);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const defaultTerminalConfig: Partial<ITerminalConfiguration> = {
unicodeVersion: '6'
};

suite('Buffer Content Tracker', () => {
suite.skip('Buffer Content Tracker', () => { // {{SQL CARBON EDIT}} skip failing suite
let instantiationService: TestInstantiationService;
let configurationService: TestConfigurationService;
let themeService: TestThemeService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ suite('TerminalLinkManager', () => {
} as Partial<ITerminalCapabilityStore> as any, instantiationService.createInstance(TerminalLinkResolver));
});

suite('getLinks and open recent link', () => {
suite.skip('getLinks and open recent link', () => { // {{SQL CARBON EDIT}} skip failing suite
test('should return no links', async () => {
const links = await linkManager.getLinks();
equals(links.webLinks, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { TestFileService } from 'vs/workbench/test/browser/workbenchTestServices
import { TestExtensionService } from 'vs/workbench/test/common/workbenchTestServices';


suite('Getting Started Markdown Renderer', () => {
suite.skip('Getting Started Markdown Renderer', () => { // {{SQL CARBON EDIT}} - disable suite
test('renders theme picker markdown with images', async () => {
const fileService = new TestFileService();
const languageService = new LanguageService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ConfigurationCache implements IConfigurationCache {
async remove({ type, key }: ConfigurationKey): Promise<void> { this.cache.delete(`${type}:${key}`); }
}

suite('DefaultConfiguration', () => {
suite.skip('DefaultConfiguration', () => { // {{SQL CARBON EDIT}} skip failing suite

const configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);
const cacheKey: ConfigurationKey = { type: 'defaults', key: 'configurationDefaultsOverrides' };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ConfigurationCache implements IConfigurationCache {
async remove(): Promise<void> { }
}

suite('ConfigurationEditing', () => {
suite.skip('ConfigurationEditing', () => { // {{SQL CARBON EDIT}} skip suite

let instantiationService: TestInstantiationService;
let userDataProfileService: IUserDataProfileService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const nullContext = {
getExecPath: () => undefined
};

suite('Configuration Resolver Service', () => {
suite.skip('Configuration Resolver Service', () => { // {{SQL CARBON EDIT}} - skip failing suite
let configurationResolverService: IConfigurationResolverService | null;
const envVariables: { [key: string]: string } = { key1: 'Value for key1', key2: 'Value for key2' };
// let environmentService: MockWorkbenchEnvironmentService;
Expand Down

0 comments on commit 9bd2bbb

Please sign in to comment.