You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
interface MyInterface {
foo(): string,
bar: Array<number>,
}
export abstract class Foo implements MyInterface {
foo() {
// TODO: return an actual value here
return 'hello'
}
get bar() {
return [ 1,
2, 3,
]
}
}
type RequestType = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'OPTIONS' | 'CONNECT' | 'DELETE' | 'TRACE'
Open it in a clean Vim:
$ vim --clean foo.ts
Format the whole buffer with the built-in formatexpr:
gggqG
Enjoy:
interface MyInterface { foo(): string, bar: Array<number>, } export abstract class Foo implements MyInterface { foo() { // TODO: return an actual value here return 'hello' } get bar() { return [ 1, 2, 3, ] } } type RequestType = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'OPTIONS' | 'CONNECT' | 'DELETE' | 'TRACE'
Expected behaviour
Something that generally looks like the input, but with better formatting, alignment, etc. Anything but everything mashed into a single line, really.
Version of Vim
9.0.20, 9.0.472, 9.0.828, 9.0.1276, 9.01313
Environment
Operating system: macOS 12.6.1 and now 13.3.1 but irrelevant
Terminal: irrelevant
$TERM: irrelevant
Shell: irrelevant
Other considerations
The FixedGq() in $VIMRUNTIME/indent/typescript.vim and the one in this repo are essentially (not exactly) identical but I am not sure if there is an official maintainer for Vim's TS runtime file or if there is some kind of official relationship between this repo and Vim's TS runtime files. Either way, the one in Vim and this one are both broken.
Mirror issue opened in Vim's issue tracker: vim/vim#11493
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Put the following content in
foo.ts
(TypeScript sample taken from https://prettier.io/playground/):Open it in a clean Vim:
Format the whole buffer with the built-in
formatexpr
:Enjoy:
Expected behaviour
Something that generally looks like the input, but with better formatting, alignment, etc. Anything but everything mashed into a single line, really.
Version of Vim
9.0.20, 9.0.472, 9.0.828, 9.0.1276, 9.01313
Environment
Operating system: macOS 12.6.1 and now 13.3.1 but irrelevant
Terminal: irrelevant
$TERM: irrelevant
Shell: irrelevant
Other considerations
The
FixedGq()
in$VIMRUNTIME/indent/typescript.vim
and the one in this repo are essentially (not exactly) identical but I am not sure if there is an official maintainer for Vim's TS runtime file or if there is some kind of official relationship between this repo and Vim's TS runtime files. Either way, the one in Vim and this one are both broken.Mirror issue opened in Vim's issue tracker: vim/vim#11493
The text was updated successfully, but these errors were encountered: