scalameta / metals-feature-requests

Issue tracker for Metals feature requests
37 stars 4 forks source link

Allow 'no kind' when creating a new scala file #246

Closed prolativ closed 2 years ago

prolativ commented 2 years ago

Is your feature request related to a problem? Please describe.

When New Scala file action is triggered, a user has to choose the kind of file to create (class/object/enum/...) and then the name of the created file matches the name of the class/object/... (which can only be provided after choosing the file kind).

In some cases however someone might want to define multiple classes/traits/... in one file (out of which none's name would match the name of the file) or just have some top level vals/defs/... there (for scala 3).

It would then make sense to allow easy creation of a scala file without forcing the user to choose a more specific kind of the definition that is supposed to be placed in the file.

Describe the solution you'd like

Add a new option for the kind of file to choose during the file creation wizard called like No kind / Top level definitions / Freestyle / etc. (which could be the default choice) which would create a new scala file with the given name and .scala extension at the desired path containing only the package ... clause.

Describe alternatives you've considered

Currently the possible workarounds are:

Also instead of defining a new file kind this functionality could be provided as a separate action like New blank scala file

Additional contex

No response

Search terms

improvement, new file, quality of life

dos65 commented 2 years ago

I'm not fully sure but it feels like previously the items ordering in context menu in VSCode was different - New Scala File was placed after standard New File. I usually used New File option but from some period I started hitting New Scala File by an accident.