TypeScript/tests/cases/fourslash/formatAddSemicolons1.ts
Andrew Branch 7d9b22eea0
Add semicolon preference to formatter options (#33402)
* Add UserPreferences for semicolons

* Prototype formatter semicolon removal

* Implement semicolon insertion

* Fix existing tests

* Start adding tests

* Fix some edge cases of semicolon deletion

* Fix semicolon removal before comments

* Fix indentation

* Test on checker

* Replace semicolon-omitting writer with formatter preference

* Fix writing new nodes, update protocol

* Rename option

* Really fix formatting synthetic nodes

* Fix refactoring misses

* Un-update submodules gahhhh

* Update APIs

* Update for ESLint

* Revert accidental test change

* De-kludge deduplication of EOF processing

* Omit last element semicolon from single-line object-like types

* Revert "Omit last element semicolon from single-line object-like types"

This reverts commit 5625cb0237.

* Fix straggler test

* Add test for leading semicolon class members

* Rename a lot of stuff for clarity

* Invert some boolean logic
2019-09-26 13:23:29 -07:00

54 lines
1.1 KiB
TypeScript

/// <reference path="fourslash.ts" />
////console.log(1)
////console.log(2)
////const x = function() { }
////for (let i = 0; i < 1; i++) {
//// 1
//// 2
////}
////do { } while (false) console.log(3)
////function f() { }
////class C {
//// ["one"] = {}
//// ["two"]
//// three: string
//// m() { }
//// ;["three"] = {}
//// ;["four"]
////}
////enum E {
//// C
////}
////type M<T> = { [K in keyof T]: any }
////declare module 'foo' { }
////declare module 'bar'
////type T = { x: string, y: number }
format.setFormatOptions({ ...format.copyFormatOptions(), semicolons: ts.SemicolonPreference.Insert });
format.document();
verify.currentFileContentIs(`console.log(1);
console.log(2);
const x = function() { };
for (let i = 0; i < 1; i++) {
1;
2;
}
do { } while (false); console.log(3);
function f() { }
class C {
["one"] = {}
["two"];
three: string;
m() { }
;["three"] = {}
;["four"];
}
enum E {
C
}
type M<T> = { [K in keyof T]: any };
declare module 'foo' { }
declare module 'bar';
type T = { x: string, y: number; };`);