Zulip Chat Archive

Stream: general

Topic: rename a declaration


Johan Commelin (Mar 30 2020 at 07:12):

How hard would it be to ask Lean to replace all occurences of foo.bar.xyzzy with baz.quux? This should also work of the namespace foo, foo.bar, and/or baz has been opened...

Mario Carneiro (Mar 30 2020 at 07:18):

nope

Johan Commelin (Mar 30 2020 at 07:18):

Hmmm.... it's "Mario nope" hard. That's unfortunate.

Johan Commelin (Mar 30 2020 at 07:20):

We have the hover information, and olean files know everything about source locations. So I was hoping that we could run some substitution over the source files...

Mario Carneiro (Mar 30 2020 at 07:20):

you might be able to exploit go to definition support, but that's exactly the sort of thing that not having an external parser causes

Mario Carneiro (Mar 30 2020 at 07:20):

It will require some new lean API

Sebastian Ullrich (Mar 30 2020 at 08:59):

I've actually given some thought to how to do such refactorings in the Lean 3 parser, even without a concrete syntax tree. You could change the scanner to output each read token to some output stream before reading the next token from the input, which gives the parser (which does name resolution in Lean 3) a chance to modify that token before calling into the scanner again...

Mario Carneiro (Mar 30 2020 at 09:23):

Could it send the data to vscode instead? I know vscode / LSP has a rename option, and it seems like file editing is better done there


Last updated: Dec 20 2023 at 11:08 UTC