nushell/crates/nu-parser/src
Leonhard Kipp eb3c2c9e76
Add comments to next LiteCommand (#2846)
This commit applied adds comments preceding a command to the LiteCommands new
field `comments`.

This can be usefull for example when defining a function with `def`. Nushell
could pick up the comments and display them when the user types `help my_def_func`.

Example
```shell
def my_echo [arg] { echo $arg }
```
The LiteCommand def will now contain the comments `My echo` and `It's much
better :)`.

The comment is not associated with the next command if there is a (or multiple) newline
between them.
Example
```shell

echo 42
```

This new functionality is similar to DocStrings. One might introduce a special
notation for such DocStrings, so that the parser can differentiate better
between discardable comments and usefull documentation.
2021-01-08 06:14:51 +13:00
..
errors.rs Getting ready for multiline scripts (#2737) 2020-11-10 05:27:07 +13:00
lex.rs Add comments to next LiteCommand (#2846) 2021-01-08 06:14:51 +13:00
lib.rs Document lexer (#2865) 2021-01-07 16:03:00 +13:00
parse.rs Add comments to next LiteCommand (#2846) 2021-01-08 06:14:51 +13:00
path.rs Support completion for paths with multiple dots (#1640) 2020-04-23 16:17:38 +12:00
scope.rs Multiline scripts part 2 (#2795) 2020-12-18 20:53:49 +13:00
shapes.rs Multiline scripts part 2 (#2795) 2020-12-18 20:53:49 +13:00
signature.rs Pipeline blocks (#1579) 2020-04-13 19:59:57 +12:00