Follow

@technomancy
just watched the structural editing talk, I imagine you already have some ideas on how to do that, but in case it helps here's how the comments in alv are handled (where I have to parse into AST and stringify back with zero changes):

- comments are a kind of whitespace
- forms with N elements optionally store N+1 pieces of whitespace strings (before head, between 1 and 2, 2 and 3, ... after N)
- the document itself is an implicit, parenthesis-less "do" form

@technomancy
you could have a flag for the compiler-parser to keep whitespace and use that whitespace rather than auto-generated one if present.

If you keep the raw string for each token/literal, you can also fix the number thing that way if you want. But not having any string backups has a certain purity that might be your goal 😉

@s_ol thanks! to some degree the goals are still fluid, but I don't think that preserving whitespace will be a goal of the project. in fennel we do have a (comment ...) form which is structured as a list, so for a codebase built entirely with the structured editor, that's an option.

but for using a structured editor to collaborate on a codebase written by people who don't use structural editing... that could get messy. dunno yet.

Sign in to participate in the conversation
Merveilles

Merveilles is a community project aimed at the establishment of new ways of speaking, seeing and organizing information — A culture that seeks augmentation through the arts of engineering and design. A warm welcome to any like-minded people who feel these ideals resonate with them.