mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 17:52:34 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -80,7 +80,7 @@ export function format(documentText: string, range: Range | undefined, options:
|
||||
rangeStart = 0;
|
||||
rangeEnd = documentText.length;
|
||||
}
|
||||
let eol = getEOL(options, documentText);
|
||||
const eol = getEOL(options, documentText);
|
||||
|
||||
let lineBreak = false;
|
||||
let indentLevel = 0;
|
||||
@@ -91,7 +91,7 @@ export function format(documentText: string, range: Range | undefined, options:
|
||||
indentValue = '\t';
|
||||
}
|
||||
|
||||
let scanner = createScanner(formatText, false);
|
||||
const scanner = createScanner(formatText, false);
|
||||
let hasError = false;
|
||||
|
||||
function newLineAndIndent(): string {
|
||||
@@ -107,7 +107,7 @@ export function format(documentText: string, range: Range | undefined, options:
|
||||
hasError = token === SyntaxKind.Unknown || scanner.getTokenError() !== ScanError.None;
|
||||
return token;
|
||||
}
|
||||
let editOperations: Edit[] = [];
|
||||
const editOperations: Edit[] = [];
|
||||
function addEdit(text: string, startOffset: number, endOffset: number) {
|
||||
if (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) {
|
||||
editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
|
||||
@@ -117,8 +117,8 @@ export function format(documentText: string, range: Range | undefined, options:
|
||||
let firstToken = scanNext();
|
||||
|
||||
if (firstToken !== SyntaxKind.EOF) {
|
||||
let firstTokenStart = scanner.getTokenOffset() + formatTextStart;
|
||||
let initialIndent = repeat(indentValue, initialIndentLevel);
|
||||
const firstTokenStart = scanner.getTokenOffset() + formatTextStart;
|
||||
const initialIndent = repeat(indentValue, initialIndentLevel);
|
||||
addEdit(initialIndent, formatTextStart, firstTokenStart);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ export function format(documentText: string, range: Range | undefined, options:
|
||||
let replaceContent = '';
|
||||
while (!lineBreak && (secondToken === SyntaxKind.LineCommentTrivia || secondToken === SyntaxKind.BlockCommentTrivia)) {
|
||||
// comments on the same line: keep them on the same line, but ignore them otherwise
|
||||
let commentTokenStart = scanner.getTokenOffset() + formatTextStart;
|
||||
const commentTokenStart = scanner.getTokenOffset() + formatTextStart;
|
||||
addEdit(' ', firstTokenEnd, commentTokenStart);
|
||||
firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
||||
replaceContent = secondToken === SyntaxKind.LineCommentTrivia ? newLineAndIndent() : '';
|
||||
@@ -195,7 +195,7 @@ export function format(documentText: string, range: Range | undefined, options:
|
||||
}
|
||||
|
||||
}
|
||||
let secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
||||
const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
||||
addEdit(replaceContent, firstTokenEnd, secondTokenStart);
|
||||
firstToken = secondToken;
|
||||
}
|
||||
@@ -213,9 +213,9 @@ function repeat(s: string, count: number): string {
|
||||
function computeIndentLevel(content: string, options: FormattingOptions): number {
|
||||
let i = 0;
|
||||
let nChars = 0;
|
||||
let tabSize = options.tabSize || 4;
|
||||
const tabSize = options.tabSize || 4;
|
||||
while (i < content.length) {
|
||||
let ch = content.charAt(i);
|
||||
const ch = content.charAt(i);
|
||||
if (ch === ' ') {
|
||||
nChars++;
|
||||
} else if (ch === '\t') {
|
||||
@@ -230,7 +230,7 @@ function computeIndentLevel(content: string, options: FormattingOptions): number
|
||||
|
||||
function getEOL(options: FormattingOptions, text: string): string {
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
let ch = text.charAt(i);
|
||||
const ch = text.charAt(i);
|
||||
if (ch === '\r') {
|
||||
if (i + 1 < text.length && text.charAt(i + 1) === '\n') {
|
||||
return '\r\n';
|
||||
|
||||
Reference in New Issue
Block a user