Git Product home page Git Product logo

forest's People

Contributors

dependabot[bot] avatar tehwalris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

forest's Issues

Children of chain sometimes not transformed

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.

Template literals generate something pretty wrong

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.

Reodering support

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.

Some children don't have shortcut keys

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.

Writing assignments is a lot of work

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.

Show whitespace in strings

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.

Show what a node is

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.

Remove directional navigation

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.

Make wrapping nodes easier

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".

Improve regex literal

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.

"implements" generates to "extends"

To reproduce:

  • write a class which implements an interface in a text file
  • load the file in forest and save it again
  • the "extends" keyword is replaced with "implements"

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.

Not possible to write newline in a string

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.

Can't paste function body into spread

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).

Holes instead of random defaults

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.

Arrow functions must be wrapped in ParenthesizedExpression

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 not shown in text

Flags (access modifiers like "private") are not shown at all in the new text view. They are still loaded and saved correctly.

Make startup faster

The startup of whole editor is slow. This is because all the files are immediately loaded as trees and fully transformed.

"Set from string" on tokens

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-paste is very unreliable

Copy pasting currently only works if:

  • The paste target is a union node
  • There are no transforms around the paste target
  • The subtree being pasted can be built

That means there are plenty of places where it does not work, for example:

  • Plain struct properties (eg. function name)
  • List elements which are not unions (import named binding fields)
  • Flat if branches

The current design of the copy-paste system can't handle these cases without a lot of special-casing code.

Ability to disable transforms on single nodes

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.

"Instant" actions on optinal nodes

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).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.