๐Ÿ“Code editing verbs

tags
Editor ยง Programming Projectional Editor

These are common operations performed on code. These are expected to form a vocabulary for code editing. Each example represents one action one wants to perform on the code (in the terms we think of code, not how we currently edit text).

Verbs are different for different programming languages!

  • navigation

    • move to function (by name search)
    • go to definition under cursor
    • search references
  • edit

    • add statement / delete statement
    • move statement up/down
    • extract variable

      variable should be extracted to the closest possible scope (to reduce possibility of side effects)

    • inline variable (reverse of extract variable)

      • should we inline all variable occurrences?
      • should we preserve the original variable?
    • wrapping

      • into parentheses

        • is it natural? why would I do that with structural editing?
      • into function call
      • into JSX element (or fragment)
      • into control structures (if, for, while)
      • into function definition
    • unwrapping (basically same as wrappipng)
    • convert arrow function body to expression/block
    • convert JSXElement to JSXSelfClosingElement and back

      • do reverse automatically if I move into self-closing element?
    • extract function (or component) / inline function
    • move to another module

      steps:

      1. move definition
      2. export it
      3. import dependencies
      4. re-import in the original module
      5. remove unused dependencies from original module
    • attach debug information

      • console.log
      • to react component
    • comment out code (temporary disable code)
    • change JSX element name
    • duplicate function + change name (to modify it later)
    • change expression (while keeping old value visible for reference)
    • add comment (explaining, not comment out code)
    • rename variable or function (with all usages)
  • actions

    • REPL for test
    • google
    • interact with running program

Backlinks