2
0
Fork 0
mirror of https://github.com/nushell/nushell synced 2025-02-15 21:48:29 +00:00
nushell/tests
Wind def36865ef
Enable reloading changes to a submodule ()
# Description

Fixes: https://github.com/nushell/nushell/issues/12099

Currently if user run `use voice.nu`, and file is unchanged, then run
`use voice.nu` again. nushell will use the module directly, even if
submodule inside `voice.nu` is changed.

After discussed with @kubouch, I think it's ok to re-parse the module
file when:
1. It exports sub modules which are defined by a file
2. It uses other modules which are defined by a file

## About the change:
To achieve the behavior, we need to add 2 attributes to `Module`:
1. `imported_modules`: it tracks the other modules is imported by the
givem `module`, e.g: `use foo.nu`
2. `file`: the path of a module, if a module is defined by a file, it
will be `Some(path)`, or else it will be `None`.

After the change:

    use voice.nu always read the file and parse it.
    use voice will still use the module which is saved in EngineState.

# User-Facing Changes

use `xxx.nu` will read the file and parse it if it exports submodules or
uses submodules

# Tests + Formatting

Done

---------

Co-authored-by: Jakub Žádník <kubouch@gmail.com>
2024-06-25 18:33:37 -07:00
..
assets/nu_json Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
const_ add raw-string literal support () 2024-05-02 09:36:37 -04:00
eval Exit early when encountering parsing errors () 2023-09-05 14:36:37 +02:00
fixtures add some completion tests () 2024-05-23 10:47:06 +08:00
hooks Fix hooks on 0.92.0 () 2024-04-04 09:25:54 +02:00
modules Enable reloading changes to a submodule () 2024-06-25 18:33:37 -07:00
overlays Avoid taking unnecessary ownership of intermediates () 2024-05-04 00:53:15 +00:00
parsing Avoid taking unnecessary ownership of intermediates () 2024-05-04 00:53:15 +00:00
path Avoid taking unnecessary ownership of intermediates () 2024-05-04 00:53:15 +00:00
plugin_persistence Allow plugins to report their own version and store it in the registry () 2024-06-21 06:27:09 -05:00
plugins Allow plugins to report their own version and store it in the registry () 2024-06-21 06:27:09 -05:00
repl Fix usage parsing for commands defined in CRLF (windows) files () 2024-06-23 18:43:05 -05:00
scope Avoid taking unnecessary ownership of intermediates () 2024-05-04 00:53:15 +00:00
shell Make which-support feature non-optional () 2024-06-12 20:04:12 -05:00
main.rs Merged tests to produce a single binary () 2024-05-13 13:37:53 +00:00