fix linting errors

This commit is contained in:
Kagami Sascha Rosylight
2016-12-18 15:44:54 +09:00
parent 603ba89309
commit 27a60e4580
26 changed files with 112 additions and 86 deletions

View File

@@ -113,7 +113,8 @@ namespace ts.server {
if (len > 1) {
let insertedNodes = <LineCollection[]>new Array(len - 1);
let startNode = <LineCollection>leafNode;
for (let i = 1, len = lines.length; i < len; i++) {
const n = lines.length
for (let i = 1; i < n; i++) {
insertedNodes[i - 1] = new LineLeaf(lines[i]);
}
let pathIndex = this.startPath.length - 2;
@@ -341,8 +342,7 @@ namespace ts.server {
let snap = this.versions[this.currentVersionToIndex()];
if (this.changes.length > 0) {
let snapIndex = snap.index;
for (let i = 0, len = this.changes.length; i < len; i++) {
const change = this.changes[i];
for (const change of this.changes) {
snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText);
}
snap = new LineIndexSnapshot(this.currentVersion + 1, this);
@@ -366,8 +366,7 @@ namespace ts.server {
const textChangeRanges: ts.TextChangeRange[] = [];
for (let i = oldVersion + 1; i <= newVersion; i++) {
const snap = this.versions[this.versionToIndex(i)];
for (let j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) {
const textChange = snap.changesSincePreviousVersion[j];
for (const textChange of snap.changesSincePreviousVersion) {
textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange();
}
}
@@ -471,7 +470,8 @@ namespace ts.server {
load(lines: string[]) {
if (lines.length > 0) {
const leaves: LineLeaf[] = [];
for (let i = 0, len = lines.length; i < len; i++) {
const len = lines.length;
for (let i = 0; i < len; i++) {
leaves[i] = new LineLeaf(lines[i]);
}
this.root = LineIndex.buildTreeFromBottom(leaves);
@@ -643,8 +643,7 @@ namespace ts.server {
updateCounts() {
this.totalChars = 0;
this.totalLines = 0;
for (let i = 0, len = this.children.length; i < len; i++) {
const child = this.children[i];
for (const child of this.children) {
this.totalChars += child.charCount();
this.totalLines += child.lineCount();
}