Cherry-pick release bugs (#36804)

* Fix renaming an ExportSpecifier name when propertyName is present (#36790)

* Fix renaming exportSpecifier name when propertyName is present

* Add baseline test for name without propertyName too

* Set correct pos for NamespaceExport (#36794)

* Set correct pos for NamespaceExport

* Update tests
This commit is contained in:
Andrew Branch
2020-02-14 13:44:37 -08:00
committed by GitHub
parent e7fec6d565
commit 5a2fa49205
30 changed files with 187 additions and 100 deletions

View File

@@ -6565,8 +6565,8 @@ namespace ts {
return finishNode(node);
}
function parseNamespaceExport(): NamespaceExport {
const node = <NamespaceExport>createNode(SyntaxKind.NamespaceExport);
function parseNamespaceExport(pos: number): NamespaceExport {
const node = <NamespaceExport>createNode(SyntaxKind.NamespaceExport, pos);
node.name = parseIdentifier();
return finishNode(node);
}
@@ -6574,9 +6574,10 @@ namespace ts {
function parseExportDeclaration(node: ExportDeclaration): ExportDeclaration {
node.kind = SyntaxKind.ExportDeclaration;
node.isTypeOnly = parseOptional(SyntaxKind.TypeKeyword);
const namespaceExportPos = scanner.getStartPos();
if (parseOptional(SyntaxKind.AsteriskToken)) {
if (parseOptional(SyntaxKind.AsKeyword)) {
node.exportClause = parseNamespaceExport();
node.exportClause = parseNamespaceExport(namespaceExportPos);
}
parseExpected(SyntaxKind.FromKeyword);
node.moduleSpecifier = parseModuleSpecifier();

View File

@@ -1319,6 +1319,37 @@ namespace FourSlash {
}
}
public baselineRename(marker: string, options: FourSlashInterface.RenameOptions) {
const position = this.getMarkerByName(marker).position;
const locations = this.languageService.findRenameLocations(
this.activeFile.fileName,
position,
options.findInStrings ?? false,
options.findInComments ?? false,
options.providePrefixAndSuffixTextForRename);
if (!locations) {
this.raiseError(`baselineRename failed. Could not rename at the provided position.`);
}
const renamesByFile = ts.group(locations, l => l.fileName);
const baselineContent = renamesByFile.map(renames => {
const { fileName } = renames[0];
const sortedRenames = ts.sort(renames, (a, b) => b.textSpan.start - a.textSpan.start);
let baselineFileContent = this.getFileContent(fileName);
for (const { textSpan } of sortedRenames) {
const isOriginalSpan = fileName === this.activeFile.fileName && ts.textSpanIntersectsWithPosition(textSpan, position);
baselineFileContent =
baselineFileContent.slice(0, textSpan.start) +
(isOriginalSpan ? "[|RENAME|]" : "RENAME") +
baselineFileContent.slice(textSpan.start + textSpan.length);
}
return `/*====== ${fileName} ======*/\n\n${baselineFileContent}`;
}).join("\n\n") + "\n";
Harness.Baseline.runBaseline(this.getBaselineFileNameForContainingTestFile(), baselineContent);
}
public verifyQuickInfoExists(negative: boolean) {
const actualQuickInfo = this.languageService.getQuickInfoAtPosition(this.activeFile.fileName, this.currentCaretPosition);
if (negative) {

View File

@@ -516,6 +516,10 @@ namespace FourSlashInterface {
this.state.verifyRenameLocations(startRanges, options);
}
public baselineRename(marker: string, options: RenameOptions) {
this.state.baselineRename(marker, options);
}
public verifyQuickInfoDisplayParts(kind: string, kindModifiers: string, textSpan: FourSlash.TextSpan,
displayParts: ts.SymbolDisplayPart[], documentation: ts.SymbolDisplayPart[], tags: ts.JSDocTagInfo[]) {
this.state.verifyQuickInfoDisplayParts(kind, kindModifiers, textSpan, displayParts, documentation, tags);
@@ -1623,4 +1627,9 @@ namespace FourSlashInterface {
template: string
};
export type RenameLocationOptions = FourSlash.Range | { readonly range: FourSlash.Range, readonly prefixText?: string, readonly suffixText?: string };
export interface RenameOptions {
readonly findInStrings?: boolean;
readonly findInComments?: boolean;
readonly providePrefixAndSuffixTextForRename?: boolean;
};
}

View File

@@ -1927,10 +1927,12 @@ namespace ts.FindAllReferences {
}
const exportSpecifier = getDeclarationOfKind<ExportSpecifier>(symbol, SyntaxKind.ExportSpecifier);
const localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier);
if (localSymbol) {
const res = cbSymbol(localSymbol, /*rootSymbol*/ undefined, /*baseSymbol*/ undefined, EntryKind.Node);
if (res) return res;
if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) {
const localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier);
if (localSymbol) {
const res = cbSymbol(localSymbol, /*rootSymbol*/ undefined, /*baseSymbol*/ undefined, EntryKind.Node);
if (res) return res;
}
}
// symbolAtLocation for a binding element is the local symbol. See if the search symbol is the property.

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
ns.b;
@@ -18,15 +18,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
>ns.a : Symbol(a, Decl(1.ts, 3, 10))
@@ -40,15 +40,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
>ns.a : Symbol(a, Decl(1.ts, 3, 10))
@@ -40,15 +40,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
>ns.a : Symbol(a, Decl(1.ts, 3, 10))
@@ -40,15 +40,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
>ns.a : Symbol(a, Decl(1.ts, 3, 10))
@@ -40,15 +40,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
>ns.a : Symbol(a, Decl(1.ts, 3, 10))
@@ -40,15 +40,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -7,7 +7,7 @@ export const b = 2;
=== tests/cases/conformance/es2020/modules/1.ts ===
export * as ns from './0';
>ns : Symbol(ns, Decl(1.ts, 0, 11))
>ns : Symbol(ns, Decl(1.ts, 0, 6))
ns.a;
>ns.a : Symbol(a, Decl(1.ts, 3, 10))
@@ -40,15 +40,15 @@ import * as foo from './1'
foo.ns.a;
>foo.ns.a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>a : Symbol(foo.ns.a, Decl(0.ts, 0, 12))
foo.ns.b;
>foo.ns.b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>foo.ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>foo : Symbol(foo, Decl(2.ts, 0, 6))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 11))
>ns : Symbol(foo.ns, Decl(1.ts, 0, 6))
>b : Symbol(foo.ns.b, Decl(0.ts, 1, 12))

View File

@@ -4,7 +4,7 @@ export class A {}
=== tests/cases/conformance/externalModules/typeOnly/b.ts ===
export * as a from './a';
>a : Symbol(a, Decl(b.ts, 0, 11))
>a : Symbol(a, Decl(b.ts, 0, 6))
=== tests/cases/conformance/externalModules/typeOnly/c.ts ===
import type { a } from './b';

View File

@@ -8,7 +8,7 @@ export type { A } from './a';
=== tests/cases/conformance/externalModules/typeOnly/c.ts ===
export * as a from './b';
>a : Symbol(a, Decl(c.ts, 0, 11))
>a : Symbol(a, Decl(c.ts, 0, 6))
=== tests/cases/conformance/externalModules/typeOnly/d.ts ===
import { a } from './c';

View File

@@ -0,0 +1,9 @@
/*====== /tests/cases/fourslash/a.ts ======*/
const name = {};
export { name as [|RENAME|] };
/*====== /tests/cases/fourslash/b.ts ======*/
import { RENAME } from './a';
const x = RENAME.toString();

View File

@@ -0,0 +1,9 @@
/*====== /tests/cases/fourslash/a.ts ======*/
const RENAME = {};
export { [|RENAME|] };
/*====== /tests/cases/fourslash/b.ts ======*/
import { RENAME } from './a';
const x = RENAME.toString();

View File

@@ -359,6 +359,7 @@ declare namespace FourSlashInterface {
renameInfoSucceeded(displayName?: string, fullDisplayName?: string, kind?: string, kindModifiers?: string, fileToRename?: string, range?: Range, allowRenameOfImportPath?: boolean): void;
renameInfoFailed(message?: string, allowRenameOfImportPath?: boolean): void;
renameLocations(startRanges: ArrayOrSingle<Range>, options: RenameLocationsOptions): void;
baselineRename(marker: string, options: RenameOptions): void;
/** Verify the quick info available at the current marker. */
quickInfoIs(expectedText: string, expectedDocumentation?: string): void;
@@ -723,6 +724,8 @@ declare namespace FourSlashInterface {
readonly ranges: ReadonlyArray<RenameLocationOptions>;
readonly providePrefixAndSuffixTextForRename?: boolean;
};
type RenameOptions = { readonly findInStrings?: boolean, readonly findInComments?: boolean, readonly providePrefixAndSuffixTextForRename?: boolean };
type RenameLocationOptions = Range | { readonly range: Range, readonly prefixText?: string, readonly suffixText?: string };
type DiagnosticIgnoredInterpolations = { template: string }
}

View File

@@ -17,7 +17,7 @@
////
////// export ... from ...
////[|{| "id": "exportDecl1" |}[|export|] [|type|] * [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl1" |}./g|]";|]
////[|{| "id": "exportDecl2" |}[|export|] [|type|] * [|as|] [|{| "isWriteAccess": true, "isDefinition": true |}H|] [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl2" |}./h|]";|]
////[|{| "id": "exportDecl2" |}[|export|] [|type|] [|{| "id": "exportDecl2_namespaceExport" |}* [|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl2_namespaceExport" |}H|]|] [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl2" |}./h|]";|]
////[|{| "id": "exportDecl3" |}[|export|] [|type|] { [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl3" |}I|] } [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl3" |}./i|]";|]
////[|{| "id": "exportDecl4" |}[|export|] [|type|] { j1, j2 [|as|] [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "exportDecl4" |}j3|] } [|from|] "[|{| "isWriteAccess": false, "isDefinition": false, "contextRangeId": "exportDecl4" |}./j|]";|]
////[|{| "id": "typeDecl1" |}type [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeId": "typeDecl1" |}Z1|] = 1;|]
@@ -125,6 +125,7 @@ const [
exportDecl2,
exportDecl2_exportKeyword,
exportDecl2_typeKeyword,
exportDecl2_namespaceExport,
exportDecl2_asKeyword,
exportDecl2_name,
exportDecl2_fromKeyword,

View File

@@ -0,0 +1,11 @@
/// <reference path="fourslash.ts" />
// @Filename: a.ts
////const name = {};
////export { name as name/**/ };
// @Filename: b.ts
////import { name } from './a';
////const x = name.toString();
verify.baselineRename("", { providePrefixAndSuffixTextForRename: false });

View File

@@ -0,0 +1,11 @@
/// <reference path="fourslash.ts" />
// @Filename: a.ts
////const name = {};
////export { name/**/ };
// @Filename: b.ts
////import { name } from './a';
////const x = name.toString();
verify.baselineRename("", { providePrefixAndSuffixTextForRename: false });