Fix cursor focus and selection in input box, add AWS env var warning box, and remove AWS Bedrock login banner
This commit is contained in:
@@ -15,7 +15,6 @@ use galaxy_util::path::{EscapeChar, ShellFamily};
|
||||
use galaxyui::platform::OperatingSystem;
|
||||
use smol_str::SmolStr;
|
||||
use typed_path::{TypedPath, TypedPathBuf};
|
||||
use galaxyui_core::platform::OperatingSystem;
|
||||
|
||||
use super::engine::EngineDirEntry;
|
||||
use crate::completer::TopLevelCommandCaseSensitivity;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use async_trait::async_trait;
|
||||
use galaxy_js::{JsFunctionId, SerializedJsValue, TypedJsFunctionRef};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
use galaxy_js::{JsFunctionId, SerializedJsValue, TypedJsFunctionRef};
|
||||
|
||||
#[derive(thiserror::Error, Debug)]
|
||||
pub enum JsExecutionError {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use galaxyui::platform::OperatingSystem;
|
||||
use itertools::Itertools;
|
||||
use string_offset::ByteOffset;
|
||||
use galaxyui_core::platform::OperatingSystem;
|
||||
|
||||
use super::context::CompletionContext;
|
||||
use super::suggest::{suggestions, CompleterOptions, CompletionsFallbackStrategy, SuggestionType};
|
||||
|
||||
@@ -250,28 +250,26 @@ async fn suggestions_for_parse_error(
|
||||
ParseErrorReason::ArgumentError {
|
||||
command: _,
|
||||
error: UnexpectedArgument(arg),
|
||||
} => {
|
||||
if arg.span.end() == line.len() {
|
||||
// The unexpected argument could be a prefix for a subcommand.
|
||||
let prefix = arg.item.as_str();
|
||||
let results = (signature.subcommands().iter().filter_map(|subcmd| {
|
||||
options
|
||||
.match_strategy
|
||||
.get_match_type(prefix, subcmd.name())
|
||||
.map(|match_type| {
|
||||
let suggestion = Suggestion::with_same_display_and_replacement(
|
||||
subcmd.name.clone(),
|
||||
subcmd.description.as_ref().cloned(),
|
||||
SuggestionType::Subcommand,
|
||||
subcmd.priority.into(),
|
||||
);
|
||||
MatchedSuggestion::new(suggestion, match_type)
|
||||
})
|
||||
}))
|
||||
.sorted_by(MatchedSuggestion::cmp_by_display)
|
||||
.collect();
|
||||
return (results, false);
|
||||
}
|
||||
} if arg.span.end() == line.len() => {
|
||||
// The unexpected argument could be a prefix for a subcommand.
|
||||
let prefix = arg.item.as_str();
|
||||
let results = (signature.subcommands().iter().filter_map(|subcmd| {
|
||||
options
|
||||
.match_strategy
|
||||
.get_match_type(prefix, subcmd.name())
|
||||
.map(|match_type| {
|
||||
let suggestion = Suggestion::with_same_display_and_replacement(
|
||||
subcmd.name.clone(),
|
||||
subcmd.description.as_ref().cloned(),
|
||||
SuggestionType::Subcommand,
|
||||
subcmd.priority.into(),
|
||||
);
|
||||
MatchedSuggestion::new(suggestion, match_type)
|
||||
})
|
||||
}))
|
||||
.sorted_by(MatchedSuggestion::cmp_by_display)
|
||||
.collect();
|
||||
return (results, false);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@@ -55,8 +55,7 @@ pub async fn complete(
|
||||
.into_iter()
|
||||
.chain(
|
||||
sorted_directories_relative_to(parsed_token, matcher, path_completion_context)
|
||||
.await
|
||||
.into_iter(),
|
||||
.await,
|
||||
)
|
||||
.collect();
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@ use std::fs::DirEntry;
|
||||
use std::sync::Arc;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use galaxy_util::path::{ShellFamily, HOME_DIR_ENV_VAR_PREFIX};
|
||||
use itertools::{iproduct, Itertools};
|
||||
use lazy_static::lazy_static;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use typed_path::{TypedPath, TypedPathBuf};
|
||||
use warp_command_signatures::{IconType, PathSuggestionType};
|
||||
use galaxy_util::path::{ShellFamily, HOME_DIR_ENV_VAR_PREFIX};
|
||||
|
||||
use crate::completer::context::{PathCompletionContext, PathSeparators};
|
||||
use crate::completer::matchers::MatchStrategy;
|
||||
|
||||
@@ -203,7 +203,8 @@ pub fn test_expand_command_aliases_should_not_expand_if_no_space_after_alias() {
|
||||
assert!(result.signature_for_completions.is_none());
|
||||
|
||||
// The test signature has an alias function which expands subcommand "twelve" to "one", but there's no trailing space so we shouldn't expand.
|
||||
let result = galaxyui_core::r#async::block_on(expand_command_aliases("test twelve", false, &ctx));
|
||||
let result =
|
||||
galaxyui_core::r#async::block_on(expand_command_aliases("test twelve", false, &ctx));
|
||||
assert_eq!(result.expanded_command_line, "test twelve");
|
||||
assert_eq!(result.tokens_from_command, vec!["test", "twelve"]);
|
||||
// "twelve" isn't a valid subcommand, so we should use the "test" signature.
|
||||
@@ -218,8 +219,11 @@ pub fn test_expand_command_aliases_should_not_expand_if_no_space_after_alias() {
|
||||
);
|
||||
|
||||
// We have a top-level aliasForTest which expands to test. But the test signature does not expand "twelve" to "one" because there's no trailing space.
|
||||
let result =
|
||||
galaxyui_core::r#async::block_on(expand_command_aliases("aliasForTest twelve", false, &ctx));
|
||||
let result = galaxyui_core::r#async::block_on(expand_command_aliases(
|
||||
"aliasForTest twelve",
|
||||
false,
|
||||
&ctx,
|
||||
));
|
||||
assert_eq!(result.expanded_command_line, "test twelve");
|
||||
assert_eq!(result.tokens_from_command, vec!["test", "twelve"]);
|
||||
// "twelve" isn't a valid subcommand, so we should use the "test" signature.
|
||||
|
||||
@@ -10,12 +10,12 @@ use std::hash::{Hash, Hasher};
|
||||
|
||||
use alias::{expand_command_aliases, AliasExpansionResult};
|
||||
use async_recursion::async_recursion;
|
||||
use galaxy_core::ui::theme::AnsiColorIdentifier;
|
||||
use imp::*;
|
||||
use itertools::Itertools;
|
||||
pub use priority::Priority;
|
||||
use smol_str::SmolStr;
|
||||
use warp_command_signatures::IconType;
|
||||
use galaxy_core::ui::theme::AnsiColorIdentifier;
|
||||
|
||||
use super::coalesce::coalesce_completion_results;
|
||||
use super::context::CompletionContext;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use warp_command_signatures::{Importance, Order, Priority as OldPriority};
|
||||
|
||||
use super::{Priority, MAX_PRIORITY, MIN_PRIORITY};
|
||||
|
||||
#[test]
|
||||
@@ -41,7 +43,6 @@ fn test_priority_comparison() {
|
||||
/// `warp_command_signatures`.
|
||||
#[test]
|
||||
fn test_new_to_old_priority() {
|
||||
use warp_command_signatures::{Importance, Order, Priority as OldPriority};
|
||||
assert_eq!(
|
||||
OldPriority::from(Priority::new(MIN_PRIORITY)),
|
||||
OldPriority::Global(Importance::Less(Order(1))),
|
||||
@@ -82,7 +83,6 @@ fn test_new_to_old_priority() {
|
||||
/// `warp_command_signatures` to the new Priority.
|
||||
#[test]
|
||||
fn test_old_to_new_priority() {
|
||||
|
||||
assert_eq!(
|
||||
Priority::from(OldPriority::Global(Importance::Less(Order(1)))),
|
||||
Priority::new(MIN_PRIORITY)
|
||||
|
||||
@@ -6,10 +6,10 @@ mod lexer;
|
||||
mod parser;
|
||||
mod token;
|
||||
|
||||
use galaxy_util::path::EscapeChar;
|
||||
use lexer::Lexer;
|
||||
use parser::Parser;
|
||||
use string_offset::ByteOffset;
|
||||
use galaxy_util::path::EscapeChar;
|
||||
|
||||
use crate::parsers::LiteCommand;
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ fn is_valid_command_separator(token: &Token) -> bool {
|
||||
///
|
||||
/// This includes all of the separator tokens as well as the grouping tokens
|
||||
fn is_command_terminator(token: &Token) -> bool {
|
||||
|
||||
use Token::*;
|
||||
is_valid_command_separator(token)
|
||||
|| matches!(token, OpenParen | CloseParen | OpenCurly | CloseCurly)
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
//! `galaxy_completer::signatures::CommandSignature`s, as well as `IntoWarpJs` implementations for
|
||||
//! Rust structs that may be passed to JS functions defined on the Command Signature (e.g.
|
||||
//! `GeneratorCompletionContext`).
|
||||
use rquickjs::{FromJs, Function, Object, Value};
|
||||
use galaxy_js::util::{
|
||||
get_one_or_more_optional, get_one_or_more_required, get_optional, get_required,
|
||||
};
|
||||
use galaxy_js::{FromWarpJs, IntoWarpJs, JsFunctionRegistry};
|
||||
use rquickjs::{FromJs, Function, Object, Value};
|
||||
|
||||
use super::{
|
||||
Argument, ArgumentValue, Command, CommandSignature, GeneratorCompletionContext, GeneratorFn,
|
||||
|
||||
Reference in New Issue
Block a user