6
cb219
4d

So fucking exhausting when you have to change many things in a codebase in a repetitive manner with search and replace and it's not worth the time to write a rool to automate it. One of those special cases where you wish search and replace would support some kind of templating or be variable depending on the search result

Comments
  • 4
    Can’t you use refactoring?
  • 5
    Do you use regex in search & replace? It can do wonders.
  • 2
    might be a good job for AI for once

    don't quote me on that. they'd have to actually design it as a feature and they have not

    and you'd still have to go look over every change cuz that thing fucks up so much
  • 2
    also in vscode you can use regex in search and replace btw

    most text editors

    I write those all the time but I have only used them in single files not whole codebases
  • 2
    There's regex

    But also, I wish you could write something like

    Replace every occurrence of

    Pos::Range($range)

    with

    SourceRange::new($range, $source).pos()

    wherein $source is

    - the unique variable in the nearest scope of type Sym or

    - the unique Sym reachable via member access and parameterless immutable functions from variables in scope or

    leave it blank and mark for human review
  • 2
    A semantic replace system like that would have saved me more than an hour today
  • 2
    @Lensflare was not a traditional refactoring job, just a whole bunch of css to edit.
  • 2
    @cafecortado yup, worked a lot with regex, just used the caveman version of that tool, when in fact a way more advanced version existed I didn't know about.
  • 2
    @jestdotty unfortunately only allowed in a very restricted kind of usage, no in-editor AI for now, whole codebase not allowed as context.
  • 1
    Cave people, I can select the whole document, do ctrl+I and describe in English an advanced replace and smash enter. No regex needed. It's called AI (Codeium)
Add Comment