diff --git a/lib/tsc.js b/lib/tsc.js index d425ad1b55369..e81c6d87ee334 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { var ts; (function (ts) { ts.versionMajorMinor = "4.4"; - ts.version = "4.4.2"; + ts.version = "4.4.3"; var NativeCollections; (function (NativeCollections) { function tryGetNativeMap() { @@ -97526,6 +97526,10 @@ var ts; }); parsedConfigs = undefined; } + if (packageJsonMap) { + ts.clearMap(packageJsonMap, ts.closeFileWatcher); + packageJsonMap = undefined; + } } function getCurrentBuilderProgram() { return builderProgram; diff --git a/lib/tsserver.js b/lib/tsserver.js index 6e4ee30b7be1d..fe6210be028d9 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -100,7 +100,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.4.2"; + ts.version = "4.4.3"; /* @internal */ var Comparison; (function (Comparison) { @@ -118027,6 +118027,10 @@ var ts; }); parsedConfigs = undefined; } + if (packageJsonMap) { + ts.clearMap(packageJsonMap, ts.closeFileWatcher); + packageJsonMap = undefined; + } } function getCurrentBuilderProgram() { return builderProgram; @@ -126702,13 +126706,16 @@ var ts; case 204 /* PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; - if ((ts.isCallExpression(node) || ts.isFunctionLike(node)) && - node.end === contextToken.pos && - node.getChildCount(sourceFile) && - ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */) { + var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); + if (ts.nodeIsMissing(leftmostAccessExpression) || + ((ts.isCallExpression(node) || ts.isFunctionLike(node)) && + node.end === contextToken.pos && + node.getChildCount(sourceFile) && + ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */)) { // This is likely dot from incorrectly parsed expression and user is starting to write spread // eg: Math.min(./**/) // const x = function (./**/) {} + // ({./**/}) return undefined; } break; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 5fa1cd290e10a..d7f4aeafca012 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -294,7 +294,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.4.2"; + ts.version = "4.4.3"; /* @internal */ var Comparison; (function (Comparison) { @@ -118221,6 +118221,10 @@ var ts; }); parsedConfigs = undefined; } + if (packageJsonMap) { + ts.clearMap(packageJsonMap, ts.closeFileWatcher); + packageJsonMap = undefined; + } } function getCurrentBuilderProgram() { return builderProgram; @@ -127284,13 +127288,16 @@ var ts; case 204 /* PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; - if ((ts.isCallExpression(node) || ts.isFunctionLike(node)) && - node.end === contextToken.pos && - node.getChildCount(sourceFile) && - ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */) { + var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); + if (ts.nodeIsMissing(leftmostAccessExpression) || + ((ts.isCallExpression(node) || ts.isFunctionLike(node)) && + node.end === contextToken.pos && + node.getChildCount(sourceFile) && + ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */)) { // This is likely dot from incorrectly parsed expression and user is starting to write spread // eg: Math.min(./**/) // const x = function (./**/) {} + // ({./**/}) return undefined; } break; diff --git a/lib/typescript.js b/lib/typescript.js index 44462973f29fb..ebd4c15a2a6a7 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -294,7 +294,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.4.2"; + ts.version = "4.4.3"; /* @internal */ var Comparison; (function (Comparison) { @@ -118221,6 +118221,10 @@ var ts; }); parsedConfigs = undefined; } + if (packageJsonMap) { + ts.clearMap(packageJsonMap, ts.closeFileWatcher); + packageJsonMap = undefined; + } } function getCurrentBuilderProgram() { return builderProgram; @@ -127284,13 +127288,16 @@ var ts; case 204 /* PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; - if ((ts.isCallExpression(node) || ts.isFunctionLike(node)) && - node.end === contextToken.pos && - node.getChildCount(sourceFile) && - ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */) { + var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); + if (ts.nodeIsMissing(leftmostAccessExpression) || + ((ts.isCallExpression(node) || ts.isFunctionLike(node)) && + node.end === contextToken.pos && + node.getChildCount(sourceFile) && + ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */)) { // This is likely dot from incorrectly parsed expression and user is starting to write spread // eg: Math.min(./**/) // const x = function (./**/) {} + // ({./**/}) return undefined; } break; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 20a6fc52e509b..9fb67067ec13c 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -294,7 +294,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.4.2"; + ts.version = "4.4.3"; /* @internal */ var Comparison; (function (Comparison) { @@ -118221,6 +118221,10 @@ var ts; }); parsedConfigs = undefined; } + if (packageJsonMap) { + ts.clearMap(packageJsonMap, ts.closeFileWatcher); + packageJsonMap = undefined; + } } function getCurrentBuilderProgram() { return builderProgram; @@ -127284,13 +127288,16 @@ var ts; case 204 /* PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; - if ((ts.isCallExpression(node) || ts.isFunctionLike(node)) && - node.end === contextToken.pos && - node.getChildCount(sourceFile) && - ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */) { + var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); + if (ts.nodeIsMissing(leftmostAccessExpression) || + ((ts.isCallExpression(node) || ts.isFunctionLike(node)) && + node.end === contextToken.pos && + node.getChildCount(sourceFile) && + ts.last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */)) { // This is likely dot from incorrectly parsed expression and user is starting to write spread // eg: Math.min(./**/) // const x = function (./**/) {} + // ({./**/}) return undefined; } break; diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index a0e7177a10ceb..ba475a0e8e99f 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -89,7 +89,7 @@ var ts; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.4.2"; + ts.version = "4.4.3"; /* @internal */ var Comparison; (function (Comparison) { @@ -118016,6 +118016,10 @@ var ts; }); parsedConfigs = undefined; } + if (packageJsonMap) { + ts.clearMap(packageJsonMap, ts.closeFileWatcher); + packageJsonMap = undefined; + } } function getCurrentBuilderProgram() { return builderProgram; diff --git a/package.json b/package.json index d62bcb0c5f439..a7b638357953d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "4.4.2", + "version": "4.4.3", "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 f82b32beb3570..2d7cc75a278f3 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -5,7 +5,7 @@ namespace ts { // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - export const version = "4.4.2" as string; + export const version = "4.4.3" as string; /** * Type of objects whose values are all of the same type. diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index bfcdc4c8a1d2a..1cc21a0bc9400 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -404,6 +404,10 @@ namespace ts { }); parsedConfigs = undefined; } + if (packageJsonMap) { + clearMap(packageJsonMap, closeFileWatcher); + packageJsonMap = undefined!; + } } function getCurrentBuilderProgram() { diff --git a/src/services/completions.ts b/src/services/completions.ts index 285095e727a0c..ef16b782c2971 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -1338,13 +1338,16 @@ namespace ts.Completions { case SyntaxKind.PropertyAccessExpression: propertyAccessToConvert = parent as PropertyAccessExpression; node = propertyAccessToConvert.expression; - if ((isCallExpression(node) || isFunctionLike(node)) && - node.end === contextToken.pos && - node.getChildCount(sourceFile) && - last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken) { + const leftmostAccessExpression = getLeftmostAccessExpression(propertyAccessToConvert); + if (nodeIsMissing(leftmostAccessExpression) || + ((isCallExpression(node) || isFunctionLike(node)) && + node.end === contextToken.pos && + node.getChildCount(sourceFile) && + last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken)) { // This is likely dot from incorrectly parsed expression and user is starting to write spread // eg: Math.min(./**/) // const x = function (./**/) {} + // ({./**/}) return undefined; } break; diff --git a/tests/baselines/reference/tscWatch/incremental/editing-module-augmentation-watch.js b/tests/baselines/reference/tscWatch/incremental/editing-module-augmentation-watch.js index 381d2d4f0f640..14d6f7c11844c 100644 --- a/tests/baselines/reference/tscWatch/incremental/editing-module-augmentation-watch.js +++ b/tests/baselines/reference/tscWatch/incremental/editing-module-augmentation-watch.js @@ -203,9 +203,6 @@ Shape signatures in builder refreshed for:: /users/username/projects/project/src/index.ts (computed .d.ts) WatchedFiles:: -/users/username/projects/project/node_modules/classnames/package.json: - {"fileName":"/users/username/projects/project/node_modules/classnames/package.json","pollingInterval":250} - {"fileName":"/users/username/projects/project/node_modules/classnames/package.json","pollingInterval":250} /users/username/projects/project/tsconfig.json: {"fileName":"/users/username/projects/project/tsconfig.json","pollingInterval":250} /users/username/projects/project/src/index.ts: @@ -216,6 +213,8 @@ WatchedFiles:: {"fileName":"/users/username/projects/project/src/types/classnames.d.ts","pollingInterval":250} /a/lib/lib.d.ts: {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/users/username/projects/project/node_modules/classnames/package.json: + {"fileName":"/users/username/projects/project/node_modules/classnames/package.json","pollingInterval":250} FsWatches:: diff --git a/tests/baselines/reference/tscWatch/incremental/importHelpers-backing-types-removed-watch.js b/tests/baselines/reference/tscWatch/incremental/importHelpers-backing-types-removed-watch.js index 49041b04874bf..54acbbd1a410d 100644 --- a/tests/baselines/reference/tscWatch/incremental/importHelpers-backing-types-removed-watch.js +++ b/tests/baselines/reference/tscWatch/incremental/importHelpers-backing-types-removed-watch.js @@ -122,15 +122,14 @@ Shape signatures in builder refreshed for:: /users/username/projects/project/index.tsx (used version) WatchedFiles:: -/users/username/projects/project/node_modules/tslib/package.json: - {"fileName":"/users/username/projects/project/node_modules/tslib/package.json","pollingInterval":250} - {"fileName":"/users/username/projects/project/node_modules/tslib/package.json","pollingInterval":250} /users/username/projects/project/tsconfig.json: {"fileName":"/users/username/projects/project/tsconfig.json","pollingInterval":250} /users/username/projects/project/index.tsx: {"fileName":"/users/username/projects/project/index.tsx","pollingInterval":250} /a/lib/lib.d.ts: {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/users/username/projects/project/node_modules/tslib/package.json: + {"fileName":"/users/username/projects/project/node_modules/tslib/package.json","pollingInterval":250} FsWatches:: diff --git a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-backing-types-removed-watch.js b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-backing-types-removed-watch.js index 9f5e8e47e58e1..641134714d966 100644 --- a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-backing-types-removed-watch.js +++ b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-backing-types-removed-watch.js @@ -190,18 +190,16 @@ Shape signatures in builder refreshed for:: /users/username/projects/project/index.tsx (computed .d.ts) WatchedFiles:: -/users/username/projects/project/node_modules/react/jsx-runtime/package.json: - {"fileName":"/users/username/projects/project/node_modules/react/jsx-runtime/package.json","pollingInterval":250} - {"fileName":"/users/username/projects/project/node_modules/react/jsx-runtime/package.json","pollingInterval":250} -/users/username/projects/project/node_modules/react/package.json: - {"fileName":"/users/username/projects/project/node_modules/react/package.json","pollingInterval":250} - {"fileName":"/users/username/projects/project/node_modules/react/package.json","pollingInterval":250} /users/username/projects/project/tsconfig.json: {"fileName":"/users/username/projects/project/tsconfig.json","pollingInterval":250} /users/username/projects/project/index.tsx: {"fileName":"/users/username/projects/project/index.tsx","pollingInterval":250} /a/lib/lib.d.ts: {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/users/username/projects/project/node_modules/react/jsx-runtime/package.json: + {"fileName":"/users/username/projects/project/node_modules/react/jsx-runtime/package.json","pollingInterval":250} +/users/username/projects/project/node_modules/react/package.json: + {"fileName":"/users/username/projects/project/node_modules/react/package.json","pollingInterval":250} FsWatches:: diff --git a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js index cd4b2d10192ef..0d39109590ffe 100644 --- a/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js +++ b/tests/baselines/reference/tscWatch/incremental/jsxImportSource-option-changed-watch.js @@ -225,10 +225,6 @@ Shape signatures in builder refreshed for:: /users/username/projects/project/index.tsx (computed .d.ts) WatchedFiles:: -/users/username/projects/project/node_modules/react/jsx-runtime/package.json: - {"fileName":"/users/username/projects/project/node_modules/react/jsx-runtime/package.json","pollingInterval":250} -/users/username/projects/project/node_modules/react/package.json: - {"fileName":"/users/username/projects/project/node_modules/react/package.json","pollingInterval":250} /users/username/projects/project/tsconfig.json: {"fileName":"/users/username/projects/project/tsconfig.json","pollingInterval":250} /users/username/projects/project/index.tsx: diff --git a/tests/cases/fourslash/getJavaScriptCompletions22.ts b/tests/cases/fourslash/getJavaScriptCompletions22.ts new file mode 100644 index 0000000000000..86f82a346eeb5 --- /dev/null +++ b/tests/cases/fourslash/getJavaScriptCompletions22.ts @@ -0,0 +1,12 @@ +/// + +// Regresion test for GH#45436 + +// @allowNonTsExtensions: true +// @Filename: file.js +//// const abc = {}; +//// ({./*1*/}); + +goTo.marker('1'); +edit.insert('.'); +verify.completions({ exact: undefined });