Skip to content

Commit

Permalink
Update LKG
Browse files Browse the repository at this point in the history
  • Loading branch information
mhegazy committed Oct 28, 2015
1 parent 0d71ec3 commit d28acec
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -42743,9 +42743,10 @@ var ts;
this.host = host;
this.project = project;
this.ls = null;
this.filenameToScript = {};
this.roots = [];
this.resolvedModuleNames = ts.createFileMap(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
this.resolvedModuleNames = ts.createFileMap(getCanonicalFileName);
this.filenameToScript = ts.createFileMap(getCanonicalFileName);
this.moduleResolutionHost = {
fileExists: function (fileName) { return _this.fileExists(fileName); },
readFile: function (fileName) { return _this.host.readFile(fileName); }
Expand Down Expand Up @@ -42824,33 +42825,29 @@ var ts;
};
LSHost.prototype.removeReferencedFile = function (info) {
if (!info.isOpen) {
this.filenameToScript[info.fileName] = undefined;
this.filenameToScript.remove(info.fileName);
this.resolvedModuleNames.remove(info.fileName);
}
};
LSHost.prototype.getScriptInfo = function (filename) {
var scriptInfo = ts.lookUp(this.filenameToScript, filename);
var scriptInfo = this.filenameToScript.get(filename);
if (!scriptInfo) {
scriptInfo = this.project.openReferencedFile(filename);
if (scriptInfo) {
this.filenameToScript[scriptInfo.fileName] = scriptInfo;
this.filenameToScript.set(scriptInfo.fileName, scriptInfo);
}
}
else {
}
return scriptInfo;
};
LSHost.prototype.addRoot = function (info) {
var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
if (!scriptInfo) {
this.filenameToScript[info.fileName] = info;
if (!this.filenameToScript.contains(info.fileName)) {
this.filenameToScript.set(info.fileName, info);
this.roots.push(info);
}
};
LSHost.prototype.removeRoot = function (info) {
var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
if (scriptInfo) {
this.filenameToScript[info.fileName] = undefined;
if (!this.filenameToScript.contains(info.fileName)) {
this.filenameToScript.remove(info.fileName);
this.roots = copyListRemovingItem(info, this.roots);
this.resolvedModuleNames.remove(info.fileName);
}
Expand Down Expand Up @@ -42890,7 +42887,7 @@ var ts;
return this.host.directoryExists(path);
};
LSHost.prototype.lineToTextSpan = function (filename, line) {
var script = this.filenameToScript[filename];
var script = this.filenameToScript.get(filename);
var index = script.snap().index;
var lineInfo = index.lineNumberToInfo(line + 1);
var len;
Expand All @@ -42904,13 +42901,13 @@ var ts;
return ts.createTextSpan(lineInfo.offset, len);
};
LSHost.prototype.lineOffsetToPosition = function (filename, line, offset) {
var script = this.filenameToScript[filename];
var script = this.filenameToScript.get(filename);
var index = script.snap().index;
var lineInfo = index.lineNumberToInfo(line);
return (lineInfo.offset + offset - 1);
};
LSHost.prototype.positionToLineOffset = function (filename, position) {
var script = this.filenameToScript[filename];
var script = this.filenameToScript.get(filename);
var index = script.snap().index;
var lineOffset = index.charOffsetToLineNumberAndPos(position);
return { line: lineOffset.line, offset: lineOffset.offset + 1 };
Expand Down

0 comments on commit d28acec

Please sign in to comment.