Skip to content

twevs/VSCodeStructuredEditing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visual Studio Code structured editing extension for C/C++

This is a fork of the Vim extension with the aim of being, in essence, a rudimentary proof of concept of how clangd might be leveraged to implement structured navigation and editing of C/C++ code. Please read this article for a more thorough explanation of the underlying ideas and motivation for this project as well as how the model it proposes differs from conventional editing.

Disclaimer: this is a project which aimed at nothing more than being a testbed for some notions about an alternative editing paradigm and is not meant to be a finished product or even one that will be actively developed. While enough was done to demonstrate the key ideas and hopefully inspire further discussion on the subject, do not expect something stable or particularly featureful.

Examples of use

Instead of navigating to the previous character, the h key now navigates to the previous sibling of the current AST node (wrapping around if one requests the previous sibling of the first child; note that internal is #defined as static):

previous_sibling_2

Likewise, the l key now navigates not to the next character, but to the following sibling of the current AST node (with the same wraparound behaviour):

next_sibling_2

j is repurposed and no longer goes to the character below, but to the first child of the current node. In the following example, we progressively narrow down our scope from the function to one of its innermost statements, changing siblings along the way as necessary:

child

k meanwhile no longer goes to the character above, but to the parent node. Here, we take the contrary journey, from the statement to the function:

parent

e (for "extract") makes the current node an elder sibling of its parent:

extract

s (for "substitute") replaces the parent node with the current node:

substitute

And x now deletes the current node:

delete

About

⭐ Vim for Visual Studio Code

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.5%
  • Other 0.5%