mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 15:45:27 -05:00
Fix tests
This commit is contained in:
@@ -1319,11 +1319,12 @@ namespace ts.server {
|
||||
}
|
||||
const auxiliaryProgram = auxiliaryProject.getLanguageService().getProgram()!;
|
||||
const fileToSearch = Debug.checkDefined(auxiliaryProgram.getSourceFile(fileNameToSearch!));
|
||||
const matches = FindAllReferences.Core.getTopMostDeclarationsInFile(candidate.name, fileToSearch);
|
||||
const matches = FindAllReferences.Core.getTopMostDeclarationNamesInFile(candidate.name, fileToSearch);
|
||||
for (const match of matches) {
|
||||
const symbol = match.symbol || auxiliaryProgram.getTypeChecker().getSymbolAtLocation(match);
|
||||
if (symbol) {
|
||||
pushIfUnique(definitions, GoToDefinition.createDefinitionInfo(match, auxiliaryProgram.getTypeChecker(), symbol, match));
|
||||
const decl = getDeclarationFromName(match);
|
||||
if (symbol && decl) {
|
||||
pushIfUnique(definitions, GoToDefinition.createDefinitionInfo(decl, auxiliaryProgram.getTypeChecker(), symbol, match));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ declare namespace FourSlashInterface {
|
||||
goToDefinition(startsAndEnds: { [startMarkerName: string]: ArrayOrSingle<string> }): void;
|
||||
/** Verifies goToDefinition for each `${markerName}Reference` -> `${markerName}Definition` */
|
||||
goToDefinitionForMarkers(...markerNames: string[]): void;
|
||||
goToSourceDefinition(startMarkerNames: ArrayOrSingle<string>, fileResult: { file: string }): void;
|
||||
goToSourceDefinition(startMarkerNames: ArrayOrSingle<string>, fileResult: { file: string, unverified?: boolean }): void;
|
||||
goToSourceDefinition(startMarkerNames: ArrayOrSingle<string>, endMarkerNames: ArrayOrSingle<string>): void;
|
||||
goToType(startsAndEnds: { [startMarkerName: string]: ArrayOrSingle<string> }): void;
|
||||
goToType(startMarkerNames: ArrayOrSingle<string>, endMarkerNames: ArrayOrSingle<string>): void;
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
//// * _.add(6, 4);
|
||||
//// * // => 10
|
||||
//// */
|
||||
//// var [|add|] = createMathOperation(function(augend, addend) {
|
||||
//// var [|/*variable*/add|] = createMathOperation(function(augend, addend) {
|
||||
//// return augend + addend;
|
||||
//// }, 0);
|
||||
////
|
||||
//// function lodash(value) {}
|
||||
//// lodash.[|add|] = add;
|
||||
//// lodash.[|/*property*/add|] = add;
|
||||
////
|
||||
//// /** Detect free variable `global` from Node.js. */
|
||||
//// var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
||||
@@ -66,4 +66,4 @@
|
||||
// @Filename: /index.ts
|
||||
//// import { /*start*/add } from 'lodash';
|
||||
|
||||
verify.allRangesAppearInImplementationList("start");
|
||||
verify.goToSourceDefinition("start", ["variable", "property"]);
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
/// <reference path="../fourslash.ts" />
|
||||
|
||||
// @Filename: /index.ts
|
||||
//// import { a/*end*/ } from "./a";
|
||||
//// [|a/*start*/|]
|
||||
|
||||
verify.goToDefinition("start", "end");
|
||||
verify.goToSourceDefinition("start", "end");
|
||||
@@ -6,7 +6,7 @@
|
||||
//// { "name": "lodash", "version": "4.17.15", "main": "./lodash.js" }
|
||||
|
||||
// @Filename: /node_modules/lodash/lodash.js
|
||||
//// [||];(function() {
|
||||
//// ;(function() {
|
||||
//// /**
|
||||
//// * Adds two numbers.
|
||||
//// *
|
||||
@@ -72,8 +72,8 @@
|
||||
//// }
|
||||
|
||||
// @Filename: /index.ts
|
||||
//// import /*defaultImport*/_, { /*unresolvableNamedImport*/foo } from /*moduleSpecifier*/'lodash';
|
||||
//// import [|/*defaultImport*/_|], { [|/*unresolvableNamedImport*/foo|] } from [|/*moduleSpecifier*/'lodash'|];
|
||||
|
||||
verify.allRangesAppearInImplementationList("defaultImport");
|
||||
verify.allRangesAppearInImplementationList("unresolvableNamedImport");
|
||||
verify.allRangesAppearInImplementationList("moduleSpecifier");
|
||||
verify.goToSourceDefinition("defaultImport", { file: "/node_modules/lodash/lodash.js", unverified: true });
|
||||
verify.goToSourceDefinition("unresolvableNamedImport", { file: "/node_modules/lodash/lodash.js", unverified: true });
|
||||
verify.goToSourceDefinition("moduleSpecifier", { file: "/node_modules/lodash/lodash.js", unverified: true });
|
||||
|
||||
Reference in New Issue
Block a user