Skip to content

Commit d28acec

Browse files
committed
Update LKG
1 parent 0d71ec3 commit d28acec

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

lib/tsserver.js

+13-16
Original file line numberDiff line numberDiff line change
@@ -42743,9 +42743,10 @@ var ts;
4274342743
this.host = host;
4274442744
this.project = project;
4274542745
this.ls = null;
42746-
this.filenameToScript = {};
4274742746
this.roots = [];
42748-
this.resolvedModuleNames = ts.createFileMap(ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
42747+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
42748+
this.resolvedModuleNames = ts.createFileMap(getCanonicalFileName);
42749+
this.filenameToScript = ts.createFileMap(getCanonicalFileName);
4274942750
this.moduleResolutionHost = {
4275042751
fileExists: function (fileName) { return _this.fileExists(fileName); },
4275142752
readFile: function (fileName) { return _this.host.readFile(fileName); }
@@ -42824,33 +42825,29 @@ var ts;
4282442825
};
4282542826
LSHost.prototype.removeReferencedFile = function (info) {
4282642827
if (!info.isOpen) {
42827-
this.filenameToScript[info.fileName] = undefined;
42828+
this.filenameToScript.remove(info.fileName);
4282842829
this.resolvedModuleNames.remove(info.fileName);
4282942830
}
4283042831
};
4283142832
LSHost.prototype.getScriptInfo = function (filename) {
42832-
var scriptInfo = ts.lookUp(this.filenameToScript, filename);
42833+
var scriptInfo = this.filenameToScript.get(filename);
4283342834
if (!scriptInfo) {
4283442835
scriptInfo = this.project.openReferencedFile(filename);
4283542836
if (scriptInfo) {
42836-
this.filenameToScript[scriptInfo.fileName] = scriptInfo;
42837+
this.filenameToScript.set(scriptInfo.fileName, scriptInfo);
4283742838
}
4283842839
}
42839-
else {
42840-
}
4284142840
return scriptInfo;
4284242841
};
4284342842
LSHost.prototype.addRoot = function (info) {
42844-
var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
42845-
if (!scriptInfo) {
42846-
this.filenameToScript[info.fileName] = info;
42843+
if (!this.filenameToScript.contains(info.fileName)) {
42844+
this.filenameToScript.set(info.fileName, info);
4284742845
this.roots.push(info);
4284842846
}
4284942847
};
4285042848
LSHost.prototype.removeRoot = function (info) {
42851-
var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName);
42852-
if (scriptInfo) {
42853-
this.filenameToScript[info.fileName] = undefined;
42849+
if (!this.filenameToScript.contains(info.fileName)) {
42850+
this.filenameToScript.remove(info.fileName);
4285442851
this.roots = copyListRemovingItem(info, this.roots);
4285542852
this.resolvedModuleNames.remove(info.fileName);
4285642853
}
@@ -42890,7 +42887,7 @@ var ts;
4289042887
return this.host.directoryExists(path);
4289142888
};
4289242889
LSHost.prototype.lineToTextSpan = function (filename, line) {
42893-
var script = this.filenameToScript[filename];
42890+
var script = this.filenameToScript.get(filename);
4289442891
var index = script.snap().index;
4289542892
var lineInfo = index.lineNumberToInfo(line + 1);
4289642893
var len;
@@ -42904,13 +42901,13 @@ var ts;
4290442901
return ts.createTextSpan(lineInfo.offset, len);
4290542902
};
4290642903
LSHost.prototype.lineOffsetToPosition = function (filename, line, offset) {
42907-
var script = this.filenameToScript[filename];
42904+
var script = this.filenameToScript.get(filename);
4290842905
var index = script.snap().index;
4290942906
var lineInfo = index.lineNumberToInfo(line);
4291042907
return (lineInfo.offset + offset - 1);
4291142908
};
4291242909
LSHost.prototype.positionToLineOffset = function (filename, position) {
42913-
var script = this.filenameToScript[filename];
42910+
var script = this.filenameToScript.get(filename);
4291442911
var index = script.snap().index;
4291542912
var lineOffset = index.charOffsetToLineNumberAndPos(position);
4291642913
return { line: lineOffset.line, offset: lineOffset.offset + 1 };

0 commit comments

Comments
 (0)