mirror of
https://github.com/nushell/nushell.git
synced 2025-05-10 13:04:28 +02:00
Merge 6150917c5e
into ff8831318d
This commit is contained in:
commit
c9f7ccef7b
@ -368,13 +368,6 @@ impl EngineState {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_overlay(&self, name: &[u8]) -> bool {
|
|
||||||
self.scope
|
|
||||||
.overlays
|
|
||||||
.iter()
|
|
||||||
.any(|(overlay_name, _)| name == overlay_name)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn active_overlay_ids<'a, 'b>(
|
pub fn active_overlay_ids<'a, 'b>(
|
||||||
&'b self,
|
&'b self,
|
||||||
removed_overlays: &'a [Vec<u8>],
|
removed_overlays: &'a [Vec<u8>],
|
||||||
@ -412,7 +405,7 @@ impl EngineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Translate overlay IDs from other to IDs in self
|
/// Translate overlay IDs from other to IDs in self
|
||||||
pub fn translate_overlay_ids(&self, other: &ScopeFrame) -> Vec<OverlayId> {
|
fn translate_overlay_ids(&self, other: &ScopeFrame) -> Vec<OverlayId> {
|
||||||
let other_names = other.active_overlays.iter().map(|other_id| {
|
let other_names = other.active_overlays.iter().map(|other_id| {
|
||||||
&other
|
&other
|
||||||
.overlays
|
.overlays
|
||||||
@ -520,10 +513,7 @@ impl EngineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "plugin")]
|
#[cfg(feature = "plugin")]
|
||||||
pub fn update_plugin_file(
|
fn update_plugin_file(&self, updated_items: Vec<PluginRegistryItem>) -> Result<(), ShellError> {
|
||||||
&self,
|
|
||||||
updated_items: Vec<PluginRegistryItem>,
|
|
||||||
) -> Result<(), ShellError> {
|
|
||||||
// Updating the signatures plugin file with the added signatures
|
// Updating the signatures plugin file with the added signatures
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ impl<'a> StateWorkingSet<'a> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn move_predecls_to_overlay(&mut self) {
|
fn move_predecls_to_overlay(&mut self) {
|
||||||
let predecls: HashMap<Vec<u8>, DeclId> =
|
let predecls: HashMap<Vec<u8>, DeclId> =
|
||||||
self.delta.last_scope_frame_mut().predecls.drain().collect();
|
self.delta.last_scope_frame_mut().predecls.drain().collect();
|
||||||
|
|
||||||
@ -313,10 +313,6 @@ impl<'a> StateWorkingSet<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn global_span_offset(&self) -> usize {
|
|
||||||
self.permanent_state.next_span_start()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn files(&self) -> impl Iterator<Item = &CachedFile> {
|
pub fn files(&self) -> impl Iterator<Item = &CachedFile> {
|
||||||
self.permanent_state.files().chain(self.delta.files.iter())
|
self.permanent_state.files().chain(self.delta.files.iter())
|
||||||
}
|
}
|
||||||
@ -554,34 +550,6 @@ impl<'a> StateWorkingSet<'a> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn contains_decl_partial_match(&self, name: &[u8]) -> bool {
|
|
||||||
let mut removed_overlays = vec![];
|
|
||||||
|
|
||||||
for scope_frame in self.delta.scope.iter().rev() {
|
|
||||||
for overlay_frame in scope_frame.active_overlays(&mut removed_overlays).rev() {
|
|
||||||
for decl in &overlay_frame.decls {
|
|
||||||
if decl.0.starts_with(name) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for overlay_frame in self
|
|
||||||
.permanent_state
|
|
||||||
.active_overlays(&removed_overlays)
|
|
||||||
.rev()
|
|
||||||
{
|
|
||||||
for decl in &overlay_frame.decls {
|
|
||||||
if decl.0.starts_with(name) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn next_var_id(&self) -> VarId {
|
pub fn next_var_id(&self) -> VarId {
|
||||||
let num_permanent_vars = self.permanent_state.num_vars();
|
let num_permanent_vars = self.permanent_state.num_vars();
|
||||||
VarId::new(num_permanent_vars + self.delta.vars.len())
|
VarId::new(num_permanent_vars + self.delta.vars.len())
|
||||||
@ -850,20 +818,6 @@ impl<'a> StateWorkingSet<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_overlay(&self, name: &[u8]) -> bool {
|
|
||||||
for scope_frame in self.delta.scope.iter().rev() {
|
|
||||||
if scope_frame
|
|
||||||
.overlays
|
|
||||||
.iter()
|
|
||||||
.any(|(overlay_name, _)| name == overlay_name)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
self.permanent_state.has_overlay(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Find the overlay corresponding to `name`.
|
/// Find the overlay corresponding to `name`.
|
||||||
pub fn find_overlay(&self, name: &[u8]) -> Option<&OverlayFrame> {
|
pub fn find_overlay(&self, name: &[u8]) -> Option<&OverlayFrame> {
|
||||||
for scope_frame in self.delta.scope.iter().rev() {
|
for scope_frame in self.delta.scope.iter().rev() {
|
||||||
|
Loading…
Reference in New Issue
Block a user