hardhat-vscode icon indicating copy to clipboard operation
hardhat-vscode copied to clipboard

Enhance add license spdx line quickfix

Open kanej opened this issue 2 years ago • 0 comments
trafficstars

To increase the license spdx quickfix to delightful, we should:

  • have excellent defaults - the easiest thing should be the right thing
  • allow users to use obscure licenses

Adding a quickfix per license is straightforward, but makes us want to limit the list to avoid showing 16 license quickfixes (12 that nobody has heard of). The ideal I think would be to scan the project and determine a list of used licenses and show those, combined with a catch all Add a license , that displays a drop down using vscode’s quick pick widget.

If you have only one license in your contracts, then that will appear as the preferred quickfix. If you have no licenses, you can use Add a license and pick from a large set of options (with the most common at the top); from then on you will get that license as the default quickfix for this warning.

A stepping stone to that may be to not scan the project for existing licenses but to save the last picked extension via the Add a license command flow into the extension and display the explicit Add a {saved license} license if it is available:

image

kanej avatar Jan 03 '23 11:01 kanej