Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Add some basic snippets #214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eric-wieser
Copy link
Contributor

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

@gebner
Copy link
Member

gebner commented Jul 27, 2020

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.

@eric-wieser
Copy link
Contributor Author

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
Copy link
Contributor Author

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. microsoft/vscode#10565 is related.

@gebner
Copy link
Member

gebner commented Jul 27, 2020

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. 😭
  • 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.

":=",
"\t${3:(field : sorry)}",
"",
"namespace ${1:}",
Copy link
Contributor

@utensil utensil Jul 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lines below are a little too much. structure should not make too much assumption on the organization after the structure. If this snippet is called theory for boilerplate of developing a theory, maybe it would be OK but there would be much more.

"\t${3:(field : sorry)}",
"",
"namespace ${1:}",
"variables ${2:}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually variables should be declared in a named section.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaring variables in a namespace is fine too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants