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

Add some basic snippets

Open eric-wieser opened this issue 4 years ago • 4 comments

Not sure if these are really all that useful, but though I'd suggest them anyway.

eric-wieser avatar Jul 27 '20 10:07 eric-wieser

I think these could prove to be fairly controversial. You automatically get a lot of text when you type structure. I don't see an easy way to avoid the snippets since you need to type structure as a keyword. Can we add an options in the settings to enable them?

Note that it's also possible to add the snippets to e.g. mathlib.

gebner avatar Jul 27 '20 12:07 gebner

I don't see an easy way to avoid the snippets since you need to type structure as a keyword. Can we add an options in the settings to enable them?

vscode lets you pick between the two options, and uses your last choice as a default:

image

eric-wieser avatar Jul 27 '20 12:07 eric-wieser

Can we add an options in the settings to enable them?

We could, but there are already extensions to manage unwanted snippets like https://github.com/svipas/vscode-control-snippets. https://github.com/Microsoft/vscode/issues/10565 is related.

eric-wieser avatar Jul 27 '20 12:07 eric-wieser

Ok, so I've tried them out a bit.

  • They are not triggered automatically unless you explicitly select them in the dropdown. This is good.
  • The structure snippet does not follow the mathlib style guide. The := should be at the end of the first line. The fields should not be indented.
  • The input abbreviation does not work in snippets. That is, you can't type \nat in a snippet field. :sob:
  • I'm not sure how much they help. The lean syntax does not have much boilerplate. At best I don't have to type := but that's it.

I've posted a thread in the PR reviews stream on zulip.

gebner avatar Jul 27 '20 12:07 gebner