Zulip Chat Archive

Stream: job postings

Topic: Refactorings for Lean code


Denis Gorbachev (Aug 03 2023 at 08:46):

Hi!

Is anyone interested in doing a paid project implementing refactorings for Lean code? Specifically:

  • Move the definition to another file
  • Rename a local variable
  • Auto-import a definition

I hope those functions would be helpful for every Lean programmer, and I'm willing to pay for the implementation.

Scott Morrison (Aug 03 2023 at 20:29):

You might be interested in the #find_home and #minimize_imports commands. Unfortunately both are buggy at the point, but fixing them is on my to-do list.

Scott Morrison (Aug 03 2023 at 20:29):

Hopefully they could be helpful to drive actual VSCode code actions.

Bolton Bailey (Aug 12 2023 at 19:04):

I would like there to be some kind of "extract lemma" code action which takes the proof state at a particular point, and creates a new sorried lemma immediately above the theorem in question with all of the hypotheses as arguments and the goal as a conclusion.

Kayla Thomas (Aug 12 2023 at 19:14):

(deleted)

Kayla Thomas (Aug 12 2023 at 19:15):

(deleted)

Kayla Thomas (Aug 12 2023 at 19:15):

Bolton Bailey said:

I would like there to be some kind of "extract lemma" code action which takes the proof state at a particular point, and creates a new sorried lemma immediately above the theorem in question with all of the hypotheses as arguments and the goal as a conclusion.

https://leanprover-community.github.io/mathlib4_docs/Mathlib/Tactic/ExtractGoal.html#extractGoal

Denis Gorbachev (Aug 24 2023 at 05:37):

PSA: The Lean 4 Code Actions is now available on VSCode marketplace: https://marketplace.visualstudio.com/items?itemName=denis-gorbachev.lean4-code-actions

Eric Wieser (Aug 24 2023 at 10:31):

regarding the sibling package https://marketplace.visualstudio.com/items?itemName=denis-gorbachev.lean4-language-configuration; making ` an auto-closing bracket is likely pretty annoying for meta code, where the unmatched `(tactic| foo ) is common

Denis Gorbachev (Aug 24 2023 at 10:44):

Yes, that's exactly the reason it's in a separate extension.

The rationale for making ` an auto-closing bracket was to simplify writing docstrings in Markdown, where two backticks wrap the inline code. Ideally, the IDE should auto-close ` in docstrings but not in actual code.

Not sure how to resolve this - feel free to suggest.

Eric Wieser (Aug 24 2023 at 14:39):

Ideally you would add it here

Eric Wieser (Aug 24 2023 at 14:46):

Aha, I've tracked it down to https://github.com/microsoft/vscode/issues/133397

Denis Gorbachev (Aug 25 2023 at 02:55):

Yeah, still an open issue...

Denis Gorbachev (Aug 25 2023 at 02:57):

Eric Wieser said:

Ideally you would add it here

We only have access to LanguageConfiguration from 'vscode' package, and autoClosingPairs are deprecated there.

I've already extracted whatever was possible to extract to code in languageConfiguration.ts


Last updated: Dec 20 2023 at 11:08 UTC