diff --git a/src/harness/fourslashImpl.ts b/src/harness/fourslashImpl.ts index 0cf7285364388..d1ef154ffe440 100644 --- a/src/harness/fourslashImpl.ts +++ b/src/harness/fourslashImpl.ts @@ -10,8 +10,6 @@ import ArrayOrSingle = FourSlashInterface.ArrayOrSingle; export const enum FourSlashTestType { Native, - Shims, - ShimsWithPreprocess, Server, } @@ -202,6 +200,32 @@ const enum CallHierarchyItemDirection { Outgoing, } +interface RealizedDiagnostic { + message: string; + start: number; + length: number; + category: string; + code: number; + reportsUnnecessary?: {}; + reportsDeprecated?: {}; +} + +function realizeDiagnostics(diagnostics: readonly ts.Diagnostic[], newLine: string): RealizedDiagnostic[] { + return diagnostics.map(d => realizeDiagnostic(d, newLine)); +} + +function realizeDiagnostic(diagnostic: ts.Diagnostic, newLine: string): RealizedDiagnostic { + return { + message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine), + start: diagnostic.start!, // TODO: GH#18217 + length: diagnostic.length!, // TODO: GH#18217 + category: ts.diagnosticCategoryName(diagnostic), + code: diagnostic.code, + reportsUnnecessary: diagnostic.reportsUnnecessary, + reportsDeprecated: diagnostic.reportsDeprecated, + }; +} + export class TestState { // Language service instance private languageServiceAdapterHost: Harness.LanguageService.LanguageServiceAdapterHost; @@ -267,10 +291,6 @@ export class TestState { switch (testType) { case FourSlashTestType.Native: return new Harness.LanguageService.NativeLanguageServiceAdapter(cancellationToken, compilationOptions); - case FourSlashTestType.Shims: - return new Harness.LanguageService.ShimLanguageServiceAdapter(/*preprocessToResolve*/ false, cancellationToken, compilationOptions); - case FourSlashTestType.ShimsWithPreprocess: - return new Harness.LanguageService.ShimLanguageServiceAdapter(/*preprocessToResolve*/ true, cancellationToken, compilationOptions); case FourSlashTestType.Server: return new Harness.LanguageService.ServerLanguageServiceAdapter(cancellationToken, compilationOptions); default: @@ -1764,8 +1784,8 @@ export class TestState { private testDiagnostics(expected: readonly FourSlashInterface.Diagnostic[], diagnostics: readonly ts.Diagnostic[], category: string) { assert.deepEqual( - ts.realizeDiagnostics(diagnostics, "\n"), - expected.map((e): ts.RealizedDiagnostic => { + realizeDiagnostics(diagnostics, "\n"), + expected.map((e): RealizedDiagnostic => { const range = e.range || this.getRangesInFile()[0]; if (!range) { this.raiseError("Must provide a range for each expected diagnostic, or have one range in the fourslash source."); diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 996b7a39a3050..3760206090aca 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -109,24 +109,6 @@ class ScriptSnapshot implements ts.IScriptSnapshot { } } -class ScriptSnapshotProxy implements ts.ScriptSnapshotShim { - constructor(private readonly scriptSnapshot: ts.IScriptSnapshot) { - } - - public getText(start: number, end: number): string { - return this.scriptSnapshot.getText(start, end); - } - - public getLength(): number { - return this.scriptSnapshot.getLength(); - } - - public getChangeRange(oldScript: ts.ScriptSnapshotShim): string | undefined { - const range = this.scriptSnapshot.getChangeRange((oldScript as ScriptSnapshotProxy).scriptSnapshot); - return range && JSON.stringify(range); - } -} - class DefaultHostCancellationToken implements ts.HostCancellationToken { public static readonly instance = new DefaultHostCancellationToken(); @@ -361,449 +343,6 @@ export class NativeLanguageServiceAdapter implements LanguageServiceAdapter { } } -/// Shim adapter -class ShimLanguageServiceHost extends LanguageServiceAdapterHost implements ts.LanguageServiceShimHost, ts.CoreServicesShimHost { - private nativeHost: NativeLanguageServiceHost; - - public getModuleResolutionsForFile: ((fileName: string) => string) | undefined; - public getTypeReferenceDirectiveResolutionsForFile: ((fileName: string) => string) | undefined; - - constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) { - super(cancellationToken, options); - this.nativeHost = new NativeLanguageServiceHost(cancellationToken, options); - - if (preprocessToResolve) { - const compilerOptions = this.nativeHost.getCompilationSettings(); - const moduleResolutionHost: ts.ModuleResolutionHost = { - fileExists: fileName => this.getScriptInfo(fileName) !== undefined, - readFile: fileName => { - const scriptInfo = this.getScriptInfo(fileName); - return scriptInfo && scriptInfo.content; - }, - useCaseSensitiveFileNames: this.useCaseSensitiveFileNames(), - }; - this.getModuleResolutionsForFile = fileName => { - const scriptInfo = this.getScriptInfo(fileName)!; - const preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ true); - const imports: ts.MapLike = {}; - for (const module of preprocessInfo.importedFiles) { - const resolutionInfo = ts.resolveModuleName(module.fileName, fileName, compilerOptions, moduleResolutionHost); - if (resolutionInfo.resolvedModule) { - imports[module.fileName] = resolutionInfo.resolvedModule.resolvedFileName; - } - } - return JSON.stringify(imports); - }; - this.getTypeReferenceDirectiveResolutionsForFile = fileName => { - const scriptInfo = this.getScriptInfo(fileName); - if (scriptInfo) { - const preprocessInfo = ts.preProcessFile(scriptInfo.content, /*readImportFiles*/ false); - const resolutions: ts.MapLike = {}; - const settings = this.nativeHost.getCompilationSettings(); - for (const typeReferenceDirective of preprocessInfo.typeReferenceDirectives) { - const resolutionInfo = ts.resolveTypeReferenceDirective(typeReferenceDirective.fileName, fileName, settings, moduleResolutionHost); - if (resolutionInfo.resolvedTypeReferenceDirective!.resolvedFileName) { - resolutions[typeReferenceDirective.fileName] = resolutionInfo.resolvedTypeReferenceDirective!; - } - } - return JSON.stringify(resolutions); - } - else { - return "[]"; - } - }; - } - } - - override getFilenames(): string[] { - return this.nativeHost.getFilenames(); - } - override getScriptInfo(fileName: string): ScriptInfo | undefined { - return this.nativeHost.getScriptInfo(fileName); - } - override addScript(fileName: string, content: string, isRootFile: boolean): void { - this.nativeHost.addScript(fileName, content, isRootFile); - } - override editScript(fileName: string, start: number, end: number, newText: string): void { - this.nativeHost.editScript(fileName, start, end, newText); - } - override positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { - return this.nativeHost.positionToLineAndCharacter(fileName, position); - } - - getCompilationSettings(): string { - return JSON.stringify(this.nativeHost.getCompilationSettings()); - } - getCancellationToken(): ts.HostCancellationToken { - return this.nativeHost.getCancellationToken(); - } - getCurrentDirectory(): string { - return this.nativeHost.getCurrentDirectory(); - } - getDirectories(path: string): string { - return JSON.stringify(this.nativeHost.getDirectories(path)); - } - getDefaultLibFileName(): string { - return this.nativeHost.getDefaultLibFileName(); - } - getScriptFileNames(): string { - return JSON.stringify(this.nativeHost.getScriptFileNames()); - } - getScriptSnapshot(fileName: string): ts.ScriptSnapshotShim { - const nativeScriptSnapshot = this.nativeHost.getScriptSnapshot(fileName)!; // TODO: GH#18217 - return nativeScriptSnapshot && new ScriptSnapshotProxy(nativeScriptSnapshot); - } - getScriptKind(): ts.ScriptKind { - return this.nativeHost.getScriptKind(); - } - getScriptVersion(fileName: string): string { - return this.nativeHost.getScriptVersion(fileName); - } - getLocalizedDiagnosticMessages(): string { - return JSON.stringify({}); - } - - readDirectory = ts.notImplemented; - readDirectoryNames = ts.notImplemented; - readFileNames = ts.notImplemented; - override fileExists(fileName: string) { - return this.getScriptInfo(fileName) !== undefined; - } - override readFile(fileName: string) { - const snapshot = this.nativeHost.getScriptSnapshot(fileName); - return snapshot && ts.getSnapshotText(snapshot); - } - log(s: string): void { - this.nativeHost.log(s); - } - trace(s: string): void { - this.nativeHost.trace(s); - } - error(s: string): void { - this.nativeHost.error(s); - } - override directoryExists(): boolean { - // for tests pessimistically assume that directory always exists - return true; - } -} - -class ClassifierShimProxy implements ts.Classifier { - constructor(private shim: ts.ClassifierShim) { - } - getEncodedLexicalClassifications(_text: string, _lexState: ts.EndOfLineState, _classifyKeywordsInGenerics?: boolean): ts.Classifications { - return ts.notImplemented(); - } - getClassificationsForLine(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.ClassificationResult { - const result = this.shim.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics).split("\n"); - const entries: ts.ClassificationInfo[] = []; - let i = 0; - let position = 0; - - for (; i < result.length - 1; i += 2) { - const t = entries[i / 2] = { - length: parseInt(result[i]), - classification: parseInt(result[i + 1]), - }; - - assert.isTrue(t.length > 0, "Result length should be greater than 0, got :" + t.length); - position += t.length; - } - const finalLexState = parseInt(result[result.length - 1]); - - assert.equal(position, text.length, "Expected cumulative length of all entries to match the length of the source. expected: " + text.length + ", but got: " + position); - - return { - finalLexState, - entries, - }; - } -} - -function unwrapJSONCallResult(result: string): any { - const parsedResult = JSON.parse(result); - if (parsedResult.error) { - throw new Error("Language Service Shim Error: " + JSON.stringify(parsedResult.error)); - } - else if (parsedResult.canceled) { - throw new ts.OperationCanceledException(); - } - return parsedResult.result; -} - -class LanguageServiceShimProxy implements ts.LanguageService { - constructor(private shim: ts.LanguageServiceShim) { - } - cleanupSemanticCache(): void { - this.shim.cleanupSemanticCache(); - } - getSyntacticDiagnostics(fileName: string): ts.DiagnosticWithLocation[] { - return unwrapJSONCallResult(this.shim.getSyntacticDiagnostics(fileName)); - } - getSemanticDiagnostics(fileName: string): ts.DiagnosticWithLocation[] { - return unwrapJSONCallResult(this.shim.getSemanticDiagnostics(fileName)); - } - getSuggestionDiagnostics(fileName: string): ts.DiagnosticWithLocation[] { - return unwrapJSONCallResult(this.shim.getSuggestionDiagnostics(fileName)); - } - getCompilerOptionsDiagnostics(): ts.Diagnostic[] { - return unwrapJSONCallResult(this.shim.getCompilerOptionsDiagnostics()); - } - getSyntacticClassifications(fileName: string, span: ts.TextSpan): ts.ClassifiedSpan[] { - return unwrapJSONCallResult(this.shim.getSyntacticClassifications(fileName, span.start, span.length)); - } - getSemanticClassifications(fileName: string, span: ts.TextSpan, format?: ts.SemanticClassificationFormat): ts.ClassifiedSpan[] { - return unwrapJSONCallResult(this.shim.getSemanticClassifications(fileName, span.start, span.length, format)); - } - getEncodedSyntacticClassifications(fileName: string, span: ts.TextSpan): ts.Classifications { - return unwrapJSONCallResult(this.shim.getEncodedSyntacticClassifications(fileName, span.start, span.length)); - } - getEncodedSemanticClassifications(fileName: string, span: ts.TextSpan, format?: ts.SemanticClassificationFormat): ts.Classifications { - const responseFormat = format || ts.SemanticClassificationFormat.Original; - return unwrapJSONCallResult(this.shim.getEncodedSemanticClassifications(fileName, span.start, span.length, responseFormat)); - } - getCompletionsAtPosition(fileName: string, position: number, preferences: ts.UserPreferences | undefined, formattingSettings: ts.FormatCodeSettings | undefined): ts.CompletionInfo { - return unwrapJSONCallResult(this.shim.getCompletionsAtPosition(fileName, position, preferences, formattingSettings)); - } - getCompletionEntryDetails(fileName: string, position: number, entryName: string, formatOptions: ts.FormatCodeOptions | undefined, source: string | undefined, preferences: ts.UserPreferences | undefined, data: ts.CompletionEntryData | undefined): ts.CompletionEntryDetails { - return unwrapJSONCallResult(this.shim.getCompletionEntryDetails(fileName, position, entryName, JSON.stringify(formatOptions), source, preferences, data)); - } - getCompletionEntrySymbol(): ts.Symbol { - throw new Error("getCompletionEntrySymbol not implemented across the shim layer."); - } - getQuickInfoAtPosition(fileName: string, position: number): ts.QuickInfo { - return unwrapJSONCallResult(this.shim.getQuickInfoAtPosition(fileName, position)); - } - getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): ts.TextSpan { - return unwrapJSONCallResult(this.shim.getNameOrDottedNameSpan(fileName, startPos, endPos)); - } - getBreakpointStatementAtPosition(fileName: string, position: number): ts.TextSpan { - return unwrapJSONCallResult(this.shim.getBreakpointStatementAtPosition(fileName, position)); - } - getSignatureHelpItems(fileName: string, position: number, options: ts.SignatureHelpItemsOptions | undefined): ts.SignatureHelpItems { - return unwrapJSONCallResult(this.shim.getSignatureHelpItems(fileName, position, options)); - } - getRenameInfo(fileName: string, position: number, preferences: ts.UserPreferences): ts.RenameInfo { - return unwrapJSONCallResult(this.shim.getRenameInfo(fileName, position, preferences)); - } - getSmartSelectionRange(fileName: string, position: number): ts.SelectionRange { - return unwrapJSONCallResult(this.shim.getSmartSelectionRange(fileName, position)); - } - findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, preferences?: ts.UserPreferences | boolean): ts.RenameLocation[] { - return unwrapJSONCallResult(this.shim.findRenameLocations(fileName, position, findInStrings, findInComments, preferences)); - } - getDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[] { - return unwrapJSONCallResult(this.shim.getDefinitionAtPosition(fileName, position)); - } - getDefinitionAndBoundSpan(fileName: string, position: number): ts.DefinitionInfoAndBoundSpan { - return unwrapJSONCallResult(this.shim.getDefinitionAndBoundSpan(fileName, position)); - } - getTypeDefinitionAtPosition(fileName: string, position: number): ts.DefinitionInfo[] { - return unwrapJSONCallResult(this.shim.getTypeDefinitionAtPosition(fileName, position)); - } - getImplementationAtPosition(fileName: string, position: number): ts.ImplementationLocation[] { - return unwrapJSONCallResult(this.shim.getImplementationAtPosition(fileName, position)); - } - getReferencesAtPosition(fileName: string, position: number): ts.ReferenceEntry[] { - return unwrapJSONCallResult(this.shim.getReferencesAtPosition(fileName, position)); - } - findReferences(fileName: string, position: number): ts.ReferencedSymbol[] { - return unwrapJSONCallResult(this.shim.findReferences(fileName, position)); - } - getFileReferences(fileName: string): ts.ReferenceEntry[] { - return unwrapJSONCallResult(this.shim.getFileReferences(fileName)); - } - getDocumentHighlights(fileName: string, position: number, filesToSearch: string[]): ts.DocumentHighlights[] { - return unwrapJSONCallResult(this.shim.getDocumentHighlights(fileName, position, JSON.stringify(filesToSearch))); - } - getNavigateToItems(searchValue: string): ts.NavigateToItem[] { - return unwrapJSONCallResult(this.shim.getNavigateToItems(searchValue)); - } - getNavigationBarItems(fileName: string): ts.NavigationBarItem[] { - return unwrapJSONCallResult(this.shim.getNavigationBarItems(fileName)); - } - getNavigationTree(fileName: string): ts.NavigationTree { - return unwrapJSONCallResult(this.shim.getNavigationTree(fileName)); - } - getOutliningSpans(fileName: string): ts.OutliningSpan[] { - return unwrapJSONCallResult(this.shim.getOutliningSpans(fileName)); - } - getTodoComments(fileName: string, descriptors: ts.TodoCommentDescriptor[]): ts.TodoComment[] { - return unwrapJSONCallResult(this.shim.getTodoComments(fileName, JSON.stringify(descriptors))); - } - getBraceMatchingAtPosition(fileName: string, position: number): ts.TextSpan[] { - return unwrapJSONCallResult(this.shim.getBraceMatchingAtPosition(fileName, position)); - } - getIndentationAtPosition(fileName: string, position: number, options: ts.EditorOptions): number { - return unwrapJSONCallResult(this.shim.getIndentationAtPosition(fileName, position, JSON.stringify(options))); - } - getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] { - return unwrapJSONCallResult(this.shim.getFormattingEditsForRange(fileName, start, end, JSON.stringify(options))); - } - getFormattingEditsForDocument(fileName: string, options: ts.FormatCodeOptions): ts.TextChange[] { - return unwrapJSONCallResult(this.shim.getFormattingEditsForDocument(fileName, JSON.stringify(options))); - } - getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: ts.FormatCodeOptions): ts.TextChange[] { - return unwrapJSONCallResult(this.shim.getFormattingEditsAfterKeystroke(fileName, position, key, JSON.stringify(options))); - } - getDocCommentTemplateAtPosition(fileName: string, position: number, options?: ts.DocCommentTemplateOptions, formatOptions?: ts.FormatCodeSettings): ts.TextInsertion { - return unwrapJSONCallResult(this.shim.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions)); - } - isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean { - return unwrapJSONCallResult(this.shim.isValidBraceCompletionAtPosition(fileName, position, openingBrace)); - } - getJsxClosingTagAtPosition(): never { - throw new Error("Not supported on the shim."); - } - getLinkedEditingRangeAtPosition(): never { - throw new Error("Not supported on the shim."); - } - getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): ts.TextSpan { - return unwrapJSONCallResult(this.shim.getSpanOfEnclosingComment(fileName, position, onlyMultiLine)); - } - getSupportedCodeFixes(): never { - throw new Error("Not supported on the shim."); - } - getCodeFixesAtPosition(): never { - throw new Error("Not supported on the shim."); - } - getCombinedCodeFix = ts.notImplemented; - applyCodeActionCommand = ts.notImplemented; - getCodeFixDiagnostics(): ts.Diagnostic[] { - throw new Error("Not supported on the shim."); - } - getEditsForRefactor(): ts.RefactorEditInfo { - throw new Error("Not supported on the shim."); - } - getApplicableRefactors(): ts.ApplicableRefactorInfo[] { - throw new Error("Not supported on the shim."); - } - getMoveToRefactoringFileSuggestions(): { newFileName: string; files: string[]; } { - throw new Error("Not supported on the shim."); - } - organizeImports(_args: ts.OrganizeImportsArgs, _formatOptions: ts.FormatCodeSettings): readonly ts.FileTextChanges[] { - throw new Error("Not supported on the shim."); - } - getEditsForFileRename(): readonly ts.FileTextChanges[] { - throw new Error("Not supported on the shim."); - } - prepareCallHierarchy(fileName: string, position: number) { - return unwrapJSONCallResult(this.shim.prepareCallHierarchy(fileName, position)); - } - provideCallHierarchyIncomingCalls(fileName: string, position: number) { - return unwrapJSONCallResult(this.shim.provideCallHierarchyIncomingCalls(fileName, position)); - } - provideCallHierarchyOutgoingCalls(fileName: string, position: number) { - return unwrapJSONCallResult(this.shim.provideCallHierarchyOutgoingCalls(fileName, position)); - } - provideInlayHints(fileName: string, span: ts.TextSpan, preference: ts.UserPreferences) { - return unwrapJSONCallResult(this.shim.provideInlayHints(fileName, span, preference)); - } - getEmitOutput(fileName: string): ts.EmitOutput { - return unwrapJSONCallResult(this.shim.getEmitOutput(fileName)); - } - getProgram(): ts.Program { - throw new Error("Program can not be marshaled across the shim layer."); - } - getCurrentProgram(): ts.Program | undefined { - throw new Error("Program can not be marshaled across the shim layer."); - } - getAutoImportProvider(): ts.Program | undefined { - throw new Error("Program can not be marshaled across the shim layer."); - } - updateIsDefinitionOfReferencedSymbols(_referencedSymbols: readonly ts.ReferencedSymbol[], _knownSymbolSpans: Set): boolean { - return ts.notImplemented(); - } - getNonBoundSourceFile(): ts.SourceFile { - throw new Error("SourceFile can not be marshaled across the shim layer."); - } - getSourceFile(): ts.SourceFile { - throw new Error("SourceFile can not be marshaled across the shim layer."); - } - getSourceMapper(): never { - return ts.notImplemented(); - } - clearSourceMapperCache(): never { - return ts.notImplemented(); - } - toggleLineComment(fileName: string, textRange: ts.TextRange): ts.TextChange[] { - return unwrapJSONCallResult(this.shim.toggleLineComment(fileName, textRange)); - } - toggleMultilineComment(fileName: string, textRange: ts.TextRange): ts.TextChange[] { - return unwrapJSONCallResult(this.shim.toggleMultilineComment(fileName, textRange)); - } - commentSelection(fileName: string, textRange: ts.TextRange): ts.TextChange[] { - return unwrapJSONCallResult(this.shim.commentSelection(fileName, textRange)); - } - uncommentSelection(fileName: string, textRange: ts.TextRange): ts.TextChange[] { - return unwrapJSONCallResult(this.shim.uncommentSelection(fileName, textRange)); - } - dispose(): void { - this.shim.dispose({}); - } -} - -export class ShimLanguageServiceAdapter implements LanguageServiceAdapter { - private host: ShimLanguageServiceHost; - private factory: ts.TypeScriptServicesFactory; - constructor(preprocessToResolve: boolean, cancellationToken?: ts.HostCancellationToken, options?: ts.CompilerOptions) { - this.host = new ShimLanguageServiceHost(preprocessToResolve, cancellationToken, options); - this.factory = new ts.TypeScriptServicesFactory(); - } - getHost() { - return this.host; - } - getLanguageService(): ts.LanguageService { - return new LanguageServiceShimProxy(this.factory.createLanguageServiceShim(this.host)); - } - getClassifier(): ts.Classifier { - return new ClassifierShimProxy(this.factory.createClassifierShim(this.host)); - } - getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { - const coreServicesShim = this.factory.createCoreServicesShim(this.host); - const shimResult: { - referencedFiles: ts.ShimsFileReference[]; - typeReferenceDirectives: ts.ShimsFileReference[]; - importedFiles: ts.ShimsFileReference[]; - isLibFile: boolean; - } = unwrapJSONCallResult(coreServicesShim.getPreProcessedFileInfo(fileName, ts.ScriptSnapshot.fromString(fileContents))); - - const convertResult: ts.PreProcessedFileInfo = { - referencedFiles: [], - importedFiles: [], - ambientExternalModules: [], - isLibFile: shimResult.isLibFile, - typeReferenceDirectives: [], - libReferenceDirectives: [], - }; - - ts.forEach(shimResult.referencedFiles, refFile => { - convertResult.referencedFiles.push({ - fileName: refFile.path, - pos: refFile.position, - end: refFile.position + refFile.length, - }); - }); - - ts.forEach(shimResult.importedFiles, importedFile => { - convertResult.importedFiles.push({ - fileName: importedFile.path, - pos: importedFile.position, - end: importedFile.position + importedFile.length, - }); - }); - - ts.forEach(shimResult.typeReferenceDirectives, typeRefDirective => { - convertResult.importedFiles.push({ - fileName: typeRefDirective.path, - pos: typeRefDirective.position, - end: typeRefDirective.position + typeRefDirective.length, - }); - }); - return convertResult; - } -} - // Server adapter class SessionClientHost extends NativeLanguageServiceHost implements ts.server.SessionClientHost { private client!: ts.server.SessionClient; diff --git a/src/harness/runnerbase.ts b/src/harness/runnerbase.ts index 3401301a08ca5..1877d763e9fea 100644 --- a/src/harness/runnerbase.ts +++ b/src/harness/runnerbase.ts @@ -7,7 +7,7 @@ import * as ts from "./_namespaces/ts"; export type TestRunnerKind = CompilerTestKind | FourslashTestKind | "project"; export type CompilerTestKind = "conformance" | "compiler"; -export type FourslashTestKind = "fourslash" | "fourslash-shims" | "fourslash-shims-pp" | "fourslash-server"; +export type FourslashTestKind = "fourslash" | "fourslash-server"; export let shards = 1; export let shardId = 1; diff --git a/src/services/_namespaces/ts.ts b/src/services/_namespaces/ts.ts index eae114fd2e834..e30ea818a04b5 100644 --- a/src/services/_namespaces/ts.ts +++ b/src/services/_namespaces/ts.ts @@ -16,7 +16,6 @@ export * from "../suggestionDiagnostics"; export * from "../transpile"; export * from "../services"; export * from "../transform"; -export * from "../shims"; import * as BreakpointResolver from "./ts.BreakpointResolver"; export { BreakpointResolver }; import * as CallHierarchy from "./ts.CallHierarchy"; diff --git a/src/services/shims.ts b/src/services/shims.ts deleted file mode 100644 index 4c2fa0cbce057..0000000000000 --- a/src/services/shims.ts +++ /dev/null @@ -1,1451 +0,0 @@ -import { - Classifications, - Classifier, - clear, - CompilerOptions, - CompletionEntryData, - createClassifier, - createDocumentRegistry, - createGetCanonicalFileName, - createLanguageService, - createTextChangeRange, - createTextSpan, - Diagnostic, - diagnosticCategoryName, - DocCommentTemplateOptions, - DocumentRegistry, - EditorOptions, - EmitOutput, - emptyOptions, - EndOfLineState, - Extension, - extensionFromPath, - FileReference, - filter, - flattenDiagnosticMessageText, - FormatCodeOptions, - FormatCodeSettings, - getAutomaticTypeDirectiveNames, - GetCompletionsAtPositionOptions, - getDefaultCompilerOptions, - getDirectoryPath, - getFileMatcherPatterns, - getNewLineOrDefaultFromHost, - getProperty, - getSnapshotText, - HostCancellationToken, - IScriptSnapshot, - isString, - JSDocParsingMode, - JsTyping, - LanguageService, - LanguageServiceHost, - map, - MapLike, - ModuleResolutionHost, - normalizeSlashes, - OperationCanceledException, - ParseConfigHost, - parseJsonSourceFileConfigFileContent, - parseJsonText, - preProcessFile, - ResolvedModuleFull, - ResolvedTypeReferenceDirective, - resolveModuleName, - resolveTypeReferenceDirective, - ScriptKind, - SemanticClassificationFormat, - servicesVersion, - SignatureHelpItemsOptions, - TextChangeRange, - TextRange, - TextSpan, - ThrottledCancellationToken, - timestamp, - toFileNameLowerCase, - toPath, - TypeAcquisition, - UserPreferences, -} from "./_namespaces/ts"; - -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/** @internal */ -let debugObjectHost: { CollectGarbage(): void; } = (function (this: any) { // eslint-disable-line prefer-const - return this; -})(); - -// We need to use 'null' to interface with the managed side. -/* eslint-disable local/no-in-operator */ - -// dprint-ignore -interface DiscoverTypingsInfo { - fileNames: string[]; // The file names that belong to the same project. - projectRootPath: string; // The path to the project root directory - safeListPath: string; // The path used to retrieve the safe list - packageNameToTypingLocation: Map; // The map of package names to their cached typing locations and installed versions - typeAcquisition: TypeAcquisition; // Used to customize the type acquisition process - compilerOptions: CompilerOptions; // Used as a source for typing inference - unresolvedImports: readonly string[]; // List of unresolved module ids from imports - typesRegistry: ReadonlyMap>; // The map of available typings in npm to maps of TS versions to their latest supported versions -} - -/** @internal */ -export interface ScriptSnapshotShim { - /** Gets a portion of the script snapshot specified by [start, end). */ - getText(start: number, end: number): string; - - /** Gets the length of this script snapshot. */ - getLength(): number; - - /** - * Returns a JSON-encoded value of the type: - * { span: { start: number; length: number }; newLength: number } - * - * Or undefined value if there was no change. - */ - getChangeRange(oldSnapshot: ScriptSnapshotShim): string | undefined; - - /** Releases all resources held by this script snapshot */ - dispose?(): void; -} - -/** @internal */ -export interface Logger { - log(s: string): void; - trace(s: string): void; - error(s: string): void; -} - -/** - * Public interface of the host of a language service shim instance. - * - * @internal - */ -export interface LanguageServiceShimHost extends Logger { - getCompilationSettings(): string; - - /** Returns a JSON-encoded value of the type: string[] */ - getScriptFileNames(): string; - getScriptKind?(fileName: string): ScriptKind; - getScriptVersion(fileName: string): string; - getScriptSnapshot(fileName: string): ScriptSnapshotShim; - getLocalizedDiagnosticMessages(): string; - getCancellationToken(): HostCancellationToken; - getCurrentDirectory(): string; - getDirectories(path: string): string; - getDefaultLibFileName(options: string): string; - getNewLine?(): string; - getProjectVersion?(): string; - useCaseSensitiveFileNames?(): boolean; - - getTypeRootsVersion?(): number; - readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string; - readFile(path: string, encoding?: string): string | undefined; - fileExists(path: string): boolean; - - getModuleResolutionsForFile?(fileName: string): string; - getTypeReferenceDirectiveResolutionsForFile?(fileName: string): string; - directoryExists(directoryName: string): boolean; - - jsDocParsingMode?: JSDocParsingMode; -} - -/** - * Public interface of the core-services host instance used in managed side - * - * @internal - */ -export interface CoreServicesShimHost extends Logger { - directoryExists(directoryName: string): boolean; - fileExists(fileName: string): boolean; - getCurrentDirectory(): string; - getDirectories(path: string): string; - - /** - * Returns a JSON-encoded value of the type: string[] - * - * @param exclude A JSON encoded string[] containing the paths to exclude - * when enumerating the directory. - */ - readDirectory(rootDir: string, extension: string, basePaths?: string, excludeEx?: string, includeFileEx?: string, includeDirEx?: string, depth?: number): string; - - /** - * Read arbitrary text files on disk, i.e. when resolution procedure needs the content of 'package.json' to determine location of bundled typings for node modules - */ - readFile(fileName: string): string | undefined; - realpath?(path: string): string; - trace(s: string): void; - useCaseSensitiveFileNames?(): boolean; -} - -/// -/// Pre-processing -/// -// Note: This is being using by the host (VS) and is marshaled back and forth. -// When changing this make sure the changes are reflected in the managed side as well -/** @internal */ -export interface ShimsFileReference { - path: string; - position: number; - length: number; -} - -/** - * Public interface of a language service instance shim. - * - * @internal - */ -export interface ShimFactory { - registerShim(shim: Shim): void; - unregisterShim(shim: Shim): void; -} - -/** @internal */ -export interface Shim { - dispose(_dummy: {}): void; -} - -/** @internal */ -export interface LanguageServiceShim extends Shim { - languageService: LanguageService; - - dispose(_dummy: {}): void; - - refresh(throwOnError: boolean): void; - - cleanupSemanticCache(): void; - - getSyntacticDiagnostics(fileName: string): string; - getSemanticDiagnostics(fileName: string): string; - getSuggestionDiagnostics(fileName: string): string; - getCompilerOptionsDiagnostics(): string; - - getSyntacticClassifications(fileName: string, start: number, length: number): string; - getSemanticClassifications(fileName: string, start: number, length: number, format?: SemanticClassificationFormat): string; - getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string; - getEncodedSemanticClassifications(fileName: string, start: number, length: number, format?: SemanticClassificationFormat): string; - - getCompletionsAtPosition(fileName: string, position: number, preferences: UserPreferences | undefined, formattingSettings: FormatCodeSettings | undefined): string; - getCompletionEntryDetails(fileName: string, position: number, entryName: string, formatOptions: string /*Services.FormatCodeOptions*/ | undefined, source: string | undefined, preferences: UserPreferences | undefined, data: CompletionEntryData | undefined): string; - - getQuickInfoAtPosition(fileName: string, position: number): string; - - getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string; - getBreakpointStatementAtPosition(fileName: string, position: number): string; - - getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): string; - - /** - * Returns a JSON-encoded value of the type: - * { canRename: boolean, localizedErrorMessage: string, displayName: string, fullDisplayName: string, kind: string, kindModifiers: string, triggerSpan: { start; length } } - */ - getRenameInfo(fileName: string, position: number, preferences: UserPreferences): string; - getSmartSelectionRange(fileName: string, position: number): string; - - /** - * Returns a JSON-encoded value of the type: - * { fileName: string, textSpan: { start: number, length: number } }[] - */ - findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, preferences?: UserPreferences | boolean): string; - - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string } - * - * Or undefined value if no definition can be found. - */ - getDefinitionAtPosition(fileName: string, position: number): string; - - getDefinitionAndBoundSpan(fileName: string, position: number): string; - - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; kind: string; name: string; containerKind: string; containerName: string } - * - * Or undefined value if no definition can be found. - */ - getTypeDefinitionAtPosition(fileName: string, position: number): string; - - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; }[] - */ - getImplementationAtPosition(fileName: string, position: number): string; - - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean, isDefinition?: boolean }[] - */ - getReferencesAtPosition(fileName: string, position: number): string; - - /** - * Returns a JSON-encoded value of the type: - * { definition: ; references: [] }[] - */ - findReferences(fileName: string, position: number): string; - - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; textSpan: { start: number; length: number}; isWriteAccess: boolean, isDefinition?: boolean }[] - */ - getFileReferences(fileName: string): string; - - /** - * Returns a JSON-encoded value of the type: - * { fileName: string; highlights: { start: number; length: number }[] }[] - * - * @param fileToSearch A JSON encoded string[] containing the file names that should be - * considered when searching. - */ - getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string; - - /** - * Returns a JSON-encoded value of the type: - * { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = []; - */ - getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string): string; - - /** - * Returns a JSON-encoded value of the type: - * { text: string; kind: string; kindModifiers: string; bolded: boolean; grayed: boolean; indent: number; spans: { start: number; length: number; }[]; childItems: [] } [] = []; - */ - getNavigationBarItems(fileName: string): string; - - /** Returns a JSON-encoded value of the type ts.NavigationTree. */ - getNavigationTree(fileName: string): string; - - /** - * Returns a JSON-encoded value of the type: - * { textSpan: { start: number, length: number }; hintSpan: { start: number, length: number }; bannerText: string; autoCollapse: boolean } [] = []; - */ - getOutliningSpans(fileName: string): string; - - getTodoComments(fileName: string, todoCommentDescriptors: string): string; - - getBraceMatchingAtPosition(fileName: string, position: number): string; - getIndentationAtPosition(fileName: string, position: number, options: string /*Services.EditorOptions*/): string; - - getFormattingEditsForRange(fileName: string, start: number, end: number, options: string /*Services.FormatCodeOptions*/): string; - getFormattingEditsForDocument(fileName: string, options: string /*Services.FormatCodeOptions*/): string; - getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: string /*Services.FormatCodeOptions*/): string; - - /** - * Returns JSON-encoded value of the type TextInsertion. - */ - getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): string; - - /** - * Returns JSON-encoded boolean to indicate whether we should support brace location - * at the current position. - * E.g. we don't want brace completion inside string-literals, comments, etc. - */ - isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): string; - - /** - * Returns a JSON-encoded TextSpan | undefined indicating the range of the enclosing comment, if it exists. - */ - getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): string; - - prepareCallHierarchy(fileName: string, position: number): string; - provideCallHierarchyIncomingCalls(fileName: string, position: number): string; - provideCallHierarchyOutgoingCalls(fileName: string, position: number): string; - provideInlayHints(fileName: string, span: TextSpan, preference: UserPreferences | undefined): string; - getEmitOutput(fileName: string): string; - getEmitOutputObject(fileName: string): EmitOutput; - - toggleLineComment(fileName: string, textChange: TextRange): string; - toggleMultilineComment(fileName: string, textChange: TextRange): string; - commentSelection(fileName: string, textChange: TextRange): string; - uncommentSelection(fileName: string, textChange: TextRange): string; -} - -/** @internal */ -export interface ClassifierShim extends Shim { - getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; - getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; -} - -/** @internal */ -export interface CoreServicesShim extends Shim { - getAutomaticTypeDirectiveNames(compilerOptionsJson: string): string; - getPreProcessedFileInfo(fileName: string, sourceText: IScriptSnapshot): string; - getTSConfigFileInfo(fileName: string, sourceText: IScriptSnapshot): string; - getDefaultCompilationSettings(): string; - discoverTypings(discoverTypingsJson: string): string; -} - -function logInternalError(logger: Logger, err: Error) { - if (logger) { - logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); - } -} - -class ScriptSnapshotShimAdapter implements IScriptSnapshot { - constructor(private scriptSnapshotShim: ScriptSnapshotShim) { - } - - public getText(start: number, end: number): string { - return this.scriptSnapshotShim.getText(start, end); - } - - public getLength(): number { - return this.scriptSnapshotShim.getLength(); - } - - public getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined { - const oldSnapshotShim = oldSnapshot as ScriptSnapshotShimAdapter; - const encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); - /* eslint-disable no-null/no-null */ - if (encoded === null) { - return null!; // TODO: GH#18217 - } - /* eslint-enable no-null/no-null */ - - const decoded: { span: { start: number; length: number; }; newLength: number; } = JSON.parse(encoded!); // TODO: GH#18217 - return createTextChangeRange( - createTextSpan(decoded.span.start, decoded.span.length), - decoded.newLength, - ); - } - - public dispose(): void { - // if scriptSnapshotShim is a COM object then property check becomes method call with no arguments - // 'in' does not have this effect - if ("dispose" in this.scriptSnapshotShim) { - this.scriptSnapshotShim.dispose!(); // TODO: GH#18217 Can we just use `if (this.scriptSnapshotShim.dispose)`? - } - } -} - -/** @internal */ -export class LanguageServiceShimHostAdapter implements LanguageServiceHost { - private loggingEnabled = false; - private tracingEnabled = false; - - public resolveModuleNames: ((moduleName: string[], containingFile: string) => (ResolvedModuleFull | undefined)[]) | undefined; - public resolveTypeReferenceDirectives: ((typeDirectiveNames: string[] | readonly FileReference[], containingFile: string) => (ResolvedTypeReferenceDirective | undefined)[]) | undefined; - public directoryExists: ((directoryName: string) => boolean) | undefined; - - public jsDocParsingMode: JSDocParsingMode | undefined; - - constructor(private shimHost: LanguageServiceShimHost) { - // if shimHost is a COM object then property check will become method call with no arguments. - // 'in' does not have this effect. - if ("getModuleResolutionsForFile" in this.shimHost) { - this.resolveModuleNames = (moduleNames, containingFile) => { - const resolutionsInFile = JSON.parse(this.shimHost.getModuleResolutionsForFile!(containingFile)) as MapLike; // TODO: GH#18217 - return map(moduleNames, name => { - const result = getProperty(resolutionsInFile, name); - return result ? { resolvedFileName: result, extension: extensionFromPath(result), isExternalLibraryImport: false } : undefined; - }); - }; - } - if ("directoryExists" in this.shimHost) { - this.directoryExists = directoryName => this.shimHost.directoryExists(directoryName); - } - if ("getTypeReferenceDirectiveResolutionsForFile" in this.shimHost) { - this.resolveTypeReferenceDirectives = (typeDirectiveNames, containingFile) => { - const typeDirectivesForFile = JSON.parse(this.shimHost.getTypeReferenceDirectiveResolutionsForFile!(containingFile)) as MapLike; // TODO: GH#18217 - return map(typeDirectiveNames as (string | FileReference)[], name => getProperty(typeDirectivesForFile, isString(name) ? name : toFileNameLowerCase(name.fileName))); - }; - } - if ("jsDocParsingMode" in this.shimHost) { - this.jsDocParsingMode = this.shimHost.jsDocParsingMode; - } - } - - public log(s: string): void { - if (this.loggingEnabled) { - this.shimHost.log(s); - } - } - - public trace(s: string): void { - if (this.tracingEnabled) { - this.shimHost.trace(s); - } - } - - public error(s: string): void { - this.shimHost.error(s); - } - - public getProjectVersion(): string { - if (!this.shimHost.getProjectVersion) { - // shimmed host does not support getProjectVersion - return undefined!; // TODO: GH#18217 - } - - return this.shimHost.getProjectVersion(); - } - - public getTypeRootsVersion(): number { - if (!this.shimHost.getTypeRootsVersion) { - return 0; - } - return this.shimHost.getTypeRootsVersion(); - } - - public useCaseSensitiveFileNames(): boolean { - return this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; - } - - public getCompilationSettings(): CompilerOptions { - const settingsJson = this.shimHost.getCompilationSettings(); - // eslint-disable-next-line no-null/no-null - if (settingsJson === null || settingsJson === "") { - throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); - } - const compilerOptions = JSON.parse(settingsJson) as CompilerOptions; - // permit language service to handle all files (filtering should be performed on the host side) - compilerOptions.allowNonTsExtensions = true; - return compilerOptions; - } - - public getScriptFileNames(): string[] { - const encoded = this.shimHost.getScriptFileNames(); - return JSON.parse(encoded); - } - - public getScriptSnapshot(fileName: string): IScriptSnapshot | undefined { - const scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); - return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); - } - - public getScriptKind(fileName: string): ScriptKind { - if ("getScriptKind" in this.shimHost) { - return this.shimHost.getScriptKind!(fileName); // TODO: GH#18217 - } - else { - return ScriptKind.Unknown; - } - } - - public getScriptVersion(fileName: string): string { - return this.shimHost.getScriptVersion(fileName); - } - - public getLocalizedDiagnosticMessages() { - /* eslint-disable no-null/no-null */ - const diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); - if (diagnosticMessagesJson === null || diagnosticMessagesJson === "") { - return null; - } - - try { - return JSON.parse(diagnosticMessagesJson); - } - catch (e) { - this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format"); - return null; - } - /* eslint-enable no-null/no-null */ - } - - public getCancellationToken(): HostCancellationToken { - const hostCancellationToken = this.shimHost.getCancellationToken(); - return new ThrottledCancellationToken(hostCancellationToken); - } - - public getCurrentDirectory(): string { - return this.shimHost.getCurrentDirectory(); - } - - public getDirectories(path: string): string[] { - return JSON.parse(this.shimHost.getDirectories(path)); - } - - public getDefaultLibFileName(options: CompilerOptions): string { - return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); - } - - public readDirectory(path: string, extensions?: readonly string[], exclude?: string[], include?: string[], depth?: number): string[] { - const pattern = getFileMatcherPatterns(path, exclude, include, this.shimHost.useCaseSensitiveFileNames!(), this.shimHost.getCurrentDirectory()); // TODO: GH#18217 - return JSON.parse(this.shimHost.readDirectory( - path, - JSON.stringify(extensions), - JSON.stringify(pattern.basePaths), - pattern.excludePattern, - pattern.includeFilePattern, - pattern.includeDirectoryPattern, - depth, - )); - } - - public readFile(path: string, encoding?: string): string | undefined { - return this.shimHost.readFile(path, encoding); - } - - public fileExists(path: string): boolean { - return this.shimHost.fileExists(path); - } -} - -/** @internal */ -export class CoreServicesShimHostAdapter implements ParseConfigHost, ModuleResolutionHost, JsTyping.TypingResolutionHost { - public directoryExists: (directoryName: string) => boolean; - public realpath: (path: string) => string; - public useCaseSensitiveFileNames: boolean; - - constructor(private shimHost: CoreServicesShimHost) { - this.useCaseSensitiveFileNames = this.shimHost.useCaseSensitiveFileNames ? this.shimHost.useCaseSensitiveFileNames() : false; - if ("directoryExists" in this.shimHost) { - this.directoryExists = directoryName => this.shimHost.directoryExists(directoryName); - } - else { - this.directoryExists = undefined!; // TODO: GH#18217 - } - if ("realpath" in this.shimHost) { - this.realpath = path => this.shimHost.realpath!(path); // TODO: GH#18217 - } - else { - this.realpath = undefined!; // TODO: GH#18217 - } - } - - public readDirectory(rootDir: string, extensions: readonly string[], exclude: readonly string[], include: readonly string[], depth?: number): string[] { - const pattern = getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames!(), this.shimHost.getCurrentDirectory()); // TODO: GH#18217 - return JSON.parse(this.shimHost.readDirectory( - rootDir, - JSON.stringify(extensions), - JSON.stringify(pattern.basePaths), - pattern.excludePattern, - pattern.includeFilePattern, - pattern.includeDirectoryPattern, - depth, - )); - } - - public fileExists(fileName: string): boolean { - return this.shimHost.fileExists(fileName); - } - - public readFile(fileName: string): string | undefined { - return this.shimHost.readFile(fileName); - } - - public getDirectories(path: string): string[] { - return JSON.parse(this.shimHost.getDirectories(path)); - } -} - -function simpleForwardCall(logger: Logger, actionDescription: string, action: () => unknown, logPerformance: boolean): unknown { - let start: number | undefined; - if (logPerformance) { - logger.log(actionDescription); - start = timestamp(); - } - - const result = action(); - - if (logPerformance) { - const end = timestamp(); - logger.log(`${actionDescription} completed in ${end - start!} msec`); - if (isString(result)) { - let str = result; - if (str.length > 128) { - str = str.substring(0, 128) + "..."; - } - logger.log(` result.length=${str.length}, result='${JSON.stringify(str)}'`); - } - } - - return result; -} - -function forwardJSONCall(logger: Logger, actionDescription: string, action: () => {} | null | undefined, logPerformance: boolean): string { - return forwardCall(logger, actionDescription, /*returnJson*/ true, action, logPerformance) as string; -} - -function forwardCall(logger: Logger, actionDescription: string, returnJson: boolean, action: () => T, logPerformance: boolean): T | string { - try { - const result = simpleForwardCall(logger, actionDescription, action, logPerformance); - return returnJson ? JSON.stringify({ result }) : result as T; - } - catch (err) { - if (err instanceof OperationCanceledException) { - return JSON.stringify({ canceled: true }); - } - logInternalError(logger, err); - err.description = actionDescription; - return JSON.stringify({ error: err }); - } -} - -class ShimBase implements Shim { - constructor(private factory: ShimFactory) { - factory.registerShim(this); - } - public dispose(_dummy: {}): void { - this.factory.unregisterShim(this); - } -} - -/** @internal */ -export interface RealizedDiagnostic { - message: string; - start: number; - length: number; - category: string; - code: number; - reportsUnnecessary?: {}; - reportsDeprecated?: {}; -} -/** @internal */ -export function realizeDiagnostics(diagnostics: readonly Diagnostic[], newLine: string): RealizedDiagnostic[] { - return diagnostics.map(d => realizeDiagnostic(d, newLine)); -} - -function realizeDiagnostic(diagnostic: Diagnostic, newLine: string): RealizedDiagnostic { - return { - message: flattenDiagnosticMessageText(diagnostic.messageText, newLine), - start: diagnostic.start!, // TODO: GH#18217 - length: diagnostic.length!, // TODO: GH#18217 - category: diagnosticCategoryName(diagnostic), - code: diagnostic.code, - reportsUnnecessary: diagnostic.reportsUnnecessary, - reportsDeprecated: diagnostic.reportsDeprecated, - }; -} - -class LanguageServiceShimObject extends ShimBase implements LanguageServiceShim { - private logger: Logger; - private logPerformance = false; - - constructor(factory: ShimFactory, private host: LanguageServiceShimHost, public languageService: LanguageService) { - super(factory); - this.logger = this.host; - } - - public forwardJSONCall(actionDescription: string, action: () => {} | null | undefined): string { - return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); - } - - /// DISPOSE - - /** - * Ensure (almost) deterministic release of internal Javascript resources when - * some external native objects holds onto us (e.g. Com/Interop). - */ - public override dispose(dummy: {}): void { - this.logger.log("dispose()"); - this.languageService.dispose(); - this.languageService = null!; // eslint-disable-line no-null/no-null - - // force a GC - if (debugObjectHost && debugObjectHost.CollectGarbage) { - debugObjectHost.CollectGarbage(); - this.logger.log("CollectGarbage()"); - } - - this.logger = null!; // eslint-disable-line no-null/no-null - - super.dispose(dummy); - } - - /// REFRESH - - /** - * Update the list of scripts known to the compiler - */ - public refresh(throwOnError: boolean): void { - this.forwardJSONCall( - `refresh(${throwOnError})`, - () => null, // eslint-disable-line no-null/no-null - ); - } - - public cleanupSemanticCache(): void { - this.forwardJSONCall( - "cleanupSemanticCache()", - () => { - this.languageService.cleanupSemanticCache(); - return null; // eslint-disable-line no-null/no-null - }, - ); - } - - private realizeDiagnostics(diagnostics: readonly Diagnostic[]): { message: string; start: number; length: number; category: string; }[] { - const newLine = getNewLineOrDefaultFromHost(this.host, /*formatSettings*/ undefined); - return realizeDiagnostics(diagnostics, newLine); - } - - public getSyntacticClassifications(fileName: string, start: number, length: number): string { - return this.forwardJSONCall( - `getSyntacticClassifications('${fileName}', ${start}, ${length})`, - () => this.languageService.getSyntacticClassifications(fileName, createTextSpan(start, length)), - ); - } - - public getSemanticClassifications(fileName: string, start: number, length: number): string { - return this.forwardJSONCall( - `getSemanticClassifications('${fileName}', ${start}, ${length})`, - () => this.languageService.getSemanticClassifications(fileName, createTextSpan(start, length)), - ); - } - - public getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string { - return this.forwardJSONCall( - `getEncodedSyntacticClassifications('${fileName}', ${start}, ${length})`, - // directly serialize the spans out to a string. This is much faster to decode - // on the managed side versus a full JSON array. - () => convertClassifications(this.languageService.getEncodedSyntacticClassifications(fileName, createTextSpan(start, length))), - ); - } - - public getEncodedSemanticClassifications(fileName: string, start: number, length: number): string { - return this.forwardJSONCall( - `getEncodedSemanticClassifications('${fileName}', ${start}, ${length})`, - // directly serialize the spans out to a string. This is much faster to decode - // on the managed side versus a full JSON array. - () => convertClassifications(this.languageService.getEncodedSemanticClassifications(fileName, createTextSpan(start, length))), - ); - } - - public getSyntacticDiagnostics(fileName: string): string { - return this.forwardJSONCall( - `getSyntacticDiagnostics('${fileName}')`, - () => { - const diagnostics = this.languageService.getSyntacticDiagnostics(fileName); - return this.realizeDiagnostics(diagnostics); - }, - ); - } - - public getSemanticDiagnostics(fileName: string): string { - return this.forwardJSONCall( - `getSemanticDiagnostics('${fileName}')`, - () => { - const diagnostics = this.languageService.getSemanticDiagnostics(fileName); - return this.realizeDiagnostics(diagnostics); - }, - ); - } - - public getSuggestionDiagnostics(fileName: string): string { - return this.forwardJSONCall(`getSuggestionDiagnostics('${fileName}')`, () => this.realizeDiagnostics(this.languageService.getSuggestionDiagnostics(fileName))); - } - - public getCompilerOptionsDiagnostics(): string { - return this.forwardJSONCall( - "getCompilerOptionsDiagnostics()", - () => { - const diagnostics = this.languageService.getCompilerOptionsDiagnostics(); - return this.realizeDiagnostics(diagnostics); - }, - ); - } - - /// QUICKINFO - - /** - * Computes a string representation of the type at the requested position - * in the active file. - */ - public getQuickInfoAtPosition(fileName: string, position: number): string { - return this.forwardJSONCall( - `getQuickInfoAtPosition('${fileName}', ${position})`, - () => this.languageService.getQuickInfoAtPosition(fileName, position), - ); - } - - /// NAMEORDOTTEDNAMESPAN - - /** - * Computes span information of the name or dotted name at the requested position - * in the active file. - */ - public getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): string { - return this.forwardJSONCall( - `getNameOrDottedNameSpan('${fileName}', ${startPos}, ${endPos})`, - () => this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos), - ); - } - - /** - * STATEMENTSPAN - * Computes span information of statement at the requested position in the active file. - */ - public getBreakpointStatementAtPosition(fileName: string, position: number): string { - return this.forwardJSONCall( - `getBreakpointStatementAtPosition('${fileName}', ${position})`, - () => this.languageService.getBreakpointStatementAtPosition(fileName, position), - ); - } - - /// SIGNATUREHELP - - public getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): string { - return this.forwardJSONCall( - `getSignatureHelpItems('${fileName}', ${position})`, - () => this.languageService.getSignatureHelpItems(fileName, position, options), - ); - } - - /// GOTO DEFINITION - - /** - * Computes the definition location and file for the symbol - * at the requested position. - */ - public getDefinitionAtPosition(fileName: string, position: number): string { - return this.forwardJSONCall( - `getDefinitionAtPosition('${fileName}', ${position})`, - () => this.languageService.getDefinitionAtPosition(fileName, position), - ); - } - - /** - * Computes the definition location and file for the symbol - * at the requested position. - */ - public getDefinitionAndBoundSpan(fileName: string, position: number): string { - return this.forwardJSONCall( - `getDefinitionAndBoundSpan('${fileName}', ${position})`, - () => this.languageService.getDefinitionAndBoundSpan(fileName, position), - ); - } - - /// GOTO Type - - /** - * Computes the definition location of the type of the symbol - * at the requested position. - */ - public getTypeDefinitionAtPosition(fileName: string, position: number): string { - return this.forwardJSONCall( - `getTypeDefinitionAtPosition('${fileName}', ${position})`, - () => this.languageService.getTypeDefinitionAtPosition(fileName, position), - ); - } - - /// GOTO Implementation - - /** - * Computes the implementation location of the symbol - * at the requested position. - */ - public getImplementationAtPosition(fileName: string, position: number): string { - return this.forwardJSONCall( - `getImplementationAtPosition('${fileName}', ${position})`, - () => this.languageService.getImplementationAtPosition(fileName, position), - ); - } - - public getRenameInfo(fileName: string, position: number, preferences: UserPreferences): string { - return this.forwardJSONCall( - `getRenameInfo('${fileName}', ${position})`, - () => this.languageService.getRenameInfo(fileName, position, preferences), - ); - } - - public getSmartSelectionRange(fileName: string, position: number): string { - return this.forwardJSONCall( - `getSmartSelectionRange('${fileName}', ${position})`, - () => this.languageService.getSmartSelectionRange(fileName, position), - ); - } - - public findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, preferences: UserPreferences): string { - return this.forwardJSONCall( - `findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments})`, - () => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, preferences), - ); - } - - /// GET BRACE MATCHING - public getBraceMatchingAtPosition(fileName: string, position: number): string { - return this.forwardJSONCall( - `getBraceMatchingAtPosition('${fileName}', ${position})`, - () => this.languageService.getBraceMatchingAtPosition(fileName, position), - ); - } - - public isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): string { - return this.forwardJSONCall( - `isValidBraceCompletionAtPosition('${fileName}', ${position}, ${openingBrace})`, - () => this.languageService.isValidBraceCompletionAtPosition(fileName, position, openingBrace), - ); - } - - public getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): string { - return this.forwardJSONCall( - `getSpanOfEnclosingComment('${fileName}', ${position})`, - () => this.languageService.getSpanOfEnclosingComment(fileName, position, onlyMultiLine), - ); - } - - /// GET SMART INDENT - public getIndentationAtPosition(fileName: string, position: number, options: string /*Services.EditorOptions*/): string { - return this.forwardJSONCall( - `getIndentationAtPosition('${fileName}', ${position})`, - () => { - const localOptions: EditorOptions = JSON.parse(options); - return this.languageService.getIndentationAtPosition(fileName, position, localOptions); - }, - ); - } - - /// GET REFERENCES - - public getReferencesAtPosition(fileName: string, position: number): string { - return this.forwardJSONCall( - `getReferencesAtPosition('${fileName}', ${position})`, - () => this.languageService.getReferencesAtPosition(fileName, position), - ); - } - - public findReferences(fileName: string, position: number): string { - return this.forwardJSONCall( - `findReferences('${fileName}', ${position})`, - () => this.languageService.findReferences(fileName, position), - ); - } - - public getFileReferences(fileName: string) { - return this.forwardJSONCall( - `getFileReferences('${fileName})`, - () => this.languageService.getFileReferences(fileName), - ); - } - - public getDocumentHighlights(fileName: string, position: number, filesToSearch: string): string { - return this.forwardJSONCall( - `getDocumentHighlights('${fileName}', ${position})`, - () => { - const results = this.languageService.getDocumentHighlights(fileName, position, JSON.parse(filesToSearch)); - // workaround for VS document highlighting issue - keep only items from the initial file - const normalizedName = toFileNameLowerCase(normalizeSlashes(fileName)); - return filter(results, r => toFileNameLowerCase(normalizeSlashes(r.fileName)) === normalizedName); - }, - ); - } - - /// COMPLETION LISTS - - /** - * Get a string based representation of the completions - * to provide at the given source position and providing a member completion - * list if requested. - */ - public getCompletionsAtPosition(fileName: string, position: number, preferences: GetCompletionsAtPositionOptions | undefined, formattingSettings: FormatCodeSettings | undefined) { - return this.forwardJSONCall( - `getCompletionsAtPosition('${fileName}', ${position}, ${preferences}, ${formattingSettings})`, - () => this.languageService.getCompletionsAtPosition(fileName, position, preferences, formattingSettings), - ); - } - - /** Get a string based representation of a completion list entry details */ - public getCompletionEntryDetails(fileName: string, position: number, entryName: string, formatOptions: string /*Services.FormatCodeOptions*/ | undefined, source: string | undefined, preferences: UserPreferences | undefined, data: CompletionEntryData | undefined) { - return this.forwardJSONCall( - `getCompletionEntryDetails('${fileName}', ${position}, '${entryName}')`, - () => { - const localOptions: FormatCodeOptions = formatOptions === undefined ? undefined : JSON.parse(formatOptions); - return this.languageService.getCompletionEntryDetails(fileName, position, entryName, localOptions, source, preferences, data); - }, - ); - } - - public getFormattingEditsForRange(fileName: string, start: number, end: number, options: string /*Services.FormatCodeOptions*/): string { - return this.forwardJSONCall( - `getFormattingEditsForRange('${fileName}', ${start}, ${end})`, - () => { - const localOptions: FormatCodeOptions = JSON.parse(options); - return this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); - }, - ); - } - - public getFormattingEditsForDocument(fileName: string, options: string /*Services.FormatCodeOptions*/): string { - return this.forwardJSONCall( - `getFormattingEditsForDocument('${fileName}')`, - () => { - const localOptions: FormatCodeOptions = JSON.parse(options); - return this.languageService.getFormattingEditsForDocument(fileName, localOptions); - }, - ); - } - - public getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: string /*Services.FormatCodeOptions*/): string { - return this.forwardJSONCall( - `getFormattingEditsAfterKeystroke('${fileName}', ${position}, '${key}')`, - () => { - const localOptions: FormatCodeOptions = JSON.parse(options); - return this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); - }, - ); - } - - public getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): string { - return this.forwardJSONCall( - `getDocCommentTemplateAtPosition('${fileName}', ${position})`, - () => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions), - ); - } - - /// NAVIGATE TO - - /** Return a list of symbols that are interesting to navigate to */ - public getNavigateToItems(searchValue: string, maxResultCount?: number, fileName?: string): string { - return this.forwardJSONCall( - `getNavigateToItems('${searchValue}', ${maxResultCount}, ${fileName})`, - () => this.languageService.getNavigateToItems(searchValue, maxResultCount, fileName), - ); - } - - public getNavigationBarItems(fileName: string): string { - return this.forwardJSONCall( - `getNavigationBarItems('${fileName}')`, - () => this.languageService.getNavigationBarItems(fileName), - ); - } - - public getNavigationTree(fileName: string): string { - return this.forwardJSONCall( - `getNavigationTree('${fileName}')`, - () => this.languageService.getNavigationTree(fileName), - ); - } - - public getOutliningSpans(fileName: string): string { - return this.forwardJSONCall( - `getOutliningSpans('${fileName}')`, - () => this.languageService.getOutliningSpans(fileName), - ); - } - - public getTodoComments(fileName: string, descriptors: string): string { - return this.forwardJSONCall( - `getTodoComments('${fileName}')`, - () => this.languageService.getTodoComments(fileName, JSON.parse(descriptors)), - ); - } - - /// CALL HIERARCHY - - public prepareCallHierarchy(fileName: string, position: number): string { - return this.forwardJSONCall( - `prepareCallHierarchy('${fileName}', ${position})`, - () => this.languageService.prepareCallHierarchy(fileName, position), - ); - } - - public provideCallHierarchyIncomingCalls(fileName: string, position: number): string { - return this.forwardJSONCall( - `provideCallHierarchyIncomingCalls('${fileName}', ${position})`, - () => this.languageService.provideCallHierarchyIncomingCalls(fileName, position), - ); - } - - public provideCallHierarchyOutgoingCalls(fileName: string, position: number): string { - return this.forwardJSONCall( - `provideCallHierarchyOutgoingCalls('${fileName}', ${position})`, - () => this.languageService.provideCallHierarchyOutgoingCalls(fileName, position), - ); - } - - public provideInlayHints(fileName: string, span: TextSpan, preference: UserPreferences | undefined): string { - return this.forwardJSONCall( - `provideInlayHints('${fileName}', '${JSON.stringify(span)}', ${JSON.stringify(preference)})`, - () => this.languageService.provideInlayHints(fileName, span, preference), - ); - } - - /// Emit - public getEmitOutput(fileName: string): string { - return this.forwardJSONCall( - `getEmitOutput('${fileName}')`, - () => { - const { diagnostics, ...rest } = this.languageService.getEmitOutput(fileName); - return { ...rest, diagnostics: this.realizeDiagnostics(diagnostics) }; - }, - ); - } - - public getEmitOutputObject(fileName: string): EmitOutput { - return forwardCall( - this.logger, - `getEmitOutput('${fileName}')`, - /*returnJson*/ false, - () => this.languageService.getEmitOutput(fileName), - this.logPerformance, - ) as EmitOutput; - } - - public toggleLineComment(fileName: string, textRange: TextRange): string { - return this.forwardJSONCall( - `toggleLineComment('${fileName}', '${JSON.stringify(textRange)}')`, - () => this.languageService.toggleLineComment(fileName, textRange), - ); - } - - public toggleMultilineComment(fileName: string, textRange: TextRange): string { - return this.forwardJSONCall( - `toggleMultilineComment('${fileName}', '${JSON.stringify(textRange)}')`, - () => this.languageService.toggleMultilineComment(fileName, textRange), - ); - } - - public commentSelection(fileName: string, textRange: TextRange): string { - return this.forwardJSONCall( - `commentSelection('${fileName}', '${JSON.stringify(textRange)}')`, - () => this.languageService.commentSelection(fileName, textRange), - ); - } - - public uncommentSelection(fileName: string, textRange: TextRange): string { - return this.forwardJSONCall( - `uncommentSelection('${fileName}', '${JSON.stringify(textRange)}')`, - () => this.languageService.uncommentSelection(fileName, textRange), - ); - } -} - -function convertClassifications(classifications: Classifications): { spans: string; endOfLineState: EndOfLineState; } { - return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; -} - -class ClassifierShimObject extends ShimBase implements ClassifierShim { - public classifier: Classifier; - private logPerformance = false; - - constructor(factory: ShimFactory, private logger: Logger) { - super(factory); - this.classifier = createClassifier(); - } - - public getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent = false): string { - return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", () => convertClassifications(this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)), this.logPerformance); - } - - /// COLORIZATION - public getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics = false): string { - const classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); - let result = ""; - for (const item of classification.entries) { - result += item.length + "\n"; - result += item.classification + "\n"; - } - result += classification.finalLexState; - return result; - } -} - -class CoreServicesShimObject extends ShimBase implements CoreServicesShim { - private logPerformance = false; - private safeList: JsTyping.SafeList | undefined; - - constructor(factory: ShimFactory, public readonly logger: Logger, private readonly host: CoreServicesShimHostAdapter) { - super(factory); - } - - private forwardJSONCall(actionDescription: string, action: () => {}): string { - return forwardJSONCall(this.logger, actionDescription, action, this.logPerformance); - } - - public resolveModuleName(fileName: string, moduleName: string, compilerOptionsJson: string): string { - return this.forwardJSONCall(`resolveModuleName('${fileName}')`, () => { - const compilerOptions = JSON.parse(compilerOptionsJson) as CompilerOptions; - const result = resolveModuleName(moduleName, normalizeSlashes(fileName), compilerOptions, this.host); - let resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (result.resolvedModule && result.resolvedModule.extension !== Extension.Ts && result.resolvedModule.extension !== Extension.Tsx && result.resolvedModule.extension !== Extension.Dts) { - resolvedFileName = undefined; - } - - return { - resolvedFileName, - failedLookupLocations: result.failedLookupLocations, - affectingLocations: result.affectingLocations, - }; - }); - } - - public resolveTypeReferenceDirective(fileName: string, typeReferenceDirective: string, compilerOptionsJson: string): string { - return this.forwardJSONCall(`resolveTypeReferenceDirective(${fileName})`, () => { - const compilerOptions = JSON.parse(compilerOptionsJson) as CompilerOptions; - const result = resolveTypeReferenceDirective(typeReferenceDirective, normalizeSlashes(fileName), compilerOptions, this.host); - return { - resolvedFileName: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.resolvedFileName : undefined, - primary: result.resolvedTypeReferenceDirective ? result.resolvedTypeReferenceDirective.primary : true, - failedLookupLocations: result.failedLookupLocations, - }; - }); - } - - public getPreProcessedFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string { - return this.forwardJSONCall( - `getPreProcessedFileInfo('${fileName}')`, - () => { - // for now treat files as JavaScript - const result = preProcessFile(getSnapshotText(sourceTextSnapshot), /*readImportFiles*/ true, /*detectJavaScriptImports*/ true); - return { - referencedFiles: this.convertFileReferences(result.referencedFiles), - importedFiles: this.convertFileReferences(result.importedFiles), - ambientExternalModules: result.ambientExternalModules, - isLibFile: result.isLibFile, - typeReferenceDirectives: this.convertFileReferences(result.typeReferenceDirectives), - libReferenceDirectives: this.convertFileReferences(result.libReferenceDirectives), - }; - }, - ); - } - - public getAutomaticTypeDirectiveNames(compilerOptionsJson: string): string { - return this.forwardJSONCall( - `getAutomaticTypeDirectiveNames('${compilerOptionsJson}')`, - () => { - const compilerOptions = JSON.parse(compilerOptionsJson) as CompilerOptions; - return getAutomaticTypeDirectiveNames(compilerOptions, this.host); - }, - ); - } - - private convertFileReferences(refs: FileReference[]): ShimsFileReference[] | undefined { - if (!refs) { - return undefined; - } - const result: ShimsFileReference[] = []; - for (const ref of refs) { - result.push({ - path: normalizeSlashes(ref.fileName), - position: ref.pos, - length: ref.end - ref.pos, - }); - } - return result; - } - - public getTSConfigFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string { - return this.forwardJSONCall( - `getTSConfigFileInfo('${fileName}')`, - () => { - const result = parseJsonText(fileName, getSnapshotText(sourceTextSnapshot)); - const normalizedFileName = normalizeSlashes(fileName); - const configFile = parseJsonSourceFileConfigFileContent(result, this.host, getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName); - - return { - options: configFile.options, - typeAcquisition: configFile.typeAcquisition, - files: configFile.fileNames, - raw: configFile.raw, - errors: realizeDiagnostics([...result.parseDiagnostics, ...configFile.errors], "\r\n"), - }; - }, - ); - } - - public getDefaultCompilationSettings(): string { - return this.forwardJSONCall( - "getDefaultCompilationSettings()", - () => getDefaultCompilerOptions(), - ); - } - - public discoverTypings(discoverTypingsJson: string): string { - const getCanonicalFileName = createGetCanonicalFileName(/*useCaseSensitiveFileNames*/ false); - return this.forwardJSONCall("discoverTypings()", () => { - const info = JSON.parse(discoverTypingsJson) as DiscoverTypingsInfo; - if (this.safeList === undefined) { - this.safeList = JsTyping.loadSafeList(this.host, toPath(info.safeListPath, info.safeListPath, getCanonicalFileName)); - } - return JsTyping.discoverTypings( - this.host, - msg => this.logger.log(msg), - info.fileNames, - toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), - this.safeList, - info.packageNameToTypingLocation, - info.typeAcquisition, - info.unresolvedImports, - info.typesRegistry, - emptyOptions, - ); - }); - } -} - -/** @internal */ -export class TypeScriptServicesFactory implements ShimFactory { - private _shims: Shim[] = []; - private documentRegistry: DocumentRegistry | undefined; - - /* - * Returns script API version. - */ - public getServicesVersion(): string { - return servicesVersion; - } - - public createLanguageServiceShim(host: LanguageServiceShimHost): LanguageServiceShim { - try { - if (this.documentRegistry === undefined) { - this.documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); - } - const hostAdapter = new LanguageServiceShimHostAdapter(host); - const languageService = createLanguageService(hostAdapter, this.documentRegistry, /*syntaxOnlyOrLanguageServiceMode*/ false); - return new LanguageServiceShimObject(this, host, languageService); - } - catch (err) { - logInternalError(host, err); - throw err; - } - } - - public createClassifierShim(logger: Logger): ClassifierShim { - try { - return new ClassifierShimObject(this, logger); - } - catch (err) { - logInternalError(logger, err); - throw err; - } - } - - public createCoreServicesShim(host: CoreServicesShimHost): CoreServicesShim { - try { - const adapter = new CoreServicesShimHostAdapter(host); - return new CoreServicesShimObject(this, host as Logger, adapter); - } - catch (err) { - logInternalError(host as Logger, err); - throw err; - } - } - - public close(): void { - // Forget all the registered shims - clear(this._shims); - this.documentRegistry = undefined; - } - - public registerShim(shim: Shim): void { - this._shims.push(shim); - } - - public unregisterShim(shim: Shim): void { - for (let i = 0; i < this._shims.length; i++) { - if (this._shims[i] === shim) { - delete this._shims[i]; - return; - } - } - - throw new Error("Invalid operation"); - } -} - -/* eslint-enable local/no-in-operator */ diff --git a/src/testRunner/fourslashRunner.ts b/src/testRunner/fourslashRunner.ts index 3e79a035c4ecb..cbf2bf7d87e54 100644 --- a/src/testRunner/fourslashRunner.ts +++ b/src/testRunner/fourslashRunner.ts @@ -17,14 +17,6 @@ export class FourSlashRunner extends RunnerBase { this.basePath = "tests/cases/fourslash"; this.testSuiteName = "fourslash"; break; - case FourSlash.FourSlashTestType.Shims: - this.basePath = "tests/cases/fourslash/shims"; - this.testSuiteName = "fourslash-shims"; - break; - case FourSlash.FourSlashTestType.ShimsWithPreprocess: - this.basePath = "tests/cases/fourslash/shims-pp"; - this.testSuiteName = "fourslash-shims-pp"; - break; case FourSlash.FourSlashTestType.Server: this.basePath = "tests/cases/fourslash/server"; this.testSuiteName = "fourslash-server"; diff --git a/src/testRunner/runner.ts b/src/testRunner/runner.ts index 4c8151d4c3611..d8b7bbed8a501 100644 --- a/src/testRunner/runner.ts +++ b/src/testRunner/runner.ts @@ -63,10 +63,6 @@ export function createRunner(kind: TestRunnerKind): RunnerBase { return new CompilerBaselineRunner(CompilerTestType.Regressions); case "fourslash": return new FourSlashRunner(FourSlash.FourSlashTestType.Native); - case "fourslash-shims": - return new FourSlashRunner(FourSlash.FourSlashTestType.Shims); - case "fourslash-shims-pp": - return new FourSlashRunner(FourSlash.FourSlashTestType.ShimsWithPreprocess); case "fourslash-server": return new FourSlashRunner(FourSlash.FourSlashTestType.Server); case "project": @@ -189,12 +185,6 @@ function handleTestConfig() { case "fourslash": runners.push(new FourSlashRunner(FourSlash.FourSlashTestType.Native)); break; - case "fourslash-shims": - runners.push(new FourSlashRunner(FourSlash.FourSlashTestType.Shims)); - break; - case "fourslash-shims-pp": - runners.push(new FourSlashRunner(FourSlash.FourSlashTestType.ShimsWithPreprocess)); - break; case "fourslash-server": runners.push(new FourSlashRunner(FourSlash.FourSlashTestType.Server)); break; @@ -216,8 +206,6 @@ function handleTestConfig() { // language services runners.push(new FourSlashRunner(FourSlash.FourSlashTestType.Native)); - runners.push(new FourSlashRunner(FourSlash.FourSlashTestType.Shims)); - runners.push(new FourSlashRunner(FourSlash.FourSlashTestType.ShimsWithPreprocess)); runners.push(new FourSlashRunner(FourSlash.FourSlashTestType.Server)); // runners.push(new GeneratedFourslashRunner()); } diff --git a/src/testRunner/unittests/services/colorization.ts b/src/testRunner/unittests/services/colorization.ts index 27232e8fd0b95..0a28b5efaf81b 100644 --- a/src/testRunner/unittests/services/colorization.ts +++ b/src/testRunner/unittests/services/colorization.ts @@ -11,8 +11,7 @@ interface ClassificationEntry { } describe("unittests:: services:: Colorization", () => { - // Use the shim adapter to ensure test coverage of the shim layer for the classifier - const languageServiceAdapter = new Harness.LanguageService.ShimLanguageServiceAdapter(/*preprocessToResolve*/ false); + const languageServiceAdapter = new Harness.LanguageService.NativeLanguageServiceAdapter(); const classifier = languageServiceAdapter.getClassifier(); function getEntryAtPosition(result: ts.ClassificationResult, position: number) { diff --git a/tests/baselines/reference/getBreakpointStatementAtPosition.baseline b/tests/baselines/reference/getBreakpointStatementAtPosition.baseline deleted file mode 100644 index 617589b904720..0000000000000 --- a/tests/baselines/reference/getBreakpointStatementAtPosition.baseline +++ /dev/null @@ -1,71 +0,0 @@ - -1 >while (true) { - - ~~~~~~~~~~~~~~~ => Pos: (0 to 14) SpanInfo: {"start":0,"length":12} - >while (true) - >:=> (line 1, col 0) to (line 1, col 12) --------------------------------- -2 > break; - - ~~~~~~~~~~~ => Pos: (15 to 25) SpanInfo: {"start":19,"length":5} - >break - >:=> (line 2, col 4) to (line 2, col 9) --------------------------------- -3 >} - - ~~ => Pos: (26 to 27) SpanInfo: {"start":19,"length":5} - >break - >:=> (line 2, col 4) to (line 2, col 9) --------------------------------- -4 >y: while (true) { - - ~~~~~~~~~~~~~~~~~~ => Pos: (28 to 45) SpanInfo: {"start":31,"length":12} - >while (true) - >:=> (line 4, col 3) to (line 4, col 15) --------------------------------- -5 > break y; - - ~~~~~~~~~~~~~ => Pos: (46 to 58) SpanInfo: {"start":50,"length":7} - >break y - >:=> (line 5, col 4) to (line 5, col 11) --------------------------------- -6 >} - - ~~ => Pos: (59 to 60) SpanInfo: {"start":50,"length":7} - >break y - >:=> (line 5, col 4) to (line 5, col 11) --------------------------------- -7 >while (true) { - - ~~~~~~~~~~~~~~~ => Pos: (61 to 75) SpanInfo: {"start":61,"length":12} - >while (true) - >:=> (line 7, col 0) to (line 7, col 12) --------------------------------- -8 > continue; - - ~~~~~~~~~~~~~~ => Pos: (76 to 89) SpanInfo: {"start":80,"length":8} - >continue - >:=> (line 8, col 4) to (line 8, col 12) --------------------------------- -9 >} - - ~~ => Pos: (90 to 91) SpanInfo: {"start":80,"length":8} - >continue - >:=> (line 8, col 4) to (line 8, col 12) --------------------------------- -10 >z: while (true) { - - ~~~~~~~~~~~~~~~~~~ => Pos: (92 to 109) SpanInfo: {"start":95,"length":12} - >while (true) - >:=> (line 10, col 3) to (line 10, col 15) --------------------------------- -11 > continue z; - - ~~~~~~~~~~~~~~~~ => Pos: (110 to 125) SpanInfo: {"start":114,"length":10} - >continue z - >:=> (line 11, col 4) to (line 11, col 14) --------------------------------- -12 >} - ~ => Pos: (126 to 126) SpanInfo: {"start":114,"length":10} - >continue z - >:=> (line 11, col 4) to (line 11, col 14) \ No newline at end of file diff --git a/tests/baselines/reference/getDefinitionAtPosition-pp.baseline.jsonc b/tests/baselines/reference/getDefinitionAtPosition-pp.baseline.jsonc deleted file mode 100644 index b6c372e78a2c1..0000000000000 --- a/tests/baselines/reference/getDefinitionAtPosition-pp.baseline.jsonc +++ /dev/null @@ -1,147 +0,0 @@ -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Definition.ts === -// <|var [|remoteVariable|];|> -// function remoteFunction() { } -// class remoteClass { } -// interface remoteInterface{ } -// module remoteModule{ export var foo = 1;} - -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Consumption.ts === -// /*GOTO DEF POS*/remoteVariable = 1; -// remoteFunction(); -// var foo = new remoteClass(); -// class fooCls implements remoteInterface { } -// var fooVar = remoteModule.foo; - - // === Details === - [ - { - "kind": "var", - "name": "remoteVariable", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] - - - -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Definition.ts === -// var remoteVariable; -// <|function [|remoteFunction|]() { }|> -// class remoteClass { } -// interface remoteInterface{ } -// module remoteModule{ export var foo = 1;} - -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Consumption.ts === -// remoteVariable = 1; -// /*GOTO DEF POS*/remoteFunction(); -// var foo = new remoteClass(); -// class fooCls implements remoteInterface { } -// var fooVar = remoteModule.foo; - - // === Details === - [ - { - "kind": "function", - "name": "remoteFunction", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] - - - -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Definition.ts === -// var remoteVariable; -// function remoteFunction() { } -// <|class [|remoteClass|] { }|> -// interface remoteInterface{ } -// module remoteModule{ export var foo = 1;} - -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Consumption.ts === -// remoteVariable = 1; -// remoteFunction(); -// var foo = new /*GOTO DEF POS*/remoteClass(); -// class fooCls implements remoteInterface { } -// var fooVar = remoteModule.foo; - - // === Details === - [ - { - "kind": "class", - "name": "remoteClass", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] - - - -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Definition.ts === -// var remoteVariable; -// function remoteFunction() { } -// class remoteClass { } -// <|interface [|remoteInterface|]{ }|> -// module remoteModule{ export var foo = 1;} - -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Consumption.ts === -// remoteVariable = 1; -// remoteFunction(); -// var foo = new remoteClass(); -// class fooCls implements /*GOTO DEF POS*/remoteInterface { } -// var fooVar = remoteModule.foo; - - // === Details === - [ - { - "kind": "interface", - "name": "remoteInterface", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] - - - -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Definition.ts === -// var remoteVariable; -// function remoteFunction() { } -// class remoteClass { } -// interface remoteInterface{ } -// <|module [|remoteModule|]{ export var foo = 1;}|> - -// === /tests/cases/fourslash/shims-pp/goToDefinitionDifferentFile_Consumption.ts === -// remoteVariable = 1; -// remoteFunction(); -// var foo = new remoteClass(); -// class fooCls implements remoteInterface { } -// var fooVar = /*GOTO DEF POS*/remoteModule.foo; - - // === Details === - [ - { - "kind": "module", - "name": "remoteModule", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/getDefinitionAtPosition-shims.baseline.jsonc b/tests/baselines/reference/getDefinitionAtPosition-shims.baseline.jsonc deleted file mode 100644 index 1f4a1f978d098..0000000000000 --- a/tests/baselines/reference/getDefinitionAtPosition-shims.baseline.jsonc +++ /dev/null @@ -1,147 +0,0 @@ -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Definition.ts === -// <|var [|remoteVariable|];|> -// function remoteFunction() { } -// class remoteClass { } -// interface remoteInterface{ } -// module remoteModule{ export var foo = 1;} - -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Consumption.ts === -// /*GOTO DEF POS*/remoteVariable = 1; -// remoteFunction(); -// var foo = new remoteClass(); -// class fooCls implements remoteInterface { } -// var fooVar = remoteModule.foo; - - // === Details === - [ - { - "kind": "var", - "name": "remoteVariable", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] - - - -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Definition.ts === -// var remoteVariable; -// <|function [|remoteFunction|]() { }|> -// class remoteClass { } -// interface remoteInterface{ } -// module remoteModule{ export var foo = 1;} - -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Consumption.ts === -// remoteVariable = 1; -// /*GOTO DEF POS*/remoteFunction(); -// var foo = new remoteClass(); -// class fooCls implements remoteInterface { } -// var fooVar = remoteModule.foo; - - // === Details === - [ - { - "kind": "function", - "name": "remoteFunction", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] - - - -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Definition.ts === -// var remoteVariable; -// function remoteFunction() { } -// <|class [|remoteClass|] { }|> -// interface remoteInterface{ } -// module remoteModule{ export var foo = 1;} - -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Consumption.ts === -// remoteVariable = 1; -// remoteFunction(); -// var foo = new /*GOTO DEF POS*/remoteClass(); -// class fooCls implements remoteInterface { } -// var fooVar = remoteModule.foo; - - // === Details === - [ - { - "kind": "class", - "name": "remoteClass", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] - - - -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Definition.ts === -// var remoteVariable; -// function remoteFunction() { } -// class remoteClass { } -// <|interface [|remoteInterface|]{ }|> -// module remoteModule{ export var foo = 1;} - -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Consumption.ts === -// remoteVariable = 1; -// remoteFunction(); -// var foo = new remoteClass(); -// class fooCls implements /*GOTO DEF POS*/remoteInterface { } -// var fooVar = remoteModule.foo; - - // === Details === - [ - { - "kind": "interface", - "name": "remoteInterface", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] - - - -// === getDefinitionAtPosition === -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Definition.ts === -// var remoteVariable; -// function remoteFunction() { } -// class remoteClass { } -// interface remoteInterface{ } -// <|module [|remoteModule|]{ export var foo = 1;}|> - -// === /tests/cases/fourslash/shims/goToDefinitionDifferentFile_Consumption.ts === -// remoteVariable = 1; -// remoteFunction(); -// var foo = new remoteClass(); -// class fooCls implements remoteInterface { } -// var fooVar = /*GOTO DEF POS*/remoteModule.foo; - - // === Details === - [ - { - "kind": "module", - "name": "remoteModule", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/getEmitOutput-pp.baseline b/tests/baselines/reference/getEmitOutput-pp.baseline deleted file mode 100644 index d3e9e977f58a7..0000000000000 --- a/tests/baselines/reference/getEmitOutput-pp.baseline +++ /dev/null @@ -1,34 +0,0 @@ -EmitSkipped: false - -FileName : /tests/cases/fourslash/shims-pp/inputFile1.js -var x = 5; -var Bar = /** @class */ (function () { - function Bar() { - } - return Bar; -}()); - -FileName : /tests/cases/fourslash/shims-pp/inputFile1.d.ts -declare var x: number; -declare class Bar { - x: string; - y: number; -} - -EmitSkipped: false - -FileName : /tests/cases/fourslash/shims-pp/inputFile2.js -var x1 = "hello world"; -var Foo = /** @class */ (function () { - function Foo() { - } - return Foo; -}()); - -FileName : /tests/cases/fourslash/shims-pp/inputFile2.d.ts -declare var x1: string; -declare class Foo { - x: string; - y: number; -} - diff --git a/tests/baselines/reference/getEmitOutput.baseline b/tests/baselines/reference/getEmitOutput.baseline deleted file mode 100644 index 1b029eefd126d..0000000000000 --- a/tests/baselines/reference/getEmitOutput.baseline +++ /dev/null @@ -1,34 +0,0 @@ -EmitSkipped: false - -FileName : /tests/cases/fourslash/shims/inputFile1.js -var x = 5; -var Bar = /** @class */ (function () { - function Bar() { - } - return Bar; -}()); - -FileName : /tests/cases/fourslash/shims/inputFile1.d.ts -declare var x: number; -declare class Bar { - x: string; - y: number; -} - -EmitSkipped: false - -FileName : /tests/cases/fourslash/shims/inputFile2.js -var x1 = "hello world"; -var Foo = /** @class */ (function () { - function Foo() { - } - return Foo; -}()); - -FileName : /tests/cases/fourslash/shims/inputFile2.d.ts -declare var x1: string; -declare class Foo { - x: string; - y: number; -} - diff --git a/tests/baselines/reference/getImplementationAtPosition-pp.baseline.jsonc b/tests/baselines/reference/getImplementationAtPosition-pp.baseline.jsonc deleted file mode 100644 index 59455d0af283a..0000000000000 --- a/tests/baselines/reference/getImplementationAtPosition-pp.baseline.jsonc +++ /dev/null @@ -1,191 +0,0 @@ -// === goToImplementation === -// === /tests/cases/fourslash/shims-pp/goToImplementationDifferentFile_Implementation.ts === -// <|class [|FooImpl|] implements Foo {}|> -// -// class Bar { -// hello() {} -// } -// - -// === /tests/cases/fourslash/shims-pp/goToImplementationDifferentFile_Consumption.ts === -// interface Fo/*GOTO IMPL*/o {} -// -// var x = new Bar(); -// -// --- (line: 5) skipped --- - - // === Details === - [ - { - "displayParts": [ - { - "text": "class", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "FooImpl", - "kind": "className" - } - ], - "kind": "class" - } - ] - - - -// === goToImplementation === -// === /tests/cases/fourslash/shims-pp/goToImplementationDifferentFile_Implementation.ts === -// class FooImpl implements Foo {} -// -// <|class [|Bar|] { -// hello() {} -// }|> -// - -// === /tests/cases/fourslash/shims-pp/goToImplementationDifferentFile_Consumption.ts === -// interface Foo {} -// -// var x = new B/*GOTO IMPL*/ar(); -// -// x.hello(); -// -// --- (line: 7) skipped --- - - // === Details === - [ - { - "displayParts": [ - { - "text": "class", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Bar", - "kind": "className" - } - ], - "kind": "class" - } - ] - - - -// === goToImplementation === -// === /tests/cases/fourslash/shims-pp/goToImplementationDifferentFile_Implementation.ts === -// class FooImpl implements Foo {} -// -// class Bar { -// <|[|hello|]() {}|> -// } -// - -// === /tests/cases/fourslash/shims-pp/goToImplementationDifferentFile_Consumption.ts === -// interface Foo {} -// -// var x = new Bar(); -// -// x.hel/*GOTO IMPL*/lo(); -// -// class SomeClass { -// someMethod() { -// --- (line: 9) skipped --- - - // === Details === - [ - { - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "method", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Bar", - "kind": "className" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "hello", - "kind": "methodName" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "void", - "kind": "keyword" - } - ], - "kind": "method" - } - ] - - - -// === goToImplementation === -// === /tests/cases/fourslash/shims-pp/goToImplementationDifferentFile_Consumption.ts === -// --- (line: 3) skipped --- -// -// x.hello(); -// -// <|class [|SomeClass|] { -// someMethod() { -// thi/*GOTO IMPL*/s.someMethod(); -// } -// }|> - - // === Details === - [ - { - "displayParts": [ - { - "text": "class", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "SomeClass", - "kind": "className" - } - ], - "kind": "class" - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/getImplementationAtPosition-shims.baseline.jsonc b/tests/baselines/reference/getImplementationAtPosition-shims.baseline.jsonc deleted file mode 100644 index bdb65a3f75ced..0000000000000 --- a/tests/baselines/reference/getImplementationAtPosition-shims.baseline.jsonc +++ /dev/null @@ -1,191 +0,0 @@ -// === goToImplementation === -// === /tests/cases/fourslash/shims/goToImplementationDifferentFile_Implementation.ts === -// <|class [|FooImpl|] implements Foo {}|> -// -// class Bar { -// hello() {} -// } -// - -// === /tests/cases/fourslash/shims/goToImplementationDifferentFile_Consumption.ts === -// interface Fo/*GOTO IMPL*/o {} -// -// var x = new Bar(); -// -// --- (line: 5) skipped --- - - // === Details === - [ - { - "displayParts": [ - { - "text": "class", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "FooImpl", - "kind": "className" - } - ], - "kind": "class" - } - ] - - - -// === goToImplementation === -// === /tests/cases/fourslash/shims/goToImplementationDifferentFile_Implementation.ts === -// class FooImpl implements Foo {} -// -// <|class [|Bar|] { -// hello() {} -// }|> -// - -// === /tests/cases/fourslash/shims/goToImplementationDifferentFile_Consumption.ts === -// interface Foo {} -// -// var x = new B/*GOTO IMPL*/ar(); -// -// x.hello(); -// -// --- (line: 7) skipped --- - - // === Details === - [ - { - "displayParts": [ - { - "text": "class", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Bar", - "kind": "className" - } - ], - "kind": "class" - } - ] - - - -// === goToImplementation === -// === /tests/cases/fourslash/shims/goToImplementationDifferentFile_Implementation.ts === -// class FooImpl implements Foo {} -// -// class Bar { -// <|[|hello|]() {}|> -// } -// - -// === /tests/cases/fourslash/shims/goToImplementationDifferentFile_Consumption.ts === -// interface Foo {} -// -// var x = new Bar(); -// -// x.hel/*GOTO IMPL*/lo(); -// -// class SomeClass { -// someMethod() { -// --- (line: 9) skipped --- - - // === Details === - [ - { - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "method", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Bar", - "kind": "className" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "hello", - "kind": "methodName" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "void", - "kind": "keyword" - } - ], - "kind": "method" - } - ] - - - -// === goToImplementation === -// === /tests/cases/fourslash/shims/goToImplementationDifferentFile_Consumption.ts === -// --- (line: 3) skipped --- -// -// x.hello(); -// -// <|class [|SomeClass|] { -// someMethod() { -// thi/*GOTO IMPL*/s.someMethod(); -// } -// }|> - - // === Details === - [ - { - "displayParts": [ - { - "text": "class", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "SomeClass", - "kind": "className" - } - ], - "kind": "class" - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesAtPosition-pp.baseline.jsonc b/tests/baselines/reference/getOccurrencesAtPosition-pp.baseline.jsonc deleted file mode 100644 index 19a75f7dd9ac1..0000000000000 --- a/tests/baselines/reference/getOccurrencesAtPosition-pp.baseline.jsonc +++ /dev/null @@ -1,27 +0,0 @@ -// === documentHighlights === -// === /tests/cases/fourslash/shims-pp/getOccurrencesAtPosition-pp.ts === -// -// interface A { -// <|[|{| kind: "reference" |}foo|]: string;|> -// } -// function foo(x: A) { -// x.[|{| kind: "reference" |}f/*HIGHLIGHTS*/oo|] -// } - - - -// === customWork === -// Added new line - - - -// === documentHighlights === -// === /tests/cases/fourslash/shims-pp/getOccurrencesAtPosition-pp.ts === -// -// -// interface A { -// <|[|{| kind: "reference" |}foo|]: string;|> -// } -// function foo(x: A) { -// x.[|{| kind: "reference" |}f/*HIGHLIGHTS*/oo|] -// } \ No newline at end of file diff --git a/tests/baselines/reference/getOccurrencesAtPosition-shims.baseline.jsonc b/tests/baselines/reference/getOccurrencesAtPosition-shims.baseline.jsonc deleted file mode 100644 index a72a9b688c6d8..0000000000000 --- a/tests/baselines/reference/getOccurrencesAtPosition-shims.baseline.jsonc +++ /dev/null @@ -1,27 +0,0 @@ -// === documentHighlights === -// === /tests/cases/fourslash/shims/getOccurrencesAtPosition-shims.ts === -// -// interface A { -// <|[|{| kind: "reference" |}foo|]: string;|> -// } -// function foo(x: A) { -// x.[|{| kind: "reference" |}f/*HIGHLIGHTS*/oo|] -// } - - - -// === customWork === -// Added new line - - - -// === documentHighlights === -// === /tests/cases/fourslash/shims/getOccurrencesAtPosition-shims.ts === -// -// -// interface A { -// <|[|{| kind: "reference" |}foo|]: string;|> -// } -// function foo(x: A) { -// x.[|{| kind: "reference" |}f/*HIGHLIGHTS*/oo|] -// } \ No newline at end of file diff --git a/tests/baselines/reference/getReferencesAtPosition-pp.baseline.jsonc b/tests/baselines/reference/getReferencesAtPosition-pp.baseline.jsonc deleted file mode 100644 index a3f63d1df51eb..0000000000000 --- a/tests/baselines/reference/getReferencesAtPosition-pp.baseline.jsonc +++ /dev/null @@ -1,294 +0,0 @@ -// === findAllReferences === -// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts === -// --- (line: 3) skipped --- -// -// } -// -// /*FIND ALL REFS*/<|public [|{| isWriteAccess: true, isDefinition: true |}start|](){ -// return this; -// }|> -// -// public stop(){ -// return this; -// } -// } - -// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition.ts === -// import Second = require("./findAllRefsOnDefinition-import"); -// -// var second = new Second.Test() -// second.[|start|](); -// second.stop(); - - // === Definitions === - // === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts === - // --- (line: 3) skipped --- - // - // } - // - // /*FIND ALL REFS*/<|public [|start|](){ - // return this; - // }|> - // - // public stop(){ - // return this; - // } - // } - - // === Details === - [ - { - "containerKind": "", - "containerName": "", - "kind": "method", - "name": "(method) Test.start(): this", - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "method", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Test", - "kind": "className" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "start", - "kind": "methodName" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "this", - "kind": "keyword" - } - ] - } - ] - - - -// === findAllReferences === -// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts === -// --- (line: 3) skipped --- -// -// } -// -// <|public /*FIND ALL REFS*/[|{| isWriteAccess: true, isDefinition: true |}start|](){ -// return this; -// }|> -// -// public stop(){ -// return this; -// } -// } - -// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition.ts === -// import Second = require("./findAllRefsOnDefinition-import"); -// -// var second = new Second.Test() -// second.[|start|](); -// second.stop(); - - // === Definitions === - // === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts === - // --- (line: 3) skipped --- - // - // } - // - // <|public /*FIND ALL REFS*/[|start|](){ - // return this; - // }|> - // - // public stop(){ - // return this; - // } - // } - - // === Details === - [ - { - "containerKind": "", - "containerName": "", - "kind": "method", - "name": "(method) Test.start(): this", - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "method", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Test", - "kind": "className" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "start", - "kind": "methodName" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "this", - "kind": "keyword" - } - ] - } - ] - - - -// === findAllReferences === -// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts === -// --- (line: 3) skipped --- -// -// } -// -// <|public [|{| isWriteAccess: true |}start|](){ -// return this; -// }|> -// -// public stop(){ -// return this; -// } -// } - -// === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition.ts === -// import Second = require("./findAllRefsOnDefinition-import"); -// -// var second = new Second.Test() -// second./*FIND ALL REFS*/[|start|](); -// second.stop(); - - // === Definitions === - // === /tests/cases/fourslash/shims-pp/findAllRefsOnDefinition-import.ts === - // --- (line: 3) skipped --- - // - // } - // - // <|public [|start|](){ - // return this; - // }|> - // - // public stop(){ - // return this; - // } - // } - - // === Details === - [ - { - "containerKind": "", - "containerName": "", - "kind": "method", - "name": "(method) Test.start(): this", - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "method", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Test", - "kind": "className" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "start", - "kind": "methodName" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "this", - "kind": "keyword" - } - ] - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/getReferencesAtPosition.baseline.jsonc b/tests/baselines/reference/getReferencesAtPosition.baseline.jsonc deleted file mode 100644 index 1c54db331e01f..0000000000000 --- a/tests/baselines/reference/getReferencesAtPosition.baseline.jsonc +++ /dev/null @@ -1,294 +0,0 @@ -// === findAllReferences === -// === /tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts === -// --- (line: 3) skipped --- -// -// } -// -// /*FIND ALL REFS*/<|public [|{| isWriteAccess: true, isDefinition: true |}start|](){ -// return this; -// }|> -// -// public stop(){ -// return this; -// } -// } - -// === /tests/cases/fourslash/shims/findAllRefsOnDefinition.ts === -// import Second = require("./findAllRefsOnDefinition-import"); -// -// var second = new Second.Test() -// second.[|start|](); -// second.stop(); - - // === Definitions === - // === /tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts === - // --- (line: 3) skipped --- - // - // } - // - // /*FIND ALL REFS*/<|public [|start|](){ - // return this; - // }|> - // - // public stop(){ - // return this; - // } - // } - - // === Details === - [ - { - "containerKind": "", - "containerName": "", - "kind": "method", - "name": "(method) Test.start(): this", - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "method", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Test", - "kind": "className" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "start", - "kind": "methodName" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "this", - "kind": "keyword" - } - ] - } - ] - - - -// === findAllReferences === -// === /tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts === -// --- (line: 3) skipped --- -// -// } -// -// <|public /*FIND ALL REFS*/[|{| isWriteAccess: true, isDefinition: true |}start|](){ -// return this; -// }|> -// -// public stop(){ -// return this; -// } -// } - -// === /tests/cases/fourslash/shims/findAllRefsOnDefinition.ts === -// import Second = require("./findAllRefsOnDefinition-import"); -// -// var second = new Second.Test() -// second.[|start|](); -// second.stop(); - - // === Definitions === - // === /tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts === - // --- (line: 3) skipped --- - // - // } - // - // <|public /*FIND ALL REFS*/[|start|](){ - // return this; - // }|> - // - // public stop(){ - // return this; - // } - // } - - // === Details === - [ - { - "containerKind": "", - "containerName": "", - "kind": "method", - "name": "(method) Test.start(): this", - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "method", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Test", - "kind": "className" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "start", - "kind": "methodName" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "this", - "kind": "keyword" - } - ] - } - ] - - - -// === findAllReferences === -// === /tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts === -// --- (line: 3) skipped --- -// -// } -// -// <|public [|{| isWriteAccess: true |}start|](){ -// return this; -// }|> -// -// public stop(){ -// return this; -// } -// } - -// === /tests/cases/fourslash/shims/findAllRefsOnDefinition.ts === -// import Second = require("./findAllRefsOnDefinition-import"); -// -// var second = new Second.Test() -// second./*FIND ALL REFS*/[|start|](); -// second.stop(); - - // === Definitions === - // === /tests/cases/fourslash/shims/findAllRefsOnDefinition-import.ts === - // --- (line: 3) skipped --- - // - // } - // - // <|public [|start|](){ - // return this; - // }|> - // - // public stop(){ - // return this; - // } - // } - - // === Details === - [ - { - "containerKind": "", - "containerName": "", - "kind": "method", - "name": "(method) Test.start(): this", - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "method", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "Test", - "kind": "className" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "start", - "kind": "methodName" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "this", - "kind": "keyword" - } - ] - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/getRenameInfo-pp.baseline.jsonc b/tests/baselines/reference/getRenameInfo-pp.baseline.jsonc deleted file mode 100644 index ecfaaef8a8bfd..0000000000000 --- a/tests/baselines/reference/getRenameInfo-pp.baseline.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -// === findRenameLocations === -// === /tests/cases/fourslash/shims-pp/getRenameInfo-pp.ts === -// /// -// <|function /*RENAME*/[|BarRENAME|]() { -// // This is a reference to Bar in a comment. -// "this is a reference to Bar in a string" -// }|> \ No newline at end of file diff --git a/tests/baselines/reference/getRenameInfo-shims.baseline.jsonc b/tests/baselines/reference/getRenameInfo-shims.baseline.jsonc deleted file mode 100644 index 2da08f3bb4257..0000000000000 --- a/tests/baselines/reference/getRenameInfo-shims.baseline.jsonc +++ /dev/null @@ -1,7 +0,0 @@ -// === findRenameLocations === -// === /tests/cases/fourslash/shims/getRenameInfo-shims.ts === -// /// -// <|function /*RENAME*/[|BarRENAME|]() { -// // This is a reference to Bar in a comment. -// "this is a reference to Bar in a string" -// }|> \ No newline at end of file diff --git a/tests/baselines/reference/goToDefinitionTypeReferenceDirective-pp.baseline.jsonc b/tests/baselines/reference/goToDefinitionTypeReferenceDirective-pp.baseline.jsonc deleted file mode 100644 index 9415d35b6d799..0000000000000 --- a/tests/baselines/reference/goToDefinitionTypeReferenceDirective-pp.baseline.jsonc +++ /dev/null @@ -1,16 +0,0 @@ -// === goToDefinition === -// === /tests/cases/fourslash/shims-pp/src/types/lib/index.d.ts === -// [||]declare let $: {x: number}; - -// === /tests/cases/fourslash/shims-pp/src/app.ts === -// /// -// $.x; - - // === Details === - [ - { - "kind": "script", - "name": "lib", - "unverified": false - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/goToDefinitionTypeReferenceDirective-shims.baseline.jsonc b/tests/baselines/reference/goToDefinitionTypeReferenceDirective-shims.baseline.jsonc deleted file mode 100644 index b3b6049069ff2..0000000000000 --- a/tests/baselines/reference/goToDefinitionTypeReferenceDirective-shims.baseline.jsonc +++ /dev/null @@ -1,16 +0,0 @@ -// === goToDefinition === -// === /tests/cases/fourslash/shims/src/types/lib/index.d.ts === -// [||]declare let $: {x: number}; - -// === /tests/cases/fourslash/shims/src/app.ts === -// /// -// $.x; - - // === Details === - [ - { - "kind": "script", - "name": "lib", - "unverified": false - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/goToTypeDefinition-pp.baseline.jsonc b/tests/baselines/reference/goToTypeDefinition-pp.baseline.jsonc deleted file mode 100644 index b4c683f5e2651..0000000000000 --- a/tests/baselines/reference/goToTypeDefinition-pp.baseline.jsonc +++ /dev/null @@ -1,44 +0,0 @@ -// === goToType === -// === /tests/cases/fourslash/shims-pp/goToTypeDefinition_Definition.ts === -// <|class [|C|] { -// p; -// }|> -// var c: C; - -// === /tests/cases/fourslash/shims-pp/goToTypeDefinition_Consumption.ts === -// /*GOTO TYPE*/c = undefined; - - // === Details === - [ - { - "kind": "class", - "name": "C", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] - - - -// === goToType === -// === /tests/cases/fourslash/shims-pp/goToTypeDefinition_Definition.ts === -// <|class /*GOTO TYPE*/[|C|] { -// p; -// }|> -// var c: C; - - // === Details === - [ - { - "kind": "class", - "name": "C", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/goToTypeDefinition-shims.baseline.jsonc b/tests/baselines/reference/goToTypeDefinition-shims.baseline.jsonc deleted file mode 100644 index e588cb1dfb4dc..0000000000000 --- a/tests/baselines/reference/goToTypeDefinition-shims.baseline.jsonc +++ /dev/null @@ -1,22 +0,0 @@ -// === goToType === -// === /tests/cases/fourslash/shims/goToTypeDefinition_Definition.ts === -// <|class [|C|] { -// p; -// }|> -// var c: C; - -// === /tests/cases/fourslash/shims/goToTypeDefinition_Consumption.ts === -// /*GOTO TYPE*/c = undefined; - - // === Details === - [ - { - "kind": "class", - "name": "C", - "containerName": "", - "isLocal": false, - "isAmbient": false, - "unverified": false, - "failedAliasResolution": false - } - ] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline deleted file mode 100644 index b2b3b2d73cfd2..0000000000000 --- a/tests/baselines/reference/quickInfoDisplayPartsVar.shims-pp.baseline +++ /dev/null @@ -1,1208 +0,0 @@ -=== /tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts === -// var a = 10; -// ^ -// | ---------------------------------------------------------------------- -// | var a: number -// | ---------------------------------------------------------------------- -// function foo() { -// var b = a; -// ^ -// | ---------------------------------------------------------------------- -// | (local var) b: number -// | ---------------------------------------------------------------------- -// ^ -// | ---------------------------------------------------------------------- -// | var a: number -// | ---------------------------------------------------------------------- -// } -// module m { -// var c = 10; -// ^ -// | ---------------------------------------------------------------------- -// | var c: number -// | ---------------------------------------------------------------------- -// export var d = 10; -// ^ -// | ---------------------------------------------------------------------- -// | var m.d: number -// | ---------------------------------------------------------------------- -// } -// var f: () => number; -// ^ -// | ---------------------------------------------------------------------- -// | var f: () => number -// | ---------------------------------------------------------------------- -// var g = f; -// ^ -// | ---------------------------------------------------------------------- -// | var g: () => number -// | ---------------------------------------------------------------------- -// ^ -// | ---------------------------------------------------------------------- -// | var f: () => number -// | ---------------------------------------------------------------------- -// f(); -// ^ -// | ---------------------------------------------------------------------- -// | var f: () => number -// | ---------------------------------------------------------------------- -// var h: { (a: string): number; (a: number): string; }; -// ^ -// | ---------------------------------------------------------------------- -// | var h: { -// | (a: string): number; -// | (a: number): string; -// | } -// | ---------------------------------------------------------------------- -// var i = h; -// ^ -// | ---------------------------------------------------------------------- -// | var i: { -// | (a: string): number; -// | (a: number): string; -// | } -// | ---------------------------------------------------------------------- -// ^ -// | ---------------------------------------------------------------------- -// | var h: { -// | (a: string): number; -// | (a: number): string; -// | } -// | ---------------------------------------------------------------------- -// h(10); -// ^ -// | ---------------------------------------------------------------------- -// | var h: (a: number) => string (+1 overload) -// | ---------------------------------------------------------------------- -// h("hello"); -// ^ -// | ---------------------------------------------------------------------- -// | var h: (a: string) => number (+1 overload) -// | ---------------------------------------------------------------------- - -[ - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 4, - "name": "1" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 4, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "a", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 37, - "name": "2" - }, - "item": { - "kind": "local var", - "kindModifiers": "", - "textSpan": { - "start": 37, - "length": 1 - }, - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "local var", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "b", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 41, - "name": "3" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 41, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "a", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 65, - "name": "4" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 65, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "c", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 88, - "name": "5" - }, - "item": { - "kind": "var", - "kindModifiers": "export", - "textSpan": { - "start": 88, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "m", - "kind": "moduleName" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "d", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 102, - "name": "6" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 102, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "f", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 123, - "name": "7" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 123, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "g", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 127, - "name": "8" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 127, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "f", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 130, - "name": "9" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 130, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "f", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 139, - "name": "10" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 139, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "h", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "{", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "}", - "kind": "punctuation" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 193, - "name": "11" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 193, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "i", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "{", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "}", - "kind": "punctuation" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 197, - "name": "12" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 197, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "h", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "{", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "}", - "kind": "punctuation" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 200, - "name": "13" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 200, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "h", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "+", - "kind": "operator" - }, - { - "text": "1", - "kind": "numericLiteral" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "overload", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts", - "position": 207, - "name": "14" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 207, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "h", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "+", - "kind": "operator" - }, - { - "text": "1", - "kind": "numericLiteral" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "overload", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - } - ], - "documentation": [] - } - } -] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline b/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline deleted file mode 100644 index de5dcc200f778..0000000000000 --- a/tests/baselines/reference/quickInfoDisplayPartsVar.shims.baseline +++ /dev/null @@ -1,1208 +0,0 @@ -=== /tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts === -// var a = 10; -// ^ -// | ---------------------------------------------------------------------- -// | var a: number -// | ---------------------------------------------------------------------- -// function foo() { -// var b = a; -// ^ -// | ---------------------------------------------------------------------- -// | (local var) b: number -// | ---------------------------------------------------------------------- -// ^ -// | ---------------------------------------------------------------------- -// | var a: number -// | ---------------------------------------------------------------------- -// } -// module m { -// var c = 10; -// ^ -// | ---------------------------------------------------------------------- -// | var c: number -// | ---------------------------------------------------------------------- -// export var d = 10; -// ^ -// | ---------------------------------------------------------------------- -// | var m.d: number -// | ---------------------------------------------------------------------- -// } -// var f: () => number; -// ^ -// | ---------------------------------------------------------------------- -// | var f: () => number -// | ---------------------------------------------------------------------- -// var g = f; -// ^ -// | ---------------------------------------------------------------------- -// | var g: () => number -// | ---------------------------------------------------------------------- -// ^ -// | ---------------------------------------------------------------------- -// | var f: () => number -// | ---------------------------------------------------------------------- -// f(); -// ^ -// | ---------------------------------------------------------------------- -// | var f: () => number -// | ---------------------------------------------------------------------- -// var h: { (a: string): number; (a: number): string; }; -// ^ -// | ---------------------------------------------------------------------- -// | var h: { -// | (a: string): number; -// | (a: number): string; -// | } -// | ---------------------------------------------------------------------- -// var i = h; -// ^ -// | ---------------------------------------------------------------------- -// | var i: { -// | (a: string): number; -// | (a: number): string; -// | } -// | ---------------------------------------------------------------------- -// ^ -// | ---------------------------------------------------------------------- -// | var h: { -// | (a: string): number; -// | (a: number): string; -// | } -// | ---------------------------------------------------------------------- -// h(10); -// ^ -// | ---------------------------------------------------------------------- -// | var h: (a: number) => string (+1 overload) -// | ---------------------------------------------------------------------- -// h("hello"); -// ^ -// | ---------------------------------------------------------------------- -// | var h: (a: string) => number (+1 overload) -// | ---------------------------------------------------------------------- - -[ - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 4, - "name": "1" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 4, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "a", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 37, - "name": "2" - }, - "item": { - "kind": "local var", - "kindModifiers": "", - "textSpan": { - "start": 37, - "length": 1 - }, - "displayParts": [ - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "local var", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "b", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 41, - "name": "3" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 41, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "a", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 65, - "name": "4" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 65, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "c", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 88, - "name": "5" - }, - "item": { - "kind": "var", - "kindModifiers": "export", - "textSpan": { - "start": 88, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "m", - "kind": "moduleName" - }, - { - "text": ".", - "kind": "punctuation" - }, - { - "text": "d", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 102, - "name": "6" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 102, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "f", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 123, - "name": "7" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 123, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "g", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 127, - "name": "8" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 127, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "f", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 130, - "name": "9" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 130, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "f", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 139, - "name": "10" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 139, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "h", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "{", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "}", - "kind": "punctuation" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 193, - "name": "11" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 193, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "i", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "{", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "}", - "kind": "punctuation" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 197, - "name": "12" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 197, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "h", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "{", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ";", - "kind": "punctuation" - }, - { - "text": "\n", - "kind": "lineBreak" - }, - { - "text": "}", - "kind": "punctuation" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 200, - "name": "13" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 200, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "h", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "+", - "kind": "operator" - }, - { - "text": "1", - "kind": "numericLiteral" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "overload", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - } - ], - "documentation": [] - } - }, - { - "marker": { - "fileName": "/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts", - "position": 207, - "name": "14" - }, - "item": { - "kind": "var", - "kindModifiers": "", - "textSpan": { - "start": 207, - "length": 1 - }, - "displayParts": [ - { - "text": "var", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "h", - "kind": "localName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "a", - "kind": "parameterName" - }, - { - "text": ":", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "string", - "kind": "keyword" - }, - { - "text": ")", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "=>", - "kind": "punctuation" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "number", - "kind": "keyword" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "(", - "kind": "punctuation" - }, - { - "text": "+", - "kind": "operator" - }, - { - "text": "1", - "kind": "numericLiteral" - }, - { - "text": " ", - "kind": "space" - }, - { - "text": "overload", - "kind": "text" - }, - { - "text": ")", - "kind": "punctuation" - } - ], - "documentation": [] - } - } -] \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getBraceMatchingAtPosition.ts b/tests/cases/fourslash/shims-pp/getBraceMatchingAtPosition.ts deleted file mode 100644 index a41f6e2e31ac2..0000000000000 --- a/tests/cases/fourslash/shims-pp/getBraceMatchingAtPosition.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// - -//////curly braces -////module Foo [|{ -//// class Bar [|{ -//// private f() [|{ -//// }|] -//// -//// private f2() [|{ -//// if (true) [|{ }|] [|{ }|]; -//// }|] -//// }|] -////}|] -//// -//////parenthesis -////class FooBar { -//// private f[|()|] { -//// return [|([|(1 + 1)|])|]; -//// } -//// -//// private f2[|()|] { -//// if [|(true)|] { } -//// } -////} -//// -//////square brackets -////class Baz { -//// private f() { -//// var a: any[|[]|] = [|[[|[1, 2]|], [|[3, 4]|], 5]|]; -//// } -////} -//// -////// angular brackets -////class TemplateTest [||] { -//// public foo(a, b) { -//// return [||] a; -//// } -////} - -for (const range of test.ranges()) { - verify.matchingBracePositionInCurrentFile(range.pos, range.end - 1); - verify.matchingBracePositionInCurrentFile(range.end - 1, range.pos); -} diff --git a/tests/cases/fourslash/shims-pp/getBreakpointStatementAtPosition.ts b/tests/cases/fourslash/shims-pp/getBreakpointStatementAtPosition.ts deleted file mode 100644 index 9e1d075a17ff5..0000000000000 --- a/tests/cases/fourslash/shims-pp/getBreakpointStatementAtPosition.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -// @BaselineFile: getBreakpointStatementAtPosition.baseline -// @Filename: getBreakpointStatementAtPosition.ts -////while (true) { -//// break; -////} -////y: while (true) { -//// break y; -////} -////while (true) { -//// continue; -////} -////z: while (true) { -//// continue z; -////} -verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts b/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts deleted file mode 100644 index 527c0d0b6cab9..0000000000000 --- a/tests/cases/fourslash/shims-pp/getCompletionsAtPosition.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -////function foo(strOrNum: string | number) { -//// /*1*/ -//// if (typeof strOrNum === "number") { -//// strOrNum/*2*/; -//// } -//// else { -//// strOrNum/*3*/; -//// } -////} - -verify.completions( - { marker: "1", includes: { name: "strOrNum", text: "(parameter) strOrNum: string | number" } }, - { marker: "2", includes: { name: "strOrNum", text: "(parameter) strOrNum: number" } }, - { marker: "3", includes: { name: "strOrNum", text: "(parameter) strOrNum: string" } }, -); diff --git a/tests/cases/fourslash/shims-pp/getDefinitionAtPosition-pp.ts b/tests/cases/fourslash/shims-pp/getDefinitionAtPosition-pp.ts deleted file mode 100644 index 16179d873cdc4..0000000000000 --- a/tests/cases/fourslash/shims-pp/getDefinitionAtPosition-pp.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -// @Filename: goToDefinitionDifferentFile_Definition.ts -////var /*remoteVariableDefinition*/remoteVariable; -////function /*remoteFunctionDefinition*/remoteFunction() { } -////class /*remoteClassDefinition*/remoteClass { } -////interface /*remoteInterfaceDefinition*/remoteInterface{ } -////module /*remoteModuleDefinition*/remoteModule{ export var foo = 1;} - -// @Filename: goToDefinitionDifferentFile_Consumption.ts -/////*remoteVariableReference*/remoteVariable = 1; -/////*remoteFunctionReference*/remoteFunction(); -////var foo = new /*remoteClassReference*/remoteClass(); -////class fooCls implements /*remoteInterfaceReference*/remoteInterface { } -////var fooVar = /*remoteModuleReference*/remoteModule.foo; - -verify.baselineGetDefinitionAtPosition("remoteVariableReference", "remoteFunctionReference", "remoteClassReference", "remoteInterfaceReference", "remoteModuleReference"); diff --git a/tests/cases/fourslash/shims-pp/getEmitOutput.ts b/tests/cases/fourslash/shims-pp/getEmitOutput.ts deleted file mode 100644 index 45679066278c0..0000000000000 --- a/tests/cases/fourslash/shims-pp/getEmitOutput.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -// @BaselineFile: getEmitOutput-pp.baseline -// @declaration: true - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// var x: number = 5; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var x1: string = "hello world"; -//// class Foo{ -//// x : string; -//// y : number; -//// } - -verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getImplementationAtPosition-pp.ts b/tests/cases/fourslash/shims-pp/getImplementationAtPosition-pp.ts deleted file mode 100644 index b555cc882682e..0000000000000 --- a/tests/cases/fourslash/shims-pp/getImplementationAtPosition-pp.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -// @Filename: goToImplementationDifferentFile_Implementation.ts -//// class /*fooClassImplementation*/FooImpl implements Foo {} -//// -//// class /*barClassImplementation*/Bar { -//// /*barHelloFunctionImplementation*/hello() {} -//// } -//// - -// @Filename: goToImplementationDifferentFile_Consumption.ts -//// interface Fo/*fooClassReference*/o {} -//// -//// var x = new B/*barClassReference*/ar(); -//// -//// x.hel/*barHelloFunctionReference*/lo(); -//// -//// class /*thisImplementation*/SomeClass { -//// someMethod() { -//// thi/*thisReference*/s.someMethod(); -//// } -//// } - -verify.baselineGoToImplementation("fooClassReference", "barClassReference", "barHelloFunctionReference", "thisReference"); diff --git a/tests/cases/fourslash/shims-pp/getIndentationAtPosition.ts b/tests/cases/fourslash/shims-pp/getIndentationAtPosition.ts deleted file mode 100644 index ba2936bd70223..0000000000000 --- a/tests/cases/fourslash/shims-pp/getIndentationAtPosition.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -////class Bar { -//// {| "indentation": 4|} -//// private foo: string = ""; -//// {| "indentation": 4|} -//// private f() { -//// var a: any[] = [[1, 2], [3, 4], 5]; -//// {| "indentation": 8|} -//// return ((1 + 1)); -//// } -//// {| "indentation": 4|} -//// private f2() { -//// if (true) { } { }; -//// } -////} -////{| "indentation": 0|} - -test.markers().forEach((marker) => { - verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); -}); diff --git a/tests/cases/fourslash/shims-pp/getNavigateToItems.ts b/tests/cases/fourslash/shims-pp/getNavigateToItems.ts deleted file mode 100644 index 0ffbf983ff1ed..0000000000000 --- a/tests/cases/fourslash/shims-pp/getNavigateToItems.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -/////// Module -////[|{| "name": "Shapes", "kind": "module" |}module Shapes { -//// -//// // Class -//// [|{| "name": "Point", "kind": "class", "kindModifiers": "export", "containerName": "Shapes", "containerKind": "module" |}export class Point { -//// // Instance member -//// [|{| "name": "origin", "kind": "property", "kindModifiers": "private", "containerName": "Point", "containerKind": "class" |}private origin = 0.0;|] -//// -//// [|{| "name": "distFromZero", "kind": "property", "kindModifiers": "private", "containerName": "Point", "containerKind": "class" |}private distFromZero = 0.0;|] -//// -//// // Getter -//// [|{| "name": "distance", "kind": "getter", "containerName": "Point", "containerKind": "class" |}get distance(): number { return 0; }|] -//// }|] -////}|] -//// -////// Local variables -////var [|{| "name": "xyz", "kind": "var" |}xyz = new Shapes.Point()|]; - -for (const range of test.ranges()) { - verify.navigateTo({ - pattern: range.marker.data.name, - expected: [{ ...range.marker.data, range }], - }); -} diff --git a/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts b/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts deleted file mode 100644 index 627d4dac178f5..0000000000000 --- a/tests/cases/fourslash/shims-pp/getNavigationBarItems.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// - -//// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0; - -verify.navigationTree({ - "text": "", - "kind": "script", - "childItems": [ - { - "text": "c", - "kind": "const" - } - ] -}) - -verify.navigationBar([ - { - "text": "", - "kind": "script", - "childItems": [ - { - "text": "c", - "kind": "const" - } - ] - } -]); diff --git a/tests/cases/fourslash/shims-pp/getOccurrencesAtPosition-pp.ts b/tests/cases/fourslash/shims-pp/getOccurrencesAtPosition-pp.ts deleted file mode 100644 index 80f65974fce01..0000000000000 --- a/tests/cases/fourslash/shims-pp/getOccurrencesAtPosition-pp.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -/////*0*/ -////interface A { -//// foo: string; -////} -////function foo(x: A) { -//// x.f/*1*/oo -////} - -verify.baselineCommands( - { type: "documentHighlights", markerOrRange: "1" }, - { - type: "customWork", - work: () => { - goTo.marker("0"); - edit.insert("\n"); - return "Added new line"; - }, - }, - { type: "documentHighlights", markerOrRange: "1" }, -); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/getOutliningSpans.ts b/tests/cases/fourslash/shims-pp/getOutliningSpans.ts deleted file mode 100644 index 849d7bcf8b922..0000000000000 --- a/tests/cases/fourslash/shims-pp/getOutliningSpans.ts +++ /dev/null @@ -1,100 +0,0 @@ -/// - -////// interface -////interface IFoo[| { -//// getDist(): number; -////}|] -//// -////// class members -////class Foo[| { -//// constructor()[| { -//// }|] -//// -//// public foo(): number[| { -//// return 0; -//// }|] -//// -//// public get X()[| { -//// return 1; -//// }|] -//// -//// public set X(v: number)[| { -//// }|] -//// -//// public member = function f()[| { -//// -//// }|] -////}|] -////switch(1)[| { -//// case 1:[| break;|] -////}|] -//// -////var array =[| [ -//// 1, -//// 2 -////]|] -//// -////// modules -////module m1[| { -//// module m2[| { }|] -//// module m3[| { -//// function foo()[| { -//// -//// }|] -//// -//// interface IFoo2[| { -//// -//// }|] -//// -//// class foo2 implements IFoo2[| { -//// -//// }|] -//// }|] -////}|] -//// -////// function declaration -////function foo(): number[| { -//// return 0; -////}|] -//// -////// function expressions -////[|(function f()[| { -//// -////}|])|] -//// -////// trivia handeling -////class ClassFooWithTrivia[| /* some comments */ -//// /* more trivia */ { -//// -//// -//// /*some trailing trivia */ -////}|] /* even more */ -//// -////// object literals -////var x =[|{ -//// a:1, -//// b:2, -//// get foo()[| { -//// return 1; -//// }|] -////}|] -//////outline with deep nesting -////var nest =[| [[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[ -//// [|[ -//// [ -//// [ -//// [ -//// [ -//// 1,2,3 -//// ] -//// ] -//// ] -//// ] -//// ]|] -////]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]; -//// -//////outline after a deeply nested node -////class AfterNestedNodes[| { -////}|] - -verify.outliningSpansInCurrentFile(test.ranges(), "code"); diff --git a/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts b/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts deleted file mode 100644 index a33a6c9a470ce..0000000000000 --- a/tests/cases/fourslash/shims-pp/getPreProcessedFile.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// -// @ModuleResolution: classic - -// @Filename: refFile1.ts -//// class D { } - -// @Filename: refFile2.ts -//// export class E {} - -// @Filename: main.ts -// @ResolveReference: true -//// /// -//// /// -//// /*3*/////*4*/ -//// import ref2 = require("refFile2"); -//// import noExistref2 = require(/*5*/"NotExistRefFile2"/*6*/); -//// import invalidRef1 /*7*/require/*8*/("refFile2"); -//// import invalidRef2 = /*9*/requi/*10*/(/*10A*/"refFile2"); -//// var obj: /*11*/C/*12*/; -//// var obj1: D; -//// var obj2: ref2.E; - -goTo.file("main.ts"); -verify.numberOfErrorsInCurrentFile(7); -verify.errorExistsBetweenMarkers("1", "2"); -verify.errorExistsBetweenMarkers("3", "4"); -verify.errorExistsBetweenMarkers("5", "6"); -verify.errorExistsBetweenMarkers("7", "8"); -verify.errorExistsBetweenMarkers("9", "10"); -verify.errorExistsBetweenMarkers("10", "10A"); -verify.errorExistsBetweenMarkers("11", "12"); diff --git a/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts b/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts deleted file mode 100644 index efb49eb58c4e5..0000000000000 --- a/tests/cases/fourslash/shims-pp/getQuickInfoAtPosition.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -////class SS{} -//// -////var x/*1*/1 = new SS(); -////var x/*2*/2 = new SS(); -////var x/*3*/3 = new SS; - -verify.quickInfos({ - 1: "var x1: SS", - 2: "var x2: SS", - 3: "var x3: SS" -}); diff --git a/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts b/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts deleted file mode 100644 index debd0c793bc22..0000000000000 --- a/tests/cases/fourslash/shims-pp/getReferencesAtPosition.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// - -//@BaselineFile: getReferencesAtPosition-pp.baseline.jsonc -//@Filename: findAllRefsOnDefinition-import.ts -////export class Test{ -//// -//// constructor(){ -//// -//// } -//// -//// /*1*/public /*2*/start(){ -//// return this; -//// } -//// -//// public stop(){ -//// return this; -//// } -////} - -//@Filename: findAllRefsOnDefinition.ts -////import Second = require("./findAllRefsOnDefinition-import"); -//// -////var second = new Second.Test() -////second./*3*/start(); -////second.stop(); - -verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/shims-pp/getRenameInfo-pp.ts b/tests/cases/fourslash/shims-pp/getRenameInfo-pp.ts deleted file mode 100644 index 42c60bb4dc2ad..0000000000000 --- a/tests/cases/fourslash/shims-pp/getRenameInfo-pp.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -/////// - -////[|function [|{| "contextRangeIndex": 0 |}Bar|]() { -//// // This is a reference to Bar in a comment. -//// "this is a reference to Bar in a string" -////}|] - -verify.baselineRenameAtRangesWithText("Bar"); diff --git a/tests/cases/fourslash/shims-pp/getSemanticClassifications.ts b/tests/cases/fourslash/shims-pp/getSemanticClassifications.ts deleted file mode 100644 index 1bbc4eec21a3e..0000000000000 --- a/tests/cases/fourslash/shims-pp/getSemanticClassifications.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -//// module /*0*/M { -//// export interface /*1*/I { -//// } -//// } -//// interface /*2*/X extends /*3*/M./*4*/I { } - -const c = classification("original"); -verify.semanticClassificationsAre("original", - c.moduleName("M", test.marker("0").position), - c.interfaceName("I", test.marker("1").position), - c.interfaceName("X", test.marker("2").position), - c.moduleName("M", test.marker("3").position), - c.interfaceName("I", test.marker("4").position)); diff --git a/tests/cases/fourslash/shims-pp/getSemanticDiagnostics.ts b/tests/cases/fourslash/shims-pp/getSemanticDiagnostics.ts deleted file mode 100644 index 72739c665be62..0000000000000 --- a/tests/cases/fourslash/shims-pp/getSemanticDiagnostics.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -// @module: CommonJS -// @declaration: true -//// export function /*1*/foo/*2*/() { -//// interface privateInterface {} -//// class Bar implements privateInterface { private a; } -//// return Bar; -//// } - -verify.errorExistsBetweenMarkers("1", "2"); -verify.numberOfErrorsInCurrentFile(1); - - diff --git a/tests/cases/fourslash/shims-pp/getSignatureHelpItems.ts b/tests/cases/fourslash/shims-pp/getSignatureHelpItems.ts deleted file mode 100644 index 672e9069a42c5..0000000000000 --- a/tests/cases/fourslash/shims-pp/getSignatureHelpItems.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file0.ts -////declare function fn(x: string, y: number); - -// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file1.ts -////declare function fn(x: string); - -// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file2.ts -////fn(/*1*/ - -verify.signatureHelp({ marker: "1", overloadsCount: 2 }); diff --git a/tests/cases/fourslash/shims-pp/getSyntacticClassifications.ts b/tests/cases/fourslash/shims-pp/getSyntacticClassifications.ts deleted file mode 100644 index 897d42cbea729..0000000000000 --- a/tests/cases/fourslash/shims-pp/getSyntacticClassifications.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -//// // comment -//// module M { -//// var v = 0 + 1; -//// var s = "string"; -//// -//// class C { -//// } -//// -//// enum E { -//// } -//// -//// interface I { -//// } -//// -//// module M1.M2 { -//// } -//// } - -const c = classification("original"); -verify.syntacticClassificationsAre( - c.comment("// comment"), - c.keyword("module"), c.moduleName("M"), c.punctuation("{"), - c.keyword("var"), c.identifier("v"), c.operator("="), c.numericLiteral("0"), c.operator("+"), c.numericLiteral("1"), c.punctuation(";"), - c.keyword("var"), c.identifier("s"), c.operator("="), c.stringLiteral('"string"'), c.punctuation(";"), - c.keyword("class"), c.className("C"), c.punctuation("<"), c.typeParameterName("T"), c.punctuation(">"), c.punctuation("{"), - c.punctuation("}"), - c.keyword("enum"), c.enumName("E"), c.punctuation("{"), - c.punctuation("}"), - c.keyword("interface"), c.interfaceName("I"), c.punctuation("{"), - c.punctuation("}"), - c.keyword("module"), c.moduleName("M1"), c.punctuation("."), c.moduleName("M2"), c.punctuation("{"), - c.punctuation("}"), - c.punctuation("}")); diff --git a/tests/cases/fourslash/shims-pp/getTodoComments.ts b/tests/cases/fourslash/shims-pp/getTodoComments.ts deleted file mode 100644 index b1e0086b93f7b..0000000000000 --- a/tests/cases/fourslash/shims-pp/getTodoComments.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// // [|TODO|] - -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective-pp.ts b/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective-pp.ts deleted file mode 100644 index 78be01520219f..0000000000000 --- a/tests/cases/fourslash/shims-pp/goToDefinitionTypeReferenceDirective-pp.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -// @typeRoots: src/types -// @Filename: src/types/lib/index.d.ts -/////*0*/declare let $: {x: number}; - -// @Filename: src/app.ts -//// /// -//// $.x; - -verify.baselineGoToDefinition("1"); diff --git a/tests/cases/fourslash/shims-pp/goToTypeDefinition-pp.ts b/tests/cases/fourslash/shims-pp/goToTypeDefinition-pp.ts deleted file mode 100644 index bef31e039a17a..0000000000000 --- a/tests/cases/fourslash/shims-pp/goToTypeDefinition-pp.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -// @Filename: goToTypeDefinition_Definition.ts -////class /*definition*/C { -//// p; -////} -////var c: C; - -// @Filename: goToTypeDefinition_Consumption.ts -/////*reference*/c = undefined; - -verify.baselineGoToType("reference", "definition"); diff --git a/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts b/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts deleted file mode 100644 index ce87a5e2f823e..0000000000000 --- a/tests/cases/fourslash/shims-pp/quickInfoDisplayPartsVarShims.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -// @BaselineFile: quickInfoDisplayPartsVar.shims-pp.baseline - -////var /*1*/a = 10; -////function foo() { -//// var /*2*/b = /*3*/a; -////} -////module m { -//// var /*4*/c = 10; -//// export var /*5*/d = 10; -////} -////var /*6*/f: () => number; -////var /*7*/g = /*8*/f; -/////*9*/f(); -////var /*10*/h: { (a: string): number; (a: number): string; }; -////var /*11*/i = /*12*/h; -/////*13*/h(10); -/////*14*/h("hello"); - -verify.baselineQuickInfo(); \ No newline at end of file diff --git a/tests/cases/fourslash/shims/getBraceMatchingAtPosition.ts b/tests/cases/fourslash/shims/getBraceMatchingAtPosition.ts deleted file mode 100644 index a41f6e2e31ac2..0000000000000 --- a/tests/cases/fourslash/shims/getBraceMatchingAtPosition.ts +++ /dev/null @@ -1,43 +0,0 @@ -/// - -//////curly braces -////module Foo [|{ -//// class Bar [|{ -//// private f() [|{ -//// }|] -//// -//// private f2() [|{ -//// if (true) [|{ }|] [|{ }|]; -//// }|] -//// }|] -////}|] -//// -//////parenthesis -////class FooBar { -//// private f[|()|] { -//// return [|([|(1 + 1)|])|]; -//// } -//// -//// private f2[|()|] { -//// if [|(true)|] { } -//// } -////} -//// -//////square brackets -////class Baz { -//// private f() { -//// var a: any[|[]|] = [|[[|[1, 2]|], [|[3, 4]|], 5]|]; -//// } -////} -//// -////// angular brackets -////class TemplateTest [||] { -//// public foo(a, b) { -//// return [||] a; -//// } -////} - -for (const range of test.ranges()) { - verify.matchingBracePositionInCurrentFile(range.pos, range.end - 1); - verify.matchingBracePositionInCurrentFile(range.end - 1, range.pos); -} diff --git a/tests/cases/fourslash/shims/getBreakpointStatementAtPosition.ts b/tests/cases/fourslash/shims/getBreakpointStatementAtPosition.ts deleted file mode 100644 index 9e1d075a17ff5..0000000000000 --- a/tests/cases/fourslash/shims/getBreakpointStatementAtPosition.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -// @BaselineFile: getBreakpointStatementAtPosition.baseline -// @Filename: getBreakpointStatementAtPosition.ts -////while (true) { -//// break; -////} -////y: while (true) { -//// break y; -////} -////while (true) { -//// continue; -////} -////z: while (true) { -//// continue z; -////} -verify.baselineCurrentFileBreakpointLocations(); \ No newline at end of file diff --git a/tests/cases/fourslash/shims/getCompletionsAtPosition.ts b/tests/cases/fourslash/shims/getCompletionsAtPosition.ts deleted file mode 100644 index 527c0d0b6cab9..0000000000000 --- a/tests/cases/fourslash/shims/getCompletionsAtPosition.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -////function foo(strOrNum: string | number) { -//// /*1*/ -//// if (typeof strOrNum === "number") { -//// strOrNum/*2*/; -//// } -//// else { -//// strOrNum/*3*/; -//// } -////} - -verify.completions( - { marker: "1", includes: { name: "strOrNum", text: "(parameter) strOrNum: string | number" } }, - { marker: "2", includes: { name: "strOrNum", text: "(parameter) strOrNum: number" } }, - { marker: "3", includes: { name: "strOrNum", text: "(parameter) strOrNum: string" } }, -); diff --git a/tests/cases/fourslash/shims/getDefinitionAtPosition-shims.ts b/tests/cases/fourslash/shims/getDefinitionAtPosition-shims.ts deleted file mode 100644 index 16179d873cdc4..0000000000000 --- a/tests/cases/fourslash/shims/getDefinitionAtPosition-shims.ts +++ /dev/null @@ -1,17 +0,0 @@ -/// - -// @Filename: goToDefinitionDifferentFile_Definition.ts -////var /*remoteVariableDefinition*/remoteVariable; -////function /*remoteFunctionDefinition*/remoteFunction() { } -////class /*remoteClassDefinition*/remoteClass { } -////interface /*remoteInterfaceDefinition*/remoteInterface{ } -////module /*remoteModuleDefinition*/remoteModule{ export var foo = 1;} - -// @Filename: goToDefinitionDifferentFile_Consumption.ts -/////*remoteVariableReference*/remoteVariable = 1; -/////*remoteFunctionReference*/remoteFunction(); -////var foo = new /*remoteClassReference*/remoteClass(); -////class fooCls implements /*remoteInterfaceReference*/remoteInterface { } -////var fooVar = /*remoteModuleReference*/remoteModule.foo; - -verify.baselineGetDefinitionAtPosition("remoteVariableReference", "remoteFunctionReference", "remoteClassReference", "remoteInterfaceReference", "remoteModuleReference"); diff --git a/tests/cases/fourslash/shims/getEmitOutput.ts b/tests/cases/fourslash/shims/getEmitOutput.ts deleted file mode 100644 index 7e86212d135d7..0000000000000 --- a/tests/cases/fourslash/shims/getEmitOutput.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -// @BaselineFile: getEmitOutput.baseline -// @declaration: true - -// @Filename: inputFile1.ts -// @emitThisFile: true -//// var x: number = 5; -//// class Bar { -//// x : string; -//// y : number -//// } - -// @Filename: inputFile2.ts -// @emitThisFile: true -//// var x1: string = "hello world"; -//// class Foo{ -//// x : string; -//// y : number; -//// } - -verify.baselineGetEmitOutput(); \ No newline at end of file diff --git a/tests/cases/fourslash/shims/getImplementationAtPosition-shims.ts b/tests/cases/fourslash/shims/getImplementationAtPosition-shims.ts deleted file mode 100644 index b555cc882682e..0000000000000 --- a/tests/cases/fourslash/shims/getImplementationAtPosition-shims.ts +++ /dev/null @@ -1,24 +0,0 @@ -/// - -// @Filename: goToImplementationDifferentFile_Implementation.ts -//// class /*fooClassImplementation*/FooImpl implements Foo {} -//// -//// class /*barClassImplementation*/Bar { -//// /*barHelloFunctionImplementation*/hello() {} -//// } -//// - -// @Filename: goToImplementationDifferentFile_Consumption.ts -//// interface Fo/*fooClassReference*/o {} -//// -//// var x = new B/*barClassReference*/ar(); -//// -//// x.hel/*barHelloFunctionReference*/lo(); -//// -//// class /*thisImplementation*/SomeClass { -//// someMethod() { -//// thi/*thisReference*/s.someMethod(); -//// } -//// } - -verify.baselineGoToImplementation("fooClassReference", "barClassReference", "barHelloFunctionReference", "thisReference"); diff --git a/tests/cases/fourslash/shims/getIndentationAtPosition.ts b/tests/cases/fourslash/shims/getIndentationAtPosition.ts deleted file mode 100644 index ba2936bd70223..0000000000000 --- a/tests/cases/fourslash/shims/getIndentationAtPosition.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -////class Bar { -//// {| "indentation": 4|} -//// private foo: string = ""; -//// {| "indentation": 4|} -//// private f() { -//// var a: any[] = [[1, 2], [3, 4], 5]; -//// {| "indentation": 8|} -//// return ((1 + 1)); -//// } -//// {| "indentation": 4|} -//// private f2() { -//// if (true) { } { }; -//// } -////} -////{| "indentation": 0|} - -test.markers().forEach((marker) => { - verify.indentationAtPositionIs(marker.fileName, marker.position, marker.data.indentation); -}); diff --git a/tests/cases/fourslash/shims/getNavigateToItems.ts b/tests/cases/fourslash/shims/getNavigateToItems.ts deleted file mode 100644 index 0ffbf983ff1ed..0000000000000 --- a/tests/cases/fourslash/shims/getNavigateToItems.ts +++ /dev/null @@ -1,26 +0,0 @@ -/// - -/////// Module -////[|{| "name": "Shapes", "kind": "module" |}module Shapes { -//// -//// // Class -//// [|{| "name": "Point", "kind": "class", "kindModifiers": "export", "containerName": "Shapes", "containerKind": "module" |}export class Point { -//// // Instance member -//// [|{| "name": "origin", "kind": "property", "kindModifiers": "private", "containerName": "Point", "containerKind": "class" |}private origin = 0.0;|] -//// -//// [|{| "name": "distFromZero", "kind": "property", "kindModifiers": "private", "containerName": "Point", "containerKind": "class" |}private distFromZero = 0.0;|] -//// -//// // Getter -//// [|{| "name": "distance", "kind": "getter", "containerName": "Point", "containerKind": "class" |}get distance(): number { return 0; }|] -//// }|] -////}|] -//// -////// Local variables -////var [|{| "name": "xyz", "kind": "var" |}xyz = new Shapes.Point()|]; - -for (const range of test.ranges()) { - verify.navigateTo({ - pattern: range.marker.data.name, - expected: [{ ...range.marker.data, range }], - }); -} diff --git a/tests/cases/fourslash/shims/getNavigationBarItems.ts b/tests/cases/fourslash/shims/getNavigationBarItems.ts deleted file mode 100644 index 627d4dac178f5..0000000000000 --- a/tests/cases/fourslash/shims/getNavigationBarItems.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// - -//// {| "itemName": "c", "kind": "const", "parentName": "" |}const c = 0; - -verify.navigationTree({ - "text": "", - "kind": "script", - "childItems": [ - { - "text": "c", - "kind": "const" - } - ] -}) - -verify.navigationBar([ - { - "text": "", - "kind": "script", - "childItems": [ - { - "text": "c", - "kind": "const" - } - ] - } -]); diff --git a/tests/cases/fourslash/shims/getOccurrencesAtPosition-shims.ts b/tests/cases/fourslash/shims/getOccurrencesAtPosition-shims.ts deleted file mode 100644 index 80f65974fce01..0000000000000 --- a/tests/cases/fourslash/shims/getOccurrencesAtPosition-shims.ts +++ /dev/null @@ -1,22 +0,0 @@ -/// - -/////*0*/ -////interface A { -//// foo: string; -////} -////function foo(x: A) { -//// x.f/*1*/oo -////} - -verify.baselineCommands( - { type: "documentHighlights", markerOrRange: "1" }, - { - type: "customWork", - work: () => { - goTo.marker("0"); - edit.insert("\n"); - return "Added new line"; - }, - }, - { type: "documentHighlights", markerOrRange: "1" }, -); \ No newline at end of file diff --git a/tests/cases/fourslash/shims/getOutliningSpans.ts b/tests/cases/fourslash/shims/getOutliningSpans.ts deleted file mode 100644 index 849d7bcf8b922..0000000000000 --- a/tests/cases/fourslash/shims/getOutliningSpans.ts +++ /dev/null @@ -1,100 +0,0 @@ -/// - -////// interface -////interface IFoo[| { -//// getDist(): number; -////}|] -//// -////// class members -////class Foo[| { -//// constructor()[| { -//// }|] -//// -//// public foo(): number[| { -//// return 0; -//// }|] -//// -//// public get X()[| { -//// return 1; -//// }|] -//// -//// public set X(v: number)[| { -//// }|] -//// -//// public member = function f()[| { -//// -//// }|] -////}|] -////switch(1)[| { -//// case 1:[| break;|] -////}|] -//// -////var array =[| [ -//// 1, -//// 2 -////]|] -//// -////// modules -////module m1[| { -//// module m2[| { }|] -//// module m3[| { -//// function foo()[| { -//// -//// }|] -//// -//// interface IFoo2[| { -//// -//// }|] -//// -//// class foo2 implements IFoo2[| { -//// -//// }|] -//// }|] -////}|] -//// -////// function declaration -////function foo(): number[| { -//// return 0; -////}|] -//// -////// function expressions -////[|(function f()[| { -//// -////}|])|] -//// -////// trivia handeling -////class ClassFooWithTrivia[| /* some comments */ -//// /* more trivia */ { -//// -//// -//// /*some trailing trivia */ -////}|] /* even more */ -//// -////// object literals -////var x =[|{ -//// a:1, -//// b:2, -//// get foo()[| { -//// return 1; -//// }|] -////}|] -//////outline with deep nesting -////var nest =[| [[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[[|[ -//// [|[ -//// [ -//// [ -//// [ -//// [ -//// 1,2,3 -//// ] -//// ] -//// ] -//// ] -//// ]|] -////]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]]|]; -//// -//////outline after a deeply nested node -////class AfterNestedNodes[| { -////}|] - -verify.outliningSpansInCurrentFile(test.ranges(), "code"); diff --git a/tests/cases/fourslash/shims/getPreProcessedFile.ts b/tests/cases/fourslash/shims/getPreProcessedFile.ts deleted file mode 100644 index a33a6c9a470ce..0000000000000 --- a/tests/cases/fourslash/shims/getPreProcessedFile.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// -// @ModuleResolution: classic - -// @Filename: refFile1.ts -//// class D { } - -// @Filename: refFile2.ts -//// export class E {} - -// @Filename: main.ts -// @ResolveReference: true -//// /// -//// /// -//// /*3*/////*4*/ -//// import ref2 = require("refFile2"); -//// import noExistref2 = require(/*5*/"NotExistRefFile2"/*6*/); -//// import invalidRef1 /*7*/require/*8*/("refFile2"); -//// import invalidRef2 = /*9*/requi/*10*/(/*10A*/"refFile2"); -//// var obj: /*11*/C/*12*/; -//// var obj1: D; -//// var obj2: ref2.E; - -goTo.file("main.ts"); -verify.numberOfErrorsInCurrentFile(7); -verify.errorExistsBetweenMarkers("1", "2"); -verify.errorExistsBetweenMarkers("3", "4"); -verify.errorExistsBetweenMarkers("5", "6"); -verify.errorExistsBetweenMarkers("7", "8"); -verify.errorExistsBetweenMarkers("9", "10"); -verify.errorExistsBetweenMarkers("10", "10A"); -verify.errorExistsBetweenMarkers("11", "12"); diff --git a/tests/cases/fourslash/shims/getQuickInfoAtPosition.ts b/tests/cases/fourslash/shims/getQuickInfoAtPosition.ts deleted file mode 100644 index efb49eb58c4e5..0000000000000 --- a/tests/cases/fourslash/shims/getQuickInfoAtPosition.ts +++ /dev/null @@ -1,13 +0,0 @@ -/// - -////class SS{} -//// -////var x/*1*/1 = new SS(); -////var x/*2*/2 = new SS(); -////var x/*3*/3 = new SS; - -verify.quickInfos({ - 1: "var x1: SS", - 2: "var x2: SS", - 3: "var x3: SS" -}); diff --git a/tests/cases/fourslash/shims/getReferencesAtPosition.ts b/tests/cases/fourslash/shims/getReferencesAtPosition.ts deleted file mode 100644 index 40e03cd2d76ae..0000000000000 --- a/tests/cases/fourslash/shims/getReferencesAtPosition.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// - -//@BaselineFile: getReferencesAtPosition.baseline.jsonc -//@Filename: findAllRefsOnDefinition-import.ts -////export class Test{ -//// -//// constructor(){ -//// -//// } -//// -//// /*1*/public /*2*/start(){ -//// return this; -//// } -//// -//// public stop(){ -//// return this; -//// } -////} - -//@Filename: findAllRefsOnDefinition.ts -////import Second = require("./findAllRefsOnDefinition-import"); -//// -////var second = new Second.Test() -////second./*3*/start(); -////second.stop(); - -verify.baselineFindAllReferences('1', '2', '3'); diff --git a/tests/cases/fourslash/shims/getRenameInfo-shims.ts b/tests/cases/fourslash/shims/getRenameInfo-shims.ts deleted file mode 100644 index 42c60bb4dc2ad..0000000000000 --- a/tests/cases/fourslash/shims/getRenameInfo-shims.ts +++ /dev/null @@ -1,10 +0,0 @@ -/// - -/////// - -////[|function [|{| "contextRangeIndex": 0 |}Bar|]() { -//// // This is a reference to Bar in a comment. -//// "this is a reference to Bar in a string" -////}|] - -verify.baselineRenameAtRangesWithText("Bar"); diff --git a/tests/cases/fourslash/shims/getSemanticClassifications.ts b/tests/cases/fourslash/shims/getSemanticClassifications.ts deleted file mode 100644 index 1bbc4eec21a3e..0000000000000 --- a/tests/cases/fourslash/shims/getSemanticClassifications.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// - -//// module /*0*/M { -//// export interface /*1*/I { -//// } -//// } -//// interface /*2*/X extends /*3*/M./*4*/I { } - -const c = classification("original"); -verify.semanticClassificationsAre("original", - c.moduleName("M", test.marker("0").position), - c.interfaceName("I", test.marker("1").position), - c.interfaceName("X", test.marker("2").position), - c.moduleName("M", test.marker("3").position), - c.interfaceName("I", test.marker("4").position)); diff --git a/tests/cases/fourslash/shims/getSemanticDiagnostics.ts b/tests/cases/fourslash/shims/getSemanticDiagnostics.ts deleted file mode 100644 index 72739c665be62..0000000000000 --- a/tests/cases/fourslash/shims/getSemanticDiagnostics.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// - -// @module: CommonJS -// @declaration: true -//// export function /*1*/foo/*2*/() { -//// interface privateInterface {} -//// class Bar implements privateInterface { private a; } -//// return Bar; -//// } - -verify.errorExistsBetweenMarkers("1", "2"); -verify.numberOfErrorsInCurrentFile(1); - - diff --git a/tests/cases/fourslash/shims/getSignatureHelpItems.ts b/tests/cases/fourslash/shims/getSignatureHelpItems.ts deleted file mode 100644 index 672e9069a42c5..0000000000000 --- a/tests/cases/fourslash/shims/getSignatureHelpItems.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file0.ts -////declare function fn(x: string, y: number); - -// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file1.ts -////declare function fn(x: string); - -// @Filename: signatureHelpInFunctionCallOnFunctionDeclarationInMultipleFiles_file2.ts -////fn(/*1*/ - -verify.signatureHelp({ marker: "1", overloadsCount: 2 }); diff --git a/tests/cases/fourslash/shims/getSyntacticClassifications.ts b/tests/cases/fourslash/shims/getSyntacticClassifications.ts deleted file mode 100644 index 897d42cbea729..0000000000000 --- a/tests/cases/fourslash/shims/getSyntacticClassifications.ts +++ /dev/null @@ -1,35 +0,0 @@ -/// - -//// // comment -//// module M { -//// var v = 0 + 1; -//// var s = "string"; -//// -//// class C { -//// } -//// -//// enum E { -//// } -//// -//// interface I { -//// } -//// -//// module M1.M2 { -//// } -//// } - -const c = classification("original"); -verify.syntacticClassificationsAre( - c.comment("// comment"), - c.keyword("module"), c.moduleName("M"), c.punctuation("{"), - c.keyword("var"), c.identifier("v"), c.operator("="), c.numericLiteral("0"), c.operator("+"), c.numericLiteral("1"), c.punctuation(";"), - c.keyword("var"), c.identifier("s"), c.operator("="), c.stringLiteral('"string"'), c.punctuation(";"), - c.keyword("class"), c.className("C"), c.punctuation("<"), c.typeParameterName("T"), c.punctuation(">"), c.punctuation("{"), - c.punctuation("}"), - c.keyword("enum"), c.enumName("E"), c.punctuation("{"), - c.punctuation("}"), - c.keyword("interface"), c.interfaceName("I"), c.punctuation("{"), - c.punctuation("}"), - c.keyword("module"), c.moduleName("M1"), c.punctuation("."), c.moduleName("M2"), c.punctuation("{"), - c.punctuation("}"), - c.punctuation("}")); diff --git a/tests/cases/fourslash/shims/getTodoComments.ts b/tests/cases/fourslash/shims/getTodoComments.ts deleted file mode 100644 index b1e0086b93f7b..0000000000000 --- a/tests/cases/fourslash/shims/getTodoComments.ts +++ /dev/null @@ -1,3 +0,0 @@ -//// // [|TODO|] - -verify.todoCommentsInCurrentFile(["TODO"]); \ No newline at end of file diff --git a/tests/cases/fourslash/shims/goToDefinitionTypeReferenceDirective-shims.ts b/tests/cases/fourslash/shims/goToDefinitionTypeReferenceDirective-shims.ts deleted file mode 100644 index 78be01520219f..0000000000000 --- a/tests/cases/fourslash/shims/goToDefinitionTypeReferenceDirective-shims.ts +++ /dev/null @@ -1,11 +0,0 @@ -/// - -// @typeRoots: src/types -// @Filename: src/types/lib/index.d.ts -/////*0*/declare let $: {x: number}; - -// @Filename: src/app.ts -//// /// -//// $.x; - -verify.baselineGoToDefinition("1"); diff --git a/tests/cases/fourslash/shims/goToTypeDefinition-shims.ts b/tests/cases/fourslash/shims/goToTypeDefinition-shims.ts deleted file mode 100644 index 30fbd1ff77950..0000000000000 --- a/tests/cases/fourslash/shims/goToTypeDefinition-shims.ts +++ /dev/null @@ -1,12 +0,0 @@ -/// - -// @Filename: goToTypeDefinition_Definition.ts -////class /*definition*/C { -//// p; -////} -////var c: C; - -// @Filename: goToTypeDefinition_Consumption.ts -/////*reference*/c = undefined; - -verify.baselineGoToType("reference"); diff --git a/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts b/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts deleted file mode 100644 index aa06ed94c5973..0000000000000 --- a/tests/cases/fourslash/shims/quickInfoDisplayPartsVarShims.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -// @BaselineFile: quickInfoDisplayPartsVar.shims.baseline - -////var /*1*/a = 10; -////function foo() { -//// var /*2*/b = /*3*/a; -////} -////module m { -//// var /*4*/c = 10; -//// export var /*5*/d = 10; -////} -////var /*6*/f: () => number; -////var /*7*/g = /*8*/f; -/////*9*/f(); -////var /*10*/h: { (a: string): number; (a: number): string; }; -////var /*11*/i = /*12*/h; -/////*13*/h(10); -/////*14*/h("hello"); - -verify.baselineQuickInfo(); \ No newline at end of file