forked from extern/nushell
Adds multi-file support to IDE support (#8857)
# Description This adds multi-file support to the in-progress IDE support. The main new features are a `-I` flag that allows you to add a new source search path when starting up the nu binary, and fixes for the current IDE support to support spans in other files. This needs accompanying fixes to the vscode/lsp implementation to pass along the project directory via `-I`. UPDATE: Marking this draft until we have a means to test this. # User-Facing Changes _(List of all changes that impact the user experience here. This helps us keep track of breaking changes.)_ # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass - `cargo run -- crates/nu-std/tests/run.nu` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date.
This commit is contained in:
@ -1719,7 +1719,8 @@ pub fn parse_use(working_set: &mut StateWorkingSet, spans: &[Span]) -> (Pipeline
|
||||
};
|
||||
|
||||
if let Ok(contents) = std::fs::read(&module_path) {
|
||||
let file_id = working_set.add_file(module_filename, &contents);
|
||||
let file_id =
|
||||
working_set.add_file(module_path.to_string_lossy().to_string(), &contents);
|
||||
let new_span = working_set.get_span_for_file(file_id);
|
||||
|
||||
// Change the currently parsed directory
|
||||
|
@ -5813,7 +5813,12 @@ pub fn parse(
|
||||
scoped: bool,
|
||||
) -> Block {
|
||||
let name = match fname {
|
||||
Some(fname) => fname.to_string(),
|
||||
Some(fname) => {
|
||||
// use the canonical name for this filename
|
||||
nu_path::expand_to_real_path(fname)
|
||||
.to_string_lossy()
|
||||
.to_string()
|
||||
}
|
||||
None => "source".to_string(),
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user