I suggest you ...

Unused procedures vanish automatically on compile.

When I compile or debug the program I want all unused procedures to vanish automatically. (example: Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged End Sub should vanish when debug/compile if no code is inside it.)
This worked in VB6.

18 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Torbjörn GörtzTorbjörn Görtz shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    9 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Adorian DoranAdorian Doran commented  ·   ·  Flag as inappropriate

        The idea is actually not bad. I like it! I use to do reusable code, that may contain features that may not be used in a certain project. It would be nice for these methods/fields to get discarded at compile time, if they are marked as dispensable through an attribute and are not called nor members of an interface or base class.

      • Mr. VB6Mr. VB6 commented  ·   ·  Flag as inappropriate

        In VB6, default unused procedures do that, and that is smart! if you rename the default procedure, then it does not disappear :)

      • Torbjörn GörtzTorbjörn Görtz commented  ·   ·  Flag as inappropriate

        To Draco - Wy on earth do you want to keep empty procedures - which was created automatically by the IDE? If you dont use them by putting code inte them - why keep them?

      • Torbjörn GörtzTorbjörn Görtz commented  ·   ·  Flag as inappropriate

        Only empty sub procedures which are automatically created by the IDE should vanish (just like in VB6). If you doubleclick on control but don't put any code into the new procedure it should vanish automatically on compile.

      • Nick RobertsNick Roberts commented  ·   ·  Flag as inappropriate

        Maybe it should be a specific refactoring option, which can be applied to a whole project as well as to a specific class (or file)?

        It could be counteracted in a specific procedure by putting a comment in it? (E.g. a TODO.)

      • Torbjörn GörtzTorbjörn Görtz commented  ·   ·  Flag as inappropriate

        My intention is thas only empty sub procedures which are automatically created by the IDE, when you double click on a control, are going to be removed. On VB6 this type of sub procedures vanish when you run a full debug - and manually created sub procedures are left unchanged. This is exactly the way I want it.

      • PaulPaul commented  ·   ·  Flag as inappropriate

        As long as it's optional! Are we talking about deleting such out of source, or simply not including it in compile/debug? I can't be the only one who often has empty procedure stubs here and there, waiting to get either fleshed out or [manually] deleted.

      Feedback and Knowledge Base