tehwalris / forest Goto Github PK
View Code? Open in Web Editor NEWA multi-cursor structural editor prototype for TypeScript
Home Page: https://forest.walr.is
License: MIT License
A multi-cursor structural editor prototype for TypeScript
Home Page: https://forest.walr.is
License: MIT License
When a chain is empty and a single child is added, that child is not affected by other transforms. This is because the chain transform can not be unapplied when there is only one child, so no new transforms are applied to the whole tree.
If the last section of a template literal is not TemplateTail
, then the generated text code is pretty broken. It's very hard to discover that this is what you have to do. This should be handled automatically, maybe combined with a simpler way to work with template literals.
It's possible to reorder nodes in a list manually by using "copy", "delete", navigate, insert sibling above/below and "paste". We could support reordering "natively" by with a shortcuts like "shift-up" and "shift-down" to swap a node with it's sibling. We could also support drag-and-drop.
The first letter of a child's key determines it's shortcut. If the shortcut is already taken, the child gets no shortcut. It can only be accessed via directional navigation, which will probably be removed.
You have to create an ExpressionStatement
, create a BinaryExpression
, set the operator to =
, create an Identifier
and then finally set your value. Assignments are super common, so this should be simplified.
It's possible to enter strings with leading or trailing whitespace (or only whitespace). However when you are browsing the tree, you can't see the whitespace. For example the string " "
looks the same as an empty string.
You have to copy, create, paste each element separately. This is extremely painful.
There's not way to see what type a node has (eg. is currently string literal) and what types a node could have (eg. can be any expression) in the UI. This would be very helpful, especially for new users. The problem is that this information is not explicitly present in the tree either, so that needs to be solved first.
Browsing code without scroll support is very annoying.
Since we have the new navigation system with a key for each child, also having directional navigation is confusing. Directional navigation still makes sense for lists. For other types of nodes it should be removed.
For example auto-suggest making the replaced value a child of the new node after "set variant". That would be equivalent to "copy", "set variant", focus (most common) child and "paste".
You currently have to write the slashes around a regex literal manually, since that's how it is in the TS AST. That's probably because there can also be flags afterwards (like /.../g
). It would be nice to handle flags with separate nodes in the tree. This would allow us to automatically add the slashes to the body of the regex.
To reproduce:
This seems like it will require special handling to fix, because of this type:
token: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword
The problem is that the values of this property are not ts.Node
. There are 1-2 more cases like this in other parts of the AST.
It's not possible to write escapes in a string (eg. \n
), since everything is escaped automatically. The problem is that since the input box is single-line, there's absolutely no way to write a string with a newline. There are also other escapes which we might want to support, but it's not clear what the UX should be.
It's not possible to paste function bodies into places where the body is spread. For example, you can't paste over the body of a meta level transformed function declaration. The reason for this is a different from #11 - there just is not a clear node which you could paste over, since there is no node for the function body if the function body is spread (only one for the function itself, and some for the children of the function body).
For example have a ("required") hole as the target of a call expression instead of the blank identifier which is currently inserted there.
This is also relevant for creating new children (using "ctrl-right"). We could insert holes as the children instead of random defaults. An alternative approach here would be to force the user to always choose a type when creating the node.
Both of these things can be used in a type position. What's the difference? Maybe only one should be allowed. This also causes problems because of conflicting shortcuts.
There are some locations where arrow functions have to be wrapped in ParenthesizedExpression
. This makes them really hard to find sometimes. ArrowFunction
should be available anywhere where ParenthesizedExpression
is allowed, and parenthesizing should be automatic.
Flags (access modifiers like "private") are not shown at all in the new text view. They are still loaded and saved correctly.
The startup of whole editor is slow. This is because all the files are immediately loaded as trees and fully transformed.
To set a token (for example the operator in a BinaryExpression
), you have to use "set variant". This seems pretty arbitrary to users - why not "set from string" instead? We should consider allowing both, or having a unified UI.
Copy pasting currently only works if:
That means there are plenty of places where it does not work, for example:
The current design of the copy-paste system can't handle these cases without a lot of special-casing code.
Currently the only way to disable specific transforms is in the code "at compile time". There's also no way to disable transforms only at a specific point in the tree. New transform system designs should consider letting the user disable individual transforms at individual locations in the tree.
Often you have an optional node which does nothing useful when set to None
, which you have to toggle before you can do anything with it (for example a missing function body). Maybe it should be always be possible to perform those actions, and the node will be toggled automatically if needed? Or maybe we should get rid of optional all together in some places (like function names, where blank could be equivalent to missing). Or we could make None
just another entry in a union (for example no function body vs block).
Both of these things can be used in a type position. What's the difference? Maybe only one should be allowed.
The chain transform was meant to support function calls too. They currently aren't supported, because the transform is a huge pain to write.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.