Lint fixes and test fixes

This commit is contained in:
zhengbli
2015-10-06 12:33:06 -07:00
parent 3b6f283669
commit 8171dede90
2 changed files with 17 additions and 11 deletions
+10 -10
View File
@@ -210,7 +210,7 @@ namespace ts {
}
private static copyListRemovingItem<T>(item: T, list: T[]) {
var copiedList: T[] = [];
let copiedList: T[] = [];
for (var i = 0, len = list.length; i < len; i++) {
if (list[i] != item) {
copiedList.push(list[i]);
@@ -224,7 +224,7 @@ namespace ts {
}
private poll(checkedIndex: number) {
var watchedFile = this.watchedFiles[checkedIndex];
let watchedFile = this.watchedFiles[checkedIndex];
if (!watchedFile) {
return;
}
@@ -245,9 +245,9 @@ namespace ts {
// and efficiency of stat on modern filesystems
private startWatchTimer() {
this.watchTimer = setInterval(() => {
var count = 0;
var nextToCheck = this.nextFileToCheck;
var firstCheck = -1;
let count = 0;
let nextToCheck = this.nextFileToCheck;
let firstCheck = -1;
while ((count < this.chunkSize) && (nextToCheck !== firstCheck)) {
this.poll(nextToCheck);
if (firstCheck < 0) {
@@ -264,7 +264,7 @@ namespace ts {
}
addFile(fileName: string, callback: (fileName: string, removed?: boolean) => void): WatchedFile {
var file: WatchedFile = {
let file: WatchedFile = {
fileName,
callback,
mtime: WatchedFileSet.getModifiedTime(fileName)
@@ -295,7 +295,7 @@ namespace ts {
// changes for large reference sets? If so, do we want
// to increase the chunk size or decrease the interval
// time dynamically to match the large reference set?
var watchedFileSet = new WatchedFileSet();
let watchedFileSet = new WatchedFileSet();
function isNode4OrLater(): Boolean {
return parseInt(process.version.charAt(1)) >= 4;
@@ -402,10 +402,10 @@ namespace ts {
return _fs.watch(fileName, (eventName: string, relativeFileName: string) => callback(fileName));
}
var watchedFile = watchedFileSet.addFile(fileName, callback);
let watchedFile = watchedFileSet.addFile(fileName, callback);
return {
close: () => watchedFileSet.removeFile(watchedFile)
}
};
},
watchDirectory: (path, callback, recursive) => {
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
@@ -419,7 +419,7 @@ namespace ts {
// event name is "change")
if (eventName == "rename") {
// When deleting a file, the passed baseFileName is null
callback(relativeFileName == null ? null : normalizePath(ts.combinePaths(path, relativeFileName)))
callback(!relativeFileName ? relativeFileName : normalizePath(ts.combinePaths(path, relativeFileName)));
};
}
);
+7 -1
View File
@@ -572,6 +572,10 @@ namespace Harness.LanguageService {
return { close() { } };
}
watchDirectory(path: string, callback: (path: string) => void, recursive?: boolean): ts.FileWatcher {
return { close() { } };
}
close(): void {
}
@@ -614,7 +618,9 @@ namespace Harness.LanguageService {
// This host is just a proxy for the clientHost, it uses the client
// host to answer server queries about files on disk
let serverHost = new SessionServerHost(clientHost);
let server = new ts.server.Session(serverHost, Buffer.byteLength, process.hrtime, serverHost);
let server = new ts.server.Session(serverHost,
Buffer ? Buffer.byteLength : (string: string, encoding?: string) => string.length,
process.hrtime, serverHost);
// Fake the connection between the client and the server
serverHost.writeMessage = client.onMessage.bind(client);