mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 20:25:23 -06:00
Merge pull request #12928 from Microsoft/mergeMaster1214-2
Merge master 12/14-2
This commit is contained in:
commit
7cbc9a4912
13
Jakefile.js
13
Jakefile.js
@ -353,19 +353,16 @@ function prependFile(prefixFile, destinationFile) {
|
||||
// concatenate a list of sourceFiles to a destinationFile
|
||||
function concatenateFiles(destinationFile, sourceFiles) {
|
||||
var temp = "temptemp";
|
||||
// Copy the first file to temp
|
||||
if (!fs.existsSync(sourceFiles[0])) {
|
||||
fail(sourceFiles[0] + " does not exist!");
|
||||
}
|
||||
jake.cpR(sourceFiles[0], temp, { silent: true });
|
||||
// append all files in sequence
|
||||
for (var i = 1; i < sourceFiles.length; i++) {
|
||||
var text = "";
|
||||
for (var i = 0; i < sourceFiles.length; i++) {
|
||||
if (!fs.existsSync(sourceFiles[i])) {
|
||||
fail(sourceFiles[i] + " does not exist!");
|
||||
}
|
||||
fs.appendFileSync(temp, "\n\n");
|
||||
fs.appendFileSync(temp, fs.readFileSync(sourceFiles[i]));
|
||||
if (i > 0) { text += "\n\n"; }
|
||||
text += fs.readFileSync(sourceFiles[i]).toString().replace(/\r?\n/g, "\n");
|
||||
}
|
||||
fs.writeFileSync(temp, text);
|
||||
// Move the file to the final destination
|
||||
fs.renameSync(temp, destinationFile);
|
||||
}
|
||||
|
||||
@ -1799,7 +1799,6 @@ namespace ts.projectSystem {
|
||||
});
|
||||
|
||||
it("language service disabled state is updated in external projects", () => {
|
||||
debugger
|
||||
const f1 = {
|
||||
path: "/a/app.js",
|
||||
content: "var x = 1"
|
||||
@ -1940,6 +1939,31 @@ namespace ts.projectSystem {
|
||||
const edits = project.getLanguageService().getFormattingEditsForDocument(f1.path, options);
|
||||
assert.deepEqual(edits, [{ span: createTextSpan(/*start*/ 7, /*length*/ 3), newText: " " }]);
|
||||
});
|
||||
|
||||
it("snapshot from different caches are incompatible", () => {
|
||||
const f1 = {
|
||||
path: "/a/b/app.ts",
|
||||
content: "let x = 1;"
|
||||
};
|
||||
const host = createServerHost([f1]);
|
||||
const projectFileName = "/a/b/proj.csproj";
|
||||
const projectService = createProjectService(host);
|
||||
projectService.openExternalProject({
|
||||
projectFileName,
|
||||
rootFiles: [toExternalFile(f1.path)],
|
||||
options: {}
|
||||
})
|
||||
projectService.openClientFile(f1.path, "let x = 1;\nlet y = 2;");
|
||||
|
||||
projectService.checkNumberOfProjects({ externalProjects: 1 });
|
||||
projectService.externalProjects[0].getLanguageService(/*ensureSynchronized*/false).getNavigationBarItems(f1.path);
|
||||
projectService.closeClientFile(f1.path);
|
||||
|
||||
projectService.openClientFile(f1.path);
|
||||
projectService.checkNumberOfProjects({ externalProjects: 1 });
|
||||
const navbar = projectService.externalProjects[0].getLanguageService(/*ensureSynchronized*/false).getNavigationBarItems(f1.path);
|
||||
assert.equal(navbar[0].spans[0].length, f1.content.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Proper errors", () => {
|
||||
|
||||
@ -398,7 +398,7 @@ namespace ts.server {
|
||||
index: LineIndex;
|
||||
changesSincePreviousVersion: TextChange[] = [];
|
||||
|
||||
constructor(public version: number, public cache: ScriptVersionCache) {
|
||||
constructor(readonly version: number, readonly cache: ScriptVersionCache) {
|
||||
}
|
||||
|
||||
getText(rangeStart: number, rangeEnd: number) {
|
||||
@ -438,7 +438,7 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange {
|
||||
if (oldSnapshot instanceof LineIndexSnapshot) {
|
||||
if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) {
|
||||
return this.getTextChangeRangeSinceVersion(oldSnapshot.version);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user