From d6af9b7cbc48a21d2e52073cd38a6fedd8189904 Mon Sep 17 00:00:00 2001 From: Neonit Date: Fri, 10 Apr 2020 17:46:08 +0200 Subject: [PATCH 01/13] Fix indentation preservation in JSDoc (#37717) This fixes two bugs in the parseJSDocCommentWorker(). 1. The initial indent was calculated wrongly. It was set to the difference between the index of the last newline or beginning of file and the current start marker (position of /**). By calculating it this way, the newline character itself is counted as indentation character as well. The initial indent is used as margin for the whole comment. The margin contains the amount of characters to skip before the actual content or payload of a comment line. The algorithm does not skip non-whitespace characters at the beginning of the content, but it would strip away one whitespace character for indented content (which does matter, if there is e.g. a Markdown code block with indentation in the comment). 2. When reducing initial whitespace sequences of comment lines by the remaining margin the algorithm cut off one character too much. This might have been introduced to fix 1. It had a similar effect as 1. --- src/compiler/parser.ts | 5 +++-- .../fourslash/jsDocIndentationPreservation1.ts | 13 +++++++++++++ .../fourslash/jsDocIndentationPreservation2.ts | 13 +++++++++++++ .../fourslash/jsDocIndentationPreservation3.ts | 13 +++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 tests/cases/fourslash/jsDocIndentationPreservation1.ts create mode 100644 tests/cases/fourslash/jsDocIndentationPreservation2.ts create mode 100644 tests/cases/fourslash/jsDocIndentationPreservation3.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index ae13b113897..b68d14ed5e0 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -6884,7 +6884,8 @@ namespace ts { let state = JSDocState.SawAsterisk; let margin: number | undefined; // + 4 for leading '/** ' - let indent = start - Math.max(content.lastIndexOf("\n", start), 0) + 4; + // + 1 because the last index of \n is always one index before the first character in the line and coincidentally, if there is no \n before start, it is -1, which is also one index before the first character + let indent = start - (content.lastIndexOf("\n", start) + 1) + 4; function pushComment(text: string) { if (!margin) { margin = indent; @@ -6940,7 +6941,7 @@ namespace ts { comments.push(whitespace); } else if (margin !== undefined && indent + whitespace.length > margin) { - comments.push(whitespace.slice(margin - indent - 1)); + comments.push(whitespace.slice(margin - indent)); } indent += whitespace.length; break; diff --git a/tests/cases/fourslash/jsDocIndentationPreservation1.ts b/tests/cases/fourslash/jsDocIndentationPreservation1.ts new file mode 100644 index 00000000000..1e454ac4be1 --- /dev/null +++ b/tests/cases/fourslash/jsDocIndentationPreservation1.ts @@ -0,0 +1,13 @@ +/// +// @allowJs: true +// @Filename: Foo.js + +/////** +//// * Does some stuff. +//// * Second line. +//// * Third line. +//// */ +////function foo/**/(){} + +goTo.marker(); +verify.quickInfoIs("function foo(): void", "Does some stuff.\n Second line.\n\tThird line."); diff --git a/tests/cases/fourslash/jsDocIndentationPreservation2.ts b/tests/cases/fourslash/jsDocIndentationPreservation2.ts new file mode 100644 index 00000000000..e832bc12708 --- /dev/null +++ b/tests/cases/fourslash/jsDocIndentationPreservation2.ts @@ -0,0 +1,13 @@ +/// +// @allowJs: true +// @Filename: Foo.js + +/////** +//// Does some stuff. +//// Second line. +//// Third line. +////*/ +////function foo/**/(){} + +goTo.marker(); +verify.quickInfoIs("function foo(): void", "Does some stuff.\n Second line.\n\tThird line."); diff --git a/tests/cases/fourslash/jsDocIndentationPreservation3.ts b/tests/cases/fourslash/jsDocIndentationPreservation3.ts new file mode 100644 index 00000000000..117ea0dee4e --- /dev/null +++ b/tests/cases/fourslash/jsDocIndentationPreservation3.ts @@ -0,0 +1,13 @@ +/// +// @allowJs: true +// @Filename: Foo.js + +/////** +//// Does some stuff. +//// Second line. +//// Third line. +////*/ +////function foo/**/(){} + +goTo.marker(); +verify.quickInfoIs("function foo(): void", "Does some stuff.\n Second line.\n\tThird line."); From 065b83b9024eabe36b1dd05078269797b9fa7585 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Mon, 3 Aug 2020 14:56:55 -0700 Subject: [PATCH 02/13] Make numeric Array constructors take ArrayLikeBuffer union PR #38449 changed the second overload of the constructor for Int8, Uint8, Int32, Uint32, Int16, Uint16, Float, Float64 -Array so that it no longer includes `ArrayBufferLike`. It's just `ArrayLike`. This is fine except in the case that the caller provides exactly `ArrayLike | ArrayBufferLike`. This PR adds ArrayBufferLike back so that the union is once again accepted. This avoids a breaking change, in particular in one Microsoft-internal codebase. --- src/lib/es5.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 2a54c7529f7..5df54f51fe0 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1946,7 +1946,7 @@ interface Int8Array { interface Int8ArrayConstructor { readonly prototype: Int8Array; new(length: number): Int8Array; - new(array: ArrayLike): Int8Array; + new(array: ArrayLike | ArrayBufferLike): Int8Array; new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array; /** @@ -2229,7 +2229,7 @@ interface Uint8Array { interface Uint8ArrayConstructor { readonly prototype: Uint8Array; new(length: number): Uint8Array; - new(array: ArrayLike): Uint8Array; + new(array: ArrayLike | ArrayBufferLike): Uint8Array; new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array; /** @@ -2511,7 +2511,7 @@ interface Uint8ClampedArray { interface Uint8ClampedArrayConstructor { readonly prototype: Uint8ClampedArray; new(length: number): Uint8ClampedArray; - new(array: ArrayLike): Uint8ClampedArray; + new(array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray; /** @@ -2791,7 +2791,7 @@ interface Int16Array { interface Int16ArrayConstructor { readonly prototype: Int16Array; new(length: number): Int16Array; - new(array: ArrayLike): Int16Array; + new(array: ArrayLike | ArrayBufferLike): Int16Array; new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array; /** @@ -3074,7 +3074,7 @@ interface Uint16Array { interface Uint16ArrayConstructor { readonly prototype: Uint16Array; new(length: number): Uint16Array; - new(array: ArrayLike): Uint16Array; + new(array: ArrayLike | ArrayBufferLike): Uint16Array; new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array; /** @@ -3356,7 +3356,7 @@ interface Int32Array { interface Int32ArrayConstructor { readonly prototype: Int32Array; new(length: number): Int32Array; - new(array: ArrayLike): Int32Array; + new(array: ArrayLike | ArrayBufferLike): Int32Array; new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array; /** @@ -3637,7 +3637,7 @@ interface Uint32Array { interface Uint32ArrayConstructor { readonly prototype: Uint32Array; new(length: number): Uint32Array; - new(array: ArrayLike): Uint32Array; + new(array: ArrayLike | ArrayBufferLike): Uint32Array; new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array; /** @@ -3919,7 +3919,7 @@ interface Float32Array { interface Float32ArrayConstructor { readonly prototype: Float32Array; new(length: number): Float32Array; - new(array: ArrayLike): Float32Array; + new(array: ArrayLike | ArrayBufferLike): Float32Array; new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array; /** @@ -4193,7 +4193,7 @@ interface Float64Array { interface Float64ArrayConstructor { readonly prototype: Float64Array; new(length: number): Float64Array; - new(array: ArrayLike): Float64Array; + new(array: ArrayLike | ArrayBufferLike): Float64Array; new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array; /** From dec871ba104223c8fd9164a2f131bd4d621b9083 Mon Sep 17 00:00:00 2001 From: csigs Date: Mon, 3 Aug 2020 22:11:07 +0000 Subject: [PATCH 03/13] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 21 ++++ .../diagnosticMessages.generated.json.lcl | 102 ++++++++++++++++++ .../diagnosticMessages.generated.json.lcl | 78 ++++++++++++++ .../diagnosticMessages.generated.json.lcl | 78 ++++++++++++++ .../diagnosticMessages.generated.json.lcl | 102 ++++++++++++++++++ .../diagnosticMessages.generated.json.lcl | 102 ++++++++++++++++++ .../diagnosticMessages.generated.json.lcl | 24 +++++ 7 files changed, 507 insertions(+) diff --git a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl index 75cb06bce8f..4b256fa4a01 100644 --- a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2403,6 +2403,9 @@ + + + @@ -3390,12 +3393,18 @@ + + + + + + @@ -4176,6 +4185,9 @@ + + + @@ -5550,12 +5562,18 @@ + + + + + + @@ -13164,6 +13182,9 @@ + + + diff --git a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl index 2f49c14009b..1e5bd00c490 100644 --- a/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2163,6 +2163,12 @@ + + + + + + @@ -2391,6 +2397,15 @@ + + + + + + + + + @@ -2601,6 +2616,12 @@ + + + + + + @@ -3366,6 +3387,24 @@ + + + + + + + + + + + + + + + + + + @@ -3672,6 +3711,15 @@ + + + + + + + + + @@ -3726,6 +3774,15 @@ + + + + + + + + + @@ -3744,6 +3801,15 @@ + + + + + + + + + @@ -4113,6 +4179,15 @@ + + + + + + + + + @@ -5481,6 +5556,24 @@ + + + + + + + + + + + + + + + + + + @@ -13080,6 +13173,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index 8c96e820e2d..e0206d4104c 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2178,6 +2178,12 @@ + + + + + + @@ -2406,6 +2412,12 @@ + + + + + + @@ -2616,6 +2628,12 @@ + + + + + + @@ -3381,6 +3399,18 @@ + + + + + + + + + + + + @@ -3687,6 +3717,15 @@ + + + + + + + + + @@ -3741,6 +3780,12 @@ + + + + + + @@ -3759,6 +3804,12 @@ + + + + + + @@ -4128,6 +4179,15 @@ + + + + + + + + + @@ -5496,6 +5556,18 @@ + + + + + + + + + + + + @@ -13098,6 +13170,12 @@ + + + + + + diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index ca652f03e6a..105b2c63349 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2166,6 +2166,12 @@ + + + + + + @@ -2394,6 +2400,12 @@ + + + + + + @@ -2604,6 +2616,12 @@ + + + + + + @@ -3369,6 +3387,21 @@ + + + + + + + + + + + + + + + @@ -3675,6 +3708,12 @@ + + + + + + @@ -3729,6 +3768,12 @@ + + + + + + @@ -3747,6 +3792,12 @@ + + + + + + @@ -4116,6 +4167,12 @@ + + + + + + @@ -5484,6 +5541,21 @@ + + + + + + + + + + + + + + + @@ -13086,6 +13158,12 @@ + + + + + + diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl index 50ec9b5b086..345d509b4c2 100644 --- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2159,6 +2159,12 @@ + + + + + + @@ -2387,6 +2393,15 @@ + + + + + + + + + @@ -2597,6 +2612,12 @@ + + + + + + @@ -3362,6 +3383,24 @@ + + + + + + + + + + + + + + + + + + @@ -3668,6 +3707,15 @@ + + + + + + + + + @@ -3722,6 +3770,15 @@ + + + + + + + + + @@ -3740,6 +3797,15 @@ + + + + + + + + + @@ -4109,6 +4175,15 @@ + + + + + + + + + @@ -5477,6 +5552,24 @@ + + + + + + + + + + + + + + + + + + @@ -13076,6 +13169,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl index 1fb77c996e4..495ad4fe286 100644 --- a/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/rus/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2165,6 +2165,12 @@ + + + + + + @@ -2393,6 +2399,15 @@ + + + + + + + + + @@ -2603,6 +2618,12 @@ + + + + + + @@ -3368,6 +3389,24 @@ + + + + + + + + + + + + + + + + + + @@ -3674,6 +3713,15 @@ + + + + + + + + + @@ -3728,6 +3776,15 @@ + + + + + + + + + @@ -3746,6 +3803,15 @@ + + + + + + + + + @@ -4115,6 +4181,15 @@ + + + + + + + + + @@ -5483,6 +5558,24 @@ + + + + + + + + + + + + + + + + + + @@ -13085,6 +13178,15 @@ + + + + + + + + + diff --git a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 0c656550ca7..63a6ba2f21c 100644 --- a/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/trk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2396,6 +2396,9 @@ + + + @@ -3383,12 +3386,18 @@ + + + + + + @@ -3701,6 +3710,9 @@ + + + @@ -4166,6 +4178,9 @@ + + + @@ -5540,12 +5555,18 @@ + + + + + + @@ -13154,6 +13175,9 @@ + + + From 26d228cb1848a0d73617dd22616b12c8d50ee034 Mon Sep 17 00:00:00 2001 From: csigs Date: Tue, 4 Aug 2020 04:10:42 +0000 Subject: [PATCH 04/13] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 6 +++++ .../diagnosticMessages.generated.json.lcl | 24 +++++++++++++++++++ .../diagnosticMessages.generated.json.lcl | 24 +++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl index e90adab6cb2..dca94213e93 100644 --- a/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2178,6 +2178,9 @@ + + + @@ -2631,6 +2634,9 @@ + + + diff --git a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl index e0206d4104c..e47d9aa55c7 100644 --- a/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2415,6 +2415,9 @@ + + + @@ -3402,12 +3405,18 @@ + + + + + + @@ -3783,6 +3792,9 @@ + + + @@ -3807,6 +3819,9 @@ + + + @@ -5559,12 +5574,18 @@ + + + + + + @@ -13173,6 +13194,9 @@ + + + diff --git a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl index 105b2c63349..f2afb9c9813 100644 --- a/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ita/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2403,6 +2403,9 @@ + + + @@ -3390,6 +3393,9 @@ + + + @@ -3711,6 +3717,9 @@ + + + @@ -3771,6 +3780,9 @@ + + + @@ -3795,6 +3807,9 @@ + + + @@ -4170,6 +4185,9 @@ + + + @@ -5544,6 +5562,9 @@ + + + @@ -13161,6 +13182,9 @@ + + + From d985e68ffa8fb8d765d45099bb5c2406b5f5a468 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 3 Aug 2020 23:38:55 -0700 Subject: [PATCH 05/13] Bump version to 4.1. (#39894) * Bump version to 4.1. * Update baselines. --- package.json | 2 +- src/compiler/corePublic.ts | 2 +- tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 7f9e66add40..dc47a9b5f5d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "4.0.0", + "version": "4.1.0", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index dad59377900..ecf3f929fae 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -1,7 +1,7 @@ namespace ts { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - export const versionMajorMinor = "4.0"; + export const versionMajorMinor = "4.1"; /** The version of the TypeScript compiler release */ export const version = `${versionMajorMinor}.0-dev`; diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 068695ed7c3..9eb39fe326d 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "4.0"; + const versionMajorMinor = "4.1"; /** The version of the TypeScript compiler release */ const version: string; /** diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 92e1aecc3dd..442992f3c68 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "4.0"; + const versionMajorMinor = "4.1"; /** The version of the TypeScript compiler release */ const version: string; /** From 817dc52fd310cb447c2ece1b7729748a4e4db228 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 4 Aug 2020 00:05:24 -0700 Subject: [PATCH 06/13] Add an 'Update LKG' action (#39897) --- .github/workflows/blank.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/blank.yml diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml new file mode 100644 index 00000000000..09fccd53a07 --- /dev/null +++ b/.github/workflows/blank.yml @@ -0,0 +1,35 @@ +name: Update LKG + +on: + workflow_dispatch: + inputs: + branchName: + description: "The name of the branch you'd like to update the Last Known Good (LKG) version of the compiler on." + required: true + default: "master" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.branchName }} + - name: Use node version 12 + uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + + - name: Configure Git and Update LKG + run: | + git config user.email "ts_bot@rcavanaugh.com" + git config user.name "TypeScript Bot" + npm install + gulp LKG + npm test + git diff + git add ./lib + git commit -m "Update LKG" + git push From 2106b07f22d6d8f2affe34b9869767fa5bc7a4d9 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 4 Aug 2020 00:14:24 -0700 Subject: [PATCH 07/13] Rename and use the default ref instead of having a `workflow_dispatch` option --- .github/workflows/{blank.yml => update-lkg.yml} | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) rename .github/workflows/{blank.yml => update-lkg.yml} (66%) diff --git a/.github/workflows/blank.yml b/.github/workflows/update-lkg.yml similarity index 66% rename from .github/workflows/blank.yml rename to .github/workflows/update-lkg.yml index 09fccd53a07..8864d1316c0 100644 --- a/.github/workflows/blank.yml +++ b/.github/workflows/update-lkg.yml @@ -1,12 +1,7 @@ name: Update LKG on: - workflow_dispatch: - inputs: - branchName: - description: "The name of the branch you'd like to update the Last Known Good (LKG) version of the compiler on." - required: true - default: "master" + workflow_dispatch: {} jobs: build: @@ -14,8 +9,6 @@ jobs: steps: - uses: actions/checkout@v2 - with: - ref: ${{ github.event.inputs.branchName }} - name: Use node version 12 uses: actions/setup-node@v1 with: From 3d9eb73db2e0b84030804e424befd59e33755e21 Mon Sep 17 00:00:00 2001 From: csigs Date: Tue, 4 Aug 2020 16:10:42 +0000 Subject: [PATCH 08/13] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 6 ++++++ .../diagnosticMessages.generated.json.lcl | 6 ++++++ .../diagnosticMessages.generated.json.lcl | 6 ++++++ .../diagnosticMessages.generated.json.lcl | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl index 869aed6c55e..52b89523d6a 100644 --- a/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2169,6 +2169,9 @@ + + + @@ -2622,6 +2625,9 @@ + + + diff --git a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl index 4b256fa4a01..4c24f869731 100644 --- a/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2169,6 +2169,9 @@ + + + @@ -2622,6 +2625,9 @@ + + + diff --git a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl index 6fd5a378f20..e974ed13c02 100644 --- a/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/kor/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2169,6 +2169,9 @@ + + + @@ -2622,6 +2625,9 @@ + + + diff --git a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl index 83395f5e494..589887655fd 100644 --- a/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/plk/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2159,6 +2159,9 @@ + + + @@ -2612,6 +2615,9 @@ + + + From bcccae2fd4b2d1f548f2d5a8f49543e727df608b Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 4 Aug 2020 13:33:27 -0700 Subject: [PATCH 09/13] Handle the fact that noResolveResolution resolution is reused (#39889) Fixes #39795 --- src/compiler/resolutionCache.ts | 2 +- .../tsserver/approximateSemanticOnlyServer.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index 56ea6a03e80..725f94c7799 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -568,7 +568,7 @@ namespace ts { } else { resolution.refCount = 1; - Debug.assert(resolution.files === undefined); + Debug.assert(length(resolution.files) === 0); // This resolution shouldnt be referenced by any file yet if (isExternalModuleNameRelative(name)) { watchFailedLookupLocationOfResolution(resolution); } diff --git a/src/testRunner/unittests/tsserver/approximateSemanticOnlyServer.ts b/src/testRunner/unittests/tsserver/approximateSemanticOnlyServer.ts index 1b517e027b8..3cf03622340 100644 --- a/src/testRunner/unittests/tsserver/approximateSemanticOnlyServer.ts +++ b/src/testRunner/unittests/tsserver/approximateSemanticOnlyServer.ts @@ -213,5 +213,23 @@ function fooB() { }` assert.isFalse(project.dirty); checkProjectActualFiles(project, [libFile.path, file1.path, file2.path, file3.path, something.path]); }); + + it("should not crash when external module name resolution is reused", () => { + const { session, file1, file2, file3 } = setup(); + const service = session.getProjectService(); + openFilesForSession([file1], session); + checkNumberOfProjects(service, { inferredProjects: 1 }); + const project = service.inferredProjects[0]; + checkProjectActualFiles(project, [libFile.path, file1.path, file2.path]); + + // Close the file that contains non relative external module name and open some file that doesnt have non relative external module import + closeFilesForSession([file1], session); + openFilesForSession([file3], session); + checkProjectActualFiles(project, [libFile.path, file3.path]); + + // Open file with non relative external module name + openFilesForSession([file2], session); + checkProjectActualFiles(project, [libFile.path, file2.path, file3.path]); + }); }); } From c96bad261a145395dfb477ff579bfad420068a0a Mon Sep 17 00:00:00 2001 From: csigs Date: Tue, 4 Aug 2020 22:11:06 +0000 Subject: [PATCH 10/13] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 9649d9c68d4..dc09d8dd303 100644 --- a/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2181,6 +2181,9 @@ + + + @@ -2634,6 +2637,9 @@ + + + From 7d11da17c0067e2cd61bc7b2284e21d67b24733e Mon Sep 17 00:00:00 2001 From: csigs Date: Wed, 5 Aug 2020 10:10:46 +0000 Subject: [PATCH 11/13] LEGO: check in for master to temporary branch. --- .../diagnosticMessages/diagnosticMessages.generated.json.lcl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl index 345d509b4c2..0fa78149324 100644 --- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2162,6 +2162,9 @@ + + + From a548e4f363333ff8d35fdcee9974288ebefa44a3 Mon Sep 17 00:00:00 2001 From: csigs Date: Wed, 5 Aug 2020 16:10:40 +0000 Subject: [PATCH 12/13] LEGO: check in for master to temporary branch. --- .../diagnosticMessages.generated.json.lcl | 6 ++++++ .../diagnosticMessages.generated.json.lcl | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl index 58ec2f850ad..ed5a51fdb03 100644 --- a/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/jpn/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2169,6 +2169,9 @@ + + + @@ -2622,6 +2625,9 @@ + + + diff --git a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl index 0fa78149324..2e2338162d5 100644 --- a/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl +++ b/src/loc/lcl/ptb/diagnosticMessages/diagnosticMessages.generated.json.lcl @@ -2618,6 +2618,9 @@ + + + From 7f4e1b699a05e60977805bafef68754b653439f4 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 5 Aug 2020 10:09:45 -0700 Subject: [PATCH 13/13] Find tagless JSDoc as preceding token (#39912) --- src/services/utilities.ts | 4 ++++ tests/cases/fourslash/completionsAfterJSDoc.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/cases/fourslash/completionsAfterJSDoc.ts diff --git a/src/services/utilities.ts b/src/services/utilities.ts index c11c65d076d..ce0c15366be 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1217,6 +1217,10 @@ namespace ts { } const children = n.getChildren(sourceFile); + if (children.length === 0) { + return n; + } + const candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile); return candidate && findRightmostToken(candidate, sourceFile); } diff --git a/tests/cases/fourslash/completionsAfterJSDoc.ts b/tests/cases/fourslash/completionsAfterJSDoc.ts new file mode 100644 index 00000000000..eb882e3829a --- /dev/null +++ b/tests/cases/fourslash/completionsAfterJSDoc.ts @@ -0,0 +1,17 @@ +/// + +////export interface Foo { +//// /** JSDoc */ +//// /**/foo(): void; +////} + +// Should not crash, #35632 +verify.completions({ + marker: "", + isNewIdentifierLocation: true, + exact: [{ + name: "readonly", + kind: "keyword", + sortText: completion.SortText.GlobalsOrKeywords + }] +});