镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/harness/fourslashImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2461,8 +2461,7 @@ namespace FourSlash {
const { fileName } = this.activeFile;
const before = this.getFileContent(fileName);
this.formatDocument();
const after = this.getFileContent(fileName);
this.assertObjectsEqual(after, before);
this.verifyFileContent(fileName, before);
}

public verifyTextAtCaretIs(text: string) {
Expand Down
6 changes: 5 additions & 1 deletion src/services/formatting/smartIndenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,15 @@ namespace ts.formatting {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.FunctionExpression:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.ArrowFunction:
case SyntaxKind.Constructor:
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return childKind !== SyntaxKind.Block;
case SyntaxKind.ArrowFunction:
if (sourceFile && childKind === SyntaxKind.ParenthesizedExpression) {
return rangeIsOnOneLine(sourceFile, child!);
}
return childKind !== SyntaxKind.Block;
case SyntaxKind.ExportDeclaration:
return childKind !== SyntaxKind.NamedExports;
case SyntaxKind.ImportDeclaration:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/// <reference path="fourslash.ts" />

// @Filename: Bar.tsx
//// export const Bar = ({
//// foo,
//// bar,
//// }: any) => (
//// <div>Hello world</div>
//// )
////
//// export const Bar2 = ({
//// foo,
//// bar,
//// }) => (<div>Hello world</div>)
////
//// export const Bar2 = ({
//// foo,
//// bar,
//// }) => <div>Hello world</div>
////
//// export const Bar3 = ({
//// foo,
//// bar,
//// }) =>
//// (<div>Hello world</div>)
////
//// export const Bar4 = ({
//// foo,
//// bar,
//// }) =>
//// <div>Hello world</div>
////
//// export const Bar5 = () => (
//// <div>Hello world</div>
//// )
////
//// export const Bar6 = () => (<div>Hello world</div>)
////
//// export const Bar7 = () => <div>Hello world</div>
////
//// export const Bar8 = () =>
//// (<div>Hello world</div>)
////
//// export const Bar9 = () =>
//// <div>Hello world</div>

verify.formatDocumentChangesNothing();