mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 09:35:37 -05:00
Show Trust server certificate on dialog and fix bool select-box defaults (#21020)
This commit is contained in:
@@ -19,3 +19,40 @@ export function getSqlConfigValue<T>(workspaceConfigService: IConfigurationServi
|
||||
let config = workspaceConfigService.getValue<{ [key: string]: any }>(ConnectionConstants.sqlConfigSectionName);
|
||||
return config ? config[configName] : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps provided string using \n that qualifies as line break to wrap text in title attributes (tooltips).
|
||||
* @param str string to be wrapped
|
||||
* @param maxWidth max width to be allowed for wrapped text
|
||||
* @returns wrapped string
|
||||
*/
|
||||
export function wrapStringWithNewLine(str: string | undefined, maxWidth: number): string | undefined {
|
||||
if (!str) {
|
||||
return str;
|
||||
}
|
||||
let newLineStr = `\n`;
|
||||
let res = '';
|
||||
while (str.length > maxWidth) {
|
||||
let found = false;
|
||||
// Inserts new line at first whitespace of the line
|
||||
for (let i = maxWidth - 1; i >= 0; i--) {
|
||||
if (testWhitespace(str.charAt(i))) {
|
||||
res = res + [str.slice(0, i), newLineStr].join('');
|
||||
str = str.slice(i + 1);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Inserts new line at maxWidth position, the word is too long to wrap
|
||||
if (!found) {
|
||||
res += [str.slice(0, maxWidth), newLineStr].join('');
|
||||
str = str.slice(maxWidth);
|
||||
}
|
||||
}
|
||||
return res + str;
|
||||
}
|
||||
|
||||
function testWhitespace(x: string) {
|
||||
var white = new RegExp(/^\s$/);
|
||||
return white.test(x.charAt(0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user