如何在 WebStorm 中折叠缩进函数链?

How do I fold indented function chains in WebStorm?

对于以下代码:

this.fooService
  .bar$
  .pipe(takeUntil(this.destroy$))
  .subscribe(
    (value: ValueType) => {
      // do something
    }
  );

而不是像这样折叠它:

this.fooService
  .bar$
  .pipe(takeUntil(this.destroy$))
  .subscribe(
    (value: ValueType) => {...}
  );

我希望 WebStorm 这样折叠它:

this.fooService ...

你可以用 editor-fold 来实现,desc 将是折叠显示。

this.fooService //<editor-fold desc="...">
  .bar$
  .pipe(takeUntil(this.destroy$))
  .subscribe(
    (value: ValueType) => {
      // do something
    }
  );
  //</editor-fold>

最后做了这样的事情:

this.fooService ...

希望对您有所帮助!

来源:Jetbrains blog.