diff --git a/package-lock.json b/package-lock.json index 428aac313b0..d829cabf8c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1582,19 +1582,19 @@ "clone": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18=", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", "dev": true }, "clone-buffer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", - "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", + "integrity": "sha512-KLLTJWrvwIP+OPfMn0x2PheDEP20RPUcGXj/ERegTgdmPEZylALQldygiqrPPu8P45uNuPs7ckmReLY6v/iA5g==", "dev": true }, "clone-stats": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha1-s3gt/4u1R04Yuba/D9/ngvh3doA=", + "integrity": "sha512-au6ydSpg6nsrigcZ4m8Bc9hxjeW+GJ8xh5G3BJCMt4WXe1H10UNaVOamqQTmrx1kjVuxAHIQSNU6hY4Nsn9/ag==", "dev": true }, "cloneable-readable": { diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 66a9f6393dc..3cefcf33bf2 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2834,12 +2834,14 @@ namespace ts { } function setCommonJsModuleIndicator(node: Node) { - if (file.externalModuleIndicator) { + if (file.externalModuleIndicator && file.externalModuleIndicator !== true) { return false; } if (!file.commonJsModuleIndicator) { file.commonJsModuleIndicator = node; - bindSourceFileAsExternalModule(); + if (!file.externalModuleIndicator) { + bindSourceFileAsExternalModule(); + } } return true; } @@ -3291,7 +3293,12 @@ namespace ts { } if (!isBindingPattern(node.name)) { - if (isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & ModifierFlags.Export)) { + const possibleVariableDecl = node.kind === SyntaxKind.VariableDeclaration ? node : node.parent.parent; + if (isInJSFile(node) && + isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && + !getJSDocTypeTag(node) && + !(getCombinedModifierFlags(node) & ModifierFlags.Export) + ) { declareSymbolAndAddToSymbolTable(node as Declaration, SymbolFlags.Alias, SymbolFlags.AliasExcludes); } else if (isBlockOrCatchScoped(node)) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 974220eb2d4..a921bcd3ec0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2641,7 +2641,8 @@ namespace ts { && isAliasableOrJsExpression(node.parent.right) || node.kind === SyntaxKind.ShorthandPropertyAssignment || node.kind === SyntaxKind.PropertyAssignment && isAliasableOrJsExpression((node as PropertyAssignment).initializer) - || isVariableDeclarationInitializedToBareOrAccessedRequire(node); + || node.kind === SyntaxKind.VariableDeclaration && isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === SyntaxKind.BindingElement && isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e: Expression) { @@ -2746,7 +2747,7 @@ namespace ts { return hasExportAssignmentSymbol(moduleSymbol); } // JS files have a synthetic default if they do not contain ES2015+ module syntax (export = is not valid in js) _and_ do not have an __esModule marker - return !file.externalModuleIndicator && !resolveExportByName(moduleSymbol, escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias); + return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, escapeLeadingUnderscores("__esModule"), /*sourceNode*/ undefined, dontResolveAlias); } function getTargetOfImportClause(node: ImportClause, dontResolveAlias: boolean): Symbol | undefined { @@ -37819,8 +37820,8 @@ namespace ts { } // For a commonjs `const x = require`, validate the alias and exit const symbol = getSymbolOfNode(node); - if (symbol.flags & SymbolFlags.Alias && isVariableDeclarationInitializedToBareOrAccessedRequire(node)) { - checkAliasSymbol(node); + if (symbol.flags & SymbolFlags.Alias && isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === SyntaxKind.BindingElement ? node.parent.parent : node)) { + checkAliasSymbol(node as BindingElement | VariableDeclaration); return; } @@ -40684,7 +40685,7 @@ namespace ts { return true; } - function checkAliasSymbol(node: ImportEqualsDeclaration | VariableDeclaration | ImportClause | NamespaceImport | ImportSpecifier | ExportSpecifier | NamespaceExport) { + function checkAliasSymbol(node: ImportEqualsDeclaration | VariableDeclaration | ImportClause | NamespaceImport | ImportSpecifier | ExportSpecifier | NamespaceExport | BindingElement) { let symbol = getSymbolOfNode(node); const target = resolveAlias(symbol); diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 3ce06e5f4ca..6e39a9d8cbe 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -3638,7 +3638,7 @@ namespace ts { } if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) { return { - key: useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec), + key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames ? spec : toFileNameLowerCase(spec)), flags: WatchDirectoryFlags.Recursive }; } diff --git a/src/compiler/moduleNameResolver.ts b/src/compiler/moduleNameResolver.ts index 8f466c0495a..d2b0db1041b 100644 --- a/src/compiler/moduleNameResolver.ts +++ b/src/compiler/moduleNameResolver.ts @@ -1288,18 +1288,22 @@ namespace ts { ); } + const jsOnlyExtensions = [Extensions.JavaScript]; + const tsExtensions = [Extensions.TypeScript, Extensions.JavaScript]; + const tsPlusJsonExtensions = [...tsExtensions, Extensions.Json]; + const tsconfigExtensions = [Extensions.TSConfig]; function nodeNextModuleNameResolverWorker(features: NodeResolutionFeatures, moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference, resolutionMode?: ModuleKind.CommonJS | ModuleKind.ESNext): ResolvedModuleWithFailedLookupLocations { const containingDirectory = getDirectoryPath(containingFile); // es module file or cjs-like input file, use a variant of the legacy cjs resolver that supports the selected modern features const esmMode = resolutionMode === ModuleKind.ESNext ? NodeResolutionFeatures.EsmMode : 0; - return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions, redirectedReference); + let extensions = compilerOptions.noDtsResolution ? [Extensions.TsOnly, Extensions.JavaScript] : tsExtensions; + if (compilerOptions.resolveJsonModule) { + extensions = [...extensions, Extensions.Json]; + } + return nodeModuleNameResolverWorker(features | esmMode, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference); } - const jsOnlyExtensions = [Extensions.JavaScript]; - const tsExtensions = [Extensions.TypeScript, Extensions.JavaScript]; - const tsPlusJsonExtensions = [...tsExtensions, Extensions.Json]; - const tsconfigExtensions = [Extensions.TSConfig]; function tryResolveJSModuleWorker(moduleName: string, initialDir: string, host: ModuleResolutionHost): ResolvedModuleWithFailedLookupLocations { return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6d60cc3e84a..cfc21f8f957 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -8821,6 +8821,7 @@ namespace ts { readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; readonly includeInlayFunctionParameterTypeHints?: boolean, readonly includeInlayVariableTypeHints?: boolean; + readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean; readonly includeInlayPropertyDeclarationTypeHints?: boolean; readonly includeInlayFunctionLikeReturnTypeHints?: boolean; readonly includeInlayEnumMemberValueHints?: boolean; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 02dfc85ff3a..22f4065c996 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -2197,9 +2197,6 @@ namespace ts { } function isVariableDeclarationInitializedWithRequireHelper(node: Node, allowAccessedRequire: boolean) { - if (node.kind === SyntaxKind.BindingElement) { - node = node.parent.parent; - } return isVariableDeclaration(node) && !!node.initializer && isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true); @@ -6305,8 +6302,9 @@ namespace ts { */ function isFileForcedToBeModuleByFormat(file: SourceFile): true | undefined { // Excludes declaration files - they still require an explicit `export {}` or the like - // for back compat purposes. - return file.impliedNodeFormat === ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined; + // for back compat purposes. The only non-declaration files _not_ forced to be a module are `.js` files + // that aren't esm-mode (meaning not in a `type: module` scope). + return (file.impliedNodeFormat === ModuleKind.ESNext || (fileExtensionIsOneOf(file.fileName, [Extension.Cjs, Extension.Cts]))) && !file.isDeclarationFile ? true : undefined; } export function getSetExternalModuleIndicator(options: CompilerOptions): (file: SourceFile) => void { @@ -6315,7 +6313,7 @@ namespace ts { case ModuleDetectionKind.Force: // All non-declaration files are modules, declaration files still do the usual isFileProbablyExternalModule return (file: SourceFile) => { - file.externalModuleIndicator = !file.isDeclarationFile || isFileProbablyExternalModule(file); + file.externalModuleIndicator = isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined; }; case ModuleDetectionKind.Legacy: // Files are modules if they have imports, exports, or import.meta @@ -6375,7 +6373,8 @@ namespace ts { } export function getEmitModuleDetectionKind(options: CompilerOptions) { - return options.moduleDetection || ModuleDetectionKind.Auto; + return options.moduleDetection || + (getEmitModuleKind(options) === ModuleKind.Node16 || getEmitModuleKind(options) === ModuleKind.NodeNext ? ModuleDetectionKind.Force : ModuleDetectionKind.Auto); } export function hasJsonModuleEmitEnabled(options: CompilerOptions) { diff --git a/src/compiler/watchPublic.ts b/src/compiler/watchPublic.ts index e3257391f9e..5b2482bb4bb 100644 --- a/src/compiler/watchPublic.ts +++ b/src/compiler/watchPublic.ts @@ -710,6 +710,7 @@ namespace ts { function reloadFileNamesFromConfigFile() { writeLog("Reloading new file names and options"); + reloadLevel = ConfigFileProgramReloadLevel.None; rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile!.configFileSpecs!, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions); if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile!.configFileSpecs!, configFileParsingDiagnostics!, canConfigFileJsonReportNoInputFiles)) { hasChangedConfigFileParsingErrors = true; diff --git a/src/harness/fourslashInterfaceImpl.ts b/src/harness/fourslashInterfaceImpl.ts index a4412ca8826..ab830bb0a5e 100644 --- a/src/harness/fourslashInterfaceImpl.ts +++ b/src/harness/fourslashInterfaceImpl.ts @@ -1498,6 +1498,7 @@ namespace FourSlashInterface { "throw", "true", "try", + "type", "typeof", "var", "void", @@ -1649,6 +1650,7 @@ namespace FourSlashInterface { "throw", "true", "try", + "type", "typeof", "var", "void", diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 121b69895f9..623699de435 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -728,7 +728,7 @@ namespace ts.server.protocol { } // All we need is the `success` and `message` fields of Response. - export interface ApplyCodeActionCommandResponse extends Response {} + export interface ApplyCodeActionCommandResponse extends Response { } export interface FileRangeRequestArgs extends FileRequestArgs { /** @@ -1067,7 +1067,7 @@ namespace ts.server.protocol { readonly arguments: JsxClosingTagRequestArgs; } - export interface JsxClosingTagRequestArgs extends FileLocationRequestArgs {} + export interface JsxClosingTagRequestArgs extends FileLocationRequestArgs { } export interface JsxClosingTagResponse extends Response { readonly body: TextInsertion; @@ -2390,7 +2390,7 @@ namespace ts.server.protocol { /** * Human-readable description of the `source` from the CompletionEntry. */ - sourceDisplay?: SymbolDisplayPart[]; + sourceDisplay?: SymbolDisplayPart[]; } /** @deprecated Prefer CompletionInfoResponse, which supports several top-level fields in addition to the array of entries. */ @@ -3415,7 +3415,7 @@ namespace ts.server.protocol { /** * Allows completions to be formatted with snippet text, indicated by `CompletionItem["isSnippet"]`. */ - readonly includeCompletionsWithSnippetText?: boolean; + readonly includeCompletionsWithSnippetText?: boolean; /** * If enabled, the completion list will include completions with invalid identifier names. * For those entries, The `insertText` and `replacementSpan` properties will be set to change from `.x` property access to `["x"]`. @@ -3465,6 +3465,7 @@ namespace ts.server.protocol { readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; readonly includeInlayFunctionParameterTypeHints?: boolean, readonly includeInlayVariableTypeHints?: boolean; + readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean; readonly includeInlayPropertyDeclarationTypeHints?: boolean; readonly includeInlayFunctionLikeReturnTypeHints?: boolean; readonly includeInlayEnumMemberValueHints?: boolean; diff --git a/src/server/session.ts b/src/server/session.ts index 2a524516ed4..0905c46ecca 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -379,8 +379,8 @@ namespace ts.server { // have started the other project searches from related symbols. Propagate the // correct results to all other projects. - const defaultProjectResults = perProjectResults.get(defaultProject)!; - if (defaultProjectResults[0].references[0].isDefinition === undefined) { + const defaultProjectResults = perProjectResults.get(defaultProject); + if (defaultProjectResults?.[0].references[0]?.isDefinition === undefined) { // Clear all isDefinition properties perProjectResults.forEach(projectResults => { for (const referencedSymbol of projectResults) { @@ -575,13 +575,11 @@ namespace ts.server { // it easier for the caller to skip post-processing. if (searchedProjects.size === 1) { const it = resultsMap.values().next(); - Debug.assert(!it.done); - return it.value; + return it.done ? emptyArray : it.value; // There may not be any results at all } return resultsMap; - // May enqueue to otherPositionQueue function searchPosition(project: Project, location: DocumentPosition): readonly TResult[] | undefined { const projectResults = getResultsForPosition(project, location); if (!projectResults) return undefined; diff --git a/src/services/completions.ts b/src/services/completions.ts index 27066f7b72e..52a7bc89d4d 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -3988,6 +3988,7 @@ namespace ts.Completions { return kind === SyntaxKind.AsyncKeyword || kind === SyntaxKind.AwaitKeyword || kind === SyntaxKind.AsKeyword + || kind === SyntaxKind.TypeKeyword || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index a6253eeafa5..b9ba94daef0 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -1601,7 +1601,7 @@ namespace ts.FindAllReferences { // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (isInJSFile(referenceLocation) && referenceLocation.parent.kind === SyntaxKind.BindingElement - && isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent)) { + && isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In // this case, just skip it, since the bound identifiers are not an alias of the import. diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index b3e84023d17..256398d9a20 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -836,11 +836,9 @@ namespace ts.formatting { if (listEndToken !== SyntaxKind.Unknown && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { let tokenInfo: TokenInfo | undefined = formattingScanner.readTokenInfo(parent); if (tokenInfo.token.kind === SyntaxKind.CommaToken && isCallLikeExpression(parent)) { - const commaTokenLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; - if (startLine !== commaTokenLine) { - formattingScanner.advance(); - tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined; - } + // consume the comma + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation, parent); + tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent) : undefined; } // consume the list end token only if it is still belong to the parent diff --git a/src/services/importTracker.ts b/src/services/importTracker.ts index a3fcfb76680..6ea4de1e952 100644 --- a/src/services/importTracker.ts +++ b/src/services/importTracker.ts @@ -621,7 +621,7 @@ namespace ts.FindAllReferences { Debug.assert((parent as ImportClause | NamespaceImport).name === node); return true; case SyntaxKind.BindingElement: - return isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(parent); + return isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; } diff --git a/src/services/inlayHints.ts b/src/services/inlayHints.ts index 110e9718405..ca95df202b8 100644 --- a/src/services/inlayHints.ts +++ b/src/services/inlayHints.ts @@ -137,6 +137,10 @@ namespace ts.InlayHints { const typeDisplayString = printTypeInSingleLine(declarationType); if (typeDisplayString) { + const isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && equateStringsCaseInsensitive(decl.name.getText(), typeDisplayString); + if (isVariableNameMatchesType) { + return; + } addTypeHints(typeDisplayString, decl.name.end); } } diff --git a/src/testRunner/unittests/config/tsconfigParsing.ts b/src/testRunner/unittests/config/tsconfigParsing.ts index de793bffa4e..9a5e46322e4 100644 --- a/src/testRunner/unittests/config/tsconfigParsing.ts +++ b/src/testRunner/unittests/config/tsconfigParsing.ts @@ -421,5 +421,14 @@ namespace ts { const parsedCommand = parseJsonConfigFileContent(parsed.config, sys, "/foo.bar"); assert.deepEqual(parsedCommand.wildcardDirectories, { "/foo.bar/src": WatchDirectoryFlags.Recursive }); }); + + it("correctly parses wild card directories from implicit glob when two keys differ only in directory seperator", () => { + const parsed = parseConfigFileTextToJson("/foo.bar/tsconfig.json", JSON.stringify({ + include: ["./", "./**/*.json"] + })); + + const parsedCommand = parseJsonConfigFileContent(parsed.config, sys, "/foo"); + assert.deepEqual(parsedCommand.wildcardDirectories, { "/foo": WatchDirectoryFlags.Recursive }); + }); }); } diff --git a/src/testRunner/unittests/tscWatch/programUpdates.ts b/src/testRunner/unittests/tscWatch/programUpdates.ts index 68f03f0d20c..a17f857024f 100644 --- a/src/testRunner/unittests/tscWatch/programUpdates.ts +++ b/src/testRunner/unittests/tscWatch/programUpdates.ts @@ -616,6 +616,39 @@ export class A { ] }); + verifyTscWatch({ + scenario, + subScenario: "correctly parses wild card directories from implicit glob when two keys differ only in directory seperator", + commandLineArgs: ["-w", "--extendedDiagnostics"], + sys: () => { + const file1 = { + path: `${projectRoot}/f1.ts`, + content: "export const x = 1" + }; + const file2 = { + path: `${projectRoot}/f2.ts`, + content: "export const y = 1" + }; + const configFile = { + path: `${projectRoot}/tsconfig.json`, + content: JSON.stringify({ compilerOptions: { composite: true }, include: ["./", "./**/*.json"] }) + }; + return createWatchedSystem([file1, file2, libFile, configFile], { currentDirectory: projectRoot }); + }, + changes: [ + { + caption: "Add new file", + change: sys => sys.writeFile(`${projectRoot}/new-file.ts`, "export const z = 1;"), + timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), + }, + { + caption: "Import new file", + change: sys => sys.prependFile(`${projectRoot}/f1.ts`, `import { z } from "./new-file";`), + timeouts: sys => sys.checkTimeoutQueueLengthAndRun(1), + } + ] + }); + verifyTscWatch({ scenario, subScenario: "can correctly update configured project when set of root files has changed through include", diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 72a61813603..61ff90f4009 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -4120,6 +4120,7 @@ declare namespace ts { readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; readonly includeInlayFunctionParameterTypeHints?: boolean; readonly includeInlayVariableTypeHints?: boolean; + readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean; readonly includeInlayPropertyDeclarationTypeHints?: boolean; readonly includeInlayFunctionLikeReturnTypeHints?: boolean; readonly includeInlayEnumMemberValueHints?: boolean; @@ -9711,6 +9712,7 @@ declare namespace ts.server.protocol { readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; readonly includeInlayFunctionParameterTypeHints?: boolean; readonly includeInlayVariableTypeHints?: boolean; + readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean; readonly includeInlayPropertyDeclarationTypeHints?: boolean; readonly includeInlayFunctionLikeReturnTypeHints?: boolean; readonly includeInlayEnumMemberValueHints?: boolean; diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index eee20774742..f12f4c47c68 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4120,6 +4120,7 @@ declare namespace ts { readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; readonly includeInlayFunctionParameterTypeHints?: boolean; readonly includeInlayVariableTypeHints?: boolean; + readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean; readonly includeInlayPropertyDeclarationTypeHints?: boolean; readonly includeInlayFunctionLikeReturnTypeHints?: boolean; readonly includeInlayEnumMemberValueHints?: boolean; diff --git a/tests/baselines/reference/completionsCommentsClassMembers.baseline b/tests/baselines/reference/completionsCommentsClassMembers.baseline index 6180976aaba..c09142c2a91 100644 --- a/tests/baselines/reference/completionsCommentsClassMembers.baseline +++ b/tests/baselines/reference/completionsCommentsClassMembers.baseline @@ -4223,6 +4223,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -11284,6 +11296,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -16098,6 +16122,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -23159,6 +23195,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -27224,6 +27272,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -32445,6 +32505,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -36464,6 +36536,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -41639,6 +41723,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -46860,6 +46956,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -52081,6 +52189,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -57302,6 +57422,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -61362,6 +61494,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -65422,6 +65566,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -69482,6 +69638,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -73542,6 +73710,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -77602,6 +77782,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -81662,6 +81854,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -96035,6 +96239,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", diff --git a/tests/baselines/reference/completionsCommentsCommentParsing.baseline b/tests/baselines/reference/completionsCommentsCommentParsing.baseline index d4a9a88a0a1..99a71cece80 100644 --- a/tests/baselines/reference/completionsCommentsCommentParsing.baseline +++ b/tests/baselines/reference/completionsCommentsCommentParsing.baseline @@ -5057,6 +5057,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -11349,6 +11361,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -17125,6 +17149,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -28569,6 +28605,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -34861,6 +34909,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", diff --git a/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline b/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline index 3c056e5f263..4e3bcb80145 100644 --- a/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline +++ b/tests/baselines/reference/completionsCommentsFunctionDeclaration.baseline @@ -3568,6 +3568,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -7197,6 +7209,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -11356,6 +11380,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", diff --git a/tests/baselines/reference/completionsCommentsFunctionExpression.baseline b/tests/baselines/reference/completionsCommentsFunctionExpression.baseline index e153a2ecdaf..4fac96f0abb 100644 --- a/tests/baselines/reference/completionsCommentsFunctionExpression.baseline +++ b/tests/baselines/reference/completionsCommentsFunctionExpression.baseline @@ -11647,6 +11647,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", @@ -15990,6 +16002,18 @@ } ] }, + { + "name": "type", + "kind": "keyword", + "kindModifiers": "", + "sortText": "15", + "displayParts": [ + { + "text": "type", + "kind": "keyword" + } + ] + }, { "name": "TypeError", "kind": "var", diff --git a/tests/baselines/reference/moduleResolutionWithoutExtension8.js b/tests/baselines/reference/moduleResolutionWithoutExtension8.js index 593f3668b3c..7410092fdbc 100644 --- a/tests/baselines/reference/moduleResolutionWithoutExtension8.js +++ b/tests/baselines/reference/moduleResolutionWithoutExtension8.js @@ -3,5 +3,7 @@ import("./foo").then(x => x); // should error, ask for extension //// [bar.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // Extensionless relative path dynamic import in a cjs module import("./foo").then(x => x); // should error, ask for extension diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node16).js b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node16).js index 10d6da622e9..7eb839f9e46 100644 --- a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node16).js +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=node16).js @@ -34,6 +34,8 @@ module.exports = a; const a = {}; module.exports = a; //// [file.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file const a = {}; module.exports = a; diff --git a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=nodenext).js b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=nodenext).js index 10d6da622e9..7eb839f9e46 100644 --- a/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesAllowJsExportAssignment(module=nodenext).js @@ -34,6 +34,8 @@ module.exports = a; const a = {}; module.exports = a; //// [file.js] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); // cjs format file const a = {}; module.exports = a; diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node16).js b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node16).js new file mode 100644 index 00000000000..e3ca6368e77 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node16).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts] //// + +//// [foo.cjs] +// this file is a module despite having no imports +//// [bar.js] +// however this file is _not_ a module + +//// [foo.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// this file is a module despite having no imports +//// [bar.js] +// however this file is _not_ a module diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node16).symbols b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node16).symbols new file mode 100644 index 00000000000..e4e9a53aa59 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node16).symbols @@ -0,0 +1,5 @@ +=== tests/cases/conformance/node/allowJs/foo.cjs === +// this file is a module despite having no imports +No type information for this code.=== tests/cases/conformance/node/allowJs/bar.js === +// however this file is _not_ a module +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node16).types b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node16).types new file mode 100644 index 00000000000..e4e9a53aa59 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=node16).types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/node/allowJs/foo.cjs === +// this file is a module despite having no imports +No type information for this code.=== tests/cases/conformance/node/allowJs/bar.js === +// however this file is _not_ a module +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=nodenext).js b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=nodenext).js new file mode 100644 index 00000000000..e3ca6368e77 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=nodenext).js @@ -0,0 +1,13 @@ +//// [tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts] //// + +//// [foo.cjs] +// this file is a module despite having no imports +//// [bar.js] +// however this file is _not_ a module + +//// [foo.cjs] +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// this file is a module despite having no imports +//// [bar.js] +// however this file is _not_ a module diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=nodenext).symbols b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=nodenext).symbols new file mode 100644 index 00000000000..e4e9a53aa59 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=nodenext).symbols @@ -0,0 +1,5 @@ +=== tests/cases/conformance/node/allowJs/foo.cjs === +// this file is a module despite having no imports +No type information for this code.=== tests/cases/conformance/node/allowJs/bar.js === +// however this file is _not_ a module +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=nodenext).types b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=nodenext).types new file mode 100644 index 00000000000..e4e9a53aa59 --- /dev/null +++ b/tests/baselines/reference/nodeModulesAllowJsExportlessJsModuleDetectionAuto(module=nodenext).types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/node/allowJs/foo.cjs === +// this file is a module despite having no imports +No type information for this code.=== tests/cases/conformance/node/allowJs/bar.js === +// however this file is _not_ a module +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/referenceToEmptyObject.baseline.jsonc b/tests/baselines/reference/referenceToEmptyObject.baseline.jsonc new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/tests/baselines/reference/referenceToEmptyObject.baseline.jsonc @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/baselines/reference/referencesInEmptyFile.baseline.jsonc b/tests/baselines/reference/referencesInEmptyFile.baseline.jsonc new file mode 100644 index 00000000000..0637a088a01 --- /dev/null +++ b/tests/baselines/reference/referencesInEmptyFile.baseline.jsonc @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/baselines/reference/referencesInEmptyFileWithMultipleProjects.baseline.jsonc b/tests/baselines/reference/referencesInEmptyFileWithMultipleProjects.baseline.jsonc new file mode 100644 index 00000000000..91fe4e8e051 --- /dev/null +++ b/tests/baselines/reference/referencesInEmptyFileWithMultipleProjects.baseline.jsonc @@ -0,0 +1,3 @@ +[] + +[] \ No newline at end of file diff --git a/tests/baselines/reference/referencesInStringLiteralValueWithMultipleProjects.baseline.jsonc b/tests/baselines/reference/referencesInStringLiteralValueWithMultipleProjects.baseline.jsonc new file mode 100644 index 00000000000..d0bd5fdd355 --- /dev/null +++ b/tests/baselines/reference/referencesInStringLiteralValueWithMultipleProjects.baseline.jsonc @@ -0,0 +1,24 @@ +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/a/a.ts", + "kind": "var", + "name": "hello", + "textSpan": { + "start": 56, + "length": 5 + }, + "displayParts": [ + { + "text": "\"hello\"", + "kind": "stringLiteral" + } + ] + }, + "references": [] + } +] + +[] \ No newline at end of file diff --git a/tests/baselines/reference/referencesToStringLiteralValue.baseline.jsonc b/tests/baselines/reference/referencesToStringLiteralValue.baseline.jsonc new file mode 100644 index 00000000000..9cb62930bc0 --- /dev/null +++ b/tests/baselines/reference/referencesToStringLiteralValue.baseline.jsonc @@ -0,0 +1,22 @@ +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/server/referencesToStringLiteralValue.ts", + "kind": "var", + "name": "some string", + "textSpan": { + "start": 19, + "length": 12 + }, + "displayParts": [ + { + "text": "\"some string\"", + "kind": "stringLiteral" + } + ] + }, + "references": [] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node16).js b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node16).js index 89dd2c7541a..7c518b3b9d9 100644 --- a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node16).js +++ b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=node16).js @@ -14,5 +14,7 @@ interface GlobalThing { a: number } const a: GlobalThing = { a: 0 }; //// [usage.js] +"use strict"; /// +Object.defineProperty(exports, "__esModule", { value: true }); const a = { a: 0 }; diff --git a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js index 89dd2c7541a..7c518b3b9d9 100644 --- a/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js +++ b/tests/baselines/reference/tripleSlashTypesReferenceWithMissingExports(module=nodenext).js @@ -14,5 +14,7 @@ interface GlobalThing { a: number } const a: GlobalThing = { a: 0 }; //// [usage.js] +"use strict"; /// +Object.defineProperty(exports, "__esModule", { value: true }); const a = { a: 0 }; diff --git a/tests/baselines/reference/tscWatch/programUpdates/correctly-parses-wild-card-directories-from-implicit-glob-when-two-keys-differ-only-in-directory-seperator.js b/tests/baselines/reference/tscWatch/programUpdates/correctly-parses-wild-card-directories-from-implicit-glob-when-two-keys-differ-only-in-directory-seperator.js new file mode 100644 index 00000000000..bdb4782aa4a --- /dev/null +++ b/tests/baselines/reference/tscWatch/programUpdates/correctly-parses-wild-card-directories-from-implicit-glob-when-two-keys-differ-only-in-directory-seperator.js @@ -0,0 +1,391 @@ +Input:: +//// [/user/username/projects/myproject/f1.ts] +export const x = 1 + +//// [/user/username/projects/myproject/f2.ts] +export const y = 1 + +//// [/a/lib/lib.d.ts] +/// +interface Boolean {} +interface Function {} +interface CallableFunction {} +interface NewableFunction {} +interface IArguments {} +interface Number { toExponential: any; } +interface Object {} +interface RegExp {} +interface String { charAt: any; } +interface Array { length: number; [n: number]: T; } + +//// [/user/username/projects/myproject/tsconfig.json] +{"compilerOptions":{"composite":true},"include":["./","./**/*.json"]} + + +/a/lib/tsc.js -w --extendedDiagnostics +Output:: +[12:00:23 AM] Starting compilation in watch mode... + +Current directory: /user/username/projects/myproject CaseSensitiveFileNames: false +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/tsconfig.json 2000 undefined Config file +Synchronizing program +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts"] + options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/f1.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/f2.ts 250 undefined Source file +FileWatcher:: Added:: WatchInfo: /a/lib/lib.d.ts 250 undefined Source file +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject/node_modules/@types 1 undefined Type roots +[12:00:35 AM] Found 0 errors. Watching for file changes. + +DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +Elapsed:: *ms DirectoryWatcher:: Added:: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory + + +Program root files: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts"] +Program options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/f1.ts +/user/username/projects/myproject/f2.ts + +Semantic diagnostics in builder refreshed for:: +/a/lib/lib.d.ts +/user/username/projects/myproject/f1.ts +/user/username/projects/myproject/f2.ts + +Shape signatures in builder refreshed for:: +/a/lib/lib.d.ts (used version) +/user/username/projects/myproject/f1.ts (computed .d.ts during emit) +/user/username/projects/myproject/f2.ts (computed .d.ts during emit) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/f1.ts: + {"fileName":"/user/username/projects/myproject/f1.ts","pollingInterval":250} +/user/username/projects/myproject/f2.ts: + {"fileName":"/user/username/projects/myproject/f2.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/f1.js] +"use strict"; +exports.__esModule = true; +exports.x = void 0; +exports.x = 1; + + +//// [/user/username/projects/myproject/f1.d.ts] +export declare const x = 1; + + +//// [/user/username/projects/myproject/f2.js] +"use strict"; +exports.__esModule = true; +exports.y = void 0; +exports.y = 1; + + +//// [/user/username/projects/myproject/f2.d.ts] +export declare const y = 1; + + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./f1.ts","./f2.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true},{"version":"-10906998252-export const x = 1","signature":"-7495133367-export declare const x = 1;\n"},{"version":"-10905812331-export const y = 1","signature":"-6203665398-export declare const y = 1;\n"}],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3],"dtsChangeTime":32000},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./f1.ts", + "./f2.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "affectsGlobalScope": true + }, + "./f1.ts": { + "version": "-10906998252-export const x = 1", + "signature": "-7495133367-export declare const x = 1;\n" + }, + "./f2.ts": { + "version": "-10905812331-export const y = 1", + "signature": "-6203665398-export declare const y = 1;\n" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./f1.ts", + "./f2.ts" + ], + "dtsChangeTime": 32000 + }, + "version": "FakeTSVersion", + "size": 850 +} + + +Change:: Add new file + +Input:: +//// [/user/username/projects/myproject/new-file.ts] +export const z = 1; + + +Output:: +DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +Scheduling update +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +Reloading new file names and options +Synchronizing program +[12:00:40 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts","/user/username/projects/myproject/new-file.ts"] + options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +FileWatcher:: Added:: WatchInfo: /user/username/projects/myproject/new-file.ts 250 undefined Source file +DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.js :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +Project: /user/username/projects/myproject/tsconfig.json Detected file add/remove of non supported extension: /user/username/projects/myproject/new-file.js +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.js :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.d.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +Project: /user/username/projects/myproject/tsconfig.json Detected output file: /user/username/projects/myproject/new-file.d.ts +Elapsed:: *ms DirectoryWatcher:: Triggered with /user/username/projects/myproject/new-file.d.ts :: WatchInfo: /user/username/projects/myproject 1 undefined Wild card directory +[12:00:49 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts","/user/username/projects/myproject/new-file.ts"] +Program options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: Not +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/f1.ts +/user/username/projects/myproject/f2.ts +/user/username/projects/myproject/new-file.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/new-file.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/new-file.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/f1.ts: + {"fileName":"/user/username/projects/myproject/f1.ts","pollingInterval":250} +/user/username/projects/myproject/f2.ts: + {"fileName":"/user/username/projects/myproject/f2.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/new-file.ts: + {"fileName":"/user/username/projects/myproject/new-file.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./f1.ts","./f2.ts","./new-file.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true},{"version":"-10906998252-export const x = 1","signature":"-7495133367-export declare const x = 1;\n"},{"version":"-10905812331-export const y = 1","signature":"-6203665398-export declare const y = 1;\n"},{"version":"-11960320495-export const z = 1;","signature":"-9207164725-export declare const z = 1;\n"}],"options":{"composite":true},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,2,3,4],"dtsChangeTime":45250},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./f1.ts", + "./f2.ts", + "./new-file.ts" + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "affectsGlobalScope": true + }, + "./f1.ts": { + "version": "-10906998252-export const x = 1", + "signature": "-7495133367-export declare const x = 1;\n" + }, + "./f2.ts": { + "version": "-10905812331-export const y = 1", + "signature": "-6203665398-export declare const y = 1;\n" + }, + "./new-file.ts": { + "version": "-11960320495-export const z = 1;", + "signature": "-9207164725-export declare const z = 1;\n" + } + }, + "options": { + "composite": true + }, + "referencedMap": {}, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./f1.ts", + "./f2.ts", + "./new-file.ts" + ], + "dtsChangeTime": 45250 + }, + "version": "FakeTSVersion", + "size": 971 +} + +//// [/user/username/projects/myproject/new-file.js] +"use strict"; +exports.__esModule = true; +exports.z = void 0; +exports.z = 1; + + +//// [/user/username/projects/myproject/new-file.d.ts] +export declare const z = 1; + + + +Change:: Import new file + +Input:: +//// [/user/username/projects/myproject/f1.ts] +import { z } from "./new-file";export const x = 1 + + +Output:: +FileWatcher:: Triggered with /user/username/projects/myproject/f1.ts 1:: WatchInfo: /user/username/projects/myproject/f1.ts 250 undefined Source file +Scheduling update +Elapsed:: *ms FileWatcher:: Triggered with /user/username/projects/myproject/f1.ts 1:: WatchInfo: /user/username/projects/myproject/f1.ts 250 undefined Source file +Synchronizing program +[12:00:55 AM] File change detected. Starting incremental compilation... + +CreatingProgramWith:: + roots: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts","/user/username/projects/myproject/new-file.ts"] + options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +[12:01:05 AM] Found 0 errors. Watching for file changes. + + + +Program root files: ["/user/username/projects/myproject/f1.ts","/user/username/projects/myproject/f2.ts","/user/username/projects/myproject/new-file.ts"] +Program options: {"composite":true,"watch":true,"extendedDiagnostics":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"} +Program structureReused: SafeModules +Program files:: +/a/lib/lib.d.ts +/user/username/projects/myproject/new-file.ts +/user/username/projects/myproject/f1.ts +/user/username/projects/myproject/f2.ts + +Semantic diagnostics in builder refreshed for:: +/user/username/projects/myproject/f1.ts + +Shape signatures in builder refreshed for:: +/user/username/projects/myproject/f1.ts (computed .d.ts) + +WatchedFiles:: +/user/username/projects/myproject/tsconfig.json: + {"fileName":"/user/username/projects/myproject/tsconfig.json","pollingInterval":250} +/user/username/projects/myproject/f1.ts: + {"fileName":"/user/username/projects/myproject/f1.ts","pollingInterval":250} +/user/username/projects/myproject/f2.ts: + {"fileName":"/user/username/projects/myproject/f2.ts","pollingInterval":250} +/a/lib/lib.d.ts: + {"fileName":"/a/lib/lib.d.ts","pollingInterval":250} +/user/username/projects/myproject/new-file.ts: + {"fileName":"/user/username/projects/myproject/new-file.ts","pollingInterval":250} + +FsWatches:: + +FsWatchesRecursive:: +/user/username/projects/myproject/node_modules/@types: + {"directoryName":"/user/username/projects/myproject/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} +/user/username/projects/myproject: + {"directoryName":"/user/username/projects/myproject","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} + +exitCode:: ExitStatus.undefined + +//// [/user/username/projects/myproject/f1.js] file written with same contents +//// [/user/username/projects/myproject/f1.d.ts] file written with same contents +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo] +{"program":{"fileNames":["../../../../a/lib/lib.d.ts","./new-file.ts","./f1.ts","./f2.ts"],"fileInfos":[{"version":"-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }","affectsGlobalScope":true},{"version":"-11960320495-export const z = 1;","signature":"-9207164725-export declare const z = 1;\n"},{"version":"1363236232-import { z } from \"./new-file\";export const x = 1","signature":"-7495133367-export declare const x = 1;\n"},{"version":"-10905812331-export const y = 1","signature":"-6203665398-export declare const y = 1;\n"}],"options":{"composite":true},"fileIdsList":[[2]],"referencedMap":[[3,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[1,3,4,2],"dtsChangeTime":45250},"version":"FakeTSVersion"} + +//// [/user/username/projects/myproject/tsconfig.tsbuildinfo.readable.baseline.txt] +{ + "program": { + "fileNames": [ + "../../../../a/lib/lib.d.ts", + "./new-file.ts", + "./f1.ts", + "./f2.ts" + ], + "fileNamesList": [ + [ + "./new-file.ts" + ] + ], + "fileInfos": { + "../../../../a/lib/lib.d.ts": { + "version": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "signature": "-7698705165-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }", + "affectsGlobalScope": true + }, + "./new-file.ts": { + "version": "-11960320495-export const z = 1;", + "signature": "-9207164725-export declare const z = 1;\n" + }, + "./f1.ts": { + "version": "1363236232-import { z } from \"./new-file\";export const x = 1", + "signature": "-7495133367-export declare const x = 1;\n" + }, + "./f2.ts": { + "version": "-10905812331-export const y = 1", + "signature": "-6203665398-export declare const y = 1;\n" + } + }, + "options": { + "composite": true + }, + "referencedMap": { + "./f1.ts": [ + "./new-file.ts" + ] + }, + "exportedModulesMap": {}, + "semanticDiagnosticsPerFile": [ + "../../../../a/lib/lib.d.ts", + "./f1.ts", + "./f2.ts", + "./new-file.ts" + ], + "dtsChangeTime": 45250 + }, + "version": "FakeTSVersion", + "size": 1027 +} + diff --git a/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts new file mode 100644 index 00000000000..24037e466ba --- /dev/null +++ b/tests/cases/conformance/node/allowJs/nodeModulesAllowJsExportlessJsModuleDetectionAuto.ts @@ -0,0 +1,8 @@ +// @module: node16,nodenext +// @allowJs: true +// @outDir: ./out +// @moduleDetection: auto +// @filename: foo.cjs +// this file is a module despite having no imports +// @filename: bar.js +// however this file is _not_ a module \ No newline at end of file diff --git a/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace3.ts b/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace3.ts new file mode 100644 index 00000000000..57a89239dfe --- /dev/null +++ b/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace3.ts @@ -0,0 +1,8 @@ +/// + +////foo( +//// 1, /* comment */ ); + +format.document(); +verify.currentFileContentIs(`foo( + 1, /* comment */);`); diff --git a/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace4.ts b/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace4.ts new file mode 100644 index 00000000000..fc7a18ec8c7 --- /dev/null +++ b/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace4.ts @@ -0,0 +1,8 @@ +/// + +////new Foo(1 +////, /* comment */ ); + +format.document(); +verify.currentFileContentIs(`new Foo(1 + , /* comment */);`); diff --git a/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace5.ts b/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace5.ts new file mode 100644 index 00000000000..59d385dafbc --- /dev/null +++ b/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace5.ts @@ -0,0 +1,8 @@ +/// + +////new Foo(1, +//// /* comment */ ); + +format.document(); +verify.currentFileContentIs(`new Foo(1, + /* comment */);`); diff --git a/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace6.ts b/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace6.ts new file mode 100644 index 00000000000..6243c91ee42 --- /dev/null +++ b/tests/cases/fourslash/formatNoSpaceBeforeCloseBrace6.ts @@ -0,0 +1,8 @@ +/// + +////new Foo(1, /* comment */ +//// ); + +format.document(); +verify.currentFileContentIs(`new Foo(1, /* comment */ +);`); diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 79e0f52cb58..ea690be4014 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -666,6 +666,7 @@ declare namespace FourSlashInterface { readonly includeInlayParameterNameHintsWhenArgumentMatchesName?: boolean; readonly includeInlayFunctionParameterTypeHints?: boolean; readonly includeInlayVariableTypeHints?: boolean; + readonly includeInlayVariableTypeHintsWhenTypeMatchesName?: boolean; readonly includeInlayPropertyDeclarationTypeHints?: boolean; readonly includeInlayFunctionLikeReturnTypeHints?: boolean; readonly includeInlayEnumMemberValueHints?: boolean; diff --git a/tests/cases/fourslash/inlayHintsShouldWork67.ts b/tests/cases/fourslash/inlayHintsShouldWork67.ts new file mode 100644 index 00000000000..2b35b152b79 --- /dev/null +++ b/tests/cases/fourslash/inlayHintsShouldWork67.ts @@ -0,0 +1,24 @@ +/// + +//// type Client = {}; +//// function getClient(): Client { return {}; }; +//// const client/**/ = getClient(); + +const markers = test.markers(); + +verify.getInlayHints([ + { + text: ': Client', + position: markers[0].position, + kind: ts.InlayHintKind.Type, + whitespaceBefore: true + } +], undefined, { + includeInlayVariableTypeHints: true, + includeInlayVariableTypeHintsWhenTypeMatchesName: true +}); + +verify.getInlayHints([], undefined, { + includeInlayVariableTypeHints: true, + includeInlayVariableTypeHintsWhenTypeMatchesName: false +}); diff --git a/tests/cases/fourslash/server/goToSource13_nodenext.ts b/tests/cases/fourslash/server/goToSource13_nodenext.ts new file mode 100644 index 00000000000..99a3a29ef2e --- /dev/null +++ b/tests/cases/fourslash/server/goToSource13_nodenext.ts @@ -0,0 +1,35 @@ +/// + +// @Filename: /node_modules/left-pad/package.json +//// { +//// "name": "left-pad", +//// "version": "1.3.0", +//// "description": "String left pad", +//// "main": "index.js", +//// "types": "index.d.ts" +//// } + +// @Filename: /node_modules/left-pad/index.d.ts +//// declare function leftPad(str: string|number, len: number, ch?: string|number): string; +//// declare namespace leftPad { } +//// export = leftPad; + +// @Filename: /node_modules/left-pad/index.js +//// module.exports = leftPad; +//// function /*end*/leftPad(str, len, ch) {} + +// @Filename: /tsconfig.json +//// { +//// "compilerOptions": { +//// "module": "node16", +//// "strict": true, +//// "outDir": "./out", +//// +//// } +//// } + +// @Filename: /index.mts +//// import leftPad = require("left-pad"); +//// /*start*/leftPad("", 4); + +verify.goToSourceDefinition("start", "end"); diff --git a/tests/cases/fourslash/server/goToSource14_unresolvedRequireDestructuring.ts b/tests/cases/fourslash/server/goToSource14_unresolvedRequireDestructuring.ts new file mode 100644 index 00000000000..426dc111074 --- /dev/null +++ b/tests/cases/fourslash/server/goToSource14_unresolvedRequireDestructuring.ts @@ -0,0 +1,8 @@ +/// + +// @allowJs: true + +// @Filename: /index.js +//// const { blah/**/ } = require("unresolved"); + +verify.goToSourceDefinition("", []); diff --git a/tests/cases/fourslash/server/referenceToEmptyObject.ts b/tests/cases/fourslash/server/referenceToEmptyObject.ts new file mode 100644 index 00000000000..b740736d2bc --- /dev/null +++ b/tests/cases/fourslash/server/referenceToEmptyObject.ts @@ -0,0 +1,5 @@ +/// + +////const obj = {}/*1*/; + +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/server/referencesInEmptyFile.ts b/tests/cases/fourslash/server/referencesInEmptyFile.ts new file mode 100644 index 00000000000..f9ac25f1ae8 --- /dev/null +++ b/tests/cases/fourslash/server/referencesInEmptyFile.ts @@ -0,0 +1,5 @@ +/// + +/////*1*/ + +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/server/referencesInEmptyFileWithMultipleProjects.ts b/tests/cases/fourslash/server/referencesInEmptyFileWithMultipleProjects.ts new file mode 100644 index 00000000000..ed93a21fc50 --- /dev/null +++ b/tests/cases/fourslash/server/referencesInEmptyFileWithMultipleProjects.ts @@ -0,0 +1,16 @@ +/// + +// @Filename: /a/tsconfig.json +////{ "files": ["a.ts"] } + +// @Filename: /a/a.ts +/////// +/////*1*/; + +// @Filename: /b/tsconfig.json +////{ "files": ["b.ts"] } + +// @Filename: /b/b.ts +/////*2*/; + +verify.baselineFindAllReferences('1', '2') diff --git a/tests/cases/fourslash/server/referencesInStringLiteralValueWithMultipleProjects.ts b/tests/cases/fourslash/server/referencesInStringLiteralValueWithMultipleProjects.ts new file mode 100644 index 00000000000..c31183f2573 --- /dev/null +++ b/tests/cases/fourslash/server/referencesInStringLiteralValueWithMultipleProjects.ts @@ -0,0 +1,16 @@ +/// + +// @Filename: /a/tsconfig.json +////{ "files": ["a.ts"] } + +// @Filename: /a/a.ts +/////// +////const str: string = "hello/*1*/"; + +// @Filename: /b/tsconfig.json +////{ "files": ["b.ts"] } + +// @Filename: /b/b.ts +////const str2: string = "hello/*2*/"; + +verify.baselineFindAllReferences('1', '2') diff --git a/tests/cases/fourslash/server/referencesToStringLiteralValue.ts b/tests/cases/fourslash/server/referencesToStringLiteralValue.ts new file mode 100644 index 00000000000..ee5c9fca9c0 --- /dev/null +++ b/tests/cases/fourslash/server/referencesToStringLiteralValue.ts @@ -0,0 +1,5 @@ +/// + +////const s: string = "some /*1*/ string"; + +verify.baselineFindAllReferences('1'); diff --git a/tests/cases/fourslash/typeKeywordInFunction.ts b/tests/cases/fourslash/typeKeywordInFunction.ts new file mode 100644 index 00000000000..2c1f4bac1b1 --- /dev/null +++ b/tests/cases/fourslash/typeKeywordInFunction.ts @@ -0,0 +1,10 @@ +/// + +////function a() { +//// ty/**/ +////} + +verify.completions({ + marker: "", + includes: [{ name: "type", sortText: completion.SortText.GlobalsOrKeywords }] +});