Closed
Description
From @robotlolita on October 20, 2018 14:0
Issue Type: Bug
Steps to reproduce:
- Given an abstract class with abstract methods that have long signatures and use either a Tuple type or a generic type:
namespace some.really.long.generated.type.goes.here.you.know.this_.should.be.pretty.simple {
export interface Yah {}
}
namespace another.really.long.generated.type.goes.here.too.because.who.cares.about.space.do_.you.feel.me {
export interface Yah {}
}
interface this_will_be_collapsed {}
interface this_is_fine {}
abstract class AbstractCstVisitor {
abstract Node(arg1: [some.really.long.generated.type.goes.here.you.know.this_.should.be.pretty.simple.Yah[], another.really.long.generated.type.goes.here.too.because.who.cares.about.space.do_.you.feel.me.Yah[]], arg2: [this_will_be_collapsed], arg3: Set<this_will_be_collapsed>, arg4: this_is_fine): Set<this_will_be_collapsed>;
}
- If you create a class that inherits from this:
class CstVisitorImplementation extends AbstractCstVisitor {
}
- Then select the class's name and use the "Implement inherited abstract class" fix action, the type parameters for generic types and positional types in a tuple type will be written as
...
:
class CstVisitorImplementation extends AbstractCstVisitor {
Node(arg1: [some.really.long.generated.type.goes.here.you.know.this_.should.be.pretty.simple.Yah[], another.really.long.generated.type.goes.here.too.because.who.cares.about.space.do_.you.feel.me.Yah[]], arg2: [...], arg3: Set<...>, arg4: this_is_fine): Set<...> {
throw new Error("Method not implemented.");
}
}
Expected result:
The types should be correctly written in the generated methods:
class CstVisitorImplementation extends AbstractCstVisitor {
Node(arg1: [some.really.long.generated.type.goes.here.you.know.this_.should.be.pretty.simple.Yah[], another.really.long.generated.type.goes.here.too.because.who.cares.about.space.do_.you.feel.me.Yah[]], arg2: [this_will_be_collapsed], arg3: Set<this_will_be_collapsed>, arg4: this_is_fine): Set<this_will_be_collapsed> {
throw new Error("Method not implemented.");
}
}
Additional information:
This is unlikely to show up in most code bases tbh. I only ran into this because I'm generating a lot of code, which includes abstract classes for implementing visitors on a CST directly from a grammar (which doesn't have semantic actions), so some methods have a huge amount of parameters, and consequently the lines end up pretty long.
If someone can point me where these actions are implemented I could try to submit a patch for this.
VS Code version: Code - Insiders 1.29.0-insider (45d5d15, 2018-10-19T06:51:31.263Z)
OS version: Linux x64 4.15.0-36-generic
System Info
Item | Value |
---|---|
CPUs | Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz (4 x 2714) |
GPU Status | 2d_canvas: enabled checker_imaging: disabled_off flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software rasterization: disabled_software video_decode: unavailable_software video_encode: unavailable_software webgl: enabled webgl2: enabled |
Load (avg) | 2, 2, 2 |
Memory (System) | 7.70GB (1.70GB free) |
Process Argv | --unity-launch |
Screen Reader | no |
VM | 0% |
Copied from original issue: microsoft/vscode#61385