Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

feat: Third pass aligning core experience with IntelliJ IDEA

l0ng-ai1e00ea5ee2d1
diff --git a/Cargo.lock b/Cargo.lock
index 95edba8b9..2f6385208 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4061,6 +4061,7 @@ dependencies = [
"serde",
"serde_json",
"specta",
+ "tempfile",
"tracing",
"which",
]
@@ -4248,6 +4249,7 @@ dependencies = [
"ide-core",
"libc",
"parking_lot",
+ "portable-pty",
"serde",
"serde_json",
"specta",
@@ -4266,6 +4268,7 @@ dependencies = [
"ide-core",
"ide-language",
"ide-run",
+ "ide-vfs",
"serde",
"serde_json",
"specta",
@@ -4285,6 +4288,7 @@ dependencies = [
"grep-regex",
"grep-searcher",
"ide-core",
+ "ide-vfs",
"ignore",
"insta",
"memchr",
@@ -4294,6 +4298,18 @@ dependencies = [
"tracing",
]
+[[package]]
+name = "ide-spell"
+version = "0.1.13"
+dependencies = [
+ "ide-core",
+ "parking_lot",
+ "serde",
+ "specta",
+ "spellbook",
+ "tracing",
+]
+
[[package]]
name = "ide-syntax"
version = "0.1.13"
@@ -4389,6 +4405,7 @@ dependencies = [
"tempfile",
"tracing",
"trash",
+ "zip 2.4.2",
]
[[package]]
@@ -4426,6 +4443,7 @@ dependencies = [
"toml 0.9.12+spec-1.1.0",
"toml_edit 0.25.17+spec-1.1.0",
"tracing",
+ "zip 2.4.2",
]
[[package]]
@@ -5854,6 +5872,7 @@ dependencies = [
"ide-run",
"ide-sdk",
"ide-search",
+ "ide-spell",
"ide-syntax",
"ide-terminal",
"ide-text",
@@ -7719,6 +7738,16 @@ dependencies = [
"specta",
]
+[[package]]
+name = "spellbook"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0d204abcbdf8e88729306a8d0ca01a79d8a49969fe1f84696909d6dbc4321c1a"
+dependencies = [
+ "foldhash",
+ "hashbrown 0.17.1",
+]
+
[[package]]
name = "spin"
version = "0.9.9"
diff --git a/Cargo.toml b/Cargo.toml
index f35896bab..b86fffa9d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,6 +33,7 @@ ide-profiler = { path = "crates/ide-profiler" }
ide-http = { path = "crates/ide-http" }
ide-db = { path = "crates/ide-db" }
ide-web = { path = "crates/ide-web" }
+ide-spell = { path = "crates/ide-spell" }
# serialization & IPC typing
serde = { version = "1", features = ["derive"] }
diff --git a/THIRD_PARTY_LICENSES.md b/THIRD_PARTY_LICENSES.md
index 46787cba9..7d02d1e7b 100644
--- a/THIRD_PARTY_LICENSES.md
+++ b/THIRD_PARTY_LICENSES.md
@@ -79,6 +79,15 @@ user's app-data directory only when the user asks; none of them ships with OpenI
unmodified, and its source is available from the repository above.
- **Eclipse JDT Language Server** (jdtls): EPL-2.0, from download.eclipse.org.
+## en_US Hunspell dictionary
+
+`crates/ide-spell/src/dict/en_US.{aff,dic}` (the spell checker's bundled dictionary) is the
+SCOWL-derived en_US Hunspell dictionary (version 2020.12.07, from the `dictionary-en` npm
+package 4.0.0), copied unmodified. Copyright Kevin Atkinson and the SCOWL / Hunspell
+dictionary contributors; MIT- and BSD-style licences, full text in
+`crates/ide-spell/src/dict/LICENSE-en_US`. It is checked with the
+[spellbook](https://github.com/helix-editor/spellbook) crate (MPL-2.0).
+
## nvim-treesitter queries
`crates/ide-syntax/queries/<grammar>/locals.scm` are derived from the `locals.scm`
diff --git a/crates/ide-build/src/compile/mod.rs b/crates/ide-build/src/compile/mod.rs
index 8d62d8e76..2d4d0b92e 100644
--- a/crates/ide-build/src/compile/mod.rs
+++ b/crates/ide-build/src/compile/mod.rs
@@ -584,6 +584,7 @@ pub fn diagnostics(messages: &[BuildMessage]) -> BTreeMap<PathBuf, Vec<Diagnosti
code: m.code.clone(),
unnecessary: false,
deprecated: false,
+ server: Some(DIAGNOSTICS_SOURCE.to_owned()),
});
}
out
diff --git a/crates/ide-build/src/gradle.rs b/crates/ide-build/src/gradle.rs
index a0e8661ae..529ed6803 100644
--- a/crates/ide-build/src/gradle.rs
+++ b/crates/ide-build/src/gradle.rs
@@ -285,6 +285,74 @@ pub fn script_java_version(text: &str) -> Option<u32> {
None
}
+/// Configurations whose dependencies are libraries (`testFixturesImplementation` ends in one).
+const DEPENDENCY_CONFIGURATIONS: &[&str] = &[
+ "implementation",
+ "api",
+ "compileOnly",
+ "runtimeOnly",
+ "compileOnlyApi",
+ "annotationProcessor",
+ "kapt",
+ "ksp",
+ "compile",
+ "runtime",
+ "testCompile",
+ "testRuntime",
+ "developmentOnly",
+];
+
+fn is_dependency_configuration(name: &str) -> bool {
+ DEPENDENCY_CONFIGURATIONS.iter().any(|c| {
+ name == *c || {
+ let mut cap = c.chars();
+ let first = cap.next().map(|f| f.to_ascii_uppercase()).into_iter();
+ let capitalised: String = first.chain(cap).collect();
+ name.len() > c.len() && name.ends_with(&capitalised)
+ }
+ })
+}
+
+/// `(group, artifact, version)` of the external dependencies a build script declares:
+/// `implementation 'g:a:v'`, `api("g:a:v:classifier@jar")`, and the map notation
+/// `implementation group: 'g', name: 'a', version: 'v'` (Groovy) / `group = "g", …` (Kotlin).
+/// Versions with interpolations, ranges and catalog aliases (`libs.x`) are skipped.
+pub fn script_dependencies(text: &str) -> Vec<(String, String, String)> {
+ let text = strip_comments(text);
+ let mut out = Vec::new();
+ for line in text.lines().flat_map(|l| l.split(['{', ';'])) {
+ let line = line.trim_start();
+ let name: String = line.chars().take_while(|c| c.is_ascii_alphanumeric() || *c == '_').collect();
+ if name.is_empty() || !is_dependency_configuration(&name) {
+ continue;
+ }
+ let rest = &line[name.len()..];
+ let lits = literals(rest);
+ let map_value = |key: &str| -> Option<String> {
+ let i = rest.find(key)?;
+ let after = rest[i + key.len()..].trim_start().strip_prefix([':', '='])?;
+ literals(after).into_iter().next()
+ };
+ let coordinate = match (map_value("group"), map_value("name"), map_value("version")) {
+ (Some(g), Some(a), Some(v)) => Some((g, a, v)),
+ _ => lits.first().and_then(|l| {
+ let l = l.split('@').next().unwrap_or(l);
+ let mut parts = l.split(':');
+ Some((parts.next()?.to_owned(), parts.next()?.to_owned(), parts.next()?.to_owned()))
+ }),
+ };
+ if let Some((g, a, v)) = coordinate {
+ let plain = |s: &str| {
+ !s.is_empty() && s.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '.' | '-' | '_' | '+'))
+ };
+ if plain(&g) && plain(&a) && plain(&v) && !v.contains('+') {
+ out.push((g, a, v));
+ }
+ }
+ }
+ out
+}
+
/// Every settings and build script of the model (for change detection).
pub fn build_files(root: &Path, model: &GradleModel) -> Vec<PathBuf> {
let dir = root.join(&model.dir);
@@ -333,6 +401,38 @@ pub fn parse_tasks(output: &str) -> Vec<(String, GradleTask)> {
#[cfg(test)]
mod tests {
+ #[test]
+ fn script_dependencies_read_string_and_map_notations() {
+ let script = r#"
+plugins { id 'java' }
+dependencies {
+ implementation 'com.google.guava:guava:33.0.0-jre'
+ api("org.slf4j:slf4j-api:2.0.9")
+ testImplementation "junit:junit:4.13.2@jar"
+ // implementation 'commented:out:1.0'
+ compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.30'
+ runtimeOnly(group = "com.h2database", name = "h2", version = "2.2.224")
+ implementation "org.x:dyn:${ver}"
+ implementation 'org.x:range:1.+'
+ implementation libs.okhttp
+ implementation project(':core')
+ classpath 'not:a:library'
+}
+"#;
+ let deps = script_dependencies(script);
+ let names: Vec<String> = deps.iter().map(|(g, a, v)| format!("{g}:{a}:{v}")).collect();
+ assert_eq!(
+ names,
+ [
+ "com.google.guava:guava:33.0.0-jre",
+ "org.slf4j:slf4j-api:2.0.9",
+ "junit:junit:4.13.2",
+ "org.projectlombok:lombok:1.18.30",
+ "com.h2database:h2:2.2.224",
+ ]
+ );
+ }
+
use super::*;
#[test]
diff --git a/crates/ide-build/src/lib.rs b/crates/ide-build/src/lib.rs
index 726aa7b75..db686b0f7 100644
--- a/crates/ide-build/src/lib.rs
+++ b/crates/ide-build/src/lib.rs
@@ -50,6 +50,56 @@ pub fn load(root: &Path, cache_dir: &Path, maven_repo: Option<PathBuf>) -> Build
BuildModel { maven, gradle }
}
+/// A library the project depends on, as `groupId:artifactId:version`.
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub struct DependencyCoordinate {
+ /// Gradle builds resolve into the Gradle cache, Maven ones into the local repository.
+ pub gradle: bool,
+ pub group_id: String,
+ pub artifact_id: String,
+ pub version: String,
+}
+
+/// The external libraries of `model`, sorted and deduplicated: Maven dependencies
+/// (with the transitive ones the last sync read), except the build's own modules,
+/// `pom` imports and `system` scope; dependencies declared in the Gradle build scripts.
+pub fn dependency_coordinates(root: &Path, model: &BuildModel) -> Vec<DependencyCoordinate> {
+ let mut out = Vec::new();
+ if let Some(m) = &model.maven {
+ let modules: std::collections::HashSet<String> = m.projects.iter().map(MavenProject::key).collect();
+ let mut stack: Vec<&MavenDependency> = m.projects.iter().flat_map(|p| &p.dependencies).collect();
+ while let Some(d) = stack.pop() {
+ stack.extend(&d.children);
+ let Some(version) = d.version.as_deref().filter(|v| !v.is_empty() && !v.contains("${")) else {
+ continue;
+ };
+ if d.kind == "pom" || matches!(d.scope.as_str(), "import" | "system") {
+ continue;
+ }
+ if modules.contains(&format!("{}:{}", d.group_id, d.artifact_id)) {
+ continue;
+ }
+ out.push(DependencyCoordinate {
+ gradle: false,
+ group_id: d.group_id.clone(),
+ artifact_id: d.artifact_id.clone(),
+ version: version.to_owned(),
+ });
+ }
+ }
+ if let Some(g) = &model.gradle {
+ for script in g.projects.iter().filter_map(|p| p.build_file.as_ref()) {
+ let Ok(text) = std::fs::read_to_string(root.join(script)) else { continue };
+ out.extend(gradle::script_dependencies(&text).into_iter().map(|(group_id, artifact_id, version)| {
+ DependencyCoordinate { gradle: true, group_id, artifact_id, version }
+ }));
+ }
+ }
+ out.sort();
+ out.dedup();
+ out
+}
+
/// Whether a created / changed / removed project-relative path can change the build model.
pub fn affects_build(rel: &Path) -> bool {
let Some(name) = rel.file_name().and_then(|n| n.to_str()) else { return false };
@@ -78,4 +128,43 @@ mod tests {
assert!(affects_build(Path::new("a/pom.xml")) && affects_build(Path::new("settings.gradle.kts")));
assert!(!affects_build(Path::new("src/Main.java")));
}
+
+ #[test]
+ fn dependency_coordinates_flatten_maven_trees_and_read_gradle_scripts() {
+ let tmp = tempfile::tempdir().unwrap();
+ let root = tmp.path();
+ std::fs::write(root.join("build.gradle"), "dependencies { implementation 'org.a:x:1.0' }\n").unwrap();
+ let dep = |g: &str, a: &str, v: Option<&str>, children: Vec<MavenDependency>| MavenDependency {
+ group_id: g.into(),
+ artifact_id: a.into(),
+ version: v.map(Into::into),
+ kind: "jar".into(),
+ scope: "compile".into(),
+ children,
+ ..Default::default()
+ };
+ let maven = MavenModel {
+ projects: vec![
+ MavenProject {
+ group_id: "me".into(),
+ artifact_id: "app".into(),
+ dependencies: vec![
+ dep("me", "core", Some("1"), vec![]),
+ dep("org.b", "y", Some("2"), vec![dep("org.c", "z", Some("3"), vec![])]),
+ dep("org.d", "unresolved", Some("${v}"), vec![]),
+ ],
+ ..Default::default()
+ },
+ MavenProject { group_id: "me".into(), artifact_id: "core".into(), ..Default::default() },
+ ],
+ ..Default::default()
+ };
+ let gradle = gradle::load(root);
+ let model = BuildModel { maven: Some(maven), gradle };
+ let names: Vec<String> = dependency_coordinates(root, &model)
+ .into_iter()
+ .map(|c| format!("{}{}:{}:{}", if c.gradle { "G " } else { "M " }, c.group_id, c.artifact_id, c.version))
+ .collect();
+ assert_eq!(names, ["M org.b:y:2", "M org.c:z:3", "G org.a:x:1.0"]);
+ }
}
diff --git a/crates/ide-core/src/editor_settings.rs b/crates/ide-core/src/editor_settings.rs
index 8bf44084e..68b674e60 100644
--- a/crates/ide-core/src/editor_settings.rs
+++ b/crates/ide-core/src/editor_settings.rs
@@ -117,6 +117,12 @@ pub struct CompletionSettings {
pub auto_popup: bool,
/// Insert the selected suggestion by pressing space, dot, or other context-dependent keys.
pub insert_on_special_keys: bool,
+ /// Insert a sole suggestion of explicit (⌃Space) completion right away.
+ pub auto_insert_single: bool,
+ /// Sort suggestions by name instead of relevance.
+ pub sort_alphabetically: bool,
+ /// Add `()` after function and method suggestions.
+ pub insert_parentheses: bool,
pub show_documentation: bool,
pub documentation_delay: u32,
pub parameter_info: bool,
@@ -130,6 +136,9 @@ impl Default for CompletionSettings {
case_sensitivity: "first".into(),
auto_popup: true,
insert_on_special_keys: false,
+ auto_insert_single: true,
+ sort_alphabetically: false,
+ insert_parentheses: true,
show_documentation: false,
documentation_delay: 500,
parameter_info: true,
@@ -166,13 +175,22 @@ impl Default for FoldingSettings {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
#[serde(default, rename_all = "camelCase")]
pub struct EditorTabsSettings {
- /// `top` | `none`.
+ /// `top` | `bottom` | `none`.
pub placement: String,
pub multiple_rows: bool,
+ /// One row that doesn't fit: `scroll` the tabs panel | `squeeze` the tabs.
+ pub one_row_overflow: String,
+ pub pinned_separate_row: bool,
+ pub show_file_icon: bool,
pub show_extension: bool,
+ pub show_directory_for_non_unique: bool,
/// Mark modified tabs with an asterisk.
pub mark_modified: bool,
+ pub show_full_path_on_hover: bool,
pub show_close_button: bool,
+ /// `right` | `left` (with `show_close_button`).
+ pub close_button_position: String,
+ pub sort_alphabetically: bool,
pub preview_tab: bool,
pub open_at_end: bool,
pub tab_limit: u32,
@@ -187,9 +205,16 @@ impl Default for EditorTabsSettings {
Self {
placement: "top".into(),
multiple_rows: false,
+ one_row_overflow: "scroll".into(),
+ pinned_separate_row: false,
+ show_file_icon: true,
show_extension: true,
+ show_directory_for_non_unique: true,
mark_modified: false,
+ show_full_path_on_hover: true,
show_close_button: true,
+ close_button_position: "right".into(),
+ sort_alphabetically: false,
preview_tab: true,
open_at_end: false,
tab_limit: 30,
@@ -275,11 +300,38 @@ pub struct InlayHintsSettings {
pub disabled_languages: Vec<String>,
/// Code vision: usages above declarations.
pub code_vision_usages: bool,
+ /// Code vision: last author of a declaration (VCS blame) beside its usages.
+ pub code_vision_author: bool,
}
impl Default for InlayHintsSettings {
fn default() -> Self {
- Self { types: true, parameters: true, other: true, disabled_languages: Vec::new(), code_vision_usages: true }
+ Self {
+ types: true,
+ parameters: true,
+ other: true,
+ disabled_languages: Vec::new(),
+ code_vision_usages: true,
+ code_vision_author: true,
+ }
+ }
+}
+
+/// Editor › General › Inline Completion: ghost text from language servers that
+/// support `textDocument/inlineCompletion` (LSP 3.18).
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
+#[serde(default, rename_all = "camelCase")]
+pub struct InlineCompletionSettings {
+ pub enabled: bool,
+ /// Ask only once typing has paused for `pause_ms`, instead of right after each change.
+ pub only_on_pause: bool,
+ pub pause_ms: u32,
+ pub disabled_languages: Vec<String>,
+}
+
+impl Default for InlineCompletionSettings {
+ fn default() -> Self {
+ Self { enabled: true, only_on_pause: false, pause_ms: 500, disabled_languages: Vec::new() }
}
}
@@ -335,6 +387,14 @@ pub struct CodeStyleSettings {
/// Enable EditorConfig support.
pub editorconfig: bool,
pub languages: BTreeMap<String, LanguageCodeStyle>,
+ /// Formatter › Do not format: globs (`*.min.js`, `generated/**`) Reformat Code skips.
+ pub do_not_format: Vec<String>,
+ /// Formatter › Turn formatter on/off with markers in code comments.
+ pub formatter_tags_enabled: bool,
+ pub formatter_off_tag: String,
+ pub formatter_on_tag: String,
+ /// The markers are regular expressions.
+ pub formatter_tags_regexp: bool,
}
impl Default for CodeStyleSettings {
@@ -346,6 +406,11 @@ impl Default for CodeStyleSettings {
detect_indents: true,
editorconfig: true,
languages: BTreeMap::new(),
+ do_not_format: Vec::new(),
+ formatter_tags_enabled: false,
+ formatter_off_tag: "@formatter:off".into(),
+ formatter_on_tag: "@formatter:on".into(),
+ formatter_tags_regexp: false,
}
}
}
diff --git a/crates/ide-core/src/event.rs b/crates/ide-core/src/event.rs
index 1db2bd6c4..b9859ddca 100644
--- a/crates/ide-core/src/event.rs
+++ b/crates/ide-core/src/event.rs
@@ -32,6 +32,11 @@ pub enum IdeEvent {
doc: DocId,
dirty: bool,
},
+ /// An open document's language changed (Settings › File Types, Override File Type).
+ DocLanguage {
+ doc: DocId,
+ language: crate::LanguageId,
+ },
/// Full replacement of diagnostics for one file from one producer.
Diagnostics {
path: crate::IpcPath,
diff --git a/crates/ide-core/src/inspection_settings.rs b/crates/ide-core/src/inspection_settings.rs
new file mode 100644
index 000000000..7b28189b8
--- /dev/null
+++ b/crates/ide-core/src/inspection_settings.rs
@@ -0,0 +1,105 @@
+//! Settings › Editor › Inspections: inspection profiles. `Default` and the
+//! user's IDE-level copies live in the IDE (global) settings, `Project Default`
+//! and project-level copies in the project's; the project picks which one is in
+//! effect. The UI applies the profile to diagnostics. Also Editor › Natural
+//! Languages › Spelling (the Typo inspection's dictionaries).
+
+use serde::{Deserialize, Serialize};
+use specta::Type;
+use std::collections::BTreeMap;
+
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
+#[serde(default, rename_all = "camelCase")]
+pub struct InspectionSettings {
+ /// Profile in effect for the project: `default`, `project`, or a copy
+ /// as `ide:<key>` / `project:<key>`.
+ pub profile: String,
+ /// The `Default` profile (IDE level): inspection id → override.
+ pub default: BTreeMap<String, InspectionOverride>,
+ /// The `Project Default` profile (stored with the project).
+ pub project: BTreeMap<String, InspectionOverride>,
+ /// Profiles copied at IDE level (global settings), by key.
+ pub ide_profiles: BTreeMap<String, CustomInspectionProfile>,
+ /// Profiles copied at project level (project settings), by key.
+ pub project_profiles: BTreeMap<String, CustomInspectionProfile>,
+}
+
+impl Default for InspectionSettings {
+ fn default() -> Self {
+ Self {
+ profile: "default".into(),
+ default: BTreeMap::new(),
+ project: BTreeMap::new(),
+ ide_profiles: BTreeMap::new(),
+ project_profiles: BTreeMap::new(),
+ }
+ }
+}
+
+/// A named profile made with Copy.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(default, rename_all = "camelCase")]
+pub struct CustomInspectionProfile {
+ pub name: String,
+ pub overrides: BTreeMap<String, InspectionOverride>,
+}
+
+/// Editor › Natural Languages › Spelling.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(default, rename_all = "camelCase")]
+pub struct SpellingSettings {
+ /// Application-level dictionary: accepted words (IDE settings).
+ pub ide_words: Vec<String>,
+ /// Project-level dictionary: accepted words (project settings).
+ pub project_words: Vec<String>,
+ /// Custom dictionaries: plain word lists or Hunspell `.dic` files.
+ pub custom_dictionaries: Vec<String>,
+}
+
+/// Changes to one inspection; absent fields keep the inspection's defaults.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(default, rename_all = "camelCase")]
+pub struct InspectionOverride {
+ #[specta(optional)]
+ pub enabled: Option<bool>,
+ #[specta(optional)]
+ pub severity: Option<InspectionLevel>,
+}
+
+/// IDEA's highlighting levels.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub enum InspectionLevel {
+ Error,
+ Warning,
+ WeakWarning,
+ ServerProblem,
+ Typo,
+ /// Reported (Problems, Inspect Code) but not highlighted in the editor.
+ None,
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn overrides_parse_partially() {
+ let s: InspectionSettings = serde_json::from_str(
+ r#"{"default":{"lsp:ruff":{"enabled":false},"lsp:ruff:F401":{"severity":"weakWarning"}}}"#,
+ )
+ .unwrap();
+ assert_eq!(s.profile, "default");
+ assert_eq!(s.default["lsp:ruff"].enabled, Some(false));
+ assert_eq!(s.default["lsp:ruff:F401"].severity, Some(InspectionLevel::WeakWarning));
+ assert!(s.project.is_empty());
+ assert!(s.ide_profiles.is_empty());
+ let s: InspectionSettings = serde_json::from_str(
+ r#"{"profile":"ide:strict","ideProfiles":{"strict":{"name":"Strict","overrides":{"lsp:ruff":{"severity":"error"}}}}}"#,
+ )
+ .unwrap();
+ assert_eq!(s.ide_profiles["strict"].name, "Strict");
+ assert_eq!(s.ide_profiles["strict"].overrides["lsp:ruff"].severity, Some(InspectionLevel::Error));
+ assert!(serde_json::from_str::<InspectionSettings>(r#"{"default":{"x":{"severity":"loud"}}}"#).is_err());
+ }
+}
diff --git a/crates/ide-core/src/lib.rs b/crates/ide-core/src/lib.rs
index 574f2f894..ea2e3721d 100644
--- a/crates/ide-core/src/lib.rs
+++ b/crates/ide-core/src/lib.rs
@@ -9,6 +9,7 @@ pub mod error;
pub mod event;
pub mod ids;
pub mod ignored;
+pub mod inspection_settings;
pub mod ipc_path;
pub mod process;
pub mod project_dir;
diff --git a/crates/ide-core/src/settings.rs b/crates/ide-core/src/settings.rs
index ac68f0b0e..240562300 100644
--- a/crates/ide-core/src/settings.rs
+++ b/crates/ide-core/src/settings.rs
@@ -6,6 +6,7 @@ use specta::Type;
use std::collections::BTreeMap;
pub use crate::editor_settings::*;
+pub use crate::inspection_settings::*;
pub use crate::workflow_settings::*;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
@@ -40,6 +41,10 @@ pub struct Settings {
/// Language servers / debug adapters at a user-chosen location, by the
/// command the language definition launches (`elixir-ls`, `codelldb`).
pub tools: BTreeMap<String, ToolSettings>,
+ /// Editor › Inspections profiles.
+ pub inspections: InspectionSettings,
+ /// Editor › Natural Languages › Spelling.
+ pub spelling: SpellingSettings,
}
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
@@ -77,6 +82,8 @@ impl Default for Settings {
actions_on_save: ActionsOnSaveSettings::default(),
external_tools: Vec::new(),
tools: BTreeMap::new(),
+ inspections: InspectionSettings::default(),
+ spelling: SpellingSettings::default(),
}
}
}
@@ -109,6 +116,11 @@ pub struct GeneralSettings {
pub save_on_idle: bool,
pub idle_seconds: u32,
pub date_format: DateFormatSettings,
+ /// File › Power Save Mode: no automatic popups (completion, parameter info,
+ /// quick documentation) or background highlighting (usages, code vision).
+ pub power_save_mode: bool,
+ /// File › Rename Project… (project layer): the name shown for the project; empty = its folder name.
+ pub project_name: String,
}
impl Default for GeneralSettings {
@@ -121,6 +133,8 @@ impl Default for GeneralSettings {
save_on_idle: false,
idle_seconds: 15,
date_format: DateFormatSettings::default(),
+ power_save_mode: false,
+ project_name: String::new(),
}
}
}
@@ -210,6 +224,20 @@ pub struct AppearanceSettings {
/// Status bar widgets shown (`true`) or hidden (`false`) by the user
/// (status bar context menu); widgets not listed use their default.
pub status_bar_widgets: BTreeMap<String, bool>,
+ /// Customize Main Toolbar; `None` = the default toolbar.
+ pub main_toolbar: Option<MainToolbarSettings>,
+}
+
+/// Main toolbar entries per side, in order: title widget ids (`project`,
+/// `vcs.branch`…) or `action:<id>`. Widgets in neither list nor `hidden`
+/// (registered later) keep their default place.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(default, rename_all = "camelCase")]
+pub struct MainToolbarSettings {
+ pub left: Vec<String>,
+ pub right: Vec<String>,
+ /// Widgets the user removed.
+ pub hidden: Vec<String>,
}
impl Default for AppearanceSettings {
@@ -239,6 +267,7 @@ impl Default for AppearanceSettings {
show_tool_window_names: true,
widescreen_tool_windows: false,
status_bar_widgets: BTreeMap::new(),
+ main_toolbar: None,
}
}
}
@@ -273,6 +302,7 @@ pub struct EditorSettings {
pub smart_keys: SmartKeysSettings,
pub code_editing: CodeEditingSettings,
pub inlay: InlayHintsSettings,
+ pub inline_completion: InlineCompletionSettings,
/// Gutter icon groups turned off (`run`, `breakpoints`, `bookmarks`, `vcs`, `blame`).
pub gutter_icons_disabled: Vec<String>,
pub show_gutter_icons: bool,
@@ -307,6 +337,7 @@ impl Default for EditorSettings {
smart_keys: SmartKeysSettings::default(),
code_editing: CodeEditingSettings::default(),
inlay: InlayHintsSettings::default(),
+ inline_completion: InlineCompletionSettings::default(),
gutter_icons_disabled: Vec::new(),
show_gutter_icons: true,
code_style: CodeStyleSettings::default(),
@@ -329,6 +360,22 @@ pub struct FileSettings {
pub local_history_days: u32,
/// Upper bound for a project's Local History in MB; the oldest revisions go first.
pub local_history_max_mb: u32,
+ /// File Types › Recognized File Types: the user's changes, by language id.
+ pub file_types: BTreeMap<String, FileTypeAssociation>,
+ /// Override File Type: file (project-relative and `/`-separated, or absolute) → language id.
+ pub file_type_overrides: BTreeMap<String, String>,
+}
+
+/// One language's file name and hashbang patterns on top of its definition.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(default, rename_all = "camelCase")]
+pub struct FileTypeAssociation {
+ /// Added file name patterns: `*.foo`, `Jenkinsfile`, `Dockerfile.*` (`*` and `?` wildcards).
+ pub patterns: Vec<String>,
+ /// Patterns of the definition (`*.ext`, file names) the user removed.
+ pub removed_patterns: Vec<String>,
+ /// Interpreters run by a `#!` first line, e.g. `node` for `#!/usr/bin/env node`.
+ pub hashbangs: Vec<String>,
}
impl Default for FileSettings {
@@ -341,6 +388,8 @@ impl Default for FileSettings {
ensure_final_newline: true,
local_history_days: 5,
local_history_max_mb: 512,
+ file_types: BTreeMap::new(),
+ file_type_overrides: BTreeMap::new(),
}
}
}
@@ -471,6 +520,17 @@ pub struct ProjectStructureSettings {
pub excluded: Vec<String>,
/// Auto-detected roots (from `pom.xml`, `build.gradle`, `Cargo.toml`, …) the user unmarked.
pub unmarked: Vec<String>,
+ /// Content roots besides the project folder (absolute paths), shown and searched with it.
+ pub content_roots: Vec<String>,
+ /// "Exclude files": `;`-separated name patterns (`*.log;tmp*`) excluded at any depth.
+ pub exclude_files: String,
+}
+
+impl ProjectStructureSettings {
+ /// The "Exclude files" name patterns.
+ pub fn exclude_file_patterns(&self) -> Vec<String> {
+ self.exclude_files.split(';').map(str::trim).filter(|p| !p.is_empty()).map(str::to_owned).collect()
+ }
}
impl Settings {
@@ -486,10 +546,12 @@ impl Settings {
out
}
- /// `files.exclude` plus `files.ignoredNames` (a bare name matches at any depth).
+ /// `files.exclude`, `files.ignoredNames` and the Project Structure "Exclude files"
+ /// patterns (a bare name matches at any depth).
pub fn file_excludes(&self) -> Vec<String> {
let mut out = self.files.exclude.clone();
out.extend(self.files.ignored_names.iter().filter(|n| !n.trim().is_empty()).cloned());
+ out.extend(self.project_structure.exclude_file_patterns().into_iter().filter(|p| !p.contains('/')));
out
}
@@ -524,4 +586,15 @@ mod tests {
assert!(k.overrides["file.save"].is_empty());
assert_eq!(serde_json::to_value(Settings::default()).unwrap()["customKeymaps"], serde_json::json!({}));
}
+
+ #[test]
+ fn exclude_files_patterns_join_the_file_excludes() {
+ let s: Settings = serde_json::from_str(
+ r#"{"files":{"exclude":[],"ignoredNames":[]},"projectStructure":{"excludeFiles":" *.log ; tmp*;;"}}"#,
+ )
+ .unwrap();
+ assert_eq!(s.project_structure.exclude_file_patterns(), vec!["*.log", "tmp*"]);
+ assert_eq!(s.file_excludes(), vec!["*.log", "tmp*"]);
+ assert!(Settings::default().files.file_types.is_empty());
+ }
}
diff --git a/crates/ide-core/src/text.rs b/crates/ide-core/src/text.rs
index 45b9caa26..9f96ff766 100644
--- a/crates/ide-core/src/text.rs
+++ b/crates/ide-core/src/text.rs
@@ -129,6 +129,11 @@ pub struct Diagnostic {
pub unnecessary: bool,
#[serde(default)]
pub deprecated: bool,
+ /// Language server (or tool) that reported it, e.g. `basedpyright`; `source`
+ /// is what the producer calls itself. Inspection profiles key on this.
+ #[serde(default)]
+ #[specta(optional)]
+ pub server: Option<String>,
}
/// Symbol kinds, a stable subset of LSP `SymbolKind`.
@@ -168,6 +173,17 @@ impl SymbolKind {
}
}
+/// Declared (or conventional) visibility of an outline symbol.
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub enum Visibility {
+ Public,
+ Protected,
+ /// Package / module / assembly scope (Java default, `internal`, `pub(crate)`, Go unexported).
+ Package,
+ Private,
+}
+
/// A node of a document outline (Structure tool window, breadcrumbs).
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
pub struct OutlineItem {
@@ -179,6 +195,10 @@ pub struct OutlineItem {
/// The identifier itself; where navigation lands.
pub selection_range: Range,
pub children: Vec<OutlineItem>,
+ /// Unknown (`None`) for language-server symbols and languages without the notion.
+ #[serde(default)]
+ #[specta(optional)]
+ pub visibility: Option<Visibility>,
}
/// Fuzzy-match highlight: indices (in chars of the displayed string) that matched.
diff --git a/crates/ide-coverage/src/import.rs b/crates/ide-coverage/src/import.rs
new file mode 100644
index 000000000..669f1b8cd
--- /dev/null
+++ b/crates/ide-coverage/src/import.rs
@@ -0,0 +1,173 @@
+//! "Import a report collected in CI from disk": the format is sniffed from the
+//! content (lcov, Go cover profile, JaCoCo XML) and paths recorded on another
+//! machine are mapped into the project by their longest existing suffix.
+
+use crate::{Accumulator, CoverageSuite, goprofile, jacoco, lcov};
+use ide_core::{IdeError, IdeResult};
+use std::path::{Component, Path, PathBuf};
+
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub(crate) enum Format {
+ Lcov,
+ GoProfile,
+ Jacoco,
+}
+
+pub(crate) fn detect(text: &str) -> Option<Format> {
+ let head = text.trim_start_matches('\u{feff}').trim_start();
+ if head.starts_with('<') {
+ return head.contains("<report").then_some(Format::Jacoco);
+ }
+ let first = head.lines().next().unwrap_or_default();
+ if first.starts_with("mode:") {
+ return Some(Format::GoProfile);
+ }
+ head.lines().any(|l| l.trim_start().starts_with("SF:")).then_some(Format::Lcov)
+}
+
+/// Reads the report at `path` for the project at `root`. Blocking.
+pub fn import(path: &Path, root: &Path) -> IdeResult<CoverageSuite> {
+ let text = std::fs::read_to_string(path)?;
+ let mut suite = match detect(&text) {
+ Some(Format::Lcov) => lcov::parse(&text, root).finish("lcov"),
+ Some(Format::GoProfile) => {
+ let (module, module_dir) = go_module_for(root, &text);
+ goprofile::parse(&text, &module, &module_dir).finish("go test -cover")
+ }
+ Some(Format::Jacoco) => {
+ // A report inside the project (`<module>/target/site/jacoco/…`) knows its module.
+ let module = jacoco::module_dir(path);
+ let module =
+ if path.starts_with(root) && module.starts_with(root) && module != path.parent().unwrap_or(path) {
+ module
+ } else {
+ root.to_path_buf()
+ };
+ let mut acc = Accumulator { has_branches: true, ..Default::default() };
+ jacoco::parse_into(&text, &module, &mut acc)
+ .map_err(|e| IdeError::invalid(format!("{}: {e}", path.display())))?;
+ acc.finish("JaCoCo")
+ }
+ None => {
+ return Err(IdeError::invalid(format!(
+ "{} is not an lcov tracefile, Go cover profile or JaCoCo XML report",
+ path.display()
+ )));
+ }
+ };
+ for f in &mut suite.files {
+ let p: &Path = f.path.as_ref();
+ if !p.exists()
+ && let Some(found) = relocate(p, root)
+ {
+ f.path = found.into();
+ }
+ }
+ suite.files.sort_by(|a, b| (a.path.as_ref() as &Path).cmp(b.path.as_ref()));
+ Ok(suite)
+}
+
+/// `/home/runner/work/app/app/src/lib.rs` → `<root>/src/lib.rs`: the longest suffix of
+/// `path` that exists under `root`.
+pub(crate) fn relocate(path: &Path, root: &Path) -> Option<PathBuf> {
+ let parts: Vec<&std::ffi::OsStr> = path
+ .components()
+ .filter_map(|c| match c {
+ Component::Normal(s) => Some(s),
+ _ => None,
+ })
+ .collect();
+ (0..parts.len()).find_map(|skip| {
+ let candidate = parts[skip..].iter().fold(root.to_path_buf(), |p, s| p.join(s));
+ candidate.is_file().then_some(candidate)
+ })
+}
+
+/// The Go module the profile's import paths belong to: the project's `go.mod`, else one
+/// a level or two down whose module path prefixes the profile's files.
+fn go_module_for(root: &Path, profile: &str) -> (String, PathBuf) {
+ let first = profile
+ .lines()
+ .map(str::trim)
+ .find(|l| !l.is_empty() && !l.starts_with("mode:"))
+ .and_then(|l| l.rsplit_once(':').map(|(f, _)| f.to_owned()))
+ .unwrap_or_default();
+ let matches = |module: &str| !module.is_empty() && (first == module || first.starts_with(&format!("{module}/")));
+ let read = |dir: &Path| -> Option<String> {
+ let text = std::fs::read_to_string(dir.join("go.mod")).ok()?;
+ text.lines().find_map(|l| l.trim().strip_prefix("module")).map(|m| m.trim().trim_matches('"').to_owned())
+ };
+ let mut candidates = vec![root.to_path_buf()];
+ for dir in std::fs::read_dir(root).into_iter().flatten().flatten().map(|e| e.path()).filter(|p| p.is_dir()) {
+ candidates
+ .extend(std::fs::read_dir(&dir).into_iter().flatten().flatten().map(|e| e.path()).filter(|p| p.is_dir()));
+ candidates.push(dir);
+ }
+ let found: Vec<(String, PathBuf)> = candidates.into_iter().filter_map(|d| read(&d).map(|m| (m, d))).collect();
+ found
+ .iter()
+ .find(|(m, _)| matches(m))
+ .or_else(|| found.iter().find(|(_, d)| d == root))
+ .cloned()
+ .unwrap_or_else(|| (String::new(), root.to_path_buf()))
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn detects_formats() {
+ assert_eq!(detect("TN:\nSF:a.rs\nDA:1,1\nend_of_record\n"), Some(Format::Lcov));
+ assert_eq!(detect("mode: atomic\nm/a.go:1.1,2.2 1 0\n"), Some(Format::GoProfile));
+ assert_eq!(
+ detect("<?xml version=\"1.0\"?><!DOCTYPE report><report name=\"x\"></report>"),
+ Some(Format::Jacoco)
+ );
+ assert_eq!(detect("<?xml version=\"1.0\"?><coverage/>"), None);
+ assert_eq!(detect("hello"), None);
+ }
+
+ #[test]
+ fn imports_ci_lcov_with_foreign_paths() {
+ let tmp = tempfile::tempdir().unwrap();
+ let root = tmp.path().join("app");
+ std::fs::create_dir_all(root.join("src")).unwrap();
+ std::fs::write(root.join("src/lib.rs"), "").unwrap();
+ let report = tmp.path().join("lcov.info");
+ std::fs::write(&report, "SF:/home/runner/work/app/app/src/lib.rs\nDA:1,1\nDA:2,0\nend_of_record\n").unwrap();
+ let suite = import(&report, &root).unwrap();
+ assert_eq!(suite.runner, "lcov");
+ assert_eq!(suite.files[0].path.as_ref() as &Path, root.join("src/lib.rs"));
+ assert_eq!(suite.files[0].lines_covered, 1);
+ assert!(import(&tmp.path().join("missing"), &root).is_err());
+ std::fs::write(&report, "nothing").unwrap();
+ assert!(import(&report, &root).is_err());
+ }
+
+ #[test]
+ fn imports_go_profiles_of_nested_modules() {
+ let tmp = tempfile::tempdir().unwrap();
+ let root = tmp.path();
+ std::fs::create_dir_all(root.join("svc/calc")).unwrap();
+ std::fs::write(root.join("svc/go.mod"), "module example.com/svc\n").unwrap();
+ let report = root.join("cover.out");
+ std::fs::write(&report, "mode: set\nexample.com/svc/calc/calc.go:3.1,4.2 1 1\n").unwrap();
+ let suite = import(&report, root).unwrap();
+ assert_eq!(suite.files[0].path.as_ref() as &Path, root.join("svc/calc/calc.go"));
+ }
+
+ #[test]
+ fn imports_jacoco_against_the_project() {
+ let tmp = tempfile::tempdir().unwrap();
+ let root = tmp.path().join("p");
+ std::fs::create_dir_all(root.join("src/main/java/com/x")).unwrap();
+ std::fs::write(root.join("src/main/java/com/x/A.java"), "").unwrap();
+ let report = tmp.path().join("jacoco.xml");
+ let xml = r#"<report name="p"><package name="com/x"><sourcefile name="A.java"><line nr="2" mi="0" ci="1" mb="0" cb="0"/></sourcefile></package></report>"#;
+ std::fs::write(&report, xml).unwrap();
+ let suite = import(&report, &root).unwrap();
+ assert_eq!(suite.files[0].path.as_ref() as &Path, root.join("src/main/java/com/x/A.java"));
+ assert!(suite.has_branches);
+ }
+}
diff --git a/crates/ide-coverage/src/lib.rs b/crates/ide-coverage/src/lib.rs
index ccb1c308a..0df488bff 100644
--- a/crates/ide-coverage/src/lib.rs
+++ b/crates/ide-coverage/src/lib.rs
@@ -16,10 +16,12 @@
//! Lines in the model are 0-based, like every IPC coordinate.
mod goprofile;
+mod import;
mod jacoco;
mod lcov;
mod plan;
+pub use import::import;
pub use plan::prepare;
use ide_core::{IdeError, IdeResult, IpcPath};
diff --git a/crates/ide-coverage/src/plan.rs b/crates/ide-coverage/src/plan.rs
index 4d3ebcc6e..2368aaaa4 100644
--- a/crates/ide-coverage/src/plan.rs
+++ b/crates/ide-coverage/src/plan.rs
@@ -288,6 +288,7 @@ mod tests {
is_test: true,
debug_adapter: None,
allow_parallel: false,
+ extras: Default::default(),
}
}
diff --git a/crates/ide-db/src/conn.rs b/crates/ide-db/src/conn.rs
index 8e7d6c756..95b3ff606 100644
--- a/crates/ide-db/src/conn.rs
+++ b/crates/ide-db/src/conn.rs
@@ -15,7 +15,8 @@ use sqlx::{
postgres::{PgConnectOptions, PgPool, PgPoolOptions, PgSslMode},
sqlite::{SqliteConnectOptions, SqlitePool, SqlitePoolOptions},
};
-use std::path::Path;
+use std::path::{Path, PathBuf};
+use std::sync::Arc;
use std::time::{Duration, Instant};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Type)]
@@ -184,6 +185,90 @@ fn looks_like_query(sql: &str) -> bool {
)
}
+fn file_setting(path: &str) -> Option<PathBuf> {
+ let path = path.trim();
+ (!path.is_empty()).then(|| crate::tunnel::expand(path))
+}
+
+fn is_identifier(name: &str) -> bool {
+ let mut chars = name.chars();
+ chars.next().is_some_and(|c| c.is_ascii_alphabetic() || c == '_')
+ && chars.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '.')
+}
+
+/// A MySQL `SET` value: numbers and keywords as they are, anything else quoted.
+fn mysql_value(v: &str) -> String {
+ let keyword = ["ON", "OFF", "TRUE", "FALSE", "DEFAULT"].iter().any(|k| k.eq_ignore_ascii_case(v));
+ if keyword || v.parse::<f64>().is_ok() {
+ v.to_owned()
+ } else {
+ format!("'{}'", v.replace('\\', "\\\\").replace('\'', "''"))
+ }
+}
+
+/// How the Options and Advanced tabs reach a connection.
+#[derive(Debug, Default, PartialEq, Eq)]
+pub(crate) struct Setup {
+ /// PostgreSQL run-time parameters (startup `options`), SQLite pragmas.
+ pub params: Vec<(String, String)>,
+ /// Run on every new connection: MySQL session settings, then the startup script.
+ pub statements: Vec<String>,
+ pub application_name: Option<String>,
+ pub charset: Option<String>,
+ pub collation: Option<String>,
+ pub statement_cache: Option<usize>,
+ pub connect_timeout: Option<Duration>,
+}
+
+impl Setup {
+ pub fn of(source: &DataSource) -> IdeResult<Self> {
+ let mut s = Setup::default();
+ let o = &source.options;
+ match source.driver {
+ DbDriver::Postgres => {
+ if source.read_only {
+ s.params.push(("default_transaction_read_only".into(), "on".into()));
+ }
+ if !o.default_schema.trim().is_empty() {
+ s.params.push(("search_path".into(), o.default_schema.trim().into()));
+ }
+ if !o.time_zone.trim().is_empty() {
+ s.params.push(("TimeZone".into(), o.time_zone.trim().into()));
+ }
+ }
+ DbDriver::Mysql if source.read_only => s.statements.push("SET SESSION TRANSACTION READ ONLY".into()),
+ _ => {}
+ }
+ for p in &source.properties {
+ let value = p.value.trim();
+ let name = p.name.trim().replace('-', "_");
+ if name.is_empty() {
+ continue;
+ }
+ if !is_identifier(&name) {
+ return Err(IdeError::invalid(format!("invalid driver property name: {}", p.name.trim())));
+ }
+ let number = |what: &str| {
+ value.parse::<u64>().map_err(|_| IdeError::invalid(format!("{what} must be a whole number: {value}")))
+ };
+ match (source.driver, name.to_ascii_lowercase().as_str()) {
+ (_, "statement_cache_capacity") => s.statement_cache = Some(number(&name)? as usize),
+ (_, "connect_timeout") => s.connect_timeout = Some(Duration::from_secs(number(&name)?)),
+ (DbDriver::Postgres, "application_name") => s.application_name = Some(value.to_owned()),
+ (DbDriver::Mysql, "charset") => s.charset = Some(value.to_owned()),
+ (DbDriver::Mysql, "collation") => s.collation = Some(value.to_owned()),
+ (DbDriver::Mysql, _) => s.statements.push(format!("SET SESSION {name} = {}", mysql_value(value))),
+ _ => s.params.push((name, value.to_owned())),
+ }
+ }
+ let script = o.startup_script.trim();
+ if !script.is_empty() {
+ s.statements.extend(crate::split::split(script, source.driver).into_iter().map(|st| st.text));
+ }
+ Ok(s)
+ }
+}
+
impl Pool {
pub fn driver(&self) -> DbDriver {
match self {
@@ -196,7 +281,24 @@ impl Pool {
/// Opens a pool and one connection (so bad settings fail here).
pub async fn connect(source: &DataSource, password: Option<&str>, root: Option<&Path>) -> IdeResult<Self> {
const MAX: u32 = 4;
- let timeout = Duration::from_secs(30);
+ let setup = Setup::of(source)?;
+ let timeout = setup.connect_timeout.unwrap_or(Duration::from_secs(30));
+ let init = Arc::new(setup.statements);
+ // Runs the session statements (startup script…) on every new connection.
+ macro_rules! after_connect {
+ () => {{
+ let init = init.clone();
+ move |conn, _| {
+ let init = init.clone();
+ Box::pin(async move {
+ for sql in init.iter() {
+ sqlx::raw_sql(sqlx::AssertSqlSafe(sql.clone())).execute(&mut *conn).await?;
+ }
+ Ok(())
+ })
+ }
+ }};
+ }
match source.driver {
DbDriver::Sqlite => {
let file = source.file.as_deref().ok_or_else(|| IdeError::invalid("no database file"))?;
@@ -204,11 +306,18 @@ impl Pool {
Some(r) if file.is_relative() => r.join(file),
_ => file.to_path_buf(),
};
- let opts =
+ let mut opts =
SqliteConnectOptions::new().filename(&file).create_if_missing(false).read_only(source.read_only);
+ for (k, v) in setup.params {
+ opts = opts.pragma(k, v);
+ }
+ if let Some(n) = setup.statement_cache {
+ opts = opts.statement_cache_capacity(n);
+ }
let pool = SqlitePoolOptions::new()
.max_connections(MAX)
.acquire_timeout(timeout)
+ .after_connect(after_connect!())
.connect_with(opts)
.await
.map_err(db_err)?;
@@ -219,24 +328,39 @@ impl Pool {
.host(&source.host)
.port(source.port.unwrap_or(5432))
.username(&source.user)
- .application_name("OpenIDEA")
+ .application_name(setup.application_name.as_deref().unwrap_or("OpenIDEA"))
.ssl_mode(match source.ssl {
DbSslMode::Disable => PgSslMode::Disable,
DbSslMode::Prefer => PgSslMode::Prefer,
DbSslMode::Require => PgSslMode::Require,
+ DbSslMode::VerifyCa => PgSslMode::VerifyCa,
+ DbSslMode::VerifyFull => PgSslMode::VerifyFull,
});
+ if let Some(f) = file_setting(&source.ssl_ca_file) {
+ opts = opts.ssl_root_cert(f);
+ }
+ if let Some(f) = file_setting(&source.ssl_cert_file) {
+ opts = opts.ssl_client_cert(f);
+ }
+ if let Some(f) = file_setting(&source.ssl_key_file) {
+ opts = opts.ssl_client_key(f);
+ }
if !source.database.is_empty() {
opts = opts.database(&source.database);
}
if let Some(p) = password {
opts = opts.password(p);
}
- if source.read_only {
- opts = opts.options([("default_transaction_read_only", "on")]);
+ if !setup.params.is_empty() {
+ opts = opts.options(setup.params);
+ }
+ if let Some(n) = setup.statement_cache {
+ opts = opts.statement_cache_capacity(n);
}
let pool = PgPoolOptions::new()
.max_connections(MAX)
.acquire_timeout(timeout)
+ .after_connect(after_connect!())
.connect_with(opts)
.await
.map_err(db_err)?;
@@ -251,25 +375,41 @@ impl Pool {
DbSslMode::Disable => MySqlSslMode::Disabled,
DbSslMode::Prefer => MySqlSslMode::Preferred,
DbSslMode::Require => MySqlSslMode::Required,
+ DbSslMode::VerifyCa => MySqlSslMode::VerifyCa,
+ DbSslMode::VerifyFull => MySqlSslMode::VerifyIdentity,
});
+ if let Some(f) = file_setting(&source.ssl_ca_file) {
+ opts = opts.ssl_ca(f);
+ }
+ if let Some(f) = file_setting(&source.ssl_cert_file) {
+ opts = opts.ssl_client_cert(f);
+ }
+ if let Some(f) = file_setting(&source.ssl_key_file) {
+ opts = opts.ssl_client_key(f);
+ }
if !source.database.is_empty() {
opts = opts.database(&source.database);
}
if let Some(p) = password {
opts = opts.password(p);
}
- let read_only = source.read_only;
+ if let Some(c) = &setup.charset {
+ opts = opts.charset(c);
+ }
+ if let Some(c) = &setup.collation {
+ opts = opts.collation(c);
+ }
+ if let Some(n) = setup.statement_cache {
+ opts = opts.statement_cache_capacity(n);
+ }
+ let tz = source.options.time_zone.trim();
+ if !tz.is_empty() {
+ opts = opts.timezone(Some(tz.to_owned()));
+ }
let pool = MySqlPoolOptions::new()
.max_connections(MAX)
.acquire_timeout(timeout)
- .after_connect(move |conn, _| {
- Box::pin(async move {
- if read_only {
- conn.execute("SET SESSION TRANSACTION READ ONLY").await?;
- }
- Ok(())
- })
- })
+ .after_connect(after_connect!())
.connect_with(opts)
.await
.map_err(db_err)?;
@@ -282,6 +422,10 @@ impl Pool {
with_pool!(self, p => p.close().await)
}
+ pub fn is_closed(&self) -> bool {
+ with_pool!(self, p => p.is_closed())
+ }
+
/// Runs `sql` (no row limit beyond `max`), for introspection.
pub async fn rows(&self, sql: &str, max: usize) -> IdeResult<Vec<Vec<Option<String>>>> {
let fetched: IdeResult<Fetched> = with_pool!(self, p => fetch!(p, sql, max));
@@ -434,3 +578,68 @@ fn statement_columns<S: sqlx::Statement>(s: &S) -> Vec<ResultColumn> {
.map(|c| ResultColumn { name: c.name().to_owned(), type_name: c.type_info().name().to_owned() })
.collect()
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::source::{DbOptions, DbProperty};
+
+ fn prop(name: &str, value: &str) -> DbProperty {
+ DbProperty { name: name.into(), value: value.into() }
+ }
+
+ #[test]
+ fn postgres_options_become_runtime_parameters() {
+ let s = DataSource {
+ driver: DbDriver::Postgres,
+ read_only: true,
+ options: DbOptions {
+ default_schema: "app, public".into(),
+ time_zone: "Europe/Paris".into(),
+ startup_script: "SET work_mem = '64MB'; select 1;".into(),
+ ..Default::default()
+ },
+ properties: vec![prop("statement_timeout", "5s"), prop("application_name", "me"), prop("", "x")],
+ ..Default::default()
+ };
+ let setup = Setup::of(&s).unwrap();
+ let names: Vec<_> = setup.params.iter().map(|(k, _)| k.as_str()).collect();
+ assert_eq!(names, ["default_transaction_read_only", "search_path", "TimeZone", "statement_timeout"]);
+ assert_eq!(setup.application_name.as_deref(), Some("me"));
+ assert_eq!(setup.statements, ["SET work_mem = '64MB'", "select 1"]);
+ }
+
+ #[test]
+ fn mysql_properties_become_session_variables() {
+ let s = DataSource {
+ driver: DbDriver::Mysql,
+ read_only: true,
+ properties: vec![
+ prop("sql_mode", "ANSI_QUOTES"),
+ prop("max_execution_time", "1000"),
+ prop("charset", "utf8mb4"),
+ prop("connect-timeout", "5"),
+ ],
+ ..Default::default()
+ };
+ let setup = Setup::of(&s).unwrap();
+ assert_eq!(
+ setup.statements,
+ [
+ "SET SESSION TRANSACTION READ ONLY",
+ "SET SESSION sql_mode = 'ANSI_QUOTES'",
+ "SET SESSION max_execution_time = 1000"
+ ]
+ );
+ assert_eq!(setup.charset.as_deref(), Some("utf8mb4"));
+ assert_eq!(setup.connect_timeout, Some(Duration::from_secs(5)));
+ assert!(Setup::of(&DataSource { properties: vec![prop("a; drop", "1")], ..s.clone() }).is_err());
+ assert!(Setup::of(&DataSource { properties: vec![prop("connect_timeout", "soon")], ..s }).is_err());
+ }
+
+ #[test]
+ fn sqlite_properties_become_pragmas() {
+ let s = DataSource { properties: vec![prop("cache_size", "-2000")], ..Default::default() };
+ assert_eq!(Setup::of(&s).unwrap().params, [("cache_size".to_owned(), "-2000".to_owned())]);
+ }
+}
diff --git a/crates/ide-db/src/lib.rs b/crates/ide-db/src/lib.rs
index 1b3e05b78..b115e629e 100644
--- a/crates/ide-db/src/lib.rs
+++ b/crates/ide-db/src/lib.rs
@@ -10,7 +10,9 @@ pub mod sql;
pub mod tunnel;
pub use conn::{Held, Pool, QueryResult, ResultColumn};
-pub use source::{DataSource, DbDriver, DbSsh, DbSshAuth, DbSslMode};
+pub use source::{
+ DataSource, DbColor, DbDriver, DbIntrospection, DbOptions, DbProperty, DbSsh, DbSshAuth, DbSslMode, DbTxMode,
+};
pub use sql::{CellValue, DbRowEdit, SortKey};
use ide_core::{CancellationToken, IdeError, IdeResult, error::ErrorKind};
@@ -21,6 +23,7 @@ use specta::Type;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
+use std::time::Duration;
use tunnel::{OpenError, Tunnel, TunnelSpec, UnknownHostKey};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Type)]
@@ -219,6 +222,24 @@ fn through_tunnel(e: IdeError, source: &DataSource, tunneled: bool) -> IdeError
)
}
+/// Options › Run keep-alive query: pings the pool until it is closed or dropped
+/// (a dropped SSH tunnel or an idle-killing proxy stays alive meanwhile).
+fn keep_alive(pool: &Arc<Pool>, every: Duration) {
+ let pool = Arc::downgrade(pool);
+ tokio::spawn(async move {
+ let mut tick = tokio::time::interval(every);
+ tick.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
+ tick.tick().await;
+ loop {
+ tick.tick().await;
+ let Some(p) = pool.upgrade().filter(|p| !p.is_closed()) else { break };
+ if let Err(e) = p.rows("SELECT 1", 1).await {
+ tracing::debug!("keep-alive: {}", e.message);
+ }
+ }
+ });
+}
+
/// Rolls back a session's transaction and releases its connection.
async fn end_session(session: &Session) {
let held = session.lock().await.take();
@@ -261,14 +282,16 @@ impl DbManager {
source::load(&self.root)
}
- /// The data source of connection target `target`, with its database for `<id>:<database>`.
+ /// The connection settings of target `target` ([`DataSource::resolved`]), with
+ /// its database for `<id>:<database>`.
pub fn source(&self, target: &str) -> IdeResult<DataSource> {
let (id, database) = split_target(target);
let mut source = self
.sources()?
.into_iter()
.find(|s| s.id == id)
- .ok_or_else(|| IdeError::not_found(format!("no data source {id}")))?;
+ .ok_or_else(|| IdeError::not_found(format!("no data source {id}")))?
+ .resolved()?;
if let Some(db) = database {
source.database = db.to_owned();
}
@@ -341,7 +364,10 @@ impl DbManager {
}
async fn password(&self, source: &DataSource) -> Option<String> {
- self.secret(source.id.clone(), source.driver != DbDriver::Sqlite && source.save_password).await
+ match self.secret(source.id.clone(), source.driver != DbDriver::Sqlite && source.save_password).await {
+ Some(p) => Some(p),
+ None => source.url_password(),
+ }
}
/// Trusts the host key that failed the last connection of `id` (adds it to `known_hosts`).
@@ -411,6 +437,7 @@ impl DbManager {
password: Option<String>,
ssh_secret: Option<String>,
) -> IdeResult<String> {
+ let source = &source.resolved()?;
let password = match password {
Some(p) => Some(p),
None => self.password(source).await,
@@ -458,9 +485,14 @@ impl DbManager {
return Err(through_tunnel(e, &source, tunnel.is_some()));
}
};
- let mut pools = self.pools.lock();
// Another caller may have connected meanwhile; keep theirs.
- Ok(pools.entry(id.to_owned()).or_insert(pool).clone())
+ let kept = self.pools.lock().entry(id.to_owned()).or_insert_with(|| pool.clone()).clone();
+ if Arc::ptr_eq(&kept, &pool)
+ && let Some(secs) = source.options.keep_alive_secs.filter(|s| *s > 0)
+ {
+ keep_alive(&pool, Duration::from_secs(secs.into()));
+ }
+ Ok(kept)
}
/// Closes the tunnel of `source_id` once none of its targets is connected.
@@ -496,24 +528,29 @@ impl DbManager {
/// The databases of the server of data source `id` (PostgreSQL), the connected one first.
pub async fn databases(&self, id: &str) -> IdeResult<Databases> {
- let pool = self.pool(split_target(id).0).await?;
+ let id = split_target(id).0;
+ let system = self.source(id)?.introspection.show_system;
+ let pool = self.pool(id).await?;
if pool.driver() != DbDriver::Postgres {
return Err(IdeError::invalid("only PostgreSQL data sources list databases"));
}
let first = |rows: Vec<Vec<Option<String>>>| rows.into_iter().filter_map(|r| r.into_iter().next().flatten());
let current = first(pool.rows("SELECT current_database()", 1).await?).next().unwrap_or_default();
- let rows = pool.rows(sql::DATABASES, MAX_META_ROWS).await?;
+ let rows = pool.rows(sql::databases(system), MAX_META_ROWS).await?;
let mut names: Vec<String> =
- first(rows).filter(|n| *n == current || !sql::INTERNAL_DATABASES.contains(&n.as_str())).collect();
+ first(rows).filter(|n| system || *n == current || !sql::INTERNAL_DATABASES.contains(&n.as_str())).collect();
if !names.contains(&current) {
names.insert(0, current.clone());
}
Ok(Databases { current, names })
}
+ /// Every schema (the Schemas tab picks the ones the tree shows); system schemas
+ /// only with [`DbIntrospection::show_system`].
pub async fn schemas(&self, id: &str) -> IdeResult<Vec<String>> {
+ let system = self.source(id)?.introspection.show_system;
let pool = self.pool(id).await?;
- let rows = pool.rows(sql::schemas(pool.driver()), MAX_META_ROWS).await?;
+ let rows = pool.rows(sql::schemas(pool.driver(), system), MAX_META_ROWS).await?;
Ok(rows.into_iter().filter_map(|r| r.into_iter().next().flatten()).collect())
}
diff --git a/crates/ide-db/src/source.rs b/crates/ide-db/src/source.rs
index c691ad34a..1036995bf 100644
--- a/crates/ide-db/src/source.rs
+++ b/crates/ide-db/src/source.rs
@@ -35,6 +35,76 @@ pub enum DbSslMode {
#[default]
Prefer,
Require,
+ /// Require, and check the server certificate against the CA file.
+ VerifyCa,
+ /// [`DbSslMode::VerifyCa`], and check that the certificate names the host.
+ VerifyFull,
+}
+
+/// IDEA's data source colours (tree node and console tab tint), e.g. red for production.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub enum DbColor {
+ Red,
+ Orange,
+ Yellow,
+ Green,
+ Blue,
+ Violet,
+}
+
+/// Transaction control of the data source's consoles.
+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub enum DbTxMode {
+ #[default]
+ Auto,
+ Manual,
+}
+
+/// Options tab: session settings applied to every connection.
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase", default)]
+pub struct DbOptions {
+ pub transaction: DbTxMode,
+ /// PostgreSQL `search_path` (unqualified names resolve there).
+ pub default_schema: String,
+ /// Session time zone (`TimeZone` / `time_zone`); empty keeps the default.
+ pub time_zone: String,
+ /// Statements run on every new connection.
+ pub startup_script: String,
+ /// Run `SELECT 1` this often while connected.
+ pub keep_alive_secs: Option<u32>,
+ /// Disconnect after this long without statements (enforced by the UI, which sees the activity).
+ pub auto_disconnect_secs: Option<u32>,
+}
+
+/// Schemas tab: the databases / schemas the tree shows. Names may use `*` and `?`.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase", default)]
+pub struct DbIntrospection {
+ pub all_databases: bool,
+ pub databases: Vec<String>,
+ pub all_schemas: bool,
+ pub schemas: Vec<String>,
+ /// `pg_catalog`, `information_schema`, `mysql`…, and PostgreSQL template databases.
+ pub show_system: bool,
+}
+
+impl Default for DbIntrospection {
+ fn default() -> Self {
+ Self { all_databases: true, databases: Vec::new(), all_schemas: true, schemas: Vec::new(), show_system: false }
+ }
+}
+
+/// Advanced tab: a driver property. PostgreSQL: run-time parameters (and
+/// `application_name`); MySQL: session variables (and `charset`, `collation`);
+/// SQLite: pragmas. See [`crate::conn`].
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase", default)]
+pub struct DbProperty {
+ pub name: String,
+ pub value: String,
}
/// How the SSH tunnel authenticates (IDEA's SSH configuration "Authentication type").
@@ -84,6 +154,20 @@ pub struct DataSource {
pub read_only: bool,
/// SSH tunnel settings (`None`: never configured; kept but unused when not `enabled`).
pub ssh: Option<DbSsh>,
+ /// Wire-compatible product preset (`cockroachdb`, `tidb`…; empty: the driver itself).
+ pub vendor: String,
+ pub color: Option<DbColor>,
+ pub comment: String,
+ /// Connect with [`DataSource::url`] instead of the host / port / database fields.
+ pub url_only: bool,
+ pub url: String,
+ /// PEM files; `~/` is the home directory.
+ pub ssl_ca_file: String,
+ pub ssl_cert_file: String,
+ pub ssl_key_file: String,
+ pub options: DbOptions,
+ pub introspection: DbIntrospection,
+ pub properties: Vec<DbProperty>,
}
impl Default for DataSource {
@@ -101,10 +185,188 @@ impl Default for DataSource {
save_password: false,
read_only: false,
ssh: None,
+ vendor: String::new(),
+ color: None,
+ comment: String::new(),
+ url_only: false,
+ url: String::new(),
+ ssl_ca_file: String::new(),
+ ssl_cert_file: String::new(),
+ ssl_key_file: String::new(),
+ options: DbOptions::default(),
+ introspection: DbIntrospection::default(),
+ properties: Vec::new(),
}
}
}
+/// The connection settings of a URL (`jdbc:` prefix allowed).
+#[derive(Debug, Clone, Default, PartialEq, Eq)]
+pub struct ParsedUrl {
+ pub driver: Option<DbDriver>,
+ pub host: String,
+ pub port: Option<u16>,
+ pub database: String,
+ pub user: String,
+ pub password: Option<String>,
+ /// Query parameters, in order.
+ pub params: Vec<(String, String)>,
+ /// SQLite file.
+ pub file: Option<String>,
+}
+
+fn percent_decode(s: &str) -> String {
+ let b = s.as_bytes();
+ let mut out = Vec::with_capacity(b.len());
+ let mut i = 0;
+ let hex = |i: usize| b.get(i).and_then(|&c| (c as char).to_digit(16));
+ while i < b.len() {
+ if b[i] == b'%'
+ && let (Some(h), Some(l)) = (hex(i + 1), hex(i + 2))
+ {
+ out.push((h * 16 + l) as u8);
+ i += 3;
+ continue;
+ }
+ out.push(b[i]);
+ i += 1;
+ }
+ String::from_utf8_lossy(&out).into_owned()
+}
+
+/// The driver speaking the protocol of URL scheme `scheme` (wire-compatible products included).
+pub fn scheme_driver(scheme: &str) -> Option<DbDriver> {
+ match scheme.to_ascii_lowercase().as_str() {
+ "postgres" | "postgresql" | "pgsql" | "redshift" | "cockroachdb" | "cockroach" | "yugabytedb"
+ | "timescaledb" | "greenplum" => Some(DbDriver::Postgres),
+ "mysql" | "mariadb" | "tidb" | "singlestore" | "memsql" | "oceanbase" => Some(DbDriver::Mysql),
+ "sqlite" | "sqlite3" => Some(DbDriver::Sqlite),
+ _ => None,
+ }
+}
+
+/// Parses `scheme://[user[:password]@]host[:port][/database][?k=v&…]`, `jdbc:` forms
+/// included, and `sqlite:path`.
+pub fn parse_url(raw: &str) -> IdeResult<ParsedUrl> {
+ let bad = || IdeError::invalid(format!("not a database URL: {raw}"));
+ let url = raw.trim();
+ let url = url.strip_prefix("jdbc:").or_else(|| url.strip_prefix("JDBC:")).unwrap_or(url);
+ let (scheme, rest) = url.split_once(':').ok_or_else(bad)?;
+ let driver = scheme_driver(scheme).ok_or_else(bad)?;
+ if driver == DbDriver::Sqlite {
+ let file = rest.strip_prefix("//").unwrap_or(rest);
+ let file = file.split('?').next().unwrap_or_default();
+ if file.is_empty() {
+ return Err(bad());
+ }
+ return Ok(ParsedUrl { driver: Some(driver), file: Some(percent_decode(file)), ..Default::default() });
+ }
+ let rest = rest.strip_prefix("//").ok_or_else(bad)?;
+ let (main, query) = rest.split_once('?').unwrap_or((rest, ""));
+ let (authority, database) = main.split_once('/').unwrap_or((main, ""));
+ let (userinfo, hostport) = match authority.rsplit_once('@') {
+ Some((u, h)) => (Some(u), h),
+ None => (None, authority),
+ };
+ // Several hosts (failover lists): the first.
+ let hostport = hostport.split(',').next().unwrap_or_default();
+ let (host, port) = if let Some(v6) = hostport.strip_prefix('[') {
+ let (h, after) = v6.split_once(']').ok_or_else(bad)?;
+ (h.to_owned(), after.strip_prefix(':'))
+ } else {
+ match hostport.rsplit_once(':') {
+ Some((h, p)) => (h.to_owned(), Some(p)),
+ None => (hostport.to_owned(), None),
+ }
+ };
+ let port = match port.filter(|p| !p.is_empty()) {
+ Some(p) => Some(p.parse::<u16>().map_err(|_| bad())?),
+ None => None,
+ };
+ let mut parsed = ParsedUrl {
+ driver: Some(driver),
+ host,
+ port,
+ database: percent_decode(database.trim_end_matches('/')),
+ ..Default::default()
+ };
+ if let Some(u) = userinfo {
+ let (user, password) = match u.split_once(':') {
+ Some((u, p)) => (u, Some(percent_decode(p))),
+ None => (u, None),
+ };
+ parsed.user = percent_decode(user);
+ parsed.password = password;
+ }
+ for pair in query.split('&').filter(|p| !p.is_empty()) {
+ let (k, v) = pair.split_once('=').unwrap_or((pair, ""));
+ let (k, v) = (percent_decode(k), percent_decode(v));
+ match k.as_str() {
+ "user" if parsed.user.is_empty() => parsed.user = v,
+ "password" if parsed.password.is_none() => parsed.password = Some(v),
+ _ => parsed.params.push((k, v)),
+ }
+ }
+ Ok(parsed)
+}
+
+impl DataSource {
+ /// The settings to connect with: with [`DataSource::url_only`], host, port,
+ /// database, user, SSL and driver properties come from the URL (properties
+ /// of the Advanced tab still apply after the URL's).
+ pub fn resolved(&self) -> IdeResult<DataSource> {
+ if !self.url_only {
+ return Ok(self.clone());
+ }
+ let u = parse_url(&self.url)?;
+ let mut s = self.clone();
+ if let Some(d) = u.driver
+ && d != s.driver
+ {
+ return Err(IdeError::invalid(format!("the URL is not for the {:?} driver", s.driver)));
+ }
+ if s.driver == DbDriver::Sqlite {
+ s.file = u.file.map(IpcPath::from);
+ return Ok(s);
+ }
+ s.host = u.host;
+ s.port = u.port;
+ s.database = u.database;
+ if !u.user.is_empty() {
+ s.user = u.user;
+ }
+ let mut properties = Vec::new();
+ for (k, v) in u.params {
+ match k.to_ascii_lowercase().as_str() {
+ "sslmode" | "ssl-mode" => {
+ s.ssl = match v.to_ascii_lowercase().replace('-', "_").as_str() {
+ "disable" | "disabled" => DbSslMode::Disable,
+ "require" | "required" => DbSslMode::Require,
+ "verify_ca" => DbSslMode::VerifyCa,
+ "verify_full" | "verify_identity" => DbSslMode::VerifyFull,
+ _ => DbSslMode::Prefer,
+ }
+ }
+ "sslrootcert" | "ssl-ca" | "sslca" => s.ssl_ca_file = v,
+ "sslcert" | "ssl-cert" => s.ssl_cert_file = v,
+ "sslkey" | "ssl-key" => s.ssl_key_file = v,
+ _ => properties.push(DbProperty { name: k, value: v }),
+ }
+ }
+ properties.append(&mut s.properties);
+ s.properties = properties;
+ Ok(s)
+ }
+
+ /// The password written in the URL of a [`DataSource::url_only`] data source.
+ pub fn url_password(&self) -> Option<String> {
+ if !self.url_only {
+ return None;
+ }
+ parse_url(&self.url).ok()?.password
+ }
+}
+
#[derive(Debug, Default, Serialize, Deserialize)]
struct SourcesFile {
#[serde(default, rename = "data-source")]
@@ -164,4 +426,77 @@ mod tests {
assert_eq!(load(tmp.path()).unwrap(), vec![s]);
assert!(save(tmp.path(), &[DataSource::default()]).is_err());
}
+
+ #[test]
+ fn reads_configs_written_before_the_new_settings() {
+ let tmp = tempfile::tempdir().unwrap();
+ let dir = tmp.path().join(".openidea");
+ std::fs::create_dir_all(&dir).unwrap();
+ std::fs::write(
+ dir.join(FILE),
+ "[[data-source]]\nid = \"a\"\nname = \"old\"\ndriver = \"postgres\"\nhost = \"db\"\nssl = \"require\"\n",
+ )
+ .unwrap();
+ let s = load(tmp.path()).unwrap().remove(0);
+ assert_eq!(s.ssl, DbSslMode::Require);
+ assert!(s.introspection.all_databases && s.introspection.all_schemas);
+ assert_eq!((s.color, s.url_only, s.options.transaction), (None, false, DbTxMode::Auto));
+ }
+
+ #[test]
+ fn round_trips_the_new_settings() {
+ let tmp = tempfile::tempdir().unwrap();
+ let s = DataSource {
+ id: "b".into(),
+ name: "prod".into(),
+ driver: DbDriver::Mysql,
+ vendor: "tidb".into(),
+ color: Some(DbColor::Red),
+ comment: "careful".into(),
+ ssl: DbSslMode::VerifyFull,
+ ssl_ca_file: "~/ca.pem".into(),
+ options: DbOptions { time_zone: "UTC".into(), keep_alive_secs: Some(60), ..Default::default() },
+ introspection: DbIntrospection { all_schemas: false, schemas: vec!["app*".into()], ..Default::default() },
+ properties: vec![DbProperty { name: "sql_mode".into(), value: "ANSI".into() }],
+ ..Default::default()
+ };
+ save(tmp.path(), std::slice::from_ref(&s)).unwrap();
+ assert_eq!(load(tmp.path()).unwrap(), vec![s]);
+ }
+
+ #[test]
+ fn parses_urls() {
+ let u = parse_url("jdbc:postgresql://ann:s%[email protected]:5433/shop?sslmode=require&search_path=app").unwrap();
+ assert_eq!(u.driver, Some(DbDriver::Postgres));
+ assert_eq!((u.host.as_str(), u.port, u.database.as_str()), ("db.local", Some(5433), "shop"));
+ assert_eq!((u.user.as_str(), u.password.as_deref()), ("ann", Some("s@cret")));
+ assert_eq!(u.params, vec![("sslmode".into(), "require".into()), ("search_path".into(), "app".into())]);
+ let u = parse_url("mysql://[::1]/app?user=root").unwrap();
+ assert_eq!((u.host.as_str(), u.port, u.user.as_str()), ("::1", None, "root"));
+ assert_eq!(parse_url("jdbc:redshift://r:5439/dev").unwrap().driver, Some(DbDriver::Postgres));
+ assert_eq!(parse_url("tidb://h:4000").unwrap().driver, Some(DbDriver::Mysql));
+ assert_eq!(parse_url("sqlite:/tmp/a.db").unwrap().file.as_deref(), Some("/tmp/a.db"));
+ assert!(parse_url("oracle://x").is_err());
+ assert!(parse_url("postgres://h:99999/db").is_err());
+ }
+
+ #[test]
+ fn url_only_sources_connect_with_the_url() {
+ let s = DataSource {
+ driver: DbDriver::Postgres,
+ user: "fallback".into(),
+ url_only: true,
+ url: "postgres://ann:pw@h:6543/app?sslmode=verify-full&sslrootcert=/ca.pem&statement_timeout=5000".into(),
+ properties: vec![DbProperty { name: "work_mem".into(), value: "64MB".into() }],
+ ..Default::default()
+ };
+ let r = s.resolved().unwrap();
+ assert_eq!((r.host.as_str(), r.port, r.database.as_str(), r.user.as_str()), ("h", Some(6543), "app", "ann"));
+ assert_eq!((r.ssl, r.ssl_ca_file.as_str()), (DbSslMode::VerifyFull, "/ca.pem"));
+ let names: Vec<_> = r.properties.iter().map(|p| p.name.as_str()).collect();
+ assert_eq!(names, ["statement_timeout", "work_mem"]);
+ assert_eq!(s.url_password().as_deref(), Some("pw"));
+ assert!(DataSource { url: "mysql://h/db".into(), ..s.clone() }.resolved().is_err());
+ assert_eq!(DataSource { url_only: false, ..s }.resolved().unwrap().host, "localhost");
+ }
}
diff --git a/crates/ide-db/src/sql.rs b/crates/ide-db/src/sql.rs
index f76dfb0a3..17373158a 100644
--- a/crates/ide-db/src/sql.rs
+++ b/crates/ide-db/src/sql.rs
@@ -33,14 +33,26 @@ pub fn qualified(driver: DbDriver, schema: &str, table: &str) -> String {
}
/// Databases one can connect to (PostgreSQL).
-pub const DATABASES: &str = "SELECT datname FROM pg_database WHERE NOT datistemplate AND datallowconn ORDER BY datname";
+/// PostgreSQL databases one can connect to; templates only with `system`.
+pub fn databases(system: bool) -> &'static str {
+ if system {
+ "SELECT datname FROM pg_database WHERE datallowconn ORDER BY datname"
+ } else {
+ "SELECT datname FROM pg_database WHERE NOT datistemplate AND datallowconn ORDER BY datname"
+ }
+}
/// Databases of managed services that their users cannot use (hidden unless connected to).
pub const INTERNAL_DATABASES: &[&str] = &["rdsadmin", "azure_maintenance", "azure_sys", "cloudsqladmin"];
-pub fn schemas(driver: DbDriver) -> &'static str {
+pub fn schemas(driver: DbDriver, system: bool) -> &'static str {
match driver {
DbDriver::Sqlite => "SELECT name FROM pragma_database_list WHERE name <> 'temp' ORDER BY seq",
+ DbDriver::Postgres if system => {
+ "SELECT schema_name FROM information_schema.schemata \
+ WHERE schema_name NOT LIKE 'pg\\_toast%' AND schema_name NOT LIKE 'pg\\_temp%' ORDER BY 1"
+ }
+ DbDriver::Mysql if system => "SELECT schema_name FROM information_schema.schemata ORDER BY 1",
DbDriver::Postgres => {
"SELECT schema_name FROM information_schema.schemata \
WHERE schema_name NOT IN ('pg_catalog', 'information_schema') \
diff --git a/crates/ide-db/src/tunnel.rs b/crates/ide-db/src/tunnel.rs
index 84539a5e5..8a6f60a66 100644
--- a/crates/ide-db/src/tunnel.rs
+++ b/crates/ide-db/src/tunnel.rs
@@ -200,7 +200,7 @@ fn home() -> Option<PathBuf> {
}
/// `~/x` → `$HOME/x`.
-fn expand(path: &str) -> PathBuf {
+pub(crate) fn expand(path: &str) -> PathBuf {
match (path.strip_prefix("~/"), home()) {
(Some(rest), Some(h)) => h.join(rest),
_ => PathBuf::from(path),
diff --git a/crates/ide-db/tests/sqlite.rs b/crates/ide-db/tests/sqlite.rs
index 3dcc60b9f..03d12dac7 100644
--- a/crates/ide-db/tests/sqlite.rs
+++ b/crates/ide-db/tests/sqlite.rs
@@ -1,7 +1,7 @@
//! Introspection, queries and table edits against a real SQLite file.
use ide_core::{CancellationToken, IdeResult};
-use ide_db::{CellValue, DataSource, DbDriver, DbManager, DbRowEdit, DbTableKind, SortKey};
+use ide_db::{CellValue, DataSource, DbDriver, DbManager, DbOptions, DbProperty, DbRowEdit, DbTableKind, SortKey};
async fn setup() -> (tempfile::TempDir, DbManager) {
let tmp = tempfile::tempdir().unwrap();
@@ -246,3 +246,23 @@ async fn ddl_of_tables_and_views() -> IdeResult<()> {
assert!(db.ddl("s1", "main", "nope").await.is_err());
Ok(())
}
+
+#[tokio::test]
+async fn applies_driver_properties_and_the_startup_script_on_connect() -> IdeResult<()> {
+ let (tmp, db) = setup().await;
+ let mut s = db.sources()?.remove(0);
+ s.properties = vec![DbProperty { name: "cache_size".into(), value: "-1234".into() }];
+ s.options = DbOptions {
+ startup_script: "CREATE TEMP TABLE boot (x); INSERT INTO boot VALUES (7);".into(),
+ ..Default::default()
+ };
+ db.save_sources(vec![s.clone()]).await?;
+ let c = CancellationToken::new();
+ let r = db.execute("s1", "SELECT (SELECT x FROM boot), (SELECT cache_size FROM pragma_cache_size)", 10, &c).await?;
+ assert_eq!(r.rows, vec![vec![Some("7".into()), Some("-1234".into())]]);
+ // URL only: the file comes from the URL.
+ let url = format!("jdbc:sqlite:{}", tmp.path().join("app.db").display());
+ db.save_sources(vec![DataSource { url_only: true, url, file: None, ..s }]).await?;
+ assert_eq!(db.schemas("s1").await?, vec!["main"]);
+ Ok(())
+}
diff --git a/crates/ide-docker/Cargo.toml b/crates/ide-docker/Cargo.toml
index e88de9868..1431fa547 100644
--- a/crates/ide-docker/Cargo.toml
+++ b/crates/ide-docker/Cargo.toml
@@ -15,3 +15,6 @@ which = "8"
[target.'cfg(unix)'.dependencies]
libc = "0.2"
+
+[dev-dependencies]
+tempfile.workspace = true
diff --git a/crates/ide-docker/src/connection.rs b/crates/ide-docker/src/connection.rs
new file mode 100644
index 000000000..2f78537e8
--- /dev/null
+++ b/crates/ide-docker/src/connection.rs
@@ -0,0 +1,402 @@
+//! Docker connections (which daemon the CLI talks to) and registries, as the
+//! Services tool window's "Add Service" menu creates them. Both are app-wide
+//! like in IDEA: `docker.json` in the app data directory; registry passwords
+//! live beside it in an owner-only `docker-passwords.json`.
+
+use ide_core::{IdeError, IdeResult};
+use serde::{Deserialize, Serialize};
+use specta::Type;
+use std::collections::BTreeMap;
+use std::path::{Path, PathBuf};
+use std::process::Command;
+
+/// Which daemon a docker command talks to.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(tag = "kind", rename_all = "camelCase", rename_all_fields = "camelCase")]
+pub enum DockerEndpoint {
+ /// Whatever the CLI is configured for (`DOCKER_HOST`, the current context).
+ #[default]
+ Default,
+ /// A local daemon socket, e.g. `/var/run/docker.sock` (or a `npipe://` URL on Windows).
+ Socket { path: String },
+ /// A remote daemon, e.g. `tcp://build:2376` or `ssh://me@build`; with TLS when
+ /// `tls_cert_dir` holds `ca.pem`, `cert.pem` and `key.pem`.
+ Tcp { host: String, tls_cert_dir: Option<String> },
+ /// A named `docker context`.
+ Context { name: String },
+}
+
+impl DockerEndpoint {
+ /// Global CLI options selecting this endpoint (before the subcommand).
+ pub fn global_args(&self) -> Vec<String> {
+ match self {
+ Self::Default => Vec::new(),
+ Self::Socket { path } => {
+ let path = path.trim();
+ let url = if path.contains("://") { path.to_owned() } else { format!("unix://{path}") };
+ vec!["--host".into(), url]
+ }
+ Self::Tcp { host, tls_cert_dir } => {
+ let host = host.trim();
+ let url = if host.contains("://") { host.to_owned() } else { format!("tcp://{host}") };
+ let mut args = vec!["--host".into(), url];
+ if let Some(dir) = tls_cert_dir.as_deref().map(str::trim).filter(|d| !d.is_empty()) {
+ let file = |name: &str| Path::new(dir).join(name).to_string_lossy().into_owned();
+ args.extend([
+ "--tlsverify".into(),
+ "--tlscacert".into(),
+ file("ca.pem"),
+ "--tlscert".into(),
+ file("cert.pem"),
+ "--tlskey".into(),
+ file("key.pem"),
+ ]);
+ }
+ args
+ }
+ Self::Context { name } => vec!["--context".into(), name.trim().to_owned()],
+ }
+ }
+
+ /// Adds the global options to `cmd`; an explicit endpoint also drops the
+ /// inherited `DOCKER_HOST` / `DOCKER_CONTEXT`, which would conflict.
+ pub(crate) fn apply(&self, cmd: &mut Command) {
+ if *self != Self::Default {
+ cmd.env_remove("DOCKER_HOST").env_remove("DOCKER_CONTEXT").env_remove("DOCKER_TLS_VERIFY");
+ }
+ cmd.args(self.global_args());
+ }
+
+ /// The same selection as environment variables, for docker command lines run by
+ /// others (run configurations). An empty value clears an inherited variable: the
+ /// CLI treats `DOCKER_HOST=""` as unset.
+ pub fn env_vars(&self) -> BTreeMap<String, String> {
+ let mut env = BTreeMap::new();
+ let mut set = |k: &str, v: String| {
+ env.insert(k.to_owned(), v);
+ };
+ match self {
+ Self::Default => {}
+ Self::Socket { path } => {
+ let path = path.trim();
+ set("DOCKER_HOST", if path.contains("://") { path.to_owned() } else { format!("unix://{path}") });
+ set("DOCKER_CONTEXT", String::new());
+ set("DOCKER_TLS_VERIFY", String::new());
+ }
+ Self::Tcp { host, tls_cert_dir } => {
+ let host = host.trim();
+ set("DOCKER_HOST", if host.contains("://") { host.to_owned() } else { format!("tcp://{host}") });
+ set("DOCKER_CONTEXT", String::new());
+ match tls_cert_dir.as_deref().map(str::trim).filter(|d| !d.is_empty()) {
+ // `DOCKER_CERT_PATH` holds `ca.pem`, `cert.pem` and `key.pem`, as `global_args` expects.
+ Some(dir) => {
+ set("DOCKER_TLS_VERIFY", "1".into());
+ set("DOCKER_CERT_PATH", dir.to_owned());
+ }
+ None => set("DOCKER_TLS_VERIFY", String::new()),
+ }
+ }
+ Self::Context { name } => {
+ set("DOCKER_CONTEXT", name.trim().to_owned());
+ set("DOCKER_HOST", String::new());
+ set("DOCKER_TLS_VERIFY", String::new());
+ }
+ }
+ env
+ }
+
+ pub fn validate(&self) -> IdeResult<()> {
+ let empty = match self {
+ Self::Default => false,
+ Self::Socket { path } => path.trim().is_empty(),
+ Self::Tcp { host, .. } => host.trim().is_empty(),
+ Self::Context { name } => name.trim().is_empty() || name.trim().starts_with('-'),
+ };
+ if empty { Err(IdeError::invalid("the Docker connection needs a socket, host or context")) } else { Ok(()) }
+ }
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct DockerConnection {
+ pub id: String,
+ pub name: String,
+ pub endpoint: DockerEndpoint,
+}
+
+/// A registry to log in to (Docker Hub, GHCR, a private one). The password is stored separately.
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct DockerRegistry {
+ pub id: String,
+ pub name: String,
+ /// `docker.io`, `ghcr.io`, `registry.example.com:5000`.
+ pub address: String,
+ #[serde(default)]
+ pub username: String,
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct DockerSettings {
+ #[serde(default = "default_connections")]
+ pub connections: Vec<DockerConnection>,
+ #[serde(default)]
+ pub registries: Vec<DockerRegistry>,
+}
+
+impl Default for DockerSettings {
+ fn default() -> Self {
+ Self { connections: default_connections(), registries: Vec::new() }
+ }
+}
+
+/// Before anything is configured the CLI's own daemon is shown, as before connections existed.
+fn default_connections() -> Vec<DockerConnection> {
+ vec![DockerConnection { id: "default".into(), name: "Docker".into(), endpoint: DockerEndpoint::Default }]
+}
+
+const SETTINGS_FILE: &str = "docker.json";
+const PASSWORDS_FILE: &str = "docker-passwords.json";
+
+pub fn load_settings(data_dir: &Path) -> DockerSettings {
+ match std::fs::read(data_dir.join(SETTINGS_FILE)) {
+ Ok(bytes) => serde_json::from_slice(&bytes).unwrap_or_else(|e| {
+ tracing::warn!("{SETTINGS_FILE}: {e}");
+ DockerSettings::default()
+ }),
+ Err(_) => DockerSettings::default(),
+ }
+}
+
+pub fn save_settings(data_dir: &Path, settings: &DockerSettings) -> IdeResult<()> {
+ for c in &settings.connections {
+ if c.id.is_empty() || c.name.trim().is_empty() {
+ return Err(IdeError::invalid("every Docker connection needs a name"));
+ }
+ c.endpoint.validate()?;
+ }
+ for r in &settings.registries {
+ if r.id.is_empty() || r.address.trim().is_empty() {
+ return Err(IdeError::invalid("every Docker registry needs an address"));
+ }
+ }
+ let bytes = serde_json::to_vec_pretty(settings).map_err(|e| IdeError::internal(e.to_string()))?;
+ write_file(&data_dir.join(SETTINGS_FILE), &bytes, false)?;
+ // Forget passwords of registries that are gone.
+ let mut passwords = read_passwords(data_dir);
+ let before = passwords.len();
+ passwords.retain(|id, _| settings.registries.iter().any(|r| &r.id == id));
+ if passwords.len() != before { write_passwords(data_dir, &passwords) } else { Ok(()) }
+}
+
+fn read_passwords(data_dir: &Path) -> BTreeMap<String, String> {
+ std::fs::read(data_dir.join(PASSWORDS_FILE)).ok().and_then(|b| serde_json::from_slice(&b).ok()).unwrap_or_default()
+}
+
+fn write_passwords(data_dir: &Path, all: &BTreeMap<String, String>) -> IdeResult<()> {
+ let bytes = serde_json::to_vec_pretty(all).map_err(|e| IdeError::internal(e.to_string()))?;
+ write_file(&data_dir.join(PASSWORDS_FILE), &bytes, true)
+}
+
+pub fn registry_password(data_dir: &Path, id: &str) -> Option<String> {
+ read_passwords(data_dir).remove(id)
+}
+
+/// Saves (or with `None` forgets) the password of registry `id`.
+pub fn set_registry_password(data_dir: &Path, id: &str, password: Option<&str>) -> IdeResult<()> {
+ let mut all = read_passwords(data_dir);
+ match password {
+ Some(p) => all.insert(id.to_owned(), p.to_owned()),
+ None => all.remove(id),
+ };
+ write_passwords(data_dir, &all)
+}
+
+fn write_file(path: &Path, bytes: &[u8], private: bool) -> IdeResult<()> {
+ if let Some(dir) = path.parent() {
+ std::fs::create_dir_all(dir)?;
+ }
+ let tmp = path.with_extension("json.tmp");
+ let mut options = std::fs::OpenOptions::new();
+ options.write(true).create(true).truncate(true);
+ #[cfg(unix)]
+ if private {
+ std::os::unix::fs::OpenOptionsExt::mode(&mut options, 0o600);
+ }
+ #[cfg(not(unix))]
+ let _ = private;
+ std::io::Write::write_all(&mut options.open(&tmp)?, bytes)?;
+ std::fs::rename(&tmp, path)?;
+ Ok(())
+}
+
+/// Canonical registry host: no scheme or path; Docker Hub's aliases become `docker.io`.
+pub fn registry_host(address: &str) -> String {
+ let a = address.trim();
+ let a = a.split_once("://").map_or(a, |(_, rest)| rest);
+ let host = a.split('/').next().unwrap_or_default().to_ascii_lowercase();
+ match host.as_str() {
+ "index.docker.io" | "registry-1.docker.io" | "registry.hub.docker.com" | "hub.docker.com" => "docker.io".into(),
+ _ => host,
+ }
+}
+
+/// Registry host an image reference pulls from (`postgres:16` → `docker.io`).
+pub fn reference_registry(reference: &str) -> String {
+ match reference.split_once('/') {
+ Some((first, _)) if first.contains('.') || first.contains(':') || first == "localhost" => registry_host(first),
+ _ => "docker.io".into(),
+ }
+}
+
+/// Credentials for a `docker login`.
+#[derive(Clone, Debug)]
+pub struct RegistryAuth {
+ pub address: String,
+ pub username: String,
+ pub password: String,
+}
+
+/// The saved registry (with a password) matching `reference`, if any.
+pub fn auth_for(data_dir: &Path, reference: &str) -> Option<RegistryAuth> {
+ let host = reference_registry(reference);
+ let settings = load_settings(data_dir);
+ let registry =
+ settings.registries.into_iter().find(|r| registry_host(&r.address) == host && !r.username.is_empty())?;
+ let password = registry_password(data_dir, &registry.id)?;
+ Some(RegistryAuth { address: registry.address, username: registry.username, password })
+}
+
+/// A throwaway docker config directory: logins happen there, never in the user's
+/// `~/.docker/config.json`. Contexts are copied so a context endpoint still resolves.
+pub(crate) struct TempConfig {
+ pub dir: PathBuf,
+}
+
+impl TempConfig {
+ pub fn new() -> IdeResult<Self> {
+ let nanos =
+ std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_nanos()).unwrap_or(0);
+ let dir = std::env::temp_dir().join(format!("openidea-docker-{}-{nanos}", std::process::id()));
+ std::fs::create_dir_all(&dir)?;
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::PermissionsExt;
+ let _ = std::fs::set_permissions(&dir, std::fs::Permissions::from_mode(0o700));
+ }
+ if let Some(contexts) = user_config_dir().map(|d| d.join("contexts")).filter(|d| d.is_dir()) {
+ let _ = copy_dir(&contexts, &dir.join("contexts"));
+ }
+ Ok(Self { dir })
+ }
+}
+
+impl Drop for TempConfig {
+ fn drop(&mut self) {
+ let _ = std::fs::remove_dir_all(&self.dir);
+ }
+}
+
+fn user_config_dir() -> Option<PathBuf> {
+ if let Some(dir) = std::env::var_os("DOCKER_CONFIG") {
+ return Some(PathBuf::from(dir));
+ }
+ let home = std::env::var_os(if cfg!(windows) { "USERPROFILE" } else { "HOME" })?;
+ Some(PathBuf::from(home).join(".docker"))
+}
+
+fn copy_dir(from: &Path, to: &Path) -> std::io::Result<()> {
+ std::fs::create_dir_all(to)?;
+ for e in std::fs::read_dir(from)?.flatten() {
+ let target = to.join(e.file_name());
+ if e.file_type()?.is_dir() {
+ copy_dir(&e.path(), &target)?;
+ } else {
+ std::fs::copy(e.path(), target)?;
+ }
+ }
+ Ok(())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn endpoint_args() {
+ assert!(DockerEndpoint::Default.global_args().is_empty());
+ assert_eq!(
+ DockerEndpoint::Socket { path: "/var/run/docker.sock".into() }.global_args(),
+ ["--host", "unix:///var/run/docker.sock"]
+ );
+ let tls = DockerEndpoint::Tcp { host: "build:2376".into(), tls_cert_dir: Some("/certs".into()) }.global_args();
+ assert_eq!(tls[..3], ["--host", "tcp://build:2376", "--tlsverify"]);
+ assert!(tls.contains(&Path::new("/certs").join("key.pem").to_string_lossy().into_owned()));
+ assert_eq!(
+ DockerEndpoint::Tcp { host: "ssh://me@box".into(), tls_cert_dir: Some(" ".into()) }.global_args(),
+ ["--host", "ssh://me@box"]
+ );
+ assert_eq!(DockerEndpoint::Context { name: "orbstack".into() }.global_args(), ["--context", "orbstack"]);
+ assert!(DockerEndpoint::Context { name: "--x".into() }.validate().is_err());
+ }
+
+ #[test]
+ fn endpoint_env() {
+ assert!(DockerEndpoint::Default.env_vars().is_empty());
+ let socket = DockerEndpoint::Socket { path: "/var/run/docker.sock".into() }.env_vars();
+ assert_eq!(socket["DOCKER_HOST"], "unix:///var/run/docker.sock");
+ assert_eq!(socket["DOCKER_CONTEXT"], "");
+ let tls = DockerEndpoint::Tcp { host: "build:2376".into(), tls_cert_dir: Some("/certs".into()) }.env_vars();
+ assert_eq!(
+ (tls["DOCKER_HOST"].as_str(), tls["DOCKER_TLS_VERIFY"].as_str(), tls["DOCKER_CERT_PATH"].as_str()),
+ ("tcp://build:2376", "1", "/certs")
+ );
+ let ssh = DockerEndpoint::Tcp { host: "ssh://me@box".into(), tls_cert_dir: None }.env_vars();
+ assert_eq!((ssh["DOCKER_HOST"].as_str(), ssh["DOCKER_TLS_VERIFY"].as_str()), ("ssh://me@box", ""));
+ assert!(!ssh.contains_key("DOCKER_CERT_PATH"));
+ let ctx = DockerEndpoint::Context { name: " orbstack ".into() }.env_vars();
+ assert_eq!((ctx["DOCKER_CONTEXT"].as_str(), ctx["DOCKER_HOST"].as_str()), ("orbstack", ""));
+ }
+
+ #[test]
+ fn registries_match_references() {
+ assert_eq!(reference_registry("postgres:16"), "docker.io");
+ assert_eq!(reference_registry("library/postgres"), "docker.io");
+ assert_eq!(reference_registry("ghcr.io/org/app:1"), "ghcr.io");
+ assert_eq!(reference_registry("localhost:5000/app"), "localhost:5000");
+ assert_eq!(registry_host("https://index.docker.io/v1/"), "docker.io");
+ assert_eq!(registry_host("GHCR.io"), "ghcr.io");
+ }
+
+ #[test]
+ fn settings_round_trip_and_passwords() {
+ let tmp = tempfile::tempdir().unwrap();
+ let dir = tmp.path();
+ assert_eq!(load_settings(dir).connections[0].endpoint, DockerEndpoint::Default);
+ let settings = DockerSettings {
+ connections: vec![DockerConnection {
+ id: "c1".into(),
+ name: "Build box".into(),
+ endpoint: DockerEndpoint::Tcp { host: "build:2376".into(), tls_cert_dir: None },
+ }],
+ registries: vec![DockerRegistry {
+ id: "r1".into(),
+ name: "GHCR".into(),
+ address: "ghcr.io".into(),
+ username: "me".into(),
+ }],
+ };
+ save_settings(dir, &settings).unwrap();
+ assert_eq!(load_settings(dir), settings);
+ set_registry_password(dir, "r1", Some("s3cret")).unwrap();
+ let auth = auth_for(dir, "ghcr.io/org/app").unwrap();
+ assert_eq!((auth.username.as_str(), auth.password.as_str()), ("me", "s3cret"));
+ assert!(auth_for(dir, "postgres").is_none());
+ save_settings(dir, &DockerSettings { registries: Vec::new(), ..settings }).unwrap();
+ assert_eq!(registry_password(dir, "r1"), None);
+ // An empty list stays empty (the default connection is only for a missing file).
+ save_settings(dir, &DockerSettings { connections: Vec::new(), registries: Vec::new() }).unwrap();
+ assert!(load_settings(dir).connections.is_empty());
+ }
+}
diff --git a/crates/ide-docker/src/lib.rs b/crates/ide-docker/src/lib.rs
index 63c6d359d..22d4549a9 100644
--- a/crates/ide-docker/src/lib.rs
+++ b/crates/ide-docker/src/lib.rs
@@ -4,9 +4,11 @@
//!
//! Every function blocks; callers run them off the UI / command threads.
+mod connection;
mod model;
mod process;
+pub use connection::*;
pub use model::*;
use ide_core::{CancellationToken, IdeError, IdeResult};
@@ -61,21 +63,38 @@ pub fn docker_executable() -> Option<PathBuf> {
.clone()
}
+/// Environment for docker command lines a run configuration launches: the endpoint's
+/// variables plus a `PATH` that starts with docker's directory (GUI apps on macOS
+/// lack the usual install locations), so `docker` / `docker compose` resolve.
+pub fn run_env(ep: &DockerEndpoint) -> std::collections::BTreeMap<String, String> {
+ let mut env = ep.env_vars();
+ if let Some(dir) = docker_executable().as_deref().and_then(Path::parent) {
+ let current = std::env::var_os("PATH").unwrap_or_default();
+ let mut dirs: Vec<PathBuf> = vec![dir.to_path_buf()];
+ dirs.extend(std::env::split_paths(&current).filter(|d| d != dir));
+ if let Ok(path) = std::env::join_paths(dirs) {
+ env.insert("PATH".into(), path.to_string_lossy().into_owned());
+ }
+ }
+ env
+}
+
fn binary() -> IdeResult<PathBuf> {
docker_executable()
.ok_or_else(|| IdeError::unavailable("docker executable not found; install Docker and make sure it is on PATH"))
}
-fn command(args: &[&str]) -> IdeResult<Command> {
+fn command(ep: &DockerEndpoint, args: &[&str]) -> IdeResult<Command> {
let mut cmd = Command::new(binary()?);
+ ep.apply(&mut cmd);
cmd.args(args).env("DOCKER_CLI_HINTS", "false").env("NO_COLOR", "1");
tracing::debug!(?args, "docker");
Ok(cmd)
}
/// Runs a docker command, mapping a non-zero exit to an error with docker's message.
-fn run(args: &[&str], timeout: Duration) -> IdeResult<String> {
- let out = process::run(command(args)?, timeout, None)?;
+fn run(ep: &DockerEndpoint, args: &[&str], timeout: Duration) -> IdeResult<String> {
+ let out = process::run(command(ep, args)?, timeout, None)?;
if out.success { Ok(out.stdout) } else { Err(failure(args, &out.stderr, &out.stdout)) }
}
@@ -94,8 +113,8 @@ fn failure(args: &[&str], stderr: &str, stdout: &str) -> IdeError {
}
/// Whether docker can be used right now.
-pub fn availability() -> DockerAvailability {
- let Ok(cmd) = command(&["version", "--format", "{{json .}}"]) else {
+pub fn availability(ep: &DockerEndpoint) -> DockerAvailability {
+ let Ok(cmd) = command(ep, &["version", "--format", "{{json .}}"]) else {
return DockerAvailability::NotInstalled;
};
match process::run(cmd, Duration::from_secs(15), None) {
@@ -105,8 +124,8 @@ pub fn availability() -> DockerAvailability {
}
/// Availability plus containers, images, volumes and networks (listed in parallel).
-pub fn snapshot() -> DockerSnapshot {
- let availability = availability();
+pub fn snapshot(ep: &DockerEndpoint) -> DockerSnapshot {
+ let availability = availability(ep);
let executable = docker_executable().map(|p| ide_core::ipc_path::to_ipc(&p));
let mut snap = DockerSnapshot {
availability,
@@ -116,16 +135,17 @@ pub fn snapshot() -> DockerSnapshot {
volumes: Vec::new(),
networks: Vec::new(),
errors: Vec::new(),
+ global_args: ep.global_args(),
};
if !matches!(snap.availability, DockerAvailability::Ready { .. }) {
return snap;
}
const FMT: &str = "{{json .}}";
let (containers, images, volumes, networks) = std::thread::scope(|s| {
- let c = s.spawn(|| run(&["ps", "--all", "--no-trunc", "--format", FMT], QUICK));
- let i = s.spawn(|| run(&["image", "ls", "--no-trunc", "--format", FMT], QUICK));
- let v = s.spawn(|| run(&["volume", "ls", "--format", FMT], QUICK));
- let n = s.spawn(|| run(&["network", "ls", "--no-trunc", "--format", FMT], QUICK));
+ let c = s.spawn(|| run(ep, &["ps", "--all", "--no-trunc", "--format", FMT], QUICK));
+ let i = s.spawn(|| run(ep, &["image", "ls", "--no-trunc", "--format", FMT], QUICK));
+ let v = s.spawn(|| run(ep, &["volume", "ls", "--format", FMT], QUICK));
+ let n = s.spawn(|| run(ep, &["network", "ls", "--no-trunc", "--format", FMT], QUICK));
let join = |h: std::thread::ScopedJoinHandle<'_, IdeResult<String>>| {
h.join().unwrap_or_else(|_| Err(IdeError::internal("docker listing panicked")))
};
@@ -178,13 +198,13 @@ impl ContainerOp {
}
/// Starts / stops / … the containers `ids`.
-pub fn container_op(ids: &[String], op: ContainerOp) -> IdeResult<()> {
+pub fn container_op(ep: &DockerEndpoint, ids: &[String], op: ContainerOp) -> IdeResult<()> {
if ids.is_empty() {
return Ok(());
}
let mut args = vec!["container", op.verb()];
args.extend(ids.iter().map(String::as_str));
- run(&args, LIFECYCLE).map(drop)
+ run(ep, &args, LIFECYCLE).map(drop)
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
@@ -208,7 +228,7 @@ impl DockerObject {
}
/// `docker <object> rm` (`force`: stop running containers / untag used images first).
-pub fn remove(object: DockerObject, ids: &[String], force: bool) -> IdeResult<()> {
+pub fn remove(ep: &DockerEndpoint, object: DockerObject, ids: &[String], force: bool) -> IdeResult<()> {
if ids.is_empty() {
return Ok(());
}
@@ -217,12 +237,12 @@ pub fn remove(object: DockerObject, ids: &[String], force: bool) -> IdeResult<()
args.push("--force");
}
args.extend(ids.iter().map(String::as_str));
- run(&args, LIFECYCLE).map(drop)
+ run(ep, &args, LIFECYCLE).map(drop)
}
/// `docker inspect` of one object, pretty-printed.
-pub fn inspect(object: DockerObject, id: &str) -> IdeResult<String> {
- let out = run(&["inspect", "--type", object.noun(), id], QUICK)?;
+pub fn inspect(ep: &DockerEndpoint, object: DockerObject, id: &str) -> IdeResult<String> {
+ let out = run(ep, &["inspect", "--type", object.noun(), id], QUICK)?;
match serde_json::from_str::<serde_json::Value>(&out) {
// A one-element array for a single id: show the object itself.
Ok(serde_json::Value::Array(mut items)) if items.len() == 1 => {
@@ -236,6 +256,7 @@ pub fn inspect(object: DockerObject, id: &str) -> IdeResult<String> {
/// Streams a container's logs (`tail` last lines, then follows while `follow`)
/// until it ends or `cancel` fires.
pub fn logs(
+ ep: &DockerEndpoint,
id: &str,
tail: u32,
follow: bool,
@@ -252,16 +273,16 @@ pub fn logs(
args.push("--timestamps");
}
args.push(id);
- let (ok, stderr) = process::stream(command(&args)?, cancel, &mut |stream, text| {
+ let (ok, stderr) = process::stream(command(ep, &args)?, cancel, &mut |stream, text| {
on_line(DockerLogLine { stderr: stream == Stream::Stderr, text })
})?;
if ok { Ok(()) } else { Err(failure(&args, &stderr.join("\n"), "")) }
}
/// Follows `docker events` until it ends (daemon gone) or `cancel` fires.
-pub fn watch_events(cancel: &CancellationToken, on_event: &dyn Fn(DockerEvent)) -> IdeResult<()> {
+pub fn watch_events(ep: &DockerEndpoint, cancel: &CancellationToken, on_event: &dyn Fn(DockerEvent)) -> IdeResult<()> {
let args = ["events", "--format", "{{json .}}"];
- let (ok, stderr) = process::stream(command(&args)?, cancel, &mut |stream, line| {
+ let (ok, stderr) = process::stream(command(ep, &args)?, cancel, &mut |stream, line| {
if stream == Stream::Stdout
&& let Some(e) = parse_event(&line)
{
@@ -272,9 +293,19 @@ pub fn watch_events(cancel: &CancellationToken, on_event: &dyn Fn(DockerEvent))
}
/// Runs a long docker command (pull, prune, compose…), streaming its output lines.
-fn run_streaming(args: &[&str], cancel: &CancellationToken, on_output: &dyn Fn(String)) -> IdeResult<()> {
+fn run_streaming(
+ ep: &DockerEndpoint,
+ config: Option<&Path>,
+ args: &[&str],
+ cancel: &CancellationToken,
+ on_output: &dyn Fn(String),
+) -> IdeResult<()> {
on_output(format!("docker {}", args.join(" ")));
- let (ok, stderr) = process::stream(command(args)?, cancel, &mut |_, line| {
+ let mut cmd = command(ep, args)?;
+ if let Some(dir) = config {
+ cmd.env("DOCKER_CONFIG", dir);
+ }
+ let (ok, stderr) = process::stream(cmd, cancel, &mut |_, line| {
if !line.trim().is_empty() {
on_output(line);
}
@@ -282,13 +313,57 @@ fn run_streaming(args: &[&str], cancel: &CancellationToken, on_output: &dyn Fn(S
if ok { Ok(()) } else { Err(failure(args, &stderr.join("\n"), "")) }
}
-/// `docker pull <reference>`.
-pub fn pull(reference: &str, cancel: &CancellationToken, on_output: &dyn Fn(String)) -> IdeResult<()> {
+/// `docker pull <reference>`; with `auth` it logs in to the registry first, in a
+/// throwaway config directory (the user's docker config stays untouched).
+pub fn pull(
+ ep: &DockerEndpoint,
+ reference: &str,
+ auth: Option<&RegistryAuth>,
+ cancel: &CancellationToken,
+ on_output: &dyn Fn(String),
+) -> IdeResult<()> {
let reference = reference.trim();
if reference.is_empty() || reference.starts_with('-') {
return Err(IdeError::invalid("enter an image name, e.g. postgres:16"));
}
- run_streaming(&["pull", reference], cancel, on_output)
+ let Some(auth) = auth else { return run_streaming(ep, None, &["pull", reference], cancel, on_output) };
+ let config = TempConfig::new()?;
+ on_output(format!("Logging in to {} as {}", auth.address, auth.username));
+ login_in(ep, &config.dir, auth, Some(cancel))?;
+ run_streaming(ep, Some(&config.dir), &["pull", reference], cancel, on_output)
+}
+
+/// `docker login` with `auth`; returns docker's answer (`Login Succeeded`). Nothing is
+/// stored in the user's docker config.
+pub fn login(ep: &DockerEndpoint, auth: &RegistryAuth) -> IdeResult<String> {
+ let config = TempConfig::new()?;
+ login_in(ep, &config.dir, auth, None)
+}
+
+fn login_in(
+ ep: &DockerEndpoint,
+ config: &Path,
+ auth: &RegistryAuth,
+ cancel: Option<&CancellationToken>,
+) -> IdeResult<String> {
+ let host = registry_host(&auth.address);
+ let user = auth.username.trim();
+ if host.is_empty() || host.starts_with('-') || user.is_empty() || user.starts_with('-') {
+ return Err(IdeError::invalid("the registry needs an address and a username"));
+ }
+ let mut args = vec!["login", "--username", user, "--password-stdin"];
+ // Docker Hub is the CLI's default server.
+ if host != "docker.io" {
+ args.push(&host);
+ }
+ let mut cmd = command(ep, &args)?;
+ cmd.env("DOCKER_CONFIG", config);
+ let out = process::run_with_input(cmd, QUICK, cancel, Some(&auth.password))?;
+ if out.success {
+ Ok(out.stdout.lines().map(str::trim).rfind(|l| !l.is_empty()).unwrap_or("Login Succeeded").to_owned())
+ } else {
+ Err(failure(&args, &out.stderr, &out.stdout))
+ }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
@@ -306,7 +381,12 @@ pub enum PruneTarget {
}
/// `docker <object> prune --force`.
-pub fn prune(target: PruneTarget, cancel: &CancellationToken, on_output: &dyn Fn(String)) -> IdeResult<()> {
+pub fn prune(
+ ep: &DockerEndpoint,
+ target: PruneTarget,
+ cancel: &CancellationToken,
+ on_output: &dyn Fn(String),
+) -> IdeResult<()> {
let args: &[&str] = match target {
PruneTarget::Containers => &["container", "prune", "--force"],
PruneTarget::Images => &["image", "prune", "--force"],
@@ -315,7 +395,7 @@ pub fn prune(target: PruneTarget, cancel: &CancellationToken, on_output: &dyn Fn
PruneTarget::Networks => &["network", "prune", "--force"],
PruneTarget::System => &["system", "prune", "--force"],
};
- run_streaming(args, cancel, on_output)
+ run_streaming(ep, None, args, cancel, on_output)
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
@@ -332,6 +412,7 @@ pub enum ComposeOp {
/// labels. `files` / `working_dir` (from the labels too) are passed when they still
/// exist, so commands that need the model keep working.
pub fn compose_op(
+ ep: &DockerEndpoint,
project: &str,
files: &[String],
working_dir: Option<&str>,
@@ -357,5 +438,5 @@ pub fn compose_op(
ComposeOp::Restart => "restart",
ComposeOp::Down => "down",
});
- run_streaming(&args, cancel, on_output)
+ run_streaming(ep, None, &args, cancel, on_output)
}
diff --git a/crates/ide-docker/src/model.rs b/crates/ide-docker/src/model.rs
index d803ef7a4..1cdc1098a 100644
--- a/crates/ide-docker/src/model.rs
+++ b/crates/ide-docker/src/model.rs
@@ -105,6 +105,9 @@ pub struct DockerSnapshot {
pub networks: Vec<DockerNetwork>,
/// Lists that failed although the daemon answered (shown, not fatal).
pub errors: Vec<String>,
+ /// Global CLI options selecting the connection's daemon (for `docker exec` in a terminal).
+ #[serde(default)]
+ pub global_args: Vec<String>,
}
/// One relevant `docker events` entry.
diff --git a/crates/ide-docker/src/process.rs b/crates/ide-docker/src/process.rs
index f0c47f044..5deb05e39 100644
--- a/crates/ide-docker/src/process.rs
+++ b/crates/ide-docker/src/process.rs
@@ -60,9 +60,26 @@ fn read_all(mut pipe: impl Read + Send + 'static) -> std::thread::JoinHandle<Str
/// Runs `cmd` to completion. Fails when it outlives `timeout` or `cancel` fires;
/// a non-zero exit is reported in [`Output::success`], not as an error.
-pub(crate) fn run(mut cmd: Command, timeout: Duration, cancel: Option<&CancellationToken>) -> IdeResult<Output> {
+pub(crate) fn run(cmd: Command, timeout: Duration, cancel: Option<&CancellationToken>) -> IdeResult<Output> {
+ run_with_input(cmd, timeout, cancel, None)
+}
+
+/// [`run`] with `input` written to the child's stdin (e.g. `--password-stdin`).
+pub(crate) fn run_with_input(
+ mut cmd: Command,
+ timeout: Duration,
+ cancel: Option<&CancellationToken>,
+ input: Option<&str>,
+) -> IdeResult<Output> {
prepare(&mut cmd);
+ if input.is_some() {
+ cmd.stdin(Stdio::piped());
+ }
let mut child = spawn(&mut cmd)?;
+ if let (Some(text), Some(mut stdin)) = (input, child.stdin.take()) {
+ // Dropping `stdin` afterwards closes it, so the CLI sees EOF.
+ let _ = std::io::Write::write_all(&mut stdin, text.as_bytes());
+ }
let out = child.stdout.take().map(read_all);
let err = child.stderr.take().map(read_all);
let deadline = Instant::now() + timeout;
diff --git a/crates/ide-index/src/data.rs b/crates/ide-index/src/data.rs
index 4dddf8264..591154308 100644
--- a/crates/ide-index/src/data.rs
+++ b/crates/ide-index/src/data.rs
@@ -181,10 +181,10 @@ impl IndexData {
Some(old)
}
- /// Removes every file at or below `dir`; returns their relative paths.
- pub(crate) fn remove_tree(&mut self, dir: &Path) -> Vec<String> {
+ /// Removes every file at or below `dir`; returns their paths.
+ pub(crate) fn remove_tree(&mut self, dir: &Path) -> Vec<PathBuf> {
let doomed: Vec<PathBuf> = self.by_path.keys().filter(|p| p.starts_with(dir)).cloned().collect();
- doomed.iter().filter_map(|p| self.remove(p)).map(|e| e.rel.into_string()).collect()
+ doomed.into_iter().filter(|p| self.remove(p).is_some()).collect()
}
/// Releases spare capacity (after large deletions).
@@ -235,7 +235,7 @@ mod tests {
assert_eq!((d.file_count, d.symbol_count), (1, 5));
d.insert(entry("d.rs", 0));
assert_eq!(d.files.len(), 2, "slot reused");
- assert_eq!(d.remove_tree(Path::new("/r/a")), vec!["a/b.rs".to_owned()]);
+ assert_eq!(d.remove_tree(Path::new("/r/a")), vec![PathBuf::from("/r/a/b.rs")]);
assert_eq!((d.file_count, d.symbol_count), (1, 0));
let e = d.get(Path::new("/r/d.rs")).unwrap();
assert_eq!((e.name(), e.dir()), ("d.rs", ""));
diff --git a/crates/ide-index/src/filter.rs b/crates/ide-index/src/filter.rs
index edf5b5a36..eb8756108 100644
--- a/crates/ide-index/src/filter.rs
+++ b/crates/ide-index/src/filter.rs
@@ -1,5 +1,6 @@
//! Which paths belong in the index: `.gitignore`/`.ignore` rules (via the
-//! `ignore` crate) plus the user's `files.exclude` globs.
+//! `ignore` crate) plus the user's `files.exclude` globs, below the project root
+//! and the extra content roots (Project Structure).
use globset::{GlobBuilder, GlobSet, GlobSetBuilder};
use ignore::gitignore::{Gitignore, GitignoreBuilder};
@@ -14,10 +15,45 @@ const ALWAYS_SKIP: &[&str] = &[".git", ".hg", ".svn", ".jj"];
pub(crate) struct PathFilter {
root: PathBuf,
+ /// Content roots outside `root`, indexed as `<folder name>/<path>`.
+ extra: Vec<ExtraRoot>,
excludes: GlobSet,
/// Root-level ignore files, for paths reported by the watcher (the walker
/// applies nested ignore files itself).
gitignore: Gitignore,
+ /// What the filter was built from: `(extra roots, exclude globs)`.
+ config: (Vec<PathBuf>, Vec<String>),
+}
+
+struct ExtraRoot {
+ path: PathBuf,
+ /// Shown before the paths inside it (`shared-lib/src/x.rs`).
+ name: String,
+ gitignore: Gitignore,
+}
+
+fn root_ignores(root: &Path) -> Gitignore {
+ let mut gi = GitignoreBuilder::new(root);
+ for f in [".gitignore", ".ignore", ".git/info/exclude"] {
+ let path = root.join(f);
+ if path.is_file()
+ && let Some(e) = gi.add(&path)
+ {
+ tracing::debug!("{}: {e}", path.display());
+ }
+ }
+ gi.build().unwrap_or_else(|_| Gitignore::empty())
+}
+
+fn rel_string(rel: &Path) -> String {
+ let mut out = String::new();
+ for c in rel.components() {
+ if !out.is_empty() {
+ out.push('/');
+ }
+ out.push_str(&c.as_os_str().to_string_lossy());
+ }
+ out
}
#[derive(Clone, Debug)]
@@ -32,9 +68,9 @@ pub(crate) fn mtime_of(meta: &std::fs::Metadata) -> u64 {
}
impl PathFilter {
- pub(crate) fn new(root: &Path, excludes: &[String]) -> Self {
+ pub(crate) fn new(root: &Path, extra_roots: &[PathBuf], exclude_globs: &[String]) -> Self {
let mut set = GlobSetBuilder::new();
- for raw in excludes {
+ for raw in exclude_globs {
let p = raw.trim().trim_end_matches('/');
let anchored = p.starts_with('/');
let p = p.trim_start_matches("./").trim_start_matches('/');
@@ -55,34 +91,76 @@ impl PathFilter {
}
}
let excludes = set.build().unwrap_or_else(|_| GlobSet::empty());
- let mut gi = GitignoreBuilder::new(root);
- for f in [".gitignore", ".ignore", ".git/info/exclude"] {
- let path = root.join(f);
- if path.is_file()
- && let Some(e) = gi.add(&path)
- {
- tracing::debug!("{}: {e}", path.display());
+ let mut extra: Vec<ExtraRoot> = Vec::new();
+ for r in extra_roots {
+ let path = dunce::canonicalize(r).unwrap_or_else(|_| r.clone());
+ let nested = path.starts_with(root)
+ || root.starts_with(&path)
+ || extra.iter().any(|e| path.starts_with(&e.path) || e.path.starts_with(&path));
+ if nested || !path.is_dir() {
+ continue;
}
+ let name = path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default();
+ extra.push(ExtraRoot { gitignore: root_ignores(&path), name, path });
}
- let gitignore = gi.build().unwrap_or_else(|_| Gitignore::empty());
- Self { root: root.to_owned(), excludes, gitignore }
+ Self {
+ root: root.to_owned(),
+ extra,
+ excludes,
+ gitignore: root_ignores(root),
+ config: (extra_roots.to_vec(), exclude_globs.to_vec()),
+ }
+ }
+
+ /// Whether the filter was built from these roots and globs.
+ pub(crate) fn same_config(&self, extra_roots: &[PathBuf], excludes: &[String]) -> bool {
+ self.config.0 == extra_roots && self.config.1 == excludes
}
pub(crate) fn root(&self) -> &Path {
&self.root
}
- /// `/`-separated path relative to the root.
+ /// The project root, then the extra content roots.
+ pub(crate) fn roots(&self) -> impl Iterator<Item = &Path> {
+ std::iter::once(self.root.as_path()).chain(self.extra.iter().map(|e| e.path.as_path()))
+ }
+
+ /// The root containing `path`, its display prefix (`None` for the project root) and ignore rules.
+ fn base_of(&self, path: &Path) -> Option<(&Path, Option<&str>, &Gitignore)> {
+ if path.starts_with(&self.root) {
+ return Some((&self.root, None, &self.gitignore));
+ }
+ self.extra
+ .iter()
+ .find(|e| path.starts_with(&e.path))
+ .map(|e| (e.path.as_path(), Some(e.name.as_str()), &e.gitignore))
+ }
+
+ /// Whether `path` is (at or) below one of the roots.
+ pub(crate) fn contains(&self, path: &Path) -> bool {
+ self.base_of(path).is_some()
+ }
+
+ /// `/`-separated path relative to its root, as displayed; paths in extra
+ /// content roots start with the root's folder name.
pub(crate) fn rel(&self, path: &Path) -> Option<String> {
- let rel = path.strip_prefix(&self.root).ok()?;
- let mut out = String::new();
- for c in rel.components() {
- if !out.is_empty() {
- out.push('/');
- }
- out.push_str(&c.as_os_str().to_string_lossy());
+ let (base, prefix, _) = self.base_of(path)?;
+ let rel = rel_string(path.strip_prefix(base).ok()?);
+ if rel.is_empty() {
+ return None;
}
- (!out.is_empty()).then_some(out)
+ Some(match prefix {
+ Some(p) => format!("{p}/{rel}"),
+ None => rel,
+ })
+ }
+
+ /// Key of `path` in the persistent store: only files below the project root
+ /// are persisted (extra content roots are rescanned when the project opens).
+ pub(crate) fn store_key(&self, path: &Path) -> Option<String> {
+ let rel = rel_string(path.strip_prefix(&self.root).ok()?);
+ (!rel.is_empty()).then_some(rel)
}
fn excluded_rel(&self, rel: &str) -> bool {
@@ -96,7 +174,11 @@ impl PathFilter {
/// Whether a path reported by the watcher should be ignored (outside the
/// root, inside an excluded/ignored directory, or ignored itself).
pub(crate) fn is_excluded(&self, path: &Path, is_dir: bool) -> bool {
- let Some(rel) = self.rel(path) else { return true };
+ let Some((base, _, gitignore)) = self.base_of(path) else { return true };
+ let rel = path.strip_prefix(base).map(rel_string).unwrap_or_default();
+ if rel.is_empty() {
+ return true;
+ }
let mut prefix = String::new();
for seg in rel.split('/') {
if Self::skip_name(seg) {
@@ -110,14 +192,15 @@ impl PathFilter {
return true;
}
}
- self.gitignore.matched_path_or_any_parents(path, is_dir).is_ignore()
+ gitignore.matched_path_or_any_parents(path, is_dir).is_ignore()
}
/// All indexable files at or below `dir`, walked in parallel.
/// Stops early (returning what was found so far) once `cancel` is set.
pub(crate) fn walk(&self, dir: &Path, cancel: &AtomicBool) -> Vec<Found> {
let (tx, rx) = mpsc::channel::<Vec<Found>>();
- let root = self.root.clone();
+ let Some((root, _, _)) = self.base_of(dir) else { return Vec::new() };
+ let root = root.to_path_buf();
let excludes = self.excludes.clone();
let walker = WalkBuilder::new(dir)
.hidden(false)
@@ -207,7 +290,7 @@ mod tests {
touch(&root, f);
}
std::fs::write(root.join(".gitignore"), "build/\n").unwrap();
- let filter = PathFilter::new(&root, &["**/node_modules".into(), "target".into(), "docs/**".into()]);
+ let filter = PathFilter::new(&root, &[], &["**/node_modules".into(), "target".into(), "docs/**".into()]);
let mut found: Vec<String> =
filter.walk(&root, &AtomicBool::new(false)).iter().filter_map(|f| filter.rel(&f.path)).collect();
found.sort();
@@ -220,4 +303,31 @@ mod tests {
assert!(filter.is_excluded(Path::new("/elsewhere/x.rs"), false));
assert!(!filter.is_excluded(&root.join("src/new.rs"), false));
}
+
+ #[test]
+ fn extra_content_roots_are_walked_and_prefixed() {
+ let dir = tempfile::tempdir().unwrap();
+ let base = dunce::canonicalize(dir.path()).unwrap();
+ let (root, shared) = (base.join("app"), base.join("shared-lib"));
+ for f in ["app/src/a.rs", "shared-lib/src/b.rs", "shared-lib/target/gen.rs", "shared-lib/out/x.rs"] {
+ touch(&base, f);
+ }
+ std::fs::write(shared.join(".gitignore"), "out/\n").unwrap();
+ let filter = PathFilter::new(&root, &[shared.clone(), root.join("src")], &["target".into()]);
+ assert_eq!(filter.roots().count(), 2, "roots inside the project are not extra roots");
+ let mut found: Vec<String> = filter
+ .roots()
+ .flat_map(|r| filter.walk(r, &AtomicBool::new(false)))
+ .filter_map(|f| filter.rel(&f.path))
+ .collect();
+ found.sort();
+ assert_eq!(found, ["shared-lib/.gitignore", "shared-lib/src/b.rs", "src/a.rs"]);
+ assert_eq!(filter.store_key(&shared.join("src/b.rs")), None, "extra roots are not persisted");
+ assert_eq!(filter.store_key(&root.join("src/a.rs")).as_deref(), Some("src/a.rs"));
+ assert!(!filter.is_excluded(&shared.join("src/new.rs"), false));
+ assert!(filter.is_excluded(&shared.join("target/y.rs"), false));
+ assert!(filter.is_excluded(&shared.join("out/y.rs"), false));
+ assert!(filter.same_config(&[shared.clone(), root.join("src")], &["target".into()]));
+ assert!(!filter.same_config(&[shared], &["target".into()]));
+ }
}
diff --git a/crates/ide-index/src/lib.rs b/crates/ide-index/src/lib.rs
index 2d737f9ff..ac7361c23 100644
--- a/crates/ide-index/src/lib.rs
+++ b/crates/ide-index/src/lib.rs
@@ -67,14 +67,17 @@ pub struct IndexStatus {
pub struct ProjectIndex {
shared: Arc<Shared>,
worker: Mutex<Option<JoinHandle<()>>>,
+ root: PathBuf,
}
impl ProjectIndex {
/// Opens (or creates) the persistent index at `cache_dir` and starts a
/// background full scan that skips files whose content hash is unchanged.
+ /// `content_roots` are folders outside `root` indexed with it (not persisted).
pub fn open(
root: &Path,
cache_dir: &Path,
+ content_roots: Vec<PathBuf>,
excludes: Vec<String>,
languages: Arc<LanguageRegistry>,
syntax: Arc<Syntax>,
@@ -85,7 +88,7 @@ impl ProjectIndex {
return Err(ide_core::IdeError::not_found(format!("{} is not a directory", root.display())));
}
let store = store::Store::open(cache_dir, &root, &syntax.fingerprint());
- let filter = filter::PathFilter::new(&root, &excludes);
+ let filter = filter::PathFilter::new(&root, &content_roots, &excludes);
let shared = Arc::new(Shared::new(filter, languages, syntax, sink, store));
let worker = {
let shared = shared.clone();
@@ -94,7 +97,25 @@ impl ProjectIndex {
.spawn(move || shared.run())
.map_err(|e| ide_core::IdeError::internal(format!("cannot start indexer: {e}")))?
};
- Ok(Arc::new(Self { shared, worker: Mutex::new(Some(worker)) }))
+ Ok(Arc::new(Self { shared, worker: Mutex::new(Some(worker)), root }))
+ }
+
+ /// Changes what is indexed besides the root (content roots) and the exclude
+ /// globs, rescanning in the background (unchanged files are not re-read).
+ /// Returns whether anything changed.
+ pub fn set_scope(&self, content_roots: Vec<PathBuf>, excludes: Vec<String>) -> bool {
+ if self.shared.filter().same_config(&content_roots, &excludes) {
+ return false;
+ }
+ self.shared.set_filter(filter::PathFilter::new(&self.root, &content_roots, &excludes));
+ self.shared.enqueue(Job::Rescan);
+ true
+ }
+
+ /// File types changed (the registry the index shares was updated): re-parses
+ /// the files whose language under `before` differs from the current one.
+ pub fn languages_changed(&self, before: Arc<LanguageRegistry>) {
+ self.shared.enqueue(Job::Reparse(before));
}
pub fn status(&self) -> IndexStatus {
@@ -202,14 +223,15 @@ impl ProjectIndex {
}
pub fn root(&self) -> &Path {
- self.shared.filter.root()
+ &self.root
}
- /// Absolute path inside the root, or `None` for paths outside the project / excluded.
+ /// Absolute path inside the root (or a content root), or `None` for paths outside the project.
fn normalize(&self, path: &Path) -> Option<PathBuf> {
- let root = self.shared.filter.root();
+ let filter = self.shared.filter();
+ let root = &self.root;
let path = if path.is_absolute() { path.to_owned() } else { root.join(path) };
- let path = if path.starts_with(root) {
+ let path = if filter.contains(&path) {
path
} else {
// Watchers / the UI may report non-canonical spellings (`/tmp` vs `/private/tmp`).
@@ -221,7 +243,7 @@ impl ProjectIndex {
}
}
};
- (path.starts_with(root) && path != root).then_some(path)
+ (filter.contains(&path) && filter.rel(&path).is_some()).then_some(path)
}
}
diff --git a/crates/ide-index/src/tests.rs b/crates/ide-index/src/tests.rs
index 1de6c22d4..3d6bbdd9a 100644
--- a/crates/ide-index/src/tests.rs
+++ b/crates/ide-index/src/tests.rs
@@ -37,6 +37,7 @@ impl Fixture {
let idx = ProjectIndex::open(
&self.root,
&self.cache,
+ Vec::new(),
vec!["**/node_modules".into(), "**/target".into()],
languages,
syntax,
@@ -403,3 +404,72 @@ fn css_selectors_are_found_by_exact_name() {
assert_eq!(idx.symbols_named("--gap", None, 10).len(), 1);
assert!(idx.symbols_named(".card", Some(SymbolKind::Field), 10).is_empty());
}
+
+#[test]
+fn content_roots_and_excludes_change_without_reopening() {
+ let fx = Fixture::new(&[("src/main.rs", "fn alpha() {}\n"), ("src/gen/out.rs", "fn generated() {}\n")]);
+ let shared = fx._dir.path().join("shared-lib");
+ std::fs::create_dir_all(shared.join("src")).unwrap();
+ std::fs::write(shared.join("src/lib.rs"), "fn gamma() {}\n").unwrap();
+ let idx = fx.open();
+ assert!(files(&idx, "lib.rs").is_empty());
+
+ let excludes = vec!["**/node_modules".to_owned(), "**/target".to_owned()];
+ assert!(idx.set_scope(vec![shared.clone()], excludes.clone()));
+ assert!(!idx.set_scope(vec![shared.clone()], excludes.clone()), "unchanged scope");
+ assert!(idx.wait_idle(WAIT));
+ assert_eq!(files(&idx, "lib.rs"), ["shared-lib/src/lib.rs"]);
+ let gamma = &idx.find_symbols("gamma", SymbolFilter::All, 5)[0];
+ assert_eq!(gamma.path, dunce::canonicalize(shared.join("src/lib.rs")).unwrap());
+
+ // Files created in a content root are picked up incrementally.
+ std::fs::write(shared.join("src/more.rs"), "fn delta() {}\n").unwrap();
+ idx.update(&[shared.join("src/more.rs")], &[]);
+ assert!(idx.wait_idle(WAIT));
+ assert_eq!(symbols(&idx, "delta", SymbolFilter::All), ["delta"]);
+
+ // A new exclude drops what it matches; removing the root drops its files.
+ let mut more = excludes.clone();
+ more.push("gen".into());
+ idx.set_scope(Vec::new(), more);
+ assert!(idx.wait_idle(WAIT));
+ assert!(files(&idx, "out.rs").is_empty());
+ assert!(files(&idx, "lib.rs").is_empty());
+ assert_eq!(idx.status().files, 1);
+ drop(idx);
+
+ // Extra roots are not persisted: reopening without them lists only the project.
+ let idx = fx.open();
+ assert!(symbols(&idx, "gamma", SymbolFilter::All).is_empty());
+}
+
+#[test]
+fn file_type_changes_reparse_affected_files() {
+ let fx = Fixture::new(&[("src/main.rs", "fn alpha() {}\n"), ("src/legacy.inc", "fn beta() {}\n")]);
+ let languages = Arc::new(LanguageRegistry::load(None).unwrap());
+ let idx = ProjectIndex::open(
+ &fx.root,
+ &fx.cache,
+ Vec::new(),
+ Vec::new(),
+ languages.clone(),
+ Arc::new(Syntax::new()),
+ Arc::new(NullSink),
+ )
+ .unwrap();
+ assert!(idx.wait_idle(WAIT));
+ assert!(symbols(&idx, "beta", SymbolFilter::All).is_empty(), "plain text has no symbols");
+ let parsed = idx.shared.parsed.load(Ordering::SeqCst);
+
+ let before = Arc::new(languages.snapshot());
+ let mut ft = ide_language::FileTypes::default();
+ ft.associations.insert(
+ "rust".into(),
+ ide_core::settings::FileTypeAssociation { patterns: vec!["*.inc".into()], ..Default::default() },
+ );
+ assert!(languages.set_file_types(ft));
+ idx.languages_changed(before);
+ assert!(idx.wait_idle(WAIT));
+ assert_eq!(symbols(&idx, "beta", SymbolFilter::All), ["beta"]);
+ assert_eq!(idx.shared.parsed.load(Ordering::SeqCst), parsed + 1, "only the affected file is re-parsed");
+}
diff --git a/crates/ide-index/src/worker.rs b/crates/ide-index/src/worker.rs
index 1e25d4b56..e3fbd9193 100644
--- a/crates/ide-index/src/worker.rs
+++ b/crates/ide-index/src/worker.rs
@@ -24,6 +24,11 @@ pub(crate) enum Job {
Changed(Vec<PathBuf>),
Removed(Vec<PathBuf>),
SaveRecent,
+ /// The roots or excludes changed: scan again (unchanged files are kept).
+ Rescan,
+ /// File types changed: re-parse the indexed files whose language under the
+ /// previous registry differs from the current one.
+ Reparse(std::sync::Arc<LanguageRegistry>),
}
#[derive(Default)]
@@ -34,7 +39,7 @@ struct Queue {
}
pub(crate) struct Shared {
- pub filter: PathFilter,
+ filter: RwLock<std::sync::Arc<PathFilter>>,
pub languages: std::sync::Arc<LanguageRegistry>,
pub syntax: std::sync::Arc<Syntax>,
pub sink: SharedSink,
@@ -60,7 +65,7 @@ impl Shared {
store: Option<Store>,
) -> Self {
Self {
- filter,
+ filter: RwLock::new(std::sync::Arc::new(filter)),
languages,
syntax,
sink,
@@ -76,6 +81,14 @@ impl Shared {
}
}
+ pub(crate) fn filter(&self) -> std::sync::Arc<PathFilter> {
+ self.filter.read().clone()
+ }
+
+ pub(crate) fn set_filter(&self, filter: PathFilter) {
+ *self.filter.write() = std::sync::Arc::new(filter);
+ }
+
pub(crate) fn enqueue(&self, job: Job) {
self.queue.lock().jobs.push_back(job);
self.wake.notify_one();
@@ -150,7 +163,7 @@ impl Shared {
fn load_persisted(&self) {
let Some(store) = &self.store else { return };
- let root = self.filter.root().to_owned();
+ let root = self.filter().root().to_owned();
match store.load() {
Ok(records) => {
let entries: Vec<FileEntry> =
@@ -198,26 +211,31 @@ impl Shared {
done: false,
});
- let found = self.filter.walk(self.filter.root(), &self.cancelled);
+ let filter = self.filter();
+ let mut found = Vec::new();
+ for root in filter.roots() {
+ found.extend(filter.walk(root, &self.cancelled));
+ }
if self.is_cancelled() {
return self.end_scan(task);
}
let seen: HashSet<&Path> = found.iter().map(|f| f.path.as_path()).collect();
- let (todo, stale): (Vec<&Found>, Vec<String>) = {
+ let (todo, stale): (Vec<&Found>, Vec<PathBuf>) = {
let d = self.data.read();
let todo = found
.iter()
.filter(|f| d.get(&f.path).is_none_or(|e| e.mtime != f.mtime || e.size != f.size))
.collect();
- let stale = d.paths().filter(|p| !seen.contains(p.as_path())).filter_map(|p| self.filter.rel(p)).collect();
+ let stale = d.paths().filter(|p| !seen.contains(p.as_path())).cloned().collect();
(todo, stale)
};
if !stale.is_empty() {
let mut d = self.data.write();
- for rel in &stale {
- d.remove(&self.filter.root().join(rel));
+ for path in &stale {
+ d.remove(path);
}
}
+ let stale: Vec<String> = stale.iter().filter_map(|p| filter.store_key(p)).collect();
self.persist(&[], &stale, false);
let total = todo.len();
@@ -227,7 +245,7 @@ impl Shared {
if self.is_cancelled() {
return self.end_scan(task);
}
- self.index_files(chunk.iter().copied());
+ self.index_files(chunk.iter().copied(), false);
done += chunk.len();
if last_progress.elapsed() >= PROGRESS_EVERY {
last_progress = Instant::now();
@@ -261,16 +279,18 @@ impl Shared {
}
/// Extracts records in parallel, then publishes them to memory and disk.
- fn index_files<'a>(&self, files: impl Iterator<Item = &'a Found>) {
+ /// `force` re-parses files whose content is unchanged (their language changed).
+ fn index_files<'a>(&self, files: impl Iterator<Item = &'a Found>, force: bool) {
let files: Vec<&Found> = files.collect();
+ let filter = self.filter();
let extracted: Vec<(String, FileRecord, PathBuf)> = files
.par_iter()
.filter_map(|f| {
if self.is_cancelled() {
return None;
}
- let rel = self.filter.rel(&f.path)?;
- let prev_hash = self.data.read().get(&f.path).map(|e| e.hash);
+ let rel = filter.rel(&f.path)?;
+ let prev_hash = if force { None } else { self.data.read().get(&f.path).map(|e| e.hash) };
match self.extract(f, prev_hash) {
Extracted::Unchanged => {
// Same content, new mtime: keep the symbols, refresh metadata.
@@ -288,7 +308,7 @@ impl Shared {
return;
}
let puts: Vec<(String, FileRecord)> =
- extracted.iter().map(|(rel, rec, _)| (rel.clone(), rec.clone())).collect();
+ extracted.iter().filter_map(|(_, rec, path)| Some((filter.store_key(path)?, rec.clone()))).collect();
{
let entries: Vec<FileEntry> =
extracted.into_iter().map(|(rel, rec, path)| FileEntry::new(path, rel, rec)).collect();
@@ -346,13 +366,24 @@ impl Shared {
let mut changed: Vec<PathBuf> = Vec::new();
let mut removed: Vec<PathBuf> = Vec::new();
let mut save_recent = false;
+ let mut rescan = false;
+ let mut reparse: Vec<std::sync::Arc<LanguageRegistry>> = Vec::new();
for job in jobs {
match job {
Job::Changed(p) => changed.extend(p),
Job::Removed(p) => removed.extend(p),
Job::SaveRecent => save_recent = true,
+ Job::Rescan => rescan = true,
+ Job::Reparse(before) => reparse.push(before),
}
}
+ if rescan {
+ // The scan also picks up whatever `changed` / `removed` reported.
+ self.full_scan();
+ changed.clear();
+ removed.clear();
+ }
+ let filter = self.filter();
let mut touched = false;
// Removals first; a path removed then re-created shows up in `changed` too.
@@ -363,11 +394,11 @@ impl Shared {
continue;
}
let mut d = self.data.write();
- if let Some(e) = d.remove(&path) {
- deletes.push(e.rel.into_string());
- } else {
- deletes.extend(d.remove_tree(&path));
- }
+ let gone = match d.remove(&path) {
+ Some(_) => vec![path],
+ None => d.remove_tree(&path),
+ };
+ deletes.extend(gone.iter().filter_map(|p| filter.store_key(p)));
}
if !deletes.is_empty() {
touched = true;
@@ -381,11 +412,11 @@ impl Shared {
continue;
}
let Ok(meta) = std::fs::symlink_metadata(&path) else { continue };
- if self.filter.is_excluded(&path, meta.is_dir()) {
+ if filter.is_excluded(&path, meta.is_dir()) {
continue;
}
if meta.is_dir() {
- files.extend(self.filter.walk(&path, &self.cancelled));
+ files.extend(filter.walk(&path, &self.cancelled));
} else if meta.is_file() {
files.push(Found { mtime: mtime_of(&meta), size: meta.len(), path });
}
@@ -403,11 +434,32 @@ impl Shared {
if self.is_cancelled() {
return;
}
- self.index_files(chunk.iter());
+ self.index_files(chunk.iter(), false);
+ }
+ }
+ for before in reparse {
+ let affected: Vec<Found> = {
+ let d = self.data.read();
+ d.paths()
+ .filter(|p| before.detect(p, None) != self.languages.detect(p, None))
+ .filter_map(|p| {
+ let e = d.get(p)?;
+ Some(Found { path: p.clone(), mtime: e.mtime, size: e.size })
+ })
+ .collect()
+ };
+ if !affected.is_empty() {
+ touched = true;
+ for chunk in affected.chunks(CHUNK) {
+ if self.is_cancelled() {
+ return;
+ }
+ self.index_files(chunk.iter(), true);
+ }
}
}
if save_recent && let Some(store) = &self.store {
- let rels: Vec<String> = self.recent.lock().iter().filter_map(|p| self.filter.rel(p)).collect();
+ let rels: Vec<String> = self.recent.lock().iter().filter_map(|p| filter.store_key(p)).collect();
if let Err(e) = store.save_recent(&rels) {
tracing::warn!("index cache: saving recent files failed: {e}");
}
diff --git a/crates/ide-language/src/lib.rs b/crates/ide-language/src/lib.rs
index 8807d99a1..ef4762976 100644
--- a/crates/ide-language/src/lib.rs
+++ b/crates/ide-language/src/lib.rs
@@ -11,11 +11,11 @@ use std::collections::BTreeMap;
mod registry;
mod syntax;
-pub use registry::LanguageRegistry;
+pub use registry::{FileTypes, LanguageRegistry};
pub use syntax::{
CSS_CLASS, CSS_ID, CSS_VARIABLE, FileReference, Literal, LiteralKind, MAX_CACHED_TREES, MAX_PARSE_BYTES,
- ParsedTree, Syntax, SyntaxCache, SyntaxCacheStats, SyntaxHighlightKind, SyntaxHighlights, TreeError, WebReference,
- WebReferenceKind,
+ ParsedTree, SpellingKind, SpellingRegion, Syntax, SyntaxCache, SyntaxCacheStats, SyntaxHighlightKind,
+ SyntaxHighlights, TreeError, WebReference, WebReferenceKind, merge_visibility,
};
/// Parsed form of `languages/<id>.toml`. Backend-only; the UI gets [`LanguageInfo`].
@@ -119,6 +119,18 @@ pub struct LanguageInfo {
#[serde(default)]
#[specta(optional)]
pub debuggable: bool,
+ /// Names of the configured language servers (Settings › Inspections).
+ #[serde(default)]
+ #[specta(optional)]
+ pub language_servers: Vec<String>,
+ /// Exact file names and file-name patterns of the definition (Settings › File Types).
+ #[serde(default)]
+ #[specta(optional)]
+ pub filenames: Vec<String>,
+ /// First-line regex of the definition (shebangs, `<?php`).
+ #[serde(default)]
+ #[specta(optional)]
+ pub first_line: Option<String>,
}
impl From<&LanguageConfig> for LanguageInfo {
@@ -132,6 +144,9 @@ impl From<&LanguageConfig> for LanguageInfo {
block_comment: c.block_comment.clone(),
indent: c.indent,
debuggable: c.debugger.is_some(),
+ language_servers: c.language_servers.iter().map(|s| s.name.clone()).collect(),
+ filenames: c.filenames.clone(),
+ first_line: c.first_line.clone(),
}
}
}
diff --git a/crates/ide-language/src/registry.rs b/crates/ide-language/src/registry.rs
index 84fd9ac21..29cd289cb 100644
--- a/crates/ide-language/src/registry.rs
+++ b/crates/ide-language/src/registry.rs
@@ -1,7 +1,10 @@
use crate::LanguageConfig;
+use ide_core::settings::{FileSettings, FileTypeAssociation};
use ide_core::{IdeError, IdeResult, LanguageId};
-use std::collections::HashMap;
-use std::path::Path;
+use parking_lot::RwLock;
+use std::collections::{BTreeMap, HashMap};
+use std::path::{Path, PathBuf};
+use std::sync::Arc;
/// Built-in definitions, embedded at compile time. Add new languages here.
const BUILTIN: &[(&str, &str)] = &[
@@ -78,11 +81,130 @@ const BUILTIN: &[(&str, &str)] = &[
pub struct LanguageRegistry {
languages: Vec<LanguageConfig>,
+ /// Lookup tables of the definitions with the user's file types applied.
+ tables: RwLock<Arc<Tables>>,
+ file_types: RwLock<FileTypes>,
+}
+
+/// The user's file type associations (Settings › Editor › File Types) and
+/// per-file overrides (Override File Type), resolved for one project.
+#[derive(Clone, Debug, Default, PartialEq)]
+pub struct FileTypes {
+ /// Language id → patterns added to / removed from its definition.
+ pub associations: BTreeMap<String, FileTypeAssociation>,
+ /// Absolute path → language id.
+ pub overrides: HashMap<PathBuf, LanguageId>,
+}
+
+impl FileTypes {
+ /// From `files.fileTypes` / `files.fileTypeOverrides`; relative override paths resolve against `root`.
+ pub fn from_settings(files: &FileSettings, root: Option<&Path>) -> Self {
+ let overrides = files
+ .file_type_overrides
+ .iter()
+ .filter(|(_, lang)| !lang.trim().is_empty())
+ .filter_map(|(path, lang)| {
+ let p = Path::new(path.as_str());
+ let abs = if p.is_absolute() { p.to_path_buf() } else { root?.join(p) };
+ Some((abs, LanguageId::new(lang.trim())))
+ })
+ .collect();
+ Self { associations: files.file_types.clone(), overrides }
+ }
+}
+
+#[derive(Default)]
+struct Tables {
by_ext: HashMap<String, usize>,
by_name: HashMap<String, usize>,
- /// File-name patterns containing `*`, e.g. `Dockerfile.*`, `tsconfig.*.json`.
+ /// File-name patterns with wildcards, e.g. `Dockerfile.*`, `tsconfig.*.json`; the user's first.
name_globs: Vec<(String, usize)>,
+ /// Interpreter names of user hashbang patterns.
+ hashbangs: Vec<(String, usize)>,
first_line: Vec<(regex_lite::Regex, usize)>,
+ overrides: HashMap<PathBuf, usize>,
+}
+
+/// How a file name pattern is looked up.
+enum Pattern<'a> {
+ /// `*.ext` (lower-cased).
+ Ext(String),
+ Name(&'a str),
+ Glob(&'a str),
+}
+
+fn classify(pattern: &str) -> Pattern<'_> {
+ let wild = |s: &str| s.contains(['*', '?']);
+ match pattern.strip_prefix("*.") {
+ Some(ext) if !ext.is_empty() && !wild(ext) => Pattern::Ext(ext.to_ascii_lowercase()),
+ _ if wild(pattern) => Pattern::Glob(pattern),
+ _ => Pattern::Name(pattern),
+ }
+}
+
+impl Tables {
+ fn build(languages: &[LanguageConfig], file_types: &FileTypes) -> Self {
+ let mut t = Tables::default();
+ let index_of = |id: &str| languages.iter().position(|l| l.id.as_str() == id);
+ let removed = |l: &LanguageConfig, pattern: &str| {
+ file_types.associations.get(l.id.as_str()).is_some_and(|a| {
+ a.removed_patterns.iter().any(|r| r.trim() == pattern || r.trim().eq_ignore_ascii_case(pattern))
+ })
+ };
+ let mut builtin_globs = Vec::new();
+ for (i, l) in languages.iter().enumerate() {
+ for ext in &l.extensions {
+ if !removed(l, &format!("*.{ext}")) {
+ t.by_ext.insert(ext.to_ascii_lowercase(), i);
+ }
+ }
+ for name in l.filenames.iter().filter(|n| !removed(l, n)) {
+ if name.contains(['*', '?']) {
+ builtin_globs.push((name.clone(), i));
+ } else {
+ t.by_name.insert(name.clone(), i);
+ }
+ }
+ if let Some(pattern) = l.first_line.as_deref() {
+ match regex_lite::Regex::new(pattern) {
+ Ok(re) => t.first_line.push((re, i)),
+ Err(e) => tracing::warn!("language {}: invalid first-line pattern: {e}", l.id),
+ }
+ }
+ }
+ // The user's patterns win over the definitions'.
+ let mut user_globs = Vec::new();
+ for (id, assoc) in &file_types.associations {
+ let Some(i) = index_of(id) else { continue };
+ for pattern in assoc.patterns.iter().map(|p| p.trim()).filter(|p| !p.is_empty()) {
+ match classify(pattern) {
+ Pattern::Ext(ext) => {
+ t.by_ext.insert(ext, i);
+ }
+ Pattern::Name(name) => {
+ t.by_name.insert(name.to_owned(), i);
+ }
+ Pattern::Glob(glob) => user_globs.push((glob.to_owned(), i)),
+ }
+ }
+ for h in assoc.hashbangs.iter().map(|h| h.trim()).filter(|h| !h.is_empty()) {
+ t.hashbangs.push((h.to_owned(), i));
+ }
+ }
+ // More specific (longer) patterns first: `tsconfig.*.json` before `*.json`-like ones.
+ user_globs.sort_by_key(|(p, _): &(String, usize)| std::cmp::Reverse(p.len()));
+ builtin_globs.sort_by_key(|(p, _): &(String, usize)| std::cmp::Reverse(p.len()));
+ t.name_globs = user_globs.into_iter().chain(builtin_globs).collect();
+ t.overrides =
+ file_types.overrides.iter().filter_map(|(p, id)| Some((p.clone(), index_of(id.as_str())?))).collect();
+ t
+ }
+}
+
+/// Whether the `#!` line runs `interpreter` (`#!/usr/bin/env node`, `#!/bin/node -x` for `node`).
+fn hashbang_runs(line: &str, interpreter: &str) -> bool {
+ let Some(rest) = line.strip_prefix("#!") else { return false };
+ rest.split(|c: char| c.is_whitespace() || c == '/').any(|token| token == interpreter)
}
impl LanguageRegistry {
@@ -116,31 +238,31 @@ impl LanguageRegistry {
None => languages.push(cfg),
}
}
- let mut by_ext = HashMap::new();
- let mut by_name = HashMap::new();
- let mut name_globs = Vec::new();
- let mut first_line = Vec::new();
- for (i, l) in languages.iter().enumerate() {
- for ext in &l.extensions {
- by_ext.insert(ext.to_ascii_lowercase(), i);
- }
- for name in &l.filenames {
- if name.contains('*') {
- name_globs.push((name.clone(), i));
- } else {
- by_name.insert(name.clone(), i);
- }
- }
- if let Some(pattern) = l.first_line.as_deref() {
- match regex_lite::Regex::new(pattern) {
- Ok(re) => first_line.push((re, i)),
- Err(e) => tracing::warn!("language {}: invalid first-line pattern: {e}", l.id),
- }
- }
+ let tables = Tables::build(&languages, &FileTypes::default());
+ Self { languages, tables: RwLock::new(Arc::new(tables)), file_types: RwLock::default() }
+ }
+
+ /// A registry with the same definitions and no user file types (one per project).
+ pub fn fork(&self) -> Self {
+ Self::from_configs(self.languages.clone())
+ }
+
+ /// A copy with the same definitions and file types (to compare detection before / after a change).
+ pub fn snapshot(&self) -> Self {
+ let copy = self.fork();
+ copy.set_file_types(self.file_types.read().clone());
+ copy
+ }
+
+ /// Applies the user's file types; returns whether they changed.
+ pub fn set_file_types(&self, file_types: FileTypes) -> bool {
+ let mut current = self.file_types.write();
+ if *current == file_types {
+ return false;
}
- // More specific (longer) patterns first: `tsconfig.*.json` before `*.json`-like ones.
- name_globs.sort_by_key(|(p, _): &(String, usize)| std::cmp::Reverse(p.len()));
- Self { languages, by_ext, by_name, name_globs, first_line }
+ *self.tables.write() = Arc::new(Tables::build(&self.languages, &file_types));
+ *current = file_types;
+ true
}
pub fn all(&self) -> Vec<LanguageConfig> {
@@ -151,48 +273,67 @@ impl LanguageRegistry {
self.languages.iter().find(|l| &l.id == id).cloned()
}
- /// Detects by exact file name, then file-name pattern (`Dockerfile.*`), then
- /// extension (longest compound first, e.g. `d.ts`), then first line; falls
- /// back to plaintext.
+ /// Detects by Override File Type, exact file name, then file-name pattern
+ /// (`Dockerfile.*`), then extension (longest compound first, e.g. `d.ts`),
+ /// then hashbang / first line; falls back to plaintext. The user's patterns
+ /// win over the definitions'.
pub fn detect(&self, path: &Path, first_line: Option<&str>) -> LanguageId {
+ let t = self.tables.read().clone();
+ if !t.overrides.is_empty()
+ && let Some(&i) = t.overrides.get(path)
+ {
+ return self.languages[i].id.clone();
+ }
let file_name = path.file_name().and_then(|n| n.to_str()).unwrap_or_default();
- if let Some(&i) = self.by_name.get(file_name) {
+ if let Some(&i) = t.by_name.get(file_name) {
return self.languages[i].id.clone();
}
- if let Some((_, i)) = self.name_globs.iter().find(|(p, _)| wildcard_match(p, file_name)) {
+ if let Some((_, i)) = t.name_globs.iter().find(|(p, _)| wildcard_match(p, file_name)) {
return self.languages[*i].id.clone();
}
let lower = file_name.to_ascii_lowercase();
let mut rest = lower.as_str();
while let Some(dot) = rest.find('.') {
rest = &rest[dot + 1..];
- if let Some(&i) = self.by_ext.get(rest) {
+ if let Some(&i) = t.by_ext.get(rest) {
return self.languages[i].id.clone();
}
}
- if let Some(line) = first_line
- && let Some((_, i)) = self.first_line.iter().find(|(re, _)| re.is_match(line))
- {
- return self.languages[*i].id.clone();
+ if let Some(line) = first_line {
+ if let Some((_, i)) = t.hashbangs.iter().find(|(h, _)| hashbang_runs(line, h)) {
+ return self.languages[*i].id.clone();
+ }
+ if let Some((_, i)) = t.first_line.iter().find(|(re, _)| re.is_match(line)) {
+ return self.languages[*i].id.clone();
+ }
}
LanguageId::plain_text()
}
}
-/// `*` matches any (possibly empty) run of characters; everything else is literal.
+/// `*` matches any (possibly empty) run of characters, `?` exactly one; everything else is literal.
fn wildcard_match(pattern: &str, name: &str) -> bool {
- let mut parts = pattern.split('*');
- let first = parts.next().unwrap_or_default();
- let Some(mut rest) = name.strip_prefix(first) else { return false };
- let parts: Vec<&str> = parts.collect();
- let Some((last, middle)) = parts.split_last() else { return rest.is_empty() };
- for part in middle {
- match rest.find(part) {
- Some(i) => rest = &rest[i + part.len()..],
- None => return false,
+ let p: Vec<char> = pattern.chars().collect();
+ let n: Vec<char> = name.chars().collect();
+ let (mut pi, mut ni) = (0, 0);
+ // Position after the last `*` and the name position it is matched up to.
+ let mut star: Option<(usize, usize)> = None;
+ while ni < n.len() {
+ if pi < p.len() && (p[pi] == '?' || p[pi] == n[ni]) {
+ pi += 1;
+ ni += 1;
+ } else if pi < p.len() && p[pi] == '*' {
+ star = Some((pi + 1, ni));
+ pi += 1;
+ } else if let Some((sp, sn)) = star {
+ pi = sp;
+ ni = sn + 1;
+ star = Some((sp, sn + 1));
+ } else {
+ return false;
}
}
- rest.len() >= last.len() && rest.ends_with(last)
+ p[pi..].iter().all(|&c| c == '*')
}
fn parse(src: &str) -> Result<LanguageConfig, String> {
@@ -573,6 +714,60 @@ mod tests {
assert!(wildcard_match("*.Dockerfile", "web.Dockerfile"));
assert!(wildcard_match("a*b*c", "aXbYc"));
assert!(!wildcard_match("a*b*c", "aXcYb"));
+ assert!(wildcard_match("file?.txt", "file1.txt"));
+ assert!(!wildcard_match("file?.txt", "file.txt"));
+ assert!(wildcard_match("*", ""));
+ assert!(wildcard_match("a**", "abc"));
+ }
+
+ fn assoc(patterns: &[&str], removed: &[&str], hashbangs: &[&str]) -> FileTypeAssociation {
+ let v = |xs: &[&str]| xs.iter().map(|s| (*s).to_owned()).collect();
+ FileTypeAssociation { patterns: v(patterns), removed_patterns: v(removed), hashbangs: v(hashbangs) }
+ }
+
+ #[test]
+ fn user_file_types_add_remove_and_win() {
+ let reg = reg();
+ let mut ft = FileTypes::default();
+ ft.associations
+ .insert("python".into(), assoc(&["*.foo", "Pipfile.lock", "build_*.cfg", "*.LOG"], &[], &["mypy"]));
+ ft.associations.insert("groovy".into(), assoc(&[], &["Jenkinsfile"], &[]));
+ ft.associations.insert("shellscript".into(), assoc(&["Jenkinsfile"], &[], &[]));
+ ft.associations.insert("rust".into(), assoc(&[], &["*.rs"], &[]));
+ assert!(reg.set_file_types(ft.clone()));
+ assert!(!reg.set_file_types(ft), "unchanged file types report no change");
+ assert_eq!(detect(&reg, "a/x.foo"), "python");
+ assert_eq!(detect(&reg, "x.FOO"), "python");
+ assert_eq!(detect(&reg, "Pipfile.lock"), "python");
+ assert_eq!(detect(&reg, "build_dev.cfg"), "python");
+ assert_eq!(detect(&reg, "setup.cfg"), "ini");
+ assert_eq!(detect(&reg, "server.log"), "python", "a user extension overrides a built-in one");
+ assert_eq!(detect(&reg, "Jenkinsfile"), "shellscript");
+ assert_eq!(detect(&reg, "main.rs"), "plaintext");
+ assert_eq!(reg.detect(Path::new("tool"), Some("#!/usr/bin/env mypy --strict")).as_str(), "python");
+ assert_eq!(reg.detect(Path::new("tool"), Some("#!/usr/bin/env mypyc")).as_str(), "plaintext");
+ reg.set_file_types(FileTypes::default());
+ assert_eq!(detect(&reg, "main.rs"), "rust");
+ assert_eq!(detect(&reg, "x.foo"), "plaintext");
+ }
+
+ #[test]
+ fn override_file_type_per_file() {
+ let reg = reg().fork();
+ let files = FileSettings {
+ file_type_overrides: [
+ ("notes.txt".to_owned(), "markdown".to_owned()),
+ ("/abs/run".to_owned(), "python".to_owned()),
+ ("bad.txt".to_owned(), "no-such-language".to_owned()),
+ ]
+ .into(),
+ ..Default::default()
+ };
+ reg.set_file_types(FileTypes::from_settings(&files, Some(Path::new("/proj"))));
+ assert_eq!(detect(&reg, "/proj/notes.txt"), "markdown");
+ assert_eq!(detect(&reg, "/other/notes.txt"), "plaintext");
+ assert_eq!(detect(&reg, "/abs/run"), "python");
+ assert_eq!(detect(&reg, "/proj/bad.txt"), "plaintext");
}
#[test]
diff --git a/crates/ide-language/src/syntax/literals.rs b/crates/ide-language/src/syntax/literals.rs
index 78031fdd2..4a784d768 100644
--- a/crates/ide-language/src/syntax/literals.rs
+++ b/crates/ide-language/src/syntax/literals.rs
@@ -2,7 +2,7 @@
//! filter ("In comments", "Except string literals", …).
use super::folding::is_comment;
-use tree_sitter::{Node, Tree};
+use tree_sitter::{Node, Tree, TreeCursor};
/// What a [`Literal`] range is.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -57,3 +57,70 @@ pub(crate) fn literals(tree: &Tree) -> Vec<Literal> {
}
}
}
+
+/// What a [`SpellingRegion`] covers.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum SpellingKind {
+ Comment,
+ String,
+ /// The name a declaration introduces (not its uses).
+ Name,
+}
+
+/// Text the Typo inspection checks: byte range in document order.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct SpellingRegion {
+ pub start: usize,
+ pub end: usize,
+ pub kind: SpellingKind,
+}
+
+fn is_name_leaf(kind: &str) -> bool {
+ kind.contains("identifier") || kind == "name"
+}
+
+/// Whether the identifier leaf under `cursor` is the name a declaration
+/// introduces (`fn name`, `let pattern`, `int *declarator`, parameters,
+/// `name = …` assignments) rather than a use of one.
+fn declares(cursor: &TreeCursor<'_>, node: &Node<'_>) -> bool {
+ let parent = node.parent().map(|p| p.kind()).unwrap_or_default();
+ match cursor.field_name() {
+ Some("name" | "pattern" | "declarator") => true,
+ Some("left") => parent.contains("assignment") || parent.contains("declarator"),
+ _ => parent.contains("parameter"),
+ }
+}
+
+/// Comments, string literals and declared names, for spell checking.
+pub(crate) fn spelling_regions(tree: &Tree) -> Vec<SpellingRegion> {
+ let mut out = Vec::new();
+ let mut cursor = tree.walk();
+ loop {
+ let node = cursor.node();
+ let literal = kind_of(&node);
+ let region = |kind| SpellingRegion { start: node.start_byte(), end: node.end_byte(), kind };
+ match literal {
+ Some(LiteralKind::Comment) => out.push(region(SpellingKind::Comment)),
+ Some(LiteralKind::String) => out.push(region(SpellingKind::String)),
+ None if node.is_named()
+ && node.child_count() == 0
+ && is_name_leaf(node.kind())
+ && declares(&cursor, &node) =>
+ {
+ out.push(region(SpellingKind::Name))
+ }
+ None => {}
+ }
+ if literal.is_none() && cursor.goto_first_child() {
+ continue;
+ }
+ loop {
+ if cursor.goto_next_sibling() {
+ break;
+ }
+ if !cursor.goto_parent() {
+ return out;
+ }
+ }
+ }
+}
diff --git a/crates/ide-language/src/syntax/mod.rs b/crates/ide-language/src/syntax/mod.rs
index 879cbb649..776acdd4e 100644
--- a/crates/ide-language/src/syntax/mod.rs
+++ b/crates/ide-language/src/syntax/mod.rs
@@ -15,7 +15,8 @@ pub use cache::{MAX_CACHED_TREES, SyntaxCache, SyntaxCacheStats};
use grammars::{SPECS, Spec};
pub use highlight::{SyntaxHighlightKind, SyntaxHighlights};
use ide_core::{LanguageId, OutlineItem, Pos, Range};
-pub use literals::{Literal, LiteralKind};
+pub use literals::{Literal, LiteralKind, SpellingKind, SpellingRegion};
+pub use outline::merge_visibility;
use std::cell::RefCell;
use std::collections::HashMap;
use std::sync::OnceLock;
@@ -235,6 +236,12 @@ impl Syntax {
self.analyze(lang, text, |_, tree, _| Some(literals::literals(tree)))
}
+ /// Comments, string literals and declared names (byte ranges, document
+ /// order) for the Typo inspection; `None` like [`Self::literals`].
+ pub fn spelling_regions(&self, lang: &LanguageId, text: &str) -> Option<Vec<SpellingRegion>> {
+ self.analyze(lang, text, |_, tree, _| Some(literals::spelling_regions(tree)))
+ }
+
/// Syntax-aware selection ranges for IDEA "Extend Selection" (⌥↑), innermost first.
pub fn selection_ranges(&self, lang: &LanguageId, text: &str, offset_utf16: u32) -> Vec<Range> {
match self.analyze(lang, text, |_, tree, text| Some(selection::selection_ranges(tree, text, offset_utf16))) {
diff --git a/crates/ide-language/src/syntax/outline.rs b/crates/ide-language/src/syntax/outline.rs
index 541513d55..acae35901 100644
--- a/crates/ide-language/src/syntax/outline.rs
+++ b/crates/ide-language/src/syntax/outline.rs
@@ -15,7 +15,7 @@
use super::Grammar;
use super::lines::LineIndex;
use crate::SymbolTag;
-use ide_core::{OutlineItem, SymbolKind};
+use ide_core::{OutlineItem, SymbolKind, Visibility};
use std::collections::HashMap;
use tree_sitter::{Node, Query, QueryCursor, StreamingIterator, Tree};
@@ -139,11 +139,16 @@ struct Raw {
container_name: String,
explicit_container: Option<String>,
detail: Option<String>,
+ /// From a modifier keyword in the declaration (`pub`, `private`, ...).
+ visibility: Option<Visibility>,
+ /// Rust `impl Trait for Type`: members take the trait's visibility.
+ trait_impl: bool,
}
struct Built {
raw: Raw,
kind: SymbolKind,
+ visibility: Option<Visibility>,
children: Vec<Built>,
}
@@ -188,6 +193,7 @@ fn collect(g: &Grammar, q: &OutlineQuery, tree: &Tree, text: &str) -> Vec<Built>
base = last.to_owned();
kind = ItemKind::Symbol(SymbolKind::Method);
}
+ let trait_impl = kind == ItemKind::Impl && trait_.is_some();
let name = match (kind, trait_) {
(ItemKind::Impl, Some(t)) => format!("impl {} for {base}", clean(node_text(&t, text), 120)),
(ItemKind::Impl, None) => format!("impl {base}"),
@@ -213,6 +219,8 @@ fn collect(g: &Grammar, q: &OutlineQuery, tree: &Tree, text: &str) -> Vec<Built>
container_name,
explicit_container: container,
detail: detail.map(|d| clean(node_text(&d, text), 80)).filter(|d| !d.is_empty()),
+ visibility: explicit_visibility(&node, text),
+ trait_impl,
};
match by_node.get(&raw.node_id) {
Some(existing) if existing.pattern <= raw.pattern => {}
@@ -239,6 +247,7 @@ fn build_tree(g: &Grammar, raws: Vec<Raw>) -> Vec<Built> {
push_child(&mut stack, &mut roots, done);
}
let parent_kind = stack.last().map(|p| p.raw.kind);
+ let parent_trait_impl = stack.last().is_some_and(|p| p.raw.trait_impl);
let mut kind = raw.kind.symbol_kind();
if kind == SymbolKind::Function && parent_kind.is_some_and(ItemKind::holds_methods) {
kind = SymbolKind::Method;
@@ -250,7 +259,10 @@ fn build_tree(g: &Grammar, raws: Vec<Raw>) -> Vec<Built> {
kind = SymbolKind::Constructor;
}
}
- stack.push(Built { raw, kind, children: Vec::new() });
+ let visibility = raw
+ .visibility
+ .or_else(|| implicit_visibility(g.spec.name, raw.kind, kind, &raw.name, parent_kind, parent_trait_impl));
+ stack.push(Built { raw, kind, visibility, children: Vec::new() });
}
while let Some(done) = stack.pop() {
push_child(&mut stack, &mut roots, done);
@@ -278,6 +290,7 @@ pub(crate) fn outline(g: &Grammar, q: &OutlineQuery, tree: &Tree, text: &str) ->
range: b.raw.range,
selection_range: b.raw.sel,
children: b.children.into_iter().map(convert).collect(),
+ visibility: b.visibility,
}
}
collect(g, q, tree, text).into_iter().map(convert).collect()
@@ -308,6 +321,107 @@ pub(crate) fn tags(g: &Grammar, q: &OutlineQuery, tree: &Tree, text: &str) -> Ve
out
}
+/// Visibility spelled out by a modifier child (`visibility_modifier`, `modifiers`,
+/// `accessibility_modifier`, ...) of the declaration.
+fn explicit_visibility(node: &Node, text: &str) -> Option<Visibility> {
+ let mut cursor = node.walk();
+ let mut found: Option<Visibility> = None;
+ for child in node.children(&mut cursor) {
+ if !child.kind().contains("modifier") {
+ continue;
+ }
+ let t = node_text(&child, text);
+ if child.kind() == "visibility_modifier" && t.starts_with("pub") {
+ // Rust: `pub` / `pub(crate)` / `pub(super)` / `pub(in path)`.
+ let v = if t.trim() == "pub" { Visibility::Public } else { Visibility::Package };
+ found = Some(found.map_or(v, |f| narrower(f, v)));
+ continue;
+ }
+ for word in t.split(|c: char| !c.is_ascii_alphanumeric() && c != '_') {
+ let v = match word {
+ "public" | "open" => Visibility::Public,
+ "protected" => Visibility::Protected,
+ "internal" | "fileprivate" => Visibility::Package,
+ "private" => Visibility::Private,
+ _ => continue,
+ };
+ found = Some(found.map_or(v, |f| narrower(f, v)));
+ }
+ }
+ found
+}
+
+/// Several keywords (C# `private protected`): the narrower one wins.
+fn narrower(a: Visibility, b: Visibility) -> Visibility {
+ let rank = |v: Visibility| match v {
+ Visibility::Public => 0,
+ Visibility::Protected => 1,
+ Visibility::Package => 2,
+ Visibility::Private => 3,
+ };
+ if rank(a) >= rank(b) { a } else { b }
+}
+
+/// The language's default when no modifier is written.
+fn implicit_visibility(
+ lang: &str,
+ item: ItemKind,
+ kind: SymbolKind,
+ name: &str,
+ parent: Option<ItemKind>,
+ parent_trait_impl: bool,
+) -> Option<Visibility> {
+ use SymbolKind as K;
+ if matches!(item, ItemKind::Impl | ItemKind::Extension | ItemKind::Heading)
+ || matches!(kind, K::EnumMember | K::Package | K::Namespace)
+ {
+ return None;
+ }
+ let in_interface = matches!(parent, Some(ItemKind::Symbol(K::Interface | K::Trait)));
+ match lang {
+ "rust" => (!in_interface && !parent_trait_impl && kind != K::Macro).then_some(Visibility::Private),
+ "java" => (!in_interface).then_some(Visibility::Package),
+ "csharp" => match parent {
+ _ if in_interface => None,
+ Some(ItemKind::Symbol(K::Class | K::Struct | K::Enum)) => Some(Visibility::Private),
+ _ => Some(Visibility::Package),
+ },
+ "go" => name.starts_with(|c: char| c.is_lowercase() || c == '_').then_some(Visibility::Package),
+ "python" => {
+ (name.starts_with('_') && !(name.starts_with("__") && name.ends_with("__"))).then_some(Visibility::Private)
+ }
+ "dart" => name.starts_with('_').then_some(Visibility::Private),
+ "typescript" | "tsx" | "javascript" => name.starts_with('#').then_some(Visibility::Private),
+ _ => None,
+ }
+}
+
+/// Copies tree-sitter visibility onto language-server symbols (which carry none),
+/// matching by name and identifier start.
+pub fn merge_visibility(target: &mut [OutlineItem], source: &[OutlineItem]) {
+ fn index(items: &[OutlineItem], out: &mut HashMap<(ide_core::Pos, String), Visibility>) {
+ for i in items {
+ if let Some(v) = i.visibility {
+ out.insert((i.selection_range.start, i.name.clone()), v);
+ }
+ index(&i.children, out);
+ }
+ }
+ fn apply(items: &mut [OutlineItem], map: &HashMap<(ide_core::Pos, String), Visibility>) {
+ for i in items {
+ if i.visibility.is_none() {
+ i.visibility = map.get(&(i.selection_range.start, i.name.clone())).copied();
+ }
+ apply(&mut i.children, map);
+ }
+ }
+ let mut map = HashMap::new();
+ index(source, &mut map);
+ if !map.is_empty() {
+ apply(target, &map);
+ }
+}
+
/// End of `node` without trailing whitespace (C macros and others include the newline).
fn trimmed_end(node: &Node, text: &str) -> usize {
let (s, e) = (node.start_byte(), node.end_byte());
diff --git a/crates/ide-language/src/syntax/tests.rs b/crates/ide-language/src/syntax/tests.rs
index 293fe341a..80614378a 100644
--- a/crates/ide-language/src/syntax/tests.rs
+++ b/crates/ide-language/src/syntax/tests.rs
@@ -1,6 +1,6 @@
use super::*;
use crate::FoldKind;
-use ide_core::{OutlineItem, Pos, SymbolKind};
+use ide_core::{OutlineItem, Pos, SymbolKind, Visibility};
fn syntax() -> &'static Syntax {
static S: OnceLock<Syntax> = OnceLock::new();
@@ -1187,3 +1187,109 @@ fn literals_are_outermost_comments_and_strings() {
);
assert!(syntax().literals(&lang("plaintext"), "// x").is_none());
}
+
+/// `name: visibility` for every outline item, depth-first.
+fn visibilities(id: &str, src: &str) -> Vec<(String, Option<Visibility>)> {
+ fn go(items: &[OutlineItem], out: &mut Vec<(String, Option<Visibility>)>) {
+ for i in items {
+ out.push((i.name.clone(), i.visibility));
+ go(&i.children, out);
+ }
+ }
+ let mut out = Vec::new();
+ go(&syntax().outline(&lang(id), src), &mut out);
+ out
+}
+
+fn vis_of(list: &[(String, Option<Visibility>)], name: &str) -> Option<Visibility> {
+ list.iter().find(|(n, _)| n == name).unwrap_or_else(|| panic!("no {name} in {list:?}")).1
+}
+
+#[test]
+fn outline_visibility_rust() {
+ let src = "pub struct S { a: i32, pub b: i32, pub(crate) c: i32 }\n\
+ trait T { fn req(&self); }\n\
+ impl T for S { fn req(&self) {} }\n\
+ impl S { pub fn new() {} fn helper() {} }\n\
+ fn main() {}\n";
+ let v = visibilities("rust", src);
+ assert_eq!(vis_of(&v, "S"), Some(Visibility::Public));
+ assert_eq!(vis_of(&v, "a"), Some(Visibility::Private));
+ assert_eq!(vis_of(&v, "b"), Some(Visibility::Public));
+ assert_eq!(vis_of(&v, "c"), Some(Visibility::Package));
+ assert_eq!(vis_of(&v, "new"), Some(Visibility::Public));
+ assert_eq!(vis_of(&v, "helper"), Some(Visibility::Private));
+ assert_eq!(vis_of(&v, "main"), Some(Visibility::Private));
+ assert_eq!(vis_of(&v, "impl T for S"), None);
+ // Trait members and trait impl members follow the trait.
+ assert!(v.iter().filter(|(n, _)| n == "req").all(|(_, vis)| vis.is_none()));
+}
+
+#[test]
+fn outline_visibility_java_ts_python() {
+ let java = "public class A {\n private int x;\n protected void p() {}\n void pkg() {}\n public A() {}\n}\ninterface I { void m(); }\n";
+ let v = visibilities("java", java);
+ assert_eq!(vis_of(&v, "x"), Some(Visibility::Private));
+ assert_eq!(vis_of(&v, "p"), Some(Visibility::Protected));
+ assert_eq!(vis_of(&v, "pkg"), Some(Visibility::Package));
+ assert_eq!(vis_of(&v, "A"), Some(Visibility::Public));
+ assert_eq!(vis_of(&v, "m"), None);
+
+ let ts = "class C {\n private a = 1;\n protected b(): void {}\n c(): void {}\n #d = 2;\n}\n";
+ let v = visibilities("typescript", ts);
+ assert_eq!(vis_of(&v, "a"), Some(Visibility::Private));
+ assert_eq!(vis_of(&v, "b"), Some(Visibility::Protected));
+ assert_eq!(vis_of(&v, "c"), None);
+ assert_eq!(vis_of(&v, "#d"), Some(Visibility::Private));
+
+ let py = "class K:\n def _hidden(self): pass\n def __init__(self): pass\n def shown(self): pass\n";
+ let v = visibilities("python", py);
+ assert_eq!(vis_of(&v, "_hidden"), Some(Visibility::Private));
+ assert_eq!(vis_of(&v, "__init__"), None);
+ assert_eq!(vis_of(&v, "shown"), None);
+}
+
+#[test]
+fn merge_visibility_matches_by_name_and_position() {
+ fn clear(items: &mut [OutlineItem]) {
+ for i in items {
+ i.visibility = None;
+ clear(&mut i.children);
+ }
+ }
+ let src = "struct S { a: i32 }\nfn f() {}\n";
+ let ts = syntax().outline(&lang("rust"), src);
+ let mut lsp = ts.clone();
+ clear(&mut lsp);
+ lsp[1].name = "renamed".into();
+ crate::merge_visibility(&mut lsp, &ts);
+ assert_eq!(lsp[0].visibility, Some(Visibility::Private));
+ assert_eq!(lsp[0].children[0].visibility, Some(Visibility::Private));
+ assert_eq!(lsp[1].visibility, None);
+}
+
+#[test]
+fn spelling_regions_cover_declared_names_only() {
+ let src = "// note\nfn parse_input(raw_text: &str) -> Value { let mut counter = helper(raw_text); \"hi\" }\n";
+ let found: Vec<(&str, SpellingKind)> =
+ syntax().spelling_regions(&lang("rust"), src).unwrap().iter().map(|r| (&src[r.start..r.end], r.kind)).collect();
+ assert_eq!(
+ found,
+ vec![
+ ("// note", SpellingKind::Comment),
+ ("parse_input", SpellingKind::Name),
+ ("raw_text", SpellingKind::Name),
+ ("counter", SpellingKind::Name),
+ ("\"hi\"", SpellingKind::String),
+ ]
+ );
+ let py = "def load_config(path, retries=3):\n \"\"\"Doc.\"\"\"\n total = 0\n";
+ let names: Vec<&str> = syntax()
+ .spelling_regions(&lang("python"), py)
+ .unwrap()
+ .iter()
+ .filter(|r| r.kind == SpellingKind::Name)
+ .map(|r| &py[r.start..r.end])
+ .collect();
+ assert_eq!(names, ["load_config", "path", "retries", "total"]);
+}
diff --git a/crates/ide-lsp/src/caps.rs b/crates/ide-lsp/src/caps.rs
index 39b51ff0e..da53501b8 100644
--- a/crates/ide-lsp/src/caps.rs
+++ b/crates/ide-lsp/src/caps.rs
@@ -157,6 +157,7 @@ pub fn client_capabilities() -> Value {
"augmentsSyntaxTokens": true
},
"inlayHint": { "dynamicRegistration": false },
+ "inlineCompletion": { "dynamicRegistration": true },
"callHierarchy": { "dynamicRegistration": false },
"typeHierarchy": { "dynamicRegistration": false }
},
@@ -204,6 +205,7 @@ pub fn capability_key(method: &str) -> Option<&'static str> {
"textDocument/formatting" => "documentFormattingProvider",
"textDocument/rangeFormatting" => "documentRangeFormattingProvider",
"textDocument/inlayHint" => "inlayHintProvider",
+ "textDocument/inlineCompletion" => "inlineCompletionProvider",
"textDocument/semanticTokens" | "textDocument/semanticTokens/full" => "semanticTokensProvider",
"textDocument/codeLens" => "codeLensProvider",
"textDocument/documentLink" => "documentLinkProvider",
diff --git a/crates/ide-lsp/src/convert.rs b/crates/ide-lsp/src/convert.rs
index 34646c6a8..eadfb18d5 100644
--- a/crates/ide-lsp/src/convert.rs
+++ b/crates/ide-lsp/src/convert.rs
@@ -434,6 +434,101 @@ pub fn lsp_completion_item(text: &DocText, enc: Encoding, item: &CompletionItem)
}
}
+// ---------------------------------------------------------------- inline completion
+
+/// `InlineCompletionList | InlineCompletionItem[] | null` → items (malformed ones skipped).
+pub fn inline_completion_items(conv: &Conv, path: &Path, v: Value, server: ServerId) -> Vec<InlineCompletionItem> {
+ let items = match v {
+ Value::Array(a) => a,
+ Value::Object(mut o) => match o.remove("items") {
+ Some(Value::Array(a)) => a,
+ _ => Vec::new(),
+ },
+ _ => Vec::new(),
+ };
+ items
+ .into_iter()
+ .filter_map(|it| {
+ let insert_text = match it.get("insertText")? {
+ Value::String(s) => s.clone(),
+ Value::Object(o) if o.get("kind").and_then(Value::as_str) == Some("snippet") => {
+ snippet_text(o.get("value")?.as_str()?)
+ }
+ _ => return None,
+ };
+ let range = it
+ .get("range")
+ .and_then(|r| serde_json::from_value::<lsp::Range>(r.clone()).ok())
+ .map(|r| conv.range(path, r));
+ let filter_text = it.get("filterText").and_then(Value::as_str).map(str::to_owned);
+ let cmd = it.get("command").and_then(|c| serde_json::from_value::<lsp::Command>(c.clone()).ok());
+ Some(InlineCompletionItem { insert_text, range, filter_text, command: cmd.map(command), server })
+ })
+ .filter(|i| !i.insert_text.is_empty())
+ .collect()
+}
+
+/// The text a snippet inserts with every placeholder at its default:
+/// `foo(${1:a}, $2)$0` → `foo(a, )`; a choice takes its first option.
+pub fn snippet_text(snippet: &str) -> String {
+ fn parse(chars: &[char], i: &mut usize, out: &mut String, nested: bool) {
+ while let Some(&ch) = chars.get(*i) {
+ let next = chars.get(*i + 1).copied();
+ match ch {
+ '\\' if next.is_some() => {
+ out.extend(next);
+ *i += 2;
+ }
+ '}' if nested => {
+ *i += 1;
+ return;
+ }
+ '$' if next.is_some_and(|c| c.is_ascii_digit()) => {
+ *i += 1;
+ while chars.get(*i).is_some_and(char::is_ascii_digit) {
+ *i += 1;
+ }
+ }
+ '$' if next == Some('{') => {
+ *i += 2;
+ while chars.get(*i).is_some_and(|c| c.is_ascii_alphanumeric() || *c == '_') {
+ *i += 1;
+ }
+ match chars.get(*i) {
+ Some(':') => {
+ *i += 1;
+ parse(chars, i, out, true);
+ }
+ Some('|') => {
+ *i += 1;
+ let mut first = true;
+ while let Some(&c) = chars.get(*i).filter(|c| **c != '|') {
+ first &= c != ',';
+ if first {
+ out.push(c);
+ }
+ *i += 1;
+ }
+ *i = (*i + 2).min(chars.len());
+ }
+ // `${1}`, or a variable without a default.
+ Some('}') => *i += 1,
+ _ => {}
+ }
+ }
+ _ => {
+ out.push(ch);
+ *i += 1;
+ }
+ }
+ }
+ }
+ let chars: Vec<char> = snippet.chars().collect();
+ let mut out = String::new();
+ parse(&chars, &mut 0, &mut out, false);
+ out
+}
+
// ---------------------------------------------------------------- commands & actions
pub fn command(c: lsp::Command) -> Command {
@@ -614,6 +709,7 @@ pub fn document_symbols(conv: &Conv, path: &Path, r: lsp::DocumentSymbolResponse
range,
selection_range: range,
children: Vec::new(),
+ visibility: None,
}
})
.collect();
@@ -632,6 +728,7 @@ fn document_symbol(conv: &Conv, path: &Path, s: lsp::DocumentSymbol) -> OutlineI
range: conv.range(path, s.range),
selection_range: conv.range(path, s.selection_range),
children: s.children.unwrap_or_default().into_iter().map(|c| document_symbol(conv, path, c)).collect(),
+ visibility: None,
}
}
@@ -879,6 +976,7 @@ pub fn diagnostic(conv: &Conv, path: &Path, d: lsp::Diagnostic, server_name: &st
}),
unnecessary: tags.contains(&lsp::DiagnosticTag::UNNECESSARY),
deprecated: tags.contains(&lsp::DiagnosticTag::DEPRECATED),
+ server: Some(server_name.to_owned()),
}
}
@@ -892,6 +990,25 @@ mod tests {
use super::*;
use serde_json::json;
+ #[test]
+ fn snippet_text_takes_placeholder_defaults() {
+ assert_eq!(snippet_text("foo(${1:a}, $2)$0"), "foo(a, )");
+ assert_eq!(snippet_text("${1:outer ${2:inner}} \\$x ${3|one,two|}${TM_FILENAME}"), "outer inner $x one");
+ assert_eq!(snippet_text("plain"), "plain");
+ }
+
+ #[test]
+ fn inline_completion_shapes() {
+ let conv = Conv::utf16();
+ let path = Path::new("/a.rs");
+ let list = inline_completion_items(&conv, path, json!([{ "insertText": "x" }]), ServerId(1));
+ assert_eq!(list.len(), 1);
+ assert!(inline_completion_items(&conv, path, Value::Null, ServerId(1)).is_empty());
+ assert!(
+ inline_completion_items(&conv, path, json!({ "items": [{ "label": "no text" }] }), ServerId(1)).is_empty()
+ );
+ }
+
fn p(l: u32, c: u32) -> Pos {
Pos::new(l, c)
}
diff --git a/crates/ide-lsp/src/lib.rs b/crates/ide-lsp/src/lib.rs
index 5e7994ea9..ee171c363 100644
--- a/crates/ide-lsp/src/lib.rs
+++ b/crates/ide-lsp/src/lib.rs
@@ -804,6 +804,40 @@ impl LspManager {
out.finish(CompletionList { is_incomplete: false, items: Vec::new() })
}
+ /// LSP 3.18 `textDocument/inlineCompletion` from every server advertising
+ /// `inlineCompletionProvider` (`automatic`: triggered by typing, not explicitly).
+ pub async fn inline_completion(
+ &self,
+ doc: DocId,
+ pos: Pos,
+ automatic: bool,
+ cancel: CancellationToken,
+ ) -> IdeResult<Vec<InlineCompletionItem>> {
+ let (snap, targets) = self.doc_targets(doc, "inline completion", |c| c.has("inlineCompletionProvider")).await?;
+ let requests = targets.iter().map(|t| {
+ let mut params = snap.pos_params(t, pos);
+ params["context"] = json!({ "triggerKind": if automatic { 2 } else { 1 } });
+ let cancel = &cancel;
+ async move {
+ let r =
+ self.call::<_, Value>(t, "textDocument/inlineCompletion", params, Some(cancel), COMPLETION_TIMEOUT);
+ (t, r.await)
+ }
+ });
+ let mut out = Outcome::new();
+ for (t, result) in join_all(requests).await {
+ match result {
+ Ok(v) => {
+ let conv = self.conv(t.enc());
+ let items = convert::inline_completion_items(&conv, &snap.path, v, t.server.id);
+ out.value.get_or_insert_with(Vec::new).extend(items);
+ }
+ Err(e) => out.fail(e),
+ }
+ }
+ out.finish(Vec::new())
+ }
+
pub async fn resolve_completion(&self, doc: DocId, item: CompletionItem) -> IdeResult<CompletionItem> {
let snap = self.snapshot(doc)?;
let Some(server) = snap.servers.iter().find(|s| s.id == item.server) else { return Ok(item) };
diff --git a/crates/ide-lsp/src/types.rs b/crates/ide-lsp/src/types.rs
index 140a82823..0499d7c7b 100644
--- a/crates/ide-lsp/src/types.rs
+++ b/crates/ide-lsp/src/types.rs
@@ -145,6 +145,21 @@ pub struct Command {
pub arguments: Vec<serde_json::Value>,
}
+/// One `textDocument/inlineCompletion` suggestion (ghost text at the caret).
+#[derive(Clone, Debug, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct InlineCompletionItem {
+ /// Text that replaces `range`; snippets arrive as their plain text.
+ pub insert_text: String,
+ /// Replaced range; `None` inserts at the caret.
+ pub range: Option<Range>,
+ /// What the typed text is matched against while the suggestion stays shown (default: `insert_text`).
+ pub filter_text: Option<String>,
+ /// Run after the suggestion is accepted.
+ pub command: Option<Command>,
+ pub server: ServerId,
+}
+
#[derive(Clone, Debug, Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub struct CodeAction {
diff --git a/crates/ide-lsp/tests/mock_server.rs b/crates/ide-lsp/tests/mock_server.rs
index 562466f20..78ea902d1 100644
--- a/crates/ide-lsp/tests/mock_server.rs
+++ b/crates/ide-lsp/tests/mock_server.rs
@@ -415,6 +415,42 @@ async fn completion_mapping_merge_and_resolve() {
assert!(b.requested("completionItem/resolve").is_empty());
}
+#[tokio::test(flavor = "multi_thread")]
+async fn inline_completion_only_from_servers_that_advertise_it() {
+ let h = harness(&[
+ ("plain", incremental_caps()),
+ ("ghost", json!({ "textDocumentSync": 2, "inlineCompletionProvider": {} })),
+ ("late", json!({ "textDocumentSync": 2 })),
+ ]);
+ let (doc, _) = h.open("a.mk", "let x = fo");
+ for name in ["plain", "ghost", "late"] {
+ h.wait_status(name, ServerStatus::Ready).await;
+ }
+ let (plain, ghost) = (h.launcher.state("plain"), h.launcher.state("ghost"));
+ let init = &plain.requested("initialize")[0];
+ assert_eq!(init["capabilities"]["textDocument"]["inlineCompletion"], json!({ "dynamicRegistration": true }));
+ ghost.respond(
+ "textDocument/inlineCompletion",
+ json!({ "items": [
+ { "insertText": "foo(1)", "range": {"start":{"line":0,"character":8},"end":{"line":0,"character":10}},
+ "command": { "title": "accepted", "command": "ghost.accepted", "arguments": [7] } },
+ { "insertText": { "kind": "snippet", "value": "foo(${1:a}, $2)$0" }, "filterText": "fo" },
+ { "insertText": "" }
+ ] }),
+ );
+ let items = h.mgr.inline_completion(doc, Pos::new(0, 10), true, Default::default()).await.unwrap();
+ assert_eq!(items.len(), 2);
+ assert_eq!(items[0].insert_text, "foo(1)");
+ assert_eq!(items[0].range, Some(rng(0, 8, 0, 10)));
+ assert_eq!(items[0].command.as_ref().unwrap().command, "ghost.accepted");
+ assert_eq!(items[1].insert_text, "foo(a, )");
+ assert_eq!(items[1].filter_text.as_deref(), Some("fo"));
+ let req = &ghost.requested("textDocument/inlineCompletion")[0];
+ assert_eq!(req["context"], json!({ "triggerKind": 2 }));
+ assert_eq!(req["position"], json!({ "line": 0, "character": 10 }));
+ assert!(plain.requested("textDocument/inlineCompletion").is_empty());
+}
+
#[tokio::test(flavor = "multi_thread")]
async fn diagnostics_become_events_and_feed_code_actions() {
let h = harness(&[("mock", incremental_caps())]);
diff --git a/crates/ide-profiler/src/plan.rs b/crates/ide-profiler/src/plan.rs
index 9a679e02f..2345e8c96 100644
--- a/crates/ide-profiler/src/plan.rs
+++ b/crates/ide-profiler/src/plan.rs
@@ -233,6 +233,7 @@ mod tests {
is_test: false,
debug_adapter: None,
allow_parallel: false,
+ extras: Default::default(),
}
}
diff --git a/crates/ide-run/Cargo.toml b/crates/ide-run/Cargo.toml
index 421e5cc4a..c64c17738 100644
--- a/crates/ide-run/Cargo.toml
+++ b/crates/ide-run/Cargo.toml
@@ -14,6 +14,7 @@ specta.workspace = true
toml.workspace = true
toml_edit.workspace = true
tokio.workspace = true
+portable-pty.workspace = true
parking_lot.workspace = true
tracing.workspace = true
diff --git a/crates/ide-run/src/config.rs b/crates/ide-run/src/config.rs
index 4fc44368b..e2f067088 100644
--- a/crates/ide-run/src/config.rs
+++ b/crates/ide-run/src/config.rs
@@ -12,9 +12,25 @@
//! is-test = false
//! debug-adapter = "codelldb"
//! allow-parallel = true
+//! folder = "Servers"
+//! params = { mode = "command" }
+//! env-files = [".env"]
+//! include-system-env = false
+//! stdin-file = "input.txt"
+//! output-file = "out/server.log"
+//! before-launch = [{ kind = "build" }, { kind = "run", target = "user:migrate" }]
+//! emulate-terminal = true
+//! stop-command = "docker stop server"
+//!
+//! [[templates]] # per-type defaults for new configurations
+//! kind = "npm"
+//! env = { NODE_ENV = "development" }
//! ```
+//!
+//! Configurations not stored as project files live in the same format in the
+//! workspace-local, git-ignored `run.local.toml`.
-use crate::RunConfig;
+use crate::{BeforeLaunchTask, RunConfig, RunExtras};
use ide_core::{IdeError, IdeResult, project_dir};
use serde::Deserialize;
use std::collections::BTreeMap;
@@ -23,16 +39,30 @@ use std::path::{Path, PathBuf};
use toml_edit::{Array, ArrayOfTables, DocumentMut, InlineTable, Item, Table, value};
const FILE: &str = "run.toml";
+const LOCAL_FILE: &str = "run.local.toml";
+const CONFIGURATIONS: &str = "configurations";
+const TEMPLATES: &str = "templates";
/// Where run configurations are written.
pub(crate) fn config_path(root: &Path) -> PathBuf {
project_dir::path(root, FILE)
}
+/// Workspace-local configurations ("Store as project file" off).
+pub(crate) fn local_path(root: &Path) -> PathBuf {
+ project_dir::path(root, LOCAL_FILE)
+}
+
#[derive(Deserialize)]
struct FileDoc {
#[serde(default)]
configurations: Vec<FileConfig>,
+ #[serde(default)]
+ templates: Vec<FileConfig>,
+}
+
+fn yes() -> bool {
+ true
}
#[derive(Deserialize)]
@@ -54,6 +84,33 @@ struct FileConfig {
debug_adapter: Option<String>,
#[serde(default, alias = "allowParallel", alias = "allow_parallel")]
allow_parallel: bool,
+ #[serde(default)]
+ params: BTreeMap<String, String>,
+ folder: Option<String>,
+ #[serde(default = "yes", alias = "includeSystemEnv")]
+ include_system_env: bool,
+ #[serde(default, alias = "envFiles")]
+ env_files: Vec<String>,
+ #[serde(alias = "stdinFile")]
+ stdin_file: Option<String>,
+ #[serde(alias = "outputFile")]
+ output_file: Option<String>,
+ #[serde(default, alias = "beforeLaunch")]
+ before_launch: Vec<BeforeLaunchTask>,
+ #[serde(default)]
+ compound: Vec<String>,
+ #[serde(default, alias = "showOnStdout")]
+ show_on_stdout: bool,
+ #[serde(default, alias = "showOnStderr")]
+ show_on_stderr: bool,
+ #[serde(alias = "openToolWindow")]
+ open_tool_window: Option<bool>,
+ #[serde(default, alias = "focusToolWindow")]
+ focus_tool_window: bool,
+ #[serde(default, alias = "emulateTerminal")]
+ emulate_terminal: bool,
+ #[serde(alias = "stopCommand")]
+ stop_command: Option<String>,
}
fn slug(s: &str) -> String {
@@ -68,17 +125,22 @@ fn slug(s: &str) -> String {
out.trim_matches('-').to_owned()
}
-pub(crate) fn load(root: &Path) -> IdeResult<Vec<RunConfig>> {
- let path = config_path(root);
- let text = match fs::read_to_string(&path) {
+fn read_doc(path: &Path) -> IdeResult<Option<FileDoc>> {
+ let text = match fs::read_to_string(path) {
Ok(t) => t,
- Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(Vec::new()),
+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(None),
Err(e) => return Err(e.into()),
};
- let doc: FileDoc =
- toml::from_str(&text).map_err(|e| IdeError::invalid(format!("{}: {}", path.display(), e.message())))?;
- let mut out = Vec::with_capacity(doc.configurations.len());
- for (i, c) in doc.configurations.into_iter().enumerate() {
+ toml::from_str(&text).map(Some).map_err(|e| IdeError::invalid(format!("{}: {}", path.display(), e.message())))
+}
+
+fn non_empty(s: Option<String>) -> Option<String> {
+ s.filter(|s| !s.trim().is_empty())
+}
+
+fn convert(configs: Vec<FileConfig>, local: bool) -> Vec<RunConfig> {
+ let mut out = Vec::with_capacity(configs.len());
+ for (i, c) in configs.into_iter().enumerate() {
let name = c.name.filter(|n| !n.is_empty()).unwrap_or_else(|| {
if c.command.is_empty() { format!("Configuration {}", i + 1) } else { c.command.clone() }
});
@@ -95,11 +157,42 @@ pub(crate) fn load(root: &Path) -> IdeResult<Vec<RunConfig>> {
is_test: c.is_test,
debug_adapter: c.debug_adapter.filter(|d| !d.is_empty()),
allow_parallel: c.allow_parallel,
+ extras: RunExtras {
+ params: c.params,
+ folder: non_empty(c.folder),
+ local,
+ include_system_env: c.include_system_env,
+ env_files: c.env_files.into_iter().filter(|f| !f.trim().is_empty()).collect(),
+ stdin_file: non_empty(c.stdin_file),
+ output_file: non_empty(c.output_file),
+ before_launch: c.before_launch.into_iter().filter(|t| !t.kind.is_empty()).collect(),
+ compound: c.compound,
+ show_on_stdout: c.show_on_stdout,
+ show_on_stderr: c.show_on_stderr,
+ open_tool_window: c.open_tool_window,
+ focus_tool_window: c.focus_tool_window,
+ emulate_terminal: c.emulate_terminal,
+ stop_command: non_empty(c.stop_command),
+ },
});
}
+ out
+}
+
+/// Project configurations (`run.toml`) followed by workspace-local ones (`run.local.toml`).
+pub(crate) fn load(root: &Path) -> IdeResult<Vec<RunConfig>> {
+ let mut out = read_doc(&config_path(root))?.map(|d| convert(d.configurations, false)).unwrap_or_default();
+ if let Some(local) = read_doc(&local_path(root))? {
+ let ids: Vec<String> = out.iter().map(|c| c.id.clone()).collect();
+ out.extend(convert(local.configurations, true).into_iter().filter(|c| !ids.contains(&c.id)));
+ }
Ok(out)
}
+pub(crate) fn load_templates(root: &Path) -> IdeResult<Vec<RunConfig>> {
+ Ok(read_doc(&config_path(root))?.map(|d| convert(d.templates, false)).unwrap_or_default())
+}
+
fn to_table(c: &RunConfig) -> Table {
let mut t = Table::new();
t.insert("id", value(&c.id));
@@ -128,12 +221,66 @@ fn to_table(c: &RunConfig) -> Table {
if c.allow_parallel {
t.insert("allow-parallel", value(true));
}
+ let x = &c.extras;
+ if let Some(folder) = &x.folder {
+ t.insert("folder", value(folder));
+ }
+ if !x.params.is_empty() {
+ let mut params = InlineTable::new();
+ for (k, v) in &x.params {
+ params.insert(k, v.into());
+ }
+ t.insert("params", value(params));
+ }
+ if !x.include_system_env {
+ t.insert("include-system-env", value(false));
+ }
+ if !x.env_files.is_empty() {
+ t.insert("env-files", value(x.env_files.iter().collect::<Array>()));
+ }
+ if let Some(f) = &x.stdin_file {
+ t.insert("stdin-file", value(f));
+ }
+ if let Some(f) = &x.output_file {
+ t.insert("output-file", value(f));
+ }
+ if !x.before_launch.is_empty() {
+ let mut tasks = Array::new();
+ for task in &x.before_launch {
+ let mut it = InlineTable::new();
+ it.insert("kind", task.kind.as_str().into());
+ if !task.target.is_empty() {
+ it.insert("target", task.target.as_str().into());
+ }
+ tasks.push(it);
+ }
+ t.insert("before-launch", value(tasks));
+ }
+ if !x.compound.is_empty() {
+ t.insert("compound", value(x.compound.iter().collect::<Array>()));
+ }
+ for (key, on) in [
+ ("show-on-stdout", x.show_on_stdout),
+ ("show-on-stderr", x.show_on_stderr),
+ ("focus-tool-window", x.focus_tool_window),
+ ("emulate-terminal", x.emulate_terminal),
+ ] {
+ if on {
+ t.insert(key, value(true));
+ }
+ }
+ if let Some(open) = x.open_tool_window {
+ t.insert("open-tool-window", value(open));
+ }
+ if let Some(stop) = &x.stop_command {
+ t.insert("stop-command", value(stop));
+ }
t
}
-pub(crate) fn save(root: &Path, configs: &[RunConfig]) -> IdeResult<()> {
- let path = config_path(root);
- let existing = match fs::read_to_string(&path) {
+/// Replaces the `key` array of tables in the file at `path`, keeping unrelated keys and comments.
+fn write_array(path: &Path, key: &str, configs: &[&RunConfig]) -> IdeResult<()> {
+ let existing = match fs::read_to_string(path) {
Ok(t) => Some(t),
Err(e) if e.kind() == std::io::ErrorKind::NotFound => None,
Err(e) => return Err(e.into()),
@@ -141,25 +288,65 @@ pub(crate) fn save(root: &Path, configs: &[RunConfig]) -> IdeResult<()> {
if existing.is_none() && configs.is_empty() {
return Ok(());
}
- // Keep unrelated keys and comments; a file we cannot parse is replaced.
+ // A file we cannot parse is replaced.
let mut doc = existing.as_deref().and_then(|t| t.parse::<DocumentMut>().ok()).unwrap_or_default();
- let mut array = ArrayOfTables::new();
- for c in configs {
- array.push(to_table(c));
- }
if configs.is_empty() {
- doc.remove("configurations");
+ doc.remove(key);
} else {
- doc.insert("configurations", Item::ArrayOfTables(array));
+ let mut array = ArrayOfTables::new();
+ for c in configs {
+ array.push(to_table(c));
+ }
+ doc.insert(key, Item::ArrayOfTables(array));
+ }
+ let text = doc.to_string();
+ if existing.as_deref() == Some(text.as_str()) {
+ return Ok(());
}
if let Some(dir) = path.parent() {
fs::create_dir_all(dir)?;
}
let tmp = path.with_extension("toml.tmp");
- fs::write(&tmp, doc.to_string())?;
- fs::rename(&tmp, &path).inspect_err(|_| {
+ fs::write(&tmp, text)?;
+ fs::rename(&tmp, path).inspect_err(|_| {
let _ = fs::remove_file(&tmp);
})?;
Ok(())
}
+
+/// Keeps the workspace-local file out of version control (`.openidea/.gitignore`).
+fn ignore_local(root: &Path) -> IdeResult<()> {
+ let entry = format!("/{LOCAL_FILE}");
+ let file = project_dir::path(root, ".gitignore");
+ let current = fs::read_to_string(&file).unwrap_or_default();
+ if current.lines().any(|l| l.trim() == entry) {
+ return Ok(());
+ }
+ let mut text = current;
+ if text.is_empty() {
+ text.push_str("# Per-user IDE state\n");
+ } else if !text.ends_with('\n') {
+ text.push('\n');
+ }
+ text.push_str(&entry);
+ text.push('\n');
+ if let Some(dir) = file.parent() {
+ fs::create_dir_all(dir)?;
+ }
+ fs::write(file, text)?;
+ Ok(())
+}
+
+pub(crate) fn save(root: &Path, configs: &[RunConfig]) -> IdeResult<()> {
+ let (local, shared): (Vec<&RunConfig>, Vec<&RunConfig>) = configs.iter().partition(|c| c.extras.local);
+ write_array(&config_path(root), CONFIGURATIONS, &shared)?;
+ if !local.is_empty() {
+ ignore_local(root)?;
+ }
+ write_array(&local_path(root), CONFIGURATIONS, &local)
+}
+
+pub(crate) fn save_templates(root: &Path, templates: &[RunConfig]) -> IdeResult<()> {
+ write_array(&config_path(root), TEMPLATES, &templates.iter().collect::<Vec<_>>())
+}
diff --git a/crates/ide-run/src/detect.rs b/crates/ide-run/src/detect.rs
index cb4c2fe03..63becad64 100644
--- a/crates/ide-run/src/detect.rs
+++ b/crates/ide-run/src/detect.rs
@@ -38,6 +38,7 @@ fn config(id: impl Into<String>, name: impl Into<String>, kind: &str, command: &
is_test: false,
debug_adapter: None,
allow_parallel: false,
+ extras: Default::default(),
}
}
diff --git a/crates/ide-run/src/envfile.rs b/crates/ide-run/src/envfile.rs
new file mode 100644
index 000000000..011a89e5c
--- /dev/null
+++ b/crates/ide-run/src/envfile.rs
@@ -0,0 +1,159 @@
+//! `.env` files ("Paths to .env files" / EnvFile): `KEY=value` lines, `export`
+//! prefixes, `#` comments, single- and double-quoted values (escapes in double
+//! quotes) and `${VAR}` references to earlier variables or the base environment.
+
+use std::collections::BTreeMap;
+
+/// Parses `text`; `lookup` resolves `${VAR}` / `$VAR` not defined earlier in the file.
+pub fn parse(text: &str, lookup: &dyn Fn(&str) -> Option<String>) -> Vec<(String, String)> {
+ let mut out: Vec<(String, String)> = Vec::new();
+ let mut lines = text.lines();
+ while let Some(raw) = lines.next() {
+ let line = raw.trim_start_matches('\u{feff}').trim();
+ if line.is_empty() || line.starts_with('#') {
+ continue;
+ }
+ let line = line.strip_prefix("export ").map(str::trim_start).unwrap_or(line);
+ let Some((key, rest)) = line.split_once('=') else { continue };
+ let key = key.trim();
+ if key.is_empty() || key.contains(char::is_whitespace) {
+ continue;
+ }
+ let rest = rest.trim_start();
+ let value = if let Some(body) = rest.strip_prefix('\'') {
+ quoted(body, '\'', &mut lines).unwrap_or_else(|| rest.to_owned())
+ } else if let Some(body) = rest.strip_prefix('"') {
+ let v = quoted(body, '"', &mut lines).unwrap_or_else(|| rest.to_owned());
+ expand(&unescape(&v), &out, lookup)
+ } else {
+ let v = match rest.find(" #") {
+ Some(i) => &rest[..i],
+ None => rest,
+ };
+ expand(v.trim_end(), &out, lookup)
+ };
+ out.retain(|(k, _)| k != key);
+ out.push((key.to_owned(), value));
+ }
+ out
+}
+
+/// The body of a quoted value up to the closing `quote`, which may be on a later line.
+fn quoted<'a>(first: &str, quote: char, lines: &mut impl Iterator<Item = &'a str>) -> Option<String> {
+ let mut text = first.to_owned();
+ loop {
+ let mut escaped = false;
+ for (i, c) in text.char_indices() {
+ if quote == '"' && c == '\\' && !escaped {
+ escaped = true;
+ continue;
+ }
+ if c == quote && !escaped {
+ return Some(text[..i].to_owned());
+ }
+ escaped = false;
+ }
+ text.push('\n');
+ text.push_str(lines.next()?);
+ }
+}
+
+fn unescape(s: &str) -> String {
+ let mut out = String::with_capacity(s.len());
+ let mut chars = s.chars();
+ while let Some(c) = chars.next() {
+ if c != '\\' {
+ out.push(c);
+ continue;
+ }
+ match chars.next() {
+ Some('n') => out.push('\n'),
+ Some('t') => out.push('\t'),
+ Some('r') => out.push('\r'),
+ Some(other) => out.push(other),
+ None => out.push('\\'),
+ }
+ }
+ out
+}
+
+fn expand(value: &str, earlier: &[(String, String)], lookup: &dyn Fn(&str) -> Option<String>) -> String {
+ let resolve = |name: &str| {
+ earlier
+ .iter()
+ .rev()
+ .find(|(k, _)| k == name)
+ .map(|(_, v)| v.clone())
+ .or_else(|| lookup(name))
+ .unwrap_or_default()
+ };
+ let mut out = String::with_capacity(value.len());
+ let bytes = value.as_bytes();
+ let mut i = 0;
+ while i < value.len() {
+ if bytes[i] == b'$' {
+ if bytes.get(i + 1) == Some(&b'{')
+ && let Some(end) = value[i + 2..].find('}')
+ {
+ out.push_str(&resolve(&value[i + 2..i + 2 + end]));
+ i += end + 3;
+ continue;
+ }
+ let name_len = value[i + 1..].bytes().take_while(|b| b.is_ascii_alphanumeric() || *b == b'_').count();
+ if name_len > 0 {
+ out.push_str(&resolve(&value[i + 1..i + 1 + name_len]));
+ i += name_len + 1;
+ continue;
+ }
+ }
+ let c = value[i..].chars().next().unwrap_or_default();
+ out.push(c);
+ i += c.len_utf8();
+ }
+ out
+}
+
+/// Variables of every file in order (later files win); unreadable files are an error.
+pub fn load(
+ paths: &[std::path::PathBuf],
+ base: &BTreeMap<String, String>,
+) -> std::io::Result<BTreeMap<String, String>> {
+ let mut vars: BTreeMap<String, String> = BTreeMap::new();
+ for path in paths {
+ let text = std::fs::read_to_string(path)
+ .map_err(|e| std::io::Error::new(e.kind(), format!("{}: {e}", path.display())))?;
+ let lookup = |name: &str| vars.get(name).or_else(|| base.get(name)).cloned();
+ let parsed = parse(&text, &lookup);
+ vars.extend(parsed);
+ }
+ Ok(vars)
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn none(_: &str) -> Option<String> {
+ None
+ }
+
+ #[test]
+ fn parses_common_forms() {
+ let text = "# comment\nA=1\nexport B = two words # trailing\nC='lit $A'\nD=\"x\\ny $A ${B}\"\nE=\"multi\nline\"\n\nbad line\nF=\n";
+ let v = parse(text, &none);
+ let get = |k: &str| v.iter().find(|(n, _)| n == k).map(|(_, v)| v.as_str());
+ assert_eq!(get("A"), Some("1"));
+ assert_eq!(get("B"), Some("two words"));
+ assert_eq!(get("C"), Some("lit $A"));
+ assert_eq!(get("D"), Some("x\ny 1 two words"));
+ assert_eq!(get("E"), Some("multi\nline"));
+ assert_eq!(get("F"), Some(""));
+ assert_eq!(v.len(), 6);
+ }
+
+ #[test]
+ fn references_fall_back_to_base() {
+ let v = parse("P=$HOME/bin:${MISSING}x", &|n| (n == "HOME").then(|| "/h".to_owned()));
+ assert_eq!(v, [("P".to_owned(), "/h/bin:x".to_owned())]);
+ }
+}
diff --git a/crates/ide-run/src/lib.rs b/crates/ide-run/src/lib.rs
index 55f950573..0a717609d 100644
--- a/crates/ide-run/src/lib.rs
+++ b/crates/ide-run/src/lib.rs
@@ -2,6 +2,7 @@
mod config;
mod detect;
+pub mod envfile;
pub mod junit;
mod process;
mod utf8;
@@ -38,6 +39,113 @@ pub struct RunConfig {
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
#[specta(optional)]
pub allow_parallel: bool,
+ /// Options of user-defined configurations (all optional; old `run.toml` files load unchanged).
+ #[serde(flatten)]
+ pub extras: RunExtras,
+}
+
+/// A step run before a configuration launches; a failing step aborts the launch.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct BeforeLaunchTask {
+ /// `run` (another configuration, `target` = its id) | `build` | `tool` (external tool id) |
+ /// `command` (a shell command line) | `toolWindow` (tool window id).
+ pub kind: String,
+ #[serde(default)]
+ pub target: String,
+}
+
+fn yes() -> bool {
+ true
+}
+
+fn is_true(b: &bool) -> bool {
+ *b
+}
+
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct RunExtras {
+ /// Values of the configuration type's own form fields (the command line derives from them).
+ #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
+ #[specta(optional)]
+ pub params: BTreeMap<String, String>,
+ /// Folder in the Run/Debug Configurations tree.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ #[specta(optional)]
+ pub folder: Option<String>,
+ /// Stored in the workspace (`.openidea/run.local.toml`, not shared) instead of `run.toml`.
+ #[serde(default, skip_serializing_if = "std::ops::Not::not")]
+ #[specta(optional)]
+ pub local: bool,
+ /// Off: the process gets only the configured variables.
+ #[serde(default = "yes", skip_serializing_if = "is_true")]
+ #[specta(optional)]
+ pub include_system_env: bool,
+ /// `.env` files (relative to the project root) loaded before `env`, in order.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[specta(optional)]
+ pub env_files: Vec<String>,
+ /// "Redirect input from": the process reads this file as stdin.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ #[specta(optional)]
+ pub stdin_file: Option<String>,
+ /// "Save console output to file" (overwritten on each run).
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ #[specta(optional)]
+ pub output_file: Option<String>,
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[specta(optional)]
+ pub before_launch: Vec<BeforeLaunchTask>,
+ /// Compound configurations: ids of the configurations started together.
+ #[serde(default, skip_serializing_if = "Vec::is_empty")]
+ #[specta(optional)]
+ pub compound: Vec<String>,
+ #[serde(default, skip_serializing_if = "std::ops::Not::not")]
+ #[specta(optional)]
+ pub show_on_stdout: bool,
+ #[serde(default, skip_serializing_if = "std::ops::Not::not")]
+ #[specta(optional)]
+ pub show_on_stderr: bool,
+ /// Overrides Settings › Run › "Show the Run tool window when a process starts".
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ #[specta(optional)]
+ pub open_tool_window: Option<bool>,
+ #[serde(default, skip_serializing_if = "std::ops::Not::not")]
+ #[specta(optional)]
+ pub focus_tool_window: bool,
+ /// "Emulate terminal in output console": the process runs on a pseudo-terminal
+ /// (colours, line editing, full-screen programs); the console renders it as a terminal.
+ #[serde(default, skip_serializing_if = "std::ops::Not::not")]
+ #[specta(optional)]
+ pub emulate_terminal: bool,
+ /// Shell command line run on Stop before the process is signalled (e.g. `docker stop <name>`),
+ /// with the run's working directory and environment.
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ #[specta(optional)]
+ pub stop_command: Option<String>,
+}
+
+impl Default for RunExtras {
+ fn default() -> Self {
+ Self {
+ params: BTreeMap::new(),
+ folder: None,
+ local: false,
+ include_system_env: true,
+ env_files: Vec::new(),
+ stdin_file: None,
+ output_file: None,
+ before_launch: Vec::new(),
+ compound: Vec::new(),
+ show_on_stdout: false,
+ show_on_stderr: false,
+ open_tool_window: None,
+ focus_tool_window: false,
+ emulate_terminal: false,
+ stop_command: None,
+ }
+ }
}
#[derive(Clone, Debug, Serialize, Deserialize, Type)]
@@ -63,6 +171,8 @@ pub struct RunInfo {
pub name: String,
pub pid: Option<u32>,
pub running: bool,
+ /// Runs on a pseudo-terminal: output is raw terminal data, input goes in keystroke by keystroke.
+ pub pty: bool,
}
/// Detects configs from package.json scripts, Cargo.toml targets, build.gradle(.kts),
@@ -76,11 +186,26 @@ pub fn load_user_configs(root: &Path) -> IdeResult<Vec<RunConfig>> {
config::load(root)
}
-/// Writes `<root>/.openidea/run.toml`, preserving unrelated content in the file.
+/// Writes `<root>/.openidea/run.toml` (and the workspace-local `run.local.toml` for
+/// configurations not stored as project files), preserving unrelated content.
pub fn save_user_configs(root: &Path, configs: &[RunConfig]) -> IdeResult<()> {
config::save(root, configs)
}
+/// Configuration templates (per-type defaults for new configurations) from `run.toml`.
+pub fn load_templates(root: &Path) -> IdeResult<Vec<RunConfig>> {
+ config::load_templates(root)
+}
+
+pub fn save_templates(root: &Path, templates: &[RunConfig]) -> IdeResult<()> {
+ config::save_templates(root, templates)
+}
+
+/// The environment runs inherit (unless "Include system environment variables" is off).
+pub fn system_env() -> BTreeMap<String, String> {
+ std::env::vars().collect()
+}
+
/// Path of the user run configuration file for `root`.
pub fn user_configs_path(root: &Path) -> PathBuf {
config::config_path(root)
diff --git a/crates/ide-run/src/process.rs b/crates/ide-run/src/process.rs
index 93c5b9495..4874ede65 100644
--- a/crates/ide-run/src/process.rs
+++ b/crates/ide-run/src/process.rs
@@ -1,13 +1,15 @@
-//! Process lifecycle for run configurations: spawn, stream output, stdin, stop.
+//! Process lifecycle for run configurations: spawn (on pipes, or on a pseudo-terminal
+//! for "Emulate terminal in output console"), stream output, stdin, stop.
use crate::utf8::OutputDecoder;
use crate::{OutputChunk, RunConfig, RunInfo};
use ide_core::{IdeError, IdeEvent, IdeResult, RunId, SharedSink};
use parking_lot::Mutex;
+use portable_pty::{CommandBuilder, MasterPty, PtySize, native_pty_system};
use std::collections::BTreeMap;
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
-use std::process::{ChildStdin, Command, ExitStatus, Stdio};
+use std::process::{Command, ExitStatus, Stdio};
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{self, RecvTimeoutError, Sender};
@@ -20,15 +22,39 @@ const BATCH_BYTES: usize = 64 * 1024;
const EXIT_DRAIN: Duration = Duration::from_millis(500);
/// Delay between SIGINT and SIGKILL on [`ProcessManager::stop`].
const STOP_GRACE: Duration = Duration::from_secs(3);
+/// Longest a configuration's stop command (e.g. `docker stop`) may take before signals follow.
+const STOP_COMMAND_TIMEOUT: Duration = Duration::from_secs(60);
/// Finished runs kept for [`ProcessManager::list`].
const MAX_FINISHED: usize = 20;
+/// PTY size until the console reports its own.
+const DEFAULT_PTY: (u16, u16) = (120, 30);
+
+type OutputFn = Arc<dyn Fn(OutputChunk) + Send + Sync>;
+
+/// Environment of a launched process: the inherited one (unless cleared) plus `vars`.
+#[derive(Clone, Debug, Default)]
+struct LaunchEnv {
+ clear: bool,
+ vars: BTreeMap<String, String>,
+}
+
+/// A configuration's stop command and where it runs.
+struct StopCommand {
+ line: String,
+ cwd: PathBuf,
+ env: LaunchEnv,
+}
struct Entry {
id: RunId,
config_id: String,
name: String,
pid: Option<u32>,
- stdin: Mutex<Option<ChildStdin>>,
+ stdin: Mutex<Option<Box<dyn Write + Send>>>,
+ /// The PTY master of a terminal-emulated run (resize; dropped on exit).
+ pty: Option<Mutex<Option<Box<dyn MasterPty + Send>>>>,
+ stop: Option<StopCommand>,
+ output: OutputFn,
exited: AtomicBool,
stopping: AtomicBool,
}
@@ -41,6 +67,7 @@ impl Entry {
name: self.name.clone(),
pid: self.pid,
running: !self.exited.load(Ordering::Acquire),
+ pty: self.pty.is_some(),
}
}
}
@@ -63,9 +90,14 @@ enum Stream {
Stderr,
}
+enum Exit {
+ Pipes(std::io::Result<ExitStatus>),
+ Pty(std::io::Result<portable_pty::ExitStatus>),
+}
+
enum Msg {
Data(Stream, Vec<u8>),
- Exited(std::io::Result<ExitStatus>),
+ Exited(Exit),
}
/// The program and arguments actually executed, plus the echoed command line.
@@ -154,6 +186,23 @@ fn resolve_program(command: &str, cwd: &Path, env: &BTreeMap<String, String>, wi
path.to_path_buf()
}
+/// "Save console output to file": everything shown in the console is also written to `path`.
+fn tee_output(path: &Path, on_output: OutputFn) -> IdeResult<OutputFn> {
+ if let Some(dir) = path.parent() {
+ std::fs::create_dir_all(dir)?;
+ }
+ let file = std::fs::File::create(path)
+ .map_err(|e| IdeError::invalid(format!("cannot write console output to {}: {e}", path.display())))?;
+ let file = Mutex::new(std::io::LineWriter::new(file));
+ Ok(Arc::new(move |chunk: OutputChunk| {
+ let text = match &chunk {
+ OutputChunk::Stdout { text } | OutputChunk::Stderr { text } | OutputChunk::System { text } => text,
+ };
+ let _ = file.lock().write_all(text.as_bytes());
+ on_output(chunk);
+ }))
+}
+
fn resolve_cwd(root: &Path, cwd: Option<&Path>) -> PathBuf {
match cwd {
Some(c) if c.is_absolute() => c.to_path_buf(),
@@ -184,6 +233,24 @@ impl ProcessManager {
return Err(IdeError::not_found(format!("working directory does not exist: {}", cwd.display())));
}
let inv = invocation(config, &cwd);
+ let extras = &config.extras;
+ if extras.emulate_terminal && extras.stdin_file.is_some() {
+ return Err(IdeError::invalid("input cannot be redirected from a file when emulating a terminal"));
+ }
+ let env = launch_env(root, config)?;
+ let on_output: OutputFn = Arc::from(on_output);
+ let on_output = match extras.output_file.as_deref() {
+ Some(file) => tee_output(&resolve_cwd(root, Some(Path::new(file))), on_output)?,
+ None => on_output,
+ };
+ let stop = extras.stop_command.as_deref().map(str::trim).filter(|l| !l.is_empty()).map(|line| StopCommand {
+ line: line.to_owned(),
+ cwd: cwd.clone(),
+ env: env.clone(),
+ });
+ if extras.emulate_terminal {
+ return self.start_pty(config, &inv, &cwd, &env, stop, options, sink, on_output);
+ }
let mut cmd = Command::new(&inv.program);
if inv.raw_args {
@@ -191,11 +258,21 @@ impl ProcessManager {
} else {
cmd.args(&inv.args);
}
- cmd.current_dir(&cwd).stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped());
- if matches!(config.kind.as_str(), "python" | "pytest") && !config.env.contains_key("PYTHONUNBUFFERED") {
- cmd.env("PYTHONUNBUFFERED", "1");
- }
- cmd.envs(&config.env);
+ cmd.current_dir(&cwd).stdout(Stdio::piped()).stderr(Stdio::piped());
+ let redirected = match extras.stdin_file.as_deref() {
+ Some(file) => {
+ let path = resolve_cwd(root, Some(Path::new(file)));
+ let f = std::fs::File::open(&path)
+ .map_err(|e| IdeError::not_found(format!("cannot redirect input from {}: {e}", path.display())))?;
+ cmd.stdin(Stdio::from(f));
+ true
+ }
+ None => {
+ cmd.stdin(Stdio::piped());
+ false
+ }
+ };
+ apply_env(&mut cmd, &env);
#[cfg(unix)]
{
use std::os::unix::process::CommandExt;
@@ -214,12 +291,19 @@ impl ProcessManager {
})?;
let id = RunId::next();
+ let stdin: Option<Box<dyn Write + Send>> = match child.stdin.take() {
+ Some(pipe) if !redirected => Some(Box::new(pipe)),
+ _ => None,
+ };
let entry = Arc::new(Entry {
id,
config_id: config.id.clone(),
name: config.name.clone(),
pid: Some(child.id()),
- stdin: Mutex::new(child.stdin.take()),
+ stdin: Mutex::new(stdin),
+ pty: None,
+ stop,
+ output: on_output.clone(),
exited: AtomicBool::new(false),
stopping: AtomicBool::new(false),
});
@@ -252,7 +336,7 @@ impl ProcessManager {
.name(format!("openidea-run-wait-{}", id.0))
.spawn(move || {
let status = child.wait();
- let _ = waiter_tx.send(Msg::Exited(status));
+ let _ = waiter_tx.send(Msg::Exited(Exit::Pipes(status)));
})
.map_err(|e| IdeError::internal(format!("failed to start waiter thread: {e}")))?;
@@ -260,6 +344,94 @@ impl ProcessManager {
Ok(entry.info())
}
+ /// [`Self::start`] on a pseudo-terminal: one merged output stream of raw terminal data.
+ #[allow(clippy::too_many_arguments)]
+ fn start_pty(
+ &self,
+ config: &RunConfig,
+ inv: &Invocation,
+ cwd: &Path,
+ env: &LaunchEnv,
+ stop: Option<StopCommand>,
+ options: &StartOptions,
+ sink: SharedSink,
+ on_output: OutputFn,
+ ) -> IdeResult<RunInfo> {
+ let pair = native_pty_system()
+ .openpty(pty_size(DEFAULT_PTY.0, DEFAULT_PTY.1))
+ .map_err(|e| IdeError::internal(format!("openpty failed: {e}")))?;
+ let mut cmd = CommandBuilder::new(&inv.program);
+ cmd.args(&inv.args);
+ cmd.cwd(cwd);
+ if env.clear {
+ cmd.env_clear();
+ }
+ cmd.env("TERM", "xterm-256color");
+ cmd.env("COLORTERM", "truecolor");
+ for (k, v) in &env.vars {
+ cmd.env(k, v);
+ }
+ let mut child = pair.slave.spawn_command(cmd).map_err(|e| {
+ let text = e.to_string();
+ if text.contains("No such file") || text.contains("not found") {
+ IdeError::unavailable(format!("command not found: {}", config.command))
+ } else {
+ IdeError::unavailable(format!("failed to start `{}`: {text}", config.command))
+ }
+ })?;
+ // The child holds its own copy of the slave; dropping ours lets reads hit EOF on exit.
+ drop(pair.slave);
+ let reader = pair.master.try_clone_reader().map_err(|e| IdeError::internal(format!("pty reader: {e}")))?;
+ let writer = pair.master.take_writer().map_err(|e| IdeError::internal(format!("pty writer: {e}")))?;
+
+ let id = RunId::next();
+ let entry = Arc::new(Entry {
+ id,
+ config_id: config.id.clone(),
+ name: config.name.clone(),
+ pid: child.process_id(),
+ stdin: Mutex::new(Some(writer)),
+ pty: Some(Mutex::new(Some(pair.master))),
+ stop,
+ output: on_output.clone(),
+ exited: AtomicBool::new(false),
+ stopping: AtomicBool::new(false),
+ });
+ self.register(entry.clone());
+ on_output(OutputChunk::System { text: format!("{}\n", inv.display) });
+
+ let (tx, rx) = mpsc::channel();
+ let result = spawn_reader(id, Stream::Stdout, reader, tx.clone())
+ .and_then(|_| spawn_pump(rx, on_output, entry.clone(), sink, options.encoding.clone()));
+ if let Err(e) = result {
+ let _ = child.kill();
+ let _ = child.wait();
+ entry.exited.store(true, Ordering::Release);
+ return Err(IdeError::internal(format!("failed to start output threads: {e}")));
+ }
+ std::thread::Builder::new()
+ .name(format!("openidea-run-wait-{}", id.0))
+ .spawn(move || {
+ let status = child.wait();
+ let _ = tx.send(Msg::Exited(Exit::Pty(status)));
+ })
+ .map_err(|e| IdeError::internal(format!("failed to start waiter thread: {e}")))?;
+ tracing::debug!(%id, config = %config.id, pid = ?entry.pid, "run started on a pty");
+ Ok(entry.info())
+ }
+
+ /// Resizes the pseudo-terminal of a terminal-emulated run.
+ pub fn resize(&self, id: RunId, cols: u16, rows: u16) -> IdeResult<()> {
+ let entry = self.entry(id)?;
+ let Some(pty) = &entry.pty else { return Err(IdeError::invalid("the process does not run in a terminal")) };
+ match pty.lock().as_ref() {
+ Some(master) => {
+ master.resize(pty_size(cols, rows)).map_err(|e| IdeError::internal(format!("resize failed: {e}")))
+ }
+ None => Ok(()),
+ }
+ }
+
fn register(&self, entry: Arc<Entry>) {
let mut runs = self.runs.lock();
runs.retain(|_, e| !(e.config_id == entry.config_id && e.exited.load(Ordering::Acquire)));
@@ -293,9 +465,13 @@ impl ProcessManager {
Ok(())
}
- /// Closes the process's stdin (sends EOF).
+ /// Closes the process's stdin (sends EOF; on a terminal, types ^D).
pub fn close_stdin(&self, id: RunId) -> IdeResult<()> {
- self.entry(id)?.stdin.lock().take();
+ let entry = self.entry(id)?;
+ if entry.pty.is_some() {
+ return self.write_stdin(id, "\u{4}");
+ }
+ entry.stdin.lock().take();
Ok(())
}
@@ -304,7 +480,8 @@ impl ProcessManager {
self.stop_with_grace(id, STOP_GRACE)
}
- /// [`Self::stop`] with an explicit grace period before the kill.
+ /// [`Self::stop`] with an explicit grace period before the kill. A configuration's
+ /// stop command runs first; signals follow only if the process outlives it.
pub fn stop_with_grace(&self, id: RunId, grace: Duration) -> IdeResult<()> {
let entry = self.entry(id)?;
if entry.exited.load(Ordering::Acquire) {
@@ -316,19 +493,31 @@ impl ProcessManager {
kill_tree(pid, true);
return Ok(());
}
- kill_tree(pid, false);
+ if entry.stop.is_none() {
+ kill_tree(pid, false);
+ }
let entry = entry.clone();
std::thread::Builder::new()
.name(format!("openidea-run-stop-{}", id.0))
.spawn(move || {
- let deadline = Instant::now() + grace;
- while Instant::now() < deadline {
- if !group_alive(pid, &entry) {
+ let exits_within = |limit: Duration| {
+ let deadline = Instant::now() + limit;
+ while Instant::now() < deadline {
+ if !group_alive(pid, &entry) {
+ return true;
+ }
+ std::thread::sleep(Duration::from_millis(50));
+ }
+ !group_alive(pid, &entry)
+ };
+ if let Some(stop) = &entry.stop {
+ run_stop_command(stop, &entry.output);
+ if exits_within(grace) {
return;
}
- std::thread::sleep(Duration::from_millis(50));
+ kill_tree(pid, false);
}
- if group_alive(pid, &entry) {
+ if !exits_within(grace) {
tracing::debug!(id = %entry.id, pid, "process ignored interrupt; killing");
kill_tree(pid, true);
}
@@ -354,6 +543,90 @@ impl Drop for ProcessManager {
}
}
+/// The environment a configuration's process gets on top of the inherited one: `.env`
+/// files, then the configured variables (later wins).
+fn launch_env(root: &Path, config: &RunConfig) -> IdeResult<LaunchEnv> {
+ let extras = &config.extras;
+ let mut vars = if extras.env_files.is_empty() {
+ BTreeMap::new()
+ } else {
+ let base: BTreeMap<String, String> =
+ if extras.include_system_env { std::env::vars().collect() } else { BTreeMap::new() };
+ let paths: Vec<PathBuf> = extras.env_files.iter().map(|f| resolve_cwd(root, Some(Path::new(f)))).collect();
+ crate::envfile::load(&paths, &base).map_err(|e| IdeError::not_found(format!("cannot read .env file: {e}")))?
+ };
+ if matches!(config.kind.as_str(), "python" | "pytest")
+ && !config.env.contains_key("PYTHONUNBUFFERED")
+ && !vars.contains_key("PYTHONUNBUFFERED")
+ {
+ vars.insert("PYTHONUNBUFFERED".into(), "1".into());
+ }
+ vars.extend(config.env.iter().map(|(k, v)| (k.clone(), v.clone())));
+ Ok(LaunchEnv { clear: !extras.include_system_env, vars })
+}
+
+fn apply_env(cmd: &mut Command, env: &LaunchEnv) {
+ if env.clear {
+ cmd.env_clear();
+ }
+ cmd.envs(&env.vars);
+}
+
+/// Runs `stop.line` through the platform shell and waits for it (bounded), echoing it
+/// and any error output to the console.
+fn run_stop_command(stop: &StopCommand, output: &OutputFn) {
+ output(OutputChunk::System { text: format!("{}\n", stop.line) });
+ let inv = shell_invocation(&stop.line, cfg!(windows), std::env::var("COMSPEC").ok());
+ let mut cmd = Command::new(&inv.program);
+ if inv.raw_args {
+ add_raw_args(&mut cmd, &inv.args);
+ } else {
+ cmd.args(&inv.args);
+ }
+ cmd.current_dir(&stop.cwd).stdin(Stdio::null()).stdout(Stdio::null()).stderr(Stdio::piped());
+ apply_env(&mut cmd, &stop.env);
+ ide_core::process::no_window(&mut cmd);
+ let mut child = match cmd.spawn() {
+ Ok(c) => c,
+ Err(e) => {
+ output(OutputChunk::Stderr { text: format!("Cannot run the stop command: {e}\n") });
+ return;
+ }
+ };
+ let stderr = child.stderr.take().map(|mut pipe| {
+ std::thread::spawn(move || {
+ let mut buf = Vec::new();
+ let _ = pipe.read_to_end(&mut buf);
+ String::from_utf8_lossy(&buf).into_owned()
+ })
+ });
+ let deadline = Instant::now() + STOP_COMMAND_TIMEOUT;
+ let status = loop {
+ match child.try_wait() {
+ Ok(Some(status)) => break Some(status),
+ Ok(None) if Instant::now() < deadline => std::thread::sleep(Duration::from_millis(50)),
+ _ => {
+ let _ = child.kill();
+ let _ = child.wait();
+ break None;
+ }
+ }
+ };
+ let err = stderr.and_then(|h| h.join().ok()).unwrap_or_default();
+ if !status.is_some_and(|s| s.success()) && !err.trim().is_empty() {
+ output(OutputChunk::Stderr { text: format!("{}\n", err.trim_end()) });
+ }
+}
+
+fn pty_size(cols: u16, rows: u16) -> PtySize {
+ PtySize {
+ cols: if cols == 0 { DEFAULT_PTY.0 } else { cols },
+ rows: if rows == 0 { DEFAULT_PTY.1 } else { rows },
+ pixel_width: 0,
+ pixel_height: 0,
+ }
+}
+
#[cfg(unix)]
fn group_alive(pid: u32, _entry: &Entry) -> bool {
// Signal 0 probes the group; it fails with ESRCH once every member is gone.
@@ -440,7 +713,7 @@ fn chunk(stream: Stream, text: String) -> OutputChunk {
/// Merges both streams in arrival order, batching consecutive output of the same stream.
fn spawn_pump(
rx: mpsc::Receiver<Msg>,
- on_output: Box<dyn Fn(OutputChunk) + Send + Sync>,
+ on_output: OutputFn,
entry: Arc<Entry>,
sink: SharedSink,
encoding: Option<String>,
@@ -451,7 +724,7 @@ fn spawn_pump(
let mut pending = String::new();
let mut pending_stream = Stream::Stdout;
let mut batch_started: Option<Instant> = None;
- let mut status: Option<std::io::Result<ExitStatus>> = None;
+ let mut status: Option<Exit> = None;
let mut drain_deadline: Option<Instant> = None;
let flush = |pending: &mut String, stream: Stream, started: &mut Option<Instant>| {
@@ -512,6 +785,9 @@ fn spawn_pump(
let (code, message) = describe_exit(status);
on_output(OutputChunk::System { text: format!("\n{message}\n") });
entry.stdin.lock().take();
+ if let Some(pty) = &entry.pty {
+ pty.lock().take();
+ }
entry.exited.store(true, Ordering::Release);
tracing::debug!(id = %entry.id, ?code, "run exited");
sink.emit(IdeEvent::RunExited { run: entry.id, code });
@@ -542,9 +818,9 @@ fn signal_name(sig: i32) -> &'static str {
}
/// IDEA wording: `Process finished with exit code 130 (interrupted by signal 2:SIGINT)`.
-fn describe_exit(status: Option<std::io::Result<ExitStatus>>) -> (Option<i32>, String) {
+fn describe_exit(status: Option<Exit>) -> (Option<i32>, String) {
match status {
- Some(Ok(s)) => {
+ Some(Exit::Pipes(Ok(s))) => {
if let Some(code) = s.code() {
return (Some(code), format!("Process finished with exit code {code}"));
}
@@ -552,23 +828,55 @@ fn describe_exit(status: Option<std::io::Result<ExitStatus>>) -> (Option<i32>, S
{
use std::os::unix::process::ExitStatusExt;
if let Some(sig) = s.signal() {
- let code = 128 + sig;
- return (
- Some(code),
- format!(
- "Process finished with exit code {code} (interrupted by signal {sig}:{})",
- signal_name(sig)
- ),
- );
+ return signalled(sig);
}
}
(None, "Process finished".to_owned())
}
- Some(Err(e)) => (None, format!("Process finished with unknown exit status: {e}")),
+ Some(Exit::Pty(Ok(s))) => match s.signal() {
+ None => {
+ let code = s.exit_code() as i32;
+ (Some(code), format!("Process finished with exit code {code}"))
+ }
+ Some(name) => match signal_number(name) {
+ Some(sig) => signalled(sig),
+ None => (None, format!("Process finished ({name})")),
+ },
+ },
+ Some(Exit::Pipes(Err(e)) | Exit::Pty(Err(e))) => {
+ (None, format!("Process finished with unknown exit status: {e}"))
+ }
None => (None, "Process finished".to_owned()),
}
}
+#[cfg(unix)]
+fn signalled(sig: i32) -> (Option<i32>, String) {
+ let code = 128 + sig;
+ (Some(code), format!("Process finished with exit code {code} (interrupted by signal {sig}:{})", signal_name(sig)))
+}
+
+#[cfg(not(unix))]
+fn signalled(sig: i32) -> (Option<i32>, String) {
+ (Some(128 + sig), format!("Process finished with exit code {}", 128 + sig))
+}
+
+/// The number of a signal from the `strsignal` description portable-pty reports.
+#[cfg(unix)]
+fn signal_number(description: &str) -> Option<i32> {
+ (1..32).find(|&sig| {
+ // SAFETY: `strsignal` returns a pointer to a NUL-terminated C string that stays
+ // valid until the next call on this thread; it is copied before that.
+ let name = unsafe { libc::strsignal(sig) };
+ !name.is_null() && unsafe { std::ffi::CStr::from_ptr(name) }.to_string_lossy() == description
+ })
+}
+
+#[cfg(not(unix))]
+fn signal_number(_description: &str) -> Option<i32> {
+ None
+}
+
#[cfg(test)]
mod tests {
use super::*;
diff --git a/crates/ide-run/src/wrap.rs b/crates/ide-run/src/wrap.rs
index 3c00c97bb..0e8aabc52 100644
--- a/crates/ide-run/src/wrap.rs
+++ b/crates/ide-run/src/wrap.rs
@@ -261,6 +261,7 @@ mod tests {
is_test: false,
debug_adapter: None,
allow_parallel: false,
+ extras: Default::default(),
}
}
diff --git a/crates/ide-run/tests/config.rs b/crates/ide-run/tests/config.rs
index 74344b026..b4bb34ac1 100644
--- a/crates/ide-run/tests/config.rs
+++ b/crates/ide-run/tests/config.rs
@@ -17,6 +17,7 @@ fn sample() -> Vec<RunConfig> {
is_test: false,
debug_adapter: Some("codelldb".into()),
allow_parallel: true,
+ extras: Default::default(),
},
RunConfig {
id: "user:tests".into(),
@@ -30,6 +31,7 @@ fn sample() -> Vec<RunConfig> {
is_test: true,
debug_adapter: None,
allow_parallel: false,
+ extras: Default::default(),
},
]
}
@@ -112,3 +114,58 @@ fn invalid_file_is_reported() {
assert_eq!(err.kind, ide_core::error::ErrorKind::InvalidInput);
assert!(err.message.contains("run.toml"));
}
+
+#[test]
+fn extras_round_trip_and_local_file() {
+ use ide_run::{BeforeLaunchTask, load_templates, save_templates};
+ let dir = tempfile::tempdir().unwrap();
+ let mut shared = sample().remove(0);
+ shared.extras.folder = Some("Servers".into());
+ shared.extras.params = BTreeMap::from([("mode".into(), "command".into())]);
+ shared.extras.include_system_env = false;
+ shared.extras.env_files = vec![".env".into(), "local.env".into()];
+ shared.extras.stdin_file = Some("in.txt".into());
+ shared.extras.output_file = Some("out.log".into());
+ shared.extras.before_launch = vec![
+ BeforeLaunchTask { kind: "build".into(), target: String::new() },
+ BeforeLaunchTask { kind: "run".into(), target: "user:migrate".into() },
+ ];
+ shared.extras.show_on_stderr = true;
+ shared.extras.open_tool_window = Some(false);
+ shared.extras.focus_tool_window = true;
+ shared.extras.emulate_terminal = true;
+ shared.extras.stop_command = Some("docker stop server".into());
+ let mut local = sample().remove(1);
+ local.extras.local = true;
+ let mut compound = sample().remove(1);
+ compound.id = "user:all".into();
+ compound.name = "All".into();
+ compound.kind = "compound".into();
+ compound.command = String::new();
+ compound.extras.compound = vec!["user:server".into(), "user:tests".into()];
+ let configs = vec![shared, compound, local];
+ save_user_configs(dir.path(), &configs).unwrap();
+ assert_eq!(load_user_configs(dir.path()).unwrap(), configs);
+
+ let project = fs::read_to_string(user_configs_path(dir.path())).unwrap();
+ assert!(!project.contains("\"user:tests\"\n"), "{project}");
+ let private = fs::read_to_string(dir.path().join(".openidea/run.local.toml")).unwrap();
+ assert!(private.contains("id = \"user:tests\""), "{private}");
+ let ignore = fs::read_to_string(dir.path().join(".openidea/.gitignore")).unwrap();
+ assert!(ignore.lines().any(|l| l == "/run.local.toml"), "{ignore}");
+
+ // Making it a project file moves it back.
+ let mut moved = configs.clone();
+ moved[2].extras.local = false;
+ save_user_configs(dir.path(), &moved).unwrap();
+ assert_eq!(load_user_configs(dir.path()).unwrap(), moved);
+ assert!(!fs::read_to_string(dir.path().join(".openidea/run.local.toml")).unwrap().contains("user:tests"));
+
+ // Templates share run.toml without disturbing configurations.
+ let mut template = sample().remove(1);
+ template.id = "template:npm".into();
+ template.kind = "npm".into();
+ save_templates(dir.path(), std::slice::from_ref(&template)).unwrap();
+ assert_eq!(load_templates(dir.path()).unwrap(), vec![template]);
+ assert_eq!(load_user_configs(dir.path()).unwrap(), moved);
+}
diff --git a/crates/ide-run/tests/process.rs b/crates/ide-run/tests/process.rs
index bd9d51c4a..946edfc10 100644
--- a/crates/ide-run/tests/process.rs
+++ b/crates/ide-run/tests/process.rs
@@ -43,6 +43,7 @@ fn cfg(id: &str, command: &str, args: &[&str]) -> RunConfig {
is_test: false,
debug_adapter: None,
allow_parallel: false,
+ extras: Default::default(),
}
}
@@ -273,3 +274,108 @@ fn exit_event_goes_to_the_starters_sink_only() {
assert!(other_events.try_recv().is_err());
assert!(h.events.try_recv().is_err());
}
+
+#[test]
+fn env_files_system_env_and_redirects() {
+ let h = harness();
+ let root = h.root.path();
+ std::fs::write(root.join(".env"), "FROM_FILE=file\nOVERRIDDEN=file\n").unwrap();
+ std::fs::write(root.join("input.txt"), "from file\n").unwrap();
+ let mut config = cfg(
+ "t:extras",
+ "/bin/sh",
+ &["-c", "printf '%s|%s|%s|' \"$FROM_FILE\" \"$OVERRIDDEN\" \"${HOME:-unset}\"; cat"],
+ );
+ config.env.insert("OVERRIDDEN".into(), "config".into());
+ config.extras.env_files = vec![".env".into()];
+ config.extras.include_system_env = false;
+ config.extras.stdin_file = Some("input.txt".into());
+ config.extras.output_file = Some("logs/out.log".into());
+ let (id, chunks) = start(&h, &config);
+ // stdin comes from the file: writing to it is refused.
+ assert!(h.pm.write_stdin(id, "x").is_err());
+ assert_eq!(wait_exit(&h, id, Duration::from_secs(10)), Some(0));
+ assert_eq!(text(&chunks, stdout), "file|config|unset|from file\n");
+ let saved = std::fs::read_to_string(root.join("logs/out.log")).unwrap();
+ assert!(saved.contains("file|config|unset|from file\n"), "{saved}");
+ assert!(saved.contains("Process finished with exit code 0"), "{saved}");
+
+ // With the system environment, HOME is inherited.
+ config.extras.include_system_env = true;
+ config.extras.stdin_file = None;
+ config.extras.output_file = None;
+ config.args = vec!["-c".into(), "printf '%s' \"${HOME:+set}\"".into()];
+ let (id, chunks) = start(&h, &config);
+ assert_eq!(wait_exit(&h, id, Duration::from_secs(10)), Some(0));
+ assert_eq!(text(&chunks, stdout), "set");
+
+ config.extras.env_files = vec!["missing.env".into()];
+ assert!(h.pm.start(root, &config, &StartOptions::default(), h.sink.clone(), Box::new(|_| {})).is_err());
+}
+
+#[test]
+fn emulated_terminal_is_a_tty_with_input_resize_and_exit_code() {
+ let h = harness();
+ let script = "[ -t 1 ] && echo tty-yes; echo \"term=$TERM\"; read line; echo \"got:$line\"; stty size; exit 3";
+ let mut config = cfg("t:pty", "/bin/sh", &["-c", script]);
+ config.extras.emulate_terminal = true;
+ let (id, chunks) = start(&h, &config);
+ assert!(h.pm.list().iter().any(|r| r.id == id && r.pty));
+ wait_for(&chunks, "term=xterm-256color");
+ h.pm.resize(id, 100, 40).unwrap();
+ h.pm.write_stdin(id, "hello\r").unwrap();
+ let out = wait_for(&chunks, "40 100");
+ assert!(out.contains("tty-yes"), "{out:?}");
+ assert!(out.contains("got:hello"), "{out:?}");
+ assert_eq!(wait_exit(&h, id, Duration::from_secs(10)), Some(3));
+ assert!(text(&chunks, system).contains("Process finished with exit code 3"));
+ // Stdout and stderr share the terminal.
+ assert_eq!(text(&chunks, stderr), "");
+}
+
+#[test]
+fn emulated_terminal_stop_reports_the_signal() {
+ let h = harness();
+ let mut config = cfg("t:pty-stop", "/bin/sh", &["-c", "echo ready; sleep 30"]);
+ config.extras.emulate_terminal = true;
+ let (id, chunks) = start(&h, &config);
+ wait_for(&chunks, "ready");
+ h.pm.stop(id).unwrap();
+ let code = wait_exit(&h, id, Duration::from_secs(10));
+ assert_eq!(code, Some(130), "{:?}", text(&chunks, system));
+ assert!(text(&chunks, system).contains("SIGINT"));
+}
+
+#[test]
+fn emulated_terminal_refuses_input_redirection() {
+ let h = harness();
+ let mut config = cfg("t:pty-stdin", "/bin/cat", &[]);
+ config.extras.emulate_terminal = true;
+ config.extras.stdin_file = Some("input.txt".into());
+ assert!(h.pm.start(h.root.path(), &config, &StartOptions::default(), h.sink.clone(), Box::new(|_| {})).is_err());
+}
+
+#[test]
+fn pipe_runs_cannot_be_resized() {
+ let h = harness();
+ let (id, _chunks) = start(&h, &cfg("t:pipes", "/bin/sh", &["-c", "sleep 5"]));
+ assert!(!h.pm.list().iter().find(|r| r.id == id).unwrap().pty);
+ assert!(h.pm.resize(id, 80, 24).is_err());
+ h.pm.stop(id).unwrap();
+ wait_exit(&h, id, Duration::from_secs(10));
+}
+
+#[test]
+fn stop_command_runs_first_with_the_run_environment() {
+ let h = harness();
+ let mut config = cfg("t:stop-cmd", "/bin/sh", &["-c", "echo ready; sleep 30"]);
+ config.env.insert("OPENIDEA_MARKER".into(), "stopped".into());
+ config.extras.stop_command = Some("touch \"$OPENIDEA_MARKER\"".into());
+ let (id, chunks) = start(&h, &config);
+ wait_for(&chunks, "ready");
+ h.pm.stop_with_grace(id, Duration::from_millis(200)).unwrap();
+ // `sleep` ignores nothing: the signals that follow the stop command end it.
+ assert_eq!(wait_exit(&h, id, Duration::from_secs(10)), Some(130));
+ assert!(h.root.path().join("stopped").exists(), "stop command did not run");
+ assert!(text(&chunks, system).contains("touch \"$OPENIDEA_MARKER\""));
+}
diff --git a/crates/ide-sdk/Cargo.toml b/crates/ide-sdk/Cargo.toml
index cce2ab5b1..028f233f8 100644
--- a/crates/ide-sdk/Cargo.toml
+++ b/crates/ide-sdk/Cargo.toml
@@ -10,6 +10,7 @@ dunce.workspace = true
ide-core.workspace = true
ide-language.workspace = true
ide-run.workspace = true
+ide-vfs.workspace = true
serde.workspace = true
serde_json.workspace = true
specta.workspace = true
diff --git a/crates/ide-sdk/src/apply.rs b/crates/ide-sdk/src/apply.rs
index 9e956450c..490defe04 100644
--- a/crates/ide-sdk/src/apply.rs
+++ b/crates/ide-sdk/src/apply.rs
@@ -32,12 +32,12 @@ pub fn python_interpreter(root: &Path, s: &Settings) -> Option<PathBuf> {
}
/// The configured `node` executable's directory.
-fn node_dir(root: &Path, s: &Settings) -> Option<PathBuf> {
+pub(crate) fn node_dir(root: &Path, s: &Settings) -> Option<PathBuf> {
setting_path(root, &s.languages.node.interpreter).and_then(|p| p.parent().map(Path::to_path_buf))
}
/// The configured Rust toolchain's `bin` directory and rustup toolchain name.
-fn rust_bin(root: &Path, s: &Settings) -> Option<(PathBuf, Option<String>)> {
+pub(crate) fn rust_bin(root: &Path, s: &Settings) -> Option<(PathBuf, Option<String>)> {
let dir = setting_path(root, &s.languages.rust.toolchain)?;
let bin = if dir.join("bin").join(exe("rustc")).is_file() || dir.join("bin").join(exe("cargo")).is_file() {
dir.join("bin")
@@ -52,7 +52,7 @@ fn rust_bin(root: &Path, s: &Settings) -> Option<(PathBuf, Option<String>)> {
Some((bin, toolchain))
}
-fn goroot(root: &Path, s: &Settings) -> Option<PathBuf> {
+pub(crate) fn goroot(root: &Path, s: &Settings) -> Option<PathBuf> {
setting_path(root, &s.languages.go.goroot)
}
diff --git a/crates/ide-sdk/src/exec.rs b/crates/ide-sdk/src/exec.rs
index 267aa91d4..fd3806ae1 100644
--- a/crates/ide-sdk/src/exec.rs
+++ b/crates/ide-sdk/src/exec.rs
@@ -44,9 +44,25 @@ pub(crate) fn which(name: &str) -> Option<PathBuf> {
/// Runs `program args` and returns trimmed stdout (stderr when stdout is empty)
/// on success; `None` on failure or after `timeout`.
pub(crate) fn query(program: &Path, args: &[&str], timeout: Duration) -> Option<String> {
- let mut child = ide_core::process::no_window(&mut Command::new(program))
+ query_in(program, args, None, &[], timeout)
+}
+
+/// [`query`] in `cwd` with extra environment variables.
+pub(crate) fn query_in(
+ program: &Path,
+ args: &[&str],
+ cwd: Option<&Path>,
+ env: &[(&str, &str)],
+ timeout: Duration,
+) -> Option<String> {
+ let mut cmd = Command::new(program);
+ if let Some(cwd) = cwd {
+ cmd.current_dir(cwd);
+ }
+ let mut child = ide_core::process::no_window(&mut cmd)
.args(args)
.env("PATH", search_path())
+ .envs(env.iter().copied())
.stdin(Stdio::null())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
diff --git a/crates/ide-sdk/src/lib.rs b/crates/ide-sdk/src/lib.rs
index 296a75027..1068f19e5 100644
--- a/crates/ide-sdk/src/lib.rs
+++ b/crates/ide-sdk/src/lib.rs
@@ -9,6 +9,7 @@ pub mod apply;
mod discover;
mod exec;
pub mod java;
+pub mod libraries;
pub mod locate;
pub mod lombok;
pub mod python;
diff --git a/crates/ide-sdk/src/libraries.rs b/crates/ide-sdk/src/libraries.rs
new file mode 100644
index 000000000..08b1161bb
--- /dev/null
+++ b/crates/ide-sdk/src/libraries.rs
@@ -0,0 +1,469 @@
+//! "External Libraries" of a project (IDEA's library / SDK roots in the
+//! Project view): the folders holding the sources of the project's SDKs and
+//! dependencies — the Python interpreter's standard library and site-packages,
+//! the JDK, `node_modules` packages, Cargo crates and the Rust standard
+//! library, GOROOT and the Go module cache.
+//!
+//! Each ecosystem is detected only when the project has its manifest, and its
+//! result is cached until the manifests (or the relevant settings) change.
+//!
+//! Archives are listed as browsable roots (`<archive>!`, see `ide_vfs`): the
+//! JDK's `src.zip` and the Maven / Gradle dependency jars (sources jars preferred).
+
+use crate::exe;
+use crate::exec::{query, query_in, which};
+use ide_core::settings::Settings;
+use serde::{Deserialize, Serialize};
+use specta::Type;
+use std::collections::HashMap;
+use std::path::{Path, PathBuf};
+use std::sync::{LazyLock, Mutex};
+use std::time::{Duration, SystemTime};
+
+/// One SDK or library with its source folders (`< Python 3.12 (.venv) >`).
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct LibraryGroup {
+ /// Display name, e.g. `Python 3.12 (.venv)`.
+ pub name: String,
+ /// `python` | `jdk` | `nodeModules` | `nodeCore` | `rust` | `cargo` | `go` | `goModules` | `maven` | `gradle`.
+ pub kind: String,
+ pub roots: Vec<LibraryRoot>,
+}
+
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct LibraryRoot {
+ /// Folder name, e.g. `python3.12` or `site-packages`, the package (`serde 1.0.200`)
+ /// or the archive (`src.zip`, `guava-33.0.0-jre-sources.jar`).
+ pub name: String,
+ /// A folder, or an archive's root (`<archive>!`).
+ pub path: ide_core::IpcPath,
+}
+
+const QUERY_TIMEOUT: Duration = Duration::from_secs(10);
+/// `cargo metadata` / `go list` load the whole dependency graph.
+const GRAPH_TIMEOUT: Duration = Duration::from_secs(60);
+
+/// Prints the interpreter's library folders as JSON: `[stdlib, platstdlib, purelib, platlib]`.
+const PYTHON_PATHS: &str = "import json,sysconfig;p=sysconfig.get_paths();\
+print(json.dumps([p.get(k) for k in ('stdlib','platstdlib','purelib','platlib')]))";
+
+const JAVA_MANIFESTS: &[&str] =
+ &["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts"];
+const NODE_MANIFESTS: &[&str] = &["package.json", "package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb"];
+const CARGO_MANIFESTS: &[&str] = &["Cargo.toml", "Cargo.lock", "rust-toolchain", "rust-toolchain.toml"];
+const GO_MANIFESTS: &[&str] = &["go.mod", "go.sum", "go.work"];
+
+/// A Maven / Gradle dependency of the project, from the build model.
+#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub struct BuildDependency {
+ /// Resolved by Gradle (else Maven): looked up in the Gradle cache first.
+ pub gradle: bool,
+ pub group: String,
+ pub artifact: String,
+ pub version: String,
+}
+
+/// The project's library groups; empty when no SDK is configured. Runs the
+/// toolchains (in parallel), so call it off the UI / command thread.
+/// `dependencies` (from the build model) are listed when their jars are in the local repositories.
+pub fn project_libraries(root: &Path, settings: &Settings, dependencies: &[BuildDependency]) -> Vec<LibraryGroup> {
+ type Detect = fn(&Path, &Settings) -> Vec<LibraryGroup>;
+ let detectors: [Detect; 5] = [python_groups, jdk_groups, node_groups, rust_groups, go_groups];
+ std::thread::scope(|s| {
+ let handles: Vec<_> = detectors.iter().map(|d| s.spawn(move || d(root, settings))).collect();
+ let deps = s.spawn(|| dependency_groups(root, settings, dependencies));
+ handles.into_iter().chain([deps]).flat_map(|h| h.join().unwrap_or_default()).collect()
+ })
+}
+
+// ------------------------------------------------------------------ cache
+
+/// Size and modification time of each manifest (`None`: missing).
+type Stamp = Vec<(PathBuf, Option<(SystemTime, u64)>)>;
+
+struct Cached {
+ /// Settings the result depends on.
+ key: String,
+ stamp: Stamp,
+ groups: Vec<LibraryGroup>,
+}
+
+static CACHE: LazyLock<Mutex<HashMap<(PathBuf, &'static str), Cached>>> = LazyLock::new(Default::default);
+
+fn stamp(files: &[PathBuf]) -> Stamp {
+ files
+ .iter()
+ .map(|f| {
+ let meta = std::fs::metadata(f).ok().and_then(|m| Some((m.modified().ok()?, m.len())));
+ (f.clone(), meta)
+ })
+ .collect()
+}
+
+/// `detect()` unless the last result for `(root, ecosystem)` was computed with
+/// the same `key` and unchanged `manifests`.
+pub(crate) fn cached(
+ root: &Path,
+ ecosystem: &'static str,
+ key: String,
+ manifests: &[PathBuf],
+ detect: impl FnOnce() -> Vec<LibraryGroup>,
+) -> Vec<LibraryGroup> {
+ let id = (root.to_path_buf(), ecosystem);
+ let now = stamp(manifests);
+ if let Some(c) = CACHE.lock().unwrap_or_else(|e| e.into_inner()).get(&id)
+ && c.key == key
+ && c.stamp == now
+ {
+ return c.groups.clone();
+ }
+ let groups = detect();
+ CACHE.lock().unwrap_or_else(|e| e.into_inner()).insert(id, Cached { key, stamp: now, groups: groups.clone() });
+ groups
+}
+
+/// `names` below `root` when at least one of them exists (the project uses that ecosystem).
+fn manifests(root: &Path, names: &[&str]) -> Option<Vec<PathBuf>> {
+ let files: Vec<PathBuf> = names.iter().map(|n| root.join(n)).collect();
+ files.iter().any(|f| f.is_file()).then_some(files)
+}
+
+fn group(name: impl Into<String>, kind: &str, roots: Vec<LibraryRoot>) -> Option<LibraryGroup> {
+ (!roots.is_empty()).then(|| LibraryGroup { name: name.into(), kind: kind.into(), roots })
+}
+
+/// A configured toolchain `bin` dir's `name`, else `name` on the search path.
+fn tool(bin: Option<PathBuf>, name: &str) -> Option<PathBuf> {
+ bin.map(|b| b.join(exe(name))).filter(|p| p.is_file()).or_else(|| which(name))
+}
+
+// ------------------------------------------------------------------ python
+
+fn python_groups(root: &Path, s: &Settings) -> Vec<LibraryGroup> {
+ let Some(python) = crate::apply::python_interpreter(root, s) else { return Vec::new() };
+ let mut files = vec![python.clone()];
+ files.extend(crate::venv_of(&python).map(|v| v.join("pyvenv.cfg")));
+ cached(root, "python", python.display().to_string(), &files, || {
+ python_libraries(&python, Some(root)).into_iter().collect()
+ })
+}
+
+/// Standard library and site-packages folders of a Python interpreter.
+pub fn python_libraries(python: &Path, root: Option<&Path>) -> Option<LibraryGroup> {
+ let out = query(python, &["-c", PYTHON_PATHS], QUERY_TIMEOUT)?;
+ let name = crate::discover::python_sdk(python, "system", root).map(|s| s.name).unwrap_or_else(|| "Python".into());
+ group(name, "python", library_roots(parse_python_paths(&out)))
+}
+
+pub(crate) fn parse_python_paths(out: &str) -> Vec<PathBuf> {
+ let json = out.lines().rev().find(|l| l.trim_start().starts_with('[')).unwrap_or("[]");
+ serde_json::from_str::<Vec<Option<String>>>(json)
+ .unwrap_or_default()
+ .into_iter()
+ .flatten()
+ .map(PathBuf::from)
+ .collect()
+}
+
+/// Existing folders among `paths`, deduplicated (also through symlinks), in order.
+pub(crate) fn library_roots(paths: Vec<PathBuf>) -> Vec<LibraryRoot> {
+ named_roots(
+ paths
+ .into_iter()
+ .map(|p| {
+ (p.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_else(|| p.display().to_string()), p)
+ })
+ .collect(),
+ )
+}
+
+/// Existing folders among `(name, path)`, deduplicated (also through symlinks), in order.
+pub(crate) fn named_roots(roots: Vec<(String, PathBuf)>) -> Vec<LibraryRoot> {
+ let mut seen = std::collections::HashSet::new();
+ roots
+ .into_iter()
+ .filter(|(_, p)| p.is_dir() && seen.insert(dunce::canonicalize(p).unwrap_or_else(|_| p.clone())))
+ .map(|(name, p)| LibraryRoot { name, path: p.into() })
+ .collect()
+}
+
+// ------------------------------------------------------------------ jdk
+
+fn jdk_groups(root: &Path, s: &Settings) -> Vec<LibraryGroup> {
+ let Some(files) = manifests(root, JAVA_MANIFESTS) else { return Vec::new() };
+ cached(root, "jdk", s.languages.java.jdk.clone(), &files, || {
+ let jdk = crate::apply::project_jdk(root, s).or_else(|| {
+ crate::java::pick_jdk(&crate::java::installed_jdks(), crate::java::project_java_version(root)).cloned()
+ });
+ jdk.and_then(|j| jdk_library(&j)).into_iter().collect()
+ })
+}
+
+/// The JDK home and its sources (`lib/src.zip`, `src.zip` in JDK 8) as library roots.
+pub(crate) fn jdk_library(jdk: &crate::java::Jdk) -> Option<LibraryGroup> {
+ let name = jdk_name(&jdk.home).unwrap_or_else(|| format!("JDK {}", jdk.major));
+ let mut roots = named_roots(vec![(name.clone(), jdk.home.clone())]);
+ if let Some(src) = ["lib/src.zip", "src.zip"].iter().map(|r| jdk.home.join(r)).find(|p| p.is_file()) {
+ roots.push(LibraryRoot { name: "src.zip".into(), path: ide_vfs::archive_root(&src).into() });
+ }
+ group(name, "jdk", roots)
+}
+
+/// `temurin-21` for `…/temurin-21.jdk/Contents/Home` (macOS bundles) or `…/temurin-21`.
+pub(crate) fn jdk_name(home: &Path) -> Option<String> {
+ let dir = if home.ends_with("Contents/Home") { home.parent()?.parent()? } else { home };
+ let name = dir.file_name()?.to_string_lossy();
+ Some(name.strip_suffix(".jdk").unwrap_or(&name).to_owned())
+}
+
+// ------------------------------------------------------------------ maven / gradle
+
+fn dependency_groups(root: &Path, s: &Settings, deps: &[BuildDependency]) -> Vec<LibraryGroup> {
+ if deps.is_empty() {
+ return Vec::new();
+ }
+ let maven_repo = crate::apply::maven_local_repository(root, s).or_else(default_maven_repository);
+ let gradle_home = gradle_user_home();
+ let files: Vec<PathBuf> = JAVA_MANIFESTS.iter().map(|n| root.join(n)).collect();
+ let key = format!("{maven_repo:?}\n{gradle_home:?}\n{deps:?}");
+ cached(root, "buildDependencies", key, &files, || {
+ dependency_libraries(deps, maven_repo.as_deref(), gradle_home.as_deref())
+ })
+}
+
+/// `~/.m2/repository` (Settings › Maven › Local repository overrides it).
+fn default_maven_repository() -> Option<PathBuf> {
+ Some(crate::home_dir()?.join(".m2/repository"))
+}
+
+/// `$GRADLE_USER_HOME`, else `~/.gradle`.
+fn gradle_user_home() -> Option<PathBuf> {
+ std::env::var_os("GRADLE_USER_HOME").map(PathBuf::from).or_else(|| Some(crate::home_dir()?.join(".gradle")))
+}
+
+/// One `Maven: g:a:v` / `Gradle: g:a:v` group per dependency whose jar is in a
+/// local repository, its root being the jar (the `-sources.jar` when downloaded).
+pub(crate) fn dependency_libraries(
+ deps: &[BuildDependency],
+ maven_repo: Option<&Path>,
+ gradle_home: Option<&Path>,
+) -> Vec<LibraryGroup> {
+ let mut deps: Vec<&BuildDependency> = deps.iter().collect();
+ deps.sort();
+ deps.dedup();
+ deps.into_iter()
+ .filter_map(|d| {
+ let maven = || maven_repo.and_then(|r| maven_jar(r, d));
+ let gradle = || gradle_home.and_then(|h| gradle_jar(h, d));
+ let jar = if d.gradle { gradle().or_else(maven) } else { maven().or_else(gradle) }?;
+ let tool = if d.gradle { "Gradle" } else { "Maven" };
+ let name = jar.file_name()?.to_string_lossy().into_owned();
+ group(
+ format!("{tool}: {}:{}:{}", d.group, d.artifact, d.version),
+ &tool.to_lowercase(),
+ vec![LibraryRoot { name, path: ide_vfs::archive_root(&jar).into() }],
+ )
+ })
+ .collect()
+}
+
+/// No path separators, interpolations or `..` segments (coordinates become paths).
+fn valid_coordinate(d: &BuildDependency) -> bool {
+ [&d.group, &d.artifact, &d.version]
+ .iter()
+ .all(|p| !p.is_empty() && !p.contains(['/', '\\', '$']) && !p.split('.').any(str::is_empty))
+}
+
+/// `<repo>/<group as path>/<artifact>/<version>/<artifact>-<version>(-sources).jar`.
+pub(crate) fn maven_jar(repo: &Path, d: &BuildDependency) -> Option<PathBuf> {
+ if !valid_coordinate(d) {
+ return None;
+ }
+ let dir = repo.join(d.group.replace('.', "/")).join(&d.artifact).join(&d.version);
+ ["-sources.jar", ".jar"]
+ .iter()
+ .map(|suffix| dir.join(format!("{}-{}{suffix}", d.artifact, d.version)))
+ .find(|p| p.is_file())
+}
+
+/// `<gradle home>/caches/modules-2/files-2.1/<group>/<artifact>/<version>/<hash>/<artifact>-<version>(-sources).jar`.
+pub(crate) fn gradle_jar(home: &Path, d: &BuildDependency) -> Option<PathBuf> {
+ if !valid_coordinate(d) {
+ return None;
+ }
+ let dir = home.join("caches/modules-2/files-2.1").join(&d.group).join(&d.artifact).join(&d.version);
+ let mut hashes: Vec<PathBuf> = std::fs::read_dir(dir).ok()?.flatten().map(|e| e.path()).collect();
+ hashes.sort();
+ ["-sources.jar", ".jar"].iter().find_map(|suffix| {
+ let file = format!("{}-{}{suffix}", d.artifact, d.version);
+ hashes.iter().map(|h| h.join(&file)).find(|p| p.is_file())
+ })
+}
+
+// ------------------------------------------------------------------ node
+
+fn node_groups(root: &Path, s: &Settings) -> Vec<LibraryGroup> {
+ let Some(files) = manifests(root, NODE_MANIFESTS) else { return Vec::new() };
+ if !root.join("package.json").is_file() {
+ return Vec::new();
+ }
+ cached(root, "node", s.languages.node.interpreter.clone(), &files, || {
+ let node = tool(crate::apply::node_dir(root, s), "node");
+ node_libraries(root, node.as_deref())
+ })
+}
+
+/// `node_modules/<dep>` of the direct dependencies in `package.json`, and the
+/// Node.js core typings (`@types/node`, from the project or the runtime's global `lib`).
+pub(crate) fn node_libraries(root: &Path, node: Option<&Path>) -> Vec<LibraryGroup> {
+ let manifest = std::fs::read_to_string(root.join("package.json")).unwrap_or_default();
+ let modules = root.join("node_modules");
+ let deps = named_roots(package_dependencies(&manifest).into_iter().map(|d| (d.clone(), modules.join(d))).collect());
+ let mut core = vec![modules.join("@types/node")];
+ // `<prefix>/bin/node` → `<prefix>/lib/node_modules`.
+ if let Some(prefix) =
+ node.and_then(|n| dunce::canonicalize(n).ok()).and_then(|n| Some(n.parent()?.parent()?.to_path_buf()))
+ {
+ core.push(prefix.join("lib/node_modules/@types/node"));
+ }
+ let mut core = named_roots(core.into_iter().map(|p| ("@types/node".to_owned(), p)).collect());
+ core.truncate(1);
+ [group("Node.js Core", "nodeCore", core), group("node_modules", "nodeModules", deps)]
+ .into_iter()
+ .flatten()
+ .collect()
+}
+
+/// Names of the direct dependencies (all dependency kinds), sorted, deduplicated.
+pub(crate) fn package_dependencies(package_json: &str) -> Vec<String> {
+ let Ok(json) = serde_json::from_str::<serde_json::Value>(package_json) else { return Vec::new() };
+ let mut names: Vec<String> = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]
+ .iter()
+ .filter_map(|k| json.get(k)?.as_object())
+ .flat_map(|o| o.keys().cloned())
+ .filter(|n| !n.is_empty() && !n.contains("..") && !n.starts_with('/'))
+ .collect();
+ names.sort();
+ names.dedup();
+ names
+}
+
+// ------------------------------------------------------------------ rust
+
+fn rust_groups(root: &Path, s: &Settings) -> Vec<LibraryGroup> {
+ let Some(files) = manifests(root, CARGO_MANIFESTS) else { return Vec::new() };
+ if !root.join("Cargo.toml").is_file() {
+ return Vec::new();
+ }
+ let r = &s.languages.rust;
+ cached(root, "rust", format!("{}\n{}", r.toolchain, r.stdlib), &files, || {
+ let bin = crate::apply::rust_bin(root, s).map(|(b, _)| b);
+ let mut out = Vec::new();
+ if let Some(rustc) = tool(bin.clone(), "rustc") {
+ let version = query_in(&rustc, &["--version"], Some(root), &[], QUERY_TIMEOUT);
+ let library = crate::apply::setting_path(root, &r.stdlib).or_else(|| {
+ let sysroot = query_in(&rustc, &["--print", "sysroot"], Some(root), &[], QUERY_TIMEOUT)?;
+ Some(PathBuf::from(sysroot).join("lib/rustlib/src/rust/library"))
+ });
+ let name = match version.as_deref().and_then(|v| v.split_whitespace().nth(1)) {
+ Some(v) => format!("Rust {v}"),
+ None => "Rust".into(),
+ };
+ out.extend(library.and_then(|l| group(name, "rust", library_roots(vec![l]))));
+ }
+ if let Some(cargo) = tool(bin, "cargo")
+ && let Some(json) =
+ query_in(&cargo, &["metadata", "--format-version", "1", "--offline"], Some(root), &[], GRAPH_TIMEOUT)
+ {
+ out.extend(group("Cargo dependencies", "cargo", named_roots(parse_cargo_metadata(&json))));
+ }
+ out
+ })
+}
+
+/// `(name version, source dir)` of the non-workspace packages in `cargo metadata` output, by name.
+pub(crate) fn parse_cargo_metadata(json: &str) -> Vec<(String, PathBuf)> {
+ #[derive(Deserialize)]
+ struct Package {
+ name: String,
+ version: String,
+ source: Option<String>,
+ manifest_path: PathBuf,
+ }
+ #[derive(Deserialize)]
+ struct Metadata {
+ packages: Vec<Package>,
+ }
+ let Ok(meta) = serde_json::from_str::<Metadata>(json) else { return Vec::new() };
+ let mut out: Vec<(String, PathBuf)> = meta
+ .packages
+ .into_iter()
+ .filter(|p| p.source.is_some())
+ .filter_map(|p| Some((format!("{} {}", p.name, p.version), p.manifest_path.parent()?.to_path_buf())))
+ .collect();
+ out.sort_by_cached_key(|(name, _)| name.to_lowercase());
+ out
+}
+
+// ------------------------------------------------------------------ go
+
+fn go_groups(root: &Path, s: &Settings) -> Vec<LibraryGroup> {
+ let Some(files) = manifests(root, GO_MANIFESTS) else { return Vec::new() };
+ if !root.join("go.mod").is_file() && !root.join("go.work").is_file() {
+ return Vec::new();
+ }
+ let g = &s.languages.go;
+ cached(root, "go", format!("{}\n{}", g.goroot, g.gopath), &files, || {
+ let goroot = crate::apply::goroot(root, s);
+ let Some(go) = tool(goroot.as_ref().map(|r| r.join("bin")), "go") else { return Vec::new() };
+ let goroot_s = goroot.as_ref().map(|p| p.to_string_lossy().into_owned());
+ let gopath = crate::apply::setting_path(root, &g.gopath).map(|p| p.to_string_lossy().into_owned());
+ // Never download modules or toolchains just to list libraries.
+ let mut env = vec![("GOPROXY", "off"), ("GOTOOLCHAIN", "local")];
+ env.extend(goroot_s.as_deref().map(|v| ("GOROOT", v)));
+ env.extend(gopath.as_deref().map(|v| ("GOPATH", v)));
+ let mut out = Vec::new();
+ if let Some(vars) = query_in(&go, &["env", "GOROOT", "GOVERSION"], Some(root), &env, QUERY_TIMEOUT) {
+ let mut lines = vars.lines().map(str::trim);
+ let (dir, version) = (lines.next().unwrap_or_default(), lines.next().unwrap_or_default());
+ let name = match version.strip_prefix("go") {
+ Some(v) if !v.is_empty() => format!("Go SDK {v}"),
+ _ => "Go SDK".into(),
+ };
+ if !dir.is_empty() {
+ out.extend(group(name, "go", library_roots(vec![Path::new(dir).join("src")])));
+ }
+ }
+ if let Some(text) = query_in(&go, &["list", "-m", "-e", "-json", "all"], Some(root), &env, GRAPH_TIMEOUT) {
+ out.extend(group("Go Modules", "goModules", named_roots(parse_go_modules(&text))));
+ }
+ out
+ })
+}
+
+/// `(path@version, dir)` of the downloaded non-main modules in `go list -m -json` output.
+pub(crate) fn parse_go_modules(text: &str) -> Vec<(String, PathBuf)> {
+ #[derive(Deserialize)]
+ #[serde(rename_all = "PascalCase")]
+ struct Module {
+ path: String,
+ version: Option<String>,
+ dir: Option<PathBuf>,
+ #[serde(default)]
+ main: bool,
+ }
+ serde_json::Deserializer::from_str(text)
+ .into_iter::<Module>()
+ .map_while(Result::ok)
+ .filter(|m| !m.main)
+ .filter_map(|m| {
+ let name = match &m.version {
+ Some(v) => format!("{}@{v}", m.path),
+ None => m.path.clone(),
+ };
+ Some((name, m.dir?))
+ })
+ .collect()
+}
diff --git a/crates/ide-sdk/src/tests.rs b/crates/ide-sdk/src/tests.rs
index 0d74f038e..86088a935 100644
--- a/crates/ide-sdk/src/tests.rs
+++ b/crates/ide-sdk/src/tests.rs
@@ -47,6 +47,7 @@ fn run(kind: &str, command: &str, args: &[&str]) -> RunConfig {
is_test: false,
debug_adapter: None,
allow_parallel: false,
+ extras: Default::default(),
}
}
@@ -290,3 +291,173 @@ fn custom_tool_path_replaces_the_command() {
configure_server(&mut cfg, tmp.path(), tmp.path(), &s);
assert_eq!(cfg.command, "zls");
}
+
+#[test]
+fn python_library_paths_are_parsed_and_deduplicated() {
+ let tmp = tempfile::tempdir().unwrap();
+ let stdlib = tmp.path().join("lib/python3.12");
+ let site = stdlib.join("site-packages");
+ std::fs::create_dir_all(&site).unwrap();
+ let json = serde_json::to_string(&[Some(&stdlib), Some(&stdlib), Some(&site), None]).unwrap();
+ let paths = crate::libraries::parse_python_paths(&format!("warning: something\n{json}"));
+ assert_eq!(paths.len(), 3);
+ let roots = crate::libraries::library_roots([paths, vec![tmp.path().join("gone")]].concat());
+ assert_eq!(roots.iter().map(|r| r.name.as_str()).collect::<Vec<_>>(), ["python3.12", "site-packages"]);
+ assert!(crate::libraries::parse_python_paths("not json").is_empty());
+}
+
+#[test]
+fn no_libraries_without_an_interpreter() {
+ let tmp = tempfile::tempdir().unwrap();
+ assert!(crate::libraries::project_libraries(tmp.path(), &Settings::default(), &[]).is_empty());
+}
+
+#[test]
+fn node_libraries_list_direct_dependencies_and_core_typings() {
+ let tmp = tempfile::tempdir().unwrap();
+ let root = tmp.path();
+ std::fs::write(
+ root.join("package.json"),
+ r#"{"dependencies":{"react":"^18","@scope/ui":"1"},"devDependencies":{"vitest":"2","react":"^18"}}"#,
+ )
+ .unwrap();
+ for dir in ["react", "@scope/ui", "@types/node", "transitive"] {
+ std::fs::create_dir_all(root.join("node_modules").join(dir)).unwrap();
+ }
+ let groups = crate::libraries::node_libraries(root, None);
+ let summary: Vec<(&str, &str, Vec<&str>)> = groups
+ .iter()
+ .map(|g| (g.name.as_str(), g.kind.as_str(), g.roots.iter().map(|r| r.name.as_str()).collect()))
+ .collect();
+ assert_eq!(
+ summary,
+ [
+ ("Node.js Core", "nodeCore", vec!["@types/node"]),
+ ("node_modules", "nodeModules", vec!["@scope/ui", "react"])
+ ]
+ );
+ assert_eq!(crate::libraries::package_dependencies("{"), Vec::<String>::new());
+}
+
+#[test]
+fn cargo_metadata_lists_registry_packages_only() {
+ let tmp = tempfile::tempdir().unwrap();
+ let serde = tmp.path().join("registry/src/index/serde-1.0.200");
+ let json = serde_json::json!({ "packages": [
+ { "name": "app", "version": "0.1.0", "source": null, "manifest_path": tmp.path().join("Cargo.toml") },
+ { "name": "serde", "version": "1.0.200", "source": "registry+https://github.com/rust-lang/crates.io-index",
+ "manifest_path": serde.join("Cargo.toml") },
+ ]});
+ assert_eq!(crate::libraries::parse_cargo_metadata(&json.to_string()), [("serde 1.0.200".to_owned(), serde)]);
+ assert!(crate::libraries::parse_cargo_metadata("error: no Cargo.toml").is_empty());
+}
+
+#[test]
+fn go_modules_skip_the_main_module_and_missing_downloads() {
+ let out = r#"{"Path":"example.com/app","Main":true,"Dir":"/p"}
+{"Path":"golang.org/x/text","Version":"v0.14.0","Dir":"/gopath/pkg/mod/golang.org/x/[email protected]"}
+{"Path":"example.com/missing","Version":"v1.0.0","Error":{"Err":"module lookup disabled"}}"#;
+ assert_eq!(
+ crate::libraries::parse_go_modules(out),
+ [(
+ "golang.org/x/[email protected]".to_owned(),
+ std::path::PathBuf::from("/gopath/pkg/mod/golang.org/x/[email protected]")
+ )]
+ );
+}
+
+#[test]
+fn jdk_library_is_the_jdk_home() {
+ let tmp = tempfile::tempdir().unwrap();
+ let home = tmp.path().join("temurin-21.jdk/Contents/Home");
+ std::fs::create_dir_all(&home).unwrap();
+ assert_eq!(crate::libraries::jdk_name(&home).as_deref(), Some("temurin-21"));
+ assert_eq!(crate::libraries::jdk_name(&tmp.path().join("jdk-17")).as_deref(), Some("jdk-17"));
+ let group = crate::libraries::jdk_library(&crate::java::Jdk { major: 21, home: home.clone() }).unwrap();
+ assert_eq!((group.name.as_str(), group.kind.as_str()), ("temurin-21", "jdk"));
+ assert_eq!(group.roots[0].path, ide_core::IpcPath::from(home.clone()));
+ assert_eq!(group.roots.len(), 1, "no sources archive");
+
+ std::fs::create_dir_all(home.join("lib")).unwrap();
+ std::fs::write(home.join("lib/src.zip"), "").unwrap();
+ let group = crate::libraries::jdk_library(&crate::java::Jdk { major: 21, home: home.clone() }).unwrap();
+ assert_eq!(group.roots[1].name, "src.zip");
+ assert_eq!(group.roots[1].path, ide_core::IpcPath::from(ide_vfs::archive_root(&home.join("lib/src.zip"))));
+}
+
+#[test]
+fn build_dependencies_resolve_to_local_jars() {
+ use crate::libraries::{BuildDependency, dependency_libraries};
+ let tmp = tempfile::tempdir().unwrap();
+ let (m2, gradle) = (tmp.path().join("m2"), tmp.path().join("gradle"));
+ let touch = |p: std::path::PathBuf| {
+ std::fs::create_dir_all(p.parent().unwrap()).unwrap();
+ std::fs::write(&p, "").unwrap();
+ p
+ };
+ touch(m2.join("com/google/guava/guava/33.0/guava-33.0.jar"));
+ let guava_src = touch(m2.join("com/google/guava/guava/33.0/guava-33.0-sources.jar"));
+ let junit = touch(m2.join("junit/junit/4.13/junit-4.13.jar"));
+ let files = gradle.join("caches/modules-2/files-2.1/org.slf4j/slf4j-api/2.0.9");
+ touch(files.join("a1b2/slf4j-api-2.0.9.jar"));
+ let slf4j_src = touch(files.join("c3d4/slf4j-api-2.0.9-sources.jar"));
+ let dep = |gradle: bool, g: &str, a: &str, v: &str| BuildDependency {
+ gradle,
+ group: g.into(),
+ artifact: a.into(),
+ version: v.into(),
+ };
+ let deps = [
+ dep(false, "junit", "junit", "4.13"),
+ dep(false, "com.google.guava", "guava", "33.0"),
+ dep(false, "com.google.guava", "guava", "33.0"),
+ dep(true, "org.slf4j", "slf4j-api", "2.0.9"),
+ dep(false, "missing", "nope", "1.0"),
+ dep(false, "..", "evil", "1"),
+ ];
+ let groups = dependency_libraries(&deps, Some(&m2), Some(&gradle));
+ let shown: Vec<(&str, &str, &str)> =
+ groups.iter().map(|g| (g.name.as_str(), g.kind.as_str(), g.roots[0].name.as_str())).collect();
+ assert_eq!(
+ shown,
+ [
+ ("Maven: com.google.guava:guava:33.0", "maven", "guava-33.0-sources.jar"),
+ ("Maven: junit:junit:4.13", "maven", "junit-4.13.jar"),
+ ("Gradle: org.slf4j:slf4j-api:2.0.9", "gradle", "slf4j-api-2.0.9-sources.jar"),
+ ]
+ );
+ assert_eq!(groups[0].roots[0].path, ide_core::IpcPath::from(ide_vfs::archive_root(&guava_src)));
+ assert_eq!(groups[1].roots[0].path, ide_core::IpcPath::from(ide_vfs::archive_root(&junit)));
+ assert_eq!(groups[2].roots[0].path, ide_core::IpcPath::from(ide_vfs::archive_root(&slf4j_src)));
+ // A Gradle build also finds jars installed in the Maven local repository (`mavenLocal()`).
+ let groups = dependency_libraries(&[dep(true, "junit", "junit", "4.13")], Some(&m2), Some(&gradle));
+ assert_eq!(groups[0].name, "Gradle: junit:junit:4.13");
+}
+
+#[test]
+fn library_detection_is_cached_until_a_manifest_changes() {
+ let tmp = tempfile::tempdir().unwrap();
+ let manifest = tmp.path().join("package.json");
+ std::fs::write(&manifest, "{}").unwrap();
+ let runs = std::cell::Cell::new(0);
+ let detect = || {
+ runs.set(runs.get() + 1);
+ Vec::new()
+ };
+ let files = [manifest.clone()];
+ crate::libraries::cached(tmp.path(), "test", "a".into(), &files, detect);
+ crate::libraries::cached(tmp.path(), "test", "a".into(), &files, detect);
+ assert_eq!(runs.get(), 1);
+ std::fs::write(&manifest, r#"{"dependencies":{}}"#).unwrap();
+ crate::libraries::cached(tmp.path(), "test", "a".into(), &files, detect);
+ assert_eq!(runs.get(), 2);
+ crate::libraries::cached(tmp.path(), "test", "b".into(), &files, detect);
+ assert_eq!(runs.get(), 3);
+}
+
+#[test]
+fn no_ecosystem_libraries_without_manifests() {
+ let tmp = tempfile::tempdir().unwrap();
+ std::fs::create_dir_all(tmp.path().join("node_modules/react")).unwrap();
+ assert!(crate::libraries::project_libraries(tmp.path(), &Settings::default(), &[]).is_empty());
+}
diff --git a/crates/ide-search/Cargo.toml b/crates/ide-search/Cargo.toml
index fa4d17fe0..fe41801c4 100644
--- a/crates/ide-search/Cargo.toml
+++ b/crates/ide-search/Cargo.toml
@@ -7,6 +7,7 @@ license.workspace = true
[dependencies]
ide-core.workspace = true
+ide-vfs.workspace = true
serde.workspace = true
specta.workspace = true
grep-searcher.workspace = true
diff --git a/crates/ide-search/src/engine.rs b/crates/ide-search/src/engine.rs
index eeca99882..802595b03 100644
--- a/crates/ide-search/src/engine.rs
+++ b/crates/ide-search/src/engine.rs
@@ -3,6 +3,7 @@
use crate::iter::for_each_match;
use crate::line::line_match;
use crate::mask::FileMask;
+use crate::pattern::ScopePattern;
use crate::query::{Compiled, line_terminator};
use crate::{
FileMatches, LineMatch, LiteralKind, LiteralRange, Literals, Overlay, PathFilter, SearchContext, SearchScope,
@@ -27,6 +28,7 @@ pub(crate) struct Request<'a> {
pub scope: &'a SearchScope,
pub compiled: Compiled,
pub mask: FileMask,
+ pub pattern: Option<ScopePattern>,
pub filter: Option<PathFilter<'a>>,
pub context: SearchContext,
pub literals: Option<Literals<'a>>,
@@ -90,6 +92,7 @@ impl Control<'_> {
struct Ctx<'a> {
root: &'a Path,
mask: &'a FileMask,
+ pattern: Option<&'a ScopePattern>,
filter: Option<PathFilter<'a>>,
context: SearchContext,
literals: Option<Literals<'a>>,
@@ -104,6 +107,7 @@ pub(crate) fn run(req: Request<'_>) -> IdeResult<SearchSummary> {
let ctx = Ctx {
root: req.root,
mask: &req.mask,
+ pattern: req.pattern.as_ref(),
filter: req.filter,
context: req.context,
literals: if req.context == SearchContext::Any { None } else { req.literals },
@@ -170,7 +174,8 @@ pub(crate) fn run(req: Request<'_>) -> IdeResult<SearchSummary> {
return WalkState::Continue;
}
};
- if entry.file_type().is_some_and(|t| t.is_file()) {
+ // Archives (jar, zip) are browsed, not searched (IDEA skips them too).
+ if entry.file_type().is_some_and(|t| t.is_file()) && !ide_vfs::is_archive_file(entry.path()) {
ctx.search_file(entry.path(), &matcher, &mut searcher);
}
if ctx.ctl.stopped() { WalkState::Quit } else { WalkState::Continue }
@@ -199,7 +204,7 @@ pub(crate) fn roots(root: &Path, scope: &SearchScope) -> IdeResult<Vec<PathBuf>>
}
};
Ok(match scope {
- SearchScope::Project | SearchScope::FileSet { .. } => vec![dir(Path::new(""))?],
+ SearchScope::Project | SearchScope::FileSet { .. } | SearchScope::Pattern { .. } => vec![dir(Path::new(""))?],
SearchScope::Directory { path } => vec![dir(path)?],
SearchScope::Files { paths } => {
let mut out: Vec<PathBuf> = Vec::with_capacity(paths.len());
@@ -231,7 +236,10 @@ pub(crate) fn rel_path(root: &Path, path: &Path) -> String {
impl Ctx<'_> {
fn search_file(&self, path: &Path, matcher: &RegexMatcher, searcher: &mut Searcher) {
let rel = rel_path(self.root, path);
- if !self.mask.matches(&rel) || self.filter.is_some_and(|keep| !keep(&rel)) {
+ if !self.mask.matches(&rel)
+ || self.pattern.is_some_and(|p| !p.matches(&rel))
+ || self.filter.is_some_and(|keep| !keep(&rel))
+ {
return;
}
// The search context needs the whole text to find comments and string literals.
diff --git a/crates/ide-search/src/files.rs b/crates/ide-search/src/files.rs
index f9f5b5e7c..ba85acfc4 100644
--- a/crates/ide-search/src/files.rs
+++ b/crates/ide-search/src/files.rs
@@ -27,7 +27,10 @@ pub fn scope_files(
filter: Option<PathFilter<'_>>,
cancel: &CancellationToken,
) -> IdeResult<Vec<ScopeFile>> {
- let keep = |rel: &str| mask.matches(rel) && filter.is_none_or(|f| f(rel));
+ let pattern = scope.pattern()?;
+ let keep = |rel: &str| {
+ mask.matches(rel) && pattern.as_ref().is_none_or(|p| p.matches(rel)) && filter.is_none_or(|f| f(rel))
+ };
let found = Mutex::new(Vec::new());
let mut on_disk = Vec::new();
for path in roots(root, scope)? {
@@ -63,7 +66,7 @@ pub fn scope_files(
return WalkState::Quit;
}
let Ok(entry) = entry else { return WalkState::Continue };
- if entry.file_type().is_some_and(|t| t.is_file()) {
+ if entry.file_type().is_some_and(|t| t.is_file()) && !ide_vfs::is_archive_file(entry.path()) {
let rel = rel_path(root, entry.path());
if keep(&rel) {
found
@@ -139,4 +142,15 @@ mod tests {
vec!["src/a.rs", "src/new.rs"]
);
}
+
+ #[test]
+ fn pattern_scope() {
+ let dir = tree();
+ let none = FileMask::new(&[], &[]).unwrap();
+ let cancel = CancellationToken::new();
+ let scope = SearchScope::Pattern { pattern: "file:src//*.rs&&!file:src/sub//*".into() };
+ assert_eq!(rels(&scope_files(dir.path(), &scope, &none, None, &cancel).unwrap()), vec!["src/a.rs"]);
+ let bad = SearchScope::Pattern { pattern: "(".into() };
+ assert!(scope_files(dir.path(), &bad, &none, None, &cancel).is_err());
+ }
}
diff --git a/crates/ide-search/src/lib.rs b/crates/ide-search/src/lib.rs
index 0e8b8fcfc..8147272f3 100644
--- a/crates/ide-search/src/lib.rs
+++ b/crates/ide-search/src/lib.rs
@@ -11,11 +11,13 @@ mod files;
mod iter;
mod line;
mod mask;
+mod pattern;
mod query;
mod replace;
pub use files::{ScopeFile, scope_files};
pub use mask::FileMask;
+pub use pattern::ScopePattern;
pub use replace::{
ReplaceEvent, ReplaceHost, ReplacePreview, ReplaceSummary, ReplaceTarget, apply_edits, preserve_case, preview,
replace_files, replacement_edits,
@@ -114,6 +116,21 @@ pub enum SearchScope {
FileSet {
set: ProjectFileSet,
},
+ /// A custom scope: the project's files matching a [`ScopePattern`]
+ /// (`file:src//*.ts&&!file:*test*`).
+ Pattern {
+ pattern: String,
+ },
+}
+
+impl SearchScope {
+ /// The file pattern of a [`SearchScope::Pattern`].
+ pub fn pattern(&self) -> IdeResult<Option<ScopePattern>> {
+ match self {
+ Self::Pattern { pattern } => ScopePattern::parse(pattern).map(Some),
+ _ => Ok(None),
+ }
+ }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
@@ -211,6 +228,7 @@ pub fn search_in_context(
scope: &query.scope,
compiled: query::compile(query)?,
mask,
+ pattern: query.scope.pattern()?,
filter,
context: query.context,
literals,
@@ -225,6 +243,7 @@ pub fn search_in_context(
/// invalid regex while the user types.
pub fn validate_query(query: &SearchQuery) -> IdeResult<()> {
FileMask::new(&query.include, &query.exclude)?;
+ query.scope.pattern()?;
if !query.pattern.is_empty() {
query::compile(query)?;
}
diff --git a/crates/ide-search/src/pattern.rs b/crates/ide-search/src/pattern.rs
new file mode 100644
index 000000000..335aeaf6e
--- /dev/null
+++ b/crates/ide-search/src/pattern.rs
@@ -0,0 +1,207 @@
+//! IDEA-style scope patterns for custom (named) scopes:
+//! `file:src//*.ts&&!file:*test*`, `file:*.rs||file:docs//*`, `!(file:gen//*)`.
+//!
+//! A term is `file:<glob>` (the `file:` prefix and a `[module]` qualifier are
+//! optional); `//` means "any depth" (`src//*` = `src/**/*`), a trailing `/`
+//! means everything below. Globs without a `/` match the file name, others the
+//! project-relative path, like [`crate::FileMask`]. Terms combine with `!`,
+//! `&&`, `||` (in that precedence) and parentheses.
+
+use globset::{GlobBuilder, GlobMatcher};
+use ide_core::{IdeError, IdeResult};
+
+#[derive(Debug)]
+pub struct ScopePattern(Node);
+
+#[derive(Debug)]
+enum Node {
+ Glob { glob: GlobMatcher, by_name: bool },
+ Not(Box<Node>),
+ And(Vec<Node>),
+ Or(Vec<Node>),
+}
+
+impl ScopePattern {
+ pub fn parse(source: &str) -> IdeResult<Self> {
+ let mut p = Parser { s: source, pos: 0 };
+ p.skip_ws();
+ if p.at_end() {
+ return Err(IdeError::invalid("Empty scope pattern"));
+ }
+ let node = p.or()?;
+ p.skip_ws();
+ if !p.at_end() {
+ return Err(p.error("Unexpected input"));
+ }
+ Ok(Self(node))
+ }
+
+ /// `rel_path` is project-relative and `/`-separated.
+ pub fn matches(&self, rel_path: &str) -> bool {
+ self.0.matches(rel_path, rel_path.rsplit('/').next().unwrap_or(rel_path))
+ }
+}
+
+impl Node {
+ fn matches(&self, rel: &str, name: &str) -> bool {
+ match self {
+ Self::Glob { glob, by_name } => glob.is_match(if *by_name { name } else { rel }),
+ Self::Not(n) => !n.matches(rel, name),
+ Self::And(all) => all.iter().all(|n| n.matches(rel, name)),
+ Self::Or(any) => any.iter().any(|n| n.matches(rel, name)),
+ }
+ }
+}
+
+struct Parser<'a> {
+ s: &'a str,
+ pos: usize,
+}
+
+impl Parser<'_> {
+ fn rest(&self) -> &str {
+ &self.s[self.pos..]
+ }
+
+ fn at_end(&self) -> bool {
+ self.pos >= self.s.len()
+ }
+
+ fn skip_ws(&mut self) {
+ let rest = self.rest();
+ self.pos += rest.len() - rest.trim_start().len();
+ }
+
+ fn eat(&mut self, token: &str) -> bool {
+ self.skip_ws();
+ if self.rest().starts_with(token) {
+ self.pos += token.len();
+ true
+ } else {
+ false
+ }
+ }
+
+ fn error(&self, what: &str) -> IdeError {
+ IdeError::invalid(format!("{what} at column {} of the scope pattern", self.s[..self.pos].chars().count() + 1))
+ }
+
+ fn or(&mut self) -> IdeResult<Node> {
+ let mut items = vec![self.and()?];
+ while self.eat("||") {
+ items.push(self.and()?);
+ }
+ Ok(if items.len() == 1 { items.remove(0) } else { Node::Or(items) })
+ }
+
+ fn and(&mut self) -> IdeResult<Node> {
+ let mut items = vec![self.unary()?];
+ while self.eat("&&") {
+ items.push(self.unary()?);
+ }
+ Ok(if items.len() == 1 { items.remove(0) } else { Node::And(items) })
+ }
+
+ fn unary(&mut self) -> IdeResult<Node> {
+ if self.eat("!") {
+ return Ok(Node::Not(Box::new(self.unary()?)));
+ }
+ if self.eat("(") {
+ let node = self.or()?;
+ if !self.eat(")") {
+ return Err(self.error("Missing `)`"));
+ }
+ return Ok(node);
+ }
+ self.term()
+ }
+
+ fn term(&mut self) -> IdeResult<Node> {
+ self.skip_ws();
+ let rest = self.rest();
+ let end = ["&&", "||", ")"].iter().filter_map(|t| rest.find(t)).min().unwrap_or(rest.len());
+ let raw = rest[..end].trim();
+ if raw.is_empty() {
+ return Err(self.error("Expected a file pattern"));
+ }
+ let glob = strip_prefix(raw);
+ if glob.is_empty() {
+ return Err(self.error("Expected a file pattern"));
+ }
+ let node = glob_node(glob)?;
+ self.pos += end;
+ Ok(node)
+ }
+}
+
+/// `file:x`, `file[module]:x` → `x`.
+fn strip_prefix(term: &str) -> &str {
+ let Some(rest) = term.strip_prefix("file") else { return term };
+ let rest = match rest.strip_prefix('[') {
+ Some(r) => match r.find(']') {
+ Some(i) => &r[i + 1..],
+ None => return term,
+ },
+ None => rest,
+ };
+ rest.strip_prefix(':').map_or(term, str::trim)
+}
+
+fn glob_node(pattern: &str) -> IdeResult<Node> {
+ let mut glob = pattern.trim_start_matches("./").replace("//", "/**/");
+ if glob.ends_with('/') {
+ glob.push_str("**");
+ }
+ let by_name = !glob.contains('/');
+ let glob = if by_name { glob } else { glob.trim_start_matches('/').to_owned() };
+ let matcher = GlobBuilder::new(&glob)
+ .literal_separator(true)
+ .backslash_escape(true)
+ .case_insensitive(cfg!(any(target_os = "macos", target_os = "windows")))
+ .build()
+ .map_err(|e| IdeError::invalid(format!("Invalid file pattern `{pattern}`: {}", e.kind())))?
+ .compile_matcher();
+ Ok(Node::Glob { glob: matcher, by_name })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn p(s: &str) -> ScopePattern {
+ ScopePattern::parse(s).unwrap()
+ }
+
+ #[test]
+ fn idea_recursive_directory_globs() {
+ let s = p("file:src//*.ts");
+ assert!(s.matches("src/a.ts"));
+ assert!(s.matches("src/x/y/a.ts"));
+ assert!(!s.matches("lib/a.ts"));
+ assert!(!s.matches("src/a.rs"));
+ assert!(p("src/").matches("src/deep/a.rs"));
+ assert!(!p("file:src/*").matches("src/deep/a.rs"));
+ }
+
+ #[test]
+ fn names_operators_and_grouping() {
+ let s = p("file:src//*&&!file:*test*");
+ assert!(s.matches("src/main.rs"));
+ assert!(!s.matches("src/main_test.rs"));
+ let s = p("*.md || file[app]:docs//*");
+ assert!(s.matches("README.md"));
+ assert!(s.matches("docs/x/y.txt"));
+ assert!(!s.matches("src/a.rs"));
+ let s = p("!(file:gen//* || *.lock) && *.*");
+ assert!(s.matches("src/a.rs"));
+ assert!(!s.matches("gen/a.rs"));
+ assert!(!s.matches("Cargo.lock"));
+ }
+
+ #[test]
+ fn errors() {
+ for bad in ["", " ", "file:", "a &&", "(a", "a)", "file:a["] {
+ assert!(ScopePattern::parse(bad).is_err(), "{bad:?}");
+ }
+ }
+}
diff --git a/crates/ide-search/tests/search.rs b/crates/ide-search/tests/search.rs
index c37cab144..412fe9b11 100644
--- a/crates/ide-search/tests/search.rs
+++ b/crates/ide-search/tests/search.rs
@@ -410,6 +410,20 @@ fn directory_scope() {
assert_eq!(err.kind, ErrorKind::NotFound);
}
+#[test]
+fn pattern_scope_intersects_the_file_mask() {
+ let p = mask_project();
+ let scope = SearchScope::Pattern { pattern: "file:src//*&&!file:*Test*".into() };
+ let q = SearchQuery { scope: scope.clone(), ..query("hit") };
+ let (views, _) = run(p.path(), &q);
+ assert_eq!(paths(&views), ["src/Main.kt", "src/Util.java", "src/web/app.ts"]);
+ let q = SearchQuery { scope, include: vec!["*.ts".into()], ..query("hit") };
+ let (views, _) = run(p.path(), &q);
+ assert_eq!(paths(&views), ["src/web/app.ts"]);
+ let bad = SearchQuery { scope: SearchScope::Pattern { pattern: "a &&".into() }, ..query("hit") };
+ assert_eq!(ide_search::validate_query(&bad).unwrap_err().kind, ErrorKind::InvalidInput);
+}
+
#[test]
fn files_scope_searches_ignored_and_unsaved_files() {
let p = project(&[(".gitignore", b"*.log\n"), ("a.log", b"hit\n"), ("b.txt", b"hit\n"), ("c.txt", b"hit\n")]);
@@ -621,3 +635,11 @@ fn search_context_filters_comments_and_strings() {
vec![s("a.rs", 0, &[(0, 3)]), s("a.rs", 1, &[(0, 3)]), s("b.txt", 0, &[(0, 3), (7, 10)])]
);
}
+
+#[test]
+fn archives_are_skipped() {
+ // A stored (uncompressed) zip entry would otherwise match before the first NUL byte.
+ let p = project(&[("lib/needle.jar", b"needle in a jar"), ("docs.zip", b"needle"), ("src/a.txt", b"needle\n")]);
+ let (views, _) = run(p.path(), &query("needle"));
+ assert_eq!(paths(&views), ["src/a.txt"]);
+}
diff --git a/crates/ide-spell/Cargo.toml b/crates/ide-spell/Cargo.toml
new file mode 100644
index 000000000..119493098
--- /dev/null
+++ b/crates/ide-spell/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "ide-spell"
+description = "Spell checking (Proofreading › Typo): word extraction from comments, strings and declared names, Hunspell en_US dictionary, user dictionaries"
+version.workspace = true
+edition.workspace = true
+license.workspace = true
+
+[dependencies]
+ide-core.workspace = true
+parking_lot.workspace = true
+tracing.workspace = true
+# Pure-Rust Hunspell-compatible checker (MPL-2.0).
+spellbook = "0.4"
+serde.workspace = true
+specta.workspace = true
diff --git a/crates/ide-spell/src/dict/LICENSE-en_US b/crates/ide-spell/src/dict/LICENSE-en_US
new file mode 100644
index 000000000..6b5b49088
--- /dev/null
+++ b/crates/ide-spell/src/dict/LICENSE-en_US
@@ -0,0 +1,347 @@
+en_US Hunspell Dictionary
+Version 2020.12.07
+Mon Dec 7 20:14:35 2020 -0500 [5ef55f9]
+http://wordlist.sourceforge.net
+
+README file for English Hunspell dictionaries derived from SCOWL.
+
+These dictionaries are created using the speller/make-hunspell-dict
+script in SCOWL.
+
+The following dictionaries are available:
+
+ en_US (American)
+ en_CA (Canadian)
+ en_GB-ise (British with "ise" spelling)
+ en_GB-ize (British with "ize" spelling)
+ en_AU (Australian)
+
+ en_US-large
+ en_CA-large
+ en_GB-large (with both "ise" and "ize" spelling)
+ en_AU-large
+
+The normal (non-large) dictionaries correspond to SCOWL size 60 and,
+to encourage consistent spelling, generally only include one spelling
+variant for a word. The large dictionaries correspond to SCOWL size
+70 and may include multiple spelling for a word when both variants are
+considered almost equal. The larger dictionaries however (1) have not
+been as carefully checked for errors as the normal dictionaries and
+thus may contain misspelled or invalid words; and (2) contain
+uncommon, yet valid, words that might cause problems as they are
+likely to be misspellings of more common words (for example, "ort" and
+"calender").
+
+To get an idea of the difference in size, here are 25 random words
+only found in the large dictionary for American English:
+
+ Bermejo Freyr's Guenevere Hatshepsut Nottinghamshire arrestment
+ crassitudes crural dogwatches errorless fetial flaxseeds godroon
+ incretion jalapeño's kelpie kishkes neuroglias pietisms pullulation
+ stemwinder stenoses syce thalassic zees
+
+The en_US, en_CA and en_AU are the official dictionaries for Hunspell.
+The en_GB and large dictionaries are made available on an experimental
+basis. If you find them useful please send me a quick email at
+
+If none of these dictionaries suite you (for example, maybe you want
+the normal dictionary that also includes common variants) additional
+dictionaries can be generated at http://app.aspell.net/create or by
+modifying speller/make-hunspell-dict in SCOWL. Please do let me know
+if you end up publishing a customized dictionary.
+
+If a word is not found in the dictionary or a word is there you think
+shouldn't be, you can lookup the word up at http://app.aspell.net/lookup
+to help determine why that is.
+
+General comments on these list can be sent directly to me at
[email protected] or to the wordlist-devel mailing lists
+(https://lists.sourceforge.net/lists/listinfo/wordlist-devel). If you
+have specific issues with any of these dictionaries please file a bug
+report at https://github.com/kevina/wordlist/issues.
+
+IMPORTANT CHANGES INTRODUCED In 2016.11.20:
+
+New Australian dictionaries thanks to the work of Benjamin Titze
+
+IMPORTANT CHANGES INTRODUCED IN 2016.04.24:
+
+The dictionaries are now in UTF-8 format instead of ISO-8859-1. This
+was required to handle smart quotes correctly.
+
+IMPORTANT CHANGES INTRODUCED IN 2016.01.19:
+
+"SET UTF8" was changes to "SET UTF-8" in the affix file as some
+versions of Hunspell do not recognize "UTF8".
+
+ADDITIONAL NOTES:
+
+The NOSUGGEST flag was added to certain taboo words. While I made an
+honest attempt to flag the strongest taboo words with the NOSUGGEST
+flag, I MAKE NO GUARANTEE THAT I FLAGGED EVERY POSSIBLE TABOO WORD.
+The list was originally derived from Németh László, however I removed
+some words which, while being considered taboo by some dictionaries,
+are not really considered swear words in today's society.
+
+COPYRIGHT, SOURCES, and CREDITS:
+
+The English dictionaries come directly from SCOWL
+and is thus under the same copyright of SCOWL. The affix file is
+a heavily modified version of the original english.aff file which was
+released as part of Geoff Kuenning's Ispell and as such is covered by
+his BSD license. Part of SCOWL is also based on Ispell thus the
+Ispell copyright is included with the SCOWL copyright.
+
+The collective work is Copyright 2000-2018 by Kevin Atkinson as well
+as any of the copyrights mentioned below:
+
+ Copyright 2000-2018 by Kevin Atkinson
+
+ Permission to use, copy, modify, distribute and sell these word
+ lists, the associated scripts, the output created from the scripts,
+ and its documentation for any purpose is hereby granted without fee,
+ provided that the above copyright notice appears in all copies and
+ that both that copyright notice and this permission notice appear in
+ supporting documentation. Kevin Atkinson makes no representations
+ about the suitability of this array for any purpose. It is provided
+ "as is" without express or implied warranty.
+
+Alan Beale <[email protected]> also deserves special credit as he has,
+in addition to providing the 12Dicts package and being a major
+contributor to the ENABLE word list, given me an incredible amount of
+feedback and created a number of special lists (those found in the
+Supplement) in order to help improve the overall quality of SCOWL.
+
+The 10 level includes the 1000 most common English words (according to
+the Moby (TM) Words II [MWords] package), a subset of the 1000 most
+common words on the Internet (again, according to Moby Words II), and
+frequently class 16 from Brian Kelk's "UK English Wordlist
+with Frequency Classification".
+
+The MWords package was explicitly placed in the public domain:
+
+ The Moby lexicon project is complete and has
+ been place into the public domain. Use, sell,
+ rework, excerpt and use in any way on any platform.
+
+ Placing this material on internal or public servers is
+ also encouraged. The compiler is not aware of any
+ export restrictions so freely distribute world-wide.
+
+ You can verify the public domain status by contacting
+
+ Grady Ward
+ 3449 Martha Ct.
+ Arcata, CA 95521-4884
+
+
+The "UK English Wordlist With Frequency Classification" is also in the
+Public Domain:
+
+ Date: Sat, 08 Jul 2000 20:27:21 +0100
+ From: Brian Kelk <[email protected]>
+
+ > I was wondering what the copyright status of your "UK English
+ > Wordlist With Frequency Classification" word list as it seems to
+ > be lacking any copyright notice.
+
+ There were many many sources in total, but any text marked
+ "copyright" was avoided. Locally-written documentation was one
+ source. An earlier version of the list resided in a filespace called
+ PUBLIC on the University mainframe, because it was considered public
+ domain.
+
+ Date: Tue, 11 Jul 2000 19:31:34 +0100
+
+ > So are you saying your word list is also in the public domain?
+
+ That is the intention.
+
+The 20 level includes frequency classes 7-15 from Brian's word list.
+
+The 35 level includes frequency classes 2-6 and words appearing in at
+least 11 of 12 dictionaries as indicated in the 12Dicts package. All
+words from the 12Dicts package have had likely inflections added via
+my inflection database.
+
+The 12Dicts package and Supplement is in the Public Domain.
+
+The WordNet database, which was used in the creation of the
+Inflections database, is under the following copyright:
+
+ This software and database is being provided to you, the LICENSEE,
+ by Princeton University under the following license. By obtaining,
+ using and/or copying this software and database, you agree that you
+ have read, understood, and will comply with these terms and
+ conditions.:
+
+ Permission to use, copy, modify and distribute this software and
+ database and its documentation for any purpose and without fee or
+ royalty is hereby granted, provided that you agree to comply with
+ the following copyright notice and statements, including the
+ disclaimer, and that the same appear on ALL copies of the software,
+ database and documentation, including modifications that you make
+ for internal use or for distribution.
+
+ WordNet 1.6 Copyright 1997 by Princeton University. All rights
+ reserved.
+
+ THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON
+ UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON
+ UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT-
+ ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE
+ LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY
+ THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+ The name of Princeton University or Princeton may not be used in
+ advertising or publicity pertaining to distribution of the software
+ and/or database. Title to copyright in this software, database and
+ any associated documentation shall at all times remain with
+ Princeton University and LICENSEE agrees to preserve same.
+
+The 40 level includes words from Alan's 3esl list found in version 4.0
+of his 12dicts package. Like his other stuff the 3esl list is also in the
+public domain.
+
+The 50 level includes Brian's frequency class 1, words appearing
+in at least 5 of 12 of the dictionaries as indicated in the 12Dicts
+package, and uppercase words in at least 4 of the previous 12
+dictionaries. A decent number of proper names is also included: The
+top 1000 male, female, and Last names from the 1990 Census report; a
+list of names sent to me by Alan Beale; and a few names that I added
+myself. Finally a small list of abbreviations not commonly found in
+other word lists is included.
+
+The name files form the Census report is a government document which I
+don't think can be copyrighted.
+
+The file special-jargon.50 uses common.lst and word.lst from the
+"Unofficial Jargon File Word Lists" which is derived from "The Jargon
+File". All of which is in the Public Domain. This file also contain
+a few extra UNIX terms which are found in the file "unix-terms" in the
+special/ directory.
+
+The 55 level includes words from Alan's 2of4brif list found in version
+4.0 of his 12dicts package. Like his other stuff the 2of4brif is also
+in the public domain.
+
+The 60 level includes all words appearing in at least 2 of the 12
+dictionaries as indicated by the 12Dicts package.
+
+The 70 level includes Brian's frequency class 0 and the 74,550 common
+dictionary words from the MWords package. The common dictionary words,
+like those from the 12Dicts package, have had all likely inflections
+added. The 70 level also included the 5desk list from version 4.0 of
+the 12Dics package which is in the public domain.
+
+The 80 level includes the ENABLE word list, all the lists in the
+ENABLE supplement package (except for ABLE), the "UK Advanced Cryptics
+Dictionary" (UKACD), the list of signature words from the YAWL package,
+and the 10,196 places list from the MWords package.
+
+The ENABLE package, mainted by M\Cooper <[email protected]>,
+is in the Public Domain:
+
+ The ENABLE master word list, WORD.LST, is herewith formally released
+ into the Public Domain. Anyone is free to use it or distribute it in
+ any manner they see fit. No fee or registration is required for its
+ use nor are "contributions" solicited (if you feel you absolutely
+ must contribute something for your own peace of mind, the authors of
+ the ENABLE list ask that you make a donation on their behalf to your
+ favorite charity). This word list is our gift to the Scrabble
+ community, as an alternate to "official" word lists. Game designers
+ may feel free to incorporate the WORD.LST into their games. Please
+ mention the source and credit us as originators of the list. Note
+ that if you, as a game designer, use the WORD.LST in your product,
+ you may still copyright and protect your product, but you may *not*
+ legally copyright or in any way restrict redistribution of the
+ WORD.LST portion of your product. This *may* under law restrict your
+ rights to restrict your users' rights, but that is only fair.
+
+UKACD, by J Ross Beresford <[email protected]>, is under the
+following copyright:
+
+ Copyright (c) J Ross Beresford 1993-1999. All Rights Reserved.
+
+ The following restriction is placed on the use of this publication:
+ if The UK Advanced Cryptics Dictionary is used in a software package
+ or redistributed in any form, the copyright notice must be
+ prominently displayed and the text of this document must be included
+ verbatim.
+
+ There are no other restrictions: I would like to see the list
+ distributed as widely as possible.
+
+The 95 level includes the 354,984 single words, 256,772 compound
+words, 4,946 female names and the 3,897 male names, and 21,986 names
+from the MWords package, ABLE.LST from the ENABLE Supplement, and some
+additional words found in my part-of-speech database that were not
+found anywhere else.
+
+Accent information was taken from UKACD.
+
+The VarCon package was used to create the American, British, Canadian,
+and Australian word list. It is under the following copyright:
+
+ Copyright 2000-2016 by Kevin Atkinson
+
+ Permission to use, copy, modify, distribute and sell this array, the
+ associated software, and its documentation for any purpose is hereby
+ granted without fee, provided that the above copyright notice appears
+ in all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation. Kevin Atkinson makes no
+ representations about the suitability of this array for any
+ purpose. It is provided "as is" without express or implied warranty.
+
+ Copyright 2016 by Benjamin Titze
+
+ Permission to use, copy, modify, distribute and sell this array, the
+ associated software, and its documentation for any purpose is hereby
+ granted without fee, provided that the above copyright notice appears
+ in all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation. Benjamin Titze makes no
+ representations about the suitability of this array for any
+ purpose. It is provided "as is" without express or implied warranty.
+
+ Since the original words lists come from the Ispell distribution:
+
+ Copyright 1993, Geoff Kuenning, Granada Hills, CA
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. All modifications to the source code must be clearly marked as
+ such. Binary redistributions based on modified source code
+ must be clearly marked as modified versions in the documentation
+ and/or other materials provided with the distribution.
+ (clause 4 removed with permission from Geoff Kuenning)
+ 5. The name of Geoff Kuenning may not be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+ THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+Build Date: Mon Dec 7 20:19:27 EST 2020
+Wordlist Command: mk-list --accents=strip en_US 60
diff --git a/crates/ide-spell/src/dict/en_US.aff b/crates/ide-spell/src/dict/en_US.aff
new file mode 100644
index 000000000..9e7cb1e2f
--- /dev/null
+++ b/crates/ide-spell/src/dict/en_US.aff
@@ -0,0 +1,205 @@
+SET UTF-8
+TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
+ICONV 1
+ICONV ’ '
+NOSUGGEST !
+
+# ordinal numbers
+COMPOUNDMIN 1
+# only in compounds: 1th, 2th, 3th
+ONLYINCOMPOUND c
+# compound rules:
+# 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.)
+# 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.)
+COMPOUNDRULE 2
+COMPOUNDRULE n*1t
+COMPOUNDRULE n*mp
+WORDCHARS 0123456789
+
+PFX A Y 1
+PFX A 0 re .
+
+PFX I Y 1
+PFX I 0 in .
+
+PFX U Y 1
+PFX U 0 un .
+
+PFX C Y 1
+PFX C 0 de .
+
+PFX E Y 1
+PFX E 0 dis .
+
+PFX F Y 1
+PFX F 0 con .
+
+PFX K Y 1
+PFX K 0 pro .
+
+SFX V N 2
+SFX V e ive e
+SFX V 0 ive [^e]
+
+SFX N Y 3
+SFX N e ion e
+SFX N y ication y
+SFX N 0 en [^ey]
+
+SFX X Y 3
+SFX X e ions e
+SFX X y ications y
+SFX X 0 ens [^ey]
+
+SFX H N 2
+SFX H y ieth y
+SFX H 0 th [^y]
+
+SFX Y Y 1
+SFX Y 0 ly .
+
+SFX G Y 2
+SFX G e ing e
+SFX G 0 ing [^e]
+
+SFX J Y 2
+SFX J e ings e
+SFX J 0 ings [^e]
+
+SFX D Y 4
+SFX D 0 d e
+SFX D y ied [^aeiou]y
+SFX D 0 ed [^ey]
+SFX D 0 ed [aeiou]y
+
+SFX T N 4
+SFX T 0 st e
+SFX T y iest [^aeiou]y
+SFX T 0 est [aeiou]y
+SFX T 0 est [^ey]
+
+SFX R Y 4
+SFX R 0 r e
+SFX R y ier [^aeiou]y
+SFX R 0 er [aeiou]y
+SFX R 0 er [^ey]
+
+SFX Z Y 4
+SFX Z 0 rs e
+SFX Z y iers [^aeiou]y
+SFX Z 0 ers [aeiou]y
+SFX Z 0 ers [^ey]
+
+SFX S Y 4
+SFX S y ies [^aeiou]y
+SFX S 0 s [aeiou]y
+SFX S 0 es [sxzh]
+SFX S 0 s [^sxzhy]
+
+SFX P Y 3
+SFX P y iness [^aeiou]y
+SFX P 0 ness [aeiou]y
+SFX P 0 ness [^y]
+
+SFX M Y 1
+SFX M 0 's .
+
+SFX B Y 3
+SFX B 0 able [^aeiou]
+SFX B 0 able ee
+SFX B e able [^aeiou]e
+
+SFX L Y 1
+SFX L 0 ment .
+
+REP 90
+REP a ei
+REP ei a
+REP a ey
+REP ey a
+REP ai ie
+REP ie ai
+REP alot a_lot
+REP are air
+REP are ear
+REP are eir
+REP air are
+REP air ere
+REP ere air
+REP ere ear
+REP ere eir
+REP ear are
+REP ear air
+REP ear ere
+REP eir are
+REP eir ere
+REP ch te
+REP te ch
+REP ch ti
+REP ti ch
+REP ch tu
+REP tu ch
+REP ch s
+REP s ch
+REP ch k
+REP k ch
+REP f ph
+REP ph f
+REP gh f
+REP f gh
+REP i igh
+REP igh i
+REP i uy
+REP uy i
+REP i ee
+REP ee i
+REP j di
+REP di j
+REP j gg
+REP gg j
+REP j ge
+REP ge j
+REP s ti
+REP ti s
+REP s ci
+REP ci s
+REP k cc
+REP cc k
+REP k qu
+REP qu k
+REP kw qu
+REP o eau
+REP eau o
+REP o ew
+REP ew o
+REP oo ew
+REP ew oo
+REP ew ui
+REP ui ew
+REP oo ui
+REP ui oo
+REP ew u
+REP u ew
+REP oo u
+REP u oo
+REP u oe
+REP oe u
+REP u ieu
+REP ieu u
+REP ue ew
+REP ew ue
+REP uff ough
+REP oo ieu
+REP ieu oo
+REP ier ear
+REP ear ier
+REP ear air
+REP air ear
+REP w qu
+REP qu w
+REP z ss
+REP ss z
+REP shun tion
+REP shun sion
+REP shun cion
+REP size cise
diff --git a/crates/ide-spell/src/dict/en_US.dic b/crates/ide-spell/src/dict/en_US.dic
new file mode 100644
index 000000000..b41fd203e
--- /dev/null
+++ b/crates/ide-spell/src/dict/en_US.dic
@@ -0,0 +1,49569 @@
+49568
+0/nm
+0th/pt
+1/n1
+1st/p
+1th/tc
+2/nm
+2nd/p
+2th/tc
+3/nm
+3rd/p
+3th/tc
+4/nm
+4th/pt
+5/nm
+5th/pt
+6/nm
+6th/pt
+7/nm
+7th/pt
+8/nm
+8th/pt
+9/nm
+9th/pt
+A/SM
+AA/M
+AAA
+AB/M
+ABA
+ABC/SM
+ABM/SM
+ABS
+AC/M
+ACLU/M
+ACT
+ACTH/M
+AD/M
+ADC
+ADD
+ADM
+ADP/M
+AF
+AFAIK
+AFB
+AFC/M
+AFDC
+AFN
+AFT
+AI/SM
+AIDS/M
+AK
+AL
+AM/M
+AMA
+AMD/M
+ANSI/S
+ANZUS/M
+AOL/M
+AP/M
+APB
+APC
+API
+APO
+APR
+AR
+ARC
+ASAP
+ASCII/SM
+ASL/M
+ASPCA
+ATM/M
+ATP/M
+ATV
+AV
+AVI
+AWACS/M
+AWOL/M
+AWS/M
+AZ/M
+AZT/M
+Aachen/M
+Aaliyah/M
+Aaron/M
+Abbas/M
+Abbasid/M
+Abbott/M
+Abby/M
+Abdul/M
+Abe/M
+Abel/M
+Abelard/M
+Abelson/M
+Aberdeen/M
+Abernathy/M
+Abidjan/M
+Abigail/M
+Abilene/M
+Abner/M
+Aborigine/MS
+Abraham/M
+Abram/MS
+Abrams/M
+Absalom/M
+Abuja/M
+Abyssinia/M
+Abyssinian/M
+Ac/M
+Acadia/M
+Acapulco/M
+Accenture/M
+Accra/M
+Acevedo/M
+Achaean/M
+Achebe/M
+Achernar/M
+Acheson/M
+Achilles/M
+Aconcagua/M
+Acosta/M
+Acropolis
+Acrux/M
+Actaeon/M
+Acton/M
+Acts/M
+Acuff/M
+Ada/SM
+Adam/SM
+Adams/M
+Adan/M
+Adana/M
+Adar/M
+Addams/M
+Adderley/M
+Addie/M
+Addison/M
+Adela/M
+Adelaide/M
+Adele/M
+Adeline/M
+Aden/M
+Adenauer/M
+Adhara/M
+Adidas/M
+Adirondack/SM
+Adirondacks/M
+Adkins/M
+Adler/M
+Adm
+Admiralty
+Adolf/M
+Adolfo/M
+Adolph/M
+Adonis/MS
+Adrenalin/MS
+Adrian/M
+Adriana/M
+Adriatic/M
+Adrienne/M
+Advent/MS
+Adventist/MS
+Advil/M
+Aegean/M
+Aelfric/M
+Aeneas/M
+Aeneid/M
+Aeolus/M
+Aeroflot/M
+Aeschylus/M
+Aesculapius/M
+Aesop/M
+Afghan/SM
+Afghani/M
+Afghanistan/M
+Afr
+Africa/M
+African/SM
+Afrikaans/M
+Afrikaner/SM
+Afro/SM
+Afrocentric
+Afrocentrism/M
+Ag/M
+Agamemnon/M
+Agana
+Agassi/M
+Agassiz/M
+Agatha/M
+Aggie/M
+Aglaia/M
+Agnes/M
+Agnew/M
+Agni/M
+Agra/M
+Agricola/M
+Agrippa/M
+Agrippina/M
+Aguadilla/M
+Aguascalientes
+Aguilar/M
+Aguinaldo/M
+Aguirre/M
+Agustin/M
+Ahab/M
+Ahmad/M
+Ahmadabad/M
+Ahmadinejad/M
+Ahmed/M
+Ahriman/M
+Aida/M
+Aiken/M
+Aileen/M
+Aimee/M
+Ainu/M
+Airedale/MS
+Aires/M
+Aisha/M
+Ajax/M
+Akbar/M
+Akhmatova/M
+Akihito/M
+Akita/M
+Akiva/M
+Akkad/M
+Akron/M
+Al/M
+Ala/S
+Alabama/M
+Alabaman/MS
+Alabamian/SM
+Aladdin/M
+Alamo/M
+Alamogordo/M
+Alan/M
+Alana/M
+Alar/M
+Alaric/M
+Alaska/M
+Alaskan/MS
+Alba/M
+Albania/M
+Albanian/MS
+Albany/M
+Albee/M
+Alberio/M
+Albert/M
+Alberta/M
+Albertan
+Alberto/M
+Albigensian/M
+Albion/M
+Albireo/M
+Albuquerque/M
+Alcatraz/M
+Alcestis/M
+Alcibiades/M
+Alcindor/M
+Alcmena/M
+Alcoa/M
+Alcott/M
+Alcuin/M
+Alcyone/M
+Aldan/M
+Aldebaran/M
+Alden/M
+Alderamin/M
+Aldo/M
+Aldrin/M
+Alec/M
+Aleichem/M
+Alejandra/M
+Alejandro/M
+Alembert/M
+Aleppo/M
+Aleut/MS
+Aleutian/SM
+Alex/M
+Alexander/MS
+Alexandra/M
+Alexandria/M
+Alexandrian
+Alexei/M
+Alexis/M
+Alfonso/M
+Alfonzo/M
+Alford/M
+Alfred/M
+Alfreda/M
+Alfredo/M
+Algenib/M
+Alger/M
+Algeria/M
+Algerian/SM
+Algieba/M
+Algiers/M
+Algol/M
+Algonquian/SM
+Algonquin/MS
+Alhambra/M
+Alhena/M
+Ali/M
+Alice/M
+Alicia/M
+Alighieri/M
+Aline/M
+Alioth/M
+Alisa/M
+Alisha/M
+Alison/M
+Alissa/M
+Alistair/M
+Alkaid/M
+Allah/M
+Allahabad/M
+Allan/M
+Alleghenies/M
+Allegheny/SM
+Allegra/M
+Allen/M
+Allende/M
+Allentown/M
+Allhallows/M
+Allie/MS
+Allison/M
+Allstate/M
+Allyson/M
+Alma/M
+Almach/M
+Almaty/M
+Almighty/M
+Almohad/M
+Almoravid/M
+Alnilam/M
+Alnitak/M
+Alonzo/M
+Alpert/M
+Alphard/M
+Alphecca/M
+Alpheratz/M
+Alphonse/M
+Alphonso/M
+Alpine/M
+Alpo/M
+Alps/M
+Alsace/M
+Alsatian/SM
+Alsop/M
+Alston/M
+Alta/M
+Altaba/M
+Altai/M
+Altaic/M
+Altair/M
+Altamira/M
+Althea/M
+Altiplano/M
+Altman/M
+Altoids/M
+Alton/M
+Altoona/M
+Aludra/M
+Alva/M
+Alvarado/M
+Alvarez/M
+Alvaro/M
+Alvin/M
+Alyce/M
+Alyson/M
+Alyssa/M
+Alzheimer/M
+Am/MNR
+Amadeus/M
+Amado/M
+Amalia/M
+Amanda/M
+Amarillo/M
+Amaru/M
+Amaterasu/M
+Amati/M
+Amazon/SM
+Amazonian
+Amber/M
+Amelia/M
+Amen/M
+Amenhotep/M
+Amerasian/M
+America/SM
+American/MS
+Americana/M
+Americanism/MS
+Americanization/MS
+Americanize/GDS
+Amerind/SM
+Amerindian/MS
+Ames/M
+Ameslan/M
+Amgen/M
+Amharic/M
+Amherst/M
+Amie/M
+Amiga/M
+Amish/M
+Amman/M
+Amoco/M
+Amos/M
+Amparo/M
+Ampere/M
+Amritsar/M
+Amsterdam/M
+Amtrak/M
+Amundsen/M
+Amur/M
+Amway/M
+Amy/M
+Ana/M
+Anabaptist/M
+Anabel/M
+Anacin/M
+Anacreon/M
+Anaheim/M
+Analects/M
+Ananias/M
+Anasazi/M
+Anastasia/M
+Anatole/M
+Anatolia/M
+Anatolian/M
+Anaxagoras/M
+Anchorage/M
+Andalusia/M
+Andalusian/M
+Andaman/M
+Andean/M
+Andersen/M
+Anderson/M
+Andes/M
+Andorra/M
+Andorran/SM
+Andre/MS
+Andrea/M
+Andrei/M
+Andres/M
+Andretti/M
+Andrew/SM
+Andrews/M
+Andrianampoinimerina/M
+Android/M
+Andromache/M
+Andromeda/M
+Andropov/M
+Andy/M
+Angara/M
+Angel/M
+Angela/M
+Angeles/M
+Angelia/M
+Angelica/M
+Angelico/M
+Angelina/M
+Angeline/M
+Angelique/M
+Angelita/M
+Angelo/M
+Angelou/M
+Angevin/M
+Angie/M
+Angkor/M
+Angle/MS
+Angleton/M
+Anglia/M
+Anglican/SM
+Anglicanism/MS
+Anglicism/MS
+Anglicization
+Anglicize
+Anglo/M
+Anglophile/M
+Anglophobe
+Angola/M
+Angolan/MS
+Angora/SM
+Angstrom/M
+Anguilla/M
+Angus/M
+Anhui/M
+Aniakchak/M
+Anibal/M
+Anita/M
+Ankara/M
+Ann/M
+Anna/M
+Annabel/M
+Annabelle/M
+Annam/M
+Annapolis/M
+Annapurna/M
+Anne/M
+Annette/M
+Annie/M
+Anniston/M
+Annmarie/M
+Annunciation/SM
+Anouilh/M
+Anselm/M
+Anselmo/M
+Anshan/M
+Antaeus/M
+Antananarivo/M
+Antarctic/M
+Antarctica/M
+Antares/M
+Anthony/M
+Anthropocene
+Antichrist/SM
+Antietam/M
+Antifa/M
+Antigone/M
+Antigua/M
+Antillean
+Antilles/M
+Antioch/M
+Antipas/M
+Antipodes
+Antofagasta/M
+Antoine/M
+Antoinette/M
+Anton/M
+Antone/M
+Antonia/M
+Antoninus/M
+Antonio/M
+Antonius/M
+Antony/M
+Antwan/M
+Antwerp/M
+Anubis/M
+Anzac/M
+Apache/SM
+Apalachicola/M
+Apatosaurus
+Apennines/M
+Aphrodite/M
+Apia/M
+Apocalypse/M
+Apocrypha/M
+Apollinaire/M
+Apollo/SM
+Apollonian/M
+Apostle/M
+Appalachia/M
+Appalachian/SM
+Appalachians/M
+Appaloosa/SM
+Apple/M
+Appleseed/M
+Appleton/M
+Appomattox/M
+Apr/M
+April/MS
+Apuleius/M
+Aquafresh/M
+Aquarian
+Aquarius/MS
+Aquila/M
+Aquinas/M
+Aquino/M
+Aquitaine/M
+Ar/M
+Ara/M
+Arab/SM
+Arabia/M
+Arabian/MS
+Arabic/M
+Arabist/MS
+Araby/M
+Araceli/M
+Arafat/M
+Aragon
+Araguaya/M
+Aral/M
+Aramaic/M
+Aramco/M
+Arapaho/MS
+Arapahoes
+Ararat/M
+Araucanian/M
+Arawak/M
+Arawakan/M
+Arbitron/M
+Arcadia/M
+Arcadian/M
+Archean/M
+Archibald/M
+Archie/M
+Archimedes/M
+Arctic/M
+Arcturus/M
+Ardabil
+Arden/M
+Arduino/M
+Arecibo/M
+Arequipa/M
+Ares/M
+Argentina/M
+Argentine/M
+Argentinean
+Argentinian/MS
+Argo/SM
+Argonaut/MS
+Argonne/M
+Argos/M
+Argus/M
+Ariadne/M
+Arianism/M
+Ariel/M
+Aries/MS
+Ariosto/M
+Aristarchus/M
+Aristides/M
+Aristophanes/M
+Aristotelian/M
+Aristotle/M
+Arius/M
+Ariz
+Arizona/M
+Arizonan/SM
+Arizonian/MS
+Arjuna/M
+Ark/M
+Arkansan/MS
+Arkansas/M
+Arkhangelsk/M
+Arkwright/M
+Arlene/M
+Arline/M
+Arlington/M
+Armageddon/SM
+Armagnac/M
+Armand/M
+Armando/M
+Armani/M
+Armenia/M
+Armenian/SM
+Arminius/M
+Armonk/M
+Armour/M
+Armstrong/M
+Arneb/M
+Arnhem/M
+Arno/M
+Arnold/M
+Arnulfo/M
+Aron/M
+Arrhenius/M
+Arron/M
+Art/M
+Artaxerxes/M
+Artemis/M
+Arthur/M
+Arthurian/M
+Artie/M
+Arturo/M
+Aruba/M
+Aryan/MS
+As/M
+Asama/M
+Ascella/M
+Ascension/M
+Asgard/M
+Ashanti/M
+Ashcroft/M
+Ashe/M
+Asheville/M
+Ashgabat
+Ashikaga/M
+Ashkenazim/M
+Ashkhabad/M
+Ashlee/M
+Ashley/M
+Ashmolean/M
+Ashurbanipal/M
+Asia/M
+Asiago
+Asian/MS
+Asiatic/SM
+Asimov/M
+Asmara/M
+Asoka/M
+Aspell/M
+Aspen/M
+Asperger/M
+Aspidiske/M
+Asquith/M
+Assad/M
+Assam/M
+Assamese/M
+Assembly
+Assisi/M
+Assyria/M
+Assyrian/SM
+Astaire/M
+Astana/M
+Astarte/M
+Aston/M
+Astor/M
+Astoria/M
+Astrakhan/M
+AstroTurf/M
+Asturias/M
+Asuncion/M
+Aswan/M
+At/SM
+Atacama/M
+Atahualpa/M
+Atalanta/M
+Atari/M
+Atascadero/M
+Ataturk/M
+Athabasca/M
+Athabaskan/SM
+Athanasius
+Athena/M
+Athene/M
+Athenian/SM
+Athens/M
+Atkins/M
+Atkinson/M
+Atlanta/M
+Atlantes
+Atlantic/M
+Atlantis/M
+Atlas/MS
+Atman/M
+Atonement
+Atreus/M
+Atria/M
+Atropos/M
+Attic/M
+Attica/M
+Attila/M
+Attlee/M
+Attn
+Attucks/M
+Atwood/M
+Au/M
+Aubrey/M
+Auburn/M
+Auckland/M
+Auden/M
+Audi/M
+Audion/M
+Audra/M
+Audrey/M
+Audubon/M
+Aug/M
+Augean/M
+Augsburg/M
+August/MS
+Augusta/M
+Augustan/M
+Augustine/M
+Augustinian/MS
+Augustus/M
+Aurangzeb/M
+Aurelia/M
+Aurelio/M
+Aurelius/M
+Aureomycin/M
+Auriga/M
+Aurora/M
+Auschwitz/M
+Aussie/MS
+Austen/M
+Austerlitz/M
+Austin/MS
+Australasia/M
+Australasian
+Australia/M
+Australian/SM
+Australoid/M
+Australopithecus/M
+Austria/M
+Austrian/SM
+Austronesian/M
+Autumn/M
+Av/M
+Ava/M
+Avalon/M
+Ave/M
+Aventine/M
+Avernus/M
+Averroes/M
+Avery/M
+Avesta/M
+Avicenna/M
+Avignon/M
+Avila/M
+Avior/M
+Avis/M
+Avogadro/M
+Avon/M
+Avondale/M
+Axis
+Axum/M
+Ayala/M
+Ayers/M
+Aymara/M
+Ayrshire/M
+Ayurveda/M
+Ayyubid/M
+Azana/M
+Azania/M
+Azazel/M
+Azerbaijan/M
+Azerbaijani/MS
+Azores/M
+Azov/M
+Aztec/SM
+Aztecan/M
+Aztlan/M
+B/MNT
+BA/M
+BASIC/SM
+BB/M
+BBB/M
+BBC/M
+BBQ
+BBS
+BBSes
+BC/M
+BFF
+BIA
+BIOS
+BITNET
+BLT/SM
+BM/M
+BMW/M
+BO
+BP/M
+BPOE
+BR
+BS/M
+BSA
+BSD/SM
+BTU
+BTW
+BYOB
+Ba/M
+Baal/SM
+Baath/M
+Baathist/M
+Babbage/M
+Babbitt/M
+Babel/MS
+Babylon/MS
+Babylonia/M
+Babylonian/SM
+Bacall/M
+Bacardi/M
+Bacchanalia/M
+Bacchic
+Bacchus/M
+Bach/M
+Backus/M
+Bacon/M
+Bactria/M
+Baden/M
+Badlands/M
+Baedeker/MS
+Baez/M
+Baffin/M
+Baggies/M
+Baghdad/M
+Baguio/M
+Baha'i/M
+Baha'ullah/M
+Bahama/SM
+Bahamanian
+Bahamas/M
+Bahamian/MS
+Bahia/M
+Bahrain/M
+Baidu/M
+Baikal/M
+Bailey/M
+Baird/M
+Bakelite/M
+Baker/M
+Bakersfield/M
+Baku/M
+Bakunin/M
+Balanchine/M
+Balaton/M
+Balboa/M
+Balder/M
+Baldwin/SM
+Balearic/M
+Balfour/M
+Bali/M
+Balinese/M
+Balkan/MS
+Balkans/M
+Balkhash/M
+Ball/M
+Ballard/M
+Balthazar/M
+Baltic/M
+Baltimore/M
+Baluchistan/M
+Balzac/M
+Bamako/M
+Bambi/M
+Banach/M
+Bancroft/M
+Bandung/M
+Bangalore/M
+Bangkok/M
+Bangladesh/M
+Bangladeshi/SM
+Bangor/M
+Bangui/M
+Banjarmasin/M
+Banjul/M
+Banks/M
+Banneker/M
+Bannister/M
+Banting/M
+Bantu/MS
+Baotou/M
+Baptist/SM
+Baptiste/M
+Barabbas/M
+Barack/M
+Barbadian/SM
+Barbados/M
+Barbara/M
+Barbarella/M
+Barbarossa/M
+Barbary/M
+Barber/M
+Barbie/M
+Barbour/M
+Barbra/M
+Barbuda/M
+Barcelona/M
+Barceloneta/M
+Barclay/SM
+Barclays/M
+Bardeen/M
+Barents/M
+Barker/M
+Barkley/M
+Barlow/M
+Barnabas/M
+Barnaby/M
+Barnard/M
+Barnaul/M
+Barnes/M
+Barnett/M
+Barney/M
+Barnum/M
+Baroda/M
+Barquisimeto/M
+Barr/M
+Barranquilla/M
+Barrera/M
+Barrett/M
+Barrie/M
+Barron/M
+Barry/M
+Barrymore/M
+Bart/M
+Barth/MS
+Bartholdi/M
+Bartholomew/M
+Bartlett/M
+Bartok/M
+Barton/M
+Baruch/M
+Baryshnikov/M
+Basel/M
+Basho/M
+Basie/M
+Basil/M
+Basque/MS
+Basra/M
+Bass/M
+Basseterre/M
+Bastille/M
+Basutoland/M
+Bataan/M
+Bates/M
+Bathsheba/M
+Batista/M
+Batman/M
+Battle/M
+Batu/M
+Baudelaire/M
+Baudouin/M
+Baudrillard/M
+Bauer/M
+Bauhaus/M
+Baum/M
+Bavaria/M
+Bavarian/M
+Baxter/M
+Bayamon
+Bayer/M
+Bayes/M
+Bayesian/M
+Bayeux/M
+Baylor/M
+Bayonne/M
+Bayreuth/M
+Baywatch/M
+Be/MH
+Beach/M
+Beadle/M
+Bean/M
+Beard/M
+Beardmore/M
+Beardsley/M
+Bearnaise/M
+Beasley/M
+Beatlemania/M
+Beatles/M
+Beatrice/M
+Beatrix/M
+Beatriz/M
+Beatty/M
+Beau/M
+Beaufort/M
+Beaujolais/M
+Beaumarchais/M
+Beaumont/M
+Beauregard/M
+Beauvoir/M
+Bechtel/M
+Beck/MR
+Becker/M
+Becket/M
+Beckett/M
+Beckley/M
+Beckman
+Becky/M
+Becquerel/M
+Bede/M
+Bedouin/SM
+Beebe/M
+Beecher/M
+Beefaroni/M
+Beelzebub/M
+Beerbohm/M
+Beethoven/M
+Beeton/M
+Begin/M
+Behan/M
+Behring/M
+Beiderbecke/M
+Beijing/M
+Beirut/M
+Bekesy/M
+Bela/M
+Belarus/M
+Belarusian
+Belau/M
+Belem/M
+Belfast/M
+Belg
+Belgian/SM
+Belgium/M
+Belgrade/M
+Belinda/M
+Belize/M
+Bell/M
+Bella/M
+Bellamy/M
+Bellatrix/M
+Belleek/M
+Bellingham/M
+Bellini/M
+Bellow/M
+Belmont/M
+Belmopan/M
+Beloit/M
+Belorussian/MS
+Belshazzar/M
+Beltane/M
+Belushi/M
+Ben/M
+Benacerraf/M
+Benchley/M
+Bend/MR
+Bender/M
+Bendictus
+Bendix/M
+Benedict/M
+Benedictine/MS
+Benelux/M
+Benet/M
+Benetton/M
+Bengal/SM
+Bengali/M
+Benghazi/M
+Benin/M
+Beninese/M
+Benita/M
+Benito/M
+Benjamin/M
+Bennett/M
+Bennie/M
+Benny/M
+Benson/M
+Bentham/M
+Bentley/M
+Benton/M
+Benz/M
+Benzedrine/M
+Beowulf/M
+Berber/SM
+Berenice/M
+Beretta/M
+Berg/MNR
+Bergen/M
+Berger/M
+Bergerac/M
+Bergman/M
+Bergson/M
+Beria/M
+Bering/M
+Berkeley/M
+Berkshire/SM
+Berkshires/M
+Berle/M
+Berlin/SZMR
+Berliner/M
+Berlioz/M
+Berlitz/M
+Bermuda/SM
+Bermudan/SM
+Bermudian/SM
+Bern/M
+Bernadette/M
+Bernadine/M
+Bernanke/M
+Bernard/M
+Bernardo/M
+Bernays/M
+Bernbach/M
+Bernese
+Bernhardt/M
+Bernice/M
+Bernie/M
+Bernini/M
+Bernoulli/M
+Bernstein/M
+Berra/M
+Berry/M
+Bert/M
+Berta/M
+Bertelsmann/M
+Bertha/M
+Bertie/M
+Bertillon/M
+Bertram/M
+Bertrand/M
+Berwick/M
+Beryl/M
+Berzelius/M
+Bess/M
+Bessel/M
+Bessemer/M
+Bessie/M
+Best/M
+Betelgeuse/M
+Beth/M
+Bethany/M
+Bethe/M
+Bethesda/M
+Bethlehem/M
+Bethune/M
+Betsy/M
+Bette/M
+Bettie/M
+Betty/M
+Bettye/M
+Beulah/M
+Beveridge
+Beverley/M
+Beverly/M
+Beyer/M
+Bharat/M
+Bhopal/M
+Bhutan/M
+Bhutanese/M
+Bhutto/M
+Bi/M
+Bialystok/M
+Bianca/M
+Bib
+Bible/MS
+Bic/M
+Biddle/M
+Biden/M
+Bierce/M
+BigQuery/M
+Bigfoot/M
+Biggles/M
+Biko/M
+Bilbao/M
+Bilbo/M
+Bill/MJ
+Billie/M
+Billings/M
+Billy/M
+Bimini/M
+Binghamton/M
+Biogen/M
+Bioko/M
+Bird/M
+Birdseye/M
+Birkenstock/M
+Birmingham/M
+Biro/M
+Biscay/M
+Biscayne/M
+Bishkek/M
+Bishop/M
+Bismarck/M
+Bismark/M
+Bisquick/M
+Bissau/M
+BitTorrent/M
+Bizet/M
+Bjerknes/M
+Bjork/M
+Bk/M
+BlackBerry/M
+Blackbeard/M
+Blackburn/M
+Blackfeet/M
+Blackfoot/M
+Blackpool/M
+Blacksburg/M
+Blackshirt/M
+Blackstone/M
+Blackwell/M
+Blaine/M
+Blair/M
+Blake/M
+Blanca/M
+Blanchard/M
+Blanche/M
+Blankenship/M
+Blantyre/M
+Blatz/M
+Blavatsky/M
+Blenheim/M
+Blevins/M
+Bligh/M
+Bloch/M
+Blockbuster/M
+Bloemfontein/M
+Blondel/M
+Blondie/M
+Bloom/MR
+Bloomer/M
+Bloomfield/M
+Bloomingdale/M
+Bloomington/M
+Bloomsburg/M
+Bloomsbury/M
+Blu
+Blucher/M
+Bluebeard/M
+Bluetooth/M
+Blvd
+Blythe/M
+Boadicea
+Boas/M
+Bob/M
+Bobbi/M
+Bobbie/M
+Bobbitt/M
+Bobby/M
+Boccaccio/M
+Bodhidharma/M
+Bodhisattva/M
+Bodleian
+Boeing/M
+Boeotia/M
+Boeotian/M
+Boer/SM
+Boethius/M
+Bogart/M
+Bogota/M
+Bohemia/M
+Bohemian/SM
+Bohr/M
+Boise/M
+Bojangles/M
+Boleyn/M
+Bolivar/M
+Bolivia/M
+Bolivian/MS
+Bollywood/M
+Bologna/M
+Bolshevik/SM
+Bolsheviki
+Bolshevism/M
+Bolshevist/M
+Bolshoi/M
+Bolton/M
+Boltzmann/M
+Bombay/M
+Bonaparte/M
+Bonaventure/M
+Bond/M
+Bonhoeffer/M
+Boniface/M
+Bonita/M
+Bonn/MR
+Bonner/M
+Bonneville/M
+Bonnie/M
+Bono/M
+Booker/M
+Boole/M
+Boolean/M
+Boone/M
+Bootes/M
+Booth/M
+Bordeaux/M
+Borden/M
+Bordon/M
+Boreas/M
+Borg/SM
+Borges/M
+Borgia/M
+Borglum/M
+Boris/M
+Bork/M
+Borlaug/M
+Born/M
+Borneo/M
+Borobudur/M
+Borodin/M
+Boru/M
+Bosch/M
+Bose/M
+Bosnia/M
+Bosnian
+Bosporus/M
+Boston/MS
+Bostonian/M
+Boswell/M
+Botha
+Botox
+Botswana/M
+Botticelli/M
+Boulder/M
+Boulez/M
+Bourbaki/M
+Bourbon/SM
+Bournemouth/M
+Bovary/M
+Bowditch/M
+Bowell/M
+Bowen/M
+Bowers/M
+Bowery/M
+Bowie/M
+Bowman/M
+Boyd/M
+Boyer/M
+Boyle/M
+Br/MT
+Brad/MY
+Bradbury/M
+Braddock/M
+Bradenton/M
+Bradford/M
+Bradley/M
+Bradly/M
+Bradshaw/M
+Bradstreet/M
+Brady/M
+Bragg/M
+Brahe/M
+Brahma/MS
+Brahmagupta/M
+Brahman/MS
+Brahmani
+Brahmanism/SM
+Brahmaputra/M
+Brahms/M
+Braille/MS
+Brain/M
+Brampton/M
+Bran/M
+Branch/M
+Brandeis/M
+Branden/M
+Brandenburg/M
+Brandi/M
+Brandie/M
+Brando/M
+Brandon/M
+Brandt/M
+Brandy/M
+Brant/M
+Braque/M
+Brasilia/M
+Bratislava/M
+Brattain/M
+Bray/M
+Brazil/M
+Brazilian/MS
+Brazos/M
+Brazzaville/M
+Breakspear/M
+Breathalyzer
+Brecht/M
+Breckenridge/M
+Bremen/M
+Bremerton/M
+Brenda/M
+Brendan/M
+Brennan/M
+Brenner/M
+Brent/M
+Brenton/M
+Brest/M
+Bret/M
+Breton/M
+Brett/M
+Brewer/M
+Brewster/M
+Brexit
+Brezhnev/M
+Brian/M
+Briana/M
+Brianna/M
+Brice/M
+Bridalveil/M
+Bridgeport/M
+Bridger/M
+Bridges/M
+Bridget/M
+Bridgetown/M
+Bridgett/M
+Bridgette/M
+Bridgman/M
+Brie/SM
+Brigadoon/M
+Briggs/M
+Brigham/M
+Bright/M
+Brighton/M
+Brigid/M
+Brigitte/M
+Brillo/M
+Brillouin
+Brinkley/M
+Brisbane/M
+Bristol/M
+Brit/SM
+Britain/M
+Britannia/M
+Britannic/M
+Britannica/M
+Briticism/SM
+British/MRZ
+Britisher/M
+Britney/M
+Briton/MS
+Britt/MN
+Brittany/SM
+Britten/M
+Brittney/M
+Brno/M
+Broadway/SM
+Brobdingnag/M
+Brobdingnagian/M
+Brock/M
+Brokaw/M
+Bronson/M
+Bronte/M
+Brontosaurus
+Bronx/M
+Brooke/MS
+Brooklyn/M
+Brooks/M
+Bros
+Brown/MG
+Browne/M
+Brownian/M
+Brownie/S
+Browning/M
+Brownshirt/M
+Brownsville/M
+Brubeck/M
+Bruce/M
+Bruckner/M
+Bruegel
+Brummel/M
+Brunei/M
+Bruneian/MS
+Brunelleschi/M
+Brunhilde/M
+Bruno/M
+Brunswick/M
+Brussels/M
+Brut/M
+Brutus/M
+Bryan/M
+Bryant/M
+Bryce/M
+Brynner/M
+Bryon/M
+Brzezinski/M
+Btu/M
+Buber/M
+Buchanan/M
+Bucharest/M
+Buchenwald/M
+Buchwald/M
+Buck/M
+Buckingham/M
+Buckley/M
+Buckner/M
+Bud/M
+Budapest/M
+Buddha/SM
+Buddhism/SM
+Buddhist/SM
+Buddy/M
+Budweiser/M
+Buffalo/M
+Buffy/M
+Buford/M
+Bugatti/M
+Bugzilla/M
+Buick/M
+Bujumbura/M
+Bukhara/M
+Bukharin/M
+Bulawayo/M
+Bulfinch/M
+Bulganin/M
+Bulgar/M
+Bulgari/M
+Bulgaria/M
+Bulgarian/SM
+Bullock/M
+Bullwinkle/M
+Bultmann/M
+Bumppo/M
+Bunche/M
+Bundesbank/M
+Bundestag/M
+Bunin/M
+Bunker/M
+Bunsen/M
+Bunuel/M
+Bunyan/M
+Burbank/M
+Burberry/M
+Burch/M
+Burger/M
+Burgess/M
+Burgoyne/M
+Burgundian/M
+Burgundy/SM
+Burke/M
+Burks/M
+Burl/M
+Burlington/M
+Burma/M
+Burmese/M
+Burnett/M
+Burns/M
+Burnside/M
+Burr/M
+Burris/M
+Burroughs/M
+Bursa/M
+Burt/M
+Burton/M
+Burundi/M
+Burundian/MS
+Busch/M
+Bush/M
+Bushido/M
+Bushnell/M
+Butler/M
+Butterfingers/M
+Buxtehude/M
+Byblos/M
+Byers/M
+Byrd/M
+Byron/M
+Byronic/M
+Byzantine/MS
+Byzantium/M
+C/SM
+CA
+CAD/M
+CAI
+CAM
+CAP
+CARE
+CATV
+CB
+CBC/M
+CBS/M
+CCTV
+CCU
+CD/SM
+CDC
+CDT
+CEO/M
+CF
+CFC/M
+CFO
+CGI
+CIA/M
+CID
+CNN/M
+CNS/M
+CO/M
+COBOL/SM
+COD
+COL
+COLA
+COVID
+CPA/M
+CPI/M
+CPO
+CPR/M
+CPU/M
+CRT/SM
+CSS/M
+CST/M
+CT/M
+CV
+CVS/M
+CZ
+Ca/M
+Cabernet/M
+Cabot/M
+Cabral/M
+Cabrera/M
+Cabrini/M
+Cadette
+Cadillac/M
+Cadiz/M
+Caedmon/M
+Caerphilly/M
+Caesar/SM
+Cage/M
+Cagney/M
+Cahokia/M
+Caiaphas/M
+Cain/SM
+Cairo/M
+Caitlin/M
+Cajun/MS
+Cal/M
+Calais/M
+Calcutta/M
+Calder/M
+Calderon/M
+Caldwell/M
+Caleb/M
+Caledonia/M
+Calexico/M
+Calgary/M
+Calhoun/M
+Cali/M
+Caliban/M
+Calif
+California/M
+Californian/SM
+Caligula/M
+Callaghan/M
+Callahan/M
+Callao/M
+Callas/M
+Callie/M
+Calliope/M
+Callisto/M
+Caloocan/M
+Calvary/M
+Calvert/M
+Calvin/M
+Calvinism/MS
+Calvinist/MS
+Calvinistic
+Camacho/M
+Camarillo/M
+Cambodia/M
+Cambodian/SM
+Cambrian/SM
+Cambridge/M
+Camden/M
+Camel/M
+Camelopardalis/M
+Camelot/MS
+Camembert/MS
+Cameron/M
+Cameroon/SM
+Cameroonian/MS
+Camilla/M
+Camille/M
+Camoens/M
+Campanella/M
+Campbell/M
+Campinas/M
+Campos/M
+Camry/M
+Camus/M
+Can/M
+Canaan/M
+Canaanite/MS
+Canad
+Canada/M
+Canadian/SM
+Canadianism
+Canaletto/M
+Canaries/M
+Canaveral/M
+Canberra/M
+Cancer/SM
+Cancun/M
+Candace/M
+Candice/M
+Candide/M
+Candy/M
+Cannes/M
+Cannon/M
+Canon/M
+Canopus/M
+Cantabrigian/M
+Canterbury/M
+Canton/M
+Cantonese/M
+Cantor/M
+Cantrell/M
+Cantu/M
+Canute/M
+Capablanca/M
+Capek/M
+Capella/M
+Capet/M
+Capetian/M
+Capetown/M
+Caph/M
+Capistrano/M
+Capitol/SM
+Capitoline/M
+Capone/M
+Capote/M
+Capra/M
+Capri/M
+Capricorn/MS
+Capt
+Capuchin/M
+Capulet/M
+Cara/M
+Caracalla/M
+Caracas/M
+Caravaggio/M
+Carboloy/M
+Carbondale/M
+Carboniferous/M
+Carborundum/M
+Cardenas/M
+Cardiff/M
+Cardin/M
+Cardozo/M
+Carey/M
+Carib/MS
+Caribbean/MS
+Carina/M
+Carissa/M
+Carl/M
+Carla/M
+Carlene/M
+Carlin/M
+Carlo/MS
+Carlos/M
+Carlsbad/M
+Carlson/M
+Carlton/M
+Carly/M
+Carlyle/M
+Carmela/M
+Carmella/M
+Carmelo/M
+Carmen/M
+Carmichael/M
+Carmine/M
+Carnap/M
+Carnation/M
+Carnegie/M
+Carney/M
+Carnot/M
+Carol/M
+Carole/M
+Carolina/M
+Caroline/M
+Carolingian/M
+Carolinian/M
+Carolyn/M
+Carpathian/SM
+Carpathians/M
+Carpenter/M
+Carr/M
+Carranza/M
+Carrie/RM
+Carrier/M
+Carrillo/M
+Carroll/M
+Carson/M
+Carter/M
+Cartersville/M
+Cartesian/M
+Carthage/M
+Carthaginian/MS
+Cartier/M
+Cartwright/M
+Caruso/M
+Carver/M
+Cary/M
+Casablanca/M
+Casals/M
+Casandra/M
+Casanova/SM
+Cascades/M
+Case/M
+Casey/M
+Cash/M
+Casio/M
+Caspar/M
+Casper/M
+Caspian/M
+Cassandra/SM
+Cassatt/M
+Cassidy/M
+Cassie/M
+Cassiopeia/M
+Cassius/M
+Castaneda/M
+Castilian
+Castillo/M
+Castlereagh/M
+Castor/M
+Castries/M
+Castro/M
+Catalan/SM
+Catalina/M
+Catalonia/M
+Catawba/M
+Caterpillar/M
+Cathay/M
+Cather/M
+Catherine/M
+Cathleen/M
+Catholic/MS
+Catholicism/MS
+Cathryn/M
+Cathy/M
+Catiline/M
+Cato/M
+Catskill/SM
+Catskills/M
+Catt/M
+Catullus/M
+Caucasian/MS
+Caucasoid
+Caucasus/M
+Cauchy/M
+Cavendish/M
+Cavour/M
+Caxton/M
+Cayenne/M
+Cayman/M
+Cayuga/SM
+Cayuse
+Cb
+Cd/M
+Ce/M
+Ceausescu/M
+Cebu/M
+Cebuano/M
+Cecelia/M
+Cecil/M
+Cecile/M
+Cecilia/M
+Cecily/M
+Cedric/M
+Celeste/M
+Celgene/M
+Celia/M
+Celina/M
+Cellini/M
+Celsius/M
+Celt/SM
+Celtic/SM
+Cenozoic/M
+Centaurus/M
+Centigrade
+Central
+Cepheid/M
+Cepheus/M
+Cerberus/M
+Cerenkov/M
+Ceres/M
+Cerf/M
+Cervantes/M
+Cesar/M
+Cesarean/M
+Cessna/M
+Cetus/M
+Ceylon/M
+Ceylonese
+Cezanne/M
+Cf/M
+Ch'in/M
+Ch/N
+Chablis/M
+Chad/M
+Chadian/MS
+Chadwick/M
+Chagall/M
+Chaitanya/M
+Chaitin/M
+Chaldea
+Chaldean/M
+Challenger/M
+Chalmers
+Chamberlain/M
+Chambers/M
+Chambersburg/M
+Champaign/M
+Champlain/M
+Champollion/M
+Chan/M
+Chance/M
+Chancellorsville/M
+Chandigarh/M
+Chandler/M
+Chandon/M
+Chandra/M
+Chandragupta/M
+Chandrasekhar/M
+Chanel/M
+Chaney/M
+Chang/M
+Changchun/M
+Changsha/M
+Chantilly/M
+Chaplin/M
+Chaplinesque
+Chapman/M
+Chappaquiddick/M
+Chapultepec/M
+Charbray/M
+Chardonnay/M
+Charity/M
+Charlemagne/M
+Charlene/M
+Charles/M
+Charleston/MS
+Charley/M
+Charlie/M
+Charlotte/M
+Charlottesville/M
+Charlottetown/M
+Charmaine/M
+Charmin/M
+Charolais/M
+Charon/M
+Chartism/M
+Chartres/M
+Charybdis/M
+Chase/M
+Chasity/M
+Chateaubriand/M
+Chattahoochee/M
+Chattanooga/M
+Chatterley/M
+Chatterton/M
+Chaucer/M
+Chauncey/M
+Chautauqua/M
+Chavez/M
+Chayefsky/M
+Che/M
+Chechen/M
+Chechnya/M
+Cheddar/M
+Cheer/M
+Cheerios/M
+Cheetos/M
+Cheever/M
+Chekhov/M
+Chekhovian
+Chelsea/M
+Chelyabinsk/M
+Chen/M
+Cheney/M
+Chengdu/M
+Chennai/M
+Cheops/M
+Cheri/M
+Cherie/M
+Chernenko/M
+Chernobyl/M
+Chernomyrdin/M
+Cherokee/MS
+Cherry/M
+Cheryl/M
+Chesapeake/M
+Cheshire/M
+Chester/M
+Chesterfield/M
+Chesterton/M
+Chevalier/M
+Cheviot/M
+Chevrolet/M
+Chevron/M
+Chevy/M
+Cheyenne/SM
+Chi/M
+Chianti/MS
+Chiba/M
+Chibcha/M
+Chicago/M
+Chicagoan/M
+Chicana/M
+Chicano/M
+Chickasaw/MS
+Chiclets/M
+Chico/M
+Chihuahua/MS
+Chile/M
+Chilean/MS
+Chimborazo/M
+Chimera/MS
+Chimu/M
+Chin/M
+China/M
+Chinatown/M
+Chinese/M
+Chinook/MS
+Chipewyan/M
+Chippendale/M
+Chippewa/SM
+Chiquita/M
+Chirico/M
+Chisholm/M
+Chisinau/M
+Chittagong/M
+Chivas/M
+Chloe/M
+Choctaw/SM
+Chomsky/M
+Chongqing/M
+Chopin/M
+Chopra/M
+Chou/M
+Chretien/M
+Chris/M
+Christ/MS
+Christa/M
+Christchurch/M
+Christendom/MS
+Christensen/M
+Christi/M
+Christian/SM
+Christianity/SM
+Christianize
+Christie/M
+Christina/M
+Christine/M
+Christlike
+Christmas/MS
+Christmastide/MS
+Christmastime/MS
+Christoper/M
+Christopher/M
+Chromebook/MS
+Chronicles
+Chrysler/M
+Chrysostom/M
+Chrystal/M
+Chuck/M
+Chukchi/M
+Chumash/M
+Chung/M
+Church/M
+Churchill/M
+Churriguera/M
+Chuvash/M
+Ci/M
+Cicero/M
+Cid/M
+Cimabue/M
+Cincinnati/M
+Cinderella/MS
+Cindy/M
+CinemaScope/M
+Cinerama/M
+Cipro/M
+Circe/M
+Cisco/M
+Citibank/M
+Citigroup/M
+Citroen/M
+Cl/MV
+Claiborne/M
+Clair/M
+Claire/M
+Clairol/M
+Clancy/M
+Clapeyron/M
+Clapton/M
+Clara/M
+Clare/M
+Clarence/M
+Clarendon/M
+Clarice/M
+Clarissa/M
+Clark/M
+Clarke/M
+Clarksville/M
+Claude/M
+Claudette/M
+Claudia/M
+Claudine/M
+Claudio/M
+Claudius/M
+Claus/M
+Clausewitz/M
+Clausius/M
+Clay/M
+Clayton/M
+Clearasil/M
+Clem/XM
+Clemenceau/M
+Clemens/M
+Clement/MS
+Clementine/M
+Clements/M
+Clemons/M
+Clemson/M
+Cleo/M
+Cleopatra/M
+Cleveland/M
+Cliburn/M
+Cliff/M
+Clifford/M
+Clifton/M
+Cline/M
+Clint/M
+Clinton/M
+Clio/M
+Clive/M
+Clojure/M
+Clorets/M
+Clorox/M
+Closure/M
+Clotho/M
+Clouseau/M
+Clovis/M
+Clyde/M
+Clydesdale/M
+Clytemnestra/M
+Cm/M
+Cmdr
+Co/M
+Cobain/M
+Cobb/M
+Cochabamba/M
+Cochin/M
+Cochise/M
+Cochran/M
+Cockney/M
+Cocteau/M
+Cod
+Cody/M
+Coffey/M
+Cognac/M
+Cohan/M
+Cohen/M
+Coimbatore/M
+Cointreau/M
+Coke/SM
+Col/M
+Colbert/M
+Colby/M
+Cole/M
+Coleen/M
+Coleman/M
+Coleridge/M
+Colette/M
+Colfax/M
+Colgate/M
+Colin/M
+Colleen/M
+Collier/M
+Collin/SM
+Collins/M
+Colo
+Cologne/M
+Colombia/M
+Colombian/MS
+Colombo/M
+Colon/M
+Coloradan/SM
+Colorado/M
+Coloradoan
+Colosseum/M
+Colt/M
+Coltrane/M
+Columbia/M
+Columbine/M
+Columbus/M
+Com
+Comanche/MS
+Combs/M
+Comdr
+Comintern/M
+Commandment
+Commons/M
+Commonwealth
+Communion/SM
+Communism
+Communist/SM
+Como/M
+Comoran
+Comoros/M
+Compaq/M
+Compton/M
+CompuServe/M
+Comte/M
+Conakry/M
+Conan/M
+Concepcion/M
+Concetta/M
+Concord/SM
+Concorde/M
+Condillac/M
+Condorcet/M
+Conestoga/M
+Confederacy/M
+Confederate/MS
+Confucian/SM
+Confucianism/MS
+Confucius/M
+Cong/M
+Congo/M
+Congolese/M
+Congregational
+Congregationalist/MS
+Congress/MS
+Congressional
+Congreve/M
+Conley/M
+Conn/MR
+Connecticut/M
+Connellsville/M
+Connemara/M
+Conner/M
+Connery/M
+Connie/M
+Connolly/M
+Connors/M
+Conrad/M
+Conrail/M
+Conroe/M
+Conservative
+Constable/M
+Constance/M
+Constantine/M
+Constantinople/M
+Constitution
+Consuelo/M
+Continent/M
+Continental/M
+Contreras/M
+Conway/M
+Cook/M
+Cooke/M
+Cooley/M
+Coolidge/M
+Cooper/M
+Cooperstown/M
+Coors/M
+Copacabana/M
+Copeland/M
+Copenhagen/M
+Copernican/M
+Copernicus/M
+Copland/M
+Copley/M
+Copperfield/M
+Coppertone/M
+Coppola/M
+Coptic/M
+Cora/M
+Cordelia/M
+Cordilleras/M
+Cordoba/M
+Corey/M
+Corfu/M
+Corina/M
+Corine/M
+Corinne/M
+Corinth/M
+Corinthian/MS
+Corinthians/M
+Coriolanus/M
+Coriolis/M
+Cork
+Corleone/M
+Cormack/M
+Corneille/M
+Cornelia/M
+Cornelius/M
+Cornell/M
+Corning/M
+Cornish/MS
+Cornwall/M
+Cornwallis/M
+Coronado/M
+Corot/M
+Corp
+Correggio/M
+Corrine/M
+Corsica/M
+Corsican/M
+Cortes/MS
+Cortland/M
+Corvallis/M
+Corvette/M
+Corvus/M
+Cory/M
+Cosby/M
+CosmosDB/M
+Cossack/M
+Costco/M
+Costello/M
+Costner/M
+Cote/M
+Cotonou/M
+Cotopaxi/M
+Cotswold/M
+Cotton/M
+Coulomb/M
+Coulter/M
+Couperin/M
+Courbet/M
+Courtney/M
+Cousteau/M
+Coventry/SM
+Covington/M
+Coward/M
+Cowell/M
+Cowley/M
+Cowper/M
+Cox/M
+Coy/M
+Coyle/M
+Cozumel/M
+Cpl
+Cr/MT
+Crabbe/M
+Craft/M
+Craig/M
+Cranach/M
+Crane/M
+Cranmer/M
+Crater/M
+Crawford/M
+Cray/M
+Crayola/M
+Creation/M
+Creator/M
+Crecy/M
+Cree/DSM
+Creek/SM
+Creighton/M
+Creole/SM
+Creon/M
+Cressida/M
+Crest/M
+Cretaceous/M
+Cretan/SM
+Crete/M
+Crichton/M
+Crick/M
+Crimea/M
+Crimean/M
+Criollo/M
+Crisco/M
+Cristina/M
+Croat/SM
+Croatia/M
+Croatian/MS
+Croce/M
+Crockett/M
+Croesus/M
+Cromwell/M
+Cromwellian/M
+Cronin/M
+Cronkite/M
+Cronus/M
+Crookes/M
+Crosby/M
+Cross/M
+Crow/SM
+Crowley/M
+Crucifixion/MS
+Cruikshank/M
+Cruise/M
+Crusades's
+Crusoe/M
+Crux/M
+Cruz/M
+Cryptozoic/M
+Crystal/M
+Csonka/M
+Ct
+Ctesiphon/M
+Cthulhu/M
+Cu/M
+Cuba/M
+Cuban/SM
+Cuchulain/M
+Cuisinart/M
+Culbertson/M
+Cullen/M
+Cumberland/M
+Cummings/M
+Cunard/M
+Cunningham/M
+Cupid/M
+Curacao/M
+Curie/M
+Curitiba/M
+Currier/M
+Curry/RM
+Curt/M
+Curtis/M
+Custer/M
+Cuvier/M
+Cuzco/M
+Cybele/M
+Cyclades/M
+Cyclopes/M
+Cyclops/M
+Cygnus/M
+Cymbeline/M
+Cynthia/M
+Cyprian/M
+Cypriot/MS
+Cyprus/M
+Cyrano/M
+Cyril/M
+Cyrillic/M
+Cyrus/M
+Czech/M
+Czechia/M
+Czechoslovak
+Czechoslovakia/M
+Czechoslovakian/SM
+Czechs
+Czerny/M
+D/M
+DA/M
+DAR
+DAT/M
+DBMS/M
+DC/M
+DD/M
+DDS/M
+DDT/S
+DE
+DEA
+DEC/SD
+DH
+DHS
+DI
+DJ
+DMCA
+DMD/M
+DMZ
+DNA/M
+DOA
+DOB
+DOD
+DOE
+DOS/M
+DOT
+DP/SM
+DPT
+DST
+DTP
+DUI
+DVD/S
+DVR/SM
+DWI
+Dachau/M
+Dacron/SM
+Dada/M
+Dadaism/M
+Daedalus/M
+Daguerre/M
+Dagwood/M
+Dahomey/M
+Daimler/M
+Daisy/M
+Dakar/M
+Dakota/SM
+Dakotan/M
+Dalai
+Dale/M
+Daley/M
+Dali/M
+Dalian/M
+Dallas/M
+Dalmatia/M
+Dalmatian/SM
+Dalton/M
+Damascus/M
+Dame/MN
+Damian/M
+Damien/M
+Damion/M
+Damocles/M
+Damon/M
+Dan/M
+Dana/M
+Danae/M
+Danbury/M
+Dane/SM
+Danelaw/M
+Dangerfield/M
+Danial/M
+Daniel/SM
+Danielle/M
+Daniels/M
+Danish/M
+Dannie/M
+Danny/M
+Danone/M
+Dante/M
+Danton/M
+Danube/M
+Danubian/M
+Danville/M
+Daphne/M
+Darby/M
+Darcy/M
+Dardanelles/M
+Dare/M
+Daren/M
+Darfur/M
+Darin/M
+Dario/M
+Darius/M
+Darjeeling/M
+Darla/M
+Darlene/M
+Darling/M
+Darnell/M
+Darrel/M
+Darrell/M
+Darren/M
+Darrin/M
+Darrow/M
+Darryl/M
+Darth/M
+Dartmoor/M
+Dartmouth/M
+Darvon/M
+Darwin/M
+Darwinian/M
+Darwinism/SM
+Darwinist
+Daryl/M
+Datamation
+Daugherty/M
+Daumier/M
+Davao/M
+Dave/M
+Davenport/M
+David/MS
+Davidson/M
+Davies/M
+Davis/M
+Davy/SM
+Dawes/M
+Dawkins
+Dawn/M
+Dawson/M
+Day/M
+Dayan
+Dayton/M
+DeGeneres/M
+DeKalb/M
+Deadhead/M
+Dean/M
+Deana/M
+Deandre/M
+Deann/M
+Deanna/M
+Deanne/M
+Death/M
+Debbie/M
+Debby/M
+Debian/M
+Debora/M
+Deborah/M
+Debouillet/M
+Debra/M
+Debs/M
+Debussy/M
+Dec/M
+Decalogue/M
+Decatur/M
+Decca/M
+Deccan/M
+December/SM
+Decker/M
+Dedekind/M
+Dee/M
+Deena/M
+Deere/M
+Defoe/M
+Degas/M
+Deidre/M
+Deimos/M
+Deirdre/M
+Deity
+Dejesus/M
+Del/M
+Delacroix/M
+Delacruz/M
+Delaney/M
+Delano/M
+Delaware/MS
+Delawarean/SM
+Delbert/M
+Deleon/M
+Delgado/M
+Delhi/M
+Delia/M
+Delibes/M
+Delicious/M
+Delilah/M
+Delilahs
+Delius/M
+Dell/M
+Della/M
+Delmar/M
+Delmarva/M
+Delmer/M
+Delmonico/M
+Delores/M
+Deloris/M
+Delphi/M
+Delphic/M
+Delphinus/M
+Delta/M
+Deltona/M
+Dem/G
+Demavend/M
+Demerol/M
+Demeter/M
+Demetrius/M
+Deming/M
+Democrat/SM
+Democratic
+Democritus/M
+Demosthenes/M
+Dempsey/M
+Dena/M
+Denali
+Deneb/M
+Denebola/M
+Deng/M
+Denis/M
+Denise/M
+Denmark/M
+Dennis/M
+Denny/M
+Denton/M
+Denver/M
+Deon/M
+Depp/M
+Derby/M
+Derek/M
+Derick/M
+Dermot/M
+Derrick/M
+Derrida/M
+Descartes/M
+Desdemona/M
+Desiree/M
+Desmond/M
+Detroit/M
+Deuteronomy/M
+Devanagari/M
+Devi/M
+Devin/M
+Devon/M
+Devonian/M
+Dewar/M
+Dewayne/M
+Dewey/M
+Dewitt/M
+Dexedrine/M
+Dexter/M
+Dhaka/M
+Dhaulagiri/M
+Di/SM
+DiCaprio/M
+DiMaggio/M
+Diaghilev/M
+Dial/M
+Diana/M
+Diane/M
+Diann/M
+Dianna/M
+Dianne/M
+Dias
+Diaspora/MS
+Dick/XM
+Dickens/M
+Dickensian
+Dickerson/M
+Dickinson/M
+Dickson/M
+Dictaphone/SM
+Diderot/M
+Dido/M
+Didrikson/M
+Diefenbaker/M
+Diego/M
+Diem/M
+Dietrich/M
+Dijkstra/M
+Dijon/M
+Dilbert/MS
+Dillard/M
+Dillinger/M
+Dillon/M
+Dina/M
+Dinah/M
+Dino/M
+Diocletian/M
+Diogenes/M
+Dion/M
+Dionne/M
+Dionysian/M
+Dionysus/M
+Diophantine/M
+Dior/M
+Dipper/M
+Dir
+Dirac/M
+Dirichlet/M
+Dirk/M
+Dis/M
+Disney/M
+Disneyland/M
+Disraeli/M
+Divine/M
+Diwali/M
+Dix/M
+Dixie/M
+Dixiecrat/M
+Dixieland/SM
+Dixon/M
+Django/M
+Djibouti/M
+Dmitri/M
+Dnepropetrovsk/M
+Dniester/M
+Dobbin/M
+Doberman/M
+Dobro/M
+Doctor
+Doctorow/M
+Dodge/M
+Dodgson/M
+Dodoma/M
+Dodson/M
+Doe/M
+Doha/M
+Dolby/M
+Dole/M
+Dollie/M
+Dolly/M
+Dolores/M
+Domesday/M
+Domingo/M
+Dominguez/M
+Dominic/M
+Dominica/M
+Dominican/MS
+Dominick/M
+Dominion
+Dominique/M
+Domitian/M
+Don/SM
+Dona/M
+Donahue/M
+Donald/M
+Donaldson/M
+Donatello/M
+Donetsk/M
+Donizetti/M
+Donn/MR
+Donna/M
+Donne/M
+Donnell/M
+Donner/M
+Donnie/M
+Donny/M
+Donovan/M
+Dooley/M
+Doolittle/M
+Doonesbury/M
+Doppler/M
+Dora/M
+Dorcas/M
+Doreen/M
+Dorian/M
+Doric/M
+Doris/M
+Doritos/M
+Dorothea/M
+Dorothy/M
+Dorset/M
+Dorsey/M
+Dorthy/M
+Dortmund/M
+Dostoevsky/M
+Dot/M
+Dothan/M
+Dotson/M
+Douala/M
+Douay/M
+Doubleday/M
+Doug/M
+Douglas/M
+Douglass/M
+Douro/M
+Dover/M
+Dow/M
+Downs/M
+Downy/M
+Doyle/M
+Dr
+Draco/M
+Draconian/M
+Dracula/M
+Drake/M
+Dramamine/SM
+Drambuie/M
+Drano/M
+Dravidian/M
+Dreiser/M
+Dresden/M
+Drew/M
+Dreyfus/M
+Dristan/M
+Dropbox/M
+Drudge/M
+Drupal/M
+Dryden/M
+Dschubba/M
+Du
+DuPont/M
+Duane/M
+Dubai/M
+Dubcek/M
+Dubhe/M
+Dublin/M
+Dubrovnik/M
+Dubuque/M
+Duchamp/M
+Dudley/M
+Duffy/M
+Duisburg/M
+Duke/M
+Dulles/M
+Duluth/M
+Dumas/M
+Dumbledore/M
+Dumbo/M
+Dunant/M
+Dunbar/M
+Duncan/M
+Dundee
+Dunedin/M
+Dunkirk/M
+Dunlap/M
+Dunn/M
+Dunne/M
+Duracell/M
+Duran/M
+Durant/M
+Durante/M
+Durban/M
+Durer/M
+Durex/M
+Durham/MS
+Durkheim/M
+Duroc/M
+Durocher/M
+Duse/M
+Dushanbe/M
+Dusseldorf/M
+Dustbuster/M
+Dustin/M
+Dusty/M
+Dutch/M
+Dutchman/M
+Dutchmen/M
+Dutchwoman
+Duvalier/M
+Dvina/M
+Dvorak/M
+Dwayne/M
+Dwight/M
+Dy/M
+Dyer/M
+Dylan/M
+DynamoDB/M
+Dyson/M
+Dzerzhinsky/M
+Dzungaria/M
+E/SM
+EC
+ECG/M
+ECMAScript/M
+EDP/M
+EDT
+EEC/M
+EEG/M
+EEO
+EEOC
+EFL
+EFT
+EKG/M
+ELF/M
+EM
+EMT
+ENE/M
+EOE
+EPA/M
+ER
+ERA
+ESE/M
+ESL
+ESP/M
+ESPN/M
+ESR
+EST/M
+ET
+ETA
+ETD
+EU
+EULA/S
+Eakins/M
+Earhart/M
+Earl/M
+Earle/M
+Earlene/M
+Earline/M
+Earnest/M
+Earnestine/M
+Earnhardt/M
+Earp/M
+East/SZMR
+Easter/M
+Eastern/R
+Eastman/M
+Eastwood/M
+Eaton/M
+Eben/M
+Ebeneezer/M
+Ebert/M
+Ebola/M
+Ebonics/M
+Ebony/M
+Ebro/M
+Ecclesiastes/M
+Eco/M
+Ecstasy
+Ecuador/M
+Ecuadoran/SM
+Ecuadorean
+Ecuadorian/SM
+Ed/MNX
+Edam/SM
+Edda/M
+Eddie/M
+Eddington/M
+Eddy/M
+Eden/M
+Edgar/M
+Edgardo/M
+Edinburgh/M
+Edison/M
+Edith/M
+Edmond/M
+Edmonton/M
+Edmund/M
+Edna/M
+Edsel/M
+Eduardo/M
+Edward/SM
+Edwardian/M
+Edwardo/M
+Edwards/M
+Edwin/M
+Edwina/M
+Eeyore/M
+Effie/M
+Efrain/M
+Efren/M
+Eggo/M
+Egypt/M
+Egyptian/MS
+Egyptology/M
+Ehrenberg/M
+Ehrlich/M
+Eichmann/M
+Eiffel/M
+Eileen/M
+Einstein/MS
+Eire/M
+Eisenhower/M
+Eisenstein/M
+Eisner/M
+Elaine/M
+Elam/M
+Elanor/M
+Elasticsearch/M
+Elastoplast/M
+Elba/M
+Elbe/M
+Elbert/M
+Elbrus/M
+Eldersburg/M
+Eldon/M
+Eleanor/M
+Eleazar/M
+Electra/M
+Elena/M
+Elgar/M
+Eli/M
+Elias/M
+Elijah/M
+Elinor/M
+Eliot/M
+Elisa/M
+Elisabeth/M
+Elise/M
+Eliseo/M
+Elisha/M
+Eliza/M
+Elizabeth/M
+Elizabethan/SM
+Elizabethtown/M
+Elkhart/M
+Ella/M
+Ellen/M
+Ellesmere/M
+Ellie/M
+Ellington/M
+Elliot/M
+Elliott/M
+Ellis/M
+Ellison/M
+Elma/M
+Elmer/M
+Elmira/M
+Elmo/M
+Elnath/M
+Elnora/M
+Elohim/M
+Eloise/M
+Eloy/M
+Elroy/M
+Elsa/M
+Elsie/M
+Elsinore/M
+Eltanin/M
+Elton/M
+Elul/M
+Elva/M
+Elvia/M
+Elvin/M
+Elvira/M
+Elvis/M
+Elway/M
+Elwood/M
+Elyria/M
+Elysee/M
+Elysian/M
+Elysium/SM
+Emacs/M
+Emanuel/M
+Emerson/M
+Emery/M
+Emil/M
+Emile/M
+Emilia/M
+Emilio/M
+Emily/M
+Eminem/M
+Eminence
+Emma/M
+Emmanuel/M
+Emmett/M
+Emmy/M
+Emory/M
+Encarta/M
+Endymion/M
+Eng/M
+Engels/M
+England/M
+English/MRS
+Englishman/M
+Englishmen/M
+Englishwoman/M
+Englishwomen/M
+Enid/M
+Enif/M
+Eniwetok/M
+Enkidu/M
+Enoch/M
+Enos/M
+Enrico/M
+Enrique/M
+Enron/M
+Enterprise/M
+Eocene/M
+Epcot/M
+Ephesian/MS
+Ephesus/M
+Ephraim/M
+Epictetus/M
+Epicurean/M
+Epicurus/M
+Epimethius/M
+Epiphany/SM
+Episcopal
+Episcopalian/MS
+Epistle
+Epsom/M
+Epson/M
+Epstein/M
+Equuleus/M
+Er/M
+Erasmus/M
+Erato/M
+Eratosthenes/M
+Erebus/M
+Erector/M
+Erewhon/M
+Erhard/M
+Eric/M
+Erica/M
+Erich/M
+Erick/M
+Ericka/M
+Erickson/M
+Eridanus/M
+Erie/M
+Erik/M
+Erika/M
+Erin/M
+Eris/MS
+Eritrea/M
+Eritrean/SM
+Erlang/M
+Erlenmeyer/M
+Erma/M
+Erna/M
+Ernest/M
+Ernestine/M
+Ernesto/M
+Ernie/M
+Ernst/M
+Eros/MS
+Errol/M
+Erse/M
+ErvIn/M
+Erwin/M
+Esau/M
+Escher/M
+Escherichia/M
+Escondido
+Eskimo/MS
+Esmeralda/M
+Esperanto/M
+Esperanza/M
+Espinoza/M
+Esq/M
+Esquire/MS
+Essen/M
+Essene/M
+Essequibo/M
+Essex/M
+Essie/M
+Establishment
+Esteban/M
+Estela/M
+Estella/M
+Estelle/M
+Ester/M
+Esterhazy/M
+Estes/M
+Esther/M
+Estonia/M
+Estonian/SM
+Estrada/M
+Ethan/M
+Ethel/M
+Ethelred/M
+Ethernet/M
+Ethiopia/M
+Ethiopian/SM
+Etna/M
+Eton/M
+Etruria/M
+Etruscan/M
+Etta/M
+Eu/M
+Eucharist/MS
+Eucharistic
+Euclid/M
+Eugene/M
+Eugenia/M
+Eugenie/M
+Eugenio/M
+Eula/M
+Euler/M
+Eumenides/M
+Eunice/M
+Euphrates/M
+Eur
+Eurasia/M
+Eurasian/MS
+Euripides/M
+Eurodollar/SM
+Europa/M
+Europe/M
+European/MS
+Eurydice/M
+Eustachian/M
+Eustis/M
+Euterpe/M
+Eva/M
+Evan/SM
+Evangelical
+Evangelina/M
+Evangeline/M
+Evangelist/M
+Evans/M
+Evansville/M
+Eve/M
+Evelyn/M
+Evenki/M
+EverReady/M
+Everest/M
+Everett/M
+Everette/M
+Everglades/M
+Evert/M
+Evian/M
+Evita/M
+Ewing/M
+Excalibur/M
+Excedrin/M
+Excellency/SM
+Exchequer
+Exercycle/M
+Exocet/M
+Exodus/M
+Exxon/M
+Eyck/M
+Eyre/M
+Eysenck/M
+Ezekiel/M
+Ezra/M
+F/MD
+FAA
+FAQ/SM
+FBI/M
+FCC
+FD
+FDA
+FDIC/M
+FDR/M
+FHA/M
+FICA/M
+FIFO
+FL
+FM/SM
+FNMA/M
+FOFL
+FORTRAN/M
+FPO
+FSF/M
+FSLIC
+FTC
+FUD/S
+FWD
+FWIW
+FY
+FYI
+Faberge/M
+Fabian/MS
+Facebook/M
+Faeroe/M
+Fafnir/M
+Fagin/M
+Fahd/M
+Fahrenheit/M
+Fairbanks/M
+Fairfield/M
+Fairhope/M
+Faisal/M
+Faisalabad/M
+Faith/M
+Fajardo/M
+Falasha/M
+Falkland/SM
+Falklands/M
+Fallopian/M
+Falstaff/M
+Falwell/M
+Fannie/M
+Fanny/M
+Faraday/M
+Fargo/M
+Farley/M
+Farmer/M
+Farmington/M
+Farragut/M
+Farrakhan/M
+Farrell/M
+Farrow/M
+Farsi/M
+Fassbinder/M
+Fatah/M
+Fates/M
+Father/SM
+Fatima/M
+Fatimid/M
+Faulkner/M
+Faulknerian/M
+Fauntleroy/M
+Faust/M
+Faustian/M
+Faustino/M
+Faustus/M
+Fawkes/M
+Fay/M
+Faye/M
+Fayetteville/M
+Fe/M
+Feb/M
+February/SM
+Fed/SM
+FedEx/M
+Federal/MS
+Federalist/M
+Federico/M
+Feds/M
+Felecia/M
+Felice/M
+Felicia/M
+Felicity/M
+Felipe/M
+Felix/M
+Fellini/M
+Fenian/M
+Ferber/M
+Ferdinand/M
+Fergus/M
+Ferguson/M
+Ferlinghetti/M
+Fermat/M
+Fermi/M
+Fern/M
+Fernandez/M
+Fernando/M
+Ferrari/M
+Ferraro/M
+Ferrell/M
+Ferris/M
+Feynman/M
+Fez/M
+Fiat/M
+Fiberglas/M
+Fibonacci/M
+Fichte/M
+Fidel/M
+Fido/M
+Fielding/M
+Fields/M
+Figaro/M
+Figueroa/M
+Fiji/M
+Fijian/MS
+Filipino/MS
+Fillmore/M
+Filofax/M
+Finch/M
+Finland/M
+Finlay/M
+Finley/M
+Finn/SM
+Finnbogadottir/M
+Finnegan/M
+Finnish/M
+Fiona/M
+Firebase/M
+Firefox/M
+Firestone/M
+Fischer/M
+Fisher/M
+Fisk/M
+Fitch/M
+Fitchburg/M
+Fitzgerald/M
+Fitzpatrick/M
+Fitzroy/M
+Fizeau/M
+Fla
+Flagstaff/M
+Flanagan/M
+Flanders/M
+Flathead
+Flatt/M
+Flaubert/M
+Fleischer/M
+Fleming/M
+Flemish/M
+Fletcher/M
+Flint/M
+Flintstones/M
+Flo/M
+Flora/M
+Florence/M
+Florentine/M
+Flores/M
+Florida/M
+Floridan/M
+Floridian/SM
+Florine/M
+Florsheim/M
+Flory/M
+Flossie/M
+Flowers/M
+Floyd/M
+Flynn/M
+Fm/M
+Foch/M
+Fokker/M
+Foley/M
+Folgers/M
+Folsom/M
+Fomalhaut/M
+Fonda/M
+Foosball/M
+Forbes/M
+Ford/M
+Foreman/M
+Forest/MR
+Forester/M
+Formica/MS
+Formosa/M
+Formosan/M
+Forrest/M
+Forster/M
+Fortaleza/M
+Fosse/M
+Foster/M
+Fotomat/M
+Foucault/M
+Fourier/M
+Fourneyron/M
+Fourth
+Fowler/M
+Fox/MS
+Fr/MD
+Fragonard/M
+Fran/M
+France/SM
+Frances/M
+Francesca/M
+Francine/M
+Francis/M
+Francisca/M
+Franciscan/MS
+Francisco/M
+Franck/M
+Franco/M
+Francois/M
+Francoise/M
+Francophile
+Franglais/M
+Frank/SM
+Frankel/M
+Frankenstein/M
+Frankfort/M
+Frankfurt/MR
+Frankfurter/M
+Frankie/M
+Frankish
+Franklin/M
+Franks/M
+Franny/M
+Franz/M
+Fraser/M
+Frau/MN
+Fraulein
+Frazier/M
+Fred/M
+Freda/M
+Freddie/M
+Freddy/M
+Frederic/M
+Frederick/M
+Fredericksburg/M
+Fredericton/M
+Fredric/M
+Fredrick/M
+Freeman/M
+Freemason/SM
+Freemasonry/SM
+Freetown/M
+Freida/M
+Fremont/M
+French/MS
+Frenchman/M
+Frenchmen/M
+Frenchwoman/M
+Frenchwomen/M
+Freon/M
+Fresnel/M
+Fresno/M
+Freud/M
+Freudian/M
+Frey/M
+Freya/M
+Fri/M
+Friday/SM
+Frieda/M
+Friedan/M
+Friedman/M
+Friedmann/M
+Friend/SM
+Frigga/M
+Frigidaire/M
+Frisbee/M
+Frisco/M
+Frisian/MS
+Frito/M
+Fritz/M
+Frobisher/M
+Frodo/M
+Froissart/M
+Fromm/M
+Fronde/M
+Frontenac/M
+Frost/M
+Frostbelt/M
+Frunze/M
+Fry/M
+Frye/M
+Fuchs/M
+Fuentes/M
+Fugger/M
+Fuji/M
+Fujian/M
+Fujitsu/M
+Fujiwara/M
+Fujiyama/M
+Fukuoka/M
+Fukuyama/M
+Fulani/M
+Fulbright/M
+Fuller/M
+Fullerton/M
+Fulton/M
+Funafuti/M
+Fundy/M
+Furies/M
+Furman/M
+Furtwangler/M
+Fushun/M
+Fuzhou/M
+Fuzzbuster/M
+G/MNRB
+GA
+GAO
+GATT/M
+GB/M
+GCC/M
+GDP/M
+GE/M
+GED
+GHQ/M
+GHz
+GI
+GIF
+GIGO
+GM/M
+GMAT
+GMO
+GMT/M
+GNP/M
+GNU/M
+GOP/M
+GP/M
+GPA
+GPO
+GPS
+GPU
+GSA
+GTE/M
+GU
+GUI/M
+Ga/M
+Gable/M
+Gabon/M
+Gabonese/M
+Gaborone/M
+Gabriel/M
+Gabriela/M
+Gabrielle/M
+Gacrux/M
+Gadsden/M
+Gaea/M
+Gael/SM
+Gaelic/M
+Gagarin/M
+Gage/M
+Gaia/M
+Gail/M
+Gaiman/M
+Gaines/M
+Gainesville/M
+Gainsborough/M
+Galahad/SM
+Galapagos/M
+Galatea/M
+Galatia/M
+Galatians/M
+Galaxy
+Galbraith/M
+Gale/M
+Galen/M
+Galibi/M
+Galilean/SM
+Galilee/M
+Galileo/M
+Gall/M
+Gallagher/M
+Gallegos/M
+Gallic/M
+Gallicism/SM
+Gallo/M
+Galloway/M
+Gallup/M
+Galois/M
+Galsworthy/M
+Galvani/M
+Galveston/M
+Gama
+Gamay/M
+Gambia/M
+Gambian/SM
+Gamble/M
+Gamow/M
+Gandalf/M
+Gandhi/M
+Gandhian/M
+Ganesha/M
+Ganges/M
+Gangtok/M
+Gansu/M
+Gantry/M
+Ganymede/M
+Gap/M
+Garbo/M
+Garcia/M
+Gardner/M
+Gareth/M
+Garfield/M
+Garfunkel/M
+Gargantua/M
+Garibaldi/M
+Garland/M
+Garner/M
+Garrett/M
+Garrick/M
+Garrison/M
+Garry/M
+Garth/M
+Garvey/M
+Gary/M
+Garza/M
+Gascony/M
+Gasser/M
+Gastonia/M
+Gastroenterology
+Gates/M
+Gatling/M
+Gatorade/M
+Gatsby/M
+Gatun/M
+Gauguin/M
+Gaul/SM
+Gaulish
+Gauss/M
+Gaussian/M
+Gautama/M
+Gautier/M
+Gavin/M
+Gawain/M
+Gay/M
+Gayle/M
+Gaza/M
+Gaziantep/M
+Gd/M
+Gdansk/M
+Ge/M
+Geffen/M
+Gehenna/M
+Gehrig/M
+Geiger/M
+Gelbvieh/M
+Geller/M
+Gemini/MS
+Gen/M
+Gena/M
+Genaro/M
+Gene/M
+Genesis/M
+Genet/M
+Geneva/M
+Genevieve/M
+Genghis/M
+Genoa/SM
+Gentoo/M
+Gentry/M
+Geo/M
+Geoffrey/M
+George/MS
+Georgetown/M
+Georgette/M
+Georgia/M
+Georgian/MS
+Georgina/M
+Ger/M
+Gerald/M
+Geraldine/M
+Gerard/M
+Gerardo/M
+Gerber/M
+Gere/M
+Geritol/M
+German/MS
+Germanic/M
+Germany/M
+Geronimo/M
+Gerry/M
+Gershwin/M
+Gertrude/M
+Gestapo/SM
+Gethsemane/M
+Getty/M
+Gettysburg/M
+Gewurztraminer/M
+Ghana/M
+Ghanaian
+Ghats/M
+Ghazvanid/M
+Ghent/M
+Ghibelline/M
+Giacometti/M
+Giannini/M
+Giauque/M
+Gibbon/M
+Gibbs/M
+Gibraltar/MS
+Gibson/M
+Gide/M
+Gideon/M
+Gielgud/M
+Gienah/M
+Gil/M
+Gila/M
+Gilbert/M
+Gilberto/M
+Gilchrist/M
+Gilda/M
+Gilead/M
+Giles/M
+Gilgamesh/M
+Gill/M
+Gillespie/M
+Gillette/M
+Gilliam/M
+Gillian/M
+Gilligan/M
+Gilman
+Gilmore/M
+Gilroy/M
+Gina/M
+Ginger/M
+Gingrich/M
+Ginny/M
+Gino/M
+Ginsberg/M
+Ginsburg/M
+Ginsu/M
+Giorgione/M
+Giotto/M
+Giovanni/M
+Giraudoux/M
+Giselle/M
+Gish/M
+GitHub/M
+Giuliani/M
+Giuseppe/M
+Giza/M
+Gk
+Gladstone/MS
+Gladys/M
+Glaser/M
+Glasgow/M
+Glass/M
+Glastonbury/M
+Glaswegian/SM
+Glaxo/M
+Gleason/M
+Glen/M
+Glenda/M
+Glendale
+Glenlivet/M
+Glenn/M
+Glenna/M
+Gloria/M
+Gloucester/M
+Glover/M
+Gnostic/M
+Gnosticism/M
+GnuPG
+Goa/M
+Gobi/M
+God/M
+Godard/M
+Goddard/M
+Godel/M
+Godhead/M
+Godiva/M
+Godot/M
+Godspeed/SM
+Godthaab/M
+Godunov/M
+Godzilla/M
+Goebbels/M
+Goering/M
+Goethals/M
+Goethe/M
+Goff/M
+Gog/M
+Gogol/M
+Goiania/M
+Golan/M
+Golconda/M
+Golda/M
+Goldberg/M
+Golden/M
+Goldie/M
+Goldilocks/M
+Golding/M
+Goldman/M
+Goldsboro/M
+Goldsmith/M
+Goldwater/M
+Goldwyn/M
+Golgi/M
+Golgotha/M
+Goliath/M
+Gomez/M
+Gomorrah/M
+Gompers/M
+Gomulka/M
+Gondwanaland/M
+Gonzales/M
+Gonzalez/M
+Gonzalo/M
+Good/M
+Goodall/M
+Goode/M
+Goodman/M
+Goodrich/M
+Goodwill/M
+Goodwin/M
+Goodyear/M
+Google/M
+Goolagong/M
+Gopher
+Gorbachev/M
+Gordian/M
+Gordimer/M
+Gordon/M
+Gore/M
+Goren/M
+Gorey/M
+Gorgas/M
+Gorgon/M
+Gorgonzola/M
+Gorky/M
+Gospel/MS
+Goteborg/M
+Goth/M
+Gotham/M
+Gothic/MS
+Goths
+Gouda/SM
+Gould/M
+Gounod/M
+Governor
+Goya/M
+Gr/B
+Grable/M
+Gracchus/M
+Grace/M
+Graceland/M
+Gracie/M
+Graciela/M
+Grady/M
+Graffias/M
+Grafton/M
+Graham/M
+Grahame/M
+Grail/M
+Grammy/M
+Grampians/M
+Granada/M
+Grant/M
+Grass/M
+Graves/M
+Gray/M
+Grayslake/M
+Grecian/M
+Greece/M
+Greek/SM
+Greeley/M
+Green/SM
+Greene/M
+Greenland/M
+Greenlandic
+Greenpeace/M
+Greensboro/M
+Greensleeves/M
+Greenspan/M
+Greenville/M
+Greenwich/M
+Greer/M
+Greg/M
+Gregg/M
+Gregorian/M
+Gregorio/M
+Gregory/M
+Grenada/M
+Grenadian/MS
+Grenadines/M
+Grendel/M
+Grenoble/M
+Gresham/M
+Greta/M
+Gretchen/M
+Gretel/M
+Gretzky/M
+Grey/M
+Grieg/M
+Griffin/M
+Griffith/M
+Grimes/M
+Grimm/M
+Grinch/M
+Gris/M
+Gromyko/M
+Gropius/M
+Gross/M
+Grosz/M
+Grotius/M
+Grover/M
+Grozny
+Grumman/M
+Grundy/M
+Grunewald/M
+Grus/M
+Gruyere/SM
+Guadalajara/M
+Guadalcanal/M
+Guadalquivir/M
+Guadalupe/M
+Guadeloupe/M
+Guallatiri/M
+Guam/M
+Guamanian
+Guangdong/M
+Guangzhou/M
+Guantanamo/M
+Guarani/M
+Guarnieri/M
+Guatemala/M
+Guatemalan/MS
+Guayama/M
+Guayaquil/M
+Gucci/M
+Guelph/M
+Guernsey/MS
+Guerra/M
+Guerrero/M
+Guevara/M
+Guggenheim/M
+Guiana/M
+Guido
+Guillermo/M
+Guinea/M
+Guinean/MS
+Guinevere/M
+Guinness/M
+Guiyang/M
+Guizhou/M
+Guizot/M
+Gujarat/M
+Gujarati/M
+Gujranwala/M
+Gulfport/M
+Gullah/M
+Gulliver/M
+Gumbel/M
+Gunther/M
+Guofeng/M
+Gupta/M
+Gurkha/M
+Gus/M
+Gustav/M
+Gustavo/M
+Gustavus/M
+Gutenberg/M
+Guthrie/M
+Gutierrez/M
+Guy/M
+Guyana/M
+Guyanese/M
+Guzman/M
+Gwalior/M
+Gwen/M
+Gwendoline/M
+Gwendolyn/M
+Gwyn/M
+Gypsy/SM
+H/M
+HBO/M
+HBase/M
+HDD
+HDMI
+HDTV
+HF/M
+HHS
+HI
+HIV/M
+HM
+HMO/M
+HMS
+HOV
+HP/M
+HPV
+HQ/M
+HR
+HRH
+HS
+HSBC/M
+HST
+HT
+HTML/M
+HTTP
+HUD/M
+Ha/M
+Haas/M
+Habakkuk/M
+Haber/M
+Hadar/M
+Hades/M
+Hadoop/M
+Hadrian/M
+Hafiz/M
+Hagar/M
+Hagerstown/M
+Haggai/M
+Hagiographa/M
+Hague/M
+Hahn/M
+Haida/SM
+Haifa/M
+Hainan/M
+Haiphong/M
+Haiti/M
+Haitian/MS
+Hakka/M
+Hakluyt/M
+Hal/SM
+Haldane/M
+Hale/M
+Haleakala/M
+Haley/M
+Halifax/M
+Hall/M
+Halley/M
+Halliburton/M
+Hallie/M
+Hallmark/M
+Halloween/MS
+Hallstatt/M
+Halon/M
+Hals/M
+Halsey/M
+Ham/M
+Haman/M
+Hamburg/MS
+Hamhung/M
+Hamilcar/M
+Hamill/M
+Hamilton/M
+Hamiltonian/M
+Hamitic/M
+Hamlet/M
+Hamlin/M
+Hammarskjold/M
+Hammerstein/M
+Hammett/M
+Hammond/M
+Hammurabi/M
+Hampshire/M
+Hampton/M
+Hamsun/M
+Han/SM
+Hancock/M
+Handel/M
+Handy/M
+Haney/M
+Hanford/M
+Hangul/M
+Hangzhou/M
+Hank/M
+Hanna/M
+Hannah/M
+Hannibal/M
+Hanoi/M
+Hanover/M
+Hanoverian/M
+Hans/MN
+Hansel/M
+Hansen/M
+Hanson/M
+Hanuka
+Hanukkah/M
+Hanukkahs
+Hapsburg/M
+Harare/M
+Harbin/M
+Hardin/M
+Harding/M
+Hardy/M
+Hargreaves/M
+Harlan/M
+Harlem/M
+Harlequin/M
+Harley/M
+Harlingen/M
+Harlow/M
+Harmon/M
+Harold/M
+Harper/M
+Harpy/SM
+Harrell/M
+Harriet/M
+Harriett/M
+Harrington/M
+Harris/M
+Harrisburg/M
+Harrison/M
+Harrisonburg/M
+Harrods/M
+Harry/M
+Hart/M
+Harte/M
+Hartford/M
+Hartline/M
+Hartman/M
+Harvard/M
+Harvey/M
+Hasbro/M
+Hasidim/M
+Haskell/M
+Hastings/M
+Hatfield/M
+Hathaway/M
+Hatsheput/M
+Hatteras/M
+Hattie/M
+Hattiesburg/M
+Hauptmann/M
+Hausa/M
+Hausdorff/M
+Havana/MS
+Havarti/M
+Havel/M
+Havoline/M
+Haw
+Hawaii/M
+Hawaiian/SM
+Hawking/M
+Hawkins/M
+Hawks
+Hawthorne/M
+Hay/SM
+Hayden/M
+Haydn/M
+Hayek/M
+Hayes/M
+Haynes/M
+Hays/M
+Hayward/M
+Haywood/M
+Hayworth/M
+Hazel/M
+Hazleton/M
+Hazlitt/M
+He/M
+Head/M
+Hearst/M
+Heath/MR
+Heather/M
+Heaviside/M
+Heb
+Hebe/M
+Hebei/M
+Hebert/M
+Hebraic/M
+Hebraism/SM
+Hebrew/MS
+Hebrews/M
+Hebrides/M
+Hecate/M
+Hector/M
+Hecuba/M
+Heep/M
+Hefner/M
+Hegel/M
+Hegelian/M
+Hegira/M
+Heidegger/M
+Heidelberg/M
+Heidi/M
+Heifetz/M
+Heilongjiang/M
+Heimlich/M
+Heine/M
+Heineken/M
+Heinlein/M
+Heinrich/M
+Heinz/M
+Heisenberg/M
+Heisman/M
+Helen/M
+Helena/M
+Helene/M
+Helga/M
+Helicobacter
+Helicon/M
+Heliopolis/M
+Helios/M
+Hellene/SM
+Hellenic/M
+Hellenism/MS
+Hellenist
+Hellenistic/M
+Hellenization/M
+Hellenize/M
+Heller/M
+Hellespont/M
+Hellman/M
+Helmholtz/M
+Heloise/M
+Helsinki/M
+Helvetian
+Helvetius/M
+Hemet/M
+Hemingway/M
+Henan/M
+Hench/M
+Henderson/M
+Hendrick/MS
+Hendricks/M
+Hendrix/M
+Henley/M
+Hennessy/M
+Henri/M
+Henrietta/M
+Henrik/M
+Henry/M
+Hensley/M
+Henson/M
+Hepburn/M
+Hephaestus/M
+Hepplewhite/M
+Hera/M
+Heracles/M
+Heraclitus/M
+Herakles/M
+Herbart/M
+Herbert/M
+Herculaneum/M
+Herculean
+Hercules/M
+Herder/M
+Hereford/SM
+Herero/M
+Heriberto/M
+Herman/M
+Hermaphroditus/M
+Hermes/M
+Herminia/M
+Hermitage/M
+Hermite/M
+Hermosillo/M
+Hernandez/M
+Herod/M
+Herodotus/M
+Heroku/M
+Herr/MG
+Herrera/M
+Herrick/M
+Herring/M
+Herschel/M
+Hersey/M
+Hershel/M
+Hershey/M
+Hertz/M
+Hertzsprung/M
+Herzegovina/M
+Herzl/M
+Heshvan/M
+Hesiod/M
+Hesperia/M
+Hesperus/M
+Hess/M
+Hesse/M
+Hessian/M
+Hester/M
+Heston/M
+Hettie/M
+Hewitt/M
+Hewlett/M
+Heyerdahl/M
+Heywood/M
+Hezbollah/M
+Hezekiah/M
+Hf/M
+Hg/M
+Hialeah/M
+Hiawatha/M
+Hibernia/M
+Hibernian
+Hickman/M
+Hickok/M
+Hickory/M
+Hicks/M
+Hieronymus/M
+Higashiosaka
+Higgins/M
+Highlander/SM
+Highlands
+Highness/M
+Hightstown/M
+Hilario/M
+Hilary/M
+Hilbert/M
+Hilda/M
+Hildebrand/M
+Hilfiger/M
+Hill/M
+Hillary/M
+Hillel/M
+Hilton/M
+Himalaya/SM
+Himalayan
+Himalayas/M
+Himmler/M
+Hinayana/M
+Hindemith/M
+Hindenburg/M
+Hindi/M
+Hindu/SM
+Hinduism/SM
+Hindustan/M
+Hindustani/SM
+Hines/M
+Hinesville/M
+Hinton/M
+Hipparchus/M
+Hippocrates/M
+Hippocratic/M
+Hiram/M
+Hirobumi/M
+Hirohito/M
+Hiroshima/M
+Hispanic/SM
+Hispaniola/M
+Hiss/M
+Hitachi/M
+Hitchcock/M
+Hitler/MS
+Hittite/SM
+Hmong/M
+Ho/M
+Hobart/M
+Hobbes/M
+Hobbs/M
+Hockney/M
+Hodge/SM
+Hodges/M
+Hodgkin/M
+Hoff/M
+Hoffa/M
+Hoffman/M
+Hofstadter/M
+Hogan/M
+Hogarth/M
+Hogwarts/M
+Hohenlohe/M
+Hohenstaufen/M
+Hohenzollern/M
+Hohhot/M
+Hohokam/M
+Hokkaido/M
+Hokusai/M
+Holbein/M
+Holcomb/M
+Holden/M
+Holder/M
+Holiday/M
+Holiness
+Holland/ZSMR
+Hollander/M
+Hollerith/M
+Holley/M
+Hollie/M
+Hollis/M
+Holloway/M
+Holly/M
+Hollywood/M
+Holman/M
+Holmes/M
+Holocaust/M
+Holocene/M
+Holst/M
+Holstein/SM
+Holt/M
+Homer/M
+Homeric/M
+Hon
+Honda/M
+Honduran/MS
+Honduras/M
+Honecker/M
+Honeywell/M
+Hong
+Honiara/M
+Honolulu/M
+Honorable
+Honshu/M
+Hood/M
+Hooke/RM
+Hooker/M
+Hooper/M
+Hoosier/MS
+Hooters/M
+Hoover/MS
+Hope/M
+Hopewell/M
+Hopi/SM
+Hopkins/M
+Hopper/M
+Horace/M
+Horacio/M
+Horatio/M
+Hormel/M
+Hormuz/M
+Horn/M
+Hornblower/M
+Horne/M
+Horowitz/M
+Horthy/M
+Horton/M
+Horus/M
+Hosea/M
+Host/SM
+Hotpoint/M
+Hottentot/SM
+Houdini/M
+Houma/M
+House/M
+Housman/M
+Houston/M
+Houyhnhnm/M
+Hovhaness/M
+Howard/M
+Howe/M
+Howell/MS
+Howells/M
+Howrah
+Hoyle/M
+Hrothgar/M
+Hts
+Huang/M
+Hubbard/M
+Hubble/M
+Hubei/M
+Huber/M
+Hubert/M
+Huck/M
+Huddersfield
+Hudson/M
+Huerta/M
+Huey/M
+Huff/M
+Huffman/M
+Huggins/M
+Hugh/MS
+Hughes/M
+Hugo/M
+Huguenot/MS
+Hui/M
+Huitzilopotchli/M
+Hull/M
+Humberto/M
+Humboldt/M
+Hume/M
+Hummel/M
+Hummer/M
+Humphrey/SM
+Humvee/M
+Hun/SM
+Hunan/M
+Hung/M
+Hungarian/SM
+Hungary/M
+Hunspell/M
+Hunt/MR
+Hunter/M
+Huntington/M
+Huntley/M
+Huntsville/M
+Hurd/M
+Hurley/M
+Huron/M
+Hurst/M
+Hus/M
+Hussein/M
+Husserl/M
+Hussite/M
+Huston/M
+Hutchinson/M
+Hutton/M
+Hutu/M
+Huxley/M
+Huygens/M
+Hyades/M
+Hyde/M
+Hyderabad/M
+Hydra/M
+Hymen/M
+Hyperion/M
+Hyundai/M
+Hz/M
+I'd
+I'll
+I'm
+I've
+I/M
+IA
+IBM/M
+ICBM/SM
+ICC
+ICU
+ID/SM
+IDE
+IE
+IED
+IEEE
+IKEA/M
+IL
+IMF/M
+IMHO
+IMNSHO
+IMO
+IN
+ING/M
+INRI
+INS
+IOU/M
+IP
+IPA
+IPO
+IQ/M
+IRA/SM
+IRC
+IRS/M
+ISBN
+ISIS
+ISO/M
+ISP
+ISS
+IT
+IUD
+IV/SM
+IVF
+Ia
+Iaccoca/M
+Iago/M
+Ian/M
+Iapetus/M
+Ibadan/M
+Iberia/M
+Iberian/M
+Ibiza/M
+Iblis/M
+Ibo/M
+Ibsen/M
+Icahn/M
+Icarus/M
+Ice
+Iceland/MRZ
+Icelander/M
+Icelandic/M
+Ida/M
+Idaho/SM
+Idahoan/MS
+Idahoes
+Ieyasu/M
+Ignacio/M
+Ignatius/M
+Igor/M
+Iguassu/M
+Ijsselmeer/M
+Ike/M
+Ikhnaton/M
+Ila/M
+Ilene/M
+Iliad/SM
+Ill
+Illinois/M
+Illinoisan/MS
+Illuminati/M
+Ilyushin/M
+Imelda/M
+Imhotep/M
+Imodium/M
+Imogene/M
+Imus/M
+In/M
+Ina/M
+Inc
+Inca/SM
+Inchon/M
+Incorporated
+Ind
+Independence/M
+India/M
+Indian/MS
+Indiana/M
+Indianan/SM
+Indianapolis/M
+Indianian
+Indies/M
+Indio/M
+Indira/M
+Indochina/M
+Indochinese/M
+Indonesia/M
+Indonesian/SM
+Indore/M
+Indra/M
+Indus/M
+Indy/SM
+Ines/M
+Inez/M
+Inge/M
+Inglewood
+Ingram/M
+Ingres/M
+Ingrid/M
+Innocent/M
+Innsbruck
+Inonu/M
+Inquisition/M
+Inst
+Instagram/M
+Instamatic/M
+Intel/M
+Intelsat/M
+Internationale/M
+Internet/SM
+Interpol/M
+Inuit/MS
+Inuktitut/M
+Invar/M
+Io/M
+Ionesco/M
+Ionian/MS
+Ionic/SM
+Iowa/SM
+Iowan/MS
+Iphigenia/M
+Ipswich
+Iqaluit/M
+Iqbal/M
+Iquitos/M
+Ir/M
+Ira/M
+Iran/M
+Iranian/SM
+Iraq/M
+Iraqi/MS
+Ireland/M
+Irene/M
+Iris/M
+Irish/MR
+Irishman/M
+Irishmen/M
+Irishwoman/M
+Irishwomen/M
+Irkutsk/M
+Irma/M
+Iroquoian/SM
+Iroquois/M
+Irrawaddy/M
+Irtish/M
+Irvin/M
+Irvine/M
+Irving/M
+Irwin/M
+Isaac/M
+Isabel/M
+Isabela/M
+Isabella/M
+Isabelle/M
+Isaiah/M
+Iscariot/M
+Isfahan/M
+Isherwood/M
+Ishim/M
+Ishmael/M
+Ishtar/M
+Isiah/M
+Isidro/M
+Isis/M
+Islam/MS
+Islamabad/M
+Islamic/M
+Islamism/M
+Islamist/M
+Islamophobia
+Islamophobic
+Ismael/M
+Ismail/M
+Isolde/M
+Ispell/M
+Israel/SM
+Israeli/SM
+Israelite/M
+Issac/M
+Issachar/M
+Istanbul/M
+Isuzu/M
+It
+Itaipu/M
+Ital
+Italian/SM
+Italianate
+Italy/M
+Itasca/M
+Ithaca/M
+Ithacan/M
+Ito/M
+Iva/M
+Ivan/M
+Ivanhoe/M
+Ives/M
+Ivorian
+Ivory/M
+Ivy/M
+Iyar/M
+Izaak/M
+Izanagi/M
+Izanami/M
+Izhevsk/M
+Izmir/M
+Izod/M
+Izvestia/M
+J/MD
+JCS
+JD
+JFK/M
+JP
+JPEG
+JV
+Jack/M
+Jackie/M
+Jacklyn/M
+Jackson/M
+Jacksonian/M
+Jacksonville/M
+Jacky/M
+Jaclyn/M
+Jacob/SM
+Jacobean/M
+Jacobi/M
+Jacobin/M
+Jacobite/M
+Jacobs/M
+Jacobson/M
+Jacquard/M
+Jacqueline/M
+Jacquelyn/M
+Jacques/M
+Jacuzzi/M
+Jagger/M
+Jagiellon/M
+Jaguar/M
+Jahangir/M
+Jaime/M
+Jain/M
+Jainism/M
+Jaipur/M
+Jakarta/M
+Jake/M
+Jamaal/M
+Jamaica/M
+Jamaican/SM
+Jamal/M
+Jamar/M
+Jame/SM
+Jamel/M
+James/M
+Jamestown/M
+Jami/M
+Jamie/M
+Jan/M
+Jana/M
+Janacek/M
+Jane/M
+Janell/M
+Janelle/M
+Janesville/M
+Janet/M
+Janette/M
+Janice/M
+Janie/M
+Janine/M
+Janis/M
+Janissary/M
+Janjaweed/M
+Janna/M
+Jannie/M
+Jansen/M
+Jansenist/M
+January/SM
+Janus/M
+Jap/SM
+Japan/M
+Japanese/MS
+Japura/M
+Jared/M
+Jarlsberg/M
+Jarred/M
+Jarrett/M
+Jarrod/M
+Jarvis/M
+Jasmine/M
+Jason/M
+Jasper/M
+Jataka/M
+Java/SM
+JavaScript/M
+Javanese/M
+Javier/M
+Jaxartes/M
+Jay/M
+Jayapura/M
+Jayawardene/M
+Jaycee/MS
+Jaycees/M
+Jayne/M
+Jayson/M
+Jean/M
+Jeanette/M
+Jeanie/M
+Jeanine/M
+Jeanne/M
+Jeannette/M
+Jeannie/M
+Jeannine/M
+Jed/M
+Jedi/M
+Jeep/M
+Jeeves/M
+Jeff/M
+Jefferey/M
+Jefferson/M
+Jeffersonian/M
+Jeffery/M
+Jeffrey/M
+Jeffry/M
+Jehoshaphat/M
+Jehovah/M
+Jekyll/M
+Jenifer/M
+Jenkins/M
+Jenna/M
+Jenner/M
+Jennie/M
+Jennifer/M
+Jennings/M
+Jenny/M
+Jensen/M
+Jephthah/M
+Jerald/M
+Jeremiah/M
+Jeremiahs
+Jeremy/M
+Jeri/M
+Jericho/M
+Jermaine/M
+Jeroboam/M
+Jerold/M
+Jerome/M
+Jerri/M
+Jerrod/M
+Jerrold/M
+Jerry/M
+Jersey/MS
+Jerusalem/M
+Jess/M
+Jesse/M
+Jessica/M
+Jessie/M
+Jesuit/MS
+Jesus/M
+Jetway/M
+Jew/SM
+Jewel/M
+Jewell/M
+Jewess/MS
+Jewish/PM
+Jewry/M
+Jezebel/SM
+Jiangsu/M
+Jiangxi/M
+Jidda/M
+Jilin/M
+Jill/M
+Jillian/M
+Jim/M
+Jimenez/M
+Jimmie/M
+Jimmy/M
+Jinan/M
+Jinnah/M
+Jinny/M
+Jivaro/M
+Jo/M
+Joan/M
+Joann/M
+Joanna/M
+Joanne/M
+Joaquin/M
+Job/SM
+Jobs/M
+Jocasta/M
+Jocelyn/M
+Jock/M
+Jockey/M
+Jodi/M
+Jodie/M
+Jody/M
+Joe/M
+Joel/M
+Joey/M
+Jogjakarta/M
+Johann/M
+Johanna/M
+Johannes/M
+Johannesburg/M
+John/SM
+Johnathan/M
+Johnathon/M
+Johnie/M
+Johnnie/M
+Johnny/M
+Johns/M
+Johnson/M
+Johnston/M
+Johnstown/M
+Jolene/M
+Jolson/M
+Jon/M
+Jonah/M
+Jonahs
+Jonas/M
+Jonathan/M
+Jonathon/M
+Jones/M
+Jonesboro/M
+Joni/M
+Jonson/M
+Joplin/M
+Jordan/M
+Jordanian/MS
+Jorge/M
+Jose/M
+Josef/M
+Josefa/M
+Josefina/M
+Joseph/M
+Josephine/M
+Josephs
+Josephson/M
+Josephus/M
+Josh/M
+Joshua/M
+Josiah/M
+Josie/M
+Josue/M
+Joule/M
+Jove/M
+Jovian/M
+Joy/M
+Joyce/M
+Joycean/M
+Joyner/M
+Jpn
+Jr/M
+Juan/M
+Juana/M
+Juanita/M
+Juarez/M
+Jubal/M
+Judaeo
+Judah/M
+Judaic
+Judaical
+Judaism/MS
+Judas/MS
+Judd/M
+Jude/M
+Judea/M
+Judges
+Judith/M
+Judson/M
+Judy/M
+Juggernaut/M
+Jul
+Jules/M
+Julia/M
+Julian/M
+Juliana/M
+Julianne/M
+Julie/M
+Juliet/M
+Juliette/M
+Julio/M
+Julius/M
+Julliard/M
+July/SM
+Jun/M
+June/SM
+Juneau/M
+Jung/M
+Jungfrau/M
+Jungian/M
+Junior/SM
+Junker/SM
+Juno/M
+Jupiter/M
+Jurassic/M
+Jurua/M
+Justice/M
+Justin/M
+Justine/M
+Justinian/M
+Jutland/M
+Juvenal/M
+K/SMNGJ
+KB/M
+KC
+KFC/M
+KGB/M
+KIA
+KKK/M
+KO/M
+KP
+KS
+KY
+Kaaba/M
+Kabul/M
+Kafka/M
+Kafkaesque/M
+Kagoshima/M
+Kahlua/M
+Kahului/M
+Kaifeng/M
+Kailua/M
+Kaiser/MS
+Kaitlin/M
+Kalahari/M
+Kalamazoo/M
+Kalashnikov/M
+Kalb/M
+Kalevala/M
+Kalgoorlie/M
+Kali/M
+Kalmyk/M
+Kama/M
+Kamchatka/M
+Kamehameha/M
+Kampala/M
+Kampuchea/M
+Kan/SM
+Kanchenjunga/M
+Kandahar/M
+Kandinsky/M
+Kane/M
+Kaneohe/M
+Kankakee/M
+Kannada/M
+Kano/M
+Kanpur/M
+Kansan/MS
+Kansas/M
+Kant/M
+Kantian/M
+Kaohsiung/M
+Kaposi/M
+Kara/M
+Karachi/M
+Karaganda/M
+Karakorum/M
+Karamazov/M
+Kareem/M
+Karen/M
+Karenina/M
+Kari/M
+Karin/M
+Karina/M
+Karl/M
+Karla/M
+Karloff/M
+Karo/M
+Karol/M
+Karroo/M
+Karyn/M
+Kasai/M
+Kasey/M
+Kashmir/SM
+Kasparov/M
+Kate/M
+Katelyn/M
+Katharine/M
+Katherine/M
+Katheryn/M
+Kathiawar/M
+Kathie/M
+Kathleen/M
+Kathmandu/M
+Kathrine/M
+Kathryn/M
+Kathy/M
+Katie/M
+Katina/M
+Katmai/M
+Katowice/M
+Katrina/M
+Katy/M
+Kauai/M
+Kaufman/M
+Kaunas/M
+Kaunda/M
+Kawabata/M
+Kawasaki/M
+Kay/M
+Kaye/M
+Kayla/M
+Kazakh/M
+Kazakhs
+Kazakhstan/M
+Kazan/M
+Kazantzakis/M
+Kb/M
+Keaton/M
+Keats/M
+Keck/M
+Keenan/M
+Keewatin/M
+Keillor/M
+Keisha/M
+Keith/M
+Keller/M
+Kelley/M
+Kelli/M
+Kellie/M
+Kellogg/M
+Kelly/M
+Kelsey/M
+Kelvin/M
+Kemerovo/M
+Kemp/M
+Kempis/M
+Ken/M
+Kendall/M
+Kendra/M
+Kendrick/M
+Kenmore/M
+Kennan/M
+Kennedy/M
+Kenneth/M
+Kennewick/M
+Kennith/M
+Kenny/M
+Kenosha/M
+Kent/M
+Kenton/M
+Kentuckian/MS
+Kentucky/M
+Kenya/M
+Kenyan/SM
+Kenyatta/M
+Kenyon/M
+Keogh/M
+Keokuk/M
+Kepler/M
+Kerensky/M
+Keri/M
+Kermit/M
+Kern/M
+Kerouac/M
+Kerr/M
+Kerri/M
+Kerry/M
+Kettering/M
+Keven/M
+Kevin/M
+Kevlar/M
+Kevorkian/M
+Kewpie/M
+Key/M
+Keynes/M
+Keynesian/M
+Khabarovsk/M
+Khachaturian/M
+Khalid/M
+Khan/M
+Kharkov/M
+Khartoum/M
+Khayyam/M
+Khazar/M
+Khmer/M
+Khoikhoi/M
+Khoisan/M
+Khomeini/M
+Khorana/M
+Khrushchev/M
+Khufu/M
+Khulna/M
+Khwarizmi/M
+Khyber/M
+Kickapoo/M
+Kidd/M
+Kiel/M
+Kierkegaard/M
+Kieth/M
+Kiev/M
+Kigali/M
+Kikuyu/M
+Kilauea/M
+Kilimanjaro/M
+Killeen/M
+Kilroy/M
+Kim/M
+Kimberley/M
+Kimberly/M
+King/M
+Kingsport/M
+Kingston/M
+Kingstown/M
+Kinko's
+Kinney/M
+Kinsey/M
+Kinshasa/M
+Kiowa/MS
+Kip/M
+Kipling/M
+Kirby/M
+Kirchhoff/M
+Kirchner/M
+Kirghistan/M
+Kirghiz/M
+Kirghizia/M
+Kiribati/M
+Kirinyaga/M
+Kirk/M
+Kirkland/M
+Kirkpatrick/M
+Kirov/M
+Kirsten/M
+Kisangani/M
+Kishinev/M
+Kislev/M
+Kissimmee/M
+Kissinger/M
+Kit/M
+Kitakyushu/M
+Kitchener/M
+Kitty/M
+Kiwanis/M
+Klan/M
+Klansman/M
+Klaus/M
+Klee/M
+Kleenex/MS
+Klein/M
+Klimt/M
+Kline/M
+Klingon/M
+Klondike/MS
+Kmart/M
+Knapp/M
+Knesset/M
+Kngwarreye/M
+Knickerbocker/M
+Knievel/M
+Knight/M
+Knopf/M
+Knossos/M
+Knowles/M
+Knox/M
+Knoxville/M
+Knudsen/M
+Knuth/M
+Knuths
+Kobe/M
+Koch/M
+Kochab/M
+Kodachrome/M
+Kodak/M
+Kodaly/M
+Kodiak/M
+Koestler/M
+Kohinoor/M
+Kohl/M
+Koizumi/M
+Kojak/M
+Kokomo/M
+Kolyma/M
+Kommunizma/M
+Kong/M
+Kongo/M
+Konrad/M
+Koontz/M
+Koppel/M
+Korea/M
+Korean/SM
+Kornberg/M
+Kory/M
+Korzybski/M
+Kosciusko/M
+Kossuth/M
+Kosygin/M
+Kotlin/M
+Koufax/M
+Kowloon/M
+Kr/M
+Kraft/M
+Krakatoa/M
+Krakow/M
+Kramer/M
+Krasnodar/M
+Krasnoyarsk/M
+Krebs/M
+Kremlin/M
+Kremlinologist
+Kremlinology
+Kresge/M
+Kringle/M
+Kris/M
+Krishna/M
+Krishnamurti/M
+Krista/M
+Kristen/M
+Kristi/M
+Kristie/M
+Kristin/M
+Kristina/M
+Kristine/M
+Kristopher/M
+Kristy/M
+Kroc/M
+Kroger/M
+Kronecker/M
+Kropotkin/M
+Kruger/M
+Krugerrand/M
+Krupp/M
+Krystal/M
+Kshatriya/M
+Kublai/M
+Kubrick/M
+Kuhn/M
+Kuibyshev/M
+Kulthumm/M
+Kunming/M
+Kuomintang/M
+Kurd/M
+Kurdish/M
+Kurdistan/M
+Kurosawa/M
+Kurt/M
+Kurtis/M
+Kusch/M
+Kutuzov/M
+Kuwait/M
+Kuwaiti/SM
+Kuznets/M
+Kuznetsk/M
+Kwakiutl/M
+Kwan/M
+Kwangju/M
+Kwanzaa/MS
+Ky/MH
+Kyle/M
+Kyoto/M
+Kyrgyzstan/M
+Kyushu/M
+L'Amour/M
+L'Enfant
+L'Oreal/M
+L'Ouverture/M
+L/MN
+LA
+LAN/M
+LBJ/M
+LC
+LCD/M
+LCM
+LDC
+LED/M
+LG/M
+LGBT
+LIFO
+LL
+LLB/M
+LLD/M
+LNG
+LOGO
+LP/M
+LPG
+LPN/SM
+LSAT
+LSD/M
+LVN
+La/SM
+Lab
+Laban/M
+Labrador/SM
+Labradorean
+Lacey/M
+Lachesis/M
+Lactobacillus
+Lacy/M
+Ladoga/M
+Ladonna/M
+Lady/M
+Ladyship/MS
+Lafayette/M
+Lafitte/M
+Lagos/M
+Lagrange/M
+Lagrangian/M
+Lahore/M
+Laius/M
+Lajos/M
+Lakeisha/M
+Lakeland/M
+Lakewood
+Lakisha/M
+Lakota/M
+Lakshmi/M
+Lamaism/SM
+Lamar/M
+Lamarck/M
+Lamaze/M
+Lamb/M
+Lambert/M
+Lamborghini/M
+Lambrusco/M
+Lamentations
+Lamont/M
+Lana/M
+Lanai/M
+Lancashire/M
+Lancaster/M
+Lance/M
+Lancelot/M
+Land/M
+Landon/M
+Landry/M
+Landsat/M
+Landsteiner/M
+Lane/M
+Lang/M
+Langerhans/M
+Langland/M
+Langley/M
+Langmuir/M
+Lanka/M
+Lankan/M
+Lanny/M
+Lansing/M
+Lanzhou/M
+Lao/SM
+Laocoon/M
+Laos/M
+Laotian/SM
+Laplace/M
+Laplacian
+Lapland/MR
+Lapp/SM
+Lara/M
+Laramie/M
+Lardner/M
+Laredo/M
+Larousse/M
+Larry/M
+Lars/MN
+Larsen/M
+Larson/M
+Lascaux/M
+Lassa/M
+Lassen/M
+Lassie/M
+Lat/M
+Latasha/M
+Lateran/M
+Latham/M
+Latin/MRS
+Latina
+Latino/SM
+Latinx
+Latisha/M
+Latonya/M
+Latoya/M
+Latrobe/M
+Latvia/M
+Latvian/MS
+Laud/MR
+Lauder/M
+Laue/M
+Laundromat/M
+Laura/M
+Laurasia/M
+Laurel/M
+Lauren/M
+Laurence/M
+Laurent/M
+Lauri/M
+Laurie/M
+Laval/M
+Lavern/M
+Laverne/M
+Lavoisier/M
+Lavonne/M
+Lawanda/M
+Lawrence/M
+Lawson/M
+Lawton/M
+Layamon/M
+Layla/M
+Layton/M
+Lazaro/M
+Lazarus/M
+Le/SM
+Lea/M
+Leach/M
+Leadbelly/M
+Leah/M
+Leakey/M
+Lean/M
+Leander/M
+Leann/M
+Leanna/M
+Leanne/M
+Lear/M
+Learjet/M
+Leary/M
+Leavenworth/M
+Lebanese/M
+Lebanon/M
+Lebesgue/M
+Leblanc/M
+Leda/M
+Lederberg/M
+Lee/M
+Leeds/M
+Leesburg/M
+Leeuwenhoek/M
+Leeward/M
+Left
+Legendre/M
+Leger/M
+Leghorn/M
+Lego/M
+Legree/M
+Lehman/M
+Leibniz/M
+Leicester/SM
+Leiden/M
+Leif/M
+Leigh/M
+Leila/M
+Leipzig/M
+Lela/M
+Leland/M
+Lelia/M
+Lemaitre/M
+Lemuel/M
+Lemuria/M
+Len/M
+Lena/M
+Lenard/M
+Lenin/M
+Leningrad/M
+Leninism/M
+Leninist/M
+Lennon/M
+Lenny/M
+Leno/M
+Lenoir/M
+Lenora/M
+Lenore/M
+Lent/SMN
+Lenten/M
+Leo/SM
+Leola/M
+Leominster/M
+Leon/M
+Leona/M
+Leonard/M
+Leonardo/M
+Leoncavallo/M
+Leonel/M
+Leonid/M
+Leonidas/M
+Leonor/M
+Leopold/M
+Leopoldo/M
+Lepidus/M
+Lepke/M
+Lepus/M
+Lerner/M
+Leroy/M
+Les/M
+Lesa/M
+Lesley/M
+Leslie/M
+Lesotho/M
+Lesseps/M
+Lessie/M
+Lester/M
+Lestrade/M
+Leta/M
+Letha/M
+Lethe/M
+Leticia/M
+Letitia/M
+Letterman/M
+Levant/M
+Levesque/M
+Levi/SM
+Leviathan/M
+Levine/M
+Leviticus/M
+Levitt/M
+Levy/M
+Lew/M
+Lewinsky/M
+Lewis/M
+Lewiston/M
+Lewisville/M
+Lexington/M
+Lexus/M
+Lhasa/MS
+Lhotse/M
+Li/MY
+Liaoning/M
+Libby/M
+Liberace/M
+Liberal
+Liberia/M
+Liberian/SM
+Libra/MS
+LibreOffice/M
+Libreville/M
+Librium/M
+Libya/M
+Libyan/SM
+Lichtenstein/M
+Lidia/M
+Lie/M
+Lieberman/M
+Liebfraumilch/M
+Liechtenstein/ZMR
+Liechtensteiner/M
+Liege/M
+Lieut
+Lila/M
+Lilia/M
+Lilian/M
+Liliana/M
+Lilith/M
+Liliuokalani/M
+Lille/M
+Lillian/M
+Lillie/M
+Lilliput/M
+Lilliputian/MS
+Lilly/M
+Lilongwe/M
+Lily/M
+Lima/M
+Limbaugh/M
+Limbo
+Limburger/M
+Limoges/M
+Limousin/M
+Limpopo/M
+Lin/M
+Lina/M
+Lincoln/MS
+Lind/M
+Linda/M
+Lindbergh/M
+Lindsay/M
+Lindsey/M
+Lindy/M
+Linnaeus/M
+Linotype/M
+Linton/M
+Linus/M
+Linux/MS
+Linwood/M
+Lionel/M
+Lipizzaner/M
+Lippi/M
+Lippmann/M
+Lipscomb/M
+Lipton/M
+Lisa/M
+Lisbon/M
+Lissajous/M
+Lister/M
+Listerine/M
+Liston/M
+Liszt/M
+Lithuania/M
+Lithuanian/MS
+Little/M
+Litton/M
+Livermore/M
+Liverpool/M
+Liverpudlian/SM
+Livia/M
+Livingston/M
+Livingstone/M
+Livonia/M
+Livy/M
+Liz/M
+Liza/M
+Lizzie/M
+Lizzy/M
+Ljubljana/M
+Llewellyn/M
+Lloyd/M
+Ln
+Loafer/SM
+Lobachevsky/M
+Lochinvar/M
+Locke/M
+Lockean/M
+Lockheed/M
+Lockwood/M
+Lodge/M
+Lodi/M
+Lodz/M
+Loewe/M
+Loewi/M
+Loews/M
+Logan/M
+Lohengrin/M
+Loire/M
+Lois/M
+Loki/M
+Lola/M
+Lolita/M
+Lollard/M
+Lollobrigida/M
+Lombard/M
+Lombardi/M
+Lombardy/M
+Lome/M
+Lompoc/M
+Lon/M
+London/MRZ
+Londoner/M
+Long/M
+Longfellow/M
+Longmont/M
+Longstreet/M
+Longueuil
+Longview/M
+Lonnie/M
+Lopez/M
+Lora/M
+Lorain/M
+Loraine/M
+Lord/SM
+Lordship/SM
+Lorelei/M
+Loren/M
+Lorena/M
+Lorene/M
+Lorentz/M
+Lorentzian
+Lorenz/M
+Lorenzo/M
+Loretta/M
+Lori/M
+Lorie/M
+Lorna/M
+Lorraine/M
+Lorre/M
+Lorrie/M
+Los
+Lot/M
+Lothario/SM
+Lott/M
+Lottie/M
+Lou/M
+Louella/M
+Louie/M
+Louis/M
+Louisa/M
+Louise/M
+Louisiana/M
+Louisianan/MS
+Louisianian/MS
+Louisville/M
+Lourdes/M
+Louvre/M
+Love/M
+Lovecraft/M
+Lovelace/M
+Lowe/M
+Lowell/M
+Lowenbrau/M
+Lowery/M
+Lowlands
+Loyang/M
+Loyd/M
+Loyola/M
+Lr
+Lt
+Ltd
+Lu/M
+Luanda/M
+Luann/M
+Lubavitcher/M
+Lubbock/M
+Lubumbashi/M
+Lucas/M
+Luce/M
+Lucia/M
+Lucian/M
+Luciano/M
+Lucien/M
+Lucifer/M
+Lucile/M
+Lucille/M
+Lucinda/M
+Lucio/M
+Lucite/SM
+Lucius/M
+Lucknow/M
+Lucretia/M
+Lucretius/M
+Lucy/M
+Luddite/MS
+Ludhiana/M
+Ludwig/M
+Luella/M
+Lufthansa/M
+Luftwaffe/M
+Luger/M
+Lugosi/M
+Luigi/M
+Luis/M
+Luisa/M
+Luke/M
+Lula/M
+Lully/M
+Lulu/M
+Lumiere/M
+Luna/M
+Lupe/M
+Lupercalia/M
+Lupus/M
+Luria/M
+Lusaka/M
+Lusitania/M
+Luther/M
+Lutheran/SM
+Lutheranism/MS
+Luvs/M
+Luxembourg/ZMR
+Luxembourger/M
+Luxembourgian
+Luz/M
+Luzon/M
+Lvov/M
+LyX/M
+Lyallpur
+Lycra/M
+Lycurgus/M
+Lydia/M
+Lydian/SM
+Lyell/M
+Lyle/M
+Lyly/M
+Lyman/M
+Lyme/M
+Lynch/M
+Lynchburg/M
+Lynda/M
+Lyndon/M
+Lynette/M
+Lynn/M
+Lynne/M
+Lynnette/M
+Lyon/SM
+Lyons/M
+Lyra/M
+Lysenko/M
+Lysistrata/M
+Lysol/M
+M/SMGB
+MA/M
+MASH
+MB/M
+MBA/M
+MC
+MCI/M
+MD/M
+MDT
+ME
+MEGO/S
+MFA/M
+MGM/M
+MHz
+MI/M
+MIA
+MIDI/M
+MIPS
+MIRV
+MIT/M
+MM
+MN
+MO
+MOOC
+MP/M
+MPEG
+MRI/M
+MS/M
+MSG/M
+MST/M
+MSW
+MT/M
+MTV/M
+MVP/M
+MW
+Maalox/M
+Mabel/M
+Mable/M
+Mac/M
+MacArthur/M
+MacBride/M
+MacDonald/M
+MacLeish/M
+Macao/M
+Macaulay/M
+Macbeth/M
+Maccabees
+Maccabeus/M
+Mace/M
+Macedon/M
+Macedonia/M
+Macedonian/SM
+Mach/M
+Machiavelli/M
+Machiavellian/M
+Macias/M
+Macintosh/M
+Mack/M
+Mackenzie/M
+Mackinac/M
+Mackinaw/M
+Macmillan/M
+Macon/M
+Macumba/M
+Macy/M
+Madagascan/SM
+Madagascar/M
+Madam
+Madden/M
+Maddox/M
+Madeira/SM
+Madeleine/M
+Madeline/M
+Madelyn/M
+Madera/M
+Madge/M
+Madison/M
+Madonna/SM
+Madras/M
+Madrid/M
+Madurai/M
+Mae/M
+Maeterlinck/M
+Mafia/MS
+Mafioso/M
+Magdalena/M
+Magdalene/M
+Magellan/M
+Magellanic/M
+Maggie/M
+Maghreb/M
+Magi
+Maginot/M
+Magnificat
+Magnitogorsk/M
+Magog/M
+Magoo/M
+Magritte/M
+Magsaysay/M
+Magus
+Magyar/SM
+Mahabharata/M
+Maharashtra/M
+Mahavira/M
+Mahayana/M
+Mahayanist/M
+Mahdi/M
+Mahfouz/M
+Mahican/SM
+Mahler/M
+Mai/M
+Maidenform/M
+Maigret/M
+Mailer/M
+Maillol/M
+Maiman/M
+Maimonides/M
+Maine/MZR
+Mainer/M
+Maisie/M
+Maitreya/M
+Maj
+Majesty
+Major/M
+Majorca/M
+Majuro/M
+Makarios/M
+Maker/M
+Malabar/M
+Malabo/M
+Malacca/M
+Malachi/M
+Malagasy/M
+Malamud/M
+Malaprop/M
+Malawi/M
+Malawian/SM
+Malay/MS
+Malaya/M
+Malayalam/M
+Malayan/MS
+Malaysia/M
+Malaysian/MS
+Malcolm/M
+Maldive/MS
+Maldives/M
+Maldivian/MS
+Maldonado/M
+Male/M
+Mali/M
+Malian/SM
+Malibu/M
+Malinda/M
+Malinowski/M
+Mallarme/M
+Mallomars/M
+Mallory/M
+Malone/M
+Malory/M
+Malplaquet/M
+Malraux/M
+Malta/M
+Maltese/M
+Malthus/M
+Malthusian/SM
+Mameluke/M
+Mamet/M
+Mamie/M
+Mamore/M
+Man/M
+Managua/M
+Manama/M
+Manasseh/M
+Manchester/M
+Manchu/SM
+Manchuria/M
+Manchurian/M
+Mancini/M
+Mancunian/MS
+Mandalay/M
+Mandarin/M
+Mandela/M
+Mandelbrot/M
+Mandeville/M
+Mandingo/M
+Mandrell/M
+Mandy/M
+Manet/M
+Manfred/M
+Manhattan/SM
+Mani/M
+Manichean/M
+Manila/SM
+Manitoba/M
+Manitoulin/M
+Mankato/M
+Manley/M
+Mann/GM
+Mannheim/M
+Manning/M
+Mansfield/M
+Manson/M
+Manteca/M
+Mantegna/M
+Mantle/M
+Manuel/M
+Manuela/M
+Manx/M
+Mao/M
+Maoism/SM
+Maoist/SM
+Maori/MS
+Mapplethorpe/M
+Maputo/M
+Mar/SM
+Mara/M
+Maracaibo/M
+Marat/M
+Maratha/M
+Marathi/M
+Marathon/M
+Marc/M
+Marceau/M
+Marcel/M
+Marcelino/M
+Marcella/M
+Marcelo/M
+March/MS
+Marci/M
+Marcia/M
+Marciano/M
+Marcie/M
+Marco/MS
+Marconi/M
+Marcos/M
+Marcus/M
+Marcuse
+Marcy/M
+Marduk/M
+Margaret/M
+Margarita/M
+Margarito/M
+Marge/M
+Margery/M
+Margie/M
+Margo/M
+Margot
+Margret/M
+Margrethe/M
+Marguerite/M
+Mari/SM
+Maria/M
+MariaDB/M
+Marian/M
+Mariana/SM
+Marianas/M
+Marianne/M
+Mariano/M
+Maribel/M
+Maricela/M
+Marie/M
+Marietta/M
+Marilyn/M
+Marin/M
+Marina/M
+Marine/SM
+Mario/M
+Marion/M
+Maris/M
+Marisa/M
+Marisol/M
+Marissa/M
+Maritain/M
+Maritza/M
+Mariupol
+Marius/M
+Marjorie/M
+Marjory/M
+Mark/SM
+Markab/M
+Markham/M
+Markov/M
+Marks/M
+Marla/M
+Marlboro/M
+Marlborough/M
+Marlene/M
+Marley/M
+Marlin/M
+Marlon/M
+Marlowe/M
+Marmara/M
+Marne/M
+Maronite/M
+Marple/M
+Marquesas/M
+Marquette/M
+Marquez/M
+Marquis/M
+Marquita/M
+Marrakesh/M
+Marriott/M
+Mars/MS
+Marsala/M
+Marseillaise/MS
+Marseilles/M
+Marsh/M
+Marsha/M
+Marshall/M
+Marta/M
+Martel/M
+Martha/M
+Martial/M
+Martian/SM
+Martin/M
+Martina/M
+Martinez/M
+Martinique/M
+Marty/M
+Marva/M
+Marvell/M
+Marvin/M
+Marx/M
+Marxian
+Marxism/SM
+Marxist/SM
+Mary/M
+Maryann/M
+Maryanne/M
+Maryellen/M
+Maryland/MR
+Marylander/M
+Marylou/M
+Marysville/M
+Masada/M
+Masai/M
+Masaryk/M
+Mascagni/M
+Masefield/M
+Maserati/M
+Maseru/M
+Mashhad/M
+Mason/MS
+Masonic/M
+Masonite/M
+Mass/MS
+Massachusetts/M
+Massasoit/M
+Massenet/M
+Massey/M
+Master/S
+MasterCard/M
+Masters/M
+Mather/M
+Matheson/M
+Mathew/SM
+Mathews/M
+Mathewson/M
+Mathias/M
+Mathis/M
+Matilda/M
+Matisse/M
+Matlab/M
+Matt/M
+Mattel/M
+Matterhorn/M
+Matthew/SM
+Matthews/M
+Matthias/M
+Mattie/M
+Maud/M
+Maude/M
+Maugham/M
+Maui/M
+Mauldin/M
+Maupassant/M
+Maura/M
+Maureen/M
+Mauriac/M
+Maurice/M
+Mauricio/M
+Maurine/M
+Mauritania/M
+Mauritanian/SM
+Mauritian/SM
+Mauritius/M
+Mauro/M
+Maurois/M
+Mauryan/M
+Mauser/M
+Mavis/M
+Max/M
+Maximilian/M
+Maxine/M
+Maxwell/M
+May/SMR
+Maya/SM
+Mayan/MS
+Mayer/M
+Mayfair/M
+Mayflower/M
+Maynard/M
+Mayo/M
+Maypole
+Mayra/M
+Mays/M
+Maytag/M
+Mazama/M
+Mazarin/M
+Mazatlan/M
+Mazda/M
+Mazola/M
+Mazzini/M
+Mb/M
+Mbabane/M
+Mbini/M
+McAdam/M
+McAllen/M
+McBride/M
+McCain/M
+McCall/M
+McCarthy/M
+McCarthyism/M
+McCartney/M
+McCarty/M
+McClain/M
+McClellan/M
+McClure/M
+McConnell/M
+McCormick/M
+McCoy/M
+McCray/M
+McCullough/M
+McDaniel/M
+McDonald/M
+McDonnell/M
+McDowell/M
+McEnroe/M
+McFadden/M
+McFarland/M
+McGee/M
+McGovern/M
+McGowan/M
+McGuffey/M
+McGuire/M
+McHenry/M
+McIntosh/M
+McIntyre/M
+McJob
+McKay/M
+McKee/M
+McKenzie/M
+McKinley/M
+McKinney/M
+McKnight/M
+McLaughlin/M
+McLean/M
+McLeod/M
+McLuhan/M
+McMahon/M
+McMillan/M
+McNamara/M
+McNaughton/M
+McNeil/M
+McPherson/M
+McQueen/M
+McVeigh/M
+Md/M
+Me
+Mead/M
+Meade/M
+Meadows/M
+Meagan/M
+Meany/M
+Mecca/MS
+Medan/M
+Medea/M
+Medellin/M
+Medford/M
+Media/M
+Medicaid/SM
+Medicare/SM
+Medici/M
+Medina/M
+Mediterranean/MS
+Medusa/M
+Meg/M
+Megan/M
+Meghan/M
+Meier/M
+Meighen/M
+Meiji/M
+Meir/M
+Mejia/M
+Mekong/M
+Mel/M
+Melanesia/M
+Melanesian/M
+Melanie/M
+Melba/M
+Melbourne/M
+Melchior/M
+Melchizedek/M
+Melendez/M
+Melinda/M
+Melisa/M
+Melisande/M
+Melissa/M
+Mellon/M
+Melody/M
+Melpomene/M
+Melton/M
+Melva/M
+Melville/M
+Melvin/M
+Memcached/M
+Memling/M
+Memphis/M
+Menander/M
+Mencius/M
+Mencken/M
+Mendel/M
+Mendeleev/M
+Mendelian/M
+Mendelssohn/M
+Mendez/M
+Mendocino/M
+Mendoza/M
+Menelaus/M
+Menelik/M
+Menes/M
+Mengzi
+Menifee/M
+Menkalinan/M
+Menkar/M
+Menkent/M
+Mennen/M
+Mennonite/MS
+Menominee/M
+Menotti/M
+Mensa/M
+Mentholatum/M
+Menuhin/M
+Menzies/M
+Mephisto
+Mephistopheles/M
+Merak/M
+Mercado/M
+Mercator/M
+Merced/M
+Mercedes/M
+Mercer/M
+Mercia/M
+Merck/M
+Mercurochrome/M
+Mercury/SM
+Meredith/M
+Merino/M
+Merle/M
+Merlin/M
+Merlot/M
+Merovingian/M
+Merriam/M
+Merrick/M
+Merrill/M
+Merrimack/M
+Merritt/M
+Merthiolate/M
+Merton/M
+Mervin/M
+Mesa/M
+Mesabi/M
+Mesmer/M
+Mesolithic/M
+Mesopotamia/M
+Mesopotamian
+Mesozoic/M
+Messerschmidt/M
+Messiaen/M
+Messiah/M
+Messiahs
+Messianic
+Messieurs
+Metallica/M
+Metamucil/M
+Methodism/SM
+Methodist/SM
+Methuselah/M
+Metternich/M
+Meuse/M
+Mex
+Mexicali/M
+Mexican/MS
+Mexico/M
+Meyer/MS
+Meyerbeer/M
+Meyers/M
+Mfume/M
+Mg/M
+Mgr
+MiG/M
+Mia/M
+Miami/MS
+Miaplacidus/M
+Micah/M
+Micawber/M
+Mich/M
+Michael/M
+Michaelmas/MS
+Micheal/M
+Michel/M
+Michelangelo/M
+Michele/M
+Michelin/M
+Michelle/M
+Michelob/M
+Michelson/M
+Michigan/M
+Michigander/MS
+Michiganite
+Mick/M
+Mickey/M
+Mickie/M
+Micky/M
+Micmac/SM
+Micronesia/M
+Micronesian/M
+Microsoft/M
+Midas/M
+Middleton/M
+Middletown/M
+Mideast
+Mideastern
+Midland/MS
+Midway/M
+Midwest/M
+Midwestern/MR
+Miguel/M
+Mike/M
+Mikhail/M
+Mikoyan/M
+Milagros/M
+Milan/M
+Milanese
+Mildred/M
+Miles/M
+Milford/M
+Milken/M
+Mill/SMR
+Millard/M
+Millay/M
+Miller/M
+Millet/M
+Millicent/M
+Millie/M
+Millikan/M
+Mills/M
+Milne/M
+Milo/M
+Milosevic/M
+Milquetoast/M
+Miltiades/M
+Milton/M
+Miltonian
+Miltonic/M
+Miltown/M
+Milwaukee/M
+Mimi/M
+Mimosa/M
+Min/M
+Minamoto/M
+Mindanao/M
+Mindoro/M
+Mindy/M
+Minerva/M
+Ming/M
+Mingus/M
+Minn
+Minneapolis/M
+Minnelli/M
+Minnesota/M
+Minnesotan/SM
+Minnie/M
+Minoan/MS
+Minolta/M
+Minos/M
+Minot/M
+Minotaur/M
+Minsk/M
+Minsky/M
+Mintaka/M
+Minuit/M
+Minuteman/M
+Miocene/M
+Mir/M
+Mira/M
+Mirabeau/M
+Mirach/M
+Miranda/M
+Mirfak/M
+Miriam/M
+Miro/M
+Mirzam/M
+Miskito/M
+Miss
+Mississauga/M
+Mississippi/M
+Mississippian/SM
+Missoula/M
+Missouri/M
+Missourian/MS
+Missy/M
+Mistassini/M
+Mister
+Mistress
+Misty/M
+Mitch/M
+Mitchel/M
+Mitchell/M
+Mitford/M
+Mithra/M
+Mithridates/M
+Mitsubishi/M
+Mitterrand/M
+Mitty/M
+Mitzi/M
+Mixtec/M
+Mizar/M
+Mk
+Mlle
+Mme/S
+Mn/M
+Mnemosyne/M
+Mo/M
+Mobil/M
+Mobile/M
+Mobutu/M
+Modesto/M
+Modigliani/M
+Moe/M
+Moet/M
+Mogadishu/M
+Mogul/MS
+Mohacs/M
+Mohamed/M
+Mohammad/M
+Mohammedan/SM
+Mohammedanism/SM
+Mohave/SM
+Mohawk/SM
+Mohegan
+Moho/M
+Mohorovicic/M
+Moira/M
+Moises/M
+Moiseyev/M
+Mojave/SM
+Moldavia/M
+Moldavian
+Moldova/M
+Moldovan
+Moliere/M
+Molina/M
+Moll/M
+Mollie/M
+Molly/M
+Molnar/M
+Moloch/M
+Molokai/M
+Molotov/M
+Moluccas/M
+Mombasa/M
+Mon/SM
+Mona/M
+Monacan
+Monaco/M
+Mondale/M
+Monday/SM
+Mondrian/M
+Monegasque/SM
+Monera/M
+Monessen/M
+Monet/M
+MongoDB/M
+Mongol/SM
+Mongolia/M
+Mongolian/SM
+Mongolic/M
+Mongoloid
+Monica/M
+Monique/M
+Monk/M
+Monmouth/M
+Monongahela/M
+Monroe/M
+Monrovia/M
+Monsanto/M
+Monsieur/M
+Monsignor/SM
+Mont/M
+Montague/M
+Montaigne/M
+Montana/M
+Montanan/SM
+Montcalm/M
+Monte/M
+Montenegrin/M
+Montenegro/M
+Monterey/M
+Monterrey/M
+Montesquieu/M
+Montessori/M
+Monteverdi/M
+Montevideo/M
+Montezuma/M
+Montgolfier/M
+Montgomery/M
+Monticello/M
+Montoya/M
+Montpelier/M
+Montrachet/M
+Montreal/M
+Montserrat/M
+Monty/M
+Moody/M
+Moog/M
+Moon/M
+Mooney/M
+Moor/SM
+Moore/M
+Moorish/M
+Morales/M
+Moran/M
+Moravia/M
+Moravian/M
+Mordred/M
+More/M
+Moreno/M
+Morgan/SM
+Morgantown/M
+Moriarty/M
+Morin/M
+Morison/M
+Morita/M
+Morley/M
+Mormon/SM
+Mormonism/SM
+Moro/M
+Moroccan/SM
+Morocco/M
+Moroni/M
+Morpheus/M
+Morphy/M
+Morris/M
+Morrison/M
+Morristown/M
+Morrow/M
+Morse/M
+Mort/M
+Mortimer/M
+Morton/M
+Mosaic/M
+Moscow/M
+Moseley/M
+Moselle/M
+Moses/M
+Mosley/M
+Moss/M
+Mosul/M
+Motorola/M
+Motown/M
+Motrin/M
+Mott/M
+Moulton/M
+Mount/M
+Mountbatten/M
+Mountie/MS
+Moussorgsky/M
+Mouthe/M
+Mouton/M
+Mowgli/M
+Mozambican/SM
+Mozambique/M
+Mozart/M
+Mozilla/M
+Mr/SM
+Ms/S
+Msgr
+Mt
+Muawiya/M
+Mubarak/M
+Mueller/M
+Muenster/MS
+Mugabe/M
+Muhammad/M
+Muhammadan/MS
+Muhammadanism/SM
+Muir/M
+Mujib/M
+Mulder/M
+Mullen/M
+Muller/M
+Mulligan/M
+Mullikan/M
+Mullins/M
+Mulroney/M
+Multan/M
+Multics
+Mumbai/M
+Mumford/M
+Munch/M
+Munchhausen/M
+Muncie/M
+Munich/M
+Munoz/M
+Munro/M
+Munster/M
+Muppet/M
+Murasaki/M
+Murat/M
+Murchison/M
+Murcia
+Murdoch/M
+Murfreesboro/M
+Muriel/M
+Murillo/M
+Murine/M
+Murmansk/M
+Murphy/M
+Murray/M
+Murrieta/M
+Murrow/M
+Murrumbidgee/M
+Muscat/M
+Muscovite/M
+Muscovy/M
+Muse/M
+Musharraf/M
+Musial/M
+Muskegon/M
+Muskogee/M
+Muslim/MS
+Mussolini/M
+Mussorgsky/M
+Mutsuhito/M
+Muzak/M
+MySQL/M
+MySpace/M
+Myanmar/M
+Mycenae/M
+Mycenaean/M
+Myers/M
+Mylar/MS
+Myles/M
+Myra/M
+Myrdal/M
+Myrna/M
+Myron/M
+Myrtle/M
+Mysore/M
+Myst/M
+N'Djamena
+N/MD
+NAACP/M
+NAFTA/M
+NASA/M
+NASCAR/M
+NASDAQ/M
+NATO/M
+NB
+NBA/M
+NBC/M
+NBS
+NC
+NCAA/M
+NCO
+ND
+NE/M
+NEH
+NF
+NFC
+NFL/M
+NH
+NHL/M
+NIH
+NIMBY
+NJ
+NLRB
+NM
+NORAD/M
+NOW
+NP
+NPR/M
+NR
+NRA
+NRC
+NS
+NSA/M
+NSC
+NSF
+NSFW
+NT
+NV
+NVIDIA/M
+NW/M
+NWT
+NY
+NYC
+NYSE
+NZ
+Na/M
+Nabisco/M
+Nabokov/M
+Nader/M
+Nadia/M
+Nadine/M
+Nagasaki/M
+Nagoya/M
+Nagpur/M
+Nagy/M
+Nahuatl/MS
+Nahum/M
+Naipaul/M
+Nair/M
+Nairobi/M
+Naismith/M
+Nam/M
+Namath/M
+Namibia/M
+Namibian/MS
+Nampa/M
+Nan/M
+Nanak/M
+Nanchang/M
+Nancy/M
+Nanette/M
+Nanjing/M
+Nannie/M
+Nanook/M
+Nansen/M
+Nantes/M
+Nantucket/M
+Naomi/M
+Napa/M
+Naphtali/M
+Napier/M
+Naples/M
+Napoleon/MS
+Napoleonic/M
+Napster/M
+Narcissus/M
+Narmada/M
+Narnia/M
+Narraganset
+Narragansett/M
+Nash/M
+Nashua/M
+Nashville/M
+Nassau/M
+Nasser/M
+Nat/M
+Natalia/M
+Natalie/M
+Natasha/M
+Natchez/M
+Nate/MN
+Nathan/SM
+Nathaniel/M
+Nathans/M
+Nation/M
+Nationwide/M
+Nativity/M
+Naugahyde/M
+Nauru/M
+Nautilus/M
+Navajo/SM
+Navajoes
+Navarre/M
+Navarro/M
+Navratilova/M
+Navy
+Nazarene/M
+Nazareth/M
+Nazca/M
+Nazi/SM
+Nazism/MS
+Nb/M
+Nd/M
+Ndjamena/M
+Ne/M
+NeWS
+NeWSes
+Neal/M
+Neanderthal/SM
+Neapolitan/M
+Neb
+Nebr
+Nebraska/M
+Nebraskan/MS
+Nebuchadnezzar/M
+Ned/M
+Nefertiti/M
+Negev/M
+Negress/MS
+Negritude
+Negro/MS
+Negroes
+Negroid/SM
+Negros/M
+Nehemiah/M
+Nehru/M
+Neil/M
+Nelda/M
+Nell/M
+Nellie/M
+Nelly/M
+Nelsen/M
+Nelson/M
+Nembutal/M
+Nemesis/M
+Neo/M
+Neogene/M
+Neolithic
+Nepal/M
+Nepalese/M
+Nepali/MS
+Neptune/M
+Nereid/M
+Nerf/M
+Nero/M
+Neruda/M
+Nescafe/M
+Nesselrode/M
+Nestle/M
+Nestor/M
+Nestorius/M
+Netflix/M
+Netherlander/SM
+Netherlands/M
+Netscape/M
+Nettie/M
+Netzahualcoyotl/M
+Nev/M
+Neva/M
+Nevada/M
+Nevadan/SM
+Nevadian
+Nevis/M
+Nevsky/M
+Newark/M
+Newburgh/M
+Newcastle/M
+Newfoundland/MRS
+Newman/M
+Newport/M
+Newsweek/M
+Newton/M
+Newtonian/M
+Nexis/M
+Ngaliema/M
+Nguyen/M
+Ni/M
+Niagara/M
+Niamey/M
+Nibelung/M
+Nicaea/M
+Nicaragua/M
+Nicaraguan/SM
+Niccolo/M
+Nice/M
+Nicene/M
+Nichiren/M
+Nicholas/M
+Nichole/M
+Nichols/M
+Nicholson/M
+Nick/M
+Nickelodeon/M
+Nicklaus/M
+Nickolas/M
+Nicobar/M
+Nicodemus/M
+Nicola/SM
+Nicolas/M
+Nicole/M
+Nicosia/M
+Niebuhr/M
+Nielsen/M
+Nietzsche/M
+Nieves/M
+Nigel/M
+Niger/M
+Nigeria/M
+Nigerian/MS
+Nigerien/M
+Nightingale/M
+Nijinsky/M
+Nike/M
+Nikita/M
+Nikkei/M
+Nikki/M
+Nikolai/M
+Nikon/M
+Nile/M
+Nimitz/M
+Nimrod/M
+Nina/M
+Nineveh/M
+Nintendo/M
+Niobe/M
+Nippon/M
+Nipponese/M
+Nirenberg/M
+Nirvana/M
+Nisan/M
+Nisei/M
+Nissan/M
+Nita/M
+Nivea/M
+Nixon/M
+Nkrumah/M
+No/SM
+NoDoz/M
+Noah/M
+Nobel/M
+Nobelist/MS
+Noble/M
+Noe/M
+Noel/SM
+Noelle/M
+Noemi/M
+Nokia/M
+Nola/M
+Nolan/M
+Nome/M
+Nona/M
+Nootka/M
+Nora/M
+Norbert/M
+Norberto/M
+Nordic/MS
+Noreen/M
+Norfolk/M
+Noriega/M
+Norma/M
+Normal/M
+Norman/MS
+Normand/M
+Normandy/M
+Norplant/M
+Norris/M
+Norse/M
+Norseman/M
+Norsemen/M
+North/M
+Northampton/M
+Northeast/MS
+Northerner/M
+Northrop/M
+Northrup/M
+Norths
+Northwest/SM
+Norton/M
+Norw
+Norway/M
+Norwegian/SM
+Norwich/M
+Nosferatu/M
+Nostradamus/M
+Nottingham/M
+Nouakchott/M
+Noumea/M
+Nov/M
+Nova/M
+Novartis/M
+November/MS
+Novgorod/M
+Novocain/MS
+Novocaine
+Novokuznetsk/M
+Novosibirsk/M
+Noxzema/M
+Noyce/M
+Noyes/M
+Np/M
+Nubia/M
+Nubian/M
+Nukualofa/M
+Numbers/M
+Nunavut/M
+Nunez/M
+Nunki/M
+Nuremberg/M
+Nureyev/M
+NutraSweet/M
+NyQuil/M
+Nyasa/M
+Nyerere/M
+O'Brien/M
+O'Casey/M
+O'Connell/M
+O'Connor/M
+O'Donnell/M
+O'Hara/M
+O'Higgins/M
+O'Keeffe/M
+O'Neil/M
+O'Neill/M
+O'Rourke/M
+O'Toole/M
+O/SM
+OAS/M
+OB
+OCR
+OD/SM
+OE
+OED
+OH
+OHSA/M
+OJ
+OK/SMDG
+OMB/M
+ON
+OPEC/M
+OR
+OS/M
+OSHA/M
+OSes
+OT
+OTB
+OTC
+OTOH
+Oahu/M
+Oakland/M
+Oakley/M
+Oates/M
+Oaxaca/M
+Ob/M
+Obadiah/M
+Obama/M
+Obamacare
+Oberlin/M
+Oberon/M
+Ocala/M
+Ocaml/M
+Occam/M
+Occident
+Occidental/MS
+Oceania/M
+Oceanside
+Oceanus/M
+Ochoa/M
+Oct/M
+Octavia/M
+Octavian/M
+Octavio/M
+October/SM
+Odell/M
+Oder/M
+Odessa/M
+Odets/M
+Odin/M
+Odis/M
+Odom/M
+Odysseus/M
+Odyssey/M
+Oedipal/M
+Oedipus/M
+Oersted/M
+Ofelia/M
+Offenbach/M
+OfficeMax/M
+Ogbomosho/M
+Ogden/M
+Ogilvy/M
+Oglethorpe/M
+Ohio/M
+Ohioan/SM
+Oise/M
+Ojibwa/SM
+Okayama
+Okeechobee/M
+Okefenokee/M
+Okhotsk/M
+Okinawa/M
+Okinawan
+Okla
+Oklahoma/M
+Oklahoman/M
+Oktoberfest/M
+Ola/M
+Olaf/M
+Olajuwon/M
+Olav/M
+Oldenburg/M
+Oldfield/M
+Oldsmobile/M
+Olduvai/M
+Olen/M
+Olenek/M
+Olga/M
+Oligocene/M
+Olin/M
+Olive/MR
+Oliver/M
+Olivetti/M
+Olivia/M
+Olivier/M
+Ollie/M
+Olmec/M
+Olmsted/M
+Olsen/M
+Olson/M
+Olympia/SM
+Olympiad/MS
+Olympian/MS
+Olympic/SM
+Olympics/M
+Olympus/M
+Omaha/MS
+Oman/M
+Omani/MS
+Omar/M
+Omayyad/M
+Omdurman/M
+Omnipotent
+Omsk/M
+Onassis/M
+Oneal/M
+Onega/M
+Onegin/M
+Oneida/MS
+Onion/M
+Ono/M
+Onondaga/MS
+Onsager/M
+Ont
+Ontarian
+Ontario/M
+Oort/M
+Opal/M
+Opel/M
+OpenOffice/M
+Ophelia/M
+Ophiuchus/M
+Oppenheimer/M
+Opposition
+Oprah/M
+Ora/M
+Oracle/M
+Oran/M
+Orange/M
+Oranjestad/M
+Orbison/M
+Ordovician/M
+Ore/N
+Oreg
+Oregon/M
+Oregonian/SM
+Orem/M
+Oreo/M
+Orestes/M
+Orient/M
+Oriental/MS
+Orientalism
+Orin/M
+Orinoco/M
+Orion/M
+Oriya/M
+Orizaba/M
+Orkney/M
+Orlando/M
+Orleans/M
+Orlon/MS
+Orly/M
+Orpheus/M
+Orphic/M
+Orr/M
+Ortega/M
+Orthodox
+Ortiz/M
+Orval/M
+Orville/M
+Orwell/M
+Orwellian/M
+Os/M
+Osage/MS
+Osaka/M
+Osbert/M
+Osborn/M
+Osborne/M
+Oscar/MS
+Osceola/M
+Osgood/M
+Oshawa/M
+Oshkosh/M
+Osiris/M
+Oslo/M
+Osman/M
+Ostrogoth/M
+Ostwald/M
+Osvaldo/M
+Oswald/M
+Othello/M
+Otis/M
+Ottawa/SM
+Otto/M
+Ottoman/M
+Ouagadougou/M
+Ouija/MS
+Ovid/M
+Owen/SM
+Owens/M
+Owensboro/M
+Oxford/SM
+Oxnard/M
+Oxonian/M
+Oxus/M
+Oxycontin/M
+Oz/M
+Ozark/MS
+Ozarks/M
+Ozymandias/M
+Ozzie/M
+P/MN
+PA/M
+PAC/M
+PARC/S
+PASCAL
+PBS/M
+PBX
+PC/SM
+PCB
+PCMCIA
+PCP/M
+PD
+PDF
+PDQ
+PDT
+PE
+PET/M
+PFC
+PG
+PGP
+PHP/M
+PIN
+PJ's
+PLO/M
+PM/SMDG
+PMS/M
+PO
+POW/M
+PP
+PPS
+PR
+PRC/M
+PRO
+PS/M
+PST/M
+PT
+PTA/M
+PTO
+PVC/M
+PW
+PX
+Pa/M
+Paar/M
+Pablo/M
+Pablum/M
+Pabst/M
+Pace/M
+Pacheco/M
+Pacific/M
+Pacino/M
+Packard/M
+Padang
+Paderewski/M
+Padilla/M
+Paganini/M
+Page/M
+Paglia/M
+Pahlavi/M
+Paige/M
+Paine/M
+Paiute/SM
+Pakistan/M
+Pakistani/SM
+Palembang/M
+Paleocene/M
+Paleogene/M
+Paleolithic/M
+Paleozoic/M
+Palermo/M
+Palestine/M
+Palestinian/SM
+Palestrina/M
+Paley/M
+Palikir/M
+Palisades/M
+Palladio/M
+Palmdale/M
+Palmer/M
+Palmerston/M
+Palmolive/M
+Palmyra/M
+Palomar/M
+Pam/M
+Pamela/M
+Pamirs/M
+Pampers/M
+Pan/M
+Panama/SM
+Panamanian/MS
+Panasonic/M
+Pandora/M
+Pangaea/M
+Pankhurst/M
+Panmunjom/M
+Pansy/M
+Pantagruel/M
+Pantaloon/M
+Pantheon/M
+Panza/M
+Paracelsus/M
+Paraclete/M
+Paradise
+Paraguay/M
+Paraguayan/MS
+Paralympic/S
+Paramaribo/M
+Paramount/M
+Parana/M
+Parcheesi/M
+Pareto/M
+Paris/M
+Parisian/MS
+Park/SMR
+Parker/M
+Parkersburg/M
+Parkinson/M
+Parkinsonism
+Parkman/M
+Parks/M
+Parliament/M
+Parmenides
+Parmesan/MS
+Parnassus/MS
+Parnell/M
+Parr/M
+Parrish/M
+Parsifal/M
+Parsons/M
+Parthenon/M
+Parthia/M
+Pasadena/M
+Pascagoula/M
+Pascal/SM
+Pasco/M
+Pasquale/M
+Passion/SM
+Passover/MS
+Pasternak/M
+Pasteur/M
+Pat/M
+Patagonia/M
+Patagonian/M
+Pate/M
+Patel/M
+Paterson/M
+Patna/M
+Patrica/M
+Patrice/M
+Patricia/M
+Patrick/M
+Patsy/M
+Patterson/M
+Patti/M
+Patton/M
+Patty/M
+Paul/GM
+Paula/M
+Paulette/M
+Pauli/M
+Pauline/M
+Pauling/M
+Pavarotti/M
+Pavlov/M
+Pavlova/M
+Pavlovian/M
+Pawnee/SM
+PayPal/M
+Payne/M
+Pb/M
+Pd/M
+Peabody/M
+Peace/M
+Peale/M
+Pearl/M
+Pearlie/M
+Pearson/M
+Peary/M
+Pechora/M
+Peck/M
+Peckinpah/M
+Pecos/M
+Pedro/M
+Peel/M
+Peg/M
+Pegasus/MS
+Peggy/M
+Pei/M
+Peiping/M
+Peking/SM
+Pekingese/SM
+Pele/M
+Pelee/M
+Peloponnese/M
+Pembroke/M
+Pen/M
+Pena/M
+Penderecki/M
+Penelope/M
+Penn/M
+Penna
+Penney/M
+Pennington/M
+Pennsylvania/M
+Pennsylvanian/MS
+Penny/M
+Pennzoil/M
+Pensacola/M
+Pentagon/M
+Pentateuch/M
+Pentax/M
+Pentecost/SM
+Pentecostal/MS
+Pentecostalism
+Pentium/SM
+Peoria/M
+Pepin/M
+Pepsi/M
+Pepys/M
+Pequot/M
+Percheron/M
+Percival/M
+Percy/M
+Perelman/M
+Perez/M
+Periclean/M
+Pericles/M
+Perkins/M
+Perl/SM
+Perm/M
+Permalloy/M
+Permian/M
+Pernod/M
+Peron/M
+Perot/M
+Perrier/M
+Perry/RM
+Perseid/M
+Persephone/M
+Persepolis/M
+Perseus/M
+Pershing/M
+Persia/M
+Persian/SM
+Perth/M
+Peru/M
+Peruvian/MS
+Peshawar/M
+Petain/M
+Petaluma/M
+Pete/RMZ
+Peter/M
+Peters/MN
+Petersen/M
+Peterson/M
+Petra/M
+Petrarch/M
+Petty/M
+Peugeot/M
+Pfc
+Pfizer/M
+PhD/M
+Phaedra/M
+Phaethon/M
+Phanerozoic/M
+Pharaoh/M
+Pharaohs
+Pharisaic
+Pharisaical
+Pharisee/MS
+Phekda/M
+Phelps/M
+Phidias/M
+Phil/MY
+Philadelphia/M
+Philby/M
+Philemon/M
+Philip/MS
+Philippe/M
+Philippians/M
+Philippine/SM
+Philippines/M
+Philips/M
+Philistine/M
+Phillip/SM
+Phillipa/M
+Phillips/M
+Philly/M
+Phipps/M
+Phobos/M
+Phoebe/M
+Phoenicia/M
+Phoenician/SM
+Phoenix/M
+Photostat/MS
+Photostatted
+Photostatting
+Phrygia/M
+Phyllis/M
+Piaf/M
+Piaget/M
+Pianola/M
+Picasso/M
+Piccadilly/M
+Pickering/M
+Pickett/M
+Pickford/M
+Pickwick/M
+Pict/M
+Piedmont/M
+Pierce/M
+Pierre/M
+Pierrot/M
+Pike/M
+Pilate/MS
+Pilates/M
+Pilcomayo/M
+Pilgrim/SM
+Pillsbury/M
+Pinatubo/M
+Pincus/M
+Pindar/M
+Pinkerton/M
+Pinocchio/M
+Pinochet/M
+Pinter/M
+Pinyin
+Pippin/M
+Piraeus/M
+Pirandello/M
+Pisa/M
+Pisces/M
+Pisistratus/M
+Pissaro/M
+Pitcairn/M
+Pitt/SM
+Pittman/M
+Pitts/M
+Pittsburgh/M
+Pittsfield/M
+Pius/M
+Pizarro/M
+Pkwy
+Pl
+Planck/M
+Plano
+Plantagenet/M
+Plasticine/M
+Plataea/M
+Plath/M
+Plato/M
+Platonic
+Platonism/M
+Platonist/M
+Platte/M
+Plautus/M
+PlayStation/M
+Playboy/M
+Playtex/M
+Pleiades/M
+Pleistocene/M
+Plexiglas/MS
+Pliny/M
+Pliocene/SM
+Plutarch/M
+Pluto/M
+Plymouth/M
+Pm/M
+Po/M
+Pocahontas/M
+Pocatello/M
+Pocono/SM
+Poconos/M
+Podgorica/M
+Podhoretz/M
+Podunk/M
+Poe/M
+Pogo/M
+Poincare/M
+Poiret/M
+Poirot/M
+Poisson/M
+Poitier/M
+Pokemon/M
+Pol/MY
+Poland/M
+Polanski/M
+Polaris/M
+Polaroid/MS
+Pole/SM
+Polish/M
+Politburo/M
+Polk/M
+Pollard/M
+Pollock/M
+Pollux/M
+Polly/M
+Pollyanna/M
+Polo/M
+Poltava/M
+Polyhymnia/M
+Polynesia/M
+Polynesian/MS
+Polyphemus/M
+Pomerania/M
+Pomeranian/M
+Pomona/M
+Pompadour/M
+Pompeian
+Pompeii/M
+Pompey/M
+Ponce/M
+Pontchartrain/M
+Pontiac/M
+Pontianak/M
+Pooh/M
+Poole/M
+Poona/M
+Pope/M
+Popeye/M
+Popocatepetl/M
+Popper/M
+Poppins/M
+Popsicle/M
+Porfirio/M
+Porrima/M
+Porsche/M
+Port/MR
+Porter/M
+Porterville/M
+Portia/M
+Portland/M
+Porto/M
+Portsmouth/M
+Portugal/M
+Portuguese/M
+Poseidon/M
+Post/M
+PostgreSQL/M
+Potemkin/M
+Potomac/M
+Potsdam/M
+Pottawatomie/M
+Potter/M
+Potts/M
+Pottstown/M
+Poughkeepsie/M
+Pound/M
+Poussin/M
+Powell/M
+PowerPC/M
+PowerPoint/M
+Powers/M
+Powhatan/M
+Poznan/M
+Pr/M
+Prada/M
+Prado/M
+Praetorian/M
+Prague/M
+Praia/M
+Prakrit/M
+Pratchett/M
+Pratt/M
+Pravda/M
+Praxiteles/M
+Preakness/M
+Precambrian/M
+Preminger/M
+Premyslid/M
+Prensa/M
+Prentice/M
+Pres
+Presbyterian/SM
+Presbyterianism/MS
+Prescott/M
+Presley/M
+Preston/M
+Pretoria/M
+Priam/M
+Pribilof/M
+Price/M
+Priceline/M
+Priestley/M
+Prince/M
+Princeton/M
+Principe/M
+Priscilla/M
+Prius/M
+Private
+Procrustean/M
+Procrustes/M
+Procter/M
+Procyon/M
+Prof
+Prohibition
+Prokofiev/M
+Promethean/M
+Prometheus/M
+Prophets
+Proserpina/M
+Proserpine/M
+Protagoras/M
+Proterozoic/M
+Protestant/MS
+Protestantism/SM
+Proteus/M
+Proudhon/M
+Proust/M
+Provencal/MS
+Provence/M
+Proverbs
+Providence/SM
+Provo/M
+Prozac/MS
+Prudence/M
+Prudential/M
+Pruitt/M
+Prussia/M
+Prussian/MS
+Prut/M
+Pryor/M
+Psalms/M
+Psalter/MS
+Psyche/M
+Pt/M
+Ptah/M
+Ptolemaic/M
+Ptolemy/SM
+Pu/M
+Puccini/M
+Puck/M
+Puckett/M
+Puebla/M
+Pueblo/M
+Puerto
+Puget/M
+Pugh/M
+Pulaski/M
+Pulitzer/M
+Pullman/MS
+Punch/M
+Punic/M
+Punjab/M
+Punjabi/M
+Purana/M
+Purcell/M
+Purdue/M
+Purim/MS
+Purina/M
+Puritan/M
+Puritanism/MS
+Purus/M
+Pusan/M
+Pusey/M
+Pushkin/M
+Pushtu/M
+Putin/M
+Putnam/M
+Puzo/M
+Pvt
+PyTorch/M
+Pygmalion/M
+Pygmy/SM
+Pyle/M
+Pym/M
+Pynchon/M
+Pyongyang/M
+Pyotr/M
+Pyrenees/M
+Pyrex/MS
+Pyrrhic/M
+Pythagoras/M
+Pythagorean/M
+Pythias/M
+Python/M
+Q
+QA
+QB
+QC
+QED
+QM
+QWERTY
+Qaddafi/M
+Qantas/M
+Qatar/M
+Qatari/MS
+Qingdao/M
+Qinghai/M
+Qiqihar/M
+Qom/M
+Quaalude/M
+Quaker/MS
+Quakerism/SM
+Qualcomm/M
+Quaoar/M
+Quasimodo/M
+Quaternary/M
+Quayle/M
+Que
+Quebec/M
+Quebecois/M
+Quechua/M
+Queen/MS
+Queens/M
+Queensland/M
+Quentin/M
+Quetzalcoatl/M
+Quezon/M
+Quincy/M
+Quinn/M
+Quintilian/M
+Quinton/M
+Quirinal/M
+Quisling/M
+Quito/M
+Quixote/M
+Quixotism/M
+Qumran/M
+Quonset/M
+Quran
+Quranic
+R/M
+RAF/M
+RAM/SM
+RBI
+RC
+RCA/M
+RCMP
+RD
+RDA
+RDS/M
+REIT
+REM/SM
+RF
+RFC/S
+RFD
+RI
+RIF
+RIP
+RISC
+RN/M
+RNA/M
+ROFL
+ROM/M
+ROTC/M
+RP
+RR
+RSFSR
+RSI
+RSV
+RSVP
+RTFM
+RV/SM
+Ra/M
+Rabat/M
+Rabelais/M
+Rabelaisian/M
+Rabin/M
+Rachael/M
+Rachel/M
+Rachelle/M
+Rachmaninoff/M
+Racine/M
+Radcliff/M
+Radcliffe/M
+Rae/M
+Rafael/M
+Raffles/M
+Ragnarok/M
+Rainier/M
+Raleigh/M
+Ralph/M
+Rama/M
+Ramada/M
+Ramadan/MS
+Ramakrishna/M
+Ramanujan/M
+Ramayana/M
+Rambo/M
+Ramirez/M
+Ramiro/M
+Ramon/M
+Ramona/M
+Ramos/M
+Ramsay/M
+Ramses/M
+Ramsey/M
+Rand/M
+Randal/M
+Randall/M
+Randell/M
+Randi/M
+Randolph/M
+Randy/M
+Rangoon/M
+Rankin/M
+Rankine/M
+Raoul/M
+Raphael/M
+Rappaport/M
+Rapunzel/M
+Raquel/M
+Rasalgethi/M
+Rasalhague/M
+Rasmussen/M
+Rasputin/M
+Rasta
+Rastaban/M
+Rastafarian/MS
+Rastafarianism
+Rather/M
+Ratliff/M
+Raul/M
+Ravel/M
+Rawalpindi/M
+Ray/M
+RayBan/M
+Rayburn/M
+Rayleigh/M
+Raymond/M
+Raymundo/M
+Rb/M
+Rd
+Re/M
+Reading/M
+Reagan/M
+Reaganomics/M
+Realtor/M
+Reasoner/M
+Reba/M
+Rebekah/M
+Recife/M
+Reconstruction/M
+Redding/M
+Redeemer/M
+Redford/M
+Redgrave/M
+Redis/M
+Redmond/M
+Redshift/M
+Reebok/M
+Reed/M
+Reese/M
+Reeves/M
+Reformation/MS
+Refugio/M
+Reggie/M
+Regina/M
+Reginae/M
+Reginald/M
+Regor/M
+Regulus/M
+Rehnquist/M
+Reich/M
+Reichstag's
+Reid/M
+Reilly/M
+Reinaldo/M
+Reinhardt/M
+Reinhold/M
+Remarque/M
+Rembrandt/M
+Remington/M
+Remus/M
+Rena/M
+Renaissance/SM
+Renascence
+Renault/M
+Rene/M
+Renee/M
+Reno/M
+Renoir/M
+Rep
+Representative
+Republican/SM
+Republicanism
+Requiem/MS
+Resistance
+Restoration/M
+Resurrection
+Reuben/M
+Reunion/M
+Reuters/M
+Reuther/M
+Rev
+Reva/M
+Revelation/SM
+Revelations/M
+Revere/M
+Reverend/M
+Revlon/M
+Rex/M
+Reyes/M
+Reykjavik/M
+Reyna/M
+Reynaldo/M
+Reynolds/M
+Rf/M
+Rh/M
+Rhea/M
+Rhee/M
+Rheingau/M
+Rhenish/M
+Rhiannon/M
+Rhine/M
+Rhineland/M
+Rhoda/M
+Rhode/S
+Rhodes/M
+Rhodesia/M
+Rhodesian
+Rhonda/M
+Rhone/M
+Ribbentrop/M
+Ricardo/M
+Rice/M
+Rich/M
+Richard/MS
+Richards/M
+Richardson/M
+Richelieu/M
+Richie/M
+Richmond/M
+Richter/M
+Richthofen/M
+Rick/M
+Rickenbacker/M
+Rickey/M
+Rickie/M
+Rickover/M
+Ricky/M
+Rico/M
+Riddle/M
+Ride/M
+Riefenstahl/M
+Riel/M
+Riemann/M
+Riesling/MS
+Riga/M
+Rigel/M
+Riggs/M
+Right
+Rigoberto/M
+Rigoletto/M
+Riley/M
+Rilke/M
+Rimbaud/M
+Ringling/M
+Ringo/M
+Rio/SM
+Rios/M
+Ripley/M
+Risorgimento/M
+Rita/M
+Ritalin/M
+Ritz/M
+Rivas/M
+Rivera/M
+Rivers/M
+Riverside/M
+Riviera/MS
+Riyadh/M
+Rizal/M
+Rn/M
+Roach/M
+Roanoke/M
+Rob/M
+Robbie/M
+Robbin/MS
+Robbins/M
+Robby/M
+Roberson/M
+Robert/MS
+Roberta/M
+Roberto/M
+Roberts/M
+Robertson/M
+Robeson/M
+Robespierre/M
+Robin/M
+Robinson/M
+Robitussin/M
+Robles/M
+Robson/M
+Robt/M
+Robyn/M
+Rocco/M
+Rocha/M
+Rochambeau/M
+Roche/M
+Rochelle/M
+Rochester/M
+Rock/M
+Rockefeller/M
+Rockford/M
+Rockies/M
+Rockne/M
+Rockwell/M
+Rocky/SM
+Rod/M
+Roddenberry/M
+Roderick/M
+Rodger/MS
+Rodgers/M
+Rodin/M
+Rodney/M
+Rodolfo/M
+Rodrick/M
+Rodrigo/M
+Rodriguez/M
+Rodriquez/M
+Roeg/M
+Roentgen
+Rogelio/M
+Roger/MS
+Rogers/M
+Roget/M
+Rojas/M
+Roku/M
+Rolaids/M
+Roland/M
+Rolando/M
+Rolex/M
+Rolland/M
+Rollerblade/M
+Rollins/M
+Rolodex/M
+Rolvaag/M
+Rom
+Roman/MS
+Romanesque/MS
+Romania/M
+Romanian/MS
+Romano/M
+Romanov/M
+Romans/M
+Romansh/M
+Romanticism
+Romany/SM
+Rome/SM
+Romeo/M
+Romero/M
+Rommel/M
+Romney/M
+Romulus/M
+Ron/M
+Ronald/M
+Ronda/M
+Ronnie/M
+Ronny/M
+Ronstadt/M
+Rontgen
+Rooney/M
+Roosevelt/M
+Root/M
+Roquefort/SM
+Rorschach/M
+Rory/M
+Rosa/M
+Rosales/M
+Rosalie/M
+Rosalind/M
+Rosalinda/M
+Rosalyn/M
+Rosanna/M
+Rosanne/M
+Rosario/M
+Roscoe/M
+Rose/M
+Roseann/M
+Roseau/M
+Rosecrans/M
+Rosella/M
+Rosemarie/M
+Rosemary/M
+Rosenberg/M
+Rosendo/M
+Rosenzweig/M
+Rosetta/M
+Rosicrucian/M
+Rosie/M
+Roslyn/M
+Ross/M
+Rossetti/M
+Rossini/M
+Rostand/M
+Rostov/M
+Rostropovich/M
+Roswell/M
+Rotarian/M
+Roth/M
+Rothko/M
+Rothschild/M
+Rotterdam/M
+Rottweiler/M
+Rouault/M
+Rourke/M
+Rousseau/M
+Rove/RM
+Rover/M
+Rowe/M
+Rowena/M
+Rowland/M
+Rowling/M
+Roxanne/M
+Roxie/M
+Roxy/M
+Roy/M
+Royal/M
+Royce/M
+Rozelle/M
+Rte
+Ru/MH
+Rubaiyat/M
+Rubbermaid/M
+Ruben/SM
+Rubens/M
+Rubicon/MS
+Rubik/M
+Rubin/M
+Rubinstein/M
+Ruby/M
+Ruchbah/M
+Rudolf/M
+Rudolph/M
+Rudy/M
+Rudyard/M
+Rufus/M
+Ruhr/M
+Ruiz/M
+Rukeyser/M
+Rumpelstiltskin/M
+Rumsfeld/M
+Runnymede/M
+Runyon/M
+Rupert/M
+Rush/M
+Rushdie/M
+Rushmore/M
+Ruskin/M
+Russ/M
+Russel/M
+Russell/M
+Russia/M
+Russian/SM
+Russo/M
+Rustbelt/M
+Rusty/M
+Rutan/M
+Rutgers/M
+Ruth/M
+Rutherford/M
+Ruthie/M
+Rutledge/M
+Rwanda/MS
+Rwandan/SM
+Rwy
+Rx
+Ry
+Ryan/M
+Rydberg/M
+Ryder/M
+Ryukyu/M
+S/MN
+SA
+SAC
+SALT/M
+SAM/M
+SAP/M
+SARS/M
+SASE
+SAT
+SBA
+SC/M
+SCSI/M
+SD
+SDI
+SE/M
+SEATO
+SEC/M
+SF
+SGML/M
+SIDS/M
+SJ
+SJW
+SK
+SLR
+SO/S
+SOB/M
+SOP/M
+SOS/M
+SOSes
+SPCA
+SPF
+SQL
+SQLite/M
+SRO
+SS
+SSA
+SSE/M
+SSS
+SST
+SSW/M
+ST
+STD
+STOL
+SUSE/M
+SUV
+SVN/M
+SW/M
+SWAK
+SWAT
+Saab/M
+Saar/M
+Saarinen/M
+Saatchi/M
+Sabbath/M
+Sabbaths
+Sabik/M
+Sabin/M
+Sabina/M
+Sabine/M
+Sabre/M
+Sabrina/M
+Sacajawea/M
+Sacco/M
+Sachs/M
+Sacramento/M
+Sadat/M
+Saddam/M
+Sadducee/M
+Sade/M
+Sadie/M
+Sadr/M
+Safavid/M
+Safeway/M
+Sagan/M
+Saginaw/M
+Sagittarius/MS
+Sahara/M
+Saharan/M
+Sahel/M
+Saigon/M
+Saiph/M
+Sakai/M
+Sakha/M
+Sakhalin/M
+Sakharov/M
+Saki/M
+Saks/M
+Sal/MY
+Saladin/M
+Salado/M
+Salamis/M
+Salas/M
+Salazar/M
+Salem/M
+Salerno/M
+Salesforce/M
+Salinas/M
+Salinger/M
+Salisbury/M
+Salish/M
+Salk/M
+Sallie/M
+Sallust/M
+Sally/M
+Salome/M
+Salonika/M
+Salton/M
+Salvador/M
+Salvadoran/SM
+Salvadorean/MS
+Salvadorian/MS
+Salvatore/M
+Salween/M
+Salyut/M
+Sam/M
+Samantha/M
+Samar/M
+Samara/M
+Samaritan/MS
+Samarkand/M
+Sammie/M
+Sammy/M
+Samoa/M
+Samoan/SM
+Samoset/M
+Samoyed/M
+Sampson/M
+Samson/M
+Samsonite/M
+Samsung/M
+Samuel/M
+Samuelson/M
+San'a
+San/M
+Sana/M
+Sanchez/M
+Sancho/M
+Sand/ZM
+Sandburg/M
+Sanders/M
+Sandinista/M
+Sandoval/M
+Sandra/M
+Sandy/M
+Sanford/M
+Sanforized/M
+Sang/MR
+Sanger/M
+Sanhedrin/M
+Sanka/M
+Sankara/M
+Sanskrit/M
+Santa/M
+Santana/M
+Santayana/M
+Santeria/M
+Santiago/M
+Santos/M
+Sappho/M
+Sapporo/M
+Sara/M
+Saracen/MS
+Saragossa/M
+Sarah/M
+Sarajevo/M
+Saran/M
+Sarasota/M
+Saratov/M
+Sarawak/M
+Sardinia/M
+Sargasso/M
+Sargent/M
+Sargon/M
+Sarnoff/M
+Saroyan/M
+Sarto/M
+Sartre/M
+Sasha/M
+Sask
+Saskatchewan/M
+Saskatoon/M
+Sasquatch/MS
+Sassanian/M
+Sassoon/M
+Sat/M
+Satan/M
+Satanism/M
+Satanist/M
+Saturday/MS
+Saturn/M
+Saturnalia/M
+Saudi/MS
+Saul/M
+Saunders/M
+Saundra/M
+Saussure/M
+Sauternes
+Savage/M
+Savannah/M
+Savior/M
+Savonarola/M
+Savoy/M
+Savoyard/M
+Sawyer/M
+Saxon/MS
+Saxony/M
+Sayers/M
+Sb/M
+Sc/M
+Scala/M
+Scan
+Scandinavia/M
+Scandinavian/MS
+Scaramouch/M
+Scarborough/M
+Scarlatti/M
+Scheat/M
+Schedar/M
+Scheherazade/M
+Schelling/M
+Schenectady/M
+Schiaparelli/M
+Schick/M
+Schiller/M
+Schindler/M
+Schlesinger/M
+Schliemann/M
+Schlitz/M
+Schloss/M
+Schmidt/M
+Schnabel/M
+Schnauzer/M
+Schneider/M
+Schoenberg/M
+Schopenhauer/M
+Schrieffer/M
+Schrodinger/M
+Schroeder/M
+Schubert/M
+Schultz/M
+Schulz/M
+Schumann/M
+Schumpeter/M
+Schuyler/M
+Schuylkill/M
+Schwartz/M
+Schwarzenegger/M
+Schwarzkopf/M
+Schweitzer/M
+Schweppes/M
+Schwinger/M
+Schwinn/M
+Scientologist/SM
+Scientology/M
+Scipio/M
+Scopes/M
+Scorpio/SM
+Scorpius/M
+Scorsese/M
+Scot/SM
+Scotch/MS
+Scotchman/M
+Scotchmen/M
+Scotchwoman/M
+Scotchwomen/M
+Scotia/M
+Scotland/M
+Scotsman/M
+Scotsmen/M
+Scotswoman/M
+Scotswomen/M
+Scott/M
+Scottie/SM
+Scottish/M
+Scottsdale/M
+Scrabble/MS
+Scranton/M
+Scriabin/M
+Scribner/M
+Scripture/SM
+Scrooge/M
+Scruggs/M
+Scud/M
+Sculley/M
+Scylla/M
+Scythia/M
+Scythian/M
+Se/MH
+Seaborg/M
+Seagram/M
+Sean/M
+Sears/M
+Seaside/M
+Seattle/M
+Sebastian/M
+Sebring/M
+Sec
+Seconal/M
+Secretariat/M
+Secretary
+Seder/MS
+Sedna/M
+Seebeck/M
+Seeger/M
+Sega/M
+Segovia/M
+Segre/M
+Segundo/M
+Segway/S
+Seiko/M
+Seine/M
+Seinfeld/M
+Sejong/M
+Selassie/M
+Selectric/M
+Selena/M
+Seleucid/M
+Seleucus/M
+Selim/M
+Seljuk/M
+Selkirk/M
+Sellers/M
+Selma/M
+Selznick/M
+Semarang/M
+Seminole/MS
+Semiramis/M
+Semite/MS
+Semitic/SM
+Semtex/M
+Senate/MS
+Sendai/M
+Seneca/MS
+Senegal/M
+Senegalese/M
+Senghor/M
+Senior/M
+Sennacherib/M
+Sennett/M
+Sensurround/M
+Seoul/M
+Sep
+Sephardi/M
+Sepoy/M
+Sept/M
+September/MS
+Septuagint/MS
+Sequoya/M
+Serb/SM
+Serbia/M
+Serbian/MS
+Serena/M
+Serengeti/M
+Sergei/M
+Sergio/M
+Serpens/M
+Serra/M
+Serrano/M
+Set/M
+Seth/M
+Seton/M
+Seurat/M
+Seuss/M
+Sevastopol/M
+Severn/M
+Severus/M
+Seville/M
+Sevres/M
+Seward/M
+Sextans/M
+Sexton/M
+Seychelles/M
+Seyfert/M
+Seymour/M
+Sgt
+Shaanxi/M
+Shackleton/M
+Shaffer/M
+Shah/M
+Shaka/M
+Shaker
+Shakespeare/M
+Shakespearean/M
+Shana/M
+Shandong/M
+Shane/M
+Shanghai/M
+Shankara/M
+Shanna/M
+Shannon/M
+Shantung/M
+Shanxi/M
+Shapiro/M
+SharePoint/M
+Shari'a/M
+Shari/M
+Sharif/M
+Sharlene/M
+Sharon/M
+Sharp/M
+Sharpe/M
+Sharron/M
+Shasta/M
+Shaula/M
+Shaun/M
+Shauna/M
+Shavian/M
+Shavuot/M
+Shaw/M
+Shawn/M
+Shawna/M
+Shawnee/SM
+Shcharansky/M
+Shea/M
+Sheba/M
+Shebeli/M
+Sheboygan/M
+Sheena/M
+Sheetrock/M
+Sheffield/M
+Sheila/M
+Shelby/M
+Sheldon/M
+Shelia/M
+Shell/M
+Shelley/M
+Shelly/M
+Shelton/M
+Shenandoah/M
+Shenyang/M
+Sheol/M
+Shepard/M
+Shepherd/M
+Sheppard/M
+Sheratan/M
+Sheraton/M
+Sheree/M
+Sheri/M
+Sheridan/M
+Sherlock/M
+Sherman/M
+Sherpa/M
+Sherri/M
+Sherrie/M
+Sherry/M
+Sherwood/M
+Sheryl/M
+Shetland/SM
+Shetlands/M
+Shevardnadze/M
+Shevat/M
+Shi'ite/M
+Shields/M
+Shiite/MS
+Shijiazhuang/M
+Shikoku/M
+Shillong/M
+Shiloh/M
+Shinto/MS
+Shintoism/MS
+Shintoist/MS
+Shiraz/M
+Shirley/M
+Shiva/M
+Shockley/M
+Short/M
+Shorthorn/M
+Shoshone/SM
+Shostakovitch/M
+Shrek/M
+Shreveport/M
+Shriner/M
+Shropshire/M
+Shula/M
+Shylock/M
+Shylockian/M
+Si/M
+Siam/M
+Siamese/M
+Sibelius/M
+Siberia/M
+Siberian/MS
+Sibyl/M
+Sichuan/M
+Sicilian/SM
+Sicily/M
+Sid/M
+Siddhartha/M
+Sidney/M
+Siegfried/M
+Siemens/M
+Sierpinski/M
+Sierras
+Sigismund/M
+Sigmund/M
+Sigurd/M
+Sihanouk/M
+Sikh/M
+Sikhism
+Sikhs
+Sikkim/M
+Sikkimese/M
+Sikorsky/M
+Silas/M
+Silesia/M
+Silurian/SM
+Silva/M
+Silvia/M
+Simenon/M
+Simmental/M
+Simmons/M
+Simon/M
+Simone/M
+Simpson/SM
+Simpsons/M
+Simpsonville/M
+Sims/M
+Sinai/M
+Sinatra/M
+Sinbad/M
+Sinclair/M
+Sindbad/M
+Sindhi/M
+Singapore/M
+Singaporean/SM
+Singer/M
+Singh/M
+Singleton/M
+Sinhalese/M
+Sinkiang/M
+Sioux/M
+Sir/SM
+Sirius/M
+Sistine/M
+Sisyphean/M
+Sisyphus/M
+Siva/M
+Sivan/M
+Sjaelland/M
+Skinner/M
+Skippy/M
+Skopje/M
+Skye/M
+Skylab/M
+Skype/M
+Slackware/M
+Slashdot/M
+Slater/M
+Slav/SM
+Slavic/M
+Slavonic/M
+Slidell/M
+Slinky/M
+Sloan/M
+Sloane/M
+Slocum/M
+Slovak/SM
+Slovakia/M
+Slovakian
+Slovene/SM
+Slovenia/M
+Slovenian/MS
+Slurpee/M
+Sm/M
+Small/M
+Smetana/M
+Smirnoff/M
+Smith/M
+Smithson/M
+Smithsonian/M
+Smokey/M
+Smolensk/M
+Smollett/M
+Smuts/M
+Smyrna
+Sn/M
+Snake/M
+Snapple/M
+Snead/M
+Snell/M
+Snickers/M
+Snider/M
+Snoopy/M
+Snow/M
+Snowbelt/M
+Snyder/M
+Soave/M
+Soc
+Socastee/M
+Socorro/M
+Socrates/M
+Socratic/M
+Soddy/M
+Sodom/M
+Sofia/M
+Soho/M
+Sol/M
+Solis/M
+Solomon/M
+Solon/M
+Solzhenitsyn/M
+Somali/SM
+Somalia/M
+Somalian/MS
+Somme/M
+Somoza/M
+Son/M
+Sondheim/M
+Sondra/M
+Songhai/M
+Songhua/M
+Sonia/M
+Sonja/M
+Sonny/M
+Sonora/M
+Sontag/M
+Sony/M
+Sonya/M
+Sophia/M
+Sophie/M
+Sophoclean/M
+Sophocles/M
+Sopwith/M
+Sorbonne/M
+Sosa/M
+Soto/M
+Souphanouvong/M
+Sourceforge/M
+Sousa/M
+South/M
+Southampton/M
+Southeast/MS
+Southerner/SM
+Southey/M
+Souths
+Southwest/MS
+Soviet/M
+Soweto/M
+Soyinka/M
+Soyuz/M
+Sp
+Spaatz/M
+Spackle/M
+Spahn/M
+Spain/M
+Spam/M
+Span
+Spanglish
+Spaniard/SM
+Spanish/M
+Sparks/M
+Sparta/M
+Spartacus/M
+Spartan/MS
+Spartanburg/M
+Spears/M
+Speer/M
+Spence/RM
+Spencer/M
+Spencerian/M
+Spengler/M
+Spenglerian/M
+Spenser/M
+Spenserian/M
+Sperry/M
+Sphinx/M
+Spica/M
+Spielberg/M
+Spillane/M
+Spinoza/M
+Spinx/M
+Spiro/M
+Spirograph/M
+Spitsbergen/M
+Spitz/M
+Spock/M
+Spokane/M
+Springdale/M
+Springfield/M
+Springsteen/M
+Sprint/M
+Sprite/M
+Sputnik/M
+Sq
+Squanto/M
+Squibb/M
+Sr/M
+Srinagar/M
+Srivijaya/M
+St
+Sta
+Stacey/M
+Staci/M
+Stacie/M
+Stacy/M
+Stael/M
+Stafford/M
+StairMaster/M
+Stalin/M
+Stalingrad/M
+Stalinist/M
+Stallone/M
+Stamford/M
+Stan/M
+Standish/M
+Stanford/M
+Stanislavsky/M
+Stanley/M
+Stanton/M
+Staples/M
+Starbucks/M
+Stark/M
+Starkey/M
+Starr/M
+Staten/M
+States
+Staubach/M
+Staunton/M
+Ste
+Steadicam/M
+Steele/M
+Stefan/M
+Stefanie/M
+Stein/MR
+Steinbeck/M
+Steinem/M
+Steiner/M
+Steinmetz/M
+Steinway/M
+Stella/M
+Stendhal/M
+Stengel/M
+Stephan/M
+Stephanie/M
+Stephen/MS
+Stephens/M
+Stephenson/M
+Sterling/M
+Stern/M
+Sterne/M
+Sterno/M
+Stetson/M
+Steuben/M
+Steubenville/M
+Steve/M
+Steven/MS
+Stevens/M
+Stevenson/M
+Stevie/M
+Stewart/M
+Stieglitz/M
+Stilton/SM
+Stimson/M
+Stine/M
+Stirling/M
+Stockhausen/M
+Stockholm/M
+Stockton/M
+Stoic/SM
+Stoicism/MS
+Stokes/M
+Stolichnaya/M
+Stolypin/M
+Stone/M
+Stonehenge/M
+Stoppard/M
+Stout/M
+Stowe/M
+Strabo/M
+Stradivari
+Stradivarius/M
+Strasbourg/M
+Strauss/M
+Stravinsky/M
+Streisand/M
+Strickland/M
+Strindberg/M
+Stromboli/M
+Strong/M
+Stu/M
+Stuart/MS
+Studebaker/M
+Stuttgart/M
+Stuyvesant/M
+Stygian/M
+Styrofoam/SM
+Styron/M
+Styx/M
+Suarez/M
+Subaru/M
+Sucre/M
+Sucrets/M
+Sudan/M
+Sudanese/M
+Sudetenland/M
+Sudoku/M
+Sudra/M
+Sue/M
+Suetonius/M
+Suez/M
+Suffolk/M
+Sufi/M
+Sufism/M
+Suharto/M
+Sui/M
+Sukarno/M
+Sukkot
+Sulawesi/M
+Suleiman/M
+Sulla/M
+Sullivan/M
+Sumatra/M
+Sumatran/SM
+Sumeria/M
+Sumerian/SM
+Summer/MS
+Summers/M
+Sumner/M
+Sumter/M
+Sun/SM
+Sunbeam/M
+Sunbelt/M
+Sundanese/M
+Sundas/M
+Sunday/MS
+Sung/M
+Sunkist/M
+Sunni/SM
+Sunnite/MS
+Sunnyvale/M
+Superbowl/M
+Superfund/M
+Superglue/M
+Superior/M
+Superman/M
+Supt
+Surabaya/M
+Surat/M
+Suriname/M
+Surinamese
+Surya/M
+Susan/M
+Susana/M
+Susanna/M
+Susanne/M
+Susie/M
+Susquehanna/M
+Sussex/M
+Sutherland/M
+Sutton/M
+Suva/M
+Suwanee/M
+Suzanne/M
+Suzette/M
+Suzhou/M
+Suzuki/M
+Suzy/M
+Svalbard/M
+Sven/M
+Svengali/M
+Sverdlovsk
+Swahili/SM
+Swammerdam/M
+Swanee/M
+Swansea/M
+Swanson/M
+Swazi/SM
+Swaziland/M
+Swed/N
+Swede/SM
+Sweden/M
+Swedenborg/M
+Swedish/M
+Sweeney/M
+Sweet/M
+Swift/M
+Swinburne/M
+Swiss/MS
+Swissair/M
+Switz
+Switzerland/M
+Sybil/M
+Sydney/M
+Sykes/M
+Sylvester/M
+Sylvia/M
+Sylvie/M
+Synge/M
+Syracuse/M
+Syria/M
+Syriac/M
+Syrian/MS
+Szilard/M
+Szymborska/M
+T'ang/M
+T/MDG
+TA
+TARP
+TB/M
+TBA
+TD
+TDD
+TEFL
+TELNET/S
+TELNETTed
+TELNETTing
+TESL
+TESOL
+TGIF
+THC
+TKO/M
+TLC/M
+TM
+TN
+TNT/M
+TOEFL
+TQM
+TV/SM
+TVA
+TWA/M
+TWX
+TX
+Ta/M
+Tabasco/SM
+Tabatha/M
+Tabernacle/MS
+Tabitha/M
+Tabriz/MS
+Tacitus/M
+Tacoma/M
+Tad/M
+Tadzhik/M
+Taegu/M
+Taejon/M
+Taft/M
+Tagalog/SM
+Tagore/M
+Tagus/M
+Tahiti/M
+Tahitian/MS
+Tahoe/M
+Taichung/M
+Tainan
+Taine/M
+Taipei/M
+Taiping/M
+Taiwan/M
+Taiwanese/M
+Taiyuan/M
+Tajikistan/M
+Taklamakan/M
+Talbot/M
+Taliban/M
+Taliesin/M
+Tallahassee/M
+Tallchief/M
+Talley/M
+Talleyrand/M
+Tallinn/M
+Talmud/MS
+Talmudic
+Talmudist
+Tamara/M
+Tameka/M
+Tamera/M
+Tamerlane/M
+Tami/M
+Tamika/M
+Tamil/MS
+Tammany/M
+Tammi/M
+Tammie/M
+Tammuz/M
+Tammy/M
+Tampa/M
+Tampax/M
+Tamra/M
+Tamworth/M
+Tancred/M
+Taney/M
+Tanganyika/M
+Tangier/MS
+Tangshan/M
+Tania/M
+Tanisha/M
+Tanner/M
+Tannhauser/M
+Tantalus/M
+Tanya/M
+Tanzania/M
+Tanzanian/SM
+Tao/M
+Taoism/MS
+Taoist/MS
+Tara/M
+Tarantino/M
+Tarawa/M
+Tarazed/M
+Tarbell/M
+Target/M
+Tarim/M
+Tarkenton/M
+Tarkington/M
+Tartary/M
+Tartuffe/M
+Tarzan/M
+Tasha/M
+Tashkent/M
+Tasman/M
+Tasmania/M
+Tasmanian/M
+Tass/M
+Tatar/MS
+Tate/M
+Tatum/M
+Taurus/MS
+Tavares/M
+Tawney/M
+Taylor/M
+Tb/M
+Tbilisi/M
+Tc/M
+Tchaikovsky/M
+Te/M
+TeX
+TeXes
+Teasdale/M
+Technicolor/M
+Tecumseh/M
+Ted/M
+Teddy/M
+Teflon/MS
+Tegucigalpa/M
+Tehran
+TelePrompTer
+TelePrompter/M
+Telemachus/M
+Telemann/M
+Teletype
+Tell/MR
+Teller/M
+Telugu/M
+Temecula/M
+Tempe
+Templar/M
+Temple/M
+Tenn/M
+Tennessean/SM
+Tennessee/M
+Tennyson/M
+Tennysonian
+Tenochtitlan/M
+TensorFlow/M
+Teotihuacan/M
+Terence/M
+Teresa/M
+Tereshkova/M
+Teri/M
+Terkel/M
+Terpsichore/M
+Terr/M
+Terra/M
+Terran/M
+Terrance/M
+Terrell/M
+Terrence/M
+Terri/M
+Terrie/M
+Terry/M
+Tertiary/M
+Tesla/M
+Tess/M
+Tessa/M
+Tessie/M
+Tet/M
+Tethys/M
+Tetons/M
+Teuton/MS
+Teutonic/M
+Tevet/M
+Tex/M
+Texaco/M
+Texan/MS
+Texarkana/M
+Texas/M
+Th/M
+Thackeray/M
+Thad/M
+Thaddeus/M
+Thai/SM
+Thailand/M
+Thales/M
+Thalia/M
+Thames/M
+Thanh/M
+Thanksgiving/MS
+Thant/M
+Thar/M
+Tharp/M
+Thatcher/M
+Thea/M
+Thebes/M
+Theiler/M
+Thelma/M
+Themistocles/M
+Theocritus/M
+Theodora/M
+Theodore/M
+Theodoric/M
+Theodosius/M
+Theosophy/M
+Theravada/M
+Theresa/M
+Therese/M
+Thermopylae/M
+Thermos
+Theron/M
+Theseus/M
+Thespian/M
+Thespis/M
+Thessalonian/SM
+Thessaloniki/M
+Thessaly/M
+Thieu/M
+Thimbu/M
+Thimphu
+Thomas/M
+Thomism/M
+Thomistic/M
+Thompson/M
+Thomson/M
+Thor/M
+Thorazine/M
+Thoreau/M
+Thornton/M
+Thoroughbred/M
+Thorpe/M
+Thoth/M
+Thrace/M
+Thracian/M
+Thu
+Thucydides/M
+Thule/M
+Thunderbird/M
+Thur/S
+Thurber/M
+Thurman/M
+Thurmond/M
+Thursday/SM
+Thutmose/M
+Ti/M
+Tia/M
+Tianjin/M
+Tiber/M
+Tiberius/M
+Tibet/M
+Tibetan/MS
+Ticketmaster/M
+Ticonderoga/M
+Tide/M
+Tienanmen/M
+Tiffany/M
+Tigris/M
+Tijuana/M
+Tillich/M
+Tillman/M
+Tilsit/M
+Tim/M
+Timbuktu/M
+Timex/M
+Timmy/M
+Timon/M
+Timor/M
+Timothy/M
+Timur/M
+Timurid/M
+Tina/M
+Ting/M
+Tinkerbell/M
+Tinkertoy/M
+Tinseltown/M
+Tintoretto/M
+Tippecanoe/M
+Tipperary/M
+Tirane
+Tiresias/M
+Tirol/M
+Tirolean
+Tisha/M
+Tishri/M
+Titan/SM
+Titania/M
+Titanic/M
+Titian/M
+Titicaca/M
+Tito/M
+Titus/M
+Titusville/M
+Tl/M
+Tlaloc/M
+Tlingit/M
+Tm/M
+Tobago/M
+Tobit/M
+Toby/M
+Tocantins/M
+Tocqueville/M
+Tod/M
+Todd/M
+Togo/M
+Togolese/M
+Tojo/M
+Tokay/M
+Tokugawa/M
+Tokyo/M
+Tokyoite
+Toledo/MS
+Tolkien/M
+Tolstoy/M
+Toltec/M
+Tolyatti/M
+Tom/M
+Tomas/M
+Tombaugh/M
+Tomlin/M
+Tommie/M
+Tommy/M
+Tompkins/M
+Tomsk/M
+Tonga/M
+Tongan/MS
+Toni/M
+Tonia/M
+Tonto/M
+Tony/M
+Tonya/M
+Topeka/M
+Topsy/M
+Torah/M
+Torahs
+Toronto/M
+Torquemada/M
+Torrance/M
+Torrens/M
+Torres/M
+Torricelli/M
+Tortola/M
+Tortuga/M
+Torvalds/M
+Tory/SM
+Tosca/M
+Toscanini/M
+Toshiba/M
+Toto/M
+Toulouse/M
+Townes/M
+Townsend/M
+Toynbee/M
+Toyoda/M
+Toyota/M
+Tracey/M
+Traci/M
+Tracie/M
+Tracy/M
+Trafalgar/M
+Trailways/M
+Trajan/M
+Tran/M
+Transcaucasia/M
+Transvaal/M
+Transylvania/M
+Transylvanian/M
+Trappist/SM
+Travis/M
+Travolta/M
+Treasury/SM
+Treblinka/M
+Trekkie/M
+Trent/M
+Trenton/M
+Trevelyan/M
+Trevino/M
+Trevor/M
+Trey/M
+Triangulum/M
+Triassic/M
+Tricia/M
+Trident/M
+Trieste/M
+Trimurti/M
+Trina/M
+Trinidad/M
+Trinidadian/MS
+Trinity/SM
+Tripitaka/M
+Tripoli/M
+Trippe/M
+Trisha/M
+Tristan/M
+Triton/M
+Trobriand/M
+Troilus/M
+Trojan/MS
+Trollope/M
+Trondheim/M
+Tropicana/M
+Trotsky/M
+Troy/M
+Troyes
+Truckee/M
+Trudeau/M
+Trudy/M
+Truffaut/M
+Trujillo/M
+Truman/M
+Trumbull/M
+Trump/M
+Truth/M
+Tsimshian/M
+Tsiolkovsky/M
+Tsitsihar/M
+Tsongkhapa/M
+Tswana/M
+Tu/M
+Tuamotu/M
+Tuareg/M
+Tubman/M
+Tucker/M
+Tucson/M
+Tucuman/M
+Tudor/SM
+Tue/S
+Tues/M
+Tuesday/MS
+Tulane/M
+Tull/M
+Tulsa/M
+Tulsidas/M
+Tums/M
+Tungus/M
+Tunguska/M
+Tunis/M
+Tunisia/M
+Tunisian/MS
+Tunney/M
+Tupi/M
+Tupperware/M
+Tupungato/M
+Turgenev/M
+Turin/M
+Turing/M
+Turk/SM
+Turkestan/M
+Turkey/M
+Turkic/MS
+Turkish/M
+Turkmenistan/M
+Turlock/M
+Turner/M
+Turpin/M
+Tuscaloosa/M
+Tuscan/M
+Tuscany/M
+Tuscarora/MS
+Tuscon/M
+Tuskegee/M
+Tussaud/M
+Tut/M
+Tutankhamen/M
+Tutsi/M
+Tutu/M
+Tuvalu/M
+Tuvaluan
+Twain/M
+Tweed/M
+Tweedledee/M
+Tweedledum/M
+Twila/M
+Twinkies/M
+Twitter/M
+Twizzlers/M
+Twp
+Ty/M
+Tycho/M
+Tylenol/M
+Tyler/M
+Tyndale/M
+Tyndall/M
+Tyre/M
+Tyree/M
+Tyrolean
+Tyrone/M
+Tyson/M
+U/M
+UAR
+UAW
+UBS/M
+UCLA/M
+UFO/SM
+UHF/M
+UK/M
+UL
+UN/M
+UNESCO/M
+UNICEF/M
+UNIX/M
+UPC
+UPI/M
+UPS/M
+URL/S
+US/M
+USA/M
+USAF
+USB
+USCG
+USDA/M
+USIA
+USMC
+USN
+USO
+USP
+USPS
+USS
+USSR/M
+UT/M
+UTC
+UV/M
+Ubangi/M
+Ubuntu/M
+Ucayali/M
+Uccello/M
+Udall/M
+Ufa/M
+Uganda/M
+Ugandan/MS
+Uighur/M
+Ujungpandang/M
+Ukraine/M
+Ukrainian/SM
+Ulster/M
+Ultrasuede/M
+Ulyanovsk/M
+Ulysses/M
+Umbriel/M
+Underwood/M
+Ungava/M
+Unicode/M
+Unilever/M
+Union/SM
+Unionist
+Uniontown/M
+Uniroyal/M
+Unitarian/MS
+Unitarianism/MS
+Unitas/M
+Unix/S
+Unukalhai/M
+Upanishads/M
+Updike/M
+Upjohn/M
+Upton/M
+Ur/M
+Ural/SM
+Urals/M
+Urania/M
+Uranus/M
+Urban/M
+Urdu/M
+Urey/M
+Uriah/M
+Uriel/M
+Uris/M
+Urquhart/M
+Ursa/M
+Ursula/M
+Ursuline/M
+Uruguay/M
+Uruguayan/MS
+Urumqi/M
+Usenet/MS
+Ustinov/M
+Ut
+Utah/M
+Utahan/MS
+Ute/SM
+Utica/M
+Utopia/SM
+Utopian/SM
+Utrecht/M
+Utrillo/M
+Uzbek/M
+Uzbekistan/M
+Uzi/SM
+V/M
+VA
+VAT/M
+VAX
+VAXes
+VBA/M
+VCR/M
+VD/M
+VDT
+VDU
+VF
+VFW/M
+VG
+VGA
+VHF/M
+VHS
+VI/M
+VIP/SM
+VISTA
+VJ
+VLF/M
+VOA
+VP
+VT
+VTOL
+Va/M
+Vacaville/M
+Vader/M
+Vaduz/M
+Val/M
+Valarie/M
+Valdez/M
+Valdosta/M
+Valencia/SM
+Valenti/M
+Valentin/M
+Valentine/M
+Valentino/M
+Valenzuela/M
+Valeria/M
+Valerian/M
+Valerie/M
+Valery/M
+Valhalla/M
+Valium/MS
+Valkyrie/SM
+Vallejo/M
+Valletta/M
+Valois/M
+Valparaiso/M
+Valvoline/M
+Van/M
+Vance/M
+Vancouver/M
+Vandal/MS
+Vanderbilt/M
+Vandyke/M
+Vanessa/M
+Vang/M
+Vanuatu/M
+Vanzetti/M
+Varanasi/M
+Varese/M
+Vargas/M
+Vaseline/SM
+Vasquez/M
+Vassar/M
+Vatican/M
+Vauban/M
+Vaughan/M
+Vaughn/M
+Vazquez/M
+Veblen/M
+Veda/SM
+Vedanta/M
+Vega/SM
+Vegas/M
+Vegemite/M
+Vela/M
+Velasquez/M
+Velazquez/M
+Velcro/MS
+Velez/M
+Velma/M
+Velveeta/M
+Venetian/SM
+Venezuela/M
+Venezuelan/SM
+Venice/M
+Venn/M
+Ventolin/M
+Venus/MS
+Venusian/M
+Vera/M
+Veracruz/M
+Verde/M
+Verdi/M
+Verdun/M
+Verizon/M
+Verlaine/M
+Vermeer/M
+Vermont/ZMR
+Vermonter/M
+Vern/M
+Verna/M
+Verne/M
+Vernon/M
+Verona/M
+Veronese/M
+Veronica/M
+Versailles/M
+Vesalius/M
+Vespasian/M
+Vespucci/M
+Vesta/M
+Vesuvius/M
+Viacom/M
+Viagra/M
+Vic/M
+Vicente/M
+Vichy/M
+Vicki/M
+Vickie/M
+Vicksburg/M
+Vicky/M
+Victor/M
+Victoria/M
+Victorian/MS
+Victorianism
+Victorville/M
+Victrola/M
+Vidal/M
+Vienna/M
+Viennese/M
+Vientiane/M
+Vietcong/M
+Vietminh/M
+Vietnam/M
+Vietnamese/M
+Vijayanagar/M
+Vijayawada/M
+Viking/MS
+Vila/M
+Villa/SM
+Villarreal/M
+Villas/M
+Villon/M
+Vilma/M
+Vilnius/M
+Vilyui/M
+Vince/M
+Vincent/M
+Vindemiatrix/M
+Vineland/M
+Vinson/M
+Viola/M
+Violet/M
+Virgie/M
+Virgil/M
+Virginia/M
+Virginian/SM
+Virgo/SM
+Visa/M
+Visalia/M
+Visayans/M
+Vishnu/M
+Visigoth/M
+Visigoths
+Vistula/M
+Vitim/M
+Vito/M
+Vitus/M
+Vivaldi/M
+Vivekananda/M
+Vivian/M
+Vivienne/M
+Vlad/M
+Vladimir/M
+Vladivostok/M
+Vlaminck/M
+Vlasic/M
+VoIP
+Vogue/M
+Volcker/M
+Voldemort/M
+Volga/M
+Volgograd/M
+Volkswagen/M
+Volstead/M
+Volta/M
+Voltaire/M
+Volvo/M
+Vonda/M
+Vonnegut/M
+Voronezh/M
+Vorster/M
+Voyager/M
+Vt
+Vuitton/M
+Vulcan/M
+Vulg
+Vulgate/SM
+W/MDT
+WA
+WAC
+WASP/M
+WATS/M
+WC
+WHO/M
+WI
+WMD
+WNW/M
+WP
+WSW/M
+WTO
+WV
+WW
+WWI
+WWII
+WWW/M
+WY
+WYSIWYG
+Wabash/M
+Wac
+Waco/M
+Wade/M
+Wagner/M
+Wagnerian/M
+Wahhabi/M
+Waikiki/M
+Waite/M
+Wake/M
+Waksman/M
+Wald/MN
+Waldemar/M
+Walden/M
+Waldensian/M
+Waldheim/M
+Waldo/M
+Waldorf/M
+Wales/M
+Walesa/M
+Walgreen/SM
+Walgreens/M
+Walker/M
+Walkman/M
+Wall/SMR
+Wallace/M
+Wallenstein/M
+Waller/M
+Wallis/M
+Walloon/M
+Walls/M
+Walmart/M
+Walpole/M
+Walpurgisnacht/M
+Walsh/M
+Walt/MRZ
+Walter/M
+Walters/M
+Walton/M
+Wanamaker/M
+Wanda/M
+Wang/M
+Wankel/M
+Ward/M
+Ware/MG
+Warhol/M
+Waring/M
+Warner/M
+Warren/M
+Warsaw/M
+Warwick/M
+Wasatch/M
+Wash/M
+Washington/M
+Washingtonian/MS
+Wassermann/M
+Waterbury/M
+Waterford/M
+Watergate/M
+Waterloo/MS
+Waters/M
+Watertown/M
+Watkins/M
+Watson/M
+Watsonville/M
+Watt/SM
+Watteau/M
+Watts/M
+Watusi/M
+Waugh/M
+Wausau/M
+Wave
+Wayne/M
+Waynesboro/M
+Weaver/M
+Web/MR
+Webb/M
+Weber/M
+Webern/M
+Webster/MS
+Wed/M
+Weddell/M
+Wedgwood/M
+Wednesday/MS
+Weeks/M
+Wehrmacht/M
+Wei/M
+Weierstrass/M
+Weill/M
+Weinberg/M
+Weirton/M
+Weiss/M
+Weissmuller/M
+Weizmann/M
+Weldon/M
+Welland/M
+Weller/M
+Welles/M
+Wellington/SM
+Wells/M
+Welsh/M
+Welshman/M
+Welshmen/M
+Welshwoman
+Wenatchee/M
+Wendell/M
+Wendi/M
+Wendy/M
+Wesak/M
+Wesley/M
+Wesleyan/M
+Wessex/M
+Wesson/M
+West/SM
+Western/MRS
+Westinghouse/M
+Westminster/M
+Weston/M
+Westphalia/M
+Weyden/M
+Wezen/M
+Wharton/M
+Wheaties/M
+Wheatstone/M
+Wheeler/M
+Wheeling/M
+Whig/SM
+Whipple/M
+Whirlpool/M
+Whistler/M
+Whitaker/M
+White/SM
+Whitefield/M
+Whitehall/M
+Whitehead/M
+Whitehorse/M
+Whiteley/M
+Whitfield/M
+Whitley/M
+Whitman/M
+Whitney/M
+Whitsunday/MS
+Whittier/M
+WiFi
+Wicca/M
+Wichita/M
+Wiemar/M
+Wiesel/M
+Wiesenthal/M
+Wiggins/M
+Wigner/M
+Wii/M
+Wikileaks
+Wikipedia/M
+Wilberforce/M
+Wilbert/M
+Wilbur/M
+Wilburn/M
+Wilcox/M
+Wilda/M
+Wilde/MR
+Wilder/M
+Wiles/M
+Wiley/M
+Wilford/M
+Wilfred/M
+Wilfredo/M
+Wilhelm/M
+Wilhelmina/M
+Wilkerson/M
+Wilkes/M
+Wilkins/M
+Wilkinson/M
+Will/M
+Willa/M
+Willamette/M
+Willard/M
+Willemstad/M
+William/SM
+Williams/M
+Williamsburg/M
+Williamson/M
+Williamsport/M
+Willie/M
+Willis/M
+Willy/M
+Wilma/M
+Wilmer/M
+Wilmington/M
+Wilson/M
+Wilsonian/M
+Wilton/M
+Wimbledon/M
+Wimsey/M
+Winchell/M
+Winchester/MS
+Windbreaker/M
+Windex/M
+Windhoek/M
+Windows/M
+Windsor/SM
+Windward/M
+Winesap/M
+Winfred/M
+Winfrey/M
+Winifred/M
+Winkle/M
+Winnebago/M
+Winnie/M
+Winnipeg/M
+Winston/M
+Winters/M
+Winthrop/M
+Wis
+Wisc
+Wisconsin/M
+Wisconsinite/MS
+Wise/M
+Witt/M
+Wittgenstein/M
+Witwatersrand/M
+Wm/M
+Wobegon/M
+Wodehouse/M
+Wolf/M
+Wolfe/M
+Wolff/M
+Wolfgang/M
+Wollongong/M
+Wollstonecraft/M
+Wolsey/M
+Wolverhampton
+Wonder/M
+Wonderbra/M
+Wong/M
+Wood/SM
+Woodard/M
+Woodhull/M
+Woodland/M
+Woodrow/M
+Woods/M
+Woodstock/M
+Woodward/M
+Woolf/M
+Woolite/M
+Woolongong/M
+Woolworth/M
+Wooster/M
+Wooten/M
+Worcester/SM
+Worcestershire/M
+WordPress/M
+Wordsworth/M
+Workman/M
+Worms/M
+Wotan/M
+Wovoka/M
+Wozniak/M
+Wozzeck/M
+Wrangell/M
+Wren/M
+Wright/M
+Wrigley/M
+Wroclaw/M
+Wu/M
+Wuhan/M
+Wurlitzer/M
+Wyatt/M
+Wycherley/M
+Wycliffe/M
+Wyeth/M
+Wylie/M
+Wynn/M
+Wyo
+Wyoming/M
+Wyomingite/SM
+X/M
+XEmacs/M
+XL/M
+XML
+XS
+XXL
+Xamarin/M
+Xanadu/M
+Xanthippe/M
+Xavier/M
+Xe/SM
+Xenakis/M
+Xenia/M
+Xenophon/M
+Xerox/MS
+Xerxes/M
+Xhosa/M
+Xi'an/M
+Xian/SM
+Xiaoping/M
+Ximenes/M
+Xingu/M
+Xinjiang/M
+Xiongnu/M
+Xizang/M
+Xmas/MS
+Xochipilli/M
+Xuzhou/M
+Y/M
+YMCA/M
+YMHA
+YMMV
+YT
+YWCA/M
+YWHA
+Yacc/M
+Yahoo/M
+Yahtzee/M
+Yahweh/M
+Yakima/M
+Yakut/M
+Yakutsk/M
+Yale/M
+Yalow/M
+Yalta/M
+Yalu/M
+Yamagata/M
+Yamaha/M
+Yamoussoukro/M
+Yang/M
+Yangon/M
+Yangtze/M
+Yank/SM
+Yankee/SM
+Yaobang/M
+Yaounde/M
+Yaqui/M
+Yaren
+Yaroslavl/M
+Yataro/M
+Yates/M
+Yauco/M
+Yb/M
+Yeager/M
+Yeats/M
+Yekaterinburg/M
+Yellowknife/M
+Yellowstone/M
+Yeltsin/M
+Yemen/M
+Yemeni/SM
+Yemenite
+Yenisei/M
+Yerevan/M
+Yerkes/M
+Yesenia/M
+Yevtushenko/M
+Yggdrasil/M
+Yiddish/M
+Ymir/M
+Yoda/M
+Yoknapatawpha/M
+Yoko/M
+Yokohama/M
+Yolanda/M
+Yong/M
+Yonkers/M
+York/M
+Yorkie/M
+Yorkshire/MS
+Yorktown/M
+Yoruba/M
+Yosemite/M
+Yossarian/M
+YouTube/M
+Young/M
+Youngstown/M
+Ypres/M
+Ypsilanti/M
+Yuan/M
+Yucatan/M
+Yugo/M
+Yugoslav/MS
+Yugoslavia/M
+Yugoslavian/SM
+Yukon/M
+Yule/SM
+Yuletide/MS
+Yuma/SM
+Yunnan/M
+Yuri/M
+Yves/M
+Yvette/M
+Yvonne/M
+Z/SMNXT
+Zachariah/M
+Zachary/M
+Zachery/M
+Zagreb/M
+Zaire/M
+Zairian
+Zambezi/M
+Zambia/M
+Zambian/SM
+Zamboni/M
+Zamenhof/M
+Zamora/M
+Zane/M
+Zanuck/M
+Zanzibar/M
+Zapata/M
+Zaporozhye/M
+Zapotec/M
+Zappa/M
+Zara/M
+Zarathustra/M
+Zealand/M
+Zebedee/M
+Zechariah/M
+Zedekiah/M
+Zedong/M
+Zeffirelli/M
+Zeke/M
+Zelig/M
+Zelma/M
+Zen/M
+Zenger/M
+Zeno/M
+Zephaniah/M
+Zephyrhills/M
+Zephyrus/M
+Zest/M
+Zeus/M
+Zhdanov
+Zhejiang/M
+Zhengzhou/M
+Zhivago/M
+Zhukov/M
+Zibo/M
+Ziegfeld/M
+Ziegler/M
+Ziggy/M
+Zika
+Zimbabwe/M
+Zimbabwean/SM
+Zimmerman/M
+Zinfandel/M
+Zion/SM
+Zionism/SM
+Zionist/SM
+Ziploc/M
+Zn/M
+Zoe/M
+Zola/M
+Zollverein/M
+Zoloft/M
+Zomba/M
+Zorn/M
+Zoroaster/M
+Zoroastrian/MS
+Zoroastrianism/SM
+Zorro/M
+Zosma/M
+Zr/M
+Zsigmondy/M
+Zubenelgenubi/M
+Zubeneschamali/M
+Zukor/M
+Zulu/SM
+Zululand
+Zuni/M
+Zurich/M
+Zwingli/M
+Zworykin/M
+Zyrtec/M
+Zyuganov/M
+Zzz
+a/S
+aah
+aardvark/SM
+ab/SDY
+aback
+abacus/MS
+abaft
+abalone/SM
+abandon/LSDG
+abandonment/M
+abase/LGDS
+abasement/M
+abash/GLDS
+abashed/UY
+abashment/M
+abate/LGDS
+abated/U
+abatement/M
+abattoir/MS
+abbe/SM
+abbess/MS
+abbey/MS
+abbot/MS
+abbr
+abbrev/S
+abbreviate/DSGNX
+abbreviation/M
+abdicate/GNDSX
+abdication/M
+abdomen/SM
+abdominal
+abduct/DSG
+abductee/MS
+abduction/SM
+abductor/MS
+abeam
+aberrant
+aberration/MS
+aberrational
+abet/S
+abetted
+abetting
+abettor/SM
+abeyance/M
+abhor/S
+abhorred
+abhorrence/M
+abhorrent/Y
+abhorring
+abidance/M
+abide/GS
+abiding/Y
+ability/IEMS
+abject/YP
+abjection/M
+abjectness/M
+abjuration/SM
+abjuratory
+abjure/ZGDRS
+abjurer/M
+ablate/XGNVDS
+ablation/M
+ablative/MS
+ablaze
+able/UT
+abler
+abloom
+ablution/SM
+abnegate/GNDS
+abnegation/M
+abnormal/Y
+abnormality/SM
+aboard
+abode/MS
+abolish/GDS
+abolition/M
+abolitionism/M
+abolitionist/SM
+abominable
+abominably
+abominate/DSGNX
+abomination/M
+aboriginal/MS
+aborigine/SM
+aborning
+abort/GVDS
+abortion/MS
+abortionist/MS
+abortive/Y
+abound/DSG
+about
+above/M
+aboveboard
+abracadabra/M
+abrade/GDS
+abrasion/MS
+abrasive/MYPS
+abrasiveness/M
+abreast
+abridge/DSG
+abridgment/MS
+abroad
+abrogate/XGNDS
+abrogation/M
+abrogator/MS
+abrupt/TPRY
+abruptness/M
+abs/M
+abscess/MDSG
+abscissa/SM
+abscission/M
+abscond/ZGSDR
+absconder/M
+abseil/MDSG
+absence/SM
+absent/DYSG
+absentee/MS
+absenteeism/M
+absentminded/YP
+absentmindedness/M
+absinthe/M
+absolute/PMYTNS
+absoluteness/M
+absolution/M
+absolutism/M
+absolutist/MS
+absolve/DSG
+absorb/AGDS
+absorbance
+absorbency/M
+absorbent/SM
+absorbing/Y
+absorption/M
+absorptive
+abstain/DRZGS
+abstainer/M
+abstemious/PY
+abstemiousness/M
+abstention/MS
+abstinence/M
+abstinent
+abstract/GSPMDY
+abstracted/YP
+abstractedness/M
+abstraction/SM
+abstractness/MS
+abstruse/YP
+abstruseness/M
+absurd/TPRY
+absurdist/MS
+absurdity/SM
+absurdness/M
+abundance/SM
+abundant/Y
+abuse's
+abuse/EGVDS
+abuser/MS
+abusive/YP
+abusiveness/M
+abut/SL
+abutment/MS
+abutted
+abutting
+abuzz
+abysmal/Y
+abyss/MS
+abyssal
+ac
+acacia/MS
+academe/M
+academia/M
+academic/SM
+academical/Y
+academician/MS
+academy/SM
+acanthus/MS
+accede/GDS
+accelerate/GNXDS
+acceleration/M
+accelerator/SM
+accent/MDSG
+accented/U
+accentual
+accentuate/GNDS
+accentuation/M
+accept/DSBG
+acceptability/M
+acceptableness/M
+acceptably/U
+acceptance/SM
+acceptation/MS
+accepted/U
+access/MDSG
+accessibility/IM
+accessible/I
+accessibly/I
+accession/MDGS
+accessorize/DSG
+accessory/SM
+accident/MS
+accidental/SMY
+acclaim/MDGS
+acclamation/M
+acclimate/DSGN
+acclimation/M
+acclimatization/M
+acclimatize/DSG
+acclivity/SM
+accolade/SM
+accommodate/XGNDS
+accommodating/Y
+accommodation/M
+accompanied/U
+accompaniment/MS
+accompanist/SM
+accompany/DSG
+accomplice/SM
+accomplish/DSLG
+accomplished/U
+accomplishment/MS
+accord/GMDS
+accordance/M
+accordant
+according/Y
+accordion/MS
+accordionist/MS
+accost/GMDS
+account/MDSBG
+accountability/M
+accountable/U
+accountancy/M
+accountant/MS
+accounted/U
+accounting/M
+accouter/SGD
+accouterments/M
+accredit/SGD
+accreditation/M
+accredited/U
+accretion/MS
+accrual/MS
+accrue/GDS
+acct
+acculturate/DSGN
+acculturation/M
+accumulate/XGNVDS
+accumulation/M
+accumulator/MS
+accuracy/IM
+accurate/IY
+accurateness/M
+accursed/P
+accursedness/M
+accusation/MS
+accusative/MS
+accusatory
+accuse/ZGDRS
+accuser/M
+accusing/Y
+accustom/DSG
+accustomed/U
+ace/DSMG
+acerbate/DSG
+acerbic
+acerbically
+acerbity/M
+acetaminophen/M
+acetate/MS
+acetic
+acetone/M
+acetonic
+acetyl
+acetylene/M
+ache/DSMG
+achene/MS
+achievable/U
+achieve/BLZGDRS
+achievement/SM
+achiever/M
+aching/Y
+achoo/M
+achromatic
+achy/TR
+acid/SMY
+acidic
+acidify/GDS
+acidity/M
+acidosis/M
+acidulous
+acknowledge/DSG
+acknowledged/U
+acknowledgment/SM
+acme/SM
+acne/M
+acolyte/MS
+aconite/MS
+acorn/MS
+acoustic/S
+acoustical/Y
+acoustics/M
+acquaint/AGSD
+acquaintance/SM
+acquaintanceship/M
+acquainted/U
+acquiesce/DSG
+acquiescence/M
+acquiescent/Y
+acquire/ZGBDRSL
+acquirement/M
+acquisition/MS
+acquisitive/YP
+acquisitiveness/M
+acquit/S
+acquittal/MS
+acquitted
+acquitting
+acre/SM
+acreage/MS
+acrid/PTRY
+acridity/M
+acridness/M
+acrimonious/YP
+acrimoniousness/M
+acrimony/M
+acrobat/MS
+acrobatic/S
+acrobatically
+acrobatics/M
+acronym/MS
+acrophobia/M
+acropolis/MS
+across
+acrostic/SM
+acrylamide
+acrylic/MS
+act's
+act/ASDGV
+acting/M
+actinium/M
+action/ASM
+actionable
+activate/ICANGSD
+activation/ICAM
+activator/MS
+active's
+active/IKY
+activeness/M
+actives
+activism/M
+activist/MS
+activities
+activity/IM
+actor/AMS
+actress/MS
+actual/Y
+actuality/SM
+actualization/M
+actualize/GDS
+actuarial
+actuary/SM
+actuate/GNDS
+actuation/M
+actuator/SM
+acuity/M
+acumen/M
+acupressure/M
+acupuncture/M
+acupuncturist/SM
+acute/PMYTRS
+acuteness/M
+acyclovir/M
+acyl
+ad/SM
+adage/MS
+adagio/MS
+adamant/MY
+adapt/BZGVDRS
+adaptability/M
+adaptation/MS
+adapter/M
+adaption/S
+add/SDRBZG
+addend/MS
+addenda
+addendum/M
+adder/M
+addict/GVMDS
+addiction/SM
+addition/SM
+additional/Y
+additive/SM
+addle/GDS
+address's
+address/AGDS
+addressable
+addressed/U
+addressee/SM
+adduce/GDS
+adenine/M
+adenocarcinoma
+adenoid/SM
+adenoidal
+adept/MYPS
+adeptness/M
+adequacy/IM
+adequate/IY
+adequateness/M
+adhere/GDS
+adherence/M
+adherent/SM
+adhesion/M
+adhesive/PSM
+adhesiveness/M
+adiabatic
+adieu/MS
+adios
+adipose
+adj
+adjacency/M
+adjacent/Y
+adjectival/Y
+adjective/MS
+adjoin/GDS
+adjourn/DGLS
+adjournment/SM
+adjudge/GDS
+adjudicate/GNVXDS
+adjudication/M
+adjudicator/SM
+adjudicatory
+adjunct/MS
+adjuration/MS
+adjure/GDS
+adjust/AGDSL
+adjustable
+adjuster/SM
+adjustment/AMS
+adjutant/SM
+adman/M
+admen
+admin/S
+administer/DGS
+administrate/XDSGNV
+administration/M
+administrative/Y
+administrator/MS
+admirably
+admiral/MS
+admiralty/M
+admiration/M
+admire/BZGDRS
+admirer/M
+admiring/Y
+admissibility/IM
+admissible/I
+admissibly
+admission/AM
+admissions
+admit/AS
+admittance/M
+admitted/Y
+admitting/A
+admix/GDS
+admixture/SM
+admonish/LDSG
+admonishment/MS
+admonition/MS
+admonitory
+ado/M
+adobe/MS
+adolescence/SM
+adolescent/SM
+adopt/AGVDS
+adoptable
+adopter/MS
+adoption/SM
+adorableness/M
+adorably
+adoration/M
+adore/BZGDRS
+adorer/M
+adoring/Y
+adorn/LGDS
+adorned/U
+adornment/MS
+adrenal/MS
+adrenalin's
+adrenaline/M
+adrenergic
+adrift
+adroit/PY
+adroitness/M
+adsorb/SDG
+adsorbent/MS
+adsorption/SM
+adulate/DSGN
+adulation/M
+adulator/MS
+adulatory
+adult/MS
+adulterant/MS
+adulterate/GNDS
+adulterated/U
+adulteration/M
+adulterer/SM
+adulteress/MS
+adulterous
+adultery/SM
+adulthood/M
+adumbrate/GNDS
+adumbration/M
+adv
+advance/LDSMG
+advancement/SM
+advantage/EDSMG
+advantageous/EY
+advent/SM
+adventitious/Y
+adventure/DRSMZG
+adventurer/M
+adventuresome
+adventuress/MS
+adventurism
+adventurist/S
+adventurous/YP
+adventurousness/M
+adverb/SM
+adverbial/SMY
+adversarial
+adversary/SM
+adverse/PRYT
+adverseness/M
+adversity/SM
+advert/SMDG
+advertise/LZGDRS
+advertised/U
+advertisement/MS
+advertiser/M
+advertising/M
+advertorial/SM
+advice/M
+advisability/IM
+advisable/I
+advisably
+advise/LDRSZGB
+advised/UY
+advisement/M
+adviser/M
+advisor/SM
+advisory/SM
+advocacy/M
+advocate/MGDS
+advt
+adware
+adze/SM
+aegis/M
+aerate/DSGN
+aeration/M
+aerator/SM
+aerial/SMY
+aerialist/MS
+aerie/MS
+aerobatic/S
+aerobatics/M
+aerobic/S
+aerobically
+aerobics/M
+aerodrome/MS
+aerodynamic/S
+aerodynamically
+aerodynamics/M
+aerogram/S
+aeronautic/S
+aeronautical
+aeronautics/M
+aerosol/MS
+aerospace/M
+aery
+aesthete/MS
+aesthetic/S
+aesthetically
+aestheticism/M
+aesthetics/M
+afar
+affability/M
+affable
+affably
+affair/MS
+affect's
+affect/EGDS
+affectation/SM
+affected/UY
+affecting/Y
+affection/EM
+affectionate/Y
+affections
+afferent
+affiance/GDS
+affidavit/SM
+affiliate's
+affiliate/EGNDS
+affiliated/U
+affiliation/EM
+affiliations
+affine
+affinity/SM
+affirm/AGDS
+affirmation/AMS
+affirmative/MYS
+affix/GMDS
+afflatus/M
+afflict/GDS
+affliction/SM
+affluence/M
+affluent/Y
+afford/GDSB
+affordability
+affordably
+afforest/EGSD
+afforestation/M
+affray/MS
+affront/GMDS
+afghan/MS
+aficionado/MS
+afield
+afire
+aflame
+afloat
+aflutter
+afoot
+aforementioned
+aforesaid
+aforethought
+afoul
+afraid/U
+afresh
+aft/RZ
+afterbirth/M
+afterbirths
+afterburner/MS
+aftercare/M
+aftereffect/MS
+afterglow/SM
+afterimage/MS
+afterlife/M
+afterlives
+aftermarket/MS
+aftermath/M
+aftermaths
+afternoon/MS
+aftershave/SM
+aftershock/SM
+aftertaste/SM
+afterthought/SM
+afterward/S
+afterword/MS
+again
+against
+agape/M
+agar/M
+agate/MS
+agave/M
+age/DSMGJ
+ageism/M
+ageist/SM
+ageless/YP
+agelessness/M
+agency/SM
+agenda/SM
+agenesis
+agent/AMS
+ageratum/M
+agglomerate/DSMGNX
+agglomeration/M
+agglutinate/DSXGN
+agglutination/M
+aggrandize/GLDS
+aggrandizement/M
+aggravate/GNXDS
+aggravating/Y
+aggravation/M
+aggregate/MGNDSX
+aggregation/M
+aggregator/SM
+aggression/M
+aggressive/PY
+aggressiveness/M
+aggressor/SM
+aggrieve/DSG
+aggro
+aghast
+agile/Y
+agility/M
+aging/M
+agitate/XGNDS
+agitation/M
+agitator/MS
+agitprop/M
+agleam
+aglitter
+aglow
+agnostic/MS
+agnosticism/M
+ago
+agog
+agonist/S
+agonize/GDS
+agonizing/Y
+agony/SM
+agoraphobia/M
+agoraphobic/MS
+agrarian/MS
+agrarianism/M
+agree/EBLDS
+agreeableness/EM
+agreeably/E
+agreeing/E
+agreement/ESM
+agribusiness/MS
+agricultural/Y
+agriculturalist/MS
+agriculture/M
+agriculturist/MS
+agronomic
+agronomist/MS
+agronomy/M
+aground
+ague/M
+ah
+aha
+ahchoo
+ahead
+ahem
+ahoy
+aid/SMDG
+aide/SM
+aided/U
+aigrette/MS
+ail/SDLG
+aileron/SM
+ailment/SM
+aim/SMDG
+aimless/YP
+aimlessness/M
+ain't
+air/SMDJG
+airbag/MS
+airbase/SM
+airbed/S
+airborne
+airbrush/MDSG
+airbus/MS
+aircraft/M
+aircraftman
+aircraftmen
+aircrew/S
+airdrome/S
+airdrop/SM
+airdropped
+airdropping
+airfare/SM
+airfield/SM
+airflow/M
+airfoil/SM
+airfreight/M
+airguns
+airhead/SM
+airily
+airiness/M
+airing/M
+airless/P
+airlessness/M
+airletters
+airlift/SGMD
+airline/RSMZ
+airliner/M
+airlock/SM
+airmail/GSMD
+airman/M
+airmen
+airplane/MS
+airplay/M
+airport/SM
+airship/SM
+airshow/S
+airsick/P
+airsickness/M
+airspace/M
+airspeed
+airstrike/MS
+airstrip/SM
+airtight
+airtime/M
+airwaves/M
+airway/MS
+airwoman
+airwomen
+airworthiness/M
+airworthy/P
+airy/PTR
+aisle/MS
+aitch/MS
+ajar
+aka
+akimbo
+akin
+alabaster/M
+alack
+alacrity/M
+alarm/GMDS
+alarming/Y
+alarmist/SM
+alas
+alb/SM
+albacore/SM
+albatross/MS
+albeit
+albinism/M
+albino/MS
+album/MNS
+albumen/M
+albumin/M
+albuminous
+alchemist/SM
+alchemy/M
+alcohol/SM
+alcoholic/MS
+alcoholically
+alcoholism/M
+alcove/MS
+alder/MS
+alderman/M
+aldermen
+alderwoman/M
+alderwomen
+ale/SMV
+aleatory
+alehouse/SM
+alembic/SM
+alert/GMDYPS
+alertness/M
+alewife/M
+alewives
+alfalfa/M
+alfresco
+alga/M
+algae
+algal
+algebra/SM
+algebraic
+algebraically
+algorithm/SM
+algorithmic
+alias/GMDS
+alibi/GMDS
+alien/BGMDS
+alienable/IU
+alienate/DSGN
+alienation/M
+alienist/SM
+alight/GDS
+align/ALGDS
+aligned/U
+aligner/MS
+alignment/AMS
+alike/U
+aliment/MDSG
+alimentary
+alimony/M
+aliveness/M
+aliyah/M
+aliyahs
+alkali/M
+alkalies
+alkaline
+alkalinity/M
+alkalize/DSG
+alkaloid/SM
+alkyd/MS
+all/M
+allay/GDS
+allegation/MS
+allege/GDS
+alleged/Y
+allegiance/MS
+allegoric
+allegorical/Y
+allegorist/MS
+allegory/SM
+allegretto/MS
+allegro/MS
+allele/MS
+alleluia/SM
+allergen/SM
+allergenic
+allergic
+allergically
+allergist/SM
+allergy/SM
+alleviate/DSGN
+alleviation/M
+alley/MS
+alleyway/SM
+alliance/SM
+alligator/MS
+alliterate/DSXGNV
+alliteration/M
+alliterative/Y
+allocate/ADSGN
+allocation/AM
+allocations
+allot/LS
+allotment/SM
+allotted
+allotting
+allover
+allow/EGDS
+allowable/U
+allowably
+allowance/SM
+alloy/GMDS
+alloyed/U
+allspice/M
+allude/GDS
+allure/MGLDS
+allurement/MS
+alluring/Y
+allusion/SM
+allusive/PY
+allusiveness/M
+alluvial/M
+alluvium/SM
+ally/GDSM
+almanac/SM
+almighty
+almond/MS
+almoner/SM
+almost
+alms/M
+almshouse/MS
+aloe/SM
+aloft
+aloha/MS
+alone
+along
+alongshore
+alongside
+aloof/PY
+aloofness/M
+aloud
+alp/SM
+alpaca/MS
+alpha/MS
+alphabet/SM
+alphabetic
+alphabetical/Y
+alphabetization/SM
+alphabetize/ZGDRS
+alphabetizer/M
+alphanumeric
+alphanumerical/Y
+alpine/S
+already
+alright
+also
+alt/S
+altar/MS
+altarpiece/SM
+alter/GDBS
+alterable/U
+alteration/MS
+altercation/SM
+altered/U
+alternate/DSMYGNVX
+alternation/M
+alternative/MYS
+alternator/SM
+although
+altimeter/MS
+altitude/MS
+alto/SM
+altogether
+altruism/M
+altruist/SM
+altruistic
+altruistically
+alum/SM
+alumina/M
+aluminum/M
+alumna/M
+alumnae
+alumni
+alumnus/M
+alveolar/S
+always
+am/N
+amalgam/SM
+amalgamate/XGNDS
+amalgamation/M
+amanuenses
+amanuensis/M
+amaranth/M
+amaranths
+amaretto/M
+amaryllis/MS
+amass/GDS
+amateur/SM
+amateurish/YP
+amateurishness/M
+amateurism/M
+amatory
+amaze/LMGDS
+amazement/M
+amazing/Y
+amazon/MS
+amazonian
+ambassador/SM
+ambassadorial
+ambassadorship/MS
+ambassadress/MS
+amber/M
+ambergris/M
+ambiance/MS
+ambidexterity/M
+ambidextrous/Y
+ambient
+ambiguity/SM
+ambiguous/UY
+ambit
+ambition/MS
+ambitious/YP
+ambitiousness/M
+ambivalence/M
+ambivalent/Y
+amble/MZGDRS
+ambler/M
+ambrosia/M
+ambrosial
+ambulance/MS
+ambulanceman
+ambulancemen
+ambulancewoman
+ambulancewomen
+ambulant
+ambulate/DSXGN
+ambulation/M
+ambulatory/SM
+ambuscade/MGDS
+ambush/GMDS
+ameliorate/GNVDS
+amelioration/M
+amen/B
+amenability/M
+amenably
+amend/BLGDS
+amendment/SM
+amenity/SM
+amerce/GLDS
+amercement/SM
+americium/M
+amethyst/SM
+amiability/M
+amiable
+amiably
+amicability/M
+amicable
+amicably
+amid
+amide/MS
+amidship/S
+amigo/MS
+amine/S
+amino
+amiss
+amitriptyline
+amity/M
+ammeter/SM
+ammo/M
+ammonia/M
+ammonium
+ammunition/M
+amnesia/M
+amnesiac/MS
+amnesic/SM
+amnesty/GDSM
+amniocenteses
+amniocentesis/M
+amnion/MS
+amniotic
+amoeba/MS
+amoebae
+amoebic
+amok
+among
+amontillado/SM
+amoral/Y
+amorality/M
+amorous/YP
+amorousness/M
+amorphous/PY
+amorphousness/M
+amortization/SM
+amortize/DSGB
+amount/GMDS
+amour/MS
+amoxicillin
+amp/SMY
+amperage/M
+ampere/MS
+ampersand/MS
+amphetamine/SM
+amphibian/MS
+amphibious/Y
+amphitheater/SM
+amphora/M
+amphorae
+ampicillin
+ample/TR
+amplification/M
+amplifier/M
+amplify/NDRSXZG
+amplitude/SM
+ampule/MS
+amputate/GNDSX
+amputation/M
+amputee/MS
+amt
+amulet/MS
+amuse/LGDS
+amusement/MS
+amusing/Y
+amygdala
+amylase/M
+amyloid
+an/CS
+anabolism/M
+anachronism/SM
+anachronistic
+anachronistically
+anaconda/SM
+anaerobe/SM
+anaerobic
+anaerobically
+anagram/MS
+anal/Y
+analgesia/M
+analgesic/SM
+analog/MS
+analogical/Y
+analogize/GDS
+analogous/YP
+analogousness/M
+analogue/SM
+analogy/SM
+analysand/MS
+analyses/A
+analysis/AM
+analyst/SM
+analytic/S
+analytical/Y
+analyzable
+analyze/ADSG
+analyzer/SM
+anapest/SM
+anapestic/MS
+anarchic
+anarchically
+anarchism/M
+anarchist/MS
+anarchistic
+anarchy/M
+anathema/SM
+anathematize/DSG
+anatomic
+anatomical/Y
+anatomist/SM
+anatomize/DSG
+anatomy/SM
+ancestor/SM
+ancestral/Y
+ancestress/MS
+ancestry/SM
+anchor/MDGS
+anchorage/MS
+anchorite/MS
+anchorman/M
+anchormen
+anchorpeople
+anchorperson/SM
+anchorwoman/M
+anchorwomen
+anchovy/SM
+ancient/SPMRYT
+ancientness/M
+ancillary/SM
+and
+andante/SM
+andiron/SM
+androgen/M
+androgenic
+androgynous
+androgyny/M
+android/SM
+anecdotal/Y
+anecdote/MS
+anemia/M
+anemic
+anemically
+anemometer/SM
+anemone/SM
+anent
+anesthesia/M
+anesthesiologist/SM
+anesthesiology/M
+anesthetic/SM
+anesthetist/MS
+anesthetization/M
+anesthetize/GDS
+aneurysm/SM
+anew
+angel/MS
+angelfish/MS
+angelic
+angelica/M
+angelical/Y
+anger/GMDS
+angina/M
+angioplasty/SM
+angiosperm/SM
+angle/MZGDRS
+angler/M
+angleworm/MS
+anglicism/S
+anglicize/GDS
+angling/M
+anglophile/S
+anglophone/S
+angora/MS
+angostura
+angrily
+angry/TR
+angst/M
+angstrom/MS
+anguish/GMDS
+angular
+angularity/SM
+angulation
+anhydrous
+aniline/M
+anilingus
+animadversion/MS
+animadvert/GSD
+animal/MS
+animalcule/SM
+animate/ADSGN
+animated/Y
+animation/AM
+animations
+animator/MS
+anime/M
+animism/M
+animist/SM
+animistic
+animosity/SM
+animus/M
+anion/MS
+anionic
+anise/M
+aniseed/M
+anisette/M
+ankh/M
+ankhs
+ankle/MS
+anklebone/MS
+anklet/MS
+annalist/SM
+annals/M
+anneal/GDS
+annelid/MS
+annex/GMDS
+annexation/MS
+annihilate/DSGN
+annihilation/M
+annihilator/SM
+anniversary/SM
+annotate/DSXGNV
+annotation/M
+annotator/MS
+announce/DRSLZG
+announced/U
+announcement/MS
+announcer/M
+annoy/GDS
+annoyance/MS
+annoying/Y
+annual/MYS
+annualized
+annuitant/SM
+annuity/SM
+annul/LS
+annular
+annulled
+annulling
+annulment/SM
+annulus
+annunciation/SM
+anode/MS
+anodize/GDS
+anodyne/MS
+anoint/GDLS
+anointment/M
+anomalous/Y
+anomaly/SM
+anon/S
+anonymity/M
+anonymous/Y
+anopheles/M
+anorak/MS
+anorectic/SM
+anorexia/M
+anorexic/MS
+another
+answer/BMDGS
+answerable/U
+answered/U
+answerphone/S
+ant/SMD
+antacid/SM
+antagonism/SM
+antagonist/SM
+antagonistic
+antagonistically
+antagonize/DSG
+antarctic
+ante/SM
+anteater/MS
+antebellum
+antecedence/M
+antecedent/SM
+antechamber/SM
+antedate/GDS
+antediluvian
+anteing
+antelope/MS
+antenatal
+antenna/SM
+antennae
+anterior
+anteroom/MS
+anthem/MS
+anther/MS
+anthill/SM
+anthologist/SM
+anthologize/DSG
+anthology/SM
+anthracite/M
+anthrax/M
+anthropocentric
+anthropoid/MS
+anthropological/Y
+anthropologist/SM
+anthropology/M
+anthropomorphic
+anthropomorphically
+anthropomorphism/M
+anthropomorphize
+anthropomorphous
+anti/SM
+antiabortion
+antiabortionist/MS
+antiaircraft
+antibacterial/MS
+antibiotic/MS
+antibody/SM
+antic/MS
+anticancer
+anticipate/GNXDS
+anticipated/U
+anticipation/M
+anticipatory
+anticked
+anticking
+anticlerical
+anticlimactic
+anticlimactically
+anticlimax/MS
+anticline/SM
+anticlockwise
+anticoagulant/MS
+anticommunism/M
+anticommunist/SM
+anticyclone/SM
+anticyclonic
+antidemocratic
+antidepressant/MS
+antidote/MS
+antifascist/MS
+antiferromagnetic
+antifreeze/M
+antigen/SM
+antigenic
+antigenicity/M
+antihero/M
+antiheroes
+antihistamine/SM
+antiknock/M
+antilabor
+antilogarithm/SM
+antimacassar/MS
+antimalarial
+antimatter/M
+antimicrobial
+antimissile
+antimony/M
+antineutrino/SM
+antineutron/MS
+antinuclear
+antioxidant/MS
+antiparticle/SM
+antipasti
+antipasto/MS
+antipathetic
+antipathy/SM
+antipersonnel
+antiperspirant/SM
+antiphon/SM
+antiphonal/MYS
+antipodal/S
+antipodean/MS
+antipodes/M
+antipollution
+antipoverty
+antiproton/MS
+antiquarian/SM
+antiquarianism/M
+antiquary/SM
+antiquate/GDS
+antique/DSMG
+antiquity/SM
+antirrhinum/S
+antiscience
+antisemitic
+antisemitism/M
+antisepsis/M
+antiseptic/SM
+antiseptically
+antiserum/MS
+antislavery
+antisocial/Y
+antispasmodic/MS
+antisubmarine
+antitank
+antitheses
+antithesis/M
+antithetic
+antithetical/Y
+antitoxin/MS
+antitrust
+antivenin/MS
+antivenom
+antiviral/MS
+antivirus
+antivivisectionist/MS
+antiwar
+antler/MDS
+antonym/SM
+antonymous
+antrum
+antsy/TR
+anus/MS
+anvil/MS
+anxiety/SM
+anxious/YP
+anxiousness/M
+any
+anybody/SM
+anyhow
+anymore
+anyone/M
+anyplace
+anything/SM
+anytime
+anyway/S
+anywhere
+anywise
+aorta/MS
+aortic
+apace
+apart
+apartheid/M
+apartment/MS
+apathetic
+apathetically
+apathy/M
+apatite/M
+ape/DSMG
+apelike
+aperitif/MS
+aperture/SM
+apex/MS
+aphasia/M
+aphasic/MS
+aphelia
+aphelion/SM
+aphid/MS
+aphorism/MS
+aphoristic
+aphoristically
+aphrodisiac/SM
+apiarist/SM
+apiary/SM
+apical/Y
+apiece
+apish/Y
+aplenty
+aplomb/M
+apocalypse/SM
+apocalyptic
+apocrypha/M
+apocryphal/Y
+apogee/MS
+apolitical/Y
+apologetic/U
+apologetically
+apologia/SM
+apologist/MS
+apologize/GDS
+apology/SM
+apoplectic
+apoplexy/SM
+apoptosis
+apoptotic
+apostasy/SM
+apostate/SM
+apostatize/GDS
+apostle/MS
+apostleship/M
+apostolic
+apostrophe/MS
+apothecary/SM
+apothegm/SM
+apotheoses
+apotheosis/M
+app/SM
+appall/GDS
+appalling/Y
+appaloosa/MS
+apparatchik/S
+apparatus/MS
+apparel/MDGS
+apparent/Y
+apparition/SM
+appeal/GMDS
+appealing/UY
+appear/AESDG
+appearance/EAMS
+appease/LZGDRS
+appeasement/SM
+appeaser/M
+appellant/SM
+appellate/XN
+appellation/M
+append/GDS
+appendage/SM
+appendectomy/SM
+appendices
+appendicitis/M
+appendix/MS
+appertain/GDS
+appetite/SM
+appetizer/MS
+appetizing/Y
+applaud/ZGDRS
+applauder/M
+applause/M
+apple/MS
+applejack/M
+applesauce/M
+applet/MS
+appliance/SM
+applicability/M
+applicable/I
+applicably
+applicant/SM
+application/AM
+applicator/SM
+applier/MS
+applique/DSM
+appliqueing
+apply/ANXGDS
+appoint/AELSVGD
+appointee/SM
+appointment's/A
+appointment/ESM
+apportion/AGDLS
+apportionment/AM
+appose/GDS
+apposite/YNVP
+appositeness/M
+apposition/M
+appositive/SM
+appraisal/AMS
+appraise/ADSG
+appraiser/MS
+appreciable/I
+appreciably/I
+appreciate/DSXGNV
+appreciated/U
+appreciation/M
+appreciative/Y
+appreciator/MS
+appreciatory
+apprehend/GDS
+apprehension/MS
+apprehensive/YP
+apprehensiveness/M
+apprentice/DSMG
+apprenticeship/MS
+apprise/GDS
+apprize/GDS
+approach/GBMDS
+approachable/UI
+approbation/EM
+approbations
+appropriate/PYGNXDS
+appropriated/U
+appropriateness/IM
+appropriation/M
+appropriator/SM
+approval/EM
+approvals
+approve/EGDS
+approved/U
+approving/EY
+approx
+approximate/DSXYGN
+approximation/M
+appurtenance/SM
+appurtenant
+apricot/MS
+apron/MS
+apropos
+apse/SM
+apt/IYPT
+apter
+aptitude/SM
+aptness/IM
+aqua/SM
+aquaculture/M
+aqualung/MS
+aquamarine/SM
+aquanaut/MS
+aquaplane/MGDS
+aquarium/MS
+aquatic/SM
+aquatically
+aquatics/M
+aquatint/S
+aquavit/M
+aqueduct/MS
+aqueous
+aquifer/SM
+aquiline
+arabesque/MS
+arability/M
+arachnid/MS
+arachnophobia
+arbiter/SM
+arbitrage/MZGDRS
+arbitrager/M
+arbitrageur/SM
+arbitrament/SM
+arbitrarily
+arbitrariness/M
+arbitrary/P
+arbitrate/GNDS
+arbitration/M
+arbitrator/MS
+arbor/MS
+arboreal
+arboretum/SM
+arborvitae/SM
+arbutus/MS
+arc/SMDG
+arcade/MS
+arcane
+arch/PZTGVMDRSY
+archaeological/Y
+archaeologist/SM
+archaeology/M
+archaic
+archaically
+archaism/MS
+archaist/MS
+archangel/MS
+archbishop/SM
+archbishopric/SM
+archdeacon/SM
+archdiocesan
+archdiocese/MS
+archduchess/MS
+archduke/MS
+archenemy/SM
+archer/M
+archery/M
+archetypal
+archetype/MS
+archfiend/MS
+archiepiscopal
+archipelago/MS
+architect/SM
+architectonic/S
+architectonics/M
+architectural/Y
+architecture/MS
+architrave/SM
+archival
+archive/DSMG
+archivist/MS
+archness/M
+archway/SM
+arctic/MS
+ardent/Y
+ardor/MS
+arduous/YP
+arduousness/M
+are/SMB
+area/SM
+areal
+aren't
+arena/MS
+argent/M
+arginine
+argon/M
+argosy/SM
+argot/MS
+arguable/IU
+arguably/U
+argue/ZGDRS
+arguer/M
+argument/MS
+argumentation/M
+argumentative/PY
+argumentativeness/M
+argyle/MS
+aria/SM
+arid/Y
+aridity/M
+aright
+arise/GS
+arisen
+aristocracy/SM
+aristocrat/SM
+aristocratic
+aristocratically
+arithmetic/M
+arithmetical/Y
+arithmetician/MS
+ark/SM
+arm's
+arm/EAGDS
+armada/MS
+armadillo/SM
+armament/AEM
+armaments
+armature/MS
+armband/MS
+armchair/MS
+armed/U
+armful/MS
+armhole/SM
+armistice/SM
+armlet/MS
+armload/S
+armor/ZGMDRS
+armored/U
+armorer/M
+armorial
+armory/SM
+armpit/MS
+armrest/SM
+army/SM
+aroma/MS
+aromatherapist/MS
+aromatherapy/M
+aromatic/MS
+aromatically
+arose
+around
+arousal/M
+arouse/GDS
+arpeggio/MS
+arr
+arraign/DGSL
+arraignment/SM
+arrange/AESDLG
+arrangement's/E
+arrangement/ASM
+arranger/SM
+arrant
+arras/MS
+array/EGMDS
+arrears/M
+arrest/AGMDS
+arrhythmia/M
+arrhythmic
+arrhythmical
+arrival/MS
+arrive/GDS
+arrogance/M
+arrogant/Y
+arrogate/GNDS
+arrogation/M
+arrow/MS
+arrowhead/MS
+arrowroot/M
+arroyo/MS
+arsed
+arsenal/MS
+arsenic/M
+arsing
+arson/M
+arsonist/SM
+art/SM
+arterial
+arteriole/MS
+arteriosclerosis/M
+artery/SM
+artful/PY
+artfulness/M
+arthritic/MS
+arthritis/M
+arthropod/MS
+arthroscope/SM
+arthroscopic
+arthroscopy
+artichoke/SM
+article/MDS
+articulacy/I
+articular
+articulate/YGNPDSX
+articulateness/IM
+articulation/M
+artifact/SM
+artifice/RSMZ
+artificer/M
+artificial/Y
+artificiality/M
+artillery/M
+artilleryman/M
+artillerymen
+artiness/M
+artisan/MS
+artist/MS
+artiste/MS
+artistic/I
+artistically
+artistry/M
+artless/PY
+artlessness/M
+artsy/TR
+artwork/MS
+arty/PTR
+arugula
+arum/SM
+asap
+asbestos/M
+ascend/AGDS
+ascendance/M
+ascendancy/M
+ascendant/SM
+ascension/MS
+ascent/MS
+ascertain/GDSBL
+ascertainment/M
+ascetic/MS
+ascetically
+asceticism/M
+ascot/MS
+ascribe/GBDS
+ascription/M
+aseptic
+aseptically
+asexual/Y
+asexuality/M
+ash/MDNSG
+ashamed/UY
+ashcan/MS
+ashlar/MS
+ashore
+ashram/MS
+ashtray/SM
+ashy/TR
+aside/MS
+asinine/Y
+asininity/SM
+ask/SDG
+askance
+asked/U
+askew
+aslant
+asleep
+asocial
+asp/SMNX
+asparagus/M
+aspartame/M
+aspect/MS
+aspen/M
+asperity/SM
+aspersion/MS
+asphalt/MDGS
+asphodel/SM
+asphyxia/M
+asphyxiate/DSXGN
+asphyxiation/M
+aspic/MS
+aspidistra/MS
+aspirant/MS
+aspirate/MGNDSX
+aspiration/M
+aspirator/SM
+aspire/GDS
+aspirin/MS
+ass/MS
+assail/GBDS
+assailable/U
+assailant/SM
+assassin/SM
+assassinate/GNXDS
+assassination/M
+assault/MDRGS
+assay/ZGMDRS
+assayer/M
+assemblage/SM
+assemble/AEGSD
+assembler/MS
+assemblies
+assembly/AM
+assemblyman/M
+assemblymen
+assemblywoman/M
+assemblywomen
+assent/GMDS
+assert/AGVDS
+assertion/AM
+assertions
+assertive/YP
+assertiveness/M
+assess/ALGDS
+assessment/ASM
+assessor/MS
+asset/MS
+asseverate/DSGN
+asseveration/M
+asshole/MS!
+assiduity/M
+assiduous/PY
+assiduousness/M
+assign's
+assign/ALGDS
+assignable
+assignation/MS
+assigned/U
+assignee/M
+assigner/MS
+assignment/AMS
+assignor/MS
+assimilate/DSGN
+assimilated/U
+assimilation/M
+assist/GVMDS
+assistance/M
+assistant/SM
+assisted/U
+assize/MS
+assn
+assoc
+associate's
+associate/EDSGNV
+association/EM
+associations
+associativity
+assonance/M
+assonant/MS
+assort/GLDS
+assortative
+assortment/MS
+asst
+assuage/GDS
+assume/BGDS
+assumption/SM
+assumptive
+assurance/ASM
+assure/AGDS
+assured/MYS
+astatine/M
+aster/EMS
+asterisk/GMDS
+astern
+asteroid/MS
+asthma/M
+asthmatic/SM
+asthmatically
+astigmatic
+astigmatism/SM
+astir
+astonish/DSLG
+astonishing/Y
+astonishment/M
+astound/GDS
+astounding/Y
+astraddle
+astrakhan/M
+astral
+astray
+astride
+astringency/M
+astringent/SMY
+astrolabe/SM
+astrologer/SM
+astrological/Y
+astrologist/MS
+astrology/M
+astronaut/MS
+astronautic/S
+astronautical
+astronautics/M
+astronomer/SM
+astronomic
+astronomical/Y
+astronomy/M
+astrophysical
+astrophysicist/MS
+astrophysics/M
+astute/PYTR
+astuteness/M
+asunder
+asylum/SM
+asymmetric
+asymmetrical/Y
+asymmetry/SM
+asymptomatic
+asymptotic
+asymptotically
+asynchronous/Y
+at
+atavism/M
+atavist/SM
+atavistic
+ataxia/M
+ataxic/MS
+ate
+atelier/SM
+atheism/M
+atheist/MS
+atheistic
+atherosclerosis/M
+atherosclerotic
+athirst
+athlete/MS
+athletic/S
+athletically
+athleticism
+athletics/M
+athwart
+atilt
+atishoo
+atlas/MS
+atmosphere/MS
+atmospheric/S
+atmospherically
+atmospherics/M
+atoll/MS
+atom/SM
+atomic
+atomically
+atomize/ZGDRS
+atomizer/M
+atonal/Y
+atonality/M
+atone/LGDS
+atonement/M
+atop
+atria
+atrial
+atrioventricular
+atrium/M
+atrocious/PY
+atrociousness/M
+atrocity/SM
+atrophy/DSMG
+atropine/M
+attach/ALGDS
+attache/BM
+attached/U
+attachment/AM
+attachments
+attack/ZGMDRS
+attacker/M
+attain/AGDS
+attainability/M
+attainable/U
+attainder/M
+attainment/SM
+attar/M
+attempt's
+attempt/ASDG
+attend/SDRZG
+attendance/SM
+attendant/SM
+attended/U
+attendee/SM
+attention/IM
+attentions
+attentive/IPY
+attentiveness/IM
+attenuate/DSGN
+attenuation/M
+attest/SDG
+attestation/SM
+attested/U
+attic/SM
+attire/DSMG
+attitude/SM
+attitudinal
+attitudinize/GDS
+attn
+attorney/MS
+attract/SGVDB
+attractant/MS
+attraction/MS
+attractive/UY
+attractiveness/M
+attribute/DSMGNVBX
+attributed/U
+attribution/M
+attributive/MYS
+attrition/M
+attune/DSG
+atty
+atwitter
+atypical/Y
+aubergine/S
+auburn/M
+auction/MDGS
+auctioneer/SM
+audacious/YP
+audaciousness/M
+audacity/M
+audibility/IM
+audible/MS
+audibly/I
+audience/MS
+audio/MS
+audiological
+audiologist/SM
+audiology/M
+audiometer/SM
+audiophile/SM
+audiotape/SM
+audiovisual/S
+audiovisuals/M
+audit/GMDS
+audition/SMDG
+auditor/MS
+auditorium/SM
+auditory
+auger/MS
+aught/MS
+augment/DRZGS
+augmentation/MS
+augmentative
+augmenter/M
+augur/GMDS
+augury/SM
+august/PTRY
+augustness/M
+auk/SM
+aunt/SM
+auntie/SM
+aura/MS
+aural/Y
+aureole/SM
+aureus
+auricle/SM
+auricular
+aurora/SM
+auscultate/GNDSX
+auscultation/M
+auspice/SM
+auspicious/IY
+auspiciousness/M
+austere/RYT
+austerity/SM
+austral
+authentic/IU
+authentically
+authenticate/XGNDS
+authenticated/U
+authentication/M
+authenticity/M
+author/SMDG
+authoress/MS
+authorial
+authoritarian/MS
+authoritarianism/M
+authoritative/YP
+authoritativeness/M
+authority/SM
+authorization/MS
+authorize/AGDS
+authorized/U
+authorship/M
+autism/M
+autistic
+auto/MS
+autobahn/SM
+autobiographer/SM
+autobiographic
+autobiographical/Y
+autobiography/SM
+autoclave/MS
+autocracy/SM
+autocrat/SM
+autocratic
+autocratically
+autocross
+autodidact/SM
+autograph/MDG
+autographs
+autoimmune
+autoimmunity/M
+automaker/SM
+automate/GNDS
+automatic/SM
+automatically
+automation/M
+automatism/M
+automatize/GDS
+automaton/SM
+automobile/DSMG
+automotive
+autonomic
+autonomous/Y
+autonomy/M
+autopilot/SM
+autopsy/GDSM
+autosuggestion
+autoworker/MS
+autumn/SM
+autumnal
+aux
+auxiliary/SM
+auxin/M
+av/RZ
+avail/BGMDS
+availability/UM
+available/U
+avalanche/SM
+avarice/M
+avaricious/Y
+avast
+avatar/MS
+avaunt
+avdp
+ave
+avenge/ZGDRS
+avenger/M
+avenue/MS
+average/MYGDS
+averred
+averring
+averse/XN
+aversion/M
+avert/GDS
+avg
+avian
+aviary/SM
+aviation/M
+aviator/MS
+aviatrices
+aviatrix/MS
+avid/Y
+avidity/M
+avionic/S
+avionics/M
+avitaminosis/M
+avocado/SM
+avocation/MS
+avocational
+avoid/SDGB
+avoidable/U
+avoidably/U
+avoidance/M
+avoidant
+avoirdupois/M
+avouch/DSG
+avow/EDGS
+avowal/ESM
+avowed/Y
+avuncular/Y
+aw
+await/GDS
+awake/GS
+awaken/AGDS
+awakening/SM
+award/GMDS
+awardee/S
+aware/UP
+awareness/UM
+awash
+away
+awe/DSMG
+aweigh
+awesome/YP
+awesomeness/M
+awestruck
+awful/YP
+awfuller
+awfullest
+awfulness/M
+awhile
+awkward/RYPT
+awkwardness/M
+awl/SM
+awn/GJSM
+awning/M
+awoke
+awoken
+awry
+ax/MDSG
+axial/Y
+axiom/SM
+axiomatic
+axiomatically
+axis/M
+axle/MS
+axletree/SM
+axolotl/SM
+axon/MS
+ayah/M
+ayahs
+ayatollah/M
+ayatollahs
+aye/SM
+azalea/SM
+azimuth/M
+azimuths
+azure/SM
+b/KDT
+baa/SMDG
+babble/MZGDRS
+babbler/M
+babe/SM
+babel/MS
+baboon/MS
+babushka/SM
+baby/TGDRSM
+babyhood/M
+babyish
+babysat
+babysit/S
+babysitter/MS
+babysitting/M
+baccalaureate/SM
+baccarat/M
+bacchanal/MS
+bacchanalia/M
+bacchanalian/MS
+baccy
+bachelor/SM
+bachelorhood/M
+bacillary
+bacilli
+bacillus/M
+back/SJZGMDR
+backache/MS
+backbench/S
+backbit
+backbite/ZGRS
+backbiter/M
+backbitten
+backboard/SM
+backbone/MS
+backbreaking
+backchat
+backcloth
+backcloths
+backcomb/DSG
+backdate/GDS
+backdoor
+backdrop/MS
+backer/M
+backfield/SM
+backfire/MGDS
+backgammon/M
+background/MRZS
+backgrounder/M
+backhand/MDRSZG
+backhanded/Y
+backhander/M
+backhoe/MS
+backing/M
+backlash/MS
+backless
+backlog/MS
+backlogged
+backlogging
+backpack/ZGMDRS
+backpacker/M
+backpacking/M
+backpedal/SDG
+backrest/SM
+backroom/S
+backscratching/M
+backseat/SM
+backside/SM
+backslapper/SM
+backslapping/M
+backslash/MS
+backslid
+backslide/RSZG
+backslider/M
+backspace/DSMG
+backspin/M
+backstabber/MS
+backstabbing
+backstage/M
+backstair/S
+backstop/SM
+backstopped
+backstopping
+backstory/S
+backstreet/S
+backstretch/MS
+backstroke/MGDS
+backtalk/M
+backtrack/SDG
+backup/MS
+backward/PSY
+backwardness/M
+backwash/M
+backwater/SM
+backwoods/M
+backwoodsman/M
+backwoodsmen
+backyard/SM
+bacon/M
+bacteria/M
+bacterial
+bactericidal
+bactericide/SM
+bacteriologic
+bacteriological
+bacteriologist/SM
+bacteriology/M
+bacterium/M
+bad/MYP
+badder
+baddest
+baddie/MS
+bade
+badge/MZRS
+badger/GMD
+badinage/M
+badlands/M
+badman/M
+badmen
+badminton/M
+badmouth/GD
+badmouths
+badness/M
+baffle/MZGDRSL
+bafflement/M
+baffler/M
+bag/SM
+bagatelle/SM
+bagel/MS
+bagful/MS
+baggage/M
+bagged
+baggie/M
+baggily
+bagginess/M
+bagging
+baggy/PTRS
+bagpipe/MZRS
+bagpiper/M
+baguette/MS
+bah
+baht/SM
+bail/SBGMD
+bailey/S
+bailiff/S
+bailiwick/MS
+bailout/SM
+bailsman/M
+bailsmen
+bairn/MS
+bait/SGMD
+baize/M
+bake/DRSMZG
+baked/U
+baker/M
+bakery/SM
+bakeshop/MS
+baklava/M
+baksheesh/M
+balaclava/MS
+balalaika/MS
+balance's
+balance/UDSG
+balboa/SM
+balcony/SM
+bald/STGPDRY
+balderdash/M
+baldfaced
+baldness/M
+baldric/SM
+baldy/S
+bale/DRSMZG
+baleen/M
+baleful/PY
+balefulness/M
+baler/M
+balk/SGMD
+balky/RT
+ball/SGMD
+ballad/SM
+balladeer/MS
+balladry/M
+ballast/GSMD
+ballcock/MS
+ballerina/SM
+ballet/SM
+balletic
+ballgame/MS
+ballgirl/S
+ballgown/S
+ballistic/S
+ballistics/M
+balloon/SGMD
+balloonist/MS
+ballot/SMDG
+ballpark/MS
+ballplayer/MS
+ballpoint/MS
+ballroom/MS
+balls/DSG
+ballsy/RT
+bally
+ballyhoo/SMDG
+balm/SM
+balminess/M
+balmy/RTP
+baloney/M
+balsa/MS
+balsam/SM
+balsamic
+baluster/SM
+balustrade/MS
+bamboo/SM
+bamboozle/DSG
+ban/SM
+banal/Y
+banality/SM
+banana/SM
+band's
+band/ESGD
+bandage/DSMG
+bandanna/MS
+bandbox/MS
+bandeau/M
+bandeaux
+bandit/SM
+banditry/M
+bandleader/S
+bandmaster/SM
+bandoleer/SM
+bandsman/M
+bandsmen
+bandstand/SM
+bandwagon/SM
+bandwidth
+bandwidths
+bandy/DRSTG
+bane/SM
+baneful
+bang/SGMDR
+bangle/SM
+bani
+banish/GLDS
+banishment/M
+banister/SM
+banjo/MS
+banjoist/SM
+bank/SZGBMDR
+bankbook/SM
+bankcard/SM
+banker/M
+banking/M
+banknote/SM
+bankroll/SGMD
+bankrupt/SGMD
+bankruptcy/SM
+banned
+banner/SM
+banning
+bannock/MS
+banns/M
+banquet/ZGMDRS
+banqueter/M
+banquette/SM
+banshee/MS
+bantam/SM
+bantamweight/SM
+banter/GSMD
+bantering/Y
+banyan/SM
+banzai/SM
+baobab/SM
+bap/S
+baptism/MS
+baptismal
+baptist/S
+baptistery/SM
+baptize/ZGDRS
+baptized/U
+baptizer/M
+bar's
+bar/ECUTS
+barb/SZGMDR
+barbacoa
+barbarian/SM
+barbarianism/MS
+barbaric
+barbarically
+barbarism/SM
+barbarity/SM
+barbarize/DSG
+barbarous/Y
+barbecue/DSMG
+barbel/SM
+barbell/MS
+barber/GMD
+barberry/SM
+barbershop/MS
+barbie/S
+barbiturate/SM
+barbwire/M
+barcarole/SM
+bard/SM
+bardic
+bare/DRSPYG
+bareback/D
+barefaced/Y
+barefoot/D
+barehanded
+bareheaded
+barelegged
+bareness/M
+barf/SGMDY
+barfly/SM
+bargain/MDRZGS
+bargainer/M
+barge/MGDS
+bargeman/M
+bargemen
+barhop/S
+barhopped
+barhopping
+barista/MS
+baritone/MS
+barium/M
+bark's
+bark/CSGD
+barkeep/ZMRS
+barkeeper/M
+barker/SM
+barley/M
+barmaid/MS
+barman/M
+barmen
+barmy/RT
+barn/SM
+barnacle/MDS
+barney/S
+barnstorm/SDRZG
+barnstormer/M
+barnyard/SM
+barometer/MS
+barometric
+barometrically
+baron/MS
+baronage/MS
+baroness/MS
+baronet/MS
+baronetcy/SM
+baronial
+barony/SM
+baroque/M
+barrack/MDGS
+barracuda/SM
+barrage/MGDS
+barre/MGJDS
+barred/UEC
+barrel/GSMD
+barren/TPSMR
+barrenness/M
+barrette/SM
+barricade/MGDS
+barrier/MS
+barring/ECU
+barrio/SM
+barrister/MS
+barroom/MS
+barrow/SM
+bartender/SM
+barter/ZGSMDR
+barterer/M
+baryon/SM
+basal/Y
+basalt/M
+basaltic
+base's
+base/CDSLTG
+baseball/SM
+baseboard/MS
+baseless
+baseline/MS
+basely
+baseman/M
+basemen
+basement/CMS
+baseness/M
+baser
+bash/GMDS
+bashful/PY
+bashfulness/M
+bashing/M
+basic/MS
+basically
+basil/M
+basilica/MS
+basilisk/MS
+basin/MS
+basinful/MS
+basis/M
+bask/SGD
+basket/SM
+basketball/MS
+basketry/M
+basketwork/M
+basque/S
+bass/MS
+basset/SM
+bassinet/MS
+bassist/MS
+basso/MS
+bassoon/MS
+bassoonist/SM
+basswood/MS
+bast/M
+bastard/MS
+bastardization/MS
+bastardize/GDS
+bastardy/M
+baste/ZGNXDRS
+baster/M
+bastion/M
+bat/SM
+batch/MDSG
+bate/KACGSD
+bath/ZGMDRS
+bathe/M
+bather/M
+bathetic
+bathhouse/MS
+bathing/M
+bathmat/MS
+bathos/M
+bathrobe/SM
+bathroom/SM
+baths
+bathtub/MS
+bathwater
+bathyscaphe/SM
+bathysphere/MS
+batik/MS
+batiste/M
+batman/M
+batmen
+baton/MS
+batsman/M
+batsmen
+battalion/SM
+batted
+batten/GSMD
+batter/JZGSMDR
+batterer/M
+battery/SM
+batting/M
+battle/LDRSMZG
+battleaxe/MS
+battledore/SM
+battledress
+battlefield/MS
+battlefront/MS
+battleground/MS
+battlement/SM
+battler/M
+battleship/SM
+batty/RT
+bauble/SM
+baud/SM
+bauxite/M
+bawd/SM
+bawdily
+bawdiness/M
+bawdy/PRT
+bawl/SGMD
+bay/SMDG
+bayberry/SM
+bayonet/SMDG
+bayou/MS
+bazaar/SM
+bazillion/S
+bazooka/SM
+bbl
+bdrm
+be
+beach/MDSG
+beachcomber/SM
+beachfront
+beachhead/MS
+beachwear/M
+beacon/SM
+bead/SGMD
+beading/M
+beadle/SM
+beady/RT
+beagle/SM
+beak/SZMDR
+beaker/M
+beam/SGMD
+bean/SGMD
+beanbag/MS
+beanfeast/S
+beanie/SM
+beanpole/MS
+beansprout/S
+beanstalk/MS
+bear/SZGBJMR
+bearable/U
+bearably/U
+beard/MDGS
+beardless
+bearer/M
+bearing/M
+bearish/PY
+bearishness/M
+bearlike
+bearskin/MS
+beast/MS
+beastliness/M
+beastly/TPRM
+beat/SZGBMNRJ
+beatable/U
+beaten/U
+beater/M
+beatific
+beatifically
+beatification/M
+beatify/GXNDS
+beating/M
+beatitude/SM
+beatnik/MS
+beau/SM
+beaut/MS
+beauteous/Y
+beautician/SM
+beautification/M
+beautifier/M
+beautiful/Y
+beautify/NDRSZG
+beauty/SM
+beaver/SGMD
+bebop/MS
+becalm/GSD
+became
+because
+beck/SM
+beckon/SGD
+becloud/GDS
+become/S
+becoming/UY
+becquerel/S
+bed/SM
+bedaub/GSD
+bedazzle/GDSL
+bedazzlement/M
+bedbug/SM
+bedchamber/S
+bedclothes/M
+bedded
+bedder
+bedding/M
+bedeck/GSD
+bedevil/LGDS
+bedevilment/M
+bedfellow/SM
+bedhead/S
+bedim/S
+bedimmed
+bedimming
+bedizen/GDS
+bedlam/SM
+bedpan/SM
+bedpost/SM
+bedraggle/GDS
+bedridden
+bedrock/SM
+bedroll/SM
+bedroom/SM
+bedside/SM
+bedsit/S
+bedsitter/S
+bedsore/SM
+bedspread/SM
+bedstead/SM
+bedtime/SM
+bee/RSMZGJ
+beebread/M
+beech/MS
+beechnut/MS
+beef/SGMD
+beefburger/SM
+beefcake/MS
+beefiness/M
+beefsteak/MS
+beefy/RPT
+beehive/MS
+beekeeper/MS
+beekeeping/M
+beeline/MS
+been
+beep/SZGMDR
+beeper/M
+beer/M
+beery/TR
+beeswax/M
+beet/SM
+beetle/MGDS
+beetroot/S
+beeves
+befall/SGN
+befell
+befit/S
+befitted
+befitting/Y
+befog/S
+befogged
+befogging
+before
+beforehand
+befoul/DGS
+befriend/SGD
+befuddle/GLDS
+befuddlement/M
+beg/S
+began
+begat
+beget/S
+begetter/S
+begetting
+beggar/MDYGS
+beggary/M
+begged
+begging
+begin/S
+beginner/SM
+beginning/MS
+begone
+begonia/SM
+begot
+begotten
+begrime/DSG
+begrudge/DSG
+begrudging/Y
+beguile/DRSZGL
+beguilement/M
+beguiler/M
+beguiling/Y
+beguine/SM
+begum/MS
+begun
+behalf/M
+behalves
+behave/GDS
+behavior/SM
+behavioral/Y
+behaviorism/M
+behaviorist/MS
+behead/DGS
+beheld
+behemoth/M
+behemoths
+behest/MS
+behind/MS
+behindhand
+behold/NRZGS
+beholder/M
+behoove/DSG
+beige/M
+being/M
+bejewel/SDG
+belabor/SDG
+belated/Y
+belay/GDS
+belch/GMDS
+beleaguer/GSD
+belfry/SM
+belie/DS
+belief/EUM
+beliefs
+believable/U
+believably/U
+believe/EDRSZG
+believer/EUMS
+believing/U
+belittle/LDSG
+belittlement/M
+bell/SGMD
+belladonna/M
+bellboy/SM
+belle/MS
+belled/A
+belletrist/MS
+belletristic
+bellhop/SM
+bellicose
+bellicosity/M
+belligerence/M
+belligerency/M
+belligerent/MYS
+belling/A
+bellman/M
+bellmen
+bellow/MDGS
+bellwether/MS
+belly/GDSM
+bellyache/MGDS
+bellybutton/SM
+bellyful/MS
+belong/JDGS
+belonging/M
+beloved/SM
+below
+belt/SGMD
+beltway/SM
+beluga/MS
+belying
+bemire/GDS
+bemoan/DGS
+bemuse/LGDS
+bemused/Y
+bemusement/M
+bench/GMDS
+benchmark/MS
+bend/BSZGMR
+bender/M
+bendy/TR
+beneath
+benedictine
+benediction/SM
+benedictory
+benefaction/SM
+benefactor/MS
+benefactress/MS
+benefice/SM
+beneficence/M
+beneficent/Y
+beneficial/Y
+beneficiary/SM
+benefit/SMDG
+benevolence/SM
+benevolent/Y
+benighted/Y
+benign/Y
+benignant
+benignity/M
+bent/SM
+bentonite
+bentwood/M
+benumb/DSG
+benzene/M
+benzine/M
+benzyl
+bequeath/DG
+bequeaths
+bequest/MS
+berate/GDS
+bereave/DSLG
+bereavement/MS
+bereft
+beret/MS
+berg/SM
+beriberi/M
+berk/S
+berkelium/M
+berm/SM
+berry/GDSM
+berrylike
+berserk
+berth/GMD
+berths
+beryl/MS
+beryllium/M
+beseech/ZGRS
+beseecher/M
+beseeching/Y
+beseem/DSG
+beset/S
+besetting
+beside/S
+besiege/ZGDRS
+besieger/M
+besmear/DSG
+besmirch/GDS
+besom/MS
+besot/S
+besotted
+besotting
+besought
+bespangle/DSG
+bespatter/GSD
+bespeak/SG
+bespectacled
+bespoke
+bespoken
+best/SGMD
+bestial/Y
+bestiality/M
+bestiary/SM
+bestir/S
+bestirred
+bestirring
+bestow/DGS
+bestowal/SM
+bestrew/SDG
+bestrewn
+bestridden
+bestride/SG
+bestrode
+bestseller/MS
+bestselling
+bet/SM
+beta/SM
+betake/GS
+betaken
+betcha
+betel/M
+bethink/SG
+bethought
+betide/GDS
+betimes
+betoken/GDS
+betook
+betray/DRZGS
+betrayal/SM
+betrayer/M
+betroth/DG
+betrothal/SM
+betrothed/M
+betroths
+better/MDGLS
+betterment/M
+betting
+bettor/MS
+between
+betwixt
+bevel/GMDS
+beverage/SM
+bevvy/S
+bevy/SM
+bewail/DGS
+beware/GDS
+bewhiskered
+bewigged
+bewilder/LSGD
+bewildering/Y
+bewilderment/M
+bewitch/GLDS
+bewitching/Y
+bewitchment/M
+bey/SM
+beyond
+bezel/MS
+bf
+bhaji
+bi/SMRZ
+biannual/Y
+bias/GMDS
+biased/U
+biathlon/SM
+bib/SM
+bible/MS
+biblical
+bibliographer/MS
+bibliographic
+bibliographical/Y
+bibliography/SM
+bibliophile/SM
+bibulous
+bicameral
+bicameralism/M
+bicarb/MS
+bicarbonate/MS
+bicentenary/SM
+bicentennial/SM
+bicep/MS
+biceps/M
+bicker/MDRZGS
+bickerer/M
+biconcave
+biconvex
+bicuspid/MS
+bicycle/DRSMZG
+bicycler/M
+bicyclist/SM
+bid/SMG
+biddable
+bidden/U
+bidder/MS
+bidding/M
+biddy/SM
+bide/S
+bidet/MS
+bidirectional/Y
+biennial/MYS
+biennium/MS
+bier/M
+biff/SGD
+bifocal/S
+bifocals/M
+bifurcate/XDSGN
+bifurcation/M
+big/P
+bigamist/SM
+bigamous
+bigamy/M
+bigger
+biggest
+biggie/MS
+biggish
+bighead/SM
+bighearted/P
+bigheartedness/M
+bighorn/SM
+bight/MS
+bigmouth/M
+bigmouths
+bigness/M
+bigot/MDS
+bigotry/SM
+bigwig/MS
+bijou/M
+bijoux
+bike/DRSMZG
+biker/M
+bikini/MS
+bilabial/MS
+bilateral/Y
+bilberry/S
+bile/M
+bilge/MS
+bilingual/SMY
+bilingualism/M
+bilious/P
+biliousness/M
+bilirubin
+bilk/SZGDR
+bilker/M
+bill/SBJGMD
+billboard/MS
+billet/GMDS
+billfold/SM
+billhook/S
+billiard/S
+billiards/M
+billing/M
+billingsgate/M
+billion/MHS
+billionaire/SM
+billionth/M
+billionths
+billow/GMDS
+billowy
+billy/SM
+billycan/S
+bimbo/MS
+bimetallic/SM
+bimetallism/M
+bimodal
+bimonthly/SM
+bin/SM
+binary/SM
+binaural
+bind's
+bind/AUGS
+binder/MS
+bindery/SM
+binding/MS
+bindweed/M
+binge/MDS
+bingo/M
+binman
+binmen
+binnacle/SM
+binned
+binning
+binocular/MS
+binomial/SM
+bio/SM
+biochemical/SMY
+biochemist/MS
+biochemistry/M
+biodegradability/M
+biodegrade/DSGB
+biodiversity/M
+bioethics/M
+biofeedback/M
+biofilm/MS
+biog
+biographer/SM
+biographic
+biographical/Y
+biography/SM
+biol
+biologic
+biological/Y
+biologist/MS
+biology/M
+biomarker/MS
+biomass/M
+biomedical
+bionic/S
+bionically
+bionics/M
+biophysical
+biophysicist/MS
+biophysics/M
+biopic/MS
+biopsy/GDSM
+bioreactor/S
+biorhythm/MS
+biosensor/S
+biosphere/SM
+biosynthesis
+biotech
+biotechnological
+biotechnology/M
+biotin/M
+bipartisan
+bipartisanship/M
+bipartite
+biped/MS
+bipedal
+biplane/MS
+bipolar
+bipolarity/M
+biracial
+birch/GMDS
+bird/SZGMDR
+birdbath/M
+birdbaths
+birdbrain/SMD
+birdcage/S
+birder/M
+birdhouse/MS
+birdie/MDS
+birdieing
+birdlike
+birdlime/M
+birdseed/M
+birdsong
+birdwatcher/SM
+birdying
+biretta/SM
+birth/ZGMDR
+birthday/MS
+birther/M
+birthmark/MS
+birthplace/MS
+birthrate/MS
+birthright/MS
+births/A
+birthstone/SM
+biscuit/SM
+bisect/DGS
+bisection/MS
+bisector/SM
+bisexual/MYS
+bisexuality/M
+bishop/MS
+bishopric/SM
+bismuth/M
+bison/M
+bisque/M
+bistro/MS
+bit/CSMG
+bitch/GMDS
+bitchily
+bitchiness/M
+bitchy/PRT
+bitcoin/SM
+bite/RSMZ
+biter/M
+biting/Y
+bitmap/S
+bitten
+bitter/PMRYTS
+bittern/SM
+bitterness/M
+bitters/M
+bittersweet/MS
+bitty/TR
+bitumen/M
+bituminous
+bivalent
+bivalve/SM
+bivouac/MS
+bivouacked
+bivouacking
+biweekly/SM
+biyearly
+biz/M
+bizarre/Y
+bk
+bl/DG
+blab/SM
+blabbed
+blabber/DGS
+blabbermouth/M
+blabbermouths
+blabbing
+black/PXTGMDNRYS
+blackamoor/MS
+blackball/SGMD
+blackberry/GSM
+blackbird/SM
+blackboard/MS
+blackcurrant/S
+blacken/DG
+blackface
+blackguard/SM
+blackhead/MS
+blacking/M
+blackish
+blackjack/MDGS
+blackleg/S
+blacklist/MDSG
+blackmail/MDRSZG
+blackmailer/M
+blackness/M
+blackout/SM
+blacksmith/M
+blacksmiths
+blacksnake/SM
+blackthorn/SM
+blacktop/SM
+blacktopped
+blacktopping
+bladder/MS
+blade/MDS
+blag/S
+blagged
+blagging
+blah/M
+blahs/M
+blame/BMGDRS
+blameless/YP
+blamelessness/M
+blameworthiness/M
+blameworthy/P
+blammo
+blanch/GDS
+blancmange/MS
+bland/PTRY
+blandish/DSLG
+blandishment/SM
+blandness/M
+blank/TGPMDRYS
+blanket/GMDS
+blankness/M
+blare/MGDS
+blarney/SMDG
+blase
+blaspheme/ZGDRS
+blasphemer/M
+blasphemous/Y
+blasphemy/SM
+blast/ZGMDRS
+blaster/M
+blastoff/MS
+blat/S
+blatancy/SM
+blatant/Y
+blather/SMDG
+blaze/MZGDRS
+blazer/M
+blazon/MDGS
+bldg
+bleach/MDRSZG
+bleached/U
+bleacher/M
+bleak/TPRY
+bleakness/M
+blear
+blearily
+bleariness/M
+bleary/PRT
+bleat/GMDS
+bleed/ZGRS
+bleeder/M
+bleeding/M
+bleep/ZGMDRS
+bleeper/M
+blemish/GMDS
+blemished/U
+blench/DSG
+blend/ZGMDRS
+blender/M
+bless/GDSJ
+blessed/YP
+blessedness/M
+blessing/M
+bletch
+blew
+blight/ZGMDRS
+blimey
+blimp/MS
+blimpish
+blind/PZTGMDRYS
+blinder/M
+blindfold/SMDG
+blinding/Y
+blindness/M
+blindside/DSG
+blini/MS
+blink/ZGMDRS
+blinker/MDG
+blintz/MS
+blintze/M
+blip/SM
+bliss/M
+blissful/YP
+blissfulness/M
+blister/GMDS
+blistering/Y
+blistery
+blithe/PYTR
+blitheness/M
+blither/G
+blithesome
+blitz/GMDS
+blitzkrieg/MS
+blivet/S
+blizzard/SM
+bloat/ZGDRS
+bloatware
+blob/SM
+blobbed
+blobbing
+bloc/SM
+block's
+block/UGDS
+blockade/MZGDRS
+blockader/M
+blockage/MS
+blockbuster/SM
+blockbusting/M
+blockchain/MS
+blocker/MS
+blockhead/SM
+blockhouse/MS
+blog/SM
+blogged
+blogger/MS
+blogging
+bloke/MS
+blokish
+blond/PTMRS
+blonde/MS
+blondish
+blondness/M
+blood/GMDS
+bloodbath/M
+bloodbaths
+bloodcurdling
+bloodhound/SM
+bloodily
+bloodiness/M
+bloodless/YP
+bloodlessness/M
+bloodletting/M
+bloodline/SM
+bloodmobile/MS
+bloodshed/M
+bloodshot
+bloodstain/SMD
+bloodstock/M
+bloodstream/SM
+bloodsucker/SM
+bloodsucking
+bloodthirstily
+bloodthirstiness/M
+bloodthirsty/RPT
+bloody/PTGDRS
+bloom/ZGMDRS
+bloomer/M
+bloop/ZGMDRS
+blooper/M
+blossom/GMDS
+blossomy
+blot/SM
+blotch/GMDS
+blotchy/TR
+blotted
+blotter/MS
+blotting
+blotto
+blouse/MGDS
+blow/SZGMR
+blower/M
+blowfly/SM
+blowgun/MS
+blowhard/MS
+blowhole/S
+blowjob/SM
+blowlamp/S
+blown
+blowout/SM
+blowpipe/SM
+blowtorch/MS
+blowup/MS
+blowy/TR
+blowzy/RT
+blubber/GSMD
+blubbery
+bludgeon/MDGS
+blue/DRSPMTG
+bluebell/MS
+blueberry/SM
+bluebird/MS
+bluebonnet/SM
+bluebottle/SM
+bluefish/MS
+bluegill/MS
+bluegrass/M
+blueish
+bluejacket/SM
+bluejeans/M
+blueness/M
+bluenose/MS
+bluepoint/MS
+blueprint/MDGS
+bluestocking/SM
+bluesy/RT
+bluet/MS
+bluff/ZTGPMDRYS
+bluffer/M
+bluffness/M
+bluing/M
+bluish
+blunder/MDRZGS
+blunderbuss/MS
+blunderer/M
+blunt/PTGDRYS
+bluntness/M
+blur/SM
+blurb/MS
+blurred
+blurriness/M
+blurring
+blurry/TRP
+blurt/GDS
+blush/ZGMDRS
+blusher/M
+bluster/MDRSZG
+blusterer/M
+blusterous
+blustery
+blvd
+boa/SM
+boar/SM
+board/ZGMDRS
+boarder/M
+boarding/M
+boardinghouse/MS
+boardroom/MS
+boardwalk/MS
+boast/ZGMDRS
+boaster/M
+boastful/PY
+boastfulness/M
+boat/SZGMDR
+boater/M
+boathouse/MS
+boating/M
+boatload/S
+boatman/M
+boatmen
+boatswain/SM
+boatyard/S
+bob/SM
+bobbed
+bobbin/MS
+bobbing
+bobble/MGDS
+bobby/SM
+bobbysoxer/SM
+bobcat/MS
+bobolink/SM
+bobsled/SM
+bobsledded
+bobsledder/MS
+bobsledding
+bobsleigh/M
+bobsleighs
+bobtail/SM
+bobwhite/MS
+boccie/M
+bock/M
+bod/SMDG
+bodacious
+bode/S
+bodega/MS
+bodge/GDS
+bodice/MS
+bodily
+bodkin/MS
+body/DSM
+bodybuilder/SM
+bodybuilding/M
+bodyguard/MS
+bodysuit/SM
+bodywork/M
+boffin/S
+boffo
+bog/SM
+boga
+bogey/GMDS
+bogeyman/M
+bogeymen
+bogged
+bogging
+boggle/GDS
+boggy/TR
+bogie/MS
+bogon
+bogosity
+bogus
+bogyman/M
+bogymen
+bohemian/SM
+bohemianism/M
+boil/SJZGMDR
+boiler/M
+boilermaker/SM
+boilerplate/M
+boink/GDS
+boisterous/YP
+boisterousness/M
+bola/SM
+bold/PTRY
+boldface/DM
+boldness/M
+bole/SM
+bolero/MS
+bolivar/MS
+bolivares
+boll/SM
+bollard/S
+bollix/GMDS
+bollocking/S
+bollocks
+bologna/M
+bolshie
+bolster/GMDS
+bolt's
+bolt/USGD
+bolthole/S
+bolus/MS
+bomb/SJZGMDR
+bombard/GDLS
+bombardier/MS
+bombardment/SM
+bombast/M
+bombastic
+bombastically
+bomber/M
+bombproof
+bombshell/SM
+bombsite/S
+bonanza/MS
+bonbon/MS
+bonce/S
+bond/SGMD
+bondage/M
+bondholder/MS
+bonding/M
+bondman/M
+bondmen
+bondsman/M
+bondsmen
+bondwoman/M
+bondwomen
+bone/DRSMZG
+bonehead/SMD
+boneless
+boner/M
+boneshaker/S
+boneyard
+bonfire/MS
+bong/SGMD
+bongo/MS
+bonhomie/M
+boniness/M
+bonito/MS
+bonk/SZGD
+bonnet/MS
+bonny/TR
+bonobo/MS
+bonsai/M
+bonus/MS
+bony/PTR
+boo/SMDHG
+boob/SGMD
+booby/SM
+boodle/MS
+booger/S
+boogeyman/M
+boogeymen
+boogie/MDS
+boogieing
+boogieman/M
+boohoo/GMDS
+book/SBJGMD
+bookbinder/SM
+bookbindery/SM
+bookbinding/M
+bookcase/MS
+bookend/MS
+bookie/MS
+booking/M
+bookish
+bookkeeper/MS
+bookkeeping/M
+booklet/MS
+bookmaker/SM
+bookmaking/M
+bookmark/SMDG
+bookmobile/SM
+bookplate/MS
+bookseller/MS
+bookshelf/M
+bookshelves
+bookshop/SM
+bookstall/S
+bookstore/MS
+bookworm/SM
+boolean
+boom/SZGMDR
+boombox/MS
+boomerang/MDGS
+boon/SM
+boondocks/M
+boondoggle/MZGDRS
+boondoggler/M
+boonies/M
+boor/SM
+boorish/PY
+boorishness/MS
+boost/ZGMDRS
+booster/M
+boot's
+boot/ASGD
+bootblack/SM
+bootee/MS
+booth/M
+booths
+bootlace/S
+bootleg/MS
+bootlegged
+bootlegger/MS
+bootlegging/M
+bootless
+bootstrap/MS
+bootstrapped
+bootstrapping
+booty/SM
+booze/MZGDRS
+boozer/M
+boozy/TR
+bop/SM
+bopped
+bopping
+borax/M
+bordello/MS
+border/GMDS
+borderland/MS
+borderline/MS
+bore/DRSMZG
+boredom/M
+borehole/S
+borer/M
+boring/Y
+born/IAU
+borne
+boron/M
+borough/M
+boroughs
+borrow/SDRZGJ
+borrower/M
+borrowing/M
+borscht/M
+borstal/S
+borzoi/SM
+bosh/M
+bosom's
+bosom/US
+bosomy
+boss/DSGM
+bossily
+bossiness/M
+bossism/M
+bossy/RTP
+bot/S
+botanic
+botanical/Y
+botanist/SM
+botany/M
+botch/DRSZGM
+botcher/M
+both
+bother/SMDG
+botheration
+bothered/U
+bothersome
+botnet/SM
+bottle/DRSMZG
+bottleneck/MS
+bottler/M
+bottom/SMDG
+bottomless
+botulinum
+botulism/M
+boudoir/SM
+bouffant/SM
+bougainvillea/MS
+bough/M
+boughs
+bought
+bouillabaisse/SM
+bouillon/MS
+boulder/SM
+boules
+boulevard/SM
+bounce/DRSMZG
+bouncer/M
+bouncily
+bounciness/M
+bouncy/RTP
+bound/ASMGD
+boundary/SM
+bounden
+bounder/SM
+boundless/PY
+boundlessness/M
+bounteous/YP
+bounteousness/M
+bountiful/YP
+bountifulness/M
+bounty/SM
+bouquet/SM
+bourbon/SM
+bourgeois/M
+bourgeoisie/M
+boustrophedon
+bout/MS
+boutique/SM
+boutonniere/MS
+bouzouki/MS
+bovine/SM
+bovver
+bow/ZGSMDR
+bowdlerization/MS
+bowdlerize/DSG
+bowed/U
+bowel/SM
+bower/M
+bowl/MDRZGS
+bowleg/SM
+bowlegged
+bowler/M
+bowlful/SM
+bowline/SM
+bowling/M
+bowman/M
+bowmen
+bowsprit/SM
+bowstring/SM
+bowwow/SM
+box/ZGMDNRS
+boxcar/SM
+boxer/M
+boxing/M
+boxlike
+boxroom/S
+boxwood/M
+boxy/RT
+boy/SM
+boycott/SGMD
+boyfriend/MS
+boyhood/SM
+boyish/YP
+boyishness/M
+boysenberry/SM
+bozo/MS
+bpm
+bps
+bra/SM
+brace/MZGDRS
+bracelet/MS
+bracer/M
+bracero/MS
+bracken/M
+bracket/GMDS
+brackish/P
+brackishness/M
+bract/MS
+brad/SM
+bradawl/S
+bradycardia
+brae/SM
+brag/SM
+braggadocio/SM
+braggart/SM
+bragged
+bragger/MS
+bragging
+braid/GMDS
+braiding/M
+braille/M
+brain/GMDS
+brainchild/M
+brainchildren/M
+braininess/M
+brainless/Y
+brainpower
+brainstorm/SMDG
+brainstorming/M
+brainteaser/SM
+brainwash/DSG
+brainwashing/M
+brainwave/S
+brainy/PTR
+braise/GDS
+brake/MGDS
+brakeman/M
+brakemen
+bramble/MS
+brambly
+bran/M
+branch/GMDS
+branchlike
+brand/ZGMDRS
+branded/U
+brander/M
+brandish/DSG
+brandy/GDSM
+brash/PTRY
+brashness/M
+brass/MS
+brasserie/MS
+brassiere/MS
+brassily
+brassiness/M
+brassy/PTR
+brat/SM
+bratty/RT
+bratwurst/SM
+bravado/M
+brave/GPMYDTRS
+braveness/M
+bravery/M
+bravo/SM
+bravura/SM
+brawl/SDRZGM
+brawler/M
+brawn/M
+brawniness/M
+brawny/RTP
+bray/DGSM
+braze/DRSZG
+brazen/SDYGP
+brazenness/M
+brazer/M
+brazier/SM
+breach/GMDS
+bread/GMDHS
+breadbasket/SM
+breadboard/SM
+breadbox/MS
+breadcrumb/MS
+breadfruit/SM
+breadline/MS
+breadth/M
+breadths
+breadwinner/SM
+break/BMZGRS
+breakable/MS
+breakage/MS
+breakaway/MS
+breakdown/MS
+breaker/M
+breakfast/MDGS
+breakfront/MS
+breakneck
+breakout/MS
+breakpoints
+breakthrough/M
+breakthroughs
+breakup/SM
+breakwater/SM
+bream/MS
+breast/SMDG
+breastbone/MS
+breastfed
+breastfeed/GS
+breastplate/SM
+breaststroke/SM
+breastwork/MS
+breath/MDRSZGB
+breathalyze/ZGDRS
+breathe
+breather/M
+breathing/M
+breathless/PY
+breathlessness/M
+breaths
+breathtaking/Y
+breathy/RT
+bred/I
+breech/MS
+breed/SRZGM
+breeder/M
+breeding/IM
+breeze/DSMG
+breezeway/SM
+breezily
+breeziness/M
+breezy/RTP
+brethren
+breve/SM
+brevet/SM
+brevetted
+brevetting
+breviary/SM
+brevity/M
+brew/MDRZGS
+brewer/M
+brewery/SM
+brewpub/SM
+bribe/DRSMZG
+briber/M
+bribery/M
+brick/SMDG
+brickbat/SM
+brickie/S
+bricklayer/MS
+bricklaying/M
+brickwork/M
+brickyard/S
+bridal/SM
+bride/SM
+bridegroom/SM
+bridesmaid/MS
+bridge/DSMG
+bridgeable/U
+bridgehead/SM
+bridgework/M
+bridle/DSMG
+bridled/U
+bridleway/S
+brie/MZR
+brief's
+brief/CSDTGJ
+briefcase/SM
+briefer
+briefing/CM
+briefly
+briefness/M
+brier/M
+brig/MS
+brigade/SM
+brigadier/MS
+brigand/SM
+brigandage/M
+brigantine/MS
+bright/SPNRYXT
+brighten/DRZG
+brightener/M
+brightness/M
+brights/M
+brill
+brilliance/M
+brilliancy/M
+brilliant/MYS
+brilliantine/M
+brim/MS
+brimful
+brimless
+brimmed
+brimming
+brimstone/M
+brindle/DM
+brine/M
+bring/SRZG
+bringer/M
+brininess/M
+brink/SM
+brinkmanship/M
+briny/RTP
+brioche/SM
+briquette/MS
+brisk/SDRYTGP
+brisket/SM
+briskness/M
+bristle/DSMG
+bristly/TR
+britches/M
+brittle/PRMT
+brittleness/M
+bro/SMH
+broach/MDSG
+broad/SMNRYXTP
+broadband/M
+broadcast/AMGS
+broadcaster/MS
+broadcasting/M
+broadcloth/M
+broaden/DG
+broadloom/M
+broadminded
+broadness/M
+broadsheet/SM
+broadside/MGDS
+broadsword/SM
+brocade/DSMG
+broccoli/M
+brochette/SM
+brochure/MS
+brogan/SM
+brogue/SM
+broil/SMDRZG
+broiler/M
+broke
+broken/YP
+brokenhearted/Y
+brokenness/M
+broker/SMDG
+brokerage/MS
+brolly/S
+bromide/SM
+bromidic
+bromine/M
+bronc/SM
+bronchi
+bronchial
+bronchitic
+bronchitis/M
+bronchus/M
+bronco/SM
+broncobuster/SM
+brontosaur/MS
+brontosaurus/MS
+bronze/DSMG
+brooch/MS
+brood/SMDRZG
+brooder/M
+broodily
+brooding/MY
+broodmare/MS
+broody/RMPT
+brook/SMDG
+brooklet/SM
+broom/SM
+broomstick/MS
+broth/MRZ
+brothel/MS
+brother/MY
+brotherhood/MS
+brotherliness/M
+broths
+brougham/SM
+brought
+brouhaha/SM
+brow/MS
+browbeat/SNG
+brown/SMDRPTG
+brownfield
+brownie/MS
+brownish
+brownness/M
+brownout/SM
+brownstone/MS
+browse/DRSMZG
+browser/M
+brr
+bruin/SM
+bruise/DRSMZG
+bruiser/M
+bruising/M
+bruit/SDG
+brunch/MDSG
+brunet/SM
+brunette/MS
+brunt/M
+brush/MDSG
+brushoff/SM
+brushstroke/S
+brushwood/M
+brushwork/M
+brusque/RPYT
+brusqueness/M
+brutal/Y
+brutality/SM
+brutalization/M
+brutalize/GDS
+brute/SM
+brutish/PY
+brutishness/M
+bu
+bub/SM
+bubble/DSMG
+bubblegum/M
+bubbly/RMT
+bubo/M
+buboes
+buccaneer/SGMD
+buck/MDGS
+buckaroo/SM
+buckboard/MS
+bucket/SGMD
+bucketful/MS
+buckeye/MS
+buckle's
+buckle/UDSG
+buckler/MS
+buckram/M
+bucksaw/MS
+buckshot/M
+buckskin/MS
+buckteeth
+bucktooth/MD
+buckwheat/M
+buckyball/SM
+bucolic/MS
+bucolically
+bud/SM
+budded
+budding/S
+buddy/SM
+budge/DSG
+budgerigar/MS
+budget/SGMD
+budgetary
+budgie/SM
+buff/AMDGS
+buffalo/MDG
+buffaloes
+buffer/SMDG
+buffet/SMDGJ
+buffoon/SM
+buffoonery/M
+buffoonish
+bug's
+bug/CS
+bugaboo/SM
+bugbear/SM
+bugged/C
+bugger/SMDG
+buggery
+bugging/C
+buggy/RSMT
+bugle/DRSMZG
+bugler/M
+build/SMRZGJ
+builder/M
+building/M
+buildup/SM
+built/AI
+builtin
+bulb/MS
+bulbous
+bulge/DSMG
+bulgy/RT
+bulimarexia/M
+bulimia/M
+bulimic/SM
+bulk/MDGS
+bulkhead/MS
+bulkiness/M
+bulky/RTP
+bull/MDGS
+bulldog/SM
+bulldogged
+bulldogging
+bulldoze/ZGDRS
+bulldozer/M
+bullet/SMD
+bulletin/MDGS
+bulletproof/SDG
+bullfight/SMRZG
+bullfighter/M
+bullfighting/M
+bullfinch/MS
+bullfrog/MS
+bullhead/MDS
+bullheaded/PY
+bullheadedness/M
+bullhorn/MS
+bullion/M
+bullish/YP
+bullishness/M
+bullock/SM
+bullpen/SM
+bullring/MS
+bullseye
+bullshit/MS!
+bullshitted/!
+bullshitter/SM!
+bullshitting/!
+bullwhip/S
+bully/DSMG
+bulrush/MS
+bulwark/MS
+bum/SM
+bumbag/S
+bumble/DRSZG
+bumblebee/SM
+bumbler/M
+bumf
+bummed
+bummer/SM
+bummest
+bumming
+bump/MDRZGS
+bumper/M
+bumph
+bumpiness/M
+bumpkin/MS
+bumptious/PY
+bumptiousness/M
+bumpy/PRT
+bun/SM
+bunch/MDSG
+bunchy/RT
+bunco/SMDG
+bundle/DSMG
+bung/MDGS
+bungalow/MS
+bungee/SM
+bunghole/MS
+bungle/DRSMZG
+bungler/M
+bunion/SM
+bunk's
+bunk/CDGS
+bunker/SM
+bunkhouse/SM
+bunkum/M
+bunny/SM
+bunt/MDGSJ
+bunting/M
+buoy/MDGS
+buoyancy/M
+buoyant/Y
+bur/SMY
+burble/DSMG
+burbs/M
+burden's
+burden/USGD
+burdensome
+burdock/M
+bureau/SM
+bureaucracy/SM
+bureaucrat/MS
+bureaucratic
+bureaucratically
+bureaucratization/M
+bureaucratize/GDS
+burg/MRZS
+burgeon/DSG
+burger/M
+burgh/MRZ
+burgher/M
+burghs
+burglar/MS
+burglarize/GDS
+burglarproof
+burglary/SM
+burgle/DSG
+burgomaster/SM
+burgundy/SM
+burial/ASM
+burka/SM
+burl/MDS
+burlap/M
+burlesque/MGDS
+burliness/M
+burly/RPT
+burn/MDRZGSB
+burnable/SM
+burner/M
+burnish/ZGMDRS
+burnisher/M
+burnoose/MS
+burnout/MS
+burnt
+burp/MDGS
+burr/MDGS
+burrito/MS
+burro/SM
+burrow/SMDRZG
+burrower/M
+bursa/M
+bursae
+bursar/SM
+bursary/SM
+bursitis/M
+burst/SMG
+bury/ADSG
+bus/AMS
+busboy/SM
+busby/SM
+bused
+busgirl/MS
+bush/MDSGJ
+bushel/SGMD
+bushiness/M
+bushing/M
+bushman/M
+bushmaster/SM
+bushmen
+bushwhack/DRSZG
+bushwhacker/M
+bushy/RPT
+busily
+business/MS
+businesslike
+businessman/M
+businessmen
+businessperson/SM
+businesswoman/M
+businesswomen
+busing/M
+busk/DRZGS
+buskin/SM
+busload/S
+buss/MDSG
+bust/MDRZGS
+buster/M
+bustle/DSMG
+busty/RZT
+busy/DRSTGP
+busybody/SM
+busyness/M
+busywork/M
+but/ACS
+butane/M
+butch/MRSZ
+butcher/MDG
+butchery/SM
+butler/SM
+butt/MDRZGS
+butte/SM
+butted/A
+butter/MDG
+butterball/MS
+buttercream
+buttercup/SM
+butterfat/M
+butterfingered
+butterfingers/M
+butterfly/GDSM
+buttermilk/M
+butternut/SM
+butterscotch/M
+buttery/TRSM
+butting/A
+buttock/SM
+button's
+button/USDG
+buttonhole/DSMG
+buttonwood/MS
+buttress/MDSG
+butty/S
+buxom
+buy/ZGSMR
+buyback/SM
+buyer/M
+buyout/SM
+buzz/MDRSZG
+buzzard/MS
+buzzer/M
+buzzkill/SM
+buzzword/SM
+bx
+bxs
+by/M
+bye/SM
+bygone/SM
+bylaw/SM
+byline/SM
+bypass/GMDS
+bypath/M
+bypaths
+byplay/M
+byproduct/MS
+byre/S
+byroad/SM
+bystander/MS
+byte/MS
+byway/SM
+byword/SM
+byzantine
+c/IES
+ca
+cab/SMRZ
+cabal/MS
+cabala's
+caballero/MS
+cabana/SM
+cabaret/SM
+cabbage/MS
+cabbed
+cabbing
+cabby/SM
+cabdriver/SM
+cabin/MS
+cabinet/SM
+cabinetmaker/MS
+cabinetmaking/M
+cabinetry/M
+cabinetwork/M
+cable/MGDS
+cablecast/GMS
+cablegram/MS
+cabochon/SM
+caboodle/M
+caboose/SM
+cabriolet/SM
+cabstand/SM
+cacao/MS
+cache/MGDS
+cachepot/SM
+cachet/MS
+cackle/MZGDRS
+cackler/M
+cacophonous
+cacophony/SM
+cacti
+cactus/M
+cad/SM
+cadaver/SM
+cadaverous
+caddie/MDS
+caddish/YP
+caddishness/M
+caddying
+cadence/DSM
+cadenza/SM
+cadet/MS
+cadge/ZGDRS
+cadger/M
+cadmium/M
+cadre/MS
+caducei
+caduceus/M
+caesura/SM
+cafe/SM
+cafeteria/MS
+cafetiere/S
+caff/CS
+caffeinated
+caffeine/M
+caftan/MS
+cage/DSMG
+cagey
+cagier
+cagiest
+cagily
+caginess/M
+cagoule/S
+cahoot/MS
+caiman/MS
+cairn/MS
+caisson/SM
+caitiff/SM
+cajole/ZGLDRS
+cajolement/M
+cajoler/M
+cajolery/M
+cake/DSMG
+cakewalk/SM
+cal
+calabash/MS
+calaboose/SM
+calamari/SM
+calamine/M
+calamitous/Y
+calamity/SM
+calcareous
+calciferous
+calcification/M
+calcify/GNDS
+calcimine/DSMG
+calcine/DSG
+calcite/M
+calcium/M
+calculable/I
+calculate/AGNVDSX
+calculated/Y
+calculating/Y
+calculation/AM
+calculator/SM
+calculi
+calculus/M
+caldera/SM
+calendar/MDGS
+calf/M
+calfskin/M
+caliber/SM
+calibrate/GNDSX
+calibration/M
+calibrator/SM
+calico/M
+calicoes
+californium/M
+caliper/SGMD
+caliph/M
+caliphate/MS
+caliphs
+calisthenic/S
+calisthenics/M
+calk/SGMD
+call/ASGMD
+calla/MS
+callable
+callback/MS
+called/U
+caller/MS
+calligrapher/SM
+calligraphic
+calligraphist/MS
+calligraphy/M
+calling/SM
+calliope/MS
+callosity/SM
+callous/PGDSY
+callousness/M
+callow/RPT
+callowness/M
+callus/MDSG
+calm/PSTGMDRY
+calmness/M
+caloric
+calorie/MS
+calorific
+calumet/MS
+calumniate/GNDS
+calumniation/M
+calumniator/MS
+calumnious
+calumny/SM
+calve/GDS
+calypso/MS
+calyx/MS
+cam/SM
+camaraderie/M
+camber/MDSG
+cambial
+cambium/SM
+cambric/M
+camcorder/SM
+came
+camel/MS
+camelhair
+camellia/MS
+cameo/MS
+camera/MS
+cameraman/M
+cameramen
+camerapeople
+cameraperson
+camerawoman/M
+camerawomen
+camerawork
+camiknickers
+camisole/SM
+camouflage/MZGDRS
+camouflager/M
+camp's
+camp/CSGD
+campaign/SMDRZG
+campaigner/M
+campanile/SM
+campanologist/MS
+campanology/M
+camper/MS
+campfire/SM
+campground/SM
+camphor/M
+camping/M
+campsite/SM
+campus/MS
+campy/TR
+camshaft/SM
+can't
+can/SMDRZG
+canal/MS
+canalization/M
+canalize/GDS
+canape/MS
+canard/MS
+canary/SM
+canasta/M
+cancan/MS
+cancel/DRSZG
+canceler/M
+cancellation/SM
+cancelous
+cancer/MS
+cancerous
+candelabra/SM
+candelabrum/M
+candid/YP
+candida
+candidacy/SM
+candidate/MS
+candidature/SM
+candidness/M
+candle/MZGDRS
+candlelight/M
+candlelit
+candlepower/M
+candler/M
+candlestick/MS
+candlewick/SM
+candor/M
+candy/GDSM
+candyfloss
+cane/SM
+canebrake/MS
+caner/M
+canine/MS
+canister/SM
+canker/GMDS
+cankerous
+cannabis/MS
+canned
+cannelloni/M
+cannery/SM
+cannibal/SM
+cannibalism/M
+cannibalistic
+cannibalization/M
+cannibalize/GDS
+cannily/U
+canniness/M
+canning
+cannon/GMDS
+cannonade/MGDS
+cannonball/SM
+cannot
+canny/UTR
+canoe/MDS
+canoeing
+canoeist/SM
+canola/M
+canon/MS
+canonical/Y
+canonization/SM
+canonize/DSG
+canoodle/DSG
+canopy/GDSM
+canst
+cant's
+cant/CZRDGS
+cantabile
+cantaloupe/SM
+cantankerous/PY
+cantankerousness/M
+cantata/MS
+canteen/MS
+canter/CM
+cantered
+cantering
+canticle/MS
+cantilever/MDGS
+canto/MS
+canton/MLS
+cantonal
+cantonment/MS
+cantor/MS
+canvas/MGDS
+canvasback/SM
+canvass/MDRSZG
+canvasser/M
+canyon/MGS
+cap/SMDRBZ
+capabilities
+capability/IM
+capable/I
+capably/I
+capacious/PY
+capaciousness/M
+capacitance/M
+capacities
+capacitor/SM
+capacity/IM
+caparison/MDGS
+cape/SM
+caper/GMD
+capeskin/M
+capillarity/M
+capillary/SM
+capital/MSY
+capitalism/M
+capitalist/SM
+capitalistic
+capitalistically
+capitalization/M
+capitalize/ADSG
+capitation/CSM
+capitol/SM
+capitulate/ADSXGN
+capitulation/AM
+caplet/MS
+capo/SM
+capon/MS
+capped/UA
+capping/UA
+cappuccino/SM
+caprice/SM
+capricious/PY
+capriciousness/M
+capsicum/SM
+capsize/DSG
+capstan/SM
+capstone/MS
+capsular
+capsule/DSMG
+capsulize/DSG
+capt
+captain/SMDG
+captaincy/SM
+caption/SMDG
+captious/YP
+captiousness/M
+captivate/DSGN
+captivation/M
+captivator/SM
+captive/SM
+captivity/SM
+captor/MS
+capture/ADSMG
+car/SMDRZG
+carafe/MS
+caramel/SM
+caramelize/DSG
+carapace/SM
+carat/MS
+caravan/SM
+caravansary/SM
+caravel/SM
+caraway/SM
+carbide/SM
+carbine/SM
+carbohydrate/SM
+carbolic
+carbon/MS
+carbonaceous
+carbonate/MGNDS
+carbonation/M
+carboniferous
+carbonize/GDS
+carborundum/M
+carboy/MS
+carbs
+carbuncle/SM
+carbuncular
+carburetor/SM
+carcass/MS
+carcinogen/SM
+carcinogenic/MS
+carcinogenicity/M
+carcinoma/MS
+card/ESGMD
+cardamom/SM
+cardamon/S
+cardboard/M
+carder/MS
+cardholder/S
+cardiac
+cardie/S
+cardigan/SM
+cardinal/SMY
+cardio
+cardiogram/SM
+cardiograph/M
+cardiographs
+cardiologist/MS
+cardiology/M
+cardiomyopathy
+cardiopulmonary
+cardiovascular
+cardsharp/MRZS
+cardsharper/M
+care/SM
+careen/DGS
+career/MDGS
+careerism
+careerist/SM
+carefree
+careful/YP
+carefuller
+carefullest
+carefulness/M
+caregiver/SM
+careless/PY
+carelessness/M
+carer/M
+caress/MDSG
+caret/MS
+caretaker/MS
+careworn
+carfare/M
+cargo/M
+cargoes
+carhop/MS
+caribou/SM
+caricature/MGDS
+caricaturist/SM
+caries/M
+carillon/SM
+caring/M
+carious
+carjack/JSDRZG
+carjacker/M
+carjacking/M
+carload/SM
+carmaker/S
+carmine/SM
+carnage/M
+carnal/Y
+carnality/M
+carnation/IMS
+carnelian/MS
+carnival/MS
+carnivora
+carnivore/SM
+carnivorous/PY
+carnivorousness/M
+carny/SM
+carob/MS
+carol/ZGMDRS
+caroler/M
+carom/GMDS
+carotene/M
+carotid/SM
+carousal/SM
+carouse/DRSMZG
+carousel/SM
+carouser/M
+carp/SZGMDR
+carpal/MS
+carpel/MS
+carpenter/MDGS
+carpentry/M
+carper/M
+carpet/MDGS
+carpetbag/MS
+carpetbagged
+carpetbagger/MS
+carpetbagging
+carpeting/M
+carpi
+carpool/SMDG
+carport/SM
+carpus/M
+carrel/MS
+carriage/SM
+carriageway/S
+carrier/M
+carrion/M
+carrot/MS
+carroty
+carry/ZGDRSM
+carryall/SM
+carrycot/S
+carryout
+carryover/MS
+carsick/P
+carsickness/M
+cart/SZGMDR
+cartage/M
+cartel/MS
+carter/M
+carthorse/SM
+cartilage/SM
+cartilaginous
+cartload/SM
+cartographer/SM
+cartographic
+cartography/M
+carton/MS
+cartoon/SMDG
+cartoonist/MS
+cartridge/MS
+cartwheel/GMDS
+carve/JZGDRS
+carver/M
+carvery/S
+carving/M
+caryatid/MS
+casaba/MS
+cascade/DSMG
+cascara/SM
+case/LDSJMG
+casebook/S
+cased/U
+caseharden/DGS
+casein/M
+caseload/MS
+casement/MS
+casework/ZMR
+caseworker/M
+cash/GMDS
+cashback/M
+cashbook/MS
+cashew/MS
+cashier/GSMD
+cashless
+cashmere/M
+casing/M
+casino/MS
+cask/SM
+casket/MS
+cassava/SM
+casserole/DSMG
+cassette/MS
+cassia/MS
+cassock/SM
+cassowary/SM
+cast/ASGM
+castanet/MS
+castaway/MS
+caste/JMZRS
+castellated
+caster/M
+castigate/DSGN
+castigation/M
+castigator/SM
+casting/AM
+castle/MGDS
+castoff/SM
+castor/MS
+castrate/GNXDS
+castration/M
+casual/PMYS
+casualness/M
+casualty/SM
+casuist/SM
+casuistic
+casuistry/M
+cat/SM
+cataclysm/MS
+cataclysmal
+cataclysmic
+catacomb/SM
+catafalque/MS
+catalepsy/M
+cataleptic/MS
+catalog/ZGSMDR
+cataloger/M
+catalpa/SM
+catalyses
+catalysis/M
+catalyst/MS
+catalytic/M
+catalyze/GDS
+catamaran/SM
+catapult/GMDS
+cataract/MS
+catarrh/M
+catastrophe/MS
+catastrophic
+catastrophically
+catatonia/M
+catatonic/SM
+catbird/SM
+catboat/SM
+catcall/GSMD
+catch/ZGJLMRS
+catchall/MS
+catcher/M
+catchment/MS
+catchpenny
+catchphrase/SM
+catchword/MS
+catchy/RT
+catechism/SM
+catechist/SM
+catechize/DSG
+categorical/Y
+categorization/MS
+categorize/GDS
+category/SM
+cater/ZGJDRS
+catercorner
+caterer/M
+caterpillar/MS
+caterwaul/SMDG
+catfish/MS
+catgut/M
+catharses
+catharsis/M
+cathartic/SM
+cathedral/SM
+catheter/SM
+catheterize/DSG
+cathode/SM
+cathodic
+catholic
+catholicity/M
+cation/MS
+catkin/MS
+catlike
+catnap/MS
+catnapped
+catnapping
+catnip/M
+catsuit/S
+cattail/SM
+catted
+cattery/S
+cattily
+cattiness/M
+catting
+cattle/M
+cattleman/M
+cattlemen
+catty/TPR
+catwalk/SM
+caucus/MDSG
+caudal/Y
+caught/U
+cauldron/MS
+cauliflower/SM
+caulk/ZGMDRS
+caulker/M
+causal/Y
+causality/SM
+causation/M
+causative
+cause/MZGDRS
+causeless
+causer/M
+causerie/SM
+causeway/SM
+caustic/SM
+caustically
+causticity/M
+cauterization/M
+cauterize/GDS
+caution/SMDG
+cautionary
+cautious/IY
+cautiousness/M
+cavalcade/MS
+cavalier/SMY
+cavalry/SM
+cavalryman/M
+cavalrymen
+cave/DRSMZG
+caveat/MS
+caveman/M
+cavemen
+cavern/MS
+cavernous/Y
+caviar/M
+cavil/ZGJMDRS
+caviler/M
+caving/M
+cavitation
+cavity/FSM
+cavort/DGS
+caw/SMDG
+cay/CSM
+cayenne/M
+cayuse/MS
+cc
+cease/CMGDS
+ceasefire/MS
+ceaseless/YP
+ceaselessness/M
+ceca
+cecal
+cecum/M
+cedar/MS
+cede/FAGSD
+ceder/MS
+cedilla/SM
+ceilidh
+ceilidhs
+ceiling/MS
+celandine/M
+celeb/S
+celebrant/SM
+celebrate/DSGNX
+celebration/M
+celebrator/SM
+celebratory
+celebrity/SM
+celeriac
+celerity/M
+celery/M
+celesta/MS
+celestial/Y
+celibacy/M
+celibate/MS
+cell/SMD
+cellar/MS
+cellist/SM
+cellmate/SM
+cello/MS
+cellophane/M
+cellphone/MS
+cellular/SM
+cellulite/M
+cellulitis
+celluloid/M
+cellulose/M
+cement/MDRZGS
+cementer/M
+cementum/M
+cemetery/SM
+cenobite/MS
+cenobitic
+cenotaph/M
+cenotaphs
+censer/MS
+censor/MDGS
+censored/U
+censorial
+censorious/PY
+censoriousness/M
+censorship/M
+censure/BDRSMZG
+censurer/M
+census/MDSG
+cent/SZMR
+centaur/SM
+centavo/SM
+centenarian/MS
+centenary/SM
+centennial/MYS
+center/MDG
+centerboard/SM
+centerfold/MS
+centerpiece/MS
+centigrade
+centigram/SM
+centiliter/MS
+centime/SM
+centimeter/MS
+centipede/SM
+central/SMY
+centralism
+centralist
+centrality/M
+centralization/CM
+centralize/CGDS
+centralizer/MS
+centrifugal/Y
+centrifuge/DSMG
+centripetal/Y
+centrism/M
+centrist/MS
+centurion/SM
+century/SM
+cephalic
+ceramic/SM
+ceramicist/SM
+ceramics/M
+ceramist/MS
+cereal/MS
+cerebellar
+cerebellum/SM
+cerebra
+cerebral
+cerebrate/GNDS
+cerebration/M
+cerebrovascular
+cerebrum/MS
+cerement/MS
+ceremonial/SMY
+ceremonious/UY
+ceremoniousness/M
+ceremony/SM
+cerise/M
+cerium/M
+cermet/M
+cert/S
+certain/UY
+certainty/USM
+certifiable
+certifiably
+certificate/MGNXDS
+certification/M
+certify/DSG
+certitude/IM
+certitudes
+cerulean/M
+cervical
+cervices
+cervix/M
+cesarean/MS
+cesium/M
+cessation/MS
+cession/KAFSM
+cesspit/S
+cesspool/MS
+cetacean/MS
+ceteris
+cf
+cg
+ch/IFVT
+chad/S
+chafe/GDS
+chaff/GMDS
+chaffinch/MS
+chagrin/GSMD
+chain's
+chain/UGDS
+chainsaw/MDGS
+chair/GMDS
+chairlift/MS
+chairman/M
+chairmanship/SM
+chairmen
+chairperson/SM
+chairwoman/M
+chairwomen
+chaise/MS
+chalcedony/M
+chalet/MS
+chalice/SM
+chalk/GMDS
+chalkboard/SM
+chalkiness/M
+chalky/PRT
+challenge/DRSMZG
+challenged/U
+challenger/M
+challis/M
+chamber/SMD
+chamberlain/MS
+chambermaid/MS
+chambray/M
+chameleon/SM
+chamois/M
+chamomile/MS
+champ/ZGMDS
+champagne/MS
+champion/GMDS
+championship/MS
+chance/MGDS
+chancel/SM
+chancellery/SM
+chancellor/MS
+chancellorship/M
+chancery/SM
+chanciness/M
+chancre/SM
+chancy/PRT
+chandelier/SM
+chandler/MS
+change/MZGDRS
+changeability/M
+changeable/P
+changeableness/M
+changeably
+changed/U
+changeless/Y
+changeling/SM
+changeover/SM
+changer/M
+changing/U
+channel/GSMD
+channelization/M
+channelize/DSG
+chanson/SM
+chant/ZGMDRS
+chanter/M
+chanteuse/MS
+chantey/SM
+chanticleer/MS
+chaos/M
+chaotic
+chaotically
+chap/SM
+chaparral/SM
+chapati/S
+chapatti/S
+chapbook/MS
+chapeau/SM
+chapel/MS
+chaperon/MDGS
+chaperonage/M
+chaperoned/U
+chaplain/MS
+chaplaincy/SM
+chaplet/SM
+chapped
+chapping
+chappy/S
+chapter/SM
+char/SM
+charabanc/MS
+character/MS
+characterful
+characteristic/SM
+characteristically/U
+characterization/MS
+characterize/DSG
+characterless
+charade/SM
+charbroil/GDS
+charcoal/MS
+chard/M
+chardonnay/SM
+charge/AESDGM
+chargeable/A
+charged/U
+charger/SM
+charily
+chariness/M
+chariot/SM
+charioteer/MS
+charisma/M
+charismatic/MS
+charitable/P
+charitableness/M
+charitably/U
+charity/SM
+charlady/S
+charlatan/SM
+charlatanism/M
+charlatanry/M
+charlie/S
+charm/ZGMDRS
+charmer/M
+charming/Y
+charmless
+charred
+charring
+chart/GMDS
+charted/U
+charter's
+charter/ASGD
+charterer/MS
+chartreuse/M
+charwoman/M
+charwomen
+chary/TRP
+chase/MZGDRS
+chaser/M
+chasm/MS
+chassis/M
+chaste/PYTR
+chasten/DGS
+chasteness/M
+chastise/DRSZGL
+chastisement/SM
+chastiser/M
+chastity/M
+chasuble/SM
+chat/SM
+chateau/SM
+chateaux
+chatelaine/SM
+chatline/S
+chatroom/M
+chatted
+chattel/MS
+chatter/MDRZGS
+chatterbox/MS
+chatterer/M
+chattily
+chattiness/M
+chatting
+chatty/TPR
+chauffeur/GMDS
+chauvinism/M
+chauvinist/SM
+chauvinistic
+chauvinistically
+cheap/PXTNRY
+cheapen/DG
+cheapness/M
+cheapo
+cheapskate/MS
+cheat/ZGMDRS
+cheater/M
+check/AGMDS
+checkbook/SM
+checkbox
+checked/U
+checker/MDGS
+checkerboard/SM
+checkers/M
+checklist/MS
+checkmate/MGDS
+checkoff/SM
+checkout/SM
+checkpoint/SM
+checkroom/MS
+checksum
+checkup/MS
+cheddar/M
+cheek/GMDS
+cheekbone/SM
+cheekily
+cheekiness/M
+cheeky/TPR
+cheep/GMDS
+cheer/ZGMDRS
+cheerer/M
+cheerful/YP
+cheerfuller
+cheerfullest
+cheerfulness/M
+cheerily
+cheeriness/M
+cheerio/MS
+cheerleader/SM
+cheerless/PY
+cheerlessness/M
+cheery/TPR
+cheese/MGDS
+cheeseboard/S
+cheeseburger/SM
+cheesecake/SM
+cheesecloth/M
+cheeseparing/M
+cheesiness/M
+cheesy/TPR
+cheetah/M
+cheetahs
+chef/SM
+chem
+chemical/SMY
+chemise/MS
+chemist/MS
+chemistry/M
+chemo/M
+chemotherapeutic
+chemotherapy/M
+chemurgy/M
+chenille/M
+cherish/DSG
+cheroot/MS
+cherry/SM
+chert/M
+cherub/MS
+cherubic
+cherubim
+chervil/M
+chess/M
+chessboard/MS
+chessman/M
+chessmen
+chest/MDS
+chesterfield/SM
+chestful/SM
+chestnut/SM
+chesty/TR
+chevalier/SM
+cheviot/M
+chevron/MS
+chew/SZGMDR
+chewer/M
+chewiness/M
+chewy/PTR
+chg
+chge
+chi/SM
+chiaroscuro/M
+chic/PTMR
+chicane/MS
+chicanery/SM
+chichi/MS
+chick/XMNS
+chickadee/SM
+chicken/MDG
+chickenfeed/M
+chickenhearted
+chickenpox/M
+chickenshit/S!
+chickpea/SM
+chickweed/M
+chicle/M
+chicness/M
+chicory/SM
+chide/GDS
+chiding/Y
+chief/TMRYS
+chiefdom/M
+chieftain/MS
+chieftainship/SM
+chiffon/M
+chiffonier/MS
+chigger/MS
+chignon/MS
+chihuahua/SM
+chilblain/SM
+child/M
+childbearing/M
+childbirth/M
+childbirths
+childcare/M
+childhood/SM
+childish/YP
+childishness/M
+childless/P
+childlessness/M
+childlike
+childminder/S
+childminding
+childproof/GSD
+children/M
+chili/M
+chilies
+chill/JPZTGMDRS
+chiller/M
+chilliness/M
+chilling/Y
+chillness/M
+chilly/TPR
+chime/MZGDRS
+chimer/M
+chimera/MS
+chimeric
+chimerical
+chimney/MS
+chimp/MS
+chimpanzee/SM
+chin/SM
+china/M
+chinaware/M
+chinchilla/MS
+chine/MS
+chink/GMDS
+chinless
+chinned
+chinning
+chino/MS
+chinstrap/MS
+chintz/M
+chintzy/RT
+chinwag/S
+chip/SM
+chipboard
+chipmunk/SM
+chipolata/S
+chipped
+chipper/MS
+chippie
+chipping/S
+chippy/S
+chirography/M
+chiropodist/MS
+chiropody/M
+chiropractic/SM
+chiropractor/SM
+chirp/GMDS
+chirpily
+chirpy/PTR
+chirrup/GMDS
+chisel/ZGMDRS
+chiseler/M
+chit/SM
+chitchat/SM
+chitchatted
+chitchatting
+chitin/M
+chitinous
+chitosan
+chitterlings/M
+chivalrous/PY
+chivalrousness/M
+chivalry/M
+chive/MS
+chivy/GDS
+chlamydia/MS
+chlamydiae
+chloral/M
+chlordane/M
+chloride/MS
+chlorinate/GNDS
+chlorination/M
+chlorine/M
+chlorofluorocarbon/SM
+chloroform/SGMD
+chlorophyll/M
+chloroplast/MS
+chm
+choc/S
+chock/GMDS
+chockablock
+chocoholic/SM
+chocolate/MS
+chocolaty
+choice/MTRS
+choir/MS
+choirboy/MS
+choirmaster/SM
+choke/MZGDRS
+chokecherry/SM
+choker/M
+cholecystectomy
+cholecystitis
+choler/M
+cholera/M
+choleric
+cholesterol/M
+chomp/ZGMDRS
+choose/ZGRS
+chooser/M
+choosiness/M
+choosy/TPR
+chop/SM
+chophouse/SM
+chopped
+chopper/MDGS
+choppily
+choppiness/M
+chopping
+choppy/TPR
+chopstick/SM
+choral/MYS
+chorale/MS
+chord/MS
+chordal
+chordate/SM
+chore/MS
+chorea/M
+choreograph/DRZG
+choreographer/M
+choreographic
+choreographically
+choreographs
+choreography/M
+chorister/SM
+choroid/MS
+chortle/MZGDRS
+chortler/M
+chorus/GMDS
+chose
+chosen
+chow/SGMD
+chowder/MS
+chrism/M
+christen/ASGD
+christening/MS
+christian/U
+christology
+chromatic
+chromatically
+chromatin/M
+chromatography
+chrome/MGDS
+chromium/M
+chromosomal
+chromosome/MS
+chronic
+chronically
+chronicle/DRSMZG
+chronicler/M
+chronograph/M
+chronographs
+chronological/Y
+chronologist/MS
+chronology/SM
+chronometer/SM
+chrysalis/MS
+chrysanthemum/MS
+chub/SM
+chubbiness/M
+chubby/TPR
+chuck/GMDS
+chuckhole/SM
+chuckle/MGDS
+chuffed
+chug/SM
+chugged
+chugging
+chukka/MS
+chum/SM
+chummed
+chummily
+chumminess/M
+chumming
+chummy/PTR
+chump/MS
+chunder/GDS
+chunk/GMDS
+chunkiness/M
+chunky/PTR
+chunter/DGS
+church/MS
+churchgoer/SM
+churchgoing/M
+churchman/M
+churchmen
+churchwarden/MS
+churchwoman
+churchwomen
+churchyard/SM
+churl/MS
+churlish/PY
+churlishness/M
+churn/ZGMDRS
+churner/M
+chute/MS
+chutney/MS
+chutzpah/M
+chyme/M
+chyron/MS
+ciabatta/SM
+ciao/S
+cicada/MS
+cicatrices
+cicatrix/M
+cicerone/SM
+ciceroni
+cider's
+cider/S
+cigar/MS
+cigarette/MS
+cigarillo/MS
+cilantro/M
+cilia
+cilium/M
+cinch/GMDS
+cinchona/SM
+cincture/SM
+cinder/GMDS
+cine
+cinema/MS
+cinematic
+cinematographer/MS
+cinematographic
+cinematography/M
+cinnabar/M
+cinnamon/M
+cipher's
+cipher/CGDS
+cir
+circa
+circadian
+circle/MGDS
+circlet/MS
+circuit/MDGS
+circuital
+circuitous/YP
+circuitousness/M
+circuitry/M
+circuity/M
+circular/SMY
+circularity/M
+circularize/DSG
+circulate/ADSG
+circulation/SM
+circulatory
+circumcise/XDSGN
+circumcised/U
+circumcision/M
+circumference/MS
+circumferential
+circumflex/MS
+circumlocution/MS
+circumlocutory
+circumnavigate/XGNDS
+circumnavigation/M
+circumpolar
+circumscribe/GDS
+circumscription/MS
+circumspect/Y
+circumspection/M
+circumstance/MGDS
+circumstantial/Y
+circumvent/DSG
+circumvention/M
+circus/MS
+cirque/MS
+cirrhosis/M
+cirrhotic/SM
+cirri
+cirrus/M
+cis
+cisgender
+cistern/MS
+cit
+citadel/MS
+citation/AMS
+cite's
+cite/IAGSD
+citified
+citizen/MS
+citizenry/M
+citizenship/M
+citric
+citron/MS
+citronella/M
+citrus/MS
+city/SM
+citywide
+civet/MS
+civic/S
+civically
+civics/M
+civil/UY
+civilian/MS
+civility/ISM
+civilization/MS
+civilize/GDS
+civilized/U
+civvies/M
+ck
+cl
+clack/GMDS
+clad/U
+cladding/M
+clade
+claim's
+claim/CKEAGDS
+claimable/A
+claimant/MS
+claimed/U
+claimer/ECSM
+clairvoyance/M
+clairvoyant/MS
+clam/SM
+clambake/MS
+clamber/ZGMDRS
+clamberer/M
+clammed
+clammily
+clamminess/M
+clamming
+clammy/PTR
+clamor/GMDS
+clamorous
+clamp/GMDS
+clampdown/MS
+clan/SM
+clandestine/Y
+clang/ZGMDRS
+clangor/M
+clangorous/Y
+clank/GMDS
+clannish/P
+clannishness/M
+clansman/M
+clansmen
+clanswoman
+clanswomen
+clap/SM
+clapboard/MDGS
+clapped
+clapper/MS
+clapperboard/S
+clapping/M
+claptrap/M
+claque/MS
+claret/MS
+clarification/M
+clarify/XDSNG
+clarinet/SM
+clarinetist/SM
+clarion/MDGS
+clarity/M
+clash/GMDS
+clasp's
+clasp/UGDS
+class/GMDS
+classic/MS
+classical/MY
+classicism/M
+classicist/MS
+classifiable
+classification/CAM
+classifications
+classified's
+classified/U
+classifieds
+classifier/MS
+classify/ACSDGN
+classiness/M
+classism
+classless/P
+classmate/MS
+classroom/MS
+classwork/M
+classy/TRP
+clatter/GMDS
+clausal
+clause/MS
+claustrophobia/M
+claustrophobic
+clavichord/SM
+clavicle/MS
+clavier/MS
+claw's
+claw/CSGD
+clay/M
+clayey
+clayier
+clayiest
+clean/BJPZTGDRYS
+cleaner/M
+cleaning/M
+cleanliness/UM
+cleanly/UTPR
+cleanness/UM
+cleanse/ZGDRS
+cleanser/M
+cleanup/MS
+clear/JPTGMDRYS
+clearance/SM
+clearheaded
+clearing/M
+clearinghouse/SM
+clearness/M
+clearway/S
+cleat/MS
+cleavage/MS
+cleave/ZGDRS
+cleaver/M
+clef/SM
+cleft/MS
+clematis/MS
+clemency/IM
+clement/Y
+clementine/S
+clench/GMDS
+clerestory/SM
+clergy/SM
+clergyman/M
+clergymen
+clergywoman/M
+clergywomen
+cleric/MS
+clerical/Y
+clericalism/M
+clerk/GMDS
+clerkship/M
+clever/PTRY
+cleverness/M
+clevis/MS
+clew/SGMD
+cliche/MDS
+click/BZGMDRS
+clickbait
+clicker/M
+client/MS
+clientele/MS
+cliff/MS
+cliffhanger/SM
+cliffhanging
+clifftop/S
+clii
+climacteric/M
+climactic
+climate/SM
+climatic
+climatically
+climatologist/SM
+climatology/M
+climax/MDSG
+climb/SMDRZGB
+climber/M
+climbing/M
+clime/SM
+clinch/MDRSZG
+clincher/M
+cling/SMRZG
+clinger/M
+clingfilm
+clingy/RT
+clinic/SM
+clinical/Y
+clinician/SM
+clink/SMDRZG
+clinker/M
+cliometric/S
+cliometrician/MS
+cliometrics/M
+clip/SM
+clipboard/MS
+clipped
+clipper/SM
+clipping/SM
+clique/SM
+cliquey
+cliquish/YP
+cliquishness/M
+clit/SM
+clitoral
+clitorides
+clitoris/MS
+clix
+cloaca/M
+cloacae
+cloak's
+cloak/USDG
+cloakroom/MS
+clobber/SMDG
+cloche/SM
+clock/SMDG
+clockwise
+clockwork/SM
+clod/MS
+cloddish
+clodhopper/MS
+clog's
+clog/US
+clogged/U
+clogging/U
+cloisonne/M
+cloister/SMDG
+cloistral
+clomp/SDG
+clonal
+clone/DSMG
+clonidine
+clonk/SMDG
+clop/MS
+clopped
+clopping
+close/DRSMYTGJP
+closefisted
+closemouthed
+closeness/M
+closeout/MS
+closet/SMDG
+closeup/SM
+closing/M
+closure/ESM
+clot/MS
+cloth/M
+clothe/UDSG
+clotheshorse/MS
+clothesline/SM
+clothespin/SM
+clothier/MS
+clothing/M
+cloths
+clotted
+clotting
+cloture/SM
+cloud/SMDG
+cloudburst/SM
+clouded/U
+cloudiness/M
+cloudless
+cloudy/RPT
+clout/SMDG
+clove/RSMZ
+cloven
+clover/M
+cloverleaf/SM
+cloverleaves
+clown/SMDG
+clownish/YP
+clownishness/M
+cloy/DGS
+cloying/Y
+club/MS
+clubbable
+clubbed
+clubber/S
+clubbing
+clubfeet
+clubfoot/MD
+clubhouse/SM
+clubland
+cluck/SMDG
+clue/MGDS
+clueless
+clump/SMDG
+clumpy/TR
+clumsily
+clumsiness/M
+clumsy/TRP
+clung
+clunk/SMDRZG
+clunker/M
+clunky/TR
+cluster/MDSG
+clutch/GMDS
+clutter's
+clutter/UDSG
+clvi
+clvii
+clxi
+clxii
+clxiv
+clxix
+clxvi
+clxvii
+cm
+cnidarian/MS
+co/ESD
+coach/MDSG
+coachload/S
+coachman/M
+coachmen
+coachwork
+coadjutor/MS
+coagulant/MS
+coagulate/GNDS
+coagulation/M
+coagulator/MS
+coal/MDGS
+coalesce/GDS
+coalescence/M
+coalescent
+coalface/MS
+coalfield/S
+coalition/MS
+coalitionist/MS
+coalmine/S
+coarse/RYTP
+coarsen/SDG
+coarseness/M
+coast/SMDRZG
+coastal
+coaster/M
+coastguard/S
+coastline/MS
+coat/MDGJS
+coating/M
+coatroom/S
+coattail/SM
+coauthor/MDGS
+coax/DRSZG
+coaxer/M
+coaxial
+coaxing/Y
+cob/SM
+cobalt/M
+cobber/S
+cobble/DRSMZG
+cobbler/M
+cobblestone/SM
+cobnut/S
+cobra/SM
+cobweb/SM
+cobwebbed
+cobwebby/RT
+coca/M
+cocaine/M
+cocci/S
+coccus/M
+coccyges
+coccyx/M
+cochineal/M
+cochlea/SM
+cochleae
+cochlear
+cock/MDGS
+cockade/SM
+cockamamie
+cockatiel/MS
+cockatoo/SM
+cockatrice/SM
+cockchafer/S
+cockcrow/SM
+cockerel/SM
+cockeyed
+cockfight/MGS
+cockfighting/M
+cockily
+cockiness/M
+cockle/SM
+cockleshell/SM
+cockney/SM
+cockpit/SM
+cockroach/MS
+cockscomb/SM
+cocksucker/MS!
+cocksure
+cocktail/MS
+cocky/RTP
+coco/MS
+cocoa/SM
+coconut/SM
+cocoon/SMDG
+cod/SM
+coda/MS
+codded
+codding
+coddle/DSG
+code's
+code/CZGDRS
+codeine/M
+codependency/M
+codependent/SM
+coder/CM
+codex/M
+codfish/MS
+codger/SM
+codices
+codicil/SM
+codification/M
+codifier/M
+codify/XDRSNZG
+codon/S
+codpiece/MS
+codswallop
+coed/MS
+coeducation/M
+coeducational
+coefficient/MS
+coelenterate/MS
+coenzyme
+coequal/MYS
+coerce/DRSZGNV
+coercer/M
+coercion/M
+coeval/SMY
+coexist/DSG
+coexistence/M
+coexistent
+coextensive
+coffee/SM
+coffeecake/SM
+coffeehouse/MS
+coffeemaker/SM
+coffeepot/MS
+coffer/SM
+cofferdam/MS
+coffin/SMDG
+cog/SM
+cogency/M
+cogent/Y
+cogitate/DSXGNV
+cogitation/M
+cogitator/MS
+cognac/SM
+cognate/MS
+cognition/AM
+cognitional
+cognitive/Y
+cognizable
+cognizance/AM
+cognizant
+cognomen/SM
+cognoscente/M
+cognoscenti
+cogwheel/SM
+cohabit/SGD
+cohabitant/MS
+cohabitation/M
+coheir/SM
+cohere/DSG
+coherence/IM
+coherency/M
+coherent/IY
+cohesion/M
+cohesive/YP
+cohesiveness/M
+coho/MS
+cohort/SM
+coif/MS
+coiffed
+coiffing
+coiffure/DSMG
+coil's/A
+coil/UADGS
+coin/MDRZGS
+coinage/SM
+coincide/DSG
+coincidence/MS
+coincident
+coincidental/Y
+coiner/M
+coinsurance/M
+coir
+coital
+coitus/M
+coke/MGDS
+col/S
+cola/MS
+colander/SM
+cold/MRYTPS
+coldblooded
+coldness/M
+coleslaw/M
+coleus/MS
+coley/S
+colic/M
+colicky
+coliseum/MS
+colitis/M
+coll
+collaborate/DSXGNV
+collaboration/M
+collaborationist
+collaborative/Y
+collaborator/MS
+collage/SM
+collagen
+collapse/MGDS
+collapsible
+collar/SMDG
+collarbone/SM
+collard/SM
+collarless
+collate/DSXGN
+collateral/MY
+collateralize
+collation/M
+collator/MS
+colleague/MS
+collect's
+collect/ASGVD
+collected/U
+collectedly
+collectible/SM
+collection/AMS
+collective/MYS
+collectivism/M
+collectivist/SM
+collectivization/M
+collectivize/DSG
+collector/MS
+colleen/SM
+college/SM
+collegiality/M
+collegian/MS
+collegiate
+collide/DRSZG
+collie/RSMZ
+collier/M
+colliery/SM
+collision/SM
+collocate/MGNDSX
+collocation/M
+colloid/SM
+colloidal
+colloq
+colloquial/Y
+colloquialism/SM
+colloquies
+colloquium/MS
+colloquy/M
+collude/DSG
+collusion/M
+collusive
+cologne/SM
+colon/SM
+colonel/SM
+colonelcy/M
+colones
+colonial/SMY
+colonialism/M
+colonialist/MS
+colonist/SM
+colonization/ACM
+colonize/CAGSD
+colonizer/MS
+colonnade/MDS
+colonoscopy/SM
+colony/SM
+colophon/SM
+color's
+color/AEGDS
+colorant/SM
+coloration/EM
+coloratura/MS
+colorblind/P
+colorblindness/M
+colored's
+colored/U
+coloreds
+colorfast/P
+colorfastness/M
+colorful/PY
+colorfulness/M
+coloring's
+colorist/S
+colorization/M
+colorize/DSG
+colorless/PY
+colorlessness/M
+colorway/S
+colossal/Y
+colossi
+colossus/M
+colostomy/SM
+colostrum/M
+colt/MS
+coltish
+columbine/SM
+column/SMD
+columnar
+columnist/SM
+com/JL
+coma/MS
+comaker/SM
+comatose
+comb/MDRZGJS
+combat/SMDGV
+combatant/SM
+combativeness/M
+combed/U
+comber/M
+combination/SM
+combine's
+combine/ADSG
+combined/U
+combiner/MS
+combings/M
+combo/SM
+combust/SGVD
+combustibility/M
+combustible/MS
+combustion/M
+come/IMZGRS
+comeback/MS
+comedian/MS
+comedic
+comedienne/MS
+comedown/MS
+comedy/SM
+comeliness/M
+comely/RPT
+comer's
+comestible/SM
+comet/SM
+comeuppance/SM
+comfit's
+comfit/ES
+comfort/ESMDG
+comfortable/P
+comfortableness/M
+comfortably/U
+comforter/MS
+comforting/Y
+comfortless
+comfy/RT
+comic/SM
+comical/Y
+comicality/M
+coming/M
+comity/M
+comm
+comma/SM
+command/SMDRLZG
+commandant/MS
+commandeer/GDS
+commander/M
+commandment/MS
+commando/SM
+commemorate/XGNVDS
+commemoration/M
+commemorator/MS
+commence/ADSLG
+commencement/AM
+commencements
+commend/ASDBG
+commendably
+commendation/AMS
+commendatory
+commensurable
+commensurate/IY
+comment/GSMD
+commentary/SM
+commentate/DSG
+commentator/SM
+commerce/M
+commercial/SMY
+commercialism/M
+commercialization/M
+commercialize/GDS
+commie/SM
+commingle/DSG
+commiserate/GNVDSX
+commiseration/M
+commissar/SM
+commissariat/SM
+commissary/SM
+commission's
+commission/ACSGD
+commissionaire/S
+commissioner/SM
+commit/AS
+commitment/MS
+committal/SM
+committed/AU
+committee/SM
+committeeman/M
+committeemen
+committeewoman/M
+committeewomen
+committer/S
+committing/A
+commode's
+commode/EIS
+commodification
+commodious/Y
+commodity/SM
+commodore/SM
+common's
+common/UPRYT
+commonality/S
+commonalty/M
+commoner/MS
+commonness/UM
+commonplace/MS
+commons
+commonsense
+commonweal/MH
+commonwealth/M
+commonwealths
+commotion/SM
+communal/Y
+commune/XDSMGN
+communicability/M
+communicable/I
+communicably
+communicant/MS
+communicate/GNVDSX
+communication/M
+communicative/U
+communicator/SM
+communion/M
+communique/SM
+communism/M
+communist/SM
+communistic
+community/SM
+commutation/MS
+commutative
+commutativity
+commutator/SM
+commute/BDRSMZG
+commuter/M
+comorbidity
+comp/MDYGS
+compact/TGSMDRYP
+compaction
+compactness/M
+compactor/SM
+companion/SBM
+companionably
+companionship/M
+companionway/MS
+company/SM
+comparability/M
+comparable/I
+comparably/I
+comparative/MYS
+compare/BDSG
+comparison/MS
+compartment/SM
+compartmental
+compartmentalization/M
+compartmentalize/DSG
+compass/GMDS
+compassion/M
+compassionate/Y
+compatibility/IM
+compatible/IMS
+compatibly/I
+compatriot/MS
+compeer/SM
+compel/S
+compelled
+compelling/Y
+compendious
+compendium/SM
+compensate/DSXGN
+compensated/U
+compensation/M
+compensatory
+compere/DSG
+compete/DSG
+competence/IM
+competences
+competencies
+competency/IM
+competent/IY
+competition/SM
+competitive/PY
+competitiveness/M
+competitor/SM
+compilation/SM
+compile/DRSZG
+compiler/M
+complacence/M
+complacency/M
+complacent/Y
+complain/DRZGS
+complainant/MS
+complainer/M
+complaint/SM
+complaisance/M
+complaisant/Y
+complected
+complement/SGMD
+complementary
+complete/PYTGNXDRS
+completed/U
+completeness/IM
+completion/M
+complex/MSY
+complexion/MDS
+complexional
+complexity/SM
+compliance/M
+compliant/Y
+complicate/GDS
+complicated/Y
+complication/M
+complicit
+complicity/M
+compliment/MDGS
+complimentary/U
+comply/NDSXG
+compo/S
+component/SM
+comport/LSGD
+comportment/M
+compose/AECGSD
+composedly
+composer/MS
+composite/MYGNXDS
+composition/CM
+compositional
+compositor/SM
+compost/SGMD
+composure/EM
+compote/SM
+compound/GMDBS
+compounded/U
+comprehend/SDG
+comprehensibility/IM
+comprehensible/I
+comprehensibly/I
+comprehension/IM
+comprehensions
+comprehensive/PMYS
+comprehensiveness/M
+compress's
+compress/CGVDS
+compressed/U
+compressible
+compression/CM
+compressor/SM
+comprise/GDS
+compromise/MGDS
+comptroller/MS
+compulsion/MS
+compulsive/YP
+compulsiveness/M
+compulsorily
+compulsory/SM
+compunction/SM
+computation/SM
+computational/Y
+compute/ADSG
+computer/MS
+computerate
+computerization/M
+computerize/GDS
+computing/M
+comrade/SMY
+comradeship/M
+con/GSM
+concatenate/XDSGN
+concatenation/M
+concave/YP
+concaveness/M
+conceal/SDRZGBL
+concealed/U
+concealer/M
+concealment/M
+conceit/SMD
+conceited/PY
+conceitedness/M
+conceivable/I
+conceivably/I
+conceive/DSGB
+concentrate/DSMGNX
+concentration/M
+concentric
+concentrically
+concept/SM
+conception/SM
+conceptional
+conceptual/Y
+conceptualization/MS
+conceptualize/DSG
+concern/UMD
+concerned/UY
+concerning
+concerns
+concert's
+concert/ESDG
+concerted/Y
+concertgoer/S
+concertina/SGMD
+concertize/DSG
+concertmaster/MS
+concerto/SM
+concessionaire/MS
+concessional
+concessionary
+conch/M
+conchie/S
+conchs
+concierge/MS
+conciliate/DSGN
+conciliation/AM
+conciliator/SM
+conciliatory
+concise/RPYTN
+conciseness/M
+concision/M
+conclave/SM
+conclude/DSG
+conclusion/MS
+conclusive/IYP
+conclusiveness/IM
+concoct/SDG
+concoction/MS
+concomitant/MYS
+concord/M
+concordance/SM
+concordant
+concordat/SM
+concourse/SM
+concrete/DSPMYGNX
+concreteness/M
+concretion/M
+concubinage/M
+concubine/MS
+concupiscence/M
+concupiscent
+concur/S
+concurred
+concurrence/SM
+concurrency
+concurring
+concuss/V
+concussion/SM
+condemn/SDRZG
+condemnation/MS
+condemnatory
+condemner/M
+condensate/MNXS
+condensation/M
+condense/DRSZG
+condenser/M
+condescending/Y
+condescension/M
+condign
+condiment/MS
+condition's
+condition/AGSD
+conditional/SMY
+conditionality
+conditioned/U
+conditioner/SM
+conditioning/M
+condo/SM
+condolence/SM
+condom/SM
+condominium/MS
+condone/DSG
+condor/SM
+conduce/DSGV
+conduct/MDGV
+conductance/M
+conductibility/M
+conductible
+conduction/M
+conductivity/M
+conductor/MS
+conductress/MS
+conduit/SM
+cone/M
+coneys
+confab/SM
+confabbed
+confabbing
+confabulate/XDSGN
+confabulation/M
+confection/SZMR
+confectioner/M
+confectionery/SM
+confederacy/SM
+confederate/M
+confer/S
+conferee/SM
+conference/MGS
+conferrable
+conferral/M
+conferred
+conferrer/MS
+conferring
+confessed/Y
+confession/SM
+confessional/SM
+confessor/MS
+confetti/M
+confidant/MS
+confidante/SM
+confide/DRSZG
+confidence/SM
+confident/Y
+confidential/Y
+confidentiality/M
+confider/M
+confiding/Y
+configuration/S
+configure/B
+confined/U
+confinement/MS
+confirm/ASDG
+confirmation/ASM
+confirmatory
+confirmed/U
+confiscate/DSGNX
+confiscation/M
+confiscator/SM
+confiscatory
+conflagration/MS
+conflate/XDSGN
+conflation/M
+conflict/SGMD
+confluence/MS
+confluent
+conform/ZB
+conformable/U
+conformal
+conformance/M
+conformism/M
+conformist/SM
+conformity/M
+confrere/MS
+confrontation/SM
+confrontational
+confuse/RZ
+confused/Y
+confusing/Y
+confutation/M
+confute/DSG
+conga/SMDG
+congeal/SLDG
+congealment/M
+conger/SM
+congeries/M
+congest/SDGV
+congestion/M
+conglomerate/DSXMGN
+conglomeration/M
+congrats/M
+congratulate/XGNDS
+congratulation/M
+congratulatory
+congregant/MS
+congregate/GNDSX
+congregation/M
+congregational
+congregationalism/M
+congregationalist/MS
+congress/MS
+congressional
+congressman/M
+congressmen
+congresspeople
+congressperson/MS
+congresswoman/M
+congresswomen
+congruence/M
+congruent/Y
+congruity/ISM
+congruous
+conic/SM
+conical/Y
+conifer/SM
+coniferous
+conjectural
+conjecture/MGDS
+conjoint
+conjugal/Y
+conjugate/DSXGN
+conjugation/M
+conjunct/VMS
+conjunctiva/SM
+conjunctive/SM
+conjunctivitis/M
+conjuration/MS
+conjure/DRSZG
+conjurer/M
+conk/MDRZ
+conman
+connect/AEDVGS
+connectable
+connected/U
+connection/EMS
+connective/MS
+connectivity/M
+connector/MS
+conned
+conning
+conniption/MS
+connivance/M
+connive/DRSZG
+conniver/M
+connoisseur/SM
+connotative
+connubial
+conquer/ASDG
+conquerable/U
+conquered/U
+conqueror/MS
+conquest/AM
+conquistador/SM
+cons/DSG
+consanguineous
+consanguinity/M
+conscienceless
+conscientious/PY
+conscientiousness/M
+conscious/UYP
+consciousness/UM
+consciousnesses
+conscription/M
+consecrate/ADSGN
+consecrated/U
+consecration/AM
+consecrations
+consecutive/Y
+consensual
+consensus/MS
+consent/SMDG
+consequence/SM
+consequent/Y
+consequential/IY
+conservancy/SM
+conservation/M
+conservationism/M
+conservationist/SM
+conservatism/M
+conservative/MYS
+conservatoire/S
+conservator/SM
+conservatory/SM
+consider/AGSD
+considerable/I
+considerably
+considerate/IPYN
+considerateness/IM
+consideration/AIM
+considerations
+considered/U
+consign/ASDG
+consignee/MS
+consignment/MS
+consist/SDG
+consistence/MS
+consistency/ISM
+consistent/IY
+consistory/SM
+consolable/I
+consolation/MS
+consolatory
+consolidate/XDSGN
+consolidated/U
+consolidation/M
+consolidator/MS
+consoling/Y
+consomme/M
+consonance/SM
+consonant/SMY
+consortia
+consortium/M
+conspectus/MS
+conspicuous/IPY
+conspicuousness/IM
+conspiracy/SM
+conspirator/MS
+conspiratorial/Y
+conspire/GD
+constable/SM
+constabulary/SM
+constancy/IM
+constant/MYS
+constellation/SM
+consternation/M
+constipate/GNDS
+constipation/M
+constituency/SM
+constituent/SM
+constitute/ADSGNV
+constitution/AM
+constitutional/MYS
+constitutionalism
+constitutionality/UM
+constitutions
+constrained/U
+constraint/SM
+constrict/GVSD
+constriction/SM
+constrictor/SM
+construable
+construct's
+construct/CADVGS
+construction/CAMS
+constructional
+constructionist's
+constructionist/CS
+constructive/YP
+constructiveness/M
+constructor/MS
+construe/GDS
+consul/KSM
+consular/K
+consulate/SM
+consulship/M
+consult/GSD
+consultancy/SM
+consultant/MS
+consultation/MS
+consultative
+consumable/SM
+consume/BDRSZG
+consumed/U
+consumer/M
+consumerism/M
+consumerist/MS
+consummate/YGNXDS
+consummated/U
+consumption/M
+consumptive/SM
+cont
+contact/ASDG
+contactable
+contactless
+contagion/MS
+contagious/PY
+contagiousness/M
+contain/SBLDRZG
+container/M
+containerization/M
+containerize/DSG
+containment/M
+contaminant/SM
+contaminate/ACDSG
+contaminated/U
+contamination/CM
+contaminator/SM
+contd
+contemn/SDG
+contemplate/DSGNV
+contemplation/M
+contemplative/SMY
+contemporaneity/M
+contemporaneous/Y
+contempt/M
+contemptible
+contemptibly
+contemptuous/YP
+contemptuousness/M
+contender/MS
+content/ESLMDG
+contented/EY
+contentedness/M
+contention/SM
+contentious/YP
+contentiousness/M
+contently
+contentment/EM
+conterminous/Y
+contestable/I
+contestant/MS
+contested/U
+contextualization
+contextualize/DSG
+contiguity/M
+contiguous/Y
+continence/IM
+continent/SM
+continental/SM
+contingency/SM
+contingent/SMY
+continua
+continual/Y
+continuance/EMS
+continuation/EMS
+continue/EGDS
+continuity/ESM
+continuous/EY
+continuum/M
+contort/GD
+contortion/MS
+contortionist/SM
+contra
+contraband/M
+contrabassoon/S
+contraception/M
+contraceptive/SM
+contract/MDG
+contractible
+contractile
+contractility
+contraction/S
+contractual/Y
+contradict/SDG
+contradiction/SM
+contradictory
+contradistinction/MS
+contraflow/S
+contrail/MS
+contraindicate/GNXDS
+contraindication/M
+contralto/SM
+contraption/SM
+contrapuntal/Y
+contrarian/SM
+contrarianism
+contrariety/M
+contrarily
+contrariness/M
+contrariwise
+contrary/PSM
+contrast/MDGS
+contravene/GDS
+contravention/SM
+contretemps/M
+contribute/XGND
+contribution/M
+contributor/MS
+contributory
+contrition/M
+contrivance/MS
+contrive/ZGDRS
+contriver/M
+control's
+control/CS
+controllable/U
+controlled/UC
+controller/MS
+controlling/C
+controversial/Y
+controversy/SM
+controvert/DSG
+controvertible/I
+contumacious/Y
+contumacy/M
+contumelious
+contumely/SM
+contuse/XDSGN
+contusion/M
+conundrum/SM
+conurbation/MS
+convalesce/DSG
+convalescence/MS
+convalescent/SM
+convection/M
+convectional
+convective
+convector/S
+convene/ADSG
+convener/MS
+convenience/IMS
+convenient/IY
+convent/SM
+conventicle/MS
+convention/SM
+conventional/UY
+conventionality/UM
+conventionalize/GDS
+conventioneer/S
+convergence/MS
+convergent
+conversant
+conversation/MS
+conversational/Y
+conversationalist/SM
+converse/Y
+convert's
+convert/AGSD
+converted/U
+converter/SM
+convertibility/M
+convertible/SM
+convex/Y
+convexity/M
+convey/SBDG
+conveyance/MGS
+conveyor/MS
+convict/GSMD
+conviction/MS
+convince/GDS
+convinced/U
+convincing/UY
+convivial/Y
+conviviality/M
+convoke/DSG
+convoluted
+convolution/MS
+convoy/SMDG
+convulse/GNVXDS
+convulsion/M
+convulsive/Y
+cony/M
+coo/GSMD
+cook's
+cook/ADGS
+cookbook/MS
+cooked/U
+cooker/SM
+cookery/SM
+cookhouse/S
+cookie/SM
+cooking/M
+cookout/SM
+cookware/SM
+cool/MDRYZTGPS
+coolant/SM
+cooler/M
+coolie/SM
+coolness/M
+coon/MS!
+coonskin/MS
+coop/MDRZGS
+cooper/MDG
+cooperage/M
+cooperate/DSGNV
+cooperation/M
+cooperative/PMYS
+cooperativeness/M
+cooperator/SM
+coordinate/DSMYGN
+coordinated/U
+coordination/M
+coordinator/MS
+coot/MS
+cootie/SM
+cop/GJSMD
+copacetic
+copay/M
+cope/MS
+copier/SM
+copilot/SM
+coping/M
+copious/PY
+copiousness/M
+copped
+copper/SM
+copperhead/SM
+copperplate/M
+coppery
+copping
+copra/M
+copse/SM
+copter/SM
+copula/SM
+copulate/GNVDS
+copulation/M
+copulative/SM
+copy's
+copy/ADSG
+copybook/SM
+copycat/MS
+copycatted
+copycatting
+copyist/MS
+copyleft
+copyright/GSMD
+copywriter/MS
+coquetry/SM
+coquette/DSMG
+coquettish/Y
+cor
+coracle/SM
+coral/SM
+corbel/SM
+cord/EASGDM
+cordage/M
+cordial/SMY
+cordiality/M
+cordillera/MS
+cordite/M
+cordless
+cordon/SMDG
+cordovan/M
+corduroy/MS
+corduroys/M
+core/MZGDRS
+coreligionist/S
+corer/M
+corespondent/MS
+corgi/SM
+coriander/M
+cork's
+cork/UDGS
+corkage
+corker/SM
+corkscrew/SMDG
+corm/MS
+cormorant/SM
+corn/MDRZGS
+cornball/MS
+cornbread/M
+corncob/MS
+corncrake/S
+cornea/SM
+corneal
+corner/GMD
+cornerstone/SM
+cornet/SM
+cornfield/S
+cornflakes/M
+cornflour
+cornflower/SM
+cornice/MS
+cornily
+corniness/M
+cornmeal/M
+cornrow/MDGS
+cornstalk/SM
+cornstarch/M
+cornucopia/MS
+corny/PRT
+corolla/MS
+corollary/SM
+corona/SM
+coronal/MS
+coronary/SM
+coronation/SM
+coronavirus/MS
+coroner/MS
+coronet/MS
+corp
+corpora
+corporal/SM
+corporate/XYN
+corporation/IM
+corporatism
+corporeal/Y
+corporeality/M
+corps/MS
+corpse/M
+corpsman/M
+corpsmen
+corpulence/M
+corpulent
+corpus/M
+corpuscle/MS
+corpuscular
+corr
+corral/SM
+corralled
+corralling
+correct/DRYTGVSBP
+corrected/U
+correction/SM
+correctional
+corrective/SM
+correctness/IM
+corrector
+correlate/XDSMGNV
+correlated/U
+correlation/M
+correlational
+correlative/MS
+correspond/SDG
+correspondence/SM
+correspondent/SM
+corresponding/Y
+corridor/SM
+corrie/S
+corroborate/GNVDSX
+corroborated/U
+corroboration/M
+corroborator/SM
+corroboratory
+corrode/GDS
+corrosion/M
+corrosive/SMY
+corrugate/GNXDS
+corrugation/M
+corrupt/DRYPSTG
+corruptibility/IM
+corruptible/I
+corruption/MS
+corruptness/M
+corsage/MS
+corsair/MS
+corset/SGMD
+cortege/MS
+cortex/M
+cortical
+cortices
+cortisol
+cortisone/M
+corundum/M
+coruscate/GNDS
+coruscation/M
+corvette/SM
+cos/M
+cosh/DSG
+cosign/ZGSDR
+cosignatory/SM
+cosigner/M
+cosine/SM
+cosmetic/SM
+cosmetically
+cosmetician/MS
+cosmetologist/MS
+cosmetology/M
+cosmic
+cosmically
+cosmogonist/SM
+cosmogony/SM
+cosmological
+cosmologist/SM
+cosmology/SM
+cosmonaut/SM
+cosmopolitan/MS
+cosmopolitanism/M
+cosmos/MS
+cosplay
+cosponsor/GSMD
+cosset/SGD
+cossetted
+cossetting
+cost/MDYGSJ
+costar/SM
+costarred
+costarring
+costliness/M
+costly/PTR
+costume/MZGDRS
+costumer/M
+costumier/S
+cot/SM
+cotangent/MS
+cote/MS
+coterie/MS
+coterminous
+cotillion/SM
+cottage/MZGRS
+cottager/M
+cottar/SM
+cotter/SM
+cotton/SGMD
+cottonmouth/M
+cottonmouths
+cottonseed/MS
+cottontail/MS
+cottonwood/SM
+cottony
+cotyledon/MS
+couch/MDSG
+couchette/S
+cougar/SM
+cough/MDG
+coughs
+could
+could've
+couldn't
+coulee/SM
+coulis
+coulomb/MS
+council/MS
+councilman/M
+councilmen
+councilor/MS
+councilperson/SM
+councilwoman/M
+councilwomen
+counsel/JMDGS
+counselor/MS
+count/EASMDG
+countable/U
+countably
+countdown/MS
+counted/U
+countenance's
+countenance/EGDS
+counter/EMS
+counteract/SGVD
+counteraction/MS
+counterargument/S
+counterattack/GMDS
+counterbalance/MGDS
+counterblast/S
+counterclaim/GSMD
+counterclockwise
+counterculture/SM
+countered
+counterespionage/M
+counterexample/S
+counterfactual
+counterfeit/ZGMDRS
+counterfeiter/M
+counterfoil/MS
+countering
+counterinsurgency/SM
+counterintelligence/M
+counterman/M
+countermand/GMDS
+countermeasure/SM
+countermelody/S
+countermen
+countermove/S
+counteroffensive/SM
+counteroffer/SM
+counterpane/SM
+counterpart/SM
+counterpetition
+counterpoint/MDGS
+counterpoise/MGDS
+counterproductive
+counterrevolution/SM
+counterrevolutionary/SM
+countersign/GSMD
+countersignature/MS
+countersink/GSM
+counterspy/SM
+counterstroke/SM
+countersunk
+countertenor/MS
+countervail/GSD
+counterweight/MS
+countess/MS
+countless
+countrified
+country/SM
+countryman/M
+countrymen
+countryside/MS
+countrywide
+countrywoman/M
+countrywomen
+county/SM
+countywide
+coup's
+coup/AS
+coupe/SM
+couple's
+couple/UCGSD
+couplet/MS
+coupling/SM
+coupon/SM
+courage/M
+courageous/YP
+courageousness/M
+courgette/S
+courier/MDSG
+course/EDGMS
+coursebook/S
+courser/MS
+coursework
+court/SMDYG
+courteous/EY
+courteousness/M
+courtesan/SM
+courtesy/ESM
+courthouse/MS
+courtier/SM
+courtliness/M
+courtly/PRT
+courtroom/MS
+courtship/MS
+courtyard/MS
+couscous/M
+cousin/SM
+couture/M
+couturier/MS
+covalent
+covariance
+covariant
+cove/MS
+coven/SM
+covenant/MDSG
+cover's
+cover/AEUGDS
+coverage/M
+coverall/MS
+covering's
+coverings
+coverlet/MS
+covert/SPMY
+covertness/M
+covet/SDG
+covetous/YP
+covetousness/M
+covey/SM
+cow/ZGSMDR
+coward/SMY
+cowardice/M
+cowardliness/M
+cowbell/MS
+cowbird/MS
+cowboy/SM
+cowcatcher/MS
+cower/DG
+cowgirl/MS
+cowhand/MS
+cowherd/MS
+cowhide/MS
+cowl/MGSJ
+cowlick/MS
+cowling/M
+cowman/M
+cowmen
+coworker/MS
+cowpat/S
+cowpoke/MS
+cowpox/M
+cowpuncher/SM
+cowrie/SM
+cowshed/S
+cowslip/SM
+cox/GDS
+coxcomb/MS
+coxswain/MS
+coy/TPRY
+coyness/M
+coyote/SM
+coypu/SM
+cozen/SDG
+cozenage/M
+cozily
+coziness/M
+cozy/RSMTP
+cpd
+cpl
+cps
+crab/MS
+crabbed
+crabber/SM
+crabbily
+crabbiness/M
+crabbing
+crabby/PRT
+crabgrass/M
+crablike
+crabwise
+crack/SMDRYZGJ
+crackdown/MS
+cracker/M
+crackerjack/MS
+crackhead/MS
+crackle/DSJMG
+crackling/M
+crackpot/MS
+crackup/SM
+cradle/DSMG
+craft/SMDG
+craftily
+craftiness/M
+craftsman/M
+craftsmanship/M
+craftsmen
+craftspeople
+craftswoman/M
+craftswomen
+crafty/RTP
+crag/MS
+cragginess/M
+craggy/RPT
+cram/S
+crammed
+crammer/S
+cramming
+cramp/SMDG
+cramping/M
+crampon/SM
+cranberry/SM
+crane/DSMG
+cranial
+cranium/SM
+crank/SMDG
+crankcase/SM
+crankily
+crankiness/M
+crankshaft/MS
+cranky/PRT
+cranny/DSM
+crap/MS
+crape/SM
+crapped
+crapper/S
+crappie/RSMT
+crapping
+crappy
+craps/M
+crapshooter/MS
+crash/MDSG
+crass/RYTP
+crassness/M
+crate/DRSMZG
+crater/MDG
+cravat/SM
+crave/DSGJ
+craven/SMYP
+cravenness/M
+craving/M
+craw/MS
+crawdad/SM
+crawl/SMDRZG
+crawler/M
+crawlspace/SM
+crawly/TRSM
+cray/S
+crayfish/MS
+crayola/S
+crayon/GSMD
+craze/DSMG
+crazily
+craziness/M
+crazy/PRSMT
+creak/SMDG
+creakily
+creakiness/M
+creaky/RPT
+cream/SMDRZG
+creamer/M
+creamery/SM
+creamily
+creaminess/M
+creamy/RPT
+crease/ICGMSD
+create/KADSGNV
+creation's/K
+creation/ASM
+creationism/SM
+creationist/SM
+creative/SMYP
+creativeness/M
+creativity/M
+creator/MS
+creature/SM
+creche/SM
+cred
+credence/M
+credential/SGMD
+credenza/SM
+credibility/IM
+credible/I
+credibly/I
+credit/EGSBMD
+creditably/E
+creditor/SM
+creditworthy/P
+credo/SM
+credulity/IM
+credulous/IY
+credulousness/M
+creed/SM
+creek/SM
+creel/SM
+creep/SMRZG
+creeper/M
+creepily
+creepiness/M
+creepy/TPR
+cremains/M
+cremate/GNDSX
+cremation/M
+crematoria
+crematorium/MS
+crematory/SM
+creme/SM
+crenelate/XGNDS
+crenelation/M
+creole/SM
+creosote/MGDS
+crepe/SM
+crept
+crepuscular
+crescendo/CSM
+crescent/MS
+cress/M
+crest/SMDG
+crestfallen
+crestless
+cretaceous
+cretin/SM
+cretinism/M
+cretinous
+cretonne/M
+crevasse/SM
+crevice/MS
+crew/MDGS
+crewel/M
+crewelwork/M
+crewman/M
+crewmen
+crib/MS
+cribbage/M
+cribbed
+cribber/MS
+cribbing
+crick/SMDG
+cricket/MRSZG
+cricketer/M
+crier/M
+crikey
+crime/SM
+criminal/MYS
+criminality/M
+criminalize/CGDS
+criminologist/MS
+criminology/M
+crimp/SMDG
+crimson/SMDG
+cringe/DSMG
+crinkle/DSMG
+crinkly/RT
+crinoline/SM
+cripes
+cripple/DRSMZG
+crippler/M
+crippleware
+crippling/Y
+crises
+crisis/M
+crisp/SMDRYTGP
+crispbread/S
+crispiness/M
+crispness/M
+crispy/PRT
+crisscross/GMDS
+criteria
+criterion/M
+critic/SM
+critical/UY
+criticality
+criticism/MS
+criticize/ZGDRS
+criticizer/M
+critique/MGDS
+critter/SM
+croak/SMDG
+croaky/RT
+crochet/SMDRZG
+crocheter/M
+crocheting/M
+crock/SMD
+crockery/M
+crocodile/SM
+crocus/MS
+croft/SRZG
+croissant/MS
+crone/SM
+crony/SM
+cronyism/M
+crook/SMDG
+crooked/PTRY
+crookedness/M
+crookneck/SM
+croon/SMDRZG
+crooner/M
+crop/MS
+cropland/SM
+cropped
+cropper/MS
+cropping
+croquet/M
+croquette/SM
+crosier/MS
+cross's
+cross/AUGTSD
+crossbar/SM
+crossbeam/MS
+crossbones/M
+crossbow/SM
+crossbowman/M
+crossbowmen
+crossbred
+crossbreed/SGM
+crosscheck/SMDG
+crosscurrent/MS
+crosscut/SM
+crosscutting
+crosser
+crossfire/MS
+crosshatch/GDS
+crossing/SM
+crossly
+crossness/M
+crossover/MS
+crosspatch/MS
+crosspiece/SM
+crossroad/MS
+crossroads/M
+crosstown
+crosswalk/MS
+crosswind/MS
+crosswise
+crossword/MS
+crotch/MS
+crotchet/SM
+crotchety
+crouch/GMDS
+croup/M
+croupier/M
+croupy/ZTR
+crouton/MS
+crow/MDGS
+crowbar/MS
+crowd/SMDG
+crowded/U
+crowdfund/SDG
+crowfeet
+crowfoot/SM
+crown/SMDG
+crowned/U
+crucial/Y
+crucible/SM
+crucifix/MS
+crucifixion/SM
+cruciform/SM
+crucify/DSG
+crud/M
+cruddy/TR
+crude/RMYTP
+crudeness/M
+crudites/M
+crudity/SM
+cruel/RYPT
+cruelness/M
+cruelty/SM
+cruet/SM
+cruft/SD
+crufty
+cruise/DRSMZG
+cruiser/M
+cruller/MS
+crumb/SMDYG
+crumble/MGDS
+crumbliness/M
+crumbly/TPR
+crumby/TR
+crumminess/M
+crummy/PTR
+crumpet/MS
+crumple/MGDS
+crunch/GMDRS
+crunchiness/M
+crunchy/TRP
+crupper/MS
+crusade/MZGDRS
+crusader/M
+cruse/SM
+crush/MDRSZG
+crusher/M
+crushing/Y
+crust/SMDG
+crustacean/SM
+crustal
+crustily
+crustiness/M
+crusty/TRP
+crutch/MS
+crux/MS
+cry/ZGJDRSM
+crybaby/SM
+cryogenic/S
+cryogenics/M
+cryonics
+cryosurgery/M
+crypt/SM
+cryptanalysis
+cryptic
+cryptically
+cryptocurrency/SM
+cryptogram/SM
+cryptographer/SM
+cryptography/M
+crystal/SM
+crystalline
+crystallization/M
+crystallize/ADSG
+crystallographic
+crystallography
+ct
+ctn
+ctr
+cu
+cub/ZGSMDR
+cubbyhole/MS
+cube/MS
+cuber/M
+cubic
+cubical
+cubicle/MS
+cubism/M
+cubist/SM
+cubit/SM
+cuboid/S
+cuckold/MDSG
+cuckoldry/M
+cuckoo/SM
+cucumber/SM
+cud/SM
+cuddle/DSMG
+cuddly/TR
+cudgel/SGMDJ
+cue/DSMG
+cuff/MDGS
+cuisine/SM
+culinary
+cull/MDGS
+culminate/XDSGN
+culmination/M
+culotte/SM
+culpability/M
+culpable/I
+culpably
+culprit/SM
+cult/MS
+cultism/M
+cultist/MS
+cultivable
+cultivar/SM
+cultivate/BDSGN
+cultivated/U
+cultivation/M
+cultivator/MS
+cultural/Y
+culture/MGDS
+cultured/U
+culvert/MS
+cum/SM
+cumber/SDG
+cumbersome/P
+cumbersomeness/M
+cumbrous
+cumin/M
+cummerbund/MS
+cumming
+cumulative/Y
+cumuli
+cumulonimbi
+cumulonimbus/M
+cumulus/M
+cuneiform/M
+cunnilingus/M
+cunning/MRYT
+cunt/MS!
+cup/SM
+cupboard/SM
+cupcake/MS
+cupful/SM
+cupid/SM
+cupidity/M
+cupola/SMD
+cuppa/S
+cupped
+cupping
+cupric
+cur/SMY
+curability/M
+curacao
+curacy/SM
+curare/M
+curate/DSMGV
+curative/MS
+curator/KMS
+curatorial
+curb/MDGS
+curbing/M
+curbside
+curbstone/SM
+curd/MS
+curdle/DSG
+cure's
+cure/KZGBDRS
+cured/U
+curer/KM
+curettage/M
+curfew/SM
+curia/M
+curiae
+curie/SM
+curio/SM
+curiosity/SM
+curious/YP
+curiousness/M
+curium/M
+curl's
+curl/UDGS
+curler/SM
+curlew/SM
+curlicue/DSMG
+curliness/M
+curling/M
+curly/RPT
+curmudgeon/MYS
+currant/MS
+currency/SM
+current's
+current/FAY
+currents
+curricula
+curricular
+curriculum/M
+curry/DSMG
+currycomb/SGMD
+curse/DSMGV
+cursed/Y
+cursive's
+cursive/EAY
+cursor/SM
+cursorily
+cursoriness/M
+cursory/P
+curt/RYTP
+curtail/GDSL
+curtailment/SM
+curtain/GMDS
+curtness/M
+curtsy/GDSM
+curvaceous/P
+curvaceousness/M
+curvature/SM
+curve/DSMG
+curvy/RT
+cushion/MDSG
+cushy/RT
+cusp/MS
+cuspid/SM
+cuspidor/SM
+cuss's
+cuss/FEGSD
+cussed/PY
+custard/MS
+custodial
+custodian/MS
+custodianship/M
+custody/M
+custom/SZMR
+customarily
+customary/U
+customer/M
+customhouse/SM
+customization/M
+customize/DSG
+cut/TSMR
+cutaneous
+cutaway/MS
+cutback/MS
+cute/YP
+cuteness/M
+cutesy/TR
+cutey/S
+cuticle/MS
+cutie/SM
+cutlass/MS
+cutler/SM
+cutlery/M
+cutlet/SM
+cutoff/SM
+cutout/SM
+cutter/SM
+cutthroat/SM
+cutting/MYS
+cuttlefish/MS
+cutup/SM
+cutworm/MS
+cw
+cwt
+cyan/M
+cyanide/M
+cyanobacteria
+cyberbully/SM
+cybercafe/S
+cybernetic/S
+cybernetics/M
+cyberpunk/SM
+cybersex
+cyberspace/MS
+cyborg/SM
+cyclamen/MS
+cycle/ADSMG
+cyclic
+cyclical/Y
+cyclist/MS
+cyclometer/MS
+cyclone/MS
+cyclonic
+cyclopedia/MS
+cyclopes
+cyclops/M
+cyclotron/MS
+cygnet/MS
+cylinder/MS
+cylindrical
+cymbal/MS
+cymbalist/MS
+cynic/SM
+cynical/Y
+cynicism/M
+cynosure/MS
+cypress/MS
+cyst/MS
+cystic
+cystitis
+cytokines
+cytologist/SM
+cytology/M
+cytoplasm/M
+cytoplasmic
+cytosine/M
+czar/MS
+czarina/SM
+czarism
+czarist/SM
+d'Arezzo/M
+d'Estaing/M
+d/NXGJ
+dB
+dab/SM
+dabbed
+dabber/MS
+dabbing
+dabble/ZGDRS
+dabbler/M
+dace/SM
+dacha/MS
+dachshund/MS
+dactyl/MS
+dactylic/MS
+dad/SM
+dadaism/M
+dadaist/MS
+daddy/SM
+dado/M
+dadoes
+daemon/MS
+daemonic
+daffiness/M
+daffodil/SM
+daffy/PTR
+daft/PTRY
+daftness/M
+dag/S
+dagger/MS
+dago/S
+dagoes
+daguerreotype/DSMG
+dahlia/MS
+dailiness/M
+daily/PSM
+daintily
+daintiness/M
+dainty/RSMTP
+daiquiri/MS
+dairy/GSM
+dairying/M
+dairymaid/MS
+dairyman/M
+dairymen
+dairywoman/M
+dairywomen
+dais/MS
+daisy/SM
+dale/SM
+dalliance/MS
+dallier/M
+dally/ZGDRS
+dalmatian/MS
+dam/SM
+damage/MGDS
+damageable
+damaged/U
+damages/M
+damask/MDGS
+dame/SM
+dammed
+damming
+dammit
+damn/SBGMD
+damnably
+damnation/M
+damned/T
+damp/SPXZTGMDNRY
+dampen/ZGDR
+dampener/M
+damper/M
+dampness/M
+damsel/MS
+damselfly/SM
+damson/MS
+dance/MZGDRS
+dancer/M
+dancing/M
+dandelion/SM
+dander/M
+dandify/GDS
+dandle/GDS
+dandruff/M
+dandy/TRSM
+dang/SZGDR
+danger/M
+dangerous/Y
+dangle/ZGDRS
+dangler/M
+danish/MS
+dank/PTRY
+dankness/M
+danseuse/MS
+dapper/TR
+dapple/MGDS
+dare/DRSMZG
+daredevil/MS
+daredevilry/M
+darer/M
+daresay
+daring/MY
+dark/PXTMNRY
+darken/ZGDR
+darkener/M
+darkie/S
+darkness/M
+darkroom/MS
+darling/MS
+darn/SZGMDR
+darned/TR
+darner/M
+dart/SZGMDR
+dartboard/MS
+darter/M
+dash/ZGMDRS
+dashboard/SM
+dasher/M
+dashiki/MS
+dashing/Y
+dastard/MYS
+dastardliness/M
+data
+database/SM
+dataset/MS
+datatype
+date/DRSMZGV
+datebook/S
+dated/U
+dateless
+dateline/MGDS
+dater/M
+dateset
+dative/MS
+datum/M
+daub/SZGMDR
+dauber/M
+daughter/SMY
+daunt/GDS
+daunting/Y
+dauntless/YP
+dauntlessness/M
+dauphin/MS
+davenport/MS
+davit/MS
+dawdle/ZGDRS
+dawdler/M
+dawn/SGMD
+day/SM
+daybed/MS
+daybreak/M
+daycare/M
+daydream/MDRZGS
+daydreamer/M
+daylight/MS
+daylights/M
+daylong
+daytime/M
+daze/DSMG
+dazed/Y
+dazzle/MZGDRS
+dazzler/M
+dazzling/Y
+db
+dbl
+dc
+dd/SDG
+dded/K
+dding/K
+deacon/MS
+deaconess/MS
+dead/XTMNRY
+deadbeat/MS
+deadbolt/SM
+deaden/GD
+deadhead/SDG
+deadline/SM
+deadliness/M
+deadlock/GSMD
+deadly/TPR
+deadpan/MS
+deadpanned
+deadpanning
+deadwood/M
+deaf/PXTNR
+deafen/GD
+deafening/Y
+deafness/M
+deal/SJZGMR
+dealer/M
+dealership/SM
+dealing/M
+dealt
+dean/M
+deanery/SM
+deanship/M
+dear/SPTMRYH
+dearest/S
+dearness/M
+dearth/M
+dearths
+deary/SM
+death/MY
+deathbed/SM
+deathblow/MS
+deathless/Y
+deathlike
+deaths
+deathtrap/MS
+deathwatch/MS
+deaves
+deb/SM
+debacle/MS
+debarkation/M
+debarment/M
+debate/BMZR
+debater/M
+debating/M
+debauch/MDSG
+debauchee/MS
+debauchery/SM
+debenture/MS
+debilitate/DSGN
+debilitation/M
+debility/SM
+debit/D
+debonair/PY
+debonairness/M
+debouch/GDS
+debridement
+debris/M
+debt/SM
+debtor/MS
+debugger/S
+debut/GMD
+debutante/SM
+decade/MS
+decadence/M
+decadency/M
+decadent/MYS
+decaf/MS
+decaffeinate/DSG
+decagon/MS
+decal/MS
+decampment/M
+decapitate/XGNDS
+decapitator/MS
+decathlete/S
+decathlon/SM
+decay/GD
+deceased/M
+decedent/MS
+deceit/MS
+deceitful/YP
+deceitfulness/M
+deceive/UGDS
+deceiver/MS
+deceiving/Y
+decelerate/GNDS
+deceleration/M
+decelerator/SM
+decency/ISM
+decennial/SM
+decent/IY
+deception/MS
+deceptive/YP
+deceptiveness/M
+decibel/MS
+decidable/U
+decide/BZGDRS
+decided/Y
+deciduous
+deciliter/MS
+decimal/SM
+decimalization
+decimate/DSGN
+decimation/M
+decimeter/MS
+decipherable/UI
+decision/IM
+decisions
+decisive/IPY
+decisiveness/IM
+deck/SGMD
+deckchair/S
+deckhand/SM
+deckle/S
+declamation/MS
+declamatory
+declaration/MS
+declarative
+declaratory
+declare/DRSZGB
+declared/U
+declarer/M
+declension/SM
+declination/M
+decline/DRSMZG
+decliner/M
+declivity/SM
+decoherence
+decolletage/SM
+decollete
+decongestant/MS
+deconstructionism
+decor/MS
+decorate/AGNVDS
+decorating/M
+decoration/AM
+decorations
+decorative/Y
+decorator/MS
+decorous/IY
+decorousness/M
+decorum/M
+decoupage/DSMG
+decoy/GMDS
+decreasing/Y
+decree/MDS
+decreeing
+decrement/GDS
+decrepit
+decrepitude/M
+decriminalization/M
+decry/GDS
+decryption
+dedicate/AGDS
+dedication/SM
+dedicator/SM
+dedicatory
+deduce/GDS
+deducible
+deduct/GVD
+deductible/SM
+deduction/SM
+deductive/Y
+deed/GD
+deejay/MS
+deem/ASGD
+deep/SPXTMNRY
+deepen/GD
+deepfake/SM
+deepness/M
+deer/M
+deerskin/M
+deerstalker/S
+def/Z
+defacement/M
+defacer/SM
+defalcate/DSXGN
+defalcation/M
+defamation/M
+defamatory
+defame/ZGDRS
+defamer/M
+defaulter/SM
+defeat/MDRZGS
+defeated/U
+defeater/M
+defeatism/M
+defeatist/MS
+defecate/GNDS
+defecation/M
+defect/MDGVS
+defection/MS
+defective/MPYS
+defectiveness/M
+defector/MS
+defendant/SM
+defended/U
+defenestration/S
+defense/DSMGV
+defenseless/YP
+defenselessness/M
+defensible/I
+defensibly/I
+defensive/MYP
+defensiveness/M
+deference/M
+deferential/Y
+deferral/MS
+deferred
+deferring
+deffer
+deffest
+defiant/Y
+defibrillation
+defibrillator/S
+deficiency/SM
+deficient
+deficit/SM
+defilement/M
+definable/IU
+define/AGDS
+defined/U
+definer/MS
+definite/IYVP
+definiteness/IM
+definition/AM
+definitions
+definitive/Y
+deflate/GNDS
+deflation/M
+deflationary
+deflect/DGVS
+deflection/MS
+deflector/SM
+defogger/SM
+defoliant/SM
+defoliate/DSGN
+defoliation/M
+defoliator/MS
+deformity/SM
+defraud/DRZGS
+defrauder/M
+defrayal/M
+defrock/DG
+defroster/MS
+deft/PTRY
+deftness/M
+defunct
+defy/GDS
+deg
+degeneracy/M
+degenerate/MV
+degrade/B
+degree/MS
+dehydrator/SM
+dehydrogenase
+deicer/MS
+deification/M
+deify/NGDS
+deign/GDS
+deist/MS
+deistic
+deity/SM
+deject/GDS
+dejected/Y
+dejection/M
+delay/ZDR
+delectable
+delectably
+delectation/M
+delegate/GD
+delete/XGNDS
+deleterious
+deletion/M
+delft/M
+delftware/M
+deli/SM
+deliberate/XYVP
+deliberateness/M
+delicacy/ISM
+delicate/IY
+delicateness/M
+delicatessen/SM
+delicious/PY
+deliciousness/M
+delighted/Y
+delightful/Y
+deliminator
+delineate/GNXDS
+delineation/M
+delinquency/SM
+delinquent/SMY
+deliquesce/DSG
+deliquescent
+delirious/YP
+deliriousness/M
+delirium/SM
+deliver/ADGS
+deliverable/S
+deliverance/M
+delivered/U
+deliverer/SM
+dell/SM
+delphinium/MS
+delta/MS
+delude/GDS
+deluge/MGDS
+delusion/MS
+delusional
+delusive/Y
+deluxe
+delve/ZGDRS
+delver/M
+demagogic
+demagogically
+demagogue/SM
+demagoguery/M
+demagogy/M
+demand/GMDS
+demanding/U
+demarcate/DSGNX
+demarcation/M
+demean/GDS
+demeanor/M
+demented/Y
+dementia/M
+demesne/MS
+demigod/MS
+demigoddess/MS
+demijohn/SM
+demimondaine/SM
+demimonde/M
+demise/MGDS
+demitasse/MS
+demo/GMD
+democracy/SM
+democrat/MS
+democratic/U
+democratically
+democratization/M
+democratize/GDS
+demode
+demographer/SM
+demographic/SM
+demographically
+demographics/M
+demography/M
+demolish/DSG
+demolition/MS
+demon/MS
+demonetization/M
+demoniac
+demoniacal/Y
+demonic
+demonically
+demonize/GDS
+demonology/SM
+demonstrability
+demonstrable/I
+demonstrably
+demonstrate/XGNVDS
+demonstration/M
+demonstrative/MYSP
+demonstrativeness/M
+demonstrator/MS
+demote/GD
+demotic
+demount
+demulcent/SM
+demur/TMRS
+demure/PY
+demureness/M
+demurral/SM
+demurred
+demurrer/SM
+demurring
+den/M
+denationalization
+denaturation
+denature/DG
+dendrite/SM
+dengue/M
+deniability
+deniable/U
+denial/MS
+denier/M
+denigrate/DSGN
+denigration/M
+denim/MS
+denitrification
+denizen/MS
+denominational
+denotative
+denouement/MS
+denounce/LDSG
+denouncement/SM
+dense/PYTR
+denseness/M
+density/SM
+dent/ISGMD
+dental/Y
+dentifrice/SM
+dentin/M
+dentist/MS
+dentistry/M
+dentition/M
+denture/IMS
+denuclearize/GDS
+denudation/M
+denude/GDS
+denunciation/SM
+deny/ZGDRS
+deodorant/SM
+deodorization/M
+deodorize/DRSZG
+deodorizer/M
+departed/M
+department/MS
+departmental/Y
+departmentalization/M
+departmentalize/GDS
+departure/SM
+dependability/M
+dependable/U
+dependably
+dependence/IM
+dependency/SM
+dependent/IMYS
+depict/GDS
+depiction/MS
+depilatory/SM
+deplete/GNDS
+depletion/M
+deplorably
+deplore/BGDS
+deploy/ALGDS
+deployment/AM
+deployments
+deponent/MS
+deportation/MS
+deportee/MS
+deportment/M
+deposit/AGMDS
+depositor/MS
+depository/SM
+deprave/GDS
+depravity/SM
+deprecate/GNDS
+deprecating/Y
+deprecation/M
+deprecatory
+depreciate/DSGN
+depreciation/M
+depredation/SM
+depressant/SM
+depressing/Y
+depression/SM
+depressive/SM
+depressor/MS
+depressurization
+deprive/GDS
+deprogramming
+depth/M
+depths
+deputation/MS
+depute/DSG
+deputize/DSG
+deputy/SM
+derailleur/SM
+derailment/SM
+derangement/M
+derby/SM
+derelict/MS
+dereliction/M
+deride/GDS
+derision/M
+derisive/PY
+derisiveness/M
+derisory
+derivation/MS
+derivative/MS
+derive/B
+dermal
+dermatitis/M
+dermatological
+dermatologist/SM
+dermatology/M
+dermis/M
+derogate/DSGN
+derogation/M
+derogatorily
+derogatory
+derrick/SM
+derriere/SM
+derringer/SM
+derv
+dervish/MS
+desalinate/GNDS
+desalination/M
+desalinization/M
+desalinize/GDS
+descant/M
+descend/FGDS
+descendant/MS
+descender
+describable/I
+describe/BZGDR
+describer/M
+description/SM
+descriptive/PY
+descriptiveness/M
+descriptor/S
+descry/GDS
+desecrate/DSGN
+desecration/M
+deselection
+desert/SDRZGM
+deserter/M
+desertification
+desertion/SM
+deserved/UY
+deserving/U
+desiccant/SM
+desiccate/DSGN
+desiccation/M
+desiccator/SM
+desiderata
+desideratum/M
+design/ASDG
+designate/DSGNX
+designation/M
+desirability/UM
+desirableness/M
+desirably/U
+desire/B
+desired/U
+desirous
+desist/SDG
+desk/SM
+deskill/G
+desktop/SM
+desolate/PDSYGN
+desolateness/M
+desolation/M
+despair/SMDG
+despairing/Y
+desperado/M
+desperadoes
+desperate/YNP
+desperateness/M
+desperation/M
+despicable
+despicably
+despise/DSG
+despite
+despoilment/M
+despondence/M
+despondency/M
+despondent/Y
+despotic
+despotically
+despotism/M
+dessert/SM
+dessertspoon/S
+dessertspoonful/S
+destination/SM
+destine/DSG
+destiny/SM
+destitute/N
+destitution/M
+destroy/SZGDR
+destroyer/M
+destruct/GVMDS
+destructibility/IM
+destructible/I
+destruction/M
+destructive/PY
+destructiveness/M
+desuetude/M
+desultorily
+desultory
+detach/BLGDS
+detachment/MS
+detain/LGDS
+detainee/MS
+detainment/M
+detect/SDGVB
+detectable/U
+detected/U
+detection/M
+detective/SM
+detector/SM
+detente/SMNX
+detention/M
+deter/SL
+detergent/SM
+deteriorate/DSGN
+deterioration/M
+determent/M
+determinable/I
+determinant/SM
+determinate
+determine/AGDS
+determined/U
+determinedly
+determiner/SM
+determinism/M
+deterministic
+deterministically
+deterred/U
+deterrence/M
+deterrent/MS
+deterring
+detestably
+detestation/M
+dethrone/DSLG
+dethronement/M
+detonate/GNDSX
+detonation/M
+detonator/SM
+detox/MDSG
+detoxification/M
+detoxify/DSGN
+detract/GD
+detriment/SM
+detrimental/Y
+detritus/M
+deuce/SM
+deuterium/M
+devastate/GNDS
+devastating/Y
+devastation/M
+devastator/MS
+develop/ASGDL
+developed/U
+developer/SM
+development/ASM
+developmental/Y
+deviance/M
+deviancy/M
+deviant/SM
+deviate/DSMGNX
+deviating/U
+deviation/M
+devil/SMDGL
+devilish/YP
+devilishness/M
+devilment/M
+devilry/SM
+deviltry/SM
+devious/YP
+deviousness/M
+devoid
+devolution/M
+devolve/DSG
+devoted/Y
+devotee/SM
+devotion/MS
+devotional/SM
+devour/SDG
+devout/PRYT
+devoutness/M
+dew/M
+dewberry/SM
+dewclaw/SM
+dewdrop/SM
+dewiness/M
+dewlap/SM
+dewy/RTP
+dexterity/M
+dexterous/YP
+dexterousness/M
+dextrose/M
+dharma
+dhoti/SM
+dhow/MS
+diabetes/M
+diabetic/SM
+diabolic
+diabolical/Y
+diacritic/MS
+diacritical
+diadem/SM
+diaereses
+diaeresis/M
+diagnose/DSG
+diagnosis/M
+diagnostic/S
+diagnostically
+diagnostician/SM
+diagnostics/M
+diagonal/SMY
+diagram/SM
+diagrammatic
+diagrammatically
+diagrammed
+diagramming
+dial/AMDGS
+dialect/SM
+dialectal
+dialectic/SM
+dialectical
+dialectics/M
+dialing/S
+dialog
+dialogue/SM
+dialyses
+dialysis/M
+dialyzes
+diam
+diamagnetic
+diamagnetism
+diamante
+diameter/SM
+diametric
+diametrical/Y
+diamond/SM
+diamondback/MS
+diapason/SM
+diaper/SMDG
+diaphanous
+diaphragm/SM
+diaphragmatic
+diarist/SM
+diarrhea/M
+diary/SM
+diaspora/SM
+diastase/M
+diastole/M
+diastolic
+diathermy/M
+diatom/SM
+diatomic
+diatonic
+diatribe/SM
+diazepam
+dibble/DSMG
+dibs/M
+dice/GDS
+dices/I
+dicey
+dichotomous
+dichotomy/SM
+dicier
+diciest
+dick/MRXZS
+dicker/DG
+dickey/SM
+dickhead/S
+dickybird/S
+dicotyledon/MS
+dicotyledonous
+dict
+dicta
+dictate/DSMGNX
+dictation/M
+dictator/SM
+dictatorial/Y
+dictatorship/SM
+diction/M
+dictionary/SM
+dictum/M
+did/AU
+didactic
+didactically
+diddle/DRSZG
+diddler/M
+diddly
+diddlysquat
+diddums
+didgeridoo/S
+didn't
+dido/M
+didoes
+didst
+die/DSM
+dielectric/MS
+diereses
+dieresis/M
+diesel/SMDG
+diet/MDRZGS
+dietary/SM
+dieter/M
+dietetic/S
+dietetics/M
+dietitian/MS
+diff/DRZGS
+differ/DG
+difference/IM
+differences
+different/IY
+differentiable
+differential/SM
+differentiate/DSGN
+differentiated/U
+differentiation/M
+difficult/Y
+difficulty/SM
+diffidence/M
+diffident/Y
+diffract/GSD
+diffraction/M
+diffuse/DSYGNVP
+diffuseness/M
+diffusion/M
+diffusivity
+dig/SM
+digerati/M
+digest/SMDGV
+digested/U
+digestibility/M
+digestible/I
+digestion/IM
+digestions
+digestive/S
+digger/SM
+digging/S
+diggings/M
+digicam/S
+digit/SM
+digital/Y
+digitalis/M
+digitization
+digitize/GDS
+dignified/U
+dignify/DSG
+dignitary/SM
+dignity/ISM
+digraph/M
+digraphs
+digress/GVDS
+digression/MS
+dike/MGDS
+diktat/S
+dilapidated
+dilapidation/M
+dilatation/M
+dilate/DSGN
+dilation/M
+dilator/SM
+dilatory
+dildo/S
+dilemma/MS
+dilettante/SM
+dilettantish
+dilettantism/M
+diligence/M
+diligent/Y
+dill/MS
+dilly/SM
+dillydally/DSG
+diluent
+dilute/DSGNX
+diluted/U
+dilution/M
+dim/PSRY
+dime/MS
+dimension/SM
+dimensional
+dimensionless
+diminish/GDS
+diminished/U
+diminuendo/SM
+diminution/SM
+diminutive/SM
+dimity/M
+dimmed/U
+dimmer/SM
+dimmest
+dimming
+dimness/M
+dimple/DSMG
+dimply
+dimwit/SM
+dimwitted
+din/ZGSMDR
+dinar/SM
+dine/S
+diner/M
+dinette/MS
+ding/MDG
+dingbat/MS
+dinghy/SM
+dingily
+dinginess/M
+dingle/SM
+dingo/M
+dingoes
+dingus/MS
+dingy/RPT
+dink/R
+dinky/RSMT
+dinned
+dinner/SMDG
+dinnertime/M
+dinnerware/M
+dinning
+dinosaur/SM
+dint/M
+diocesan/MS
+diocese/MS
+diode/SM
+diorama/SM
+dioxide/SM
+dioxin/SM
+dip/SM
+diphtheria/M
+diphthong/SM
+diploid/SM
+diploma/SM
+diplomacy/M
+diplomat/MS
+diplomata
+diplomatic/U
+diplomatically
+diplomatist/MS
+diplopia
+dipole/SM
+dipped
+dipper/SM
+dipping
+dippy/RT
+dipso/S
+dipsomania/M
+dipsomaniac/MS
+dipstick/SM
+dipterous
+diptych/M
+diptychs
+dire/YTR
+direct/ASDGVT
+directer
+direction/IM
+directional
+directionless
+directions
+directive/SM
+directly
+directness/IM
+director/MS
+directorate/SM
+directorial
+directorship/SM
+directory/SM
+direful
+dirge/SM
+dirigible/MS
+dirk/MS
+dirndl/SM
+dirt/M
+dirtball/S
+dirtily
+dirtiness/M
+dirty/DRSTGP
+dis/M
+disable/DSGL
+disablement/M
+disambiguate/N
+disappointing/Y
+disarming/Y
+disassembly
+disastrous/Y
+disbandment/M
+disbarment/M
+disbelieving/Y
+disbursal/M
+disburse/DSGL
+disbursement/MS
+disc/M
+discern/LSDG
+discernible/I
+discernibly
+discerning/Y
+discernment/M
+discharged/U
+disciple/SM
+discipleship/M
+disciplinarian/SM
+disciplinary
+discipline/DSMG
+disciplined/U
+disclose/DSG
+disclosed/U
+disco/MG
+discography/SM
+discoloration/S
+discombobulate/DSGN
+discombobulation/M
+discomfit/DG
+discomfiture/M
+discommode/DG
+disconcerting/Y
+disconnected/PY
+disconnectedness/M
+disconsolate/Y
+discordance/M
+discordant/Y
+discotheque/SM
+discourage/LGDS
+discouragement/SM
+discouraging/Y
+discover/ASDG
+discovered/U
+discoverer/MS
+discovery/ASM
+discreet/PRYT
+discreetness/M
+discrepancy/SM
+discrepant
+discrete/PYN
+discreteness/M
+discretion/IM
+discretionary
+discriminant
+discriminate/GNDS
+discriminating/U
+discrimination/M
+discriminator/MS
+discriminatory
+discursiveness/M
+discus/MS
+discussant/SM
+discussion/SM
+disdain/SMDG
+disdainful/Y
+disembowel/SDLG
+disembowelment/M
+disfigurement/SM
+disfranchisement/M
+disgorgement/M
+disgruntle/LGDS
+disgruntlement/M
+disguise/GD
+disguised/U
+disgusted/Y
+disgusting/Y
+dish/MDSG
+dishabille/M
+disharmonious
+dishcloth/M
+dishcloths
+disheartening/Y
+dishevel/DGLS
+dishevelment/M
+dishpan/SM
+dishrag/SM
+dishtowel/MS
+dishware/M
+dishwasher/MS
+dishwater/M
+dishy
+disillusion/GLD
+disillusionment/M
+disinfectant/MS
+disinfection/M
+disinterested/PY
+disinterestedness/M
+disjointed/YP
+disjointedness/M
+disjunctive
+disjuncture
+disk/MS
+diskette/MS
+dislodge/GDS
+dismal/Y
+dismantlement/M
+dismay/SMDG
+dismayed/U
+dismember/LGD
+dismemberment/M
+dismissive/Y
+disorder/Y
+disorganization/M
+disparage/DSGL
+disparagement/M
+disparaging/Y
+disparate/Y
+dispatcher/MS
+dispel/S
+dispelled
+dispelling
+dispensary/SM
+dispensation/MS
+dispense/BZGDRS
+dispenser/M
+dispersal/M
+disperse/GNDS
+dispersion/M
+dispirit/GDS
+displeasure/M
+disposable/SM
+disposal/SM
+disposed/I
+disposition/ISM
+dispossession/M
+disproof/SM
+disproportional
+disprove/B
+disputable/I
+disputably/I
+disputant/MS
+disputation/SM
+disputatious/Y
+dispute/DRSMZGB
+disputed/U
+disputer/M
+disquiet/GSMD
+disquisition/MS
+disregardful
+disrepair/M
+disrepute/MB
+disrupt/GVSD
+disruption/SM
+disruptive/Y
+dissect/SDG
+dissed
+dissemblance/M
+dissemble/ZGDRS
+dissembler/M
+disseminate/GNDS
+dissemination/M
+dissension/SM
+dissent/SMDRZG
+dissenter/M
+dissertation/SM
+disses
+dissidence/M
+dissident/MS
+dissimilar
+dissimilitude/S
+dissing
+dissipate/GNDS
+dissipation/M
+dissociate/GNVDS
+dissociation/M
+dissoluble/I
+dissolute/YNP
+dissoluteness/M
+dissolve/AGDS
+dissolved/U
+dissonance/SM
+dissonant
+dissuade/GDS
+dissuasive
+dist
+distaff/SM
+distal/Y
+distance/DSMG
+distant/Y
+distaste/SM
+distemper/M
+distention/SM
+distillate/SMNX
+distillation/M
+distillery/SM
+distinct/IYTVP
+distincter
+distinction/SM
+distinctive/YP
+distinctiveness/M
+distinctness/IM
+distinguish/GDSB
+distinguishable/I
+distinguished/U
+distort/GDR
+distortion/MS
+distract/DG
+distracted/Y
+distraction/S
+distrait
+distraught
+distress/DG
+distressful
+distressing/Y
+distribute/AGNVDS
+distributed/U
+distribution/AM
+distributional
+distributions
+distributive/Y
+distributor's
+distributor/AS
+distributorship/S
+district's
+district/AS
+disturb/ZGSDR
+disturbance/SM
+disturbed/U
+disturber/M
+disturbing/Y
+disunion/M
+disyllabic
+ditch/MDSG
+dither/SMDRZG
+ditherer/M
+ditransitive
+ditsy
+ditto/SMDG
+ditty/SM
+ditz/MS
+diuretic/MS
+diurnal/Y
+div
+diva/MS
+divalent
+divan/SM
+dive/MZTGDRS
+diver/M
+diverge/DSG
+divergence/MS
+divergent
+diverse/XYNP
+diverseness/M
+diversification/M
+diversify/GNDS
+diversion/M
+diversionary
+diversity/SM
+divert/SDG
+diverticulitis/M
+divest/SLDG
+divestiture/MS
+divestment/M
+divide/DRSMZGB
+divided/U
+dividend/MS
+divider/M
+divination/M
+divine/DRSMYZTG
+diviner/M
+diving/M
+divinity/SM
+divisibility/IM
+divisible/I
+division/MS
+divisional
+divisive/PY
+divisiveness/M
+divisor/SM
+divorce/DSLMG
+divorcee/MS
+divorcement/MS
+divot/SM
+divulge/GDS
+divvy/DSMG
+dixieland/M
+dizzily
+dizziness/M
+dizzy/DRSPTG
+djellaba/MS
+do/SJMRHZG
+doable
+dob/S
+dobbed
+dobbin/SM
+dobbing
+doberman/MS
+dobro
+doc/SM
+docent/SM
+docile/Y
+docility/M
+dock/MDRZGS
+docket/SMDG
+dockland/S
+dockside
+dockworker/MS
+dockyard/MS
+doctor/SMDG
+doctoral
+doctorate/MS
+doctrinaire/MS
+doctrinal
+doctrine/MS
+docudrama/SM
+document/GMDS
+documentary/SM
+documentation/SM
+documented/U
+dodder/SMDG
+doddery
+doddle
+dodge/DRSMZG
+dodgem/S
+dodger/M
+dodgy/RT
+dodo/MS
+doe/SM
+doer/M
+does/AU
+doeskin/MS
+doesn't
+doff/DGS
+dog/SM
+dogcart/SM
+dogcatcher/SM
+doge/MS
+dogeared
+dogfight/SM
+dogfish/MS
+dogged/PY
+doggedness/M
+doggerel/M
+dogging
+doggone/TGRS
+doggy/RSMT
+doghouse/SM
+dogie/SM
+dogleg/SM
+doglegged
+doglegging
+doglike
+dogma/SM
+dogmatic
+dogmatically
+dogmatism/M
+dogmatist/SM
+dognapper
+dogsbody/S
+dogsled/S
+dogtrot/MS
+dogtrotted
+dogtrotting
+dogwood/MS
+doily/SM
+doing/USM
+doldrums/M
+dole's
+dole/FGDS
+doleful/YP
+dolefulness/M
+doll/MDGS
+dollar/SM
+dollhouse/SM
+dollop/SGMD
+dolly/SM
+dolmen/SM
+dolomite/M
+dolor/M
+dolorous/Y
+dolphin/MS
+dolt/MS
+doltish/YP
+doltishness/M
+domain/SM
+dome/MGDS
+domestic/SM
+domestically
+domesticate/DSGN
+domesticated/U
+domestication/M
+domesticity/M
+domicile/DSMG
+domiciliary
+dominance/M
+dominant/SMY
+dominate/DSGN
+domination/M
+dominatrices
+dominatrix/M
+domineer/SGD
+domineering/Y
+dominion/SM
+domino/M
+dominoes
+don't
+don/SM
+dona/MS
+donate/DSXGN
+donation/M
+done/FAU
+dong/MDGS
+dongle/SM
+donkey/SM
+donned
+donning
+donnish
+donnybrook/MS
+donor/SM
+donuts
+doodad/SM
+doodah
+doodahs
+doodle/DRSMZG
+doodlebug/SM
+doodler/M
+doohickey/SM
+doolally
+doom/MDGS
+doomsayer/MS
+doomsday/M
+doomster/S
+door's
+door/IS
+doorbell/MS
+doorjamb/S
+doorkeeper/MS
+doorknob/MS
+doorknocker/S
+doorman/M
+doormat/SM
+doormen
+doorplate/SM
+doorpost/S
+doorstep/MS
+doorstepped
+doorstepping
+doorstop/MS
+doorway/SM
+dooryard/MS
+dopa/M
+dopamine
+dope/MZGDRS
+doper/M
+dopey
+dopier
+dopiest
+dopiness/M
+doping/M
+doppelganger/S
+dork/MS
+dorky/RT
+dorm/MRZS
+dormancy/M
+dormant
+dormer/M
+dormice
+dormitory/SM
+dormouse/M
+dorsal/Y
+dory/SM
+dosage/SM
+dose/MGDS
+dosh
+dosimeter/SM
+doss/DRSZG
+dosshouse/S
+dossier/MS
+dost
+dot/ZGSMDR
+dotage/M
+dotard/SM
+dotcom/SM
+dote/S
+doter/M
+doting/Y
+dotted
+dotting
+dotty/RT
+double's
+double/ADSG
+doubleheader/MS
+doublespeak/M
+doublet/MS
+doubloon/SM
+doubly
+doubt/SMDRZG
+doubter/M
+doubtful/PY
+doubtfulness/M
+doubting/Y
+doubtless/Y
+douche/DSMG
+dough/M
+doughnut/SM
+doughty/RT
+doughy/TR
+dour/RYTP
+dourness/M
+douse/DSG
+dove/MS
+dovecot/S
+dovecote/SM
+dovetail/MDSG
+dovish
+dowager/MS
+dowdily
+dowdiness/M
+dowdy/RSPT
+dowel/SMDG
+dower/SMDG
+down/MDRZGS
+downbeat/SM
+downcast
+downdraft/MS
+downer/M
+downfall/SMN
+downfield
+downgrade/DSMG
+downhearted/PY
+downheartedness/M
+downhill/MS
+download/MDBSG
+downmarket
+downplay/DSG
+downpour/MS
+downrange
+downright
+downriver
+downscale
+downshift/SGD
+downside/MS
+downsize/GDS
+downsizing/M
+downspout/MS
+downstage
+downstairs/M
+downstate/M
+downstream
+downswing/MS
+downtempo
+downtime/M
+downtown/M
+downtrend/MS
+downtrodden
+downturn/MS
+downward/S
+downwind
+downy/RT
+dowry/SM
+dowse/DRSZG
+dowser/M
+doxology/SM
+doyen/SM
+doyenne/MS
+doz/XGDNS
+doze/M
+dozen/MH
+dozily
+dozy/RTP
+dpi
+dpt
+drab/MYSP
+drabber
+drabbest
+drabness/M
+drachma/MS
+draconian
+draft's
+draft/ASDG
+draftee/SM
+drafter/SM
+draftily
+draftiness/M
+drafting/M
+draftsman/M
+draftsmanship/M
+draftsmen
+draftswoman/M
+draftswomen
+drafty/RTP
+drag/MS
+dragged
+dragging
+draggy/TR
+dragnet/SM
+dragon/SM
+dragonfly/SM
+dragoon/SMDG
+dragster/S
+drain/SMDRZG
+drainage/M
+drainboard/SM
+drainer/M
+drainpipe/MS
+drake/SM
+dram/MS
+drama/SM
+dramatic/S
+dramatically
+dramatics/M
+dramatist/SM
+dramatization/SM
+dramatize/DSG
+drank
+drape/DRSMZG
+draper/M
+drapery/SM
+drastic
+drastically
+drat
+dratted
+draughtboard/S
+draw/MRZGSJ
+drawback/MS
+drawbridge/MS
+drawer/M
+drawing/M
+drawl/SMDG
+drawn/A
+drawstring/MS
+dray/MS
+dread/SMDG
+dreadful/PY
+dreadfulness/M
+dreadlocks/M
+dreadnought/MS
+dream/SMDRZG
+dreamboat/MS
+dreamed/U
+dreamer/M
+dreamily
+dreaminess/M
+dreamland/M
+dreamless
+dreamlike
+dreamworld/SM
+dreamy/RPT
+drear
+drearily
+dreariness/M
+dreary/RPT
+dredge/DRSMZG
+dredger/M
+dregs/M
+drench/GDS
+dress/AUGSDM
+dressage/M
+dresser/MS
+dressiness/M
+dressing/SM
+dressmaker/SM
+dressmaking/M
+dressy/TPR
+drew/A
+dribble/MZGDRS
+dribbler/M
+driblet/MS
+drier/M
+drift/SMDRZG
+drifter/M
+driftnet/S
+driftwood/M
+drill/SMDRZG
+driller/M
+drillmaster/SM
+drink/SMRBJZG
+drinkable/U
+drinker/M
+drip/MS
+dripped
+dripping/SM
+drippy/TR
+drive/RSMZGJ
+drivel/SZGMDR
+driveler/M
+driven
+driver/M
+driveshaft/SM
+driveway/MS
+drizzle/MGDS
+drizzly
+drogue/SM
+droid/S
+droll/RPT
+drollery/SM
+drollness/M
+drolly
+dromedary/SM
+drone/DSMG
+drool/SMDG
+droop/GSMD
+droopiness/M
+droopy/TPR
+drop/MS
+dropkick/MS
+droplet/SM
+dropout/SM
+dropped
+dropper/SM
+dropping/S
+droppings/M
+dropsical
+dropsy/M
+dross/M
+drought/SM
+drove/RSMZ
+drover/M
+drown/GSJD
+drowning/M
+drowse/MGDS
+drowsily
+drowsiness/M
+drowsy/RTP
+drub/S
+drubbed
+drubber/SM
+drubbing/MS
+drudge/MGDS
+drudgery/M
+drug/MS
+drugged
+druggie/SM
+drugging
+druggist/SM
+druggy
+drugstore/MS
+druid/SM
+druidism/M
+drum/MS
+drumbeat/SM
+drumlin/SM
+drummed
+drummer/SM
+drumming
+drumstick/SM
+drunk/STMNR
+drunkard/MS
+drunken/PY
+drunkenness/M
+drupe/SM
+druthers/M
+dry/ZTGDRSMY
+dryad/SM
+dryer/SM
+dryness/M
+drys
+drywall/M
+dual
+dualism/M
+duality/M
+dub/SM
+dubbed
+dubber/SM
+dubbin/M
+dubbing
+dubiety/M
+dubious/YP
+dubiousness/M
+ducal
+ducat/SM
+duchess/MS
+duchy/SM
+duck/MDGS
+duckbill/SM
+duckboards
+duckling/SM
+duckpins/M
+duckweed/M
+ducky/TRSM
+duct's/K
+duct/CKIFS
+ductile
+ductility/M
+ducting
+ductless
+dud/GSMD
+dude/MS
+dudgeon/M
+due/SM
+duel/MDRJZGS
+dueler/M
+duelist/SM
+duenna/MS
+duet/MS
+duff/MDRZGS
+duffer/M
+dug
+dugout/MS
+duh
+duke/MS
+dukedom/SM
+dulcet
+dulcimer/MS
+dull/DRPTGS
+dullard/SM
+dullness/M
+dully
+duly/U
+dumb/RYPT
+dumbbell/SM
+dumbfound/SDG
+dumbness/M
+dumbo/S
+dumbstruck
+dumbwaiter/SM
+dumdum/MS
+dummy/SM
+dump/MDRZGS
+dumpiness/M
+dumpling/SM
+dumpsite/S
+dumpster/SM
+dumpy/PTR
+dun/SM
+dunce/SM
+dunderhead/MS
+dune/MS
+dung/MDGS
+dungaree/MS
+dungeon/SM
+dunghill/MS
+dunk/MDGS
+dunned
+dunner
+dunnest
+dunning
+dunno
+duo/SM
+duodecimal
+duodena
+duodenal
+duodenum/M
+duopoly/S
+dupe/MZGDRS
+duper/M
+duple
+duplex/MS
+duplicate's
+duplicate/AGNDS
+duplication/AM
+duplicator/MS
+duplicitous
+duplicity/M
+durability/M
+durable
+durably
+durance/M
+duration/M
+duress/M
+during
+durst
+durum/M
+dusk/M
+duskiness/M
+dusky/RTP
+dust/MDRZGS
+dustbin/SM
+dustcart/S
+duster/M
+dustiness/M
+dustless
+dustman
+dustmen
+dustpan/SM
+dustsheet/S
+dusty/RTP
+dutch
+duteous/Y
+dutiable
+dutiful/YP
+dutifulness/M
+duty/SM
+duvet/SM
+dwarf/SGMD
+dwarfish
+dwarfism/M
+dweeb/SM
+dwell/SJZGR
+dweller/M
+dwelling/M
+dwelt/I
+dwindle/DSG
+dyadic
+dybbuk/SM
+dybbukim
+dye/DRSMZG
+dyeing/A
+dyer/M
+dyestuff/M
+dying/M
+dyke/MS
+dynamic/MS
+dynamical/Y
+dynamics/M
+dynamism/M
+dynamite/MZGDRS
+dynamiter/M
+dynamo/SM
+dynastic
+dynasty/SM
+dysentery/M
+dysfunction/MS
+dysfunctional
+dyslectic/SM
+dyslexia/M
+dyslexic/SM
+dyspepsia/M
+dyspeptic/MS
+dysphagia
+dysphoria
+dysphoric
+dysprosium/M
+dystonia
+dystopi
+dystopia
+dystopian
+dz
+e'en
+e'er
+e/FDST
+eBay/M
+eMusic/M
+ea
+each
+eager/PTRY
+eagerness/M
+eagle/MS
+eaglet/MS
+ear/SMDY
+earache/SM
+earbud/SM
+eardrum/SM
+earful/SM
+earl/MS
+earldom/SM
+earliness/M
+earlobe/SM
+early/RTP
+earmark/SMDG
+earmuff/SM
+earn/DRZTGJS
+earned/U
+earner/M
+earnest/SMYP
+earnestness/M
+earnings/M
+earphone/MS
+earpiece/S
+earplug/SM
+earring/SM
+earshot/M
+earsplitting
+earth's
+earth/UDYG
+earthbound
+earthen
+earthenware/M
+earthiness/M
+earthling/MS
+earthly/RT
+earthquake/SM
+earths/U
+earthshaking
+earthward/S
+earthwork/MS
+earthworm/MS
+earthy/RTP
+earwax/M
+earwig/SM
+ease/EDSM
+easel/SM
+easement/SM
+easily/U
+easiness/UM
+easing
+east/M
+eastbound
+easterly/SM
+eastern/ZR
+easterner/M
+easternmost
+eastward/S
+easy/URTP
+easygoing
+eat/ZGBSNR
+eatable/SM
+eaten/U
+eater/M
+eatery/SM
+eave/MS
+eavesdrop/S
+eavesdropped
+eavesdropper/SM
+eavesdropping
+ebb/SMDG
+ebony/SM
+ebullience/M
+ebullient/Y
+ebullition/M
+eccentric/SM
+eccentrically
+eccentricity/SM
+eccl
+ecclesial
+ecclesiastic/SM
+ecclesiastical/Y
+echelon/SM
+echidna
+echinoderm/SM
+echo's
+echo/ADG
+echoes/A
+echoic
+echolocation/M
+echos
+eclair/SM
+eclat/M
+eclectic/SM
+eclectically
+eclecticism/M
+eclipse/DSMG
+ecliptic/M
+eclogue/SM
+ecocide/M
+ecol
+ecologic
+ecological/Y
+ecologist/MS
+ecology/M
+econ
+econometric/S
+economic/S
+economical/UY
+economics/M
+economist/SM
+economize/DRSZG
+economizer/M
+economy/SM
+ecosystem/MS
+ecotourism/M
+ecotourist/MS
+ecru/M
+ecstasy/SM
+ecstatic
+ecstatically
+ecu/S
+ecumenical/Y
+ecumenicism/M
+ecumenism/M
+eczema/M
+ed/ACSM
+edamame
+eddy/DSMG
+edelweiss/M
+edema/SM
+edge/MZGJDRS
+edger/M
+edgewise
+edgily
+edginess/M
+edging/M
+edgy/RTP
+edibility/M
+edible/SMP
+edibleness/M
+edict/SM
+edification/M
+edifice/SM
+edifier/M
+edify/DRSZGN
+edifying/U
+edit's
+edit/ADGS
+editable
+edited/U
+edition/MS
+editor/SM
+editorial/SMY
+editorialize/DSG
+editorship/M
+educ
+educability/M
+educable/I
+educate/ADSGNV
+educated/U
+education/AM
+educational/Y
+educationalist/S
+educationist/S
+educations
+educator/MS
+educe/DSGB
+edutainment/M
+eek
+eel/SM
+eerie/RT
+eerily
+eeriness/M
+eff/GSD
+efface/DSLG
+effacement/M
+effect/SMDGV
+effective/IPY
+effectiveness/IM
+effectual/IY
+effectuate/DSG
+effeminacy/M
+effeminate/Y
+effendi/SM
+efferent
+effervesce/GDS
+effervescence/M
+effervescent/Y
+effete/YP
+effeteness/M
+efficacious/Y
+efficacy/IM
+efficiency/ISM
+efficient/IY
+effigy/SM
+efflorescence/M
+efflorescent
+effluence/M
+effluent/MS
+effluvia
+effluvium/M
+efflux
+effort/SM
+effortful
+effortless/YP
+effortlessness/M
+effrontery/M
+effulgence/M
+effulgent
+effuse/DSGNVX
+effusion/M
+effusive/YP
+effusiveness/M
+egad
+egalitarian/SM
+egalitarianism/M
+egg/GSMD
+eggbeater/MS
+eggcup/SM
+egghead/SM
+eggnog/M
+eggplant/MS
+eggshell/SM
+eglantine/SM
+ego/SM
+egocentric/MS
+egocentrically
+egocentricity/M
+egoism/M
+egoist/SM
+egoistic
+egoistical/Y
+egomania/M
+egomaniac/MS
+egotism/M
+egotist/SM
+egotistic
+egotistical/Y
+egregious/PY
+egregiousness/M
+egress/MS
+egret/SM
+eh
+eider/SM
+eiderdown/MS
+eigenvalue/S
+eigenvector/S
+eight/SM
+eighteen/MHS
+eighteenth/M
+eighteenths
+eighth/M
+eighths
+eightieth/M
+eightieths
+eighty/SMH
+einsteinium/M
+eisteddfod/S
+either
+ejaculate/GNXDS
+ejaculation/M
+ejaculatory
+eject/SDG
+ejection/MS
+ejector/SM
+eke/DSG
+elaborate/YGNDSPX
+elaborateness/M
+elaboration/M
+elan/M
+eland/SM
+elapse/DSG
+elastic/MS
+elastically
+elasticated
+elasticity/M
+elasticize/DSG
+elate/DSGN
+elated/Y
+elation/M
+elbow/SMDG
+elbowroom/M
+elder/SMY
+elderberry/SM
+eldercare/M
+eldest
+eldritch
+elect's
+elect/ASDGV
+electable
+election/AMS
+electioneer/DGS
+elective/MS
+elector/MS
+electoral/Y
+electorate/MS
+electric/S
+electrical/Y
+electrician/MS
+electricity/M
+electrification/M
+electrifier/M
+electrify/ZGNDRS
+electrocardiogram/MS
+electrocardiograph/M
+electrocardiographs
+electrocardiography/M
+electrocute/DSXGN
+electrocution/M
+electrode/SM
+electrodynamics
+electroencephalogram/MS
+electroencephalograph/M
+electroencephalographic
+electroencephalographs
+electroencephalography/M
+electrologist/SM
+electrolysis/M
+electrolyte/MS
+electrolytic
+electromagnet/MS
+electromagnetic
+electromagnetically
+electromagnetism/M
+electromotive
+electron/MS
+electronic/S
+electronica/M
+electronically
+electronics/M
+electroplate/DSG
+electroscope/SM
+electroscopic
+electroshock/M
+electrostatic/S
+electrostatics/M
+electrotype/MS
+electroweak
+eleemosynary
+elegance/IM
+elegant/IY
+elegiac/MS
+elegiacal
+elegy/SM
+elem
+element/MS
+elemental/Y
+elementary
+elephant/SM
+elephantiasis/M
+elephantine
+elev
+elevate/XDSGN
+elevation/M
+elevator/MS
+eleven/SMH
+elevens/S
+eleventh/M
+elevenths
+elf/M
+elfin
+elfish
+elicit/SDG
+elicitation/M
+elide/DSG
+eligibility/IM
+eligible
+eliminate/XDSGN
+elimination/M
+eliminator/S
+elision/MS
+elite/SM
+elitism/M
+elitist/MS
+elixir/SM
+elk/SM
+ell/SM
+ellipse/MS
+ellipsis/M
+ellipsoid/SM
+ellipsoidal
+elliptic
+elliptical/Y
+elm/SM
+elocution/M
+elocutionary
+elocutionist/SM
+elodea/SM
+elongate/DSGNX
+elongation/M
+elope/DSGL
+elopement/MS
+eloquence/M
+eloquent/Y
+else
+elsewhere
+elucidate/DSGNX
+elucidation/M
+elude/DSG
+elusive/YP
+elusiveness/M
+elver/SM
+elves
+elvish
+em's
+em/S
+emaciate/GNDS
+emaciation/M
+email/SMDG
+emanate/XDSGN
+emanation/M
+emancipate/DSGN
+emancipation/M
+emancipator/MS
+emasculate/GNDS
+emasculation/M
+embalm/SZGDR
+embalmer/M
+embank/SLGD
+embankment/SM
+embargo/MDG
+embargoes
+embark/AEGDS
+embarkation/EM
+embarkations
+embarrass/GLDS
+embarrassed/U
+embarrassing/Y
+embarrassment/SM
+embassy/SM
+embattled
+embed/S
+embedded
+embedding
+embellish/LGDS
+embellishment/SM
+ember/SM
+embezzle/ZGLDRS
+embezzlement/M
+embezzler/M
+embitter/GLDS
+embitterment/M
+emblazon/GDLS
+emblazonment/M
+emblem/SM
+emblematic
+emblematically
+embodiment/EM
+embody/AEGSD
+embolden/DGS
+embolism/MS
+embolization
+emboss/DRSZG
+embosser/M
+embouchure/M
+embower/SGD
+embrace/DSMG
+embraceable
+embrasure/MS
+embrocation/MS
+embroider/SDRZG
+embroiderer/M
+embroidery/SM
+embroil/DGLS
+embroilment/M
+embryo/SM
+embryological
+embryologist/MS
+embryology/M
+embryonic
+emcee/DSM
+emceeing
+emend/SDG
+emendation/MS
+emerald/MS
+emerge/ADSG
+emergence/AM
+emergency/SM
+emergent
+emerita
+emeritus
+emery/M
+emetic/SM
+emf/S
+emigrant/SM
+emigrate/DSXGN
+emigration/M
+emigre/SM
+eminence/MS
+eminent/Y
+emir/MS
+emirate/MS
+emissary/SM
+emission/SM
+emit/S
+emitted
+emitter/MS
+emitting
+emo/SM
+emoji/SM
+emollient/MS
+emolument/MS
+emote/XDSGNV
+emoticon/SM
+emotion/M
+emotional/UY
+emotionalism/M
+emotionalize/GDS
+emotionless
+emotive/Y
+empathetic
+empathically
+empathize/DSG
+empathy/M
+emperor/MS
+emphases
+emphasis/M
+emphasize/AGDS
+emphatic/U
+emphatically
+emphysema/M
+empire/SM
+empiric
+empirical/Y
+empiricism/M
+empiricist/SM
+emplacement/SM
+employ's
+employ/ADGLS
+employable/U
+employee/SM
+employer/SM
+employment/UAM
+employments
+emporium/SM
+empower/SDGL
+empowerment/M
+empress/MS
+emptily
+emptiness/M
+empty/TGPDRSM
+empyrean/M
+emu/SM
+emulate/DSGNVX
+emulation/M
+emulator/SM
+emulsification/M
+emulsifier/M
+emulsify/NDRSZG
+emulsion/MS
+en/SM
+enable/DRSZG
+enabler/M
+enact/ASLDG
+enactment/ASM
+enamel/JSZGMDR
+enameler/M
+enamelware/M
+enamor/SGD
+enc
+encamp/LSGD
+encampment/MS
+encapsulate/XGNDS
+encapsulation/M
+encase/LDSG
+encasement/M
+encephalitic
+encephalitis/M
+enchain/DGS
+enchant/ELDGS
+enchanter/MS
+enchanting/Y
+enchantment/EM
+enchantments
+enchantress/MS
+enchilada/SM
+encipher/SGD
+encircle/DSGL
+encirclement/M
+encl
+enclave/MS
+enclose/GDS
+enclosed/U
+enclosure/SM
+encode/DRSZG
+encoder/M
+encomium/MS
+encompass/GDS
+encore/DSMG
+encounter/GSMD
+encourage/DSLG
+encouragement/SM
+encouraging/Y
+encroach/GLDS
+encroachment/SM
+encrust/DGS
+encrustation/SM
+encrypt/DGS
+encryption
+encumber/EGSD
+encumbered/U
+encumbrance/MS
+ency
+encyclical/SM
+encyclopedia/MS
+encyclopedic
+encyst/LSGD
+encystment/M
+end/GVSJMD
+endanger/SGDL
+endangerment/M
+endear/SGLD
+endearing/Y
+endearment/SM
+endeavor/GSMD
+endemic/MS
+endemically
+endgame/S
+ending/M
+endive/SM
+endless/PY
+endlessness/M
+endmost
+endocarditis
+endocrine/MS
+endocrinologist/MS
+endocrinology/M
+endogenous/Y
+endometrial
+endometriosis
+endometrium
+endorphin/MS
+endorse/LZGDRS
+endorsement/MS
+endorser/M
+endoscope/MS
+endoscopic
+endoscopy/M
+endothelial
+endothermic
+endotracheal
+endow/SDLG
+endowment/MS
+endpoint/SM
+endue/DSG
+endurable/U
+endurance/M
+endure/DSBG
+endways
+enema/SM
+enemy/SM
+energetic
+energetically
+energize/ZGDRS
+energizer/M
+energy/SM
+enervate/GNDS
+enervation/M
+enfeeble/GDSL
+enfeeblement/M
+enfilade/DSMG
+enfold/SGD
+enforce/LZGDRS
+enforceable/U
+enforced/U
+enforcement/M
+enforcer/M
+enfranchise/EGDSL
+enfranchisement/EM
+engage/EADSG
+engagement/EMS
+engagingly
+engender/SGD
+engine/SM
+engineer/MDGS
+engineering/M
+engorge/LGDS
+engorgement/M
+engram/SM
+engrave/ZGJDRS
+engraver/M
+engraving/M
+engross/GLDS
+engrossment/M
+engulf/SLGD
+engulfment/M
+enhance/LZGDRS
+enhancement/SM
+enigma/SM
+enigmatic
+enigmatically
+enjambment/SM
+enjoin/SGD
+enjoy/GBLSD
+enjoyably
+enjoyment/SM
+enlarge/LZGDRS
+enlargeable
+enlargement/MS
+enlarger/M
+enlighten/SGLD
+enlightened/U
+enlightenment/M
+enlist/ADGSL
+enlistee/SM
+enlistment/AM
+enlistments
+enliven/SLDG
+enlivenment/M
+enmesh/DSGL
+enmeshment/M
+enmity/SM
+ennoble/DSGL
+ennoblement/M
+ennui/M
+enormity/SM
+enormous/PY
+enormousness/M
+enough/M
+enplane/DSG
+enqueue/DS
+enquirer/S
+enquiringly
+enrage/GDS
+enrapture/DSG
+enrich/DSLG
+enrichment/M
+enroll/DLSG
+enrollment/MS
+ensconce/DSG
+ensemble/SM
+enshrine/GLDS
+enshrinement/M
+enshroud/DGS
+ensign/MS
+ensilage/M
+enslave/DSGL
+enslavement/M
+ensnare/DSLG
+ensnarement/M
+ensue/DSG
+ensure/ZGDRS
+ensurer/M
+entail/DSGL
+entailment/M
+entangle/EDSLG
+entanglement/EM
+entanglements
+entente/SM
+enter/ASGD
+enteral
+enteric
+enteritis/M
+enterprise/MGS
+enterprising/Y
+entertain/ZGDRSL
+entertainer/M
+entertaining/MY
+entertainment/MS
+enthrall/GDSL
+enthrallment/M
+enthrone/GDSL
+enthronement/SM
+enthuse/DSG
+enthusiasm/MS
+enthusiast/MS
+enthusiastic/U
+enthusiastically
+entice/GDSL
+enticement/MS
+enticing/Y
+entire/Y
+entirety/M
+entitle/DSGL
+entitlement/SM
+entity/SM
+entomb/DSGL
+entombment/M
+entomological
+entomologist/MS
+entomology/M
+entourage/SM
+entr'acte
+entrails/M
+entrained
+entrance/LDSMG
+entrancement/M
+entrancing/Y
+entrant/SM
+entrap/LS
+entrapment/M
+entrapped
+entrapping
+entreat/GSD
+entreating/Y
+entreaty/SM
+entree/MS
+entrench/DSGL
+entrenchment/MS
+entrepreneur/SM
+entrepreneurial
+entrepreneurship
+entropy/M
+entrust/SGD
+entry/ASM
+entryphone/S
+entryway/MS
+entwine/DSG
+enumerable
+enumerate/DSGNX
+enumeration/M
+enumerator/SM
+enunciate/DSGN
+enunciation/M
+enuresis/M
+envelop/SLDRZG
+envelope/SM
+enveloper/M
+envelopment/M
+envenom/SDG
+enviable/U
+enviably
+envious/PY
+enviousness/M
+environment/MS
+environmental/Y
+environmentalism/M
+environmentalist/SM
+environs/M
+envisage/GDS
+envision/DGS
+envoy/SM
+envy/DSMG
+envying/Y
+enzymatic
+enzyme/SM
+eolian
+eon/SM
+eosinophil/S
+eosinophilic
+epaulet/SM
+epee/MS
+ephedrine/M
+ephemera/M
+ephemeral/Y
+epic/MS
+epicenter/MS
+epicure/SM
+epicurean/MS
+epidemic/SM
+epidemically
+epidemiological
+epidemiologist/SM
+epidemiology/M
+epidermal
+epidermic
+epidermis/MS
+epidural/S
+epiglottis/MS
+epigram/SM
+epigrammatic
+epigraph/M
+epigraphs
+epigraphy/M
+epilepsy/M
+epileptic/SM
+epilogue/MS
+epinephrine/M
+epiphany/SM
+episcopacy/M
+episcopal
+episcopate/M
+episode/SM
+episodic
+episodically
+epistemic
+epistemological
+epistemology
+epistle/SM
+epistolary
+epitaph/M
+epitaphs
+epithelial
+epithelium/M
+epithet/SM
+epitome/SM
+epitomize/GDS
+epoch/M
+epochal
+epochs
+eponymous
+epoxy/DSMG
+epsilon/SM
+equability/M
+equable
+equably
+equal/SMDYG
+equality/IM
+equalization/M
+equalize/ZGDRS
+equalizer/M
+equanimity/M
+equate/DSGNBX
+equation/M
+equator/SM
+equatorial
+equerry/SM
+equestrian/SM
+equestrianism/M
+equestrienne/SM
+equidistant/Y
+equilateral/SM
+equilibrium/EM
+equine/SM
+equinoctial
+equinox/MS
+equip/AS
+equipage/MS
+equipment/M
+equipoise/M
+equipped/UA
+equipping/A
+equitable/I
+equitably/I
+equitation/M
+equity/ISM
+equiv
+equivalence/MS
+equivalency/SM
+equivalent/MYS
+equivocal/UY
+equivocalness/M
+equivocate/GNXDS
+equivocation/M
+equivocator/SM
+er/C
+era/SM
+eradicable/I
+eradicate/DSGN
+eradication/M
+eradicator/MS
+erase/DRSBZG
+eraser/M
+erasure/SM
+erbium/M
+ere
+erect/PSGDY
+erectile
+erection/SM
+erectness/M
+erector/MS
+erelong
+eremite/MS
+erg/SM
+ergo
+ergonomic/S
+ergonomically
+ergonomics/M
+ergosterol/M
+ergot/M
+ermine/SM
+erode/DSG
+erodible
+erogenous
+erosion/M
+erosive
+erotic/S
+erotica/M
+erotically
+eroticism/M
+err/GSD
+errand/SM
+errant/I
+errata/SM
+erratic
+erratically
+erratum/M
+erroneous/Y
+error/SM
+ersatz/MS
+erst
+erstwhile
+eruct/SDG
+eructation/SM
+erudite/YN
+erudition/M
+erupt/SDGV
+eruption/MS
+erysipelas/M
+erythrocyte/SM
+erythromycin
+escalate/CDSGN
+escalation/CM
+escalations
+escalator/MS
+escallop/SGMD
+escalope/S
+escapade/MS
+escape/LMGDS
+escapee/MS
+escapement/SM
+escapism/M
+escapist/MS
+escapologist/S
+escapology
+escargot/MS
+escarole/MS
+escarpment/MS
+eschatological
+eschatology
+eschew/SDG
+escort/SMDG
+escritoire/MS
+escrow/SM
+escudo/SM
+escutcheon/SM
+esophageal
+esophagi
+esophagus/M
+esoteric
+esoterically
+esp
+espadrille/MS
+espalier/MDSG
+especial/Y
+espionage/M
+esplanade/MS
+espousal/M
+espouse/GDS
+espresso/MS
+esprit/M
+espy/DSG
+esquire/SM
+essay/SMDRZG
+essayer/M
+essayist/SM
+essence/SM
+essential/IMS
+essentially
+establish/AESDGL
+establishment/AEM
+establishments
+estate/SM
+esteem/ESMDG
+ester/SM
+estimable/I
+estimate/MGNDSX
+estimation/M
+estimator/SM
+estoppel
+estradiol
+estrange/LDSG
+estrangement/MS
+estrogen/MS
+estrous
+estrus/MS
+estuary/SM
+eta/SM
+etc
+etch/DRSZGJ
+etcher/M
+etching/M
+eternal/YP
+eternalness/M
+eternity/SM
+ethane/M
+ethanol/M
+ether/M
+ethereal/Y
+ethic/SM
+ethical/UY
+ethics/M
+ethmoid
+ethnic/SM
+ethnically
+ethnicity/M
+ethnocentric
+ethnocentrism/M
+ethnographer/S
+ethnographic
+ethnographically
+ethnography
+ethnological/Y
+ethnologist/SM
+ethnology/M
+ethological
+ethologist/MS
+ethology/M
+ethos/M
+ethyl/M
+ethylene/M
+etiolated
+etiologic
+etiological
+etiology/SM
+etiquette/M
+etude/SM
+etymological/Y
+etymologist/SM
+etymology/SM
+eucalypti
+eucalyptus/MS
+euchre/DSMG
+euclidean
+eugenic/S
+eugenically
+eugenicist/MS
+eugenics/M
+eukaryote/SM
+eukaryotic
+eulogist/MS
+eulogistic
+eulogize/ZGDRS
+eulogizer/M
+eulogy/SM
+eunuch/M
+eunuchs
+euphemism/SM
+euphemistic
+euphemistically
+euphonious/Y
+euphony/M
+euphoria/M
+euphoric
+euphorically
+eureka
+euro/MS
+europium/M
+eutectic
+euthanasia/M
+euthanize/DSG
+euthenics/M
+eutrophication
+evacuate/XDSGN
+evacuation/M
+evacuee/MS
+evade/DRSZG
+evader/M
+evaluate/AGNVDSX
+evaluation/AM
+evaluator/S
+evanescence/M
+evanescent
+evangelic
+evangelical/SMY
+evangelicalism/M
+evangelism/M
+evangelist/MS
+evangelistic
+evangelize/GDS
+evaporate/GNDS
+evaporation/M
+evaporator/SM
+evasion/SM
+evasive/YP
+evasiveness/M
+eve/ASM
+even/MDRYTGSJP
+evenhanded/Y
+evening/M
+evenness/UM
+evensong/M
+event/SM
+eventful/UY
+eventfulness/M
+eventide/M
+eventual/Y
+eventuality/SM
+eventuate/GDS
+ever
+everglade/SM
+evergreen/SM
+everlasting/MYS
+evermore
+every
+everybody/M
+everyday
+everyone/M
+everyplace
+everything/M
+everywhere
+evict/SDG
+eviction/MS
+evidence/MGDS
+evident/Y
+evil/MRYTSP
+evildoer/SM
+evildoing/M
+eviller
+evillest
+evilness/M
+evince/DSG
+eviscerate/DSGN
+evisceration/M
+evocation/MS
+evocative/Y
+evoke/DSG
+evolution/M
+evolutionary
+evolutionist/SM
+evolve/DSG
+ewe/RSMZ
+ewer/M
+ex/MS
+exabyte/MS
+exacerbate/GNDS
+exacerbation/M
+exact/SPDRYTG
+exacting/Y
+exaction/M
+exactitude/M
+exactness/IM
+exaggerate/XDSGN
+exaggerated/Y
+exaggeration/M
+exaggerator/MS
+exajoule/S
+exalt/SDG
+exaltation/M
+exam/MS
+examination/AMS
+examine/AGDS
+examiner/MS
+example/MGDS
+exampled/U
+exasperate/DSGN
+exasperated/Y
+exasperating/Y
+exasperation/M
+excavate/GNDSX
+excavation/M
+excavator/SM
+exceed/GSD
+exceeding/Y
+excel/S
+excelled
+excellence/M
+excellency/SM
+excellent/Y
+excelling
+excelsior/M
+except/GSD
+exception/BSM
+exceptionable/U
+exceptional/UY
+exceptionalism
+excerpt/MDGS
+excess/VMS
+excessive/Y
+exchange/DSMG
+exchangeable
+exchequer/SM
+excise/XDSMGN
+excision/M
+excitability/M
+excitably
+excitation/M
+excite/BDRSLZG
+excited/Y
+excitement/SM
+exciter/M
+exciting/Y
+exciton
+excl
+exclaim/DGS
+exclamation/SM
+exclamatory
+exclude/GDS
+exclusion/MS
+exclusionary
+exclusive/PMYS
+exclusiveness/M
+exclusivity/M
+excommunicate/GNDSX
+excommunication/M
+excoriate/DSGNX
+excoriation/M
+excrement/M
+excremental
+excrescence/MS
+excrescent
+excreta/M
+excrete/XGNDS
+excretion/M
+excretory
+excruciating/Y
+exculpate/DSGN
+exculpation/M
+exculpatory
+excursion/MS
+excursionist/MS
+excursive/YP
+excursiveness/M
+excusable/I
+excusably/I
+excuse/DSBMG
+excused/U
+exec/MS
+execrable
+execrably
+execrate/DSGN
+execration/M
+execute/BXGNVDS
+execution/ZMR
+executioner/M
+executive/SM
+executor/MS
+executrices
+executrix/M
+exegeses
+exegesis/M
+exegetic
+exegetical
+exemplar/SM
+exemplary
+exemplification/M
+exemplify/GDSXN
+exempt/SGD
+exemption/SM
+exercise/DRSMZG
+exerciser/M
+exert/SDG
+exertion/MS
+exeunt
+exfoliate/GNDS
+exhalation/MS
+exhale/DSG
+exhaust/GVMDS
+exhaustible/I
+exhaustion/M
+exhaustive/YP
+exhaustiveness/M
+exhibit/GMDS
+exhibition/MS
+exhibitionism/M
+exhibitionist/MS
+exhibitor/SM
+exhilarate/DSGN
+exhilaration/M
+exhort/SDG
+exhortation/MS
+exhumation/MS
+exhume/DSG
+exigence/MS
+exigency/SM
+exigent
+exiguity/M
+exiguous
+exile/DSMG
+exilic
+exist/SDG
+existence/MS
+existent
+existential/Y
+existentialism/M
+existentialist/MS
+exit/MDGS
+exobiology/M
+exodus/MS
+exogenous
+exon/MS
+exonerate/GNDS
+exoneration/M
+exoplanet/MS
+exorbitance/M
+exorbitant/Y
+exorcise/DSG
+exorcism/SM
+exorcist/SM
+exoskeleton/SM
+exosphere/SM
+exothermic
+exotic/SM
+exotica
+exotically
+exoticism/M
+exp
+expand/BGSD
+expanse/XMNVS
+expansible
+expansion/M
+expansionary
+expansionism/M
+expansionist/MS
+expansive/YP
+expansiveness/M
+expat/S
+expatiate/GNDS
+expatiation/M
+expatriate/DSMGN
+expatriation/M
+expect/GSD
+expectancy/M
+expectant/Y
+expectation/SM
+expectorant/SM
+expectorate/DSGN
+expectoration/M
+expedience/IM
+expediences
+expediencies
+expediency/IM
+expedient/SMY
+expedite/DRSZGNX
+expediter/M
+expedition/M
+expeditionary
+expeditious/PY
+expeditiousness/M
+expel/S
+expelled
+expelling
+expend/GSBD
+expendable/SM
+expenditure/SM
+expense/MS
+expensive/IYP
+expensiveness/IM
+experience/IMD
+experiences
+experiencing
+experiential
+experiment/MDRSZG
+experimental/Y
+experimentation/M
+experimenter/M
+expert/SPMY
+expertise/M
+expertness/M
+expiate/GNDS
+expiation/M
+expiatory
+expiration/M
+expire/DSG
+expired/U
+expiry/M
+explain/ADGS
+explainable
+explained/U
+explanation/MS
+explanatory
+expletive/MS
+explicable/I
+explicate/XGNDS
+explication/M
+explicit/PY
+explicitness/M
+explode/GDS
+exploit/ZGBMDRS
+exploitation/M
+exploitative
+exploited/U
+exploiter/M
+exploration/MS
+exploratory
+explore/ZGDRS
+explored/U
+explorer/M
+explosion/SM
+explosive/SPMY
+explosiveness/M
+expo/MS
+exponent/MS
+exponential/Y
+exponentiation
+export/BSZGMDR
+exportation/M
+exporter/M
+expose/DSMG
+exposed/U
+exposition/SM
+expositor/SM
+expository
+expostulate/GNXDS
+expostulation/M
+exposure/MS
+expound/ZGDRS
+expounder/M
+express/GVMDSY
+expressed/U
+expressible/I
+expression/SM
+expressionism/M
+expressionist/SM
+expressionistic
+expressionless/Y
+expressive/PY
+expressiveness/M
+expressway/SM
+expropriate/GNXDS
+expropriation/M
+expropriator/SM
+expulsion/MS
+expunge/GDS
+expurgate/DSGNX
+expurgated/U
+expurgation/M
+exquisite/YP
+exquisiteness/M
+ext
+extant
+extemporaneous/PY
+extemporaneousness/M
+extempore
+extemporization/M
+extemporize/GDS
+extend/SZGDRB
+extender/M
+extensibility
+extensible
+extension/SM
+extensional
+extensive/YP
+extensiveness/M
+extent/SM
+extenuate/DSGN
+extenuation/M
+exterior/MS
+exterminate/DSXGN
+extermination/M
+exterminator/MS
+external/MYS
+externalization/SM
+externalize/DSG
+extinct/GDS
+extinction/MS
+extinguish/ZGBDRS
+extinguishable/I
+extinguisher/M
+extirpate/GNDS
+extirpation/M
+extol/S
+extolled
+extolling
+extort/SGD
+extortion/MRZ
+extortionate/Y
+extortioner/M
+extortionist/MS
+extra/SM
+extracellular
+extract/MDGVS
+extraction/SM
+extractor/MS
+extracurricular
+extradite/GNBXDS
+extradition/M
+extrajudicial
+extralegal
+extramarital
+extramural
+extraneous/Y
+extraordinaire
+extraordinarily
+extraordinary
+extrapolate/XGNDS
+extrapolation/M
+extrasensory
+extraterrestrial/MS
+extraterritorial
+extraterritoriality/M
+extravagance/MS
+extravagant/Y
+extravaganza/MS
+extravehicular
+extreme/PMYTRS
+extremeness/M
+extremism/M
+extremist/MS
+extremity/SM
+extricable/I
+extricate/GNDS
+extrication/M
+extrinsic
+extrinsically
+extroversion/M
+extrovert/SMD
+extrude/GDS
+extrusion/SM
+extrusive
+exuberance/M
+exuberant/Y
+exudation/M
+exude/DSG
+exult/SDG
+exultant/Y
+exultation/M
+exurb/SM
+exurban
+exurbanite/SM
+exurbia/M
+eye/DSM
+eyeball/GMDS
+eyebrow/SM
+eyedropper/SM
+eyeful/SM
+eyeglass/MS
+eyeing
+eyelash/MS
+eyeless
+eyelet/SM
+eyelid/SM
+eyeliner/MS
+eyeopener/MS
+eyeopening
+eyepiece/MS
+eyesight/M
+eyesore/MS
+eyestrain/M
+eyeteeth
+eyetooth/M
+eyewash/M
+eyewitness/MS
+f/CIAVTR
+fMRI
+fa/M
+fab
+fable/DSM
+fabric/SM
+fabricate/DSGNX
+fabrication/M
+fabricator/SM
+fabulous/Y
+facade/SM
+face's
+face/ACSDG
+facecloth/M
+facecloths
+faceless
+facepalm/SDG
+facet/SMDG
+facetious/YP
+facetiousness/M
+facial/SMY
+facile/Y
+facilitate/GNDS
+facilitation/M
+facilitator/MS
+facility/SM
+facing/SM
+facsimile/DSM
+facsimileing
+fact/MS
+faction/SM
+factional
+factionalism/M
+factious
+factitious
+factoid/SM
+factor's
+factor/ASDG
+factorial/MS
+factorization
+factorize/GDS
+factory/SM
+factotum/SM
+factual/Y
+faculty/SM
+fad/GSMD
+faddish/P
+faddist/MS
+faddy/P
+fade/MS
+fading/U
+faerie/SM
+faff/DGS
+fag/SM
+fagged
+fagging
+faggot/SM
+fagot/SMG
+faience/M
+fail/DGJS
+failing/M
+faille/M
+failure/SM
+fain/RT
+faint/SMDRYTGP
+fainthearted
+faintness/M
+fair/MRYTGJPS
+fairground/MS
+fairing/M
+fairness/UM
+fairway/SM
+fairy/SM
+fairyland/SM
+faith/M
+faithful's
+faithful/UPY
+faithfulness/UM
+faithfuls
+faithless/PY
+faithlessness/M
+faiths
+fajita/SM
+fajitas/M
+fake/MZGDRS
+faker/M
+fakir/SM
+falcon/SMRZ
+falconer/M
+falconry/M
+fall/MNGS
+fallacious/Y
+fallacy/SM
+fallback
+fallibility/IM
+fallible/P
+fallibleness/M
+fallibly/I
+falloff/SM
+fallout/M
+fallow/SMDG
+false/PRYT
+falsehood/SM
+falseness/M
+falsetto/SM
+falsie/SM
+falsifiable
+falsification/M
+falsifier/M
+falsify/DRSZGNX
+falsity/SM
+falter/GSJMD
+faltering/Y
+fame's
+fame/D
+familial
+familiar/MYS
+familiarity/UM
+familiarization/M
+familiarize/GDS
+family/SM
+famine/SM
+famish/DSG
+famous/IY
+fan/SM
+fanatic/SM
+fanatical/Y
+fanaticism/M
+fanboy/SM
+fanciable
+fancier/M
+fanciful/YP
+fancifulness/M
+fancily
+fanciness/M
+fancy/DRSMZTGP
+fancywork/M
+fandango/MS
+fandom
+fanfare/SM
+fang/MDS
+fanlight/SM
+fanned
+fanning
+fanny/SM
+fantail/MS
+fantasia/SM
+fantasist/S
+fantasize/GDS
+fantastic
+fantastical/Y
+fantasy/DSMG
+fanzine/MS
+far
+farad/SM
+faradize/DG
+faraway
+farce/SM
+farcical/Y
+fare/MGDS
+farewell/SM
+farina/M
+farinaceous
+farm/MDRZGSJ
+farmer/M
+farmhand/SM
+farmhouse/SM
+farming/M
+farmland/MS
+farmstead/MS
+farmyard/MS
+faro/M
+farrago/M
+farragoes
+farrier/MS
+farrow/SMDG
+farseeing
+farsighted/P
+farsightedness/M
+fart/MDGS
+farther
+farthermost
+farthest
+farthing/SM
+fascia/SM
+fascicle/SM
+fascinate/GNDSX
+fascinating/Y
+fascination/M
+fascism/M
+fascist/MS
+fascistic
+fashion/ZGBMDRS
+fashionable/U
+fashionably/U
+fashioner/M
+fashionista/MS
+fast/MDRTGSP
+fastback/SM
+fastball/SM
+fasten/UAGDS
+fastener/SM
+fastening/MS
+fastidious/PY
+fastidiousness/M
+fastness/MS
+fat/GSPMD
+fatal/Y
+fatalism/M
+fatalist/SM
+fatalistic
+fatalistically
+fatality/SM
+fatback/M
+fate/MS
+fateful/YP
+fatefulness/M
+fathead/MDS
+father/SGMDY
+fatherhood/M
+fatherland/MS
+fatherless
+fathom/SMDGB
+fathomable/U
+fathomless
+fatigue/MDSG
+fatigues/M
+fatness/M
+fatso/S
+fatten/SDG
+fatter
+fattest
+fattiness/M
+fatty/RSMTP
+fatuity/M
+fatuous/YP
+fatuousness/M
+fatwa/SM
+faucet/SM
+fault/CSMDG
+faultfinder/SM
+faultfinding/M
+faultily
+faultiness/M
+faultless/PY
+faultlessness/M
+faulty/PRT
+faun/MS
+fauna/SM
+fauvism/M
+fauvist/SM
+faux
+fave/S
+favor/ESMDG
+favorable/U
+favorably/U
+favorite/SM
+favoritism/M
+fawn/MDRZGS
+fawner/M
+fax/GMDS
+fay/TSMR
+faze/GDS
+fazed/U
+fealty/M
+fear/MDGS
+fearful/YP
+fearfulness/M
+fearless/PY
+fearlessness/M
+fearsome
+feasibility/M
+feasible/IU
+feasibly
+feast/SMDRZG
+feaster/M
+feat/MS
+feather/SGMD
+featherbedding/M
+featherbrained
+featherless
+featherweight/MS
+feathery/TR
+feature/DSMG
+featureless
+febrile
+fecal
+feces/M
+feckless/PY
+fecund
+fecundate/GNDS
+fecundation/M
+fecundity/M
+fed/SM
+federal/SMY
+federalism/M
+federalist/MS
+federalization/M
+federalize/GDS
+federate/FXDSGN
+federation/FM
+fedora/SM
+fee/SM
+feeble/RTP
+feebleness/M
+feebly
+feed/MRZGSJ
+feedback/M
+feedbag/SM
+feeder/M
+feeding/M
+feedlot/SM
+feel/MRZGSJ
+feeler/M
+feelgood
+feeling/MY
+feet
+feign/SDG
+feigned/U
+feint/SMDG
+feisty/TR
+feldspar/M
+felicitate/GNXDS
+felicitation/M
+felicitous/Y
+felicity/ISM
+feline/SM
+fell/MDRZTGS
+fella/S
+fellatio/M
+fellow/SM
+fellowman/M
+fellowmen
+fellowship/MS
+felon/SM
+felonious
+felony/SM
+felt/MDGS
+fem
+female/PSM
+femaleness/M
+feminine/SMY
+femininity/M
+feminism/M
+feminist/SM
+feminize/DSG
+femoral
+femur/SM
+fen/SM
+fence/DRSMZG
+fencer/M
+fencing/M
+fend/CDRZGS
+fender/CM
+fenestration/M
+fennel/M
+fentanyl/M
+feral
+ferment/FCMS
+fermentation/M
+fermented
+fermenting
+fermium/M
+fern/MS
+ferny/RT
+ferocious/PY
+ferociousness/M
+ferocity/M
+ferret/GSMD
+ferric
+ferromagnetic
+ferromagnetism
+ferrous
+ferrule/MS
+ferry/DSMG
+ferryboat/SM
+ferryman/M
+ferrymen
+fertile/I
+fertility/IM
+fertilization/M
+fertilize/DRSZG
+fertilized/U
+fertilizer/M
+ferule/SM
+fervency/M
+fervent/Y
+fervid/Y
+fervor/M
+fess/FKGSD
+fest/MRZVS
+festal
+fester/GMD
+festival/SM
+festive/YP
+festiveness/M
+festivity/SM
+festoon/GMDS
+feta/M
+fetal
+fetch/DRSZG
+fetcher/M
+fetching/Y
+fete/MGDS
+fetid/P
+fetidness/M
+fetish/MS
+fetishism/M
+fetishist/SM
+fetishistic
+fetlock/MS
+fetter's
+fetter/USGD
+fettle/M
+fettuccine/M
+fetus/MS
+feud/MDGS
+feudal
+feudalism/M
+feudalistic
+fever/SMD
+feverish/YP
+feverishness/M
+few/TPMR
+fewness/M
+fey
+fez/M
+fezzes
+ff
+fiance/CM
+fiancee/MS
+fiances
+fiasco/M
+fiascoes
+fiat/MS
+fib/ZSMR
+fibbed
+fibber/SM
+fibbing
+fiber/M
+fiberboard/M
+fiberfill/M
+fiberglass/M
+fibril/SM
+fibrillate/GNDS
+fibrillation/M
+fibrin/M
+fibroid
+fibrosis/M
+fibrous
+fibula/M
+fibulae
+fibular
+fiche/SM
+fichu/SM
+fickle/RPT
+fickleness/M
+fiction/MS
+fictional/Y
+fictionalization/SM
+fictionalize/DSG
+fictitious/Y
+fictive
+ficus/M
+fiddle/DRSMZG
+fiddler/M
+fiddlesticks
+fiddly/TR
+fidelity/IM
+fidget/SGMD
+fidgety
+fiduciary/SM
+fie
+fief/MS
+fiefdom/MS
+field/ISMRZ
+fielded
+fielder/IM
+fielding
+fieldsman
+fieldsmen
+fieldwork/MRZ
+fieldworker/M
+fiend/SM
+fiendish/Y
+fierce/PRYT
+fierceness/M
+fieriness/M
+fiery/RPT
+fiesta/SM
+fife/MZRS
+fifer/M
+fifteen/MHS
+fifteenth/M
+fifteenths
+fifth/MY
+fifths
+fiftieth/M
+fiftieths
+fifty/SMH
+fig/SLM
+fight/SMRZG
+fightback
+fighter/IMS
+fighting/IM
+figment/MS
+figuration/FM
+figurative/Y
+figure's
+figure/FEGSD
+figurehead/SM
+figurine/MS
+filament/MS
+filamentous
+filbert/MS
+filch/DSG
+file's/KC
+file/CAKGDS
+filename/S
+filer/CSM
+filet
+filial
+filibuster/MDRSZG
+filibusterer/M
+filigree/DSM
+filigreeing
+filing's
+filings
+fill's
+fill/AIDGS
+filled/U
+filler/MS
+fillet/MDGS
+filling/SM
+fillip/MDGS
+filly/SM
+film/MDGS
+filminess/M
+filmmaker/SM
+filmstrip/MS
+filmy/TPR
+filo
+filter/MDRBSZG
+filtered/U
+filterer/M
+filth/M
+filthily
+filthiness/M
+filthy/RPT
+filtrate's
+filtrate/IGNDS
+filtration/IM
+fin/SMR
+finagle/DRSZG
+finagler/M
+final/SMY
+finale/MS
+finalist/SM
+finality/M
+finalization/M
+finalize/DSG
+finance's
+finance/ADSG
+financial/Y
+financier/MS
+financing/M
+finch/MS
+find/JMRZGS
+finder/M
+finding/M
+findings/M
+fine's/F
+fine/CAFTGDS
+finely
+fineness/M
+finery/AM
+finespun
+finesse/DSMG
+finger/MDGSJ
+fingerboard/SM
+fingering/M
+fingerling/SM
+fingermark/S
+fingernail/SM
+fingerprint/SGMD
+fingertip/MS
+finial/MS
+finical
+finickiness/M
+finicky/RPT
+finis/MS
+finish's
+finish/ADSG
+finished/U
+finisher/MS
+finite/IY
+fink/MDGS
+finned
+finny
+fir/ZGSJMDRH
+fire/MS
+firearm/SM
+fireball/MS
+firebomb/MDSJG
+firebox/MS
+firebrand/SM
+firebreak/SM
+firebrick/SM
+firebug/SM
+firecracker/SM
+firedamp/M
+firefight/MRSZG
+firefighter/M
+firefighting/M
+firefly/SM
+fireguard/S
+firehouse/SM
+firelight/ZMR
+fireman/M
+firemen
+fireplace/SM
+fireplug/MS
+firepower/M
+fireproof/DSG
+firer/M
+firescreen/S
+fireside/MS
+firestorm/MS
+firetrap/MS
+firetruck/MS
+firewall/MS
+firewater/M
+firewood/M
+firework/SM
+firm/MDRYPTGS
+firmament/SM
+firmness/M
+firmware/M
+first/SMY
+firstborn/SM
+firsthand
+firth/M
+firths
+fiscal/MYS
+fish/MDRSZG
+fishbowl/SM
+fishcake/SM
+fisher/M
+fisherman/M
+fishermen
+fishery/SM
+fishhook/SM
+fishily
+fishiness/M
+fishing/M
+fishmonger/MS
+fishnet/SM
+fishpond/MS
+fishtail/DGS
+fishwife/M
+fishwives
+fishy/TRP
+fissile
+fission/BM
+fissure/SM
+fist/MS
+fistfight/MS
+fistful/SM
+fisticuffs/M
+fistula/SM
+fistulous/M
+fit/KAMS
+fitful/YP
+fitfulness/M
+fitly
+fitment/S
+fitness/UM
+fitted/UA
+fitter/MS
+fittest
+fitting/SMY
+five/MZRS
+fix/ZGBJMDRS
+fixate/GNVDSX
+fixation/M
+fixative/MS
+fixed/Y
+fixer/M
+fixings/M
+fixity/M
+fixture/MS
+fizz/MDSG
+fizzle/DSMG
+fizzy/RT
+fjord/SM
+fl/JDG
+flab/M
+flabbergast/SGD
+flabbily
+flabbiness/M
+flabby/RPT
+flaccid/Y
+flaccidity/M
+flack/SM
+flag/MS
+flagella
+flagellant/S
+flagellate/GNDS
+flagellation/M
+flagellum/M
+flagged
+flagging/U
+flagman/M
+flagmen
+flagon/MS
+flagpole/SM
+flagrance/M
+flagrancy/M
+flagrant/Y
+flagship/SM
+flagstaff/MS
+flagstone/MS
+flail/SGMD
+flair/SM
+flak/M
+flake/DSMG
+flakiness/M
+flaky/TRP
+flamage
+flambe/MS
+flambeed
+flambeing
+flamboyance/M
+flamboyancy/M
+flamboyant/Y
+flame/DRSJMZG
+flamenco/MS
+flameproof/DGS
+flamethrower/SM
+flamingo/MS
+flammability/IM
+flammable/SM
+flan/MS
+flange/MS
+flank/SZGMDR
+flanker/M
+flannel/SGMD
+flannelette/M
+flap/MS
+flapjack/MS
+flapped
+flapper/SM
+flapping
+flare/DSMG
+flareup/SM
+flash/ZTGMDRS
+flashback/SM
+flashbulb/SM
+flashcard/SM
+flashcube/SM
+flasher/M
+flashgun/SM
+flashily
+flashiness/M
+flashing/M
+flashlight/MS
+flashy/RTP
+flask/SM
+flat/MYPS
+flatbed/SM
+flatboat/SM
+flatbread
+flatcar/SM
+flatfeet
+flatfish/MS
+flatfoot/SMD
+flatiron/SM
+flatland/M
+flatlet/S
+flatmate/S
+flatness/M
+flatted
+flatten/SDG
+flatter/SDRZG
+flatterer/M
+flattering/Y
+flattery/M
+flattest
+flatting
+flattish
+flattop/SM
+flatulence/M
+flatulent
+flatus/M
+flatware/M
+flatworm/SM
+flaunt/MDSG
+flaunting/Y
+flavor/MDSGJ
+flavored/U
+flavorful
+flavoring/M
+flavorless
+flavorsome
+flaw/MDGS
+flawless/PY
+flawlessness/M
+flax/MN
+flay/DGS
+flea/MS
+fleabag/SM
+fleabite/S
+fleapit/S
+fleck/SGMD
+fledged/U
+fledgling/MS
+flee/S
+fleece/MZGDRS
+fleecer/M
+fleeciness/M
+fleecy/RTP
+fleeing
+fleet/STGMDRYP
+fleetingly/M
+fleetingness/M
+fleetness/M
+flesh/GMDSY
+fleshly/TR
+fleshpot/MS
+fleshy/RT
+flew
+flex/AMS
+flexed
+flexibility/IM
+flexible/I
+flexibly/I
+flexing
+flexion
+flextime/M
+flibbertigibbet/SM
+flick/SZGMDR
+flicker/GMD
+flier/M
+flight/MS
+flightiness/M
+flightless
+flighty/PTR
+flimflam/SM
+flimflammed
+flimflamming
+flimsily
+flimsiness/M
+flimsy/TRP
+flinch/GMDS
+fling/GM
+flint/SM
+flintlock/SM
+flinty/TR
+flip/MS
+flippancy/M
+flippant/Y
+flipped
+flipper/MS
+flippest
+flipping
+flippy/S
+flirt/SGMD
+flirtation/MS
+flirtatious/YP
+flirtatiousness/M
+flirty
+flit/MS
+flitted
+flitting
+float/SMDRZG
+floater/M
+flock/SMDG
+flocking/M
+floe/MS
+flog/S
+flogged
+flogger/SM
+flogging/MS
+flood/SMDRG
+floodgate/MS
+floodlight/MDSG
+floodlit
+floodplain/MS
+floodwater/MS
+floor/SMDG
+floorboard/MS
+flooring/M
+floorwalker/SM
+floozy/SM
+flop/MS
+flophouse/MS
+flopped
+floppily
+floppiness/M
+flopping
+floppy/PRSMT
+flora/SM
+floral
+florescence/IM
+florescent/I
+floret/SM
+florid/PY
+floridness/M
+florin/SM
+florist/SM
+floss/MDSG
+flossy/RT
+flotation/SM
+flotilla/MS
+flotsam/M
+flounce/DSMG
+flouncy
+flounder/MDSG
+flour/SMDG
+flourish/GMDS
+floury
+flout/SMDRZG
+flouter/M
+flow/MDGS
+flowchart/SM
+flower's
+flower/CSDG
+flowerbed/MS
+floweriness/M
+flowering/S
+flowerless
+flowerpot/MS
+flowery/PTR
+flown
+flt
+flu/M
+flub/MS
+flubbed
+flubbing
+fluctuate/GNDSX
+fluctuation/M
+flue/MS
+fluency/M
+fluent/Y
+fluff/SMDG
+fluffiness/M
+fluffy/RPT
+fluid/SMY
+fluidity/M
+fluke/SM
+fluky/RT
+flume/SM
+flummox/DSG
+flung
+flunk/SMDG
+flunky/SM
+fluoresce/DSG
+fluorescence/M
+fluorescent
+fluoridate/GNDS
+fluoridation/M
+fluoride/SM
+fluorine/M
+fluorite/M
+fluorocarbon/MS
+fluoroscope/SM
+fluoroscopic
+fluoxetine
+flurry/GDSM
+flush/MDRSTG
+fluster/MDSG
+flute/DSMG
+fluting/M
+flutist/MS
+flutter/MDSG
+fluttery
+fluvial
+flux/IMS
+fluxed
+fluxing
+fly/ZTGBDRSM
+flyaway
+flyblown
+flyby/M
+flybys
+flycatcher/MS
+flying/M
+flyleaf/M
+flyleaves
+flyover/MS
+flypaper/SM
+flypast/S
+flysheet/S
+flyspeck/GMDS
+flyswatter/MS
+flytrap/S
+flyway/SM
+flyweight/SM
+flywheel/MS
+foal/MDGS
+foam/MDGS
+foaminess/M
+foamy/RTP
+fob/SM
+fobbed
+fobbing
+focal/Y
+focus's
+focus/ADSG
+focused/U
+fodder/SM
+foe/SM
+fog's
+fog/CS
+fogbound
+fogged/C
+foggily
+fogginess/M
+fogging/C
+foggy/RTP
+foghorn/MS
+fogy/SM
+fogyish
+foible/SM
+foil/MDGS
+foist/SDG
+fol
+fold's
+fold/AUSGD
+foldaway
+folder/SM
+foldout/MS
+foliage/M
+folic
+folio/SM
+folk/MS
+folklore/M
+folkloric
+folklorist/MS
+folksiness/M
+folksinger/SM
+folksinging/M
+folksy/PTR
+folktale/MS
+folkway/MS
+foll
+follicle/MS
+follow/SDRZGJ
+follower/M
+following/M
+followup/S
+folly/SM
+foment/SGD
+fomentation/M
+fond/RYTP
+fondant/MS
+fondle/DSG
+fondness/M
+fondue/SM
+font/MS
+fontanel/MS
+foo
+foobar
+food/MS
+foodie/SM
+foodstuff/SM
+fool/MDGS
+foolery/SM
+foolhardily
+foolhardiness/M
+foolhardy/TPR
+foolish/YP
+foolishness/M
+foolproof
+foolscap/M
+foot/MDRZGSJ
+footage/M
+football/MRZGS
+footballer/M
+footbridge/SM
+footfall/MS
+foothill/MS
+foothold/MS
+footie
+footing/M
+footless
+footlights/M
+footling/MS
+footlocker/SM
+footloose
+footman/M
+footmen
+footnote/MGDS
+footpath/M
+footpaths
+footplate/S
+footprint/SM
+footrace/MS
+footrest/MS
+footsie/SM
+footslogging
+footsore
+footstep/MS
+footstool/SM
+footwear/M
+footwork/M
+footy
+fop/SM
+foppery/M
+foppish/P
+foppishness/M
+for/H
+fora
+forage/DRSMZG
+forager/M
+foray/SMDG
+forbade
+forbear/SMG
+forbearance/M
+forbid/S
+forbidden
+forbidding/YS
+forbore
+forborne
+force/DSMG
+forced/U
+forceful/PY
+forcefulness/M
+forceps/M
+forcible
+forcibly
+ford/MDGSB
+fore/MS
+forearm/GSMD
+forebear/MS
+forebode/GJDS
+foreboding/M
+forecast/MRZGS
+forecaster/M
+forecastle/MS
+foreclose/DSG
+foreclosure/MS
+forecourt/SM
+foredoom/DGS
+forefather/MS
+forefeet
+forefinger/SM
+forefoot/M
+forefront/SM
+forego/G
+foregoes
+foregone
+foreground/GMDS
+forehand/MS
+forehead/MS
+foreign/ZRP
+foreigner/M
+foreignness/M
+foreknew
+foreknow/GS
+foreknowledge/M
+foreknown
+foreleg/SM
+forelimb/MS
+forelock/MS
+foreman/M
+foremast/MS
+foremen
+foremost
+forename/MDS
+forenoon/MS
+forensic/MS
+forensically
+forensics/M
+foreordain/GSD
+forepart/MS
+foreperson/SM
+foreplay/M
+forequarter/MS
+forerunner/MS
+foresail/MS
+foresaw
+foresee/RSBZ
+foreseeable/U
+foreseeing
+foreseen/U
+foreseer/M
+foreshadow/GDS
+foreshore/S
+foreshorten/DSG
+foresight/MD
+foresightedness/M
+foreskin/MS
+forest's
+forest/ACGDS
+forestall/SGD
+forestation/ACM
+forester/MS
+forestland/M
+forestry/M
+foretaste/DSMG
+foretell/GS
+forethought/M
+foretold
+forever/M
+forevermore
+forewarn/DSG
+forewent
+forewoman/M
+forewomen
+foreword/MS
+forfeit/GSMD
+forfeiture/SM
+forgather/SDG
+forgave
+forge/DRSMZGVJ
+forger/M
+forgery/SM
+forget/S
+forgetful/YP
+forgetfulness/M
+forgettable/U
+forgetting
+forging/M
+forgivable/U
+forgive/BRSZGP
+forgiven
+forgiveness/M
+forgiver/M
+forgiving/U
+forgo/RZG
+forgoer/M
+forgoes
+forgone
+forgot
+forgotten/U
+fork/MDGS
+forkful/SM
+forklift/MS
+forlorn/Y
+form's
+form/CAIFDGS
+formal/SMY
+formaldehyde/M
+formalin
+formalism/M
+formalist/MS
+formalities
+formality/IM
+formalization/M
+formalize/GDS
+format/SMV
+formation/CFASM
+formatted/A
+formatting/M
+formed/U
+former/FIAM
+formerly
+formfitting
+formic
+formidable
+formidably
+formless/PY
+formlessness/M
+formula/MS
+formulae
+formulaic
+formulate/ADSGNX
+formulated/U
+formulation/AM
+formulator/SM
+fornicate/GNDS
+fornication/M
+fornicator/MS
+forsake/GS
+forsaken
+forsook
+forsooth
+forswear/SG
+forswore
+forsworn
+forsythia/SM
+fort/MS
+forte/SM
+forthcoming/M
+forthright/YP
+forthrightness/M
+forthwith
+fortieth/M
+fortieths
+fortification/M
+fortified/U
+fortifier/M
+fortify/DRSNZGX
+fortissimo
+fortitude/M
+fortnight/MYS
+fortress/MS
+fortuitous/YP
+fortuitousness/M
+fortuity/M
+fortunate/UY
+fortune/MS
+fortuneteller/SM
+fortunetelling/M
+forty/SMH
+forum/SM
+forward/MDRYZTGSP
+forwarder/M
+forwardness/M
+forwent
+fossa
+fossil/SM
+fossilization/M
+fossilize/GDS
+foster/GSD
+fought
+foul/MDRYTGSP
+foulard/M
+foulmouthed
+foulness/M
+found/FSDG
+foundation/SM
+foundational
+founded/U
+founder/GMDS
+foundling/SM
+foundry/SM
+fount/SM
+fountain/SM
+fountainhead/MS
+four/MHS
+fourfold
+fourposter/SM
+fourscore/M
+foursome/SM
+foursquare
+fourteen/SMH
+fourteenth/M
+fourteenths
+fourth/MY
+fourths
+fowl/MDGS
+fox/GMDS
+foxfire/M
+foxglove/SM
+foxhole/MS
+foxhound/SM
+foxhunt/GS
+foxily
+foxiness/M
+foxtrot/MS
+foxtrotted
+foxtrotting
+foxy/RTP
+foyer/SM
+fps
+fr
+fracas/MS
+frack/SDG
+fractal/SM
+fraction/ISM
+fractional/Y
+fractious/YP
+fractiousness/M
+fracture/MGDS
+frag/S
+fragile/RT
+fragility/M
+fragment/GMDS
+fragmentary/M
+fragmentation/M
+fragrance/MS
+fragrant/Y
+frail/RYTP
+frailness/M
+frailty/SM
+frame/DRSMZG
+framed/U
+framer/M
+framework/SM
+franc/SM
+franchise's
+franchise/EDSG
+franchisee/SM
+franchiser/SM
+francium/M
+francophone
+frangibility/M
+frangible
+frank/SMDRYTGP
+frankfurter/MS
+frankincense/M
+frankness/M
+frantic
+frantically
+frappe/SM
+frat/MS
+fraternal/Y
+fraternity/FSM
+fraternization/M
+fraternize/ZGDRS
+fraternizer/M
+fratricidal
+fratricide/MS
+fraud's
+fraud/S
+fraudster/S
+fraudulence/M
+fraudulent/Y
+fraught
+fray's
+fray/CDGS
+frazzle/MGDS
+freak/SMDG
+freakish/YP
+freakishness/M
+freaky/RT
+freckle/DSMG
+freckly
+free/YTDRS
+freebase/MGDS
+freebie/SM
+freebooter/SM
+freeborn
+freedman/M
+freedmen
+freedom/SM
+freehand
+freehold/ZMRS
+freeholder/M
+freeing
+freelance/DRSMZG
+freelancer/M
+freeload/SDRZG
+freeloader/M
+freeman/M
+freemasonry
+freemen
+freephone
+freesia/S
+freestanding
+freestone/SM
+freestyle/SM
+freethinker/SM
+freethinking/M
+freeware/M
+freeway/MS
+freewheel/DGS
+freewill
+freezable
+freeze's
+freeze/UAGS
+freezer/MS
+freezing's
+freight/MDRZGS
+freighter/M
+french
+frenemy/S
+frenetic
+frenetically
+frenzied/Y
+frenzy/DSM
+freq
+frequencies
+frequency/IM
+frequent/DRYSZTG
+frequented/U
+frequenter/M
+fresco/M
+frescoes
+fresh/PNRYXZT
+freshen/ZGDR
+freshener/M
+freshet/MS
+freshman/M
+freshmen
+freshness/M
+freshwater/M
+fret/MS
+fretful/YP
+fretfulness/M
+fretsaw/MS
+fretted
+fretting
+fretwork/M
+friable
+friar/SM
+friary/SM
+fricassee/DSM
+fricasseeing
+fricative/SM
+friction/SM
+frictional
+fridge/SM
+friedcake/MS
+friend's
+friend/UGSDY
+friendless
+friendlies
+friendliness/UM
+friendly's
+friendly/UPTR
+friendship/MS
+frieze/SM
+frig/S
+frigate/MS
+frigged
+frigging
+fright/SXGMDN
+frighten/DG
+frightening/Y
+frightful/PY
+frightfulness/M
+frigid/YP
+frigidity/M
+frigidness/M
+frill/SMD
+frilly/TR
+fringe's
+fringe/IDSG
+frippery/SM
+frisk/SDG
+friskily
+friskiness/M
+frisky/TRP
+frisson/S
+fritter/MDSG
+fritz/M
+frivolity/SM
+frivolous/PY
+frivolousness/M
+frizz/MDSYG
+frizzle/MGDS
+frizzy/TR
+fro
+frock's
+frock/CUS
+frog/MS
+frogging/S
+frogman/M
+frogmarch/GDS
+frogmen
+frogspawn
+frolic/SM
+frolicked
+frolicker/SM
+frolicking
+frolicsome
+from
+frond/SM
+front's
+front/FSDG
+frontage/MS
+frontal/Y
+frontbench/ZRS
+frontier/MS
+frontiersman/M
+frontiersmen
+frontierswoman
+frontierswomen
+frontispiece/MS
+frontward/S
+frosh/M
+frost's
+frost/CSDG
+frostbit
+frostbite/MGS
+frostbitten
+frostily
+frostiness/M
+frosting/SM
+frosty/TPR
+froth/MDG
+frothiness/M
+froths
+frothy/TPR
+froufrou/M
+frown/SMDG
+frowzily
+frowziness/M
+frowzy/TPR
+froze/AU
+frozen/UA
+fructify/DSG
+fructose/M
+frugal/Y
+frugality/M
+fruit/SMDG
+fruitcake/MS
+fruiterer/S
+fruitful/YP
+fruitfulness/M
+fruitiness/M
+fruition/M
+fruitless/PY
+fruitlessness/M
+fruity/TPR
+frump/SM
+frumpish
+frumpy/TR
+frustrate/GNXDS
+frustrating/Y
+frustration/M
+frustum/MS
+fry/GDSM
+fryer/SM
+ft
+ftp/ZGS
+fuchsia/MS
+fuck/SMGDRZ!
+fucker/M!
+fuckhead/S!
+fuddle/DSMG
+fudge/DSMG
+fuehrer/MS
+fuel's
+fuel/ADGS
+fug
+fugal
+fuggy
+fugitive/MS
+fugue/SM
+fuhrer/SM
+fulcrum/MS
+fulfill/LDGS
+fulfilled/U
+fulfilling/U
+fulfillment/M
+full/MDRZTGSP
+fullback/MS
+fuller/M
+fullness/M
+fully
+fulminate/DSXGN
+fulmination/M
+fulsome/PY
+fulsomeness/M
+fum/S
+fumble/DRSMZG
+fumbler/M
+fumbling/Y
+fume/MGDS
+fumigant/MS
+fumigate/GNDS
+fumigation/M
+fumigator/SM
+fumy/RT
+fun/M
+function/MDGS
+functional/Y
+functionalism
+functionalist/S
+functionality/S
+functionary/SM
+functor
+fund/AMDGS
+fundamental/SMY
+fundamentalism/M
+fundamentalist/SM
+funded/U
+funding/M
+fundraiser/MS
+fundraising
+funeral/MS
+funerary
+funereal/Y
+funfair/S
+fungal
+fungi
+fungible/MS
+fungicidal
+fungicide/MS
+fungoid
+fungous
+fungus/M
+funicular/SM
+funk/MDGS
+funkiness/M
+funky/PRT
+funnel/MDGS
+funner
+funnest
+funnily
+funniness/M
+funny/TPRSM
+funnyman/M
+funnymen
+fur/SM
+furbelow/M
+furbish/ADSG
+furious/Y
+furl's
+furl/UDGS
+furlong/SM
+furlough/GMD
+furloughs
+furn
+furnace/SM
+furnish/ADSG
+furnished/U
+furnishings/M
+furniture/M
+furor/SM
+furosemide
+furred
+furrier/M
+furriness/M
+furring/M
+furrow/MDSG
+furry/ZTRP
+further/SGD
+furtherance/M
+furthermore
+furthermost
+furthest
+furtive/YP
+furtiveness/M
+fury/SM
+furze/M
+fuse's/A
+fuse/CAIFGDS
+fusee/SM
+fuselage/SM
+fusibility/M
+fusible
+fusilier/SM
+fusillade/MS
+fusion/IFKSM
+fuss/MDSG
+fussbudget/MS
+fussily
+fussiness/M
+fusspot/SM
+fussy/TRP
+fustian/M
+fustiness/M
+fusty/TRP
+fut
+futile/Y
+futility/M
+futon/SM
+future/MS
+futurism/M
+futurist/MS
+futuristic
+futurity/SM
+futurologist/MS
+futurology/M
+futz/DSG
+fuzz/MDSG
+fuzzball/S
+fuzzily
+fuzziness/M
+fuzzy/PTR
+fwd
+fwy
+g/SNXVB
+gab/SM
+gabardine/SM
+gabbed
+gabbiness/M
+gabbing
+gabble/DSMG
+gabby/RTP
+gaberdine/SM
+gabfest/MS
+gable/DSM
+gad/S
+gadabout/SM
+gadded
+gadder/SM
+gadding
+gadfly/SM
+gadget/SM
+gadgetry/M
+gadolinium/M
+gaff/MDRZGS
+gaffe/SM
+gaffer/M
+gag/SM
+gaga
+gagged
+gagging
+gaggle/SM
+gaiety/M
+gaily
+gain's
+gain/ADGS
+gainer/SM
+gainful/Y
+gainsaid
+gainsay/ZGRS
+gainsayer/M
+gait/MRZS
+gaiter/M
+gal/SM
+gala/MS
+galactic
+galaxy/SM
+gale's
+gale/AS
+galena/M
+gall/MDGS
+gallant/SMY
+gallantry/M
+gallbladder/MS
+galleon/SM
+galleria/MS
+gallery/SM
+galley/SM
+gallimaufry/SM
+gallium/M
+gallivant/GSD
+gallon/SM
+gallop/SMDG
+gallows/M
+gallstone/MS
+galoot/SM
+galore
+galosh/MS
+galumph/DG
+galumphs
+galvanic
+galvanism/M
+galvanization/M
+galvanize/DSG
+galvanometer/MS
+gambit/SM
+gamble/DRSMZG
+gambler/M
+gambling/M
+gambol/SMDG
+game/MYTGDRSP
+gamecock/MS
+gamekeeper/MS
+gameness/M
+gamesmanship/M
+gamester/MS
+gamete/SM
+gametic
+gamin/SM
+gamine/SM
+gaminess/M
+gaming/M
+gamma/SM
+gammon/M
+gammy
+gamut/SM
+gamy/RTP
+gander/SM
+gang/MDGS
+gangbusters/M
+gangland/M
+ganglia
+gangling
+ganglion/M
+ganglionic
+gangplank/SM
+gangrene/DSMG
+gangrenous
+gangsta/S
+gangster/SM
+gangway/MS
+ganja
+gannet/SM
+gantlet/MS
+gantry/SM
+gap/GSMD
+gape/MS
+gar/SLM
+garage/DSMG
+garb/MDGS
+garbage/M
+garbageman
+garbanzo/SM
+garble/DSG
+garcon/SM
+garden/SZGMDR
+gardener/M
+gardenia/MS
+gardening/M
+garfish/MS
+gargantuan
+gargle/DSMG
+gargoyle/SM
+garish/PY
+garishness/M
+garland/MDGS
+garlic/M
+garlicky
+garment/MS
+garner/SGD
+garnet/SM
+garnish/GLMDS
+garnishee/DSM
+garnisheeing
+garnishment/SM
+garret/SM
+garrison/MDSG
+garrote/MZGDRS
+garroter/M
+garrulity/M
+garrulous/PY
+garrulousness/M
+garter/SM
+gas's
+gas/CS
+gasbag/SM
+gaseous
+gash/MDSG
+gasholder/S
+gasket/SM
+gaslight/MS
+gasman
+gasmen
+gasohol/M
+gasoline/M
+gasometer/S
+gasp/MDGS
+gassed/C
+gasses
+gassing/C
+gassy/RT
+gastric
+gastritis/M
+gastroenteritis/M
+gastrointestinal
+gastronome/S
+gastronomic
+gastronomical/Y
+gastronomy/M
+gastropod/SM
+gasworks/M
+gate/MGDS
+gateau
+gateaux
+gatecrash/DRSZG
+gatecrasher/M
+gatehouse/SM
+gatekeeper/MS
+gatepost/MS
+gateway/MS
+gather/SJZGMDR
+gatherer/M
+gathering/M
+gator/SM
+gauche/RPYT
+gaucheness/M
+gaucherie/M
+gaucho/SM
+gaudily
+gaudiness/M
+gaudy/RPT
+gauge/DSMG
+gaunt/RPT
+gauntlet/MS
+gauntness/M
+gauze/M
+gauziness/M
+gauzy/RPT
+gave
+gavel/SM
+gavotte/MS
+gawd
+gawk/DGS
+gawkily
+gawkiness/M
+gawky/RPT
+gawp/DGS
+gay/TSPMR
+gayness/M
+gaze/MZGDRS
+gazebo/SM
+gazelle/MS
+gazer/M
+gazette/MGDS
+gazetteer/MS
+gazillion/S
+gazpacho/M
+gazump/DGS
+gear/MDGS
+gearbox/MS
+gearing/M
+gearshift/MS
+gearwheel/SM
+gecko/SM
+geddit
+gee/DS
+geeing
+geek/MS
+geeky/RT
+geese
+geezer/MS
+geisha/M
+gel/SM
+gelatin/M
+gelatinous
+gelcap/M
+geld/DJGS
+gelding/M
+gelid
+gelignite/M
+gelled
+gelling
+gem/SM
+gemological
+gemologist/MS
+gemology/M
+gemstone/MS
+gendarme/MS
+gender/MDS
+gene/MS
+genealogical/Y
+genealogist/MS
+genealogy/SM
+genera
+general/SMY
+generalissimo/MS
+generalist/MS
+generality/SM
+generalization/MS
+generalize/GDS
+generalship/M
+generate/CAVNGSD
+generation/ACM
+generational
+generations
+generator/SM
+generic/SM
+generically
+generosity/SM
+generous/PY
+generousness/M
+genes/S
+genesis/M
+genetic/S
+genetically
+geneticist/MS
+genetics/M
+genial/FY
+geniality/FM
+geniculate
+genie/SM
+genii
+genital/FY
+genitalia/M
+genitals/M
+genitive/MS
+genitourinary
+genius/MS
+genned
+genning
+genocidal
+genocide/MS
+genome/MS
+genomics
+genre/SM
+gent/AMS
+genteel/YP
+genteelness/M
+gentian/SM
+gentile/SM
+gentility/M
+gentle/TGDRSP
+gentlefolk/MS
+gentlefolks/M
+gentleman/MY
+gentlemanly/U
+gentlemen
+gentleness/M
+gentlewoman/M
+gentlewomen
+gently
+gentrification/M
+gentrify/DSGN
+gentry/SM
+genuflect/DGS
+genuflection/MS
+genuine/PY
+genuineness/M
+genus/M
+geocache/DSG
+geocentric
+geocentrically
+geochemistry/M
+geode/SM
+geodesic/SM
+geodesy/M
+geodetic
+geoengineering
+geog
+geographer/SM
+geographic
+geographical/Y
+geography/SM
+geologic
+geological/Y
+geologist/MS
+geology/SM
+geom
+geomagnetic
+geomagnetism/M
+geometer
+geometric
+geometrical/Y
+geometry/SM
+geophysical
+geophysicist/SM
+geophysics/M
+geopolitical
+geopolitics/M
+geostationary
+geosynchronous
+geosyncline/MS
+geothermal
+geothermic
+geranium/MS
+gerbil/MS
+geriatric/S
+geriatrician/S
+geriatrics/M
+germ/MS
+germane
+germanium/M
+germicidal
+germicide/MS
+germinal/M
+germinate/GNDS
+germination/M
+gerontological
+gerontologist/MS
+gerontology/M
+gerrymander/GMDS
+gerrymandering/M
+gerund/MS
+gestalt/S
+gestapo/MS
+gestate/GNDS
+gestation/M
+gestational
+gesticulate/DSGNX
+gesticulation/M
+gestural
+gesture/MGDS
+gesundheit
+get/S
+getaway/SM
+getting
+getup/M
+gewgaw/SM
+geyser/SM
+ghastliness/M
+ghastly/TPR
+ghat/MS
+ghee
+gherkin/MS
+ghetto/SM
+ghettoize/GDS
+ghost/SMDYG
+ghostliness/M
+ghostly/RTP
+ghostwrite/ZGRS
+ghostwriter/M
+ghostwritten
+ghostwrote
+ghoul/SM
+ghoulish/YP
+ghoulishness/M
+giant/SM
+giantess/MS
+gibber/GDS
+gibberish/M
+gibbet/GMDS
+gibbon/MS
+gibbous
+gibe/MGDS
+giblet/SM
+giddily
+giddiness/M
+giddy/RTP
+gift/MDGS
+gig/SM
+gigabit/SM
+gigabyte/MS
+gigagram/S
+gigahertz/M
+gigajoule/S
+gigameter/S
+gigantic
+gigantically
+gigapascal/S
+gigapixel/MS
+gigawatt/SM
+gigged
+gigging
+giggle/DRSMZG
+giggler/M
+giggly/RT
+gigolo/SM
+gild/MDRZGS
+gilder/M
+gilding/M
+gill/MS
+gillie/S
+gillion/S
+gilt/MS
+gimbals/M
+gimcrack/SM
+gimcrackery/M
+gimlet/GSMD
+gimme/SM
+gimmick/MS
+gimmickry/M
+gimmicky
+gimp/MDGS
+gimpy
+gin/SM
+ginger/GSMDY
+gingerbread/M
+gingersnap/SM
+gingery
+gingham/M
+gingivitis/M
+ginkgo/M
+ginkgoes
+ginned
+ginning
+ginormous
+ginseng/M
+giraffe/MS
+gird/DRZGS
+girder/M
+girdle/DSMG
+girl/MS
+girlfriend/MS
+girlhood/SM
+girlish/YP
+girlishness/M
+girly
+giro/S
+girt/MDGS
+girth/M
+girths
+gist/M
+git/S
+gite/S
+give/ZGJRS
+giveaway/MS
+giveback/MS
+given/SM
+giver/M
+gizmo/SM
+gizzard/MS
+glace/S
+glaceed
+glaceing
+glacial/Y
+glaciate/XGNDS
+glaciation/M
+glacier/MS
+glad/MYSP
+gladden/GDS
+gladder
+gladdest
+glade/SM
+gladiator/SM
+gladiatorial
+gladiola/SM
+gladioli
+gladiolus/M
+gladness/M
+gladsome
+glam
+glamorization/M
+glamorize/DSG
+glamorous/Y
+glamour/GMDS
+glance/DSMG
+gland/SM
+glandes
+glandular
+glans/M
+glare/DSMG
+glaring/Y
+glasnost/M
+glass/MDSG
+glassblower/MS
+glassblowing/M
+glassful/SM
+glasshouse/S
+glassily
+glassiness/M
+glassware/M
+glassy/RTP
+glaucoma/M
+glaze/DSMG
+glazier/SM
+glazing/M
+gleam/SMDGJ
+glean/SDRZGJ
+gleaner/M
+gleanings/M
+glee/M
+gleeful/YP
+gleefulness/M
+glen/MS
+glenohumeral
+glenoid
+glib/YP
+glibber
+glibbest
+glibness/M
+glide/DRSMZG
+glider/M
+gliding/M
+glimmer/MDGJS
+glimmering/M
+glimpse/MGDS
+glint/SMDG
+glissandi
+glissando/M
+glisten/MDSG
+glister/DSG
+glitch/GMDS
+glitter/MDSG
+glitterati
+glittery
+glitz/M
+glitzy/TR
+gloaming/SM
+gloat/SMDG
+gloating/Y
+glob/MDGS
+global/Y
+globalism/M
+globalist/MS
+globalization/M
+globalize/GDS
+globe/SM
+globetrotter/MS
+globetrotting
+globular
+globule/MS
+globulin/M
+glockenspiel/SM
+gloom/M
+gloomily
+gloominess/M
+gloomy/TRP
+glop/M
+gloppy
+glorification/M
+glorify/GDSN
+glorious/IY
+glory/DSMG
+gloss/MDSG
+glossary/SM
+glossily
+glossiness/M
+glossolalia/M
+glossy/PTRSM
+glottal
+glottis/MS
+glove/DSMG
+glow/MDRZGS
+glower/GMD
+glowing/Y
+glowworm/MS
+glucagon
+glucose/M
+glue/MGDS
+glued/U
+gluey
+gluier
+gluiest
+glum/YP
+glummer
+glummest
+glumness/M
+gluon/S
+glut/MNS
+gluten/M
+glutenous
+glutinous/Y
+glutted
+glutting
+glutton/MS
+gluttonous/Y
+gluttony/M
+glycerin/M
+glycerol/M
+glycogen/M
+glycol
+glyph
+gm
+gnarl/SMDG
+gnarly/TR
+gnash/MDSG
+gnat/MS
+gnaw/DGS
+gneiss/M
+gnocchi
+gnome/SM
+gnomic
+gnomish
+gnu/SM
+go/JMRHZG
+goad/MDGS
+goal/MS
+goalie/SM
+goalkeeper/MS
+goalkeeping/M
+goalless
+goalmouth
+goalmouths
+goalpost/MS
+goalscorer/S
+goaltender/MS
+goat/MS
+goatee/SM
+goatherd/MS
+goatskin/MS
+gob/SM
+gobbed
+gobbet/SM
+gobbing
+gobble/DRSMZG
+gobbledygook/M
+gobbler/M
+goblet/SM
+goblin/SM
+gobsmacked
+gobstopper/S
+god/SM
+godawful
+godchild/M
+godchildren/M
+goddammit
+goddamn/D
+goddaughter/MS
+goddess/MS
+godfather/SM
+godforsaken
+godhead/M
+godhood/M
+godless/PY
+godlessness/M
+godlike
+godliness/UM
+godly/URTP
+godmother/SM
+godparent/SM
+godsend/SM
+godson/SM
+godspeed
+goer/M
+goes
+gofer/SM
+goggle/DSMG
+goggles/M
+going/M
+goiter/SM
+gold/MNS
+goldbrick/ZGSMDR
+goldbricker/M
+golden/TR
+goldenrod/M
+goldfield/S
+goldfinch/MS
+goldfish/MS
+goldmine/SM
+goldsmith/M
+goldsmiths
+golf/MDRZGS
+golfer/M
+golliwog/S
+golly/SM
+gonad/SM
+gonadal
+gondola/MS
+gondolier/SM
+gone/ZR
+goner/M
+gong/MDGS
+gonk/S
+gonna
+gonorrhea/M
+gonorrheal
+gonzo
+goo/M
+goober/SM
+good/MYSP
+goodbye/MS
+goodhearted
+goodish
+goodly/TR
+goodness/M
+goodnight
+goods/M
+goodwill/M
+goody/SM
+gooey
+goof/MDGS
+goofball/SM
+goofiness/M
+goofy/RPT
+google/DSMG
+googly/S
+gooier
+gooiest
+gook/MS
+goon/MS
+goop/M
+goose/DSMG
+gooseberry/SM
+goosebumps/M
+goosestep/S
+goosestepped
+goosestepping
+gopher/SM
+gore/MGDS
+gorge's
+gorge/EDSG
+gorgeous/YP
+gorgeousness/M
+gorgon/SM
+gorilla/MS
+gorily
+goriness/M
+gormandize/DRSZG
+gormandizer/M
+gormless
+gorp/MS
+gorse/M
+gory/RTP
+gosh
+goshawk/MS
+gosling/SM
+gospel/MS
+gossamer/M
+gossip/MDRZGS
+gossiper/M
+gossipy
+got
+gotcha/S
+goths
+gotta
+gotten
+gouache/S
+gouge/DRSMZG
+gouger/M
+goulash/MS
+gourd/SM
+gourde/MS
+gourmand/SM
+gourmet/SM
+gout/M
+gouty/TR
+gov
+govern/DGSBL
+governable/U
+governance/M
+governed/U
+governess/MS
+government/MS
+governmental
+governor/SM
+governorship/M
+govt
+gown/MDGS
+gr
+grab/MS
+grabbed
+grabber/MS
+grabbing
+grabby/TR
+grace/EDSMG
+graceful/EPY
+gracefulness/EM
+graceless/PY
+gracelessness/M
+gracious/UY
+graciousness/M
+grackle/MS
+grad/MRZSB
+gradate/XGNDS
+gradation/CM
+grade's
+grade/CADSG
+graded/U
+grader/M
+gradient/MS
+gradual/PY
+gradualism/M
+gradualness/M
+graduate/XMGNDS
+graduation/M
+graffiti
+graffito/M
+graft/SMDRZG
+grafter/M
+graham/S
+grail
+grain/ISMD
+graininess/M
+grainy/PTR
+gram/KMS
+grammar/MS
+grammarian/SM
+grammatical/UY
+gramophone/MS
+grampus/MS
+gran/S
+granary/SM
+grand/SMRYPT
+grandam/MS
+grandaunt/MS
+grandchild/M
+grandchildren/M
+granddad/SM
+granddaddy/SM
+granddaughter/SM
+grandee/MS
+grandeur/M
+grandfather/GMDYS
+grandiloquence/M
+grandiloquent
+grandiose/Y
+grandiosity/M
+grandma/MS
+grandmother/MYS
+grandnephew/MS
+grandness/M
+grandniece/MS
+grandpa/MS
+grandparent/MS
+grandson/MS
+grandstand/SGMD
+granduncle/SM
+grange/SM
+granite/M
+granitic
+granny/SM
+granola/M
+grant/SMDRZG
+grantee/MS
+granter/M
+grantsmanship/M
+granular
+granularity/M
+granulate/GNDS
+granulation/M
+granule/MS
+grape/SM
+grapefruit/MS
+grapeshot/M
+grapevine/SM
+graph/MDG
+graphic/MS
+graphical/Y
+graphite/M
+graphologist/MS
+graphology/M
+graphs
+grapnel/MS
+grapple/MGDS
+grasp/SMDBG
+grass/MDSG
+grasshopper/MS
+grassland/MS
+grassroots
+grassy/TR
+grate/DRSMZGJ
+grateful/UYP
+gratefulness/UM
+grater/M
+gratification/M
+gratify/GNXDS
+gratifying/Y
+gratin/S
+grating/MY
+gratis
+gratitude/IM
+gratuitous/YP
+gratuitousness/M
+gratuity/SM
+gravamen/MS
+grave/DRSMYTGP
+gravedigger/SM
+gravel/SGMDY
+graven
+graveness/M
+graveside/MS
+gravestone/SM
+graveyard/MS
+gravid
+gravimeter/MS
+gravitas
+gravitate/GNDS
+gravitation/M
+gravitational
+gravity/M
+gravy/SM
+gray/MDRTGSP
+graybeard/SM
+grayish
+grayness/M
+graze/DRSMZG
+grazer/M
+grease/DRSMZG
+greasepaint/M
+greasily
+greasiness/M
+greasy/PTR
+great/SMRYPT
+greatcoat/SM
+greathearted
+greatness/M
+grebe/SM
+greed/M
+greedily
+greediness/M
+greedy/PTR
+green/GPSMDRYT
+greenback/MS
+greenbelt/MS
+greenery/M
+greenfield
+greenfly/S
+greengage/MS
+greengrocer/SM
+greenhorn/SM
+greenhouse/SM
+greenish
+greenmail/M
+greenness/M
+greenroom/SM
+greenstone
+greensward/M
+greenwood/M
+greet/ZGJSDR
+greeter/M
+greeting/M
+gregarious/PY
+gregariousness/M
+gremlin/SM
+grenade/SM
+grenadier/MS
+grenadine/M
+grep/S
+grepped
+grepping
+grew/A
+greyhound/SM
+gribble/S
+grid/MS
+griddle/SM
+griddlecake/SM
+gridiron/SM
+gridlock/SMD
+grief/SM
+grievance/MS
+grieve/ZGDRS
+griever/M
+grievous/PY
+grievousness/M
+griffin/SM
+griffon/SM
+grill/SGMDJ
+grille/MS
+grim/DYPG
+grimace/DSMG
+grime/SM
+griminess/M
+grimmer
+grimmest
+grimness/M
+grimy/TRP
+grin/MS
+grind/SZGMRJ
+grinder/M
+grindstone/MS
+gringo/MS
+grinned
+grinning
+grip/MDRSZG
+gripe/SM
+griper/M
+grippe/MZGDR
+gripper/M
+grisliness/M
+grisly/RTP
+grist/MY
+gristle/M
+gristmill/MS
+grit/MS
+grits/M
+gritted
+gritter/SM
+grittiness/M
+gritting
+gritty/RTP
+grizzle/DSG
+grizzly/TRSM
+groan/SGMD
+groat/SM
+grocer/MS
+grocery/SM
+grog/M
+groggily
+grogginess/M
+groggy/PRT
+groin/SM
+grok/S
+grokked
+grokking
+grommet/SM
+groom/SZGMDR
+groomer/M
+grooming/M
+groomsman/M
+groomsmen
+groove/MGDS
+groovy/RT
+grope/DRSMZG
+groper/M
+grosbeak/MS
+grosgrain/M
+gross/PTGMDRSY
+grossness/M
+grotesque/SPMY
+grotesqueness/M
+grotto/M
+grottoes
+grotty/TR
+grouch/GMDS
+grouchily
+grouchiness/M
+grouchy/RTP
+ground/ZGMDRJS
+groundbreaking/MS
+groundcloth
+groundcloths
+grounder/M
+groundhog/MS
+grounding/M
+groundless/Y
+groundnut/MS
+groundsheet/S
+groundskeeper/S
+groundsman
+groundsmen
+groundswell/SM
+groundwater/M
+groundwork/M
+group/JSZGMDR
+grouper/M
+groupie/MS
+grouping/M
+groupware/M
+grouse/MZGDRS
+grouser/M
+grout/SGMD
+grove/SM
+grovel/ZGDRS
+groveler/M
+grovelled
+grovelling
+grow/AHSG
+grower/MS
+growing/I
+growl/SZGMDR
+growler/M
+grown/AI
+grownup/MS
+growth/AM
+growths
+grub/MS
+grubbed
+grubber/MS
+grubbily
+grubbiness/M
+grubbing
+grubby/TRP
+grubstake/M
+grudge/MGDS
+grudging/Y
+grue/S
+gruel/GJM
+grueling/Y
+gruesome/RYTP
+gruesomeness/M
+gruff/TPRY
+gruffness/M
+grumble/DRSMZGJ
+grumbler/M
+grump/SM
+grumpily
+grumpiness/M
+grumpy/PRT
+grunge/MS
+grungy/RT
+grunion/SM
+grunt/SGMD
+gt
+guacamole/M
+guanine/M
+guano/M
+guarani/MS
+guarantee/MDS
+guaranteeing
+guarantor/MS
+guaranty/GDSM
+guard/SZGMDR
+guarded/Y
+guarder/M
+guardhouse/SM
+guardian/SM
+guardianship/M
+guardrail/SM
+guardroom/SM
+guardsman/M
+guardsmen
+guava/SM
+gubernatorial
+guerrilla/SM
+guess/ZGBMDRS
+guesser/M
+guesstimate/DSMG
+guesswork/M
+guest/SGMD
+guestbook/SM
+guesthouse/S
+guestroom/S
+guff/M
+guffaw/MDGS
+guidance/M
+guide/DRSMZG
+guidebook/SM
+guided/U
+guideline/SM
+guidepost/SM
+guider/M
+guild/SZMR
+guilder/M
+guildhall/MS
+guile/M
+guileful
+guileless/YP
+guilelessness/M
+guillemot/S
+guillotine/DSMG
+guilt/M
+guiltily
+guiltiness/M
+guiltless
+guilty/PRT
+guinea/MS
+guise/ESM
+guitar/MS
+guitarist/SM
+gulag/SM
+gulch/MS
+gulden/MS
+gulf/MS
+gull/MDSG
+gullet/MS
+gullibility/M
+gullible
+gully/SM
+gulp/MDRSZG
+gulper/M
+gum/SM
+gumball/S
+gumbo/SM
+gumboil/SM
+gumboot/S
+gumdrop/SM
+gummed
+gumming
+gummy/TR
+gumption/M
+gumshoe/MDS
+gumshoeing
+gun/SM
+gunboat/SM
+gunfight/MRZS
+gunfighter/M
+gunfire/M
+gunge
+gungy
+gunk/M
+gunky
+gunman/M
+gunmen
+gunmetal/M
+gunned
+gunnel/MS
+gunner/MS
+gunnery/M
+gunning
+gunny/M
+gunnysack/MS
+gunpoint/M
+gunpowder/M
+gunrunner/MS
+gunrunning/M
+gunship/MS
+gunshot/MS
+gunslinger/SM
+gunsmith/M
+gunsmiths
+gunwale/MS
+guppy/SM
+gurgle/MGDS
+gurney/MS
+guru/MS
+gush/MDRSZG
+gusher/M
+gushing/Y
+gushy/TR
+gusset/MSDG
+gussy/DSG
+gust/EMDSG
+gustatory
+gustily
+gusto/M
+gusty/RT
+gut/SM
+gutless/P
+gutlessness/M
+gutsy/RT
+gutted
+gutter/SMDG
+guttersnipe/MS
+gutting
+guttural/MS
+gutty/RT
+guv/S
+guvnor/S
+guy/SGMD
+guzzle/DRSZG
+guzzler/M
+gym/SM
+gymkhana/MS
+gymnasium/MS
+gymnast/MS
+gymnastic/S
+gymnastically
+gymnastics/M
+gymnosperm/SM
+gymslip/S
+gynecologic
+gynecological
+gynecologist/SM
+gynecology/M
+gyp/SM
+gypped
+gypper/SM
+gypping
+gypster/SM
+gypsum/M
+gypsy/SM
+gyrate/DSGNX
+gyration/M
+gyrator/SM
+gyrfalcon/MS
+gyro/MS
+gyroscope/MS
+gyroscopic
+gyve/MGDS
+h'm
+h/NRSXZGVJ
+ha/SH
+haberdasher/SM
+haberdashery/SM
+habiliment/SM
+habit's
+habit/ISB
+habitability/M
+habitat/SM
+habitation/MS
+habitual/YP
+habitualness/M
+habituate/GNDS
+habituation/M
+habitue/SM
+hacienda/SM
+hack/MDRZGS
+hacker/M
+hacking/M
+hackish
+hackle/MS
+hackney/SMDG
+hacksaw/SM
+hacktivist/MS
+hackwork/M
+had
+haddock/SM
+hadith
+hadn't
+hadst
+hafnium/M
+haft/MS
+hag/SM
+haggard/YP
+haggardness/M
+haggis/MS
+haggish
+haggle/MZGDRS
+haggler/M
+hagiographer/SM
+hagiography/SM
+hahnium/M
+haiku/M
+hail/MDGS
+hailstone/MS
+hailstorm/MS
+hair/MDS
+hairball/MS
+hairband/S
+hairbreadth/M
+hairbreadths
+hairbrush/MS
+haircloth/M
+haircut/SM
+hairdo/MS
+hairdresser/SM
+hairdressing/M
+hairdryer/MS
+hairgrip/S
+hairiness/M
+hairless
+hairlike
+hairline/SM
+hairnet/SM
+hairpiece/MS
+hairpin/SM
+hairsbreadth/M
+hairsbreadths
+hairsplitter/SM
+hairsplitting/M
+hairspray/S
+hairspring/MS
+hairstyle/MS
+hairstylist/SM
+hairy/TRP
+haj
+hajj/M
+hajjes
+hajji/SM
+hake/MS
+halal/M
+halberd/SM
+halcyon
+hale/ITGDRS
+half/M
+halfback/SM
+halfhearted/PY
+halfheartedness/M
+halfpence
+halfpenny/SM
+halftime/MS
+halftone/MS
+halfway
+halfwit/SM
+halibut/SM
+halite/M
+halitosis/M
+hall/MS
+hallelujah/M
+hallelujahs
+hallmark/GMDS
+halloo/MSG
+hallow/DSG
+hallowed/U
+hallucinate/GNXDS
+hallucination/M
+hallucinatory
+hallucinogen/SM
+hallucinogenic/SM
+hallway/SM
+halo/MDGS
+halogen/SM
+halon
+halt/MDRZGS
+halter/GMD
+halterneck/S
+halting/Y
+halve/DSG
+halyard/MS
+ham/SM
+hamburg/SZMR
+hamburger/M
+hamlet/MS
+hammed
+hammer/MDRSJZG
+hammerer/M
+hammerhead/SM
+hammerlock/SM
+hammertoe/MS
+hamming
+hammock/SM
+hammy/TR
+hamper/GMDS
+hampered/U
+hamster/MS
+hamstring/GSM
+hamstrung
+hand's
+hand/UDGS
+handbag/SM
+handball/MS
+handbarrow/SM
+handbill/MS
+handbook/MS
+handbrake/S
+handcar/SM
+handcart/MS
+handclasp/MS
+handcraft/SMDG
+handcuff/MDGS
+handed/P
+handful/SM
+handgun/SM
+handheld/MS
+handhold/MS
+handicap/MS
+handicapped
+handicapper/MS
+handicapping
+handicraft/MS
+handily
+handiness/M
+handiwork/M
+handkerchief/MS
+handle/MZGDRS
+handlebar/MS
+handler/M
+handmade
+handmaid/XMNS
+handmaiden/M
+handout/SM
+handover/S
+handpick/GDS
+handrail/MS
+handsaw/SM
+handset/SM
+handshake/JMGS
+handsome/PYTR
+handsomeness/M
+handspring/MS
+handstand/SM
+handwork/M
+handwoven
+handwriting/M
+handwritten
+handy/UTR
+handyman/M
+handymen
+hang/MDRJZGS
+hangar/MS
+hangdog
+hanger/M
+hanging/M
+hangman/M
+hangmen
+hangnail/MS
+hangout/SM
+hangover/MS
+hangup/MS
+hank/MRZS
+hanker/GJD
+hankering/M
+hankie/MS
+hansom/MS
+hap/MY
+haphazard/YP
+haphazardness/M
+hapless/YP
+haplessness/M
+haploid/MS
+happen/SDGJ
+happening/M
+happenstance/SM
+happily/U
+happiness/UM
+happy/URTP
+haptic
+harangue/MGDS
+harass/LZGDRS
+harasser/M
+harassment/M
+harbinger/SM
+harbor/GMDS
+harbormaster/S
+hard/NRYXTP
+hardback/MS
+hardball/M
+hardboard/M
+hardbound
+hardcore
+hardcover/SM
+harden/ZGDR
+hardened/U
+hardener/M
+hardhat/MS
+hardheaded/PY
+hardheadedness/M
+hardhearted/PY
+hardheartedness/M
+hardihood/M
+hardily
+hardiness/M
+hardliner/MS
+hardness/M
+hardscrabble
+hardship/SM
+hardstand/SM
+hardtack/M
+hardtop/SM
+hardware/M
+hardwired
+hardwood/SM
+hardworking
+hardy/PTR
+hare/MGDS
+harebell/MS
+harebrained
+harelip/SM
+harelipped
+harem/SM
+haricot/S
+hark/DGS
+harlequin/SM
+harlot/SM
+harlotry/M
+harm/MDGS
+harmed/U
+harmful/YP
+harmfulness/M
+harmless/PY
+harmlessness/M
+harmonic/SM
+harmonica/MS
+harmonically
+harmonies
+harmonious/PY
+harmoniousness/M
+harmonium/MS
+harmonization/M
+harmonize/ZGDRS
+harmonizer/M
+harmony/EM
+harness's
+harness/UDSG
+harp/MDGS
+harpist/SM
+harpoon/ZGSMDR
+harpooner/M
+harpsichord/MS
+harpsichordist/SM
+harpy/SM
+harridan/MS
+harrier/M
+harrow/SMDG
+harrumph/GD
+harrumphs
+harry/DRSZG
+harsh/RYTP
+harshness/M
+hart/MS
+harvest/SMDRZG
+harvested/U
+harvester/M
+hash/AMDSG
+hashish/M
+hashtag/SM
+hasn't
+hasp/MS
+hassle/DSMG
+hassock/SM
+hast/DNXG
+haste/SM
+hasten/DG
+hastily
+hastiness/M
+hasty/RTP
+hat/ZGSMDR
+hatband/S
+hatbox/MS
+hatch/MDSG
+hatchback/MS
+hatcheck/SM
+hatched/U
+hatchery/SM
+hatchet/SM
+hatching/M
+hatchway/SM
+hate/MS
+hateful/PY
+hatefulness/M
+hatemonger/MS
+hater/M
+hatpin/S
+hatred/SM
+hatstand/S
+hatted
+hatter/SM
+hatting
+hauberk/SM
+haughtily
+haughtiness/M
+haughty/PRT
+haul/MDRZGS
+haulage/M
+hauler/M
+haulier/S
+haunch/MS
+haunt/SMDRZG
+haunter/M
+haunting/Y
+hauteur/M
+have/MGS
+haven't
+haven/SM
+haversack/SM
+havoc/M
+haw/GSMD
+hawk/MDRZGS
+hawker/M
+hawkish/P
+hawkishness/M
+hawser/SM
+hawthorn/MS
+hay/GSMD
+haycock/SM
+hayloft/SM
+haymaker/S
+haymaking
+haymow/SM
+hayrick/MS
+hayride/MS
+hayseed/MS
+haystack/SM
+haywire
+hazard/SMDG
+hazardous/Y
+haze/MZGJDRS
+hazel/SM
+hazelnut/MS
+hazer/M
+hazily
+haziness/M
+hazing/M
+hazmat
+hazy/RTP
+hdqrs
+he'd
+he'll
+he/M
+head/MDRZGJS
+headache/MS
+headband/MS
+headbanger/S
+headbanging
+headboard/SM
+headbutt/DSG
+headcase/S
+headcheese
+headcount/S
+headdress/MS
+header/M
+headfirst
+headgear/M
+headhunt/DRSZG
+headhunter/M
+headhunting/M
+headily
+headiness/M
+heading/M
+headlamp/MS
+headland/MS
+headless
+headlight/MS
+headline/MZGDRS
+headliner/M
+headlock/MS
+headlong
+headman/M
+headmaster/SM
+headmen
+headmistress/MS
+headphone/MS
+headpiece/MS
+headpin/SM
+headquarter/SDG
+headquarters/M
+headrest/MS
+headroom/M
+headscarf
+headscarves
+headset/SM
+headship/SM
+headshrinker/SM
+headsman/M
+headsmen
+headstall/SM
+headstand/SM
+headstone/SM
+headstrong
+headteacher/S
+headwaiter/SM
+headwaters/M
+headway/M
+headwind/SM
+headword/SM
+heady/RTP
+heal/DRHZGS
+healed/U
+healer/M
+health/M
+healthcare
+healthful/PY
+healthfulness/M
+healthily/U
+healthiness/UM
+healthy/UTRP
+heap/MDGS
+hear/AHGJS
+heard/AU
+hearer/SM
+hearing/AM
+hearken/SGD
+hearsay/M
+hearse's
+hearse/AS
+heart/SM
+heartache/MS
+heartbeat/MS
+heartbreak/SMG
+heartbroken
+heartburn/M
+hearten/ESGD
+heartfelt
+hearth/M
+hearthrug/S
+hearths
+hearthstone/SM
+heartily
+heartiness/M
+heartland/MS
+heartless/PY
+heartlessness/M
+heartrending/Y
+heartsick/P
+heartsickness/M
+heartstrings/M
+heartthrob/MS
+heartwarming
+heartwood/M
+hearty/RSMPT
+heat's
+heat/ADGS
+heated/U
+heatedly
+heater/SM
+heath/MNRX
+heathen/M
+heathendom/M
+heathenish
+heathenism/M
+heather/M
+heaths
+heating/M
+heatproof
+heatstroke/M
+heatwave/S
+heave/DRSMZG
+heaven/SMY
+heavenly/TR
+heavens/M
+heavenward/S
+heaver/M
+heavily
+heaviness/M
+heavy/RSMTP
+heavyhearted
+heavyset
+heavyweight/MS
+heck/M
+heckle/DRSMZG
+heckler/M
+heckling/M
+hectare/SM
+hectic
+hectically
+hectogram/SM
+hectometer/MS
+hector/SMDG
+hedge/DRSMZG
+hedgehog/MS
+hedgehop/S
+hedgehopped
+hedgehopping
+hedger/M
+hedgerow/SM
+hedonism/M
+hedonist/MS
+hedonistic
+heed/MDGS
+heeded/U
+heedful/Y
+heedless/PY
+heedlessness/M
+heehaw/SMDG
+heel/MDGS
+heelless
+heft/MDGS
+heftily
+heftiness/M
+hefty/PRT
+hegemonic
+hegemony/M
+hegira/SM
+heifer/SM
+height/XSMN
+heighten/DG
+heinous/YP
+heinousness/M
+heir/MS
+heiress/MS
+heirloom/SM
+heist/SMDG
+held
+helical
+helices
+helicopter/SGMD
+heliocentric
+heliotrope/SM
+helipad/S
+heliport/MS
+helium/M
+helix/M
+hell/M
+hellbent
+hellcat/MS
+hellebore/M
+hellfire
+hellhole/MS
+hellion/MS
+hellish/YP
+hellishness/M
+hello/SM
+helluva
+helm/MS
+helmet/SMD
+helmsman/M
+helmsmen
+helot/SM
+help/MDRZGSJ
+helper/M
+helpful/UY
+helpfulness/M
+helping/M
+helpless/PY
+helplessness/M
+helpline/SM
+helpmate/SM
+helve/SM
+hem/SM
+hematite/M
+hematologic
+hematological
+hematologist/MS
+hematology/M
+heme/M
+hemiplegia
+hemisphere/SM
+hemispheric
+hemispherical
+hemline/SM
+hemlock/SM
+hemmed
+hemmer/SM
+hemming
+hemoglobin/M
+hemophilia/M
+hemophiliac/MS
+hemorrhage/MGDS
+hemorrhagic
+hemorrhoid/MS
+hemostat/MS
+hemp/MN
+hemstitch/MDSG
+hen/M
+hence
+henceforth
+henceforward
+henchman/M
+henchmen
+henna/SMDG
+henpeck/GSD
+hep
+heparin/M
+hepatic
+hepatitis/M
+hepatocyte/S
+hepper
+heppest
+heptagon/MS
+heptagonal
+heptathlon/SM
+herald/SMDG
+heralded/U
+heraldic
+heraldry/M
+herb/MS
+herbaceous
+herbage/M
+herbal/S
+herbalist/MS
+herbicidal
+herbicide/MS
+herbivore/SM
+herbivorous
+herculean
+herd/MDRZGS
+herder/M
+herdsman/M
+herdsmen
+here/M
+hereabout/S
+hereafter/SM
+hereby
+hereditary
+heredity/M
+herein
+hereinafter
+hereof
+hereon
+heresy/SM
+heretic/SM
+heretical
+hereto
+heretofore
+hereunder
+hereunto
+hereupon
+herewith
+heritable/I
+heritage/MS
+hermaphrodite/SM
+hermaphroditic
+hermetic
+hermetical/Y
+hermit/SM
+hermitage/MS
+hermitian
+hernia/SM
+hernial
+herniate/GNDS
+herniation/M
+hero/M
+heroes
+heroic/S
+heroically
+heroics/M
+heroin/SM
+heroine/SM
+heroism/M
+heron/SM
+herpes/M
+herpetologist/SM
+herpetology/M
+herring/MS
+herringbone/M
+herself
+hertz/M
+hesitance/M
+hesitancy/M
+hesitant/Y
+hesitate/DSGNX
+hesitating/UY
+hesitation/M
+hessian
+hetero/SM
+heterodox
+heterodoxy/M
+heterogeneity/M
+heterogeneous/Y
+heterosexual/MYS
+heterosexuality/M
+heuristic/MS
+heuristically
+heuristics/M
+hew/ZGSDR
+hewer/M
+hex/GMDS
+hexadecimal/S
+hexagon/MS
+hexagonal
+hexagram/SM
+hexameter/SM
+hey
+heyday/SM
+hf
+hgt
+hgwy
+hi/SD
+hiatus/MS
+hibachi/MS
+hibernate/GNDS
+hibernation/M
+hibernator/MS
+hibiscus/MS
+hiccough/DG
+hiccoughs
+hiccup/GSMD
+hick/MS
+hickey/SM
+hickory/SM
+hid
+hidden
+hide/MZGJDRS
+hideaway/SM
+hidebound
+hideous/YP
+hideousness/M
+hideout/MS
+hider/M
+hiding/M
+hie/S
+hieing
+hierarchic
+hierarchical/Y
+hierarchy/SM
+hieroglyph/M
+hieroglyphic/MS
+hieroglyphs
+high/MRYZTP
+highball/SM
+highborn
+highboy/MS
+highbrow/SM
+highchair/MS
+highfalutin
+highhanded/PY
+highhandedness/M
+highland/MRZS
+highlander/M
+highlight/SMDRZG
+highlighter/M
+highness/M
+highroad/MS
+highs
+hightail/DSG
+highway/MS
+highwayman/M
+highwaymen
+hijab/SM
+hijack/SJZGMDR
+hijacker/M
+hijacking/M
+hike/MZGDRS
+hiker/M
+hiking/M
+hilarious/PY
+hilariousness/M
+hilarity/M
+hill/MS
+hillbilly/SM
+hilliness/M
+hillock/MS
+hillside/SM
+hilltop/MS
+hilly/PRT
+hilt/MS
+him/S
+himself
+hind/MRZS
+hinder/GD
+hindered/U
+hindmost
+hindquarter/MS
+hindrance/SM
+hindsight/M
+hinge's
+hinge/UDSG
+hint/MDRZGS
+hinter/M
+hinterland/SM
+hip/SPM
+hipbath
+hipbaths
+hipbone/MS
+hiphuggers
+hipness/M
+hipped
+hipper
+hippest
+hippie/SM
+hipping
+hippo/SM
+hippocampus
+hippodrome/SM
+hippopotamus/MS
+hippy
+hipster/MS
+hiragana
+hire's
+hire/AGDS
+hireling/MS
+hirsute/P
+hirsuteness/M
+hiss/MDSG
+hist
+histamine/MS
+histogram/MS
+histologist/SM
+histology/M
+histopathology
+historian/MS
+historic
+historical/Y
+historicity/M
+historiographer/MS
+historiography/M
+history/SM
+histrionic/S
+histrionically
+histrionics/M
+hit/SM
+hitch's
+hitch/UDSG
+hitcher/MS
+hitchhike/DRSMZG
+hitchhiker/M
+hither
+hitherto
+hitter/SM
+hitting
+hive/MGDS
+hivemind/SM
+hiya
+hmm
+ho/SMDRYZ
+hoagie/MS
+hoard/SZGMDRJ
+hoarder/M
+hoarding/M
+hoarfrost/M
+hoariness/M
+hoarse/YTRP
+hoarseness/M
+hoary/TRP
+hoax/MDRSZG
+hoaxer/M
+hob/SM
+hobbit/S
+hobble/MZGDRS
+hobbler/M
+hobby/SM
+hobbyhorse/MS
+hobbyist/SM
+hobgoblin/MS
+hobnail/SGMD
+hobnob/S
+hobnobbed
+hobnobbing
+hobo/MS
+hoc
+hock/MDSG
+hockey/M
+hockshop/MS
+hod/SM
+hodgepodge/SM
+hoe/SM
+hoecake/SM
+hoedown/SM
+hoeing
+hoer/M
+hog/SM
+hogan/SM
+hogback/SM
+hogged
+hogging
+hoggish/Y
+hogshead/SM
+hogtie/DS
+hogtying
+hogwash/M
+hoick/SGD
+hoist/SGMD
+hoke/GDS
+hokey
+hokier
+hokiest
+hokum/M
+hold/MRJSZG
+holdall/S
+holder/M
+holding/M
+holdout/SM
+holdover/SM
+holdup/MS
+hole/MGDS
+holey
+holiday/SMDG
+holidaymaker/S
+holiness/UM
+holism
+holistic
+holistically
+holler/MDGS
+hollow/MDRYPSTG
+hollowness/M
+holly/SM
+hollyhock/MS
+holmium/M
+holocaust/SM
+hologram/MS
+holograph/M
+holographic
+holographs
+holography/M
+hols
+holster/SMDG
+holy/URPT
+homage/MS
+hombre/MS
+homburg/SM
+home/MYZGDRS
+homebody/SM
+homeboy/SM
+homecoming/SM
+homegrown
+homeland/MS
+homeless/MP
+homelessness/M
+homelike
+homeliness/M
+homely/PRT
+homemade
+homemaker/SM
+homemaking/M
+homeopath/M
+homeopathic
+homeopaths
+homeopathy/M
+homeostasis/M
+homeostatic
+homeowner/MS
+homepage/MS
+homer/GMD
+homeroom/MS
+homeschooling/M
+homesick/P
+homesickness/M
+homespun/M
+homestead/SMDRZG
+homesteader/M
+homestretch/MS
+hometown/MS
+homeward/S
+homework/MRZG
+homewrecker/SM
+homey/SMP
+homeyness/M
+homicidal
+homicide/MS
+homier
+homiest
+homiletic
+homily/SM
+hominid/SM
+hominoid/S
+hominy/M
+homo/MS
+homoerotic
+homogeneity/M
+homogeneous/Y
+homogenization/M
+homogenize/DSG
+homograph/M
+homographs
+homologous
+homology
+homonym/SM
+homophobia/M
+homophobic
+homophone/MS
+homosexual/SM
+homosexuality/M
+hon/SZTGMDR
+honcho/MS
+hone/MS
+honer/M
+honest/EYT
+honester
+honesty/EM
+honey/SGMD
+honeybee/SM
+honeycomb/MDSG
+honeydew/SM
+honeylocust/M
+honeymoon/ZGMDRS
+honeymooner/M
+honeypot/S
+honeysuckle/SM
+honk/MDRSZG
+honker/M
+honky/SM
+honor/ESGMDB
+honorableness/M
+honorably/E
+honorarily
+honorarium/MS
+honorary
+honoree/SM
+honorer/SM
+honorific/MS
+hooch/M
+hood/MDSG
+hoodie/MS
+hoodlum/SM
+hoodoo/MDSG
+hoodwink/DGS
+hooey/M
+hoof/MDRSZG
+hook's
+hook/UDSG
+hookah/M
+hookahs
+hooker/MS
+hookup/MS
+hookworm/MS
+hooky/M
+hooligan/MS
+hooliganism/M
+hoop/MDSG
+hoopla/M
+hooray
+hoosegow/SM
+hoot/MDRSZG
+hootenanny/SM
+hooter/M
+hoover/DSG
+hooves
+hop/SGMD
+hope/MS
+hopeful/PSMY
+hopefulness/M
+hopeless/YP
+hopelessness/M
+hopped
+hopper/MS
+hopping
+hopscotch/MDSG
+hora/MS
+horde/DSMG
+horehound/SM
+horizon/SM
+horizontal/SMY
+hormonal
+hormone/SM
+horn/MDS
+hornbeam
+hornblende/M
+hornet/MS
+hornless
+hornlike
+hornpipe/MS
+horny/TR
+horologic
+horological
+horologist/MS
+horology/M
+horoscope/SM
+horrendous/Y
+horrible/P
+horribleness/M
+horribly
+horrid/Y
+horrific
+horrifically
+horrify/DSG
+horrifying/Y
+horror/MS
+horse's
+horse/UDSG
+horseback/M
+horsebox/S
+horseflesh/M
+horsefly/SM
+horsehair/M
+horsehide/M
+horselaugh/M
+horselaughs
+horseless
+horseman/M
+horsemanship/M
+horsemen
+horseplay/M
+horsepower/M
+horseradish/MS
+horseshit/!
+horseshoe/DSM
+horseshoeing
+horsetail/SM
+horsetrading
+horsewhip/SM
+horsewhipped
+horsewhipping
+horsewoman/M
+horsewomen
+horsey
+horsier
+horsiest
+hortatory
+horticultural
+horticulturalist/S
+horticulture/M
+horticulturist/MS
+hosanna/SM
+hose/MGDS
+hosepipe/S
+hosier/MS
+hosiery/M
+hosp
+hospholipase
+hospice/MS
+hospitable/I
+hospitably/I
+hospital/SM
+hospitality/M
+hospitalization/SM
+hospitalize/DSG
+host/MDSG
+hostage/MS
+hostel/ZGMDRS
+hosteler/M
+hostelry/SM
+hostess/MDSG
+hostile/MYS
+hostilities/M
+hostility/SM
+hostler/MS
+hot/SYP
+hotbed/MS
+hotblooded
+hotbox/MS
+hotcake/SM
+hotel/SM
+hotelier/MS
+hotfoot/MDGS
+hothead/DSM
+hotheaded/YP
+hotheadedness/M
+hothouse/SM
+hotkey/S
+hotlink/S
+hotness/M
+hotplate/SM
+hotpot/S
+hots/M
+hotshot/MS
+hotted
+hotter
+hottest
+hottie/S
+hotting
+hound/SGMD
+hour/MYS
+hourglass/MS
+houri/SM
+house's
+house/ADSG
+houseboat/SM
+housebound
+houseboy/SM
+housebreak/RSZG
+housebreaker/M
+housebreaking/M
+housebroke
+housebroken
+houseclean/DSG
+housecleaning/M
+housecoat/SM
+housefly/SM
+houseful/SM
+household/SMRZ
+householder/M
+househusband/SM
+housekeeper/MS
+housekeeping/M
+houselights/M
+housemaid/SM
+houseman/M
+housemaster/S
+housemate/S
+housemen
+housemistress/S
+housemother/SM
+houseparent/SM
+houseplant/MS
+houseproud
+houseroom
+housetop/SM
+housewares/M
+housewarming/SM
+housewife/MY
+housewives
+housework/M
+housing/MS
+hove
+hovel/SM
+hover/SGD
+hoverboard/MS
+hovercraft/MS
+how'd
+how're
+how/SM
+howbeit
+howdah/M
+howdahs
+howdy
+however
+howitzer/SM
+howl/MDRSZG
+howler/M
+howsoever
+hoyden/MS
+hoydenish
+hp
+hr/S
+ht
+huarache/SM
+hub/SM
+hubbub/SM
+hubby/SM
+hubcap/SM
+hubris/M
+huckleberry/SM
+huckster/SGMD
+hucksterism/M
+huddle/DSMG
+hue/DSM
+huff/MDSG
+huffily
+huffiness/M
+huffy/PRT
+hug/STMR
+huge/YP
+hugeness/M
+hugged
+hugging
+huh
+hula/MS
+hulk/MSG
+hull/MDRSZG
+hullabaloo/SM
+huller/M
+hum/SM
+human/SMRYTP
+humane/PY
+humaneness/M
+humanism/M
+humanist/SM
+humanistic
+humanitarian/MS
+humanitarianism/M
+humanities/M
+humanity/ISM
+humanization/CM
+humanize/CDSG
+humanizer/SM
+humankind/M
+humanness/M
+humanoid/SM
+humble/DRSZTGJP
+humbleness/M
+humbler/M
+humbly
+humbug/SM
+humbugged
+humbugging
+humdinger/MS
+humdrum/M
+humeral
+humeri
+humerus/M
+humid/Y
+humidification/M
+humidifier/CM
+humidify/CZGDRS
+humidity/M
+humidor/SM
+humiliate/DSGNX
+humiliating/Y
+humiliation/M
+humility/M
+hummed
+hummer/SM
+humming
+hummingbird/SM
+hummock/SM
+hummocky
+hummus/M
+humongous
+humor/SMDG
+humoresque
+humorist/MS
+humorless/YP
+humorlessness/M
+humorous/PY
+humorousness/M
+hump/MDSG
+humpback/MDS
+humph/DG
+humphs
+humus/M
+hunch/MDSG
+hunchback/SMD
+hundred/SMH
+hundredfold
+hundredth/M
+hundredths
+hundredweight/SM
+hung
+hunger/SMDG
+hungover
+hungrily
+hungriness/M
+hungry/PRT
+hunk/MRSZ
+hunker/DG
+hunky/RT
+hunt/MDRSZG
+hunter/M
+hunting/M
+huntress/MS
+huntsman/M
+huntsmen
+hurdle/DRSMZG
+hurdler/M
+hurdling/M
+hurl/MDRSZG
+hurler/M
+hurling/M
+hurrah/GMD
+hurrahs
+hurricane/MS
+hurried/UY
+hurry/DSMG
+hurt/MSG
+hurtful/YP
+hurtfulness/M
+hurtle/DSG
+husband/GMDS
+husbandman/M
+husbandmen
+husbandry/M
+hush/MDSG
+husk/MDRSZG
+husker/M
+huskily
+huskiness/M
+husky/PRSMT
+hussar/SM
+hussy/SM
+hustings/M
+hustle/DRSMZG
+hustler/M
+hut/SM
+hutch/MS
+huzzah/MDG
+huzzahs
+hwy
+hyacinth/M
+hyacinths
+hybrid/SM
+hybridism/M
+hybridization/M
+hybridize/DSG
+hydra/SM
+hydrangea/SM
+hydrant/MS
+hydrate's
+hydrate/CGNDS
+hydration/CM
+hydraulic/S
+hydraulically
+hydraulics/M
+hydro/M
+hydrocarbon/MS
+hydrocephalus/M
+hydrochloride
+hydrocortisone
+hydrodynamic/S
+hydrodynamics/M
+hydroelectric
+hydroelectrically
+hydroelectricity/M
+hydrofoil/MS
+hydrogen/M
+hydrogenate/CGDS
+hydrogenation/M
+hydrogenous
+hydrologist/MS
+hydrology/M
+hydrolyses
+hydrolysis/M
+hydrolyze/DSG
+hydrometer/SM
+hydrometry/M
+hydrophilic
+hydrophobia/M
+hydrophobic
+hydrophone/SM
+hydroplane/GDSM
+hydroponic/S
+hydroponically
+hydroponics/M
+hydrosphere/M
+hydrotherapy/M
+hydrothermal
+hydrous
+hydroxide/SM
+hyena/SM
+hygiene/M
+hygienic/U
+hygienically
+hygienist/MS
+hygrometer/SM
+hying
+hymen/SM
+hymeneal
+hymn/MDSG
+hymnal/MS
+hymnbook/SM
+hype/MGDRS
+hyperactive
+hyperactivity/M
+hyperbola/SM
+hyperbole/M
+hyperbolic
+hypercritical/Y
+hypercube
+hyperglycemia/M
+hyperinflation
+hyperlink/GSMD
+hypermarket/S
+hypermedia/M
+hyperparathyroidism
+hyperplane
+hypersensitive/P
+hypersensitiveness/M
+hypersensitivity/SM
+hyperspace/S
+hypertension/M
+hypertensive/SM
+hypertext/M
+hyperthyroid/M
+hyperthyroidism/M
+hypertrophy/DSMG
+hyperventilate/GNDS
+hyperventilation/M
+hypervisor/MS
+hyphen/MDSG
+hyphenate/XDSMGN
+hyphenation/M
+hypnoses
+hypnosis/M
+hypnotherapist/S
+hypnotherapy/M
+hypnotic/SM
+hypnotically
+hypnotism/M
+hypnotist/MS
+hypnotize/GDS
+hypo/MS
+hypoallergenic
+hypochondria/M
+hypochondriac/SM
+hypocrisy/SM
+hypocrite/MS
+hypocritical/Y
+hypodermic/MS
+hypoglycemia/M
+hypoglycemic/SM
+hypotenuse/MS
+hypothalami
+hypothalamus/M
+hypothermia/M
+hypotheses
+hypothesis/M
+hypothesize/DSG
+hypothetical/Y
+hypothyroid/M
+hypothyroidism/M
+hyssop/M
+hysterectomy/SM
+hysteresis
+hysteria/M
+hysteric/SM
+hysterical/Y
+hysterics/M
+i/US
+iOS/M
+iPad/M
+iPhone/M
+iPod/M
+iTunes/M
+iamb/MS
+iambi
+iambic/SM
+iambus/MS
+ibex/MS
+ibid
+ibidem
+ibis/MS
+ibuprofen/M
+ice's
+ice/CDSG
+iceberg/SM
+iceboat/SM
+icebound
+icebox/MS
+icebreaker/SM
+icecap/SM
+iceman/M
+icemen
+ichthyologist/MS
+ichthyology/M
+icicle/SM
+icily
+iciness/M
+icing/SM
+icky/RT
+icon/MS
+iconic
+iconoclasm/M
+iconoclast/SM
+iconoclastic
+iconography/M
+ictus/M
+icy/TPR
+id/SMY
+idea/MS
+ideal/SMY
+idealism/M
+idealist/SM
+idealistic
+idealistically
+idealization/MS
+idealize/DSG
+idem
+idempotent
+identical/Y
+identifiable/U
+identification/M
+identified/U
+identify/ZGNDRSX
+identikit/S
+identity/SM
+ideogram/SM
+ideograph/M
+ideographs
+ideological/Y
+ideologist/SM
+ideologue/MS
+ideology/SM
+ides/M
+idiocy/SM
+idiom/SM
+idiomatic/U
+idiomatically
+idiopathic
+idiosyncrasy/SM
+idiosyncratic
+idiosyncratically
+idiot/SM
+idiotic
+idiotically
+idle/MZTGDRSP
+idleness/M
+idler/M
+idol/MS
+idolater/SM
+idolatress/MS
+idolatrous
+idolatry/M
+idolization/M
+idolize/GDS
+idyll/SM
+idyllic
+idyllically
+if/SM
+iffiness/M
+iffy/RTP
+igloo/SM
+igneous
+ignitable
+ignite/AGDS
+ignition/MS
+ignoble
+ignobly
+ignominious/Y
+ignominy/SM
+ignoramus/MS
+ignorance/M
+ignorant/Y
+ignore/GDS
+iguana/MS
+ii
+iii
+ilea
+ileitis/M
+ileum/M
+ilia
+ilium/M
+ilk/SM
+ill/SMP
+illegal/MYS
+illegality/SM
+illegibility/M
+illegible
+illegibly
+illegitimacy/M
+illegitimate/Y
+illiberal/Y
+illiberality/M
+illicit/YP
+illicitness/M
+illimitable
+illiteracy/M
+illiterate/MYS
+illness/MS
+illogical/Y
+illogicality/M
+illuminate/GNXDS
+illuminating/Y
+illumination/M
+illumine/DSBG
+illus/V
+illusion/EMS
+illusionist/SM
+illusory
+illustrate/GNVXDS
+illustration/M
+illustrative/Y
+illustrator/SM
+illustrious/PY
+illustriousness/M
+image/DSMG
+imagery/M
+imaginable/U
+imaginably/U
+imaginal
+imaginary
+imagination/MS
+imaginative/UY
+imagine/DSBJG
+imago/M
+imagoes
+imam/MS
+imbalance/DSM
+imbecile/MS
+imbecilic
+imbecility/SM
+imbibe/ZGDRS
+imbiber/M
+imbrication/M
+imbroglio/SM
+imbue/DSG
+imitable/I
+imitate/DSGNVX
+imitation/M
+imitative/PY
+imitativeness/M
+imitator/SM
+immaculate/PY
+immaculateness/M
+immanence/M
+immanency/M
+immanent/Y
+immaterial/YP
+immateriality/M
+immaterialness/M
+immature/Y
+immaturity/M
+immeasurable
+immeasurably
+immediacies/M
+immediacy/SM
+immediate/PY
+immediateness/M
+immemorial/Y
+immense/Y
+immensity/SM
+immerse/XDSGNV
+immersible
+immersion/M
+immigrant/SM
+immigrate/DSGN
+immigration/M
+imminence/M
+imminent/Y
+immobile
+immobility/M
+immobilization/M
+immobilize/ZGDRS
+immoderate/Y
+immodest/Y
+immodesty/M
+immolate/DSGN
+immolation/M
+immoral/Y
+immorality/SM
+immortal/MYS
+immortality/M
+immortalize/DSG
+immovability/M
+immovable
+immovably
+immune
+immunity/M
+immunization/SM
+immunize/GDS
+immunodeficiency/M
+immunodeficient
+immunoglobulin/S
+immunologic
+immunological
+immunologist/MS
+immunology/M
+immure/DSG
+immutability/M
+immutable
+immutably
+imp/SMR
+impact/SMDG
+impair/SDGL
+impaired/U
+impairment/MS
+impala/SM
+impale/DSGL
+impalement/M
+impalpable
+impalpably
+impanel/SDG
+impart/SDG
+impartial/Y
+impartiality/M
+impassably
+impasse/BSMV
+impassibility/M
+impassible
+impassibly
+impassioned
+impassive/YP
+impassiveness/M
+impassivity/M
+impasto/M
+impatience/MS
+impatiens/M
+impatient/Y
+impeach/ZGBLDRS
+impeachable/U
+impeacher/M
+impeachment/SM
+impeccability/M
+impeccable
+impeccably
+impecunious/PY
+impecuniousness/M
+impedance/M
+impede/DSG
+impeded/U
+impediment/SM
+impedimenta/M
+impel/S
+impelled
+impeller/MS
+impelling
+impend/SDG
+impenetrability/M
+impenetrable
+impenetrably
+impenitence/M
+impenitent/Y
+imperative/SMY
+imperceptibility/M
+imperceptible
+imperceptibly
+imperceptive
+imperf
+imperfect/SMYP
+imperfection/MS
+imperfectness/M
+imperial/MYS
+imperialism/M
+imperialist/SM
+imperialistic
+imperialistically
+imperil/GSLD
+imperilment/M
+imperious/PY
+imperiousness/M
+imperishable
+imperishably
+impermanence/M
+impermanent/Y
+impermeability/M
+impermeable
+impermeably
+impermissible
+impersonal/Y
+impersonate/GNXDS
+impersonation/M
+impersonator/SM
+impertinence/MS
+impertinent/Y
+imperturbability/M
+imperturbable
+imperturbably
+impervious/Y
+impetigo/M
+impetuosity/M
+impetuous/YP
+impetuousness/M
+impetus/MS
+impiety/SM
+impinge/LDSG
+impingement/M
+impious/PY
+impiousness/M
+impish/YP
+impishness/M
+implacability/M
+implacable
+implacably
+implant/BSGMD
+implantation/M
+implausibility/SM
+implausible
+implausibly
+implement/GBMDRS
+implementable/U
+implementation/SM
+implemented/U
+implicate/DSG
+implication/M
+implicit/PY
+implicitness/M
+implode/DSG
+implore/DSG
+imploring/Y
+implosion/MS
+implosive
+imply/XDSGN
+impolite/YP
+impoliteness/MS
+impolitic
+imponderable/MS
+import/ZGBSMDR
+importance/M
+important/Y
+importation/MS
+importer/M
+importunate/Y
+importune/GDS
+importunity/M
+impose/ADSG
+imposer/MS
+imposing/U
+imposingly
+imposition/MS
+impossibility/SM
+impossible/S
+impossibly
+impost/SM
+impostor/SM
+imposture/MS
+impotence/M
+impotency/M
+impotent/Y
+impound/DGS
+impoverish/DSLG
+impoverishment/M
+impracticability
+impracticable
+impracticably
+impractical/Y
+impracticality/M
+imprecate/DSXGN
+imprecation/M
+imprecise/PYN
+impreciseness/M
+imprecision/M
+impregnability/M
+impregnable
+impregnably
+impregnate/GNDS
+impregnation/M
+impresario/SM
+impress/MDSGV
+impressed/U
+impressibility/M
+impressible
+impression/BSM
+impressionability/M
+impressionism/M
+impressionist/SM
+impressionistic
+impressive/PY
+impressiveness/M
+imprimatur/SM
+imprint/MDRZGS
+imprinter/M
+imprison/SDLG
+imprisonment/SM
+improbability/SM
+improbable
+improbably
+impromptu/SM
+improper/Y
+impropriety/SM
+improve/GBDSL
+improved/U
+improvement/MS
+improvidence/M
+improvident/Y
+improvisation/SM
+improvisational
+improvise/ZGDRS
+improviser/M
+imprudence/M
+imprudent/Y
+impudence/M
+impudent/Y
+impugn/ZGSDR
+impugner/M
+impulse/MGNVDS
+impulsion/M
+impulsive/PY
+impulsiveness/M
+impulsivity
+impunity/M
+impure/RYT
+impurity/SM
+imputation/SM
+impute/BDSG
+in/ASM
+inaccuracy/S
+inaction/M
+inadequacy/S
+inadvertence/M
+inadvertent/Y
+inalienability/M
+inalienably
+inamorata/SM
+inane/RYT
+inanimate/PY
+inanimateness/M
+inanity/SM
+inappropriate/Y
+inarticulate/Y
+inasmuch
+inaudible
+inaugural/SM
+inaugurate/XGNDS
+inauguration/M
+inboard/MS
+inbound
+inbox/MS
+inbreed/S
+inc/TGD
+incalculably
+incandescence/M
+incandescent/Y
+incantation/SM
+incapacitate/GNDS
+incarcerate/XDSGN
+incarceration/M
+incarnadine/DSG
+incarnate/AXGNDS
+incarnation/AM
+incendiary/SM
+incense/MGDS
+incentive's
+incentive/ES
+inception/SM
+incessant/Y
+incest/M
+incestuous/PY
+incestuousness/M
+inch/MDSG
+inchoate
+inchworm/SM
+incidence/SM
+incident/SM
+incidental/MYS
+incinerate/DSGN
+incineration/M
+incinerator/MS
+incipience/M
+incipient/Y
+incise/XGNVDS
+incision/M
+incisive/PY
+incisiveness/M
+incisor/MS
+incitement/MS
+inciter/MS
+incl
+inclement
+inclination/EM
+inclinations
+incline's
+incline/EGDS
+include/GDS
+inclusion/MS
+inclusive/YP
+inclusiveness/M
+incognito/MS
+incombustible
+incommode/GD
+incommodious
+incommunicado
+incompatibility/S
+incompetent/MS
+incomplete/Y
+inconceivability/M
+incongruous/PY
+incongruousness/M
+inconsolably
+inconstant/Y
+incontestability/M
+incontestably
+incontinent
+incontrovertibly
+inconvenience/GD
+incorporate/ADSGN
+incorporated/U
+incorporation/AM
+incorporeal
+incorrect/Y
+incorrigibility/M
+incorrigible
+incorrigibly
+incorruptibly
+increasing/Y
+increment/SMDG
+incremental/Y
+incrementalism
+incrementalist/SM
+incriminate/GNDS
+incrimination/M
+incriminatory
+incrustation/SM
+incubate/GNDS
+incubation/M
+incubator/SM
+incubus/MS
+inculcate/DSGN
+inculcation/M
+inculpate/DSG
+incumbency/SM
+incumbent/SM
+incunabula
+incunabulum/M
+incur/SB
+incurable/MS
+incurably
+incurious
+incurred
+incurring
+incursion/MS
+ind
+indebted/P
+indebtedness/M
+indeed
+indefatigable
+indefatigably
+indefeasible
+indefeasibly
+indefinably
+indelible
+indelibly
+indemnification/M
+indemnify/GDSXN
+indemnity/SM
+indentation/MS
+indention/M
+indenture/DG
+indescribably
+indestructibly
+indeterminably
+indeterminacy/M
+indeterminate/Y
+index/ZGMDRS
+indexation/SM
+indexer/M
+indicate/XDSGNV
+indication/M
+indicative/SMY
+indicator/MS
+indict/GDSBL
+indictment/SM
+indie/S
+indigence/M
+indigenous
+indigent/SMY
+indignant/Y
+indignation/M
+indigo/M
+indirect/Y
+indiscipline
+indiscreet/Y
+indiscretion/S
+indiscriminate/Y
+indispensability/M
+indispensable/MS
+indispensably
+indissolubility
+indissolubly
+indistinguishably
+indite/GDS
+indium/M
+individual/MYS
+individualism/M
+individualist/MS
+individualistic
+individualistically
+individuality/M
+individualization/M
+individualize/GDS
+individuate/DSGN
+individuation/M
+indivisibly
+indoctrinate/GNDS
+indoctrination/M
+indolence/M
+indolent/Y
+indomitable
+indomitably
+indubitable
+indubitably
+induce/DRSZGL
+inducement/SM
+inducer/M
+induct/DGV
+inductance/M
+inductee/SM
+induction/MS
+inductive/Y
+indulge/DSG
+indulgence/SM
+indulgent/Y
+industrial/Y
+industrialism/M
+industrialist/SM
+industrialization/M
+industrialize/DSG
+industrious/YP
+industriousness/M
+industry/SM
+indwell/SG
+inebriate/MGNDS
+inebriation/M
+inedible
+ineffability/M
+ineffable
+ineffably
+inelastic
+ineligible/MS
+ineligibly
+ineluctable
+ineluctably
+inept/YP
+ineptitude/M
+ineptness/M
+inequality/S
+inert/YP
+inertia/M
+inertial
+inertness/M
+inescapable
+inescapably
+inestimably
+inevitability/M
+inevitable/M
+inevitably
+inexact/Y
+inexhaustibly
+inexorability
+inexorable
+inexorably
+inexpedient
+inexpert/Y
+inexpiable
+inexplicably
+inexpressibly
+inexpressive
+inextricably
+inf/ZT
+infallible
+infamy/SM
+infancy/M
+infant/MS
+infanticide/MS
+infantile
+infantry/SM
+infantryman/M
+infantrymen
+infarct/MS
+infarction/M
+infatuate/DSXGN
+infatuation/M
+infect/AESDG
+infected/U
+infection/ASM
+infectious/PY
+infectiousness/M
+infelicitous
+inference/SM
+inferential
+inferior/MS
+inferiority/M
+infernal/Y
+inferno/MS
+inferred
+inferring
+infest/GDS
+infestation/MS
+infidel/MS
+infidelity/S
+infiltrator/SM
+infinite/MV
+infinitesimal/SMY
+infinitival
+infinitive/MS
+infinitude/M
+infinity/SM
+infirm
+infirmary/SM
+infirmity/SM
+infix
+inflame/DSG
+inflammable
+inflammation/SM
+inflammatory
+inflatable/SM
+inflate/ADSG
+inflation/EM
+inflationary
+inflect/SDG
+inflection/MS
+inflectional
+inflict/SDGV
+infliction/M
+inflow/SM
+influence/MGDS
+influenced/U
+influential/Y
+influenza/M
+info/M
+infomercial/SM
+inform/Z
+informal/Y
+informant/SM
+informatics
+information/EM
+informational
+informative/PY
+informativeness/M
+informed/U
+infotainment/M
+infra
+infrared/M
+infrasonic
+infrastructural
+infrastructure/SM
+infrequence/M
+infrequent/Y
+infringement/MS
+infuriate/GDS
+infuriating/Y
+infuser/SM
+ingenious/PY
+ingeniousness/M
+ingenue/SM
+ingenuity/M
+ingenuous/EY
+ingenuousness/M
+ingest/SDG
+ingestion/M
+inglenook/SM
+ingot/SM
+ingrain/G
+ingrate/SM
+ingratiate/GNDS
+ingratiating/Y
+ingratiation/M
+ingredient/MS
+ingress/MS
+inguinal
+inhabit/DG
+inhabitable/U
+inhabitant/SM
+inhabited/U
+inhalant/SM
+inhalation/MS
+inhalator/MS
+inhaler/SM
+inharmonious
+inhere/DSG
+inherent/Y
+inherit/EGSD
+inheritance/EM
+inheritances
+inheritor/SM
+inhibit/GSD
+inhibition/SM
+inhibitor/SM
+inhibitory
+inhuman/Y
+inhumane/Y
+inimical/Y
+inimitably
+iniquitous/Y
+iniquity/SM
+initial/SGMDY
+initialism
+initialization
+initialize/DSG
+initialized/AU
+initiate/XMGNVDS
+initiated/U
+initiation/M
+initiative/SM
+initiator/MS
+initiatory
+initio
+inject/SDG
+injection/SM
+injector/SM
+injunctive
+injure/DRSZG
+injured/U
+injurer/M
+injurious
+ink/MD
+inkblot/SM
+inkiness/M
+inkling/SM
+inkstand/SM
+inkwell/MS
+inky/RTP
+inland/M
+inline
+inmate/SM
+inmost
+inn/SGMRJ
+innards/M
+innate/PY
+innateness/M
+innermost
+innersole/SM
+innerspring
+innervate/GNDS
+innervation/M
+inning/M
+innit
+innkeeper/MS
+innocence/M
+innocent/MYS
+innocuous/PY
+innocuousness/M
+innovate/XDSGNV
+innovation/M
+innovator/MS
+innovatory
+innuendo/SM
+innumerably
+innumerate
+inoculate/AGDS
+inoculation/MS
+inoperative
+inordinate/Y
+inorganic
+inositol
+inquire/ZGDR
+inquirer/M
+inquiring/Y
+inquiry/SM
+inquisition/MS
+inquisitional
+inquisitive/YP
+inquisitiveness/M
+inquisitor/SM
+inquisitorial
+inrush/MS
+insane/T
+insatiability/M
+insatiably
+inscribe/ZGDR
+inscriber/M
+inscription/MS
+inscrutability/M
+inscrutable/P
+inscrutableness/M
+inscrutably
+inseam/SM
+insecticidal
+insecticide/MS
+insectivore/MS
+insectivorous
+insecure/Y
+inseminate/DSGN
+insemination/M
+insensate
+insensible
+insensitive/Y
+inseparable/MS
+insert's
+insert/AGSD
+insertion/AM
+insertions
+insetting
+inshore
+inside/RSMZ
+insider/M
+insidious/YP
+insidiousness/M
+insight/MS
+insightful
+insignia/M
+insinuate/GNVDSX
+insinuation/M
+insinuator/SM
+insipid/PY
+insipidity/M
+insist/SGD
+insistence/M
+insistent/Y
+insisting/Y
+insofar
+insole/SM
+insolence/M
+insolent/Y
+insoluble
+insolubly
+insolvency/S
+insomnia/M
+insomniac/SM
+insomuch
+insouciance/M
+insouciant
+inspect/AGDS
+inspection/SM
+inspector/MS
+inspectorate/MS
+inspiration/MS
+inspirational
+inspiratory
+inspired/U
+inspiring/U
+inst
+instability/S
+install/UBZRSDG
+installation/MS
+installer/UM
+installment/SM
+instance/GD
+instant/MRYS
+instantaneous/Y
+instantiate/DSG
+instar
+instate/AGDS
+instead
+instigate/DSGN
+instigation/M
+instigator/MS
+instillation/M
+instinct/VMS
+instinctive/Y
+instinctual
+institute/XMZGNDRS
+instituter/M
+institution/M
+institutional/Y
+institutionalization/M
+institutionalize/DSG
+instr
+instruct/SDGV
+instructed/U
+instruction/MS
+instructional
+instructive/Y
+instructor/MS
+instrument/MDSG
+instrumental/MYS
+instrumentalist/SM
+instrumentality/M
+instrumentation/M
+insubordinate
+insufferable
+insufferably
+insula
+insular
+insularity/M
+insulate/GNDS
+insulation/M
+insulator/MS
+insulin/M
+insult/SMDG
+insulting/Y
+insuperable
+insuperably
+insurance/SM
+insure/DRSZGB
+insured/SM
+insurer/M
+insurgence/SM
+insurgency/SM
+insurgent/MS
+insurmountably
+insurrection/SM
+insurrectionist/SM
+int
+intact
+intaglio/MS
+integer/MS
+integral/SMY
+integrate/AEVNGSD
+integration/EAM
+integrator
+integrity/M
+integument/SM
+intel/M
+intellect/MS
+intellectual/MYS
+intellectualism/M
+intellectualize/GDS
+intelligence/M
+intelligent/Y
+intelligentsia/M
+intelligibility/M
+intelligible/U
+intelligibly/U
+intended/SM
+intense/YTVR
+intensification/M
+intensifier/M
+intensify/DRSZGN
+intensity/S
+intensive/MYPS
+intensiveness/M
+intent/SMYP
+intention/MS
+intentional/UY
+intentness/M
+inter/ESL
+interact/SGVD
+interaction/SM
+interactive/Y
+interactivity
+interbred
+interbreed/GS
+intercede/GDS
+intercept/GMDS
+interception/MS
+interceptor/SM
+intercession/SM
+intercessor/MS
+intercessory
+interchange/DSMG
+interchangeability
+interchangeable
+interchangeably
+intercity
+intercollegiate
+intercom/SM
+intercommunicate/DSGN
+intercommunication/M
+interconnect/GDS
+interconnection/SM
+intercontinental
+intercourse/M
+intercultural
+interdenominational
+interdepartmental
+interdependence/M
+interdependent/Y
+interdict/GMDS
+interdiction/M
+interdisciplinary
+interest/ESMD
+interested/U
+interesting/Y
+interface/MGDS
+interfaith
+interfere/GDS
+interference/M
+interferon/M
+interfile/GDS
+intergalactic
+intergovernmental
+interim/M
+interior/SM
+interj
+interject/GDS
+interjection/SM
+interlace/GDS
+interlard/DGS
+interleave/DSG
+interleukin/M
+interline/GDSJ
+interlinear
+interlining/M
+interlink/DSG
+interlock/GMDS
+interlocutor/SM
+interlocutory
+interlope/ZGDRS
+interloper/M
+interlude/MGDS
+intermarriage/SM
+intermarry/GDS
+intermediary/SM
+intermediate/MYS
+interment/EM
+interments
+intermezzi
+intermezzo/MS
+interminably
+intermingle/DSG
+intermission/SM
+intermittence
+intermittency
+intermittent/Y
+intermix/GDS
+intern/GDL
+internal/SY
+internalization/M
+internalize/GDS
+international/SMY
+internationalism/M
+internationalist/SM
+internationalization
+internationalize/DSG
+internecine
+internee/SM
+internet
+internist/MS
+internment/M
+internship/MS
+interoffice
+interoperability
+interoperable
+interoperate/S
+interpenetrate/DSGN
+interpersonal
+interplanetary
+interplay/M
+interpolate/XDSGN
+interpolation/M
+interpose/GDS
+interposition/M
+interpret/AGVDS
+interpretation/AMS
+interpretative
+interpreted/U
+interpreter/MS
+interracial
+interred/E
+interregnum/SM
+interrelate/XDSGN
+interrelation/M
+interrelationship/MS
+interring/E
+interrogate/DSGNVX
+interrogation/M
+interrogative/MYS
+interrogator/SM
+interrogatory/SM
+interrupt/ZGMDRS
+interrupter/M
+interruption/MS
+interscholastic
+intersect/GDS
+intersection/SM
+intersectional
+intersectionality
+intersession/SM
+intersex
+intersperse/GNDS
+interspersion/M
+interstate/MS
+interstellar
+interstice/MS
+interstitial
+intertwine/GDS
+interurban
+interval/SM
+intervene/GDS
+intervention/SM
+interventionism/M
+interventionist/SM
+interview/ZGMDRS
+interviewee/MS
+interviewer/M
+intervocalic
+interwar
+interweave/GS
+interwove
+interwoven
+intestacy/M
+intestate
+intestinal
+intestine/MS
+intifada
+intimacy/SM
+intimate/MYGNDSX
+intimation/M
+intimidate/GNDS
+intimidating/Y
+intimidation/M
+intonation/SM
+intoxicant/SM
+intoxicate/DSGN
+intoxication/M
+intracranial
+intramural
+intramuscular
+intranet/MS
+intransigence/M
+intransigent/MYS
+intrastate
+intrauterine
+intravenous/MSY
+intrepid/Y
+intrepidity/M
+intricacy/SM
+intricate/Y
+intrigue/DRSMZG
+intriguer/M
+intriguing/Y
+intrinsic
+intrinsically
+intro/SM
+introduce/AGDS
+introduction/AM
+introductions
+introductory
+introit/SM
+introspect/GVDS
+introspection/M
+introspective/Y
+introversion/M
+introvert/MDS
+intrude/DRSZG
+intruder/M
+intrusion/SM
+intrusive/YP
+intrusiveness/M
+intuit/SDGV
+intuition/S
+intuitive/PY
+intuitiveness/M
+inundate/XDSGN
+inundation/M
+inure/DSG
+invade/DRSZG
+invader/M
+invalid/GMDYS
+invalidism/M
+invaluable
+invaluably
+invariant
+invasion/MS
+invasive
+invective/M
+inveigh/GD
+inveighs
+inveigle/ZGDRS
+inveigler/M
+invent/ASGVD
+invention/AMS
+inventive/PY
+inventiveness/M
+inventor/MS
+inventory/DSMG
+inverse/SMY
+invert/SMDRZG
+inverter/M
+invest/ASDGL
+investigate/GNVDSX
+investigation/M
+investigator/SM
+investigatory
+investiture/MS
+investment/AEM
+investor/SM
+inveteracy/M
+inveterate
+invidious/YP
+invidiousness/M
+invigilate/GNDS
+invigilator/S
+invigorate/ADSG
+invigorating/Y
+invigoration/M
+invincibility/M
+invincibly
+inviolability/M
+inviolably
+inviolate
+invitation/SM
+invitational/SM
+invite/DSMG
+invited/U
+invitee/SM
+inviting/Y
+invoke/DSG
+involuntariness/M
+involuntary/P
+involution/M
+involve/LDSG
+involved/U
+involvement/SM
+inward/SY
+ioctl
+iodide/SM
+iodine/M
+iodize/DSG
+ion/USM
+ionic
+ionization/UM
+ionize/UDSG
+ionizer/MS
+ionosphere/MS
+ionospheric
+iota/MS
+ipecac/SM
+irascibility/M
+irascible
+irascibly
+irate/YP
+irateness/M
+ire/M
+ireful
+irenic
+irides
+iridescence/M
+iridescent/Y
+iridium/M
+iris/MS
+irk/SGD
+irksome/YP
+irksomeness/M
+iron/MDSG
+ironclad/MS
+ironic
+ironical/Y
+ironing/M
+ironmonger/S
+ironmongery
+ironstone/M
+ironware/M
+ironwood/MS
+ironwork/M
+irony/SM
+irradiate/DSGN
+irradiation/M
+irrational/SMY
+irrationality/M
+irreclaimable
+irreconcilability/M
+irreconcilable
+irreconcilably
+irrecoverable
+irrecoverably
+irredeemable
+irredeemably
+irreducible
+irreducibly
+irrefutable
+irrefutably
+irregular/MYS
+irregularity/SM
+irrelevance/MS
+irrelevancy/MS
+irrelevant/Y
+irreligion
+irreligious
+irremediable
+irremediably
+irremovable
+irreparable
+irreparably
+irreplaceable
+irrepressible
+irrepressibly
+irreproachable
+irreproachably
+irresistible
+irresistibly
+irresolute/PYN
+irresoluteness/M
+irresolution/M
+irrespective
+irresponsibility/M
+irresponsible
+irresponsibly
+irretrievable
+irretrievably
+irreverence/M
+irreverent/Y
+irreversible
+irreversibly
+irrevocable
+irrevocably
+irrigable
+irrigate/DSGN
+irrigation/M
+irritability/M
+irritable
+irritably
+irritant/SM
+irritate/DSXGN
+irritating/Y
+irritation/M
+irrupt/DGVS
+irruption/SM
+ischemia
+ischemic
+isinglass/M
+isl
+island/SZMR
+islander/M
+isle/MS
+islet/SM
+ism/CM
+isms
+isn't
+isobar/MS
+isobaric
+isolate/DSMGN
+isolation/M
+isolationism/M
+isolationist/SM
+isomer/MS
+isomeric
+isomerism/M
+isometric/S
+isometrically
+isometrics/M
+isomorphic
+isomorphism
+isosceles
+isotherm/SM
+isotope/SM
+isotopic
+isotropic
+issuance/M
+issue/ADSMG
+issuer/MS
+isthmian
+isthmus/MS
+it'd
+it'll
+it/USM
+ital
+italic/SM
+italicization/M
+italicize/GDS
+italics/M
+itch/MDSG
+itchiness/M
+itchy/RPT
+item/MS
+itemization/M
+itemize/GDS
+iterate/AXGNVDS
+iteration/AM
+iterator/S
+itinerant/SM
+itinerary/SM
+itself
+iv/U
+ivory/SM
+ivy/DSM
+ix
+j/F
+jab/SM
+jabbed
+jabber/SMDRZG
+jabberer/M
+jabbing
+jabot/SM
+jacaranda/MS
+jack/MDGS
+jackal/SM
+jackass/MS
+jackboot/SMD
+jackdaw/MS
+jacket/SMD
+jackhammer/MS
+jackknife/MGDS
+jackknives
+jackpot/MS
+jackrabbit/MS
+jackstraw/MS
+jacquard/M
+jade/MGDS
+jaded/PY
+jadedness/M
+jadeite/M
+jag/SM
+jagged/TPRY
+jaggedness/M
+jaggies
+jaguar/SM
+jail/MDRZGS
+jailbird/SM
+jailbreak/SM
+jailer/M
+jailhouse/S
+jalapeno/MS
+jalopy/SM
+jalousie/MS
+jam/SM
+jamb/MS
+jambalaya/M
+jamboree/MS
+jammed
+jamming
+jammy/RT
+jangle/DRSMZG
+jangler/M
+janitor/SM
+janitorial
+japan/SM
+japanned
+japanning
+jape/MGDS
+jar/SM
+jardiniere/SM
+jarful/MS
+jargon/M
+jarred
+jarring/Y
+jasmine/SM
+jasper/M
+jato/MS
+jaundice/DSMG
+jaunt/SGMD
+jauntily
+jauntiness/M
+jaunty/RPT
+java/M
+javelin/SM
+jaw/SGMD
+jawbone/DSMG
+jawbreaker/MS
+jawline/S
+jay/SM
+jaybird/SM
+jaywalk/DRSZG
+jaywalker/M
+jaywalking/M
+jazz/MDSG
+jazzy/TR
+jct
+jealous/Y
+jealousy/SM
+jean/MS
+jeans/M
+jeep/MS
+jeer/MDSG
+jeering/MY
+jeez
+jejuna
+jejune
+jejunum/M
+jell/DSG
+jello/S
+jelly/GDSM
+jellybean/MS
+jellyfish/MS
+jellylike
+jellyroll/SM
+jemmy/GDS
+jennet/MS
+jenny/SM
+jeopardize/GDS
+jeopardy/M
+jeremiad/MS
+jerk/MDSG
+jerkily
+jerkin/MS
+jerkiness/M
+jerkwater
+jerky/TRMP
+jeroboam/S
+jerrybuilt
+jerrycan/S
+jersey/MS
+jest/MDRSZG
+jester/M
+jesting/Y
+jet/SM
+jetliner/SM
+jetport/MS
+jetsam/M
+jetted
+jetting
+jettison/MDSG
+jetty/SM
+jewel/SZGMDR
+jeweler/M
+jewelry/SM
+jg
+jib/SGMD
+jibbed
+jibbing
+jibe/MS
+jiff/MS
+jiffy/SM
+jig's
+jig/AS
+jigged/A
+jigger's
+jigger/ASDG
+jigging/A
+jiggle/DSMG
+jiggly
+jigsaw/SMDG
+jihad/SM
+jihadist/SM
+jilt/MDSG
+jimmy/DSMG
+jimsonweed/M
+jingle/DSMG
+jingly
+jingoism/M
+jingoist/SM
+jingoistic
+jink/DSG
+jinn
+jinni/M
+jinrikisha/SM
+jinx/MDSG
+jitney/SM
+jitterbug/MS
+jitterbugged
+jitterbugger/M
+jitterbugging
+jitters/M
+jittery/RT
+jive/MGDS
+job/SM
+jobbed
+jobber/SM
+jobbing
+jobholder/MS
+jobless/P
+joblessness/M
+jobshare/S
+jobsworth
+jobsworths
+jock/MS
+jockey/SGMD
+jockstrap/MS
+jocose/PY
+jocoseness/M
+jocosity/M
+jocular/Y
+jocularity/M
+jocund/Y
+jocundity/M
+jodhpurs/M
+joey/S
+jog/SM
+jogged
+jogger/SM
+jogging/M
+joggle/DSMG
+john/MS
+johnny/SM
+johnnycake/MS
+join's
+join/AFDSG
+joiner/FMS
+joinery/M
+joint's
+joint/EGSD
+jointly/F
+joist/SM
+jojoba
+joke/MZGDRS
+joker/M
+jokey
+jokier
+jokiest
+joking/Y
+jollification/SM
+jollily
+jolliness/M
+jollity/M
+jolly/TGPDRSM
+jolt/MDRSZG
+jolter/M
+jonquil/SM
+josh/MDRSZG
+josher/M
+jostle/MGDS
+jot/SM
+jotted
+jotter/MS
+jotting/MS
+joule/SM
+jounce/MGDS
+jouncy
+journal/MS
+journalese/M
+journalism/M
+journalist/SM
+journalistic
+journey/ZGMDRS
+journeyer/M
+journeyman/M
+journeymen
+journo/S
+joust/SZGMDR
+jouster/M
+jousting/M
+jovial/Y
+joviality/M
+jowl/MS
+jowly/TR
+joy/SGMD
+joyful/YP
+joyfuller
+joyfullest
+joyfulness/M
+joyless/PY
+joylessness/M
+joyous/YP
+joyousness/M
+joyridden
+joyride/RSMZG
+joyrider/M
+joyriding/M
+joyrode
+joystick/SM
+jr
+jubilant/Y
+jubilation/M
+jubilee/SM
+judder/GDS
+judge's
+judge/ADSG
+judgeship/M
+judgment/SM
+judgmental/Y
+judicatory/SM
+judicature/M
+judicial/Y
+judiciary/SM
+judicious/IYP
+judiciousness/IM
+judo/M
+jug/SM
+jugful/MS
+jugged
+juggernaut/SM
+jugging
+juggle/MZGDRS
+juggler/M
+jugglery/M
+jugular/SM
+juice/DRSMZG
+juicer/M
+juicily
+juiciness/M
+juicy/PTR
+jujitsu/M
+jujube/MS
+jukebox/MS
+julep/SM
+julienne
+jumble/MGDS
+jumbo/SM
+jump/MDRSZG
+jumper/M
+jumpily
+jumpiness/M
+jumpsuit/MS
+jumpy/TRP
+jun
+junco/SM
+junction/FISM
+juncture/FMS
+jungle/MS
+junior/MS
+juniper/SM
+junk/MDRSZG
+junker/M
+junket/MDSG
+junketeer/MS
+junkie/MTRS
+junkyard/MS
+junta/SM
+juridic
+juridical/Y
+jurisdiction/SM
+jurisdictional
+jurisprudence/M
+jurist/MS
+juristic
+juror/SM
+jury/ISM
+juryman/M
+jurymen
+jurywoman/M
+jurywomen
+just/RYPT
+justice/IMS
+justifiable/U
+justifiably/U
+justification/M
+justified/U
+justify/XGDSN
+justness/M
+jut/SM
+jute/M
+jutted
+jutting
+juvenile/SM
+juxtapose/DSG
+juxtaposition/SM
+k/IFGS
+kHz
+kW
+kWh
+kabbalah
+kaboom
+kabuki/M
+kaddish/MS
+kaffeeklatch/MS
+kaffeeklatsch/MS
+kahuna/S
+kaiser/MS
+kale/M
+kaleidoscope/MS
+kaleidoscopic
+kaleidoscopically
+kamikaze/MS
+kana
+kangaroo/MS
+kanji
+kaolin/M
+kapok/M
+kappa/SM
+kaput
+karakul/M
+karaoke/MS
+karat/SM
+karate/M
+karma/M
+karmic
+kart/MS
+katakana
+katydid/SM
+kayak/SMDG
+kayaking/M
+kayo/MDSG
+kazoo/SM
+kc
+kebab/SM
+kedgeree
+keel/MDSG
+keelhaul/DGS
+keen/MDRYSTGP
+keenness/M
+keep/MRSZG
+keeper/M
+keeping/M
+keepsake/MS
+keg/SM
+kelp/M
+kelvin/SM
+ken/SM
+kenned
+kennel/SGMD
+kenning
+keno/M
+kepi/MS
+kept
+keratin/M
+keratitis
+kerbside
+kerchief/SM
+kerfuffle/S
+kernel/SM
+kerosene/M
+kestrel/MS
+ketch/MS
+ketchup/M
+keto
+ketogenic
+ketone/S
+kettle/SM
+kettledrum/SM
+key/SGMD
+keybinding/S
+keyboard/ZGSMDR
+keyboarder/M
+keyboardist/SM
+keyhole/MS
+keynote/MZGDRS
+keynoter/M
+keypad/SM
+keypunch/ZGMDRS
+keypuncher/M
+keystone/MS
+keystroke/SM
+keyword/MS
+kg
+khaki/SM
+khan/MS
+kibble/DSMG
+kibbutz/MS
+kibbutzim
+kibitz/ZGDRS
+kibitzer/M
+kibosh/M
+kick/MDRSZG
+kickback/SM
+kickball/M
+kickboxing
+kicker/M
+kickoff/MS
+kickstand/MS
+kicky/RT
+kid/SM
+kidded
+kidder/SM
+kiddie/SM
+kidding
+kiddish
+kiddo/SM
+kidnap/S
+kidnapped
+kidnapper/MS
+kidnapping/MS
+kidney/SM
+kidskin/M
+kielbasa/MS
+kielbasi
+kike/S
+kill/JMDRSZG
+killdeer/SM
+killer/M
+killing/M
+killjoy/SM
+kiln/MDSG
+kilo/MS
+kilobyte/SM
+kilocoulomb/S
+kilocycle/SM
+kilogram/SM
+kilohertz/M
+kilojoule/S
+kiloliter/MS
+kilometer/MS
+kilonewton/S
+kilopascal/S
+kiloton/SM
+kilovolt/S
+kilowatt/SM
+kilt/MDRS
+kilter/M
+kimono/MS
+kin/M
+kinase
+kind's
+kind/UPRYT
+kinda
+kindergarten/MS
+kindergartner/SM
+kindhearted/PY
+kindheartedness/M
+kindle/AGDS
+kindliness/M
+kindling/M
+kindly/URT
+kindness/UM
+kindnesses
+kindred/M
+kinds
+kine/S
+kinematic/S
+kinematics/M
+kinetic/S
+kinetically
+kinetics/M
+kinfolk/SM
+kinfolks/M
+king/MYS
+kingdom/SM
+kingfisher/SM
+kingly/RT
+kingmaker/S
+kingpin/SM
+kingship/M
+kink/MDSG
+kinkily
+kinkiness/M
+kinky/TPR
+kinsfolk/M
+kinship/M
+kinsman/M
+kinsmen
+kinswoman/M
+kinswomen
+kiosk/SM
+kip/SM
+kipped
+kipper/MDGS
+kipping
+kirsch/MS
+kismet/M
+kiss/MDRSBZG
+kisser/M
+kissoff/SM
+kissogram/S
+kit/SGMD
+kitchen/SM
+kitchenette/MS
+kitchenware/M
+kite/MS
+kith/M
+kitsch/M
+kitschy
+kitted
+kitten/MS
+kittenish
+kitting
+kitty/SM
+kiwi/MS
+kiwifruit/MS
+kl
+klaxon/S
+kleptocracy
+kleptomania/M
+kleptomaniac/SM
+kludge/GDS
+kluge/DS
+klutz/MS
+klutziness/M
+klutzy/TRP
+km
+kn
+knack/SZMR
+knacker/GD
+knapsack/MS
+knave/SM
+knavery/M
+knavish/Y
+knead/SZGDR
+kneader/M
+knee/MDS
+kneecap/SM
+kneecapped
+kneecapping
+kneeing
+kneel/SG
+knell/SGMD
+knelt
+knew
+knicker/S
+knickerbockers/M
+knickers/M
+knickknack/MS
+knife/DSMG
+knight/MDYSG
+knighthood/MS
+knightliness/M
+knish/MS
+knit/MS
+knitted
+knitter/SM
+knitting/M
+knitwear/M
+knives
+knob/MS
+knobbly
+knobby/TR
+knock/SZGMDR
+knockabout
+knockdown/SM
+knocker/M
+knockoff/SM
+knockout/SM
+knockwurst/SM
+knoll/SM
+knot/MS
+knothole/SM
+knotted
+knotting
+knotty/TR
+know/SB
+knowing/UYS
+knowledge/M
+knowledgeable
+knowledgeably
+known
+knuckle/DSMG
+knuckleduster/S
+knucklehead/MS
+knurl/SGMD
+koala/SM
+koan/S
+kohl
+kohlrabi/M
+kohlrabies
+kola/MS
+kook/MS
+kookaburra/SM
+kookiness/M
+kooky/TPR
+kopeck/MS
+korma
+kosher/DSG
+kowtow/GMDS
+kph
+kraal/SM
+kraut/SM!
+krill/M
+krona/M
+krone/RM
+kronor
+kronur
+krypton/M
+kt
+kuchen/SM
+kudos/M
+kudzu/SM
+kumquat/MS
+kvetch/ZGMDRS
+kvetcher/M
+kw
+l/SDXTGJ
+la/M
+lab/SM
+label's
+label/ASDG
+labeled/U
+labia
+labial/SM
+labile
+labium/M
+labor/SMDRZG
+laboratory/SM
+laborer/M
+laborious/PY
+laboriousness/M
+laborsaving
+laburnum/MS
+labyrinth/M
+labyrinthine
+labyrinths
+lac/M
+lace's
+lace/UGDS
+lacerate/DSGNX
+laceration/M
+lacewing/SM
+lacework/M
+lachrymal
+lachrymose
+lack/MDSG
+lackadaisical/Y
+lackey/SM
+lackluster
+laconic
+laconically
+lacquer/GMDS
+lacrosse/M
+lactate/GNDS
+lactation/M
+lacteal
+lactic
+lactose/M
+lacuna/M
+lacunae
+lacy/RT
+lad/SGMDNJ
+ladder/GSMD
+laddie/SM
+laddish/P
+lade/S
+laden/U
+lading/M
+ladle/DSMG
+lady/SM
+ladybird/SM
+ladybug/MS
+ladyfinger/MS
+ladylike/U
+ladylove/MS
+ladyship/MS
+laetrile/M
+lag/SZMR
+lager/M
+laggard/MYS
+lagged
+lagging/M
+lagniappe/SM
+lagoon/SM
+laid/IA
+lain
+lair/MS
+laird/SM
+laity/M
+lake/MS
+lakefront/S
+lakeside
+lam/SM
+lama/MS
+lamasery/SM
+lamb/MDSG
+lambada/MS
+lambaste/GDS
+lambda/SM
+lambency/M
+lambent/Y
+lambkin/SM
+lambskin/SM
+lambswool
+lame/MYZTGDRSP
+lamebrain/MDS
+lameness/M
+lament/BSMDG
+lamentably
+lamentation/MS
+lamina/M
+laminae
+laminar
+laminate/MGNDS
+lamination/M
+lammed
+lamming
+lamp/MS
+lampblack/M
+lamplight/MRZ
+lamplighter/M
+lampoon/SGMD
+lamppost/SM
+lamprey/MS
+lampshade/SM
+lanai/SM
+lance/DRSMZG
+lancer/M
+lancet/SM
+land/MDRSGJ
+landau/SM
+landfall/MS
+landfill/MS
+landholder/SM
+landholding/MS
+landing/M
+landlady/SM
+landless/M
+landline/MS
+landlocked
+landlord/MS
+landlubber/MS
+landmark/MS
+landmass/MS
+landmine/S
+landowner/MS
+landownership
+landowning/SM
+landscape/MZGDRS
+landscaper/M
+landslid
+landslide/MGS
+landslip/S
+landsman/M
+landsmen
+landward/S
+lane/MS
+language/MS
+languid/PY
+languidness/M
+languish/DSG
+languor/SM
+languorous/Y
+lank/RYTP
+lankiness/M
+lankness/M
+lanky/RTP
+lanolin/M
+lantern/MS
+lanthanum/M
+lanyard/MS
+lap/SM
+laparoscopic
+laparoscopy
+laparotomy
+lapboard/SM
+lapdog/SM
+lapel/SM
+lapidary/SM
+lapin/SM
+lapped
+lappet/SM
+lapping
+lapse/AKGMSD
+laptop/SM
+lapwing/MS
+larboard/SM
+larcenist/SM
+larcenous
+larceny/SM
+larch/MS
+lard/MDRSZG
+larder/M
+lardy/RT
+large/RSPMYT
+largehearted
+largeness/M
+largess/M
+largish
+largo/SM
+lariat/SM
+lark/MDSG
+larkspur/SM
+larva/M
+larvae
+larval
+laryngeal
+larynges
+laryngitis/M
+larynx/M
+lasagna/MS
+lascivious/YP
+lasciviousness/M
+lase/ZGDRS
+laser/M
+lash/MDSGJ
+lashing/M
+lass/MS
+lassie/SM
+lassitude/M
+lasso/SMDG
+last/MDYSG
+lasting/Y
+lat/S
+latch's
+latch/UDSG
+latchkey/SM
+late/YTRP
+latecomer/MS
+latency/M
+lateness/M
+latent
+lateral/MDYSG
+latest/M
+latex/M
+lath/MDRSZG
+lathe/M
+lather/GMD
+lathery
+laths
+latices
+latish
+latitude/MS
+latitudinal
+latitudinarian/MS
+latrine/MS
+latte/RSM
+latter/MY
+lattice/MDS
+latticework/SM
+laud/MDSGB
+laudably
+laudanum/M
+laudatory
+laugh/BMDG
+laughably
+laughing/MY
+laughingstock/SM
+laughs
+laughter/M
+launch/AGMDS
+launcher/SM
+launchpad/SM
+launder/DRZGS
+launderer/M
+launderette/SM
+laundress/MS
+laundromat/MS
+laundry/SM
+laundryman/M
+laundrymen
+laundrywoman/M
+laundrywomen
+laureate/MS
+laureateship/M
+laurel/SM
+lav/SGD
+lava/M
+lavage/M
+lavaliere/SM
+lavatorial
+lavatory/SM
+lave/S
+lavender/SM
+lavish/PTGDRSY
+lavishness/M
+law/SM
+lawbreaker/SM
+lawbreaking/M
+lawful/UPY
+lawfulness/UM
+lawgiver/MS
+lawless/PY
+lawlessness/M
+lawmaker/MS
+lawmaking/M
+lawman/M
+lawmen
+lawn/MS
+lawnmower/SM
+lawrencium/M
+lawsuit/MS
+lawyer/SM
+lax/TRYP
+laxative/MS
+laxity/M
+laxness/M
+lay/AICSGM
+layabout/S
+layaway/M
+layer/CSM
+layered
+layering/M
+layette/MS
+layman/M
+laymen
+layoff/SM
+layout/SM
+layover/MS
+laypeople
+layperson/MS
+layup/SM
+laywoman/M
+laywomen
+laze/MGDS
+lazily
+laziness/M
+lazy/DRSTGP
+lazybones/M
+lb/S
+lbw
+lea/SM
+leach/DSG
+lead/MDNRSZG
+leader/M
+leaderless
+leadership/SM
+leading/M
+leaf/MDSG
+leafage/M
+leafless
+leaflet/GMDS
+leafstalk/MS
+leafy/RT
+league/DSMG
+leak/MDSG
+leakage/MS
+leakiness/M
+leaky/PRT
+lean/MDRSTGJP
+leaning/M
+leanness/M
+leap/MDRSZG
+leaper/M
+leapfrog/MS
+leapfrogged
+leapfrogging
+leapt
+learn/AUGDS
+learnability
+learnable
+learnedly
+learner/MS
+learning's
+lease/ADSMG
+leaseback/SM
+leasehold/MRSZ
+leaseholder/M
+leaser/SM
+leash's
+leash/UDSG
+least/M
+leastwise
+leather/MS
+leatherette/M
+leatherneck/MS
+leathery
+leave/DRSMZGJ
+leaven/SGMD
+leavened/U
+leavening/M
+leaver/M
+leavings/M
+lech/MDRSZG
+lecher/M
+lecherous/PY
+lecherousness/M
+lechery/M
+lecithin/M
+lectern/MS
+lecture/MZGDRS
+lecturer/M
+lectureship/SM
+ledge/RSMZ
+ledger/M
+lee/RSMZ
+leech/MDSG
+leek/MS
+leer/MDG
+leeriness/M
+leery/RPT
+leeward/SM
+leeway/M
+left/MRST
+leftism/M
+leftist/SM
+leftmost
+leftover/SM
+leftward/S
+lefty/SM
+leg/SM
+legacy/SM
+legal/SMY
+legalese/M
+legalism/MS
+legalistic
+legalistically
+legality/SM
+legalization/M
+legalize/GDS
+legate/CXMNS
+legatee/MS
+legation's/AC
+legato/SM
+legend/SM
+legendarily
+legendary
+legerdemain/M
+legged
+legginess/M
+legging/MS
+leggy/RPT
+leghorn/MS
+legibility/M
+legible
+legibly
+legion/SM
+legionary/SM
+legionnaire/SM
+legislate/DSGNV
+legislation/M
+legislative/Y
+legislator/MS
+legislature/SM
+legit
+legitimacy/M
+legitimate/DSYG
+legitimatize/GDS
+legitimization/M
+legitimize/DSG
+legless
+legman/M
+legmen
+legroom/SM
+legume/MS
+leguminous
+legwarmer/S
+legwork/M
+lei/SM
+leisure/DMY
+leisureliness/M
+leisurewear/M
+leitmotif/MS
+leitmotiv/MS
+lemma/S
+lemme/JG
+lemming/M
+lemon/SM
+lemonade/SM
+lemongrass
+lemony
+lemur/SM
+lend/RSZG
+lender/M
+length/MNX
+lengthen/GD
+lengthily
+lengthiness/M
+lengths
+lengthwise
+lengthy/PRT
+lenience/M
+leniency/M
+lenient/Y
+lenitive
+lens/MS
+lent
+lentil/MS
+lento
+leonine
+leopard/SM
+leopardess/MS
+leotard/SM
+leper/SM
+leprechaun/MS
+leprosy/M
+leprous
+lepta
+lepton/MS
+lesbian/SM
+lesbianism/M
+lesion/MS
+less/MNRX
+lessee/MS
+lessen/GD
+lesson/MS
+lessor/MS
+let/ISM
+letdown/SM
+lethal/Y
+lethargic
+lethargically
+lethargy/M
+letter/ZGMDRS
+letterbomb/S
+letterbox/S
+lettered/U
+letterer/M
+letterhead/MS
+lettering/M
+letterpress/M
+letting/S
+lettuce/MS
+letup/SM
+leucine
+leucotomy/S
+leukemia/M
+leukemic/SM
+leukocyte/MS
+levee/SM
+level/PSZGMDRY
+leveler/M
+levelheaded/P
+levelheadedness/M
+levelness/M
+lever/SGMD
+leverage's
+leverage/CDSG
+leviathan/MS
+levier/M
+levitate/DSGN
+levitation/M
+levity/M
+levy/DRSMZG
+lewd/RYPT
+lewdness/M
+lexer/S
+lexical
+lexicographer/MS
+lexicographic
+lexicographical
+lexicography/M
+lexicon/SM
+lexis
+lg
+liabilities
+liability/AM
+liable/A
+liaise/GDS
+liaison/MS
+liar/MS
+lib/M
+libation/SM
+libber/MS
+libel/SZGMDR
+libeler/M
+libelous
+liberal/MYPS
+liberalism/M
+liberality/M
+liberalization/SM
+liberalize/GDS
+liberalness/M
+liberate/CDSGN
+liberation/CM
+liberator/MS
+libertarian/SM
+libertine/MS
+liberty/SM
+libidinal
+libidinous
+libido/MS
+librarian/MS
+librarianship
+library/SM
+librettist/MS
+libretto/SM
+lice
+license/MGDS
+licensed/U
+licensee/MS
+licentiate/SM
+licentious/YP
+licentiousness/M
+lichen/MS
+licit/Y
+lick/MDJSG
+licking/M
+licorice/SM
+lid/SM
+lidded
+lidless
+lido/MS
+lie/DSM
+lied/MR
+lief/RT
+liege/SM
+lien/MS
+lieu/M
+lieutenancy/M
+lieutenant/MS
+life/MZR
+lifebelt/S
+lifeblood/M
+lifeboat/MS
+lifebuoy/MS
+lifeforms
+lifeguard/SM
+lifeless/YP
+lifelessness/M
+lifelike
+lifeline/MS
+lifelong
+lifer/M
+lifesaver/SM
+lifesaving/M
+lifespan/S
+lifestyle/SM
+lifetime/MS
+lifework/MS
+lift/MDRSZG
+lifter/M
+liftoff/SM
+ligament/MS
+ligate/GNDS
+ligation/M
+ligature/MGDS
+light's/C
+light/CASTGD
+lighted/U
+lighten/SDRZG
+lightener/M
+lighter/SM
+lightface/MD
+lightheaded
+lighthearted/YP
+lightheartedness/M
+lighthouse/MS
+lighting's
+lightly
+lightness/M
+lightning/MDS
+lightproof
+lightship/MS
+lightweight/SM
+ligneous
+lignin
+lignite/M
+lii
+likability/M
+likable/P
+likableness/M
+like/EMGDST
+likelihood/UM
+likelihoods
+likeliness/UM
+likely/UPRT
+liken/SGD
+likeness/UM
+likenesses
+liker
+likewise
+liking/M
+lilac/SM
+lilliputian
+lilo/S
+lilt/MDSG
+lily/SM
+limb/MS
+limber/UDSG
+limberness/M
+limbless
+limbo/SM
+lime/MGDS
+limeade/SM
+limelight/M
+limerick/SM
+limescale
+limestone/M
+limey/S
+limit's
+limit/CSZGDR
+limitation/CM
+limitations
+limited/U
+limiter's
+limiting/S
+limitless/P
+limitlessness/M
+limn/DSG
+limo/MS
+limousine/MS
+limp/MDRYSPTG
+limpet/MS
+limpid/YP
+limpidity/M
+limpidness/M
+limpness/M
+limy/RT
+linage/M
+linchpin/SM
+linden/MS
+line/MZGDRSJ
+lineage/MS
+lineal/Y
+lineament/SM
+linear/Y
+linearity/M
+linebacker/MS
+lined/U
+linefeed
+lineman/M
+linemen
+linen/SM
+linens/M
+liner/M
+linesman/M
+linesmen
+lineup/MS
+ling/M
+linger/ZGJDRS
+lingerer/M
+lingerie/M
+lingering/Y
+lingo/M
+lingoes
+lingual
+linguine/M
+linguist/SM
+linguistic/S
+linguistically
+linguistics/M
+liniment/SM
+lining/M
+link/MDRSG
+linkage/MS
+linkman
+linkmen
+linkup/MS
+linnet/MS
+lino
+linoleum/M
+linseed/M
+lint's
+lint/CDG
+lintel/MS
+lints
+linty/TR
+lion/MS
+lioness/MS
+lionhearted
+lionization/M
+lionize/GDS
+lip/SM
+lipid/SM
+liposuction/M
+lipped
+lippy
+lipread/GRS
+lipreader/M
+lipreading/M
+lipstick/MDSG
+liq
+liquefaction/M
+liquefy/DSG
+liqueur/SM
+liquid/MS
+liquidate/XGNDS
+liquidation/M
+liquidator/MS
+liquidity/M
+liquidize/ZGDRS
+liquidizer/M
+liquor/MDGS
+lira/M
+lire
+lisle/M
+lisp/MDRSZG
+lisper/M
+lissome
+list/MDNSJXG
+listed/U
+listen/BMDRZG
+listener/M
+listeria
+listing/M
+listless/YP
+listlessness/M
+lit/ZR
+litany/SM
+litchi/MS
+lite
+liter/M
+literacy/M
+literal/SMYP
+literalness/M
+literariness/M
+literary/P
+literate/SMY
+literati/M
+literature/M
+lithe/RPYT
+litheness/M
+lithesome
+lithium/M
+lithograph/MDRZG
+lithographer/M
+lithographic
+lithographically
+lithographs
+lithography/M
+lithosphere/SM
+litigant/SM
+litigate/DSGN
+litigation/M
+litigator/MS
+litigious/P
+litigiousness/M
+litmus/M
+litotes/M
+litter/MDRSZG
+litterateur/MS
+litterbug/MS
+litterer/M
+little/MTRP
+littleness/M
+littoral/SM
+liturgical/Y
+liturgist/SM
+liturgy/SM
+livability/M
+livable/U
+live/ATGDSB
+livelihood/SM
+liveliness/M
+livelong/S
+lively/PRT
+liven/SGD
+liver's
+liver/S
+liveried
+liverish
+liverwort/MS
+liverwurst/M
+livery/CSM
+liveryman/CM
+liverymen/C
+livestock/M
+liveware
+livid/Y
+living/MS
+lix/K
+lizard/MS
+ll
+llama/SM
+llano/SM
+lo
+load's
+load/AUGSD
+loadable
+loader/MS
+loading's
+loaf/MDRSZG
+loafer/M
+loam/M
+loamy/TR
+loan/MDRSZG
+loaner/M
+loansharking/M
+loanword/MS
+loath/JZGDRS
+loathe
+loather/M
+loathing/M
+loathsome/PY
+loathsomeness/M
+loaves
+lob/SMD
+lobar
+lobbed
+lobber/MS
+lobbing
+lobby/GDSM
+lobbyist/MS
+lobe/MS
+lobotomize/DSG
+lobotomy/SM
+lobster/MS
+local/SMY
+locale/MS
+locality/SM
+localization/M
+localize/DSG
+locate/EAGNDS
+location's/A
+location/ESM
+locator/MS
+locavore/SM
+loci
+lock/MDRSBZG
+locker/M
+locket/MS
+lockjaw/M
+lockout/MS
+locksmith/M
+locksmiths
+lockstep/M
+lockup/MS
+loco/S
+locomotion/M
+locomotive/MS
+locoweed/SM
+locum/S
+locus/M
+locust/SM
+locution/MS
+lode/MS
+lodestar/MS
+lodestone/MS
+lodge/DRSJMZG
+lodger/M
+lodging/M
+lodgings/M
+loft/MDSG
+loftily
+loftiness/M
+lofty/PRT
+log/SM
+loganberry/SM
+logarithm/SM
+logarithmic
+logbook/SM
+loge/MS
+logged
+logger/SM
+loggerhead/SM
+loggia/SM
+logging/M
+logic/M
+logical/Y
+logicality/M
+logician/MS
+login/SM
+logistic/S
+logistical/Y
+logistics/M
+logjam/SM
+logo/MS
+logoff/SM
+logon/SM
+logotype/SM
+logout/SM
+logrolling/M
+logy/RT
+loin/MS
+loincloth/M
+loincloths
+loiter/ZGSDR
+loiterer/M
+loitering/M
+lolcat/SM
+loll/DSG
+lollipop/SM
+lollop/GSD
+lolly/S
+lollygag/S
+lollygagged
+lollygagging
+lone/YZR
+loneliness/M
+lonely/PTR
+loner/M
+lonesome/YP
+lonesomeness/M
+long's
+long/KDSTG
+longboat/MS
+longbow/MS
+longer
+longevity/M
+longhair/MS
+longhand/M
+longhorn/MS
+longhouse/S
+longing/MYS
+longish
+longitude/MS
+longitudinal/Y
+longshoreman/M
+longshoremen
+longsighted
+longstanding
+longtime
+longueur/SM
+longways
+loo
+loofah/M
+loofahs
+look/MDRSZG
+lookalike/MS
+looker/M
+lookout/MS
+lookup
+loom/MDSG
+loon/MS
+loonie/M
+loony/RSMT
+loop/MDSG
+loophole/MS
+loopy/RT
+loos/NRX
+loose/UDSTG
+loosely
+loosen/UGSD
+looseness/M
+loot/MDRSZG
+looter/M
+looting/M
+lop/S
+lope/MGDS
+lopped
+lopping
+lopsided/YP
+lopsidedness/M
+loquacious/PY
+loquaciousness/M
+loquacity/M
+lord/MDYSG
+lordliness/M
+lordly/TPR
+lordship/SM
+lore/M
+lorgnette/SM
+loris/MS
+lorn
+lorry/SM
+lose/ZGRSJ
+loser/M
+losing/M
+loss/MS
+lossless
+lost
+lot/SM
+lotion/SM
+lottery/SM
+lotto/M
+lotus/MS
+louche
+loud/RYTP
+loudhailer/SM
+loudmouth/MD
+loudmouths
+loudness/M
+loudspeaker/MS
+lough
+loughs
+lounge/MZGDRS
+lounger/M
+lour/DSG
+louse's
+louse/CDSG
+lousily
+lousiness/M
+lousy/TPR
+lout/MS
+loutish/PY
+louver/MDS
+lovableness/M
+lovably
+love/MYZGDRSB
+lovebird/SM
+lovechild/M
+loved/U
+loveless
+loveliness/M
+lovelorn
+lovely/RSMTP
+lovemaking/M
+lover/M
+lovesick
+lovey/S
+loving/Y
+low/SZTGMDRYP
+lowborn
+lowboy/MS
+lowbrow/SM
+lowdown/M
+lower/GD
+lowercase/M
+lowermost
+lowish
+lowland/SZMR
+lowlander/M
+lowlife/SM
+lowliness/M
+lowly/TPR
+lowness/M
+lox/M
+loyal/ETY
+loyaler
+loyalism/M
+loyalist/SM
+loyalties
+loyalty/EM
+lozenge/SM
+ltd
+luau/MS
+lubber/MYS
+lube/MGDS
+lubricant/SM
+lubricate/DSGN
+lubrication/M
+lubricator/MS
+lubricious/Y
+lubricity/M
+lucid/PY
+lucidity/M
+lucidness/M
+luck/MDSG
+luckily/U
+luckiness/UM
+luckless
+lucky/UPTR
+lucrative/YP
+lucrativeness/M
+lucre/M
+lucubrate/GNDS
+lucubration/M
+ludicrous/YP
+ludicrousness/M
+ludo
+luff/DSG
+lug/SM
+luge/S
+luggage/M
+lugged
+lugger/MS
+lugging
+lughole/S
+lugsail/SM
+lugubrious/YP
+lugubriousness/M
+lukewarm/YP
+lukewarmness/M
+lull/MDSG
+lullaby/SM
+lulu/S
+lumbago/M
+lumbar
+lumber/MDRZGS
+lumberer/M
+lumbering/M
+lumberjack/SM
+lumberman/M
+lumbermen
+lumberyard/SM
+lumen
+luminary/SM
+luminescence/M
+luminescent
+luminosity/M
+luminous/Y
+lummox/MS
+lump/MDNSG
+lumpectomy/S
+lumpenproletariat
+lumpiness/M
+lumpish
+lumpy/TRP
+lunacy/SM
+lunar
+lunatic/SM
+lunch/GMDS
+lunchbox/S
+luncheon/SM
+luncheonette/SM
+lunchroom/MS
+lunchtime/MS
+lung/MDSG
+lunge/SM
+lungfish/MS
+lungful/S
+lunkhead/MS
+lupine/MS
+lupus/M
+lurch/GMDS
+lure/MGDS
+lurgy
+lurid/PY
+luridness/M
+lurk/DRSZG
+luscious/PY
+lusciousness/M
+lush/MRSYPT
+lushness/M
+lust/MDRSG
+luster/M
+lusterless
+lustful/Y
+lustily
+lustiness/M
+lustrous/Y
+lusty/PTR
+lutanist/SM
+lute/MS
+lutenist/SM
+lutetium/M
+lux
+luxuriance/M
+luxuriant/Y
+luxuriate/DSGN
+luxuriation/M
+luxurious/PY
+luxuriousness/M
+luxury/SM
+lvi
+lvii
+lxi
+lxii
+lxiv
+lxix
+lxvi
+lxvii
+lyceum/MS
+lychgate/S
+lye/MG
+lying/M
+lymph/M
+lymphatic/SM
+lymphocyte/SM
+lymphoid
+lymphoma/SM
+lynch/JZGDRS
+lyncher/M
+lynching/M
+lynx/MS
+lyre/MS
+lyrebird/MS
+lyric/SM
+lyrical/Y
+lyricism/M
+lyricist/SM
+lysosomal
+lysosomes
+m/KAS
+ma'am
+ma/SMH
+mac/SGMD
+macabre
+macadam/M
+macadamia/SM
+macadamize/GDS
+macaque/MS
+macaroni/MS
+macaroon/MS
+macaw/SM
+mace/MS
+macerate/DSGN
+maceration/M
+mach/M
+machete/SM
+machinate/GNDSX
+machination/M
+machine/DSMGB
+machinery/M
+machinist/MS
+machismo/M
+macho/M
+mackerel/SM
+mackinaw/SM
+mackintosh/MS
+macrame/M
+macro/SM
+macrobiotic/S
+macrobiotics/M
+macrocosm/SM
+macroeconomic/S
+macroeconomics/M
+macrology/S
+macron/MS
+macrophages
+macroscopic
+mad/SMYP
+madam/SM
+madame/M
+madcap/MS
+madden/DGS
+maddening/Y
+madder/MS
+maddest
+madding
+made/AU
+mademoiselle/MS
+madhouse/SM
+madman/M
+madmen
+madness/M
+madras/MS
+madrasa/SM
+madrasah/M
+madrasahs
+madrassa/SM
+madrigal/SM
+madwoman/M
+madwomen
+maelstrom/SM
+maestro/SM
+mafia/SM
+mafiosi
+mafioso/M
+mag/SM
+magazine/SM
+mage/MS
+magenta/M
+maggot/MS
+maggoty
+magi/M
+magic/SM
+magical/Y
+magician/SM
+magicked
+magicking
+magisterial/Y
+magistracy/M
+magistrate/SM
+magma/M
+magnanimity/M
+magnanimous/Y
+magnate/SM
+magnesia/M
+magnesium/M
+magnet/MS
+magnetic
+magnetically
+magnetism/M
+magnetite/M
+magnetizable
+magnetization/CM
+magnetize/CGDS
+magneto/SM
+magnetometer/SM
+magnetosphere
+magnification/M
+magnificence/M
+magnificent/Y
+magnifier/M
+magnify/ZGXDRSN
+magniloquence/M
+magniloquent
+magnitude/SM
+magnolia/MS
+magnon
+magnum/MS
+magpie/MS
+magus/M
+maharajah/M
+maharajahs
+maharani/SM
+maharishi/SM
+mahatma/SM
+mahogany/SM
+mahout/MS
+maid/MNSX
+maiden/MY
+maidenhair/M
+maidenhead/SM
+maidenhood/M
+maidservant/SM
+mail/JMDRSZG
+mailbag/SM
+mailbomb/GSD
+mailbox/MS
+mailer/M
+mailing/M
+maillot/SM
+mailman/M
+mailmen
+mailshot/S
+maim/DSG
+main/MYS
+mainframe/SM
+mainland/MS
+mainline/MGDS
+mainmast/MS
+mainsail/MS
+mainspring/MS
+mainstay/MS
+mainstream/SMDG
+maintain/ZGBDRS
+maintainability
+maintainable/U
+maintained/U
+maintenance/M
+maintop/SM
+maisonette/MS
+maize/SM
+majestic
+majestically
+majesty/SM
+majolica/M
+major/SGMDY
+majordomo/MS
+majorette/MS
+majoritarian/SM
+majoritarianism
+majority/SM
+make's/A
+make/UAGS
+makeover/MS
+maker/SM
+makeshift/SM
+makeup/MS
+makeweight/S
+making/MS
+makings/M
+malachite/M
+maladjusted
+maladjustment/M
+maladministration
+maladroit/PY
+maladroitness/M
+malady/SM
+malaise/M
+malamute/MS
+malapropism/SM
+malaria/M
+malarial
+malarkey/M
+malathion/M
+malcontent/MS
+male/MPS
+malediction/SM
+malefaction/M
+malefactor/SM
+malefic
+maleficence/M
+maleficent
+maleness/M
+malevolence/M
+malevolent/Y
+malfeasance/M
+malformation/SM
+malformed
+malfunction/MDSG
+malice/M
+malicious/PY
+maliciousness/M
+malign/DSG
+malignancy/SM
+malignant/Y
+malignity/M
+malinger/ZGSDR
+malingerer/M
+mall/MS
+mallard/SM
+malleability/M
+malleable
+mallet/MS
+mallow/MS
+malnourished
+malnutrition/M
+malocclusion/M
+malodorous
+malpractice/SM
+malt/MDSG
+malted/MS
+maltose/M
+maltreat/GLDS
+maltreatment/M
+malty/TR
+malware/M
+mam/S
+mama/MS
+mamba/SM
+mambo/SGMD
+mamma/M
+mammal/MS
+mammalian/MS
+mammary
+mammogram/MS
+mammography/M
+mammon/M
+mammoth/M
+mammoths
+mammy/SM
+man's/F
+man/USY
+manacle/DSMG
+manage/ZGDRSL
+manageability/M
+manageable/U
+management/MS
+manager/M
+manageress/S
+managerial
+manana/MS
+manatee/SM
+mandala/SM
+mandamus/MS
+mandarin/MS
+mandate/DSMG
+mandatory
+mandible/MS
+mandibular
+mandolin/MS
+mandrake/MS
+mandrel/SM
+mandrill/MS
+mane/MDS
+manege/M
+maneuver/MDGSBJ
+maneuverability/M
+manful/Y
+manga/M
+manganese/M
+mange/DRMZ
+manger/M
+mangetout/S
+manginess/M
+mangle/MZGDRS
+mango/M
+mangoes
+mangrove/MS
+mangy/TRP
+manhandle/GDS
+manhole/SM
+manhood/M
+manhunt/SM
+mania/SM
+maniac/MS
+maniacal/Y
+manic/SM
+manically
+manicure/MGDS
+manicurist/MS
+manifest/MDYSG
+manifestation/SM
+manifesto/SM
+manifold/GMDS
+manikin/SM
+manila/M
+manioc/MS
+manipulable
+manipulate/XGNVDS
+manipulation/M
+manipulative/Y
+manipulator/MS
+mankind/M
+manky
+manlike
+manliness/M
+manly/UTR
+manna/M
+manned/U
+mannequin/SM
+manner/MDYS
+mannerism/SM
+mannerly/U
+manning/U
+mannish/YP
+mannishness/M
+manometer/SM
+manor/SM
+manorial
+manpower/M
+manque
+mansard/MS
+manse/SXMN
+manservant/M
+mansion/M
+manslaughter/M
+manta/SM
+mantel/MS
+mantelpiece/SM
+mantelshelf
+mantelshelves
+mantes
+mantilla/SM
+mantis/MS
+mantissa/SM
+mantle's
+mantle/EGDS
+mantra/MS
+manual/MYS
+manufacture/DRSMZG
+manufacturer/M
+manufacturing/M
+manumission/SM
+manumit/S
+manumitted
+manumitting
+manure/MGDS
+manuscript/MS
+many/M
+map's
+map/AS
+maple/SM
+mapmaker/SM
+mapped/A
+mapper/MS
+mapping/S
+mar/S
+marabou/MS
+marabout/SM
+maraca/MS
+maraschino/MS
+marathon/SMRZ
+marathoner/M
+maraud/ZGDRS
+marauder/M
+marble/MGDS
+marbleize/GDS
+marbling/M
+march/ZGMDRS
+marcher/M
+marchioness/MS
+mare/MS
+margarine/M
+margarita/MS
+marge
+margin/MS
+marginal/YS
+marginalia/M
+marginalization/M
+marginalize/GDS
+maria/M
+mariachi/MS
+marigold/MS
+marijuana/M
+marimba/SM
+marina/MS
+marinade/DSMG
+marinara/M
+marinate/DSGN
+marination/M
+marine/MZRS
+mariner/M
+marionette/MS
+marital/Y
+maritime
+marjoram/M
+mark/AMDSG
+markdown/SM
+marked/U
+markedly
+marker/MS
+market/MDRZGBS
+marketability/M
+marketable/U
+marketeer/SM
+marketer/M
+marketing/M
+marketplace/SM
+marking/SM
+markka/M
+markkaa
+marksman/M
+marksmanship/M
+marksmen
+markup/MS
+marl/M
+marlin/MS
+marlinespike/SM
+marmalade/M
+marmoreal
+marmoset/SM
+marmot/MS
+maroon/MDGS
+marque/MS
+marquee/SM
+marquess/MS
+marquetry/M
+marquis/MS
+marquise/M
+marquisette/M
+marred/U
+marriage/ASM
+marriageability/M
+marriageable
+married/SM
+marring
+marrow/MS
+marry/AGDS
+marsh/MS
+marshal/SMDG
+marshland/SM
+marshmallow/SM
+marshy/RT
+marsupial/MS
+mart/MNSX
+marten/M
+martensite
+martial/Y
+martian/S
+martin/MS
+martinet/MS
+martingale/MS
+martini/SM
+martyr/MDGS
+martyrdom/M
+marvel/MDGS
+marvelous/Y
+marzipan/M
+masc
+mascara/GMDS
+mascot/MS
+masculine/SM
+masculinity/M
+maser/SM
+mash/MDRSZG
+masher/M
+mashup/MS
+mask's
+mask/UDSG
+masker/MS
+masochism/M
+masochist/SM
+masochistic
+masochistically
+mason/SM
+masonic
+masonry/M
+masque/MS
+masquerade/DRSMZG
+masquerader/M
+mass/MDSGV
+massacre/MGDS
+massage/DSMG
+masseur/SM
+masseuse/MS
+massif/MS
+massive/PY
+massiveness/M
+mast/MDS
+mastectomy/SM
+master's
+master/ADGS
+masterclass/S
+masterful/Y
+masterly
+mastermind/SGMD
+masterpiece/MS
+masterstroke/SM
+masterwork/MS
+mastery/M
+masthead/MS
+mastic/M
+masticate/GNDS
+mastication/M
+mastiff/SM
+mastitis
+mastodon/SM
+mastoid/SM
+masturbate/GNDS
+masturbation/M
+masturbatory
+mat/SZGMDR
+matador/SM
+match/AMS
+matchbook/SM
+matchbox/MS
+matched/U
+matching
+matchless
+matchlock/SM
+matchmaker/MS
+matchmaking/M
+matchstick/MS
+matchwood/M
+mate/MS
+material/SMY
+materialism/M
+materialist/SM
+materialistic
+materialistically
+materialization/M
+materialize/DSG
+materiel/M
+maternal/Y
+maternity/M
+matey/S
+mathematical/Y
+mathematician/SM
+mathematics/M
+matinee/SM
+mating/M
+matins/M
+matriarch/M
+matriarchal
+matriarchs
+matriarchy/SM
+matrices
+matricidal
+matricide/MS
+matriculate/DSGN
+matriculation/M
+matrimonial
+matrimony/M
+matrix/M
+matron/MYS
+matte/DRSMZG
+matter/MDG
+matting/M
+mattock/SM
+mattress/MS
+maturate/GNDS
+maturation/M
+mature/YTGDRS
+maturity/SM
+matzo/SMH
+matzoh/M
+matzohs
+matzot
+maudlin
+maul/MDRSZG
+mauler/M
+maunder/SDG
+mausoleum/SM
+mauve/M
+maven/SM
+maverick/SM
+maw/SM
+mawkish/PY
+mawkishness/M
+max/GMDS
+maxi/MS
+maxilla/M
+maxillae
+maxillary
+maxim/SM
+maxima
+maximal/Y
+maximization/M
+maximize/GDS
+maximum/SM
+may/M
+maybe/SM
+mayday/MS
+mayflower/MS
+mayfly/SM
+mayhem/M
+mayn't
+mayo/M
+mayonnaise/M
+mayor/SM
+mayoral
+mayoralty/M
+mayoress/MS
+maypole/SM
+mayst
+maze/MS
+mazurka/MS
+mdse
+me/DSH
+mead/M
+meadow/MS
+meadowlark/MS
+meager/PY
+meagerness/M
+meal/MS
+mealiness/M
+mealtime/SM
+mealy/TPR
+mealybug/SM
+mealymouthed
+mean/MRYJPSTG
+meander/SMDJG
+meanderings/M
+meanie/M
+meaning/M
+meaningful/PY
+meaningfulness/M
+meaningless/YP
+meaninglessness/M
+meanness/M
+meant/U
+meantime/M
+meanwhile/M
+meany/SM
+meas
+measles/M
+measly/RT
+measurable
+measurably
+measure's
+measure/ADSG
+measured/U
+measureless
+measurement/MS
+meat/MS
+meatball/MS
+meathead/MS
+meatiness/M
+meatless
+meatloaf/M
+meatloaves
+meatpacking/M
+meaty/TPR
+mecca/SM
+mechanic/MS
+mechanical/Y
+mechanics/M
+mechanism/SM
+mechanistic
+mechanistically
+mechanization/M
+mechanize/DSG
+medal/SM
+medalist/MS
+medallion/SM
+meddle/ZGDRS
+meddler/M
+meddlesome
+media/SM
+medial/AY
+median/MS
+mediate/ADSGN
+mediated/U
+mediation/AM
+mediator/MS
+medic/SM
+medicaid/M
+medical/SMY
+medicament/M
+medicare/M
+medicate/GNXDS
+medication/M
+medicinal/Y
+medicine/MS
+medico/MS
+medieval
+medievalist/MS
+mediocre
+mediocrity/SM
+meditate/DSGNVX
+meditation/M
+meditative/Y
+medium/MS
+medley/MS
+medulla/SM
+medusa
+medusae
+meed/M
+meek/RYPT
+meekness/M
+meerschaum/SM
+meet/MJSG
+meeting/M
+meetinghouse/SM
+meetup/MS
+meg/S
+mega
+megabit/SM
+megabucks/M
+megabyte/MS
+megachurch/MS
+megacycle/SM
+megadeath/M
+megadeaths
+megagram/S
+megahertz/M
+megajoule/S
+megalith/M
+megalithic
+megaliths
+megalomania/M
+megalomaniac/SM
+megalopolis/MS
+megameter/S
+megapascal/S
+megaphone/DSMG
+megapixel/SM
+megastar/S
+megaton/SM
+megawatt/MS
+meh
+meiosis/M
+meiotic
+melamine/M
+melancholia/M
+melancholic/S
+melancholy/M
+melange/MS
+melanin/M
+melanoma/SM
+meld/MDSG
+melee/SM
+meliorate/GNVDS
+melioration/M
+mellifluous/PY
+mellifluousness/M
+mellow/PTGDRYS
+mellowness/M
+melodic
+melodically
+melodious/YP
+melodiousness/M
+melodrama/MS
+melodramatic/S
+melodramatically
+melodramatics/M
+melody/SM
+melon/SM
+melt's
+melt/ADSG
+meltdown/SM
+member's
+member/EAS
+membership/SM
+membrane/SM
+membranous
+meme/MS
+memento/MS
+memo/MS
+memoir/MS
+memorabilia/M
+memorability/M
+memorable/U
+memorably
+memorandum/MS
+memorial/SM
+memorialize/DSG
+memorization/M
+memorize/DSG
+memory/SM
+memsahib/S
+men/M
+menace/MGDS
+menacing/Y
+menage/MS
+menagerie/MS
+mend/MDRSZG
+mendacious/Y
+mendacity/M
+mendelevium/M
+mender/M
+mendicancy/M
+mendicant/SM
+mending/M
+menfolk/MS
+menfolks/M
+menhaden/M
+menial/MYS
+meningeal
+meninges
+meningitis/M
+meninx/M
+menisci
+meniscus/M
+menopausal
+menopause/M
+menorah/M
+menorahs
+mensch/MS
+menservants
+menses/M
+menstrual
+menstruate/GNDS
+menstruation/M
+mensurable
+mensuration/M
+menswear/M
+mental/Y
+mentalist/SM
+mentality/SM
+menthol/M
+mentholated
+mention/GSMD
+mentioned/U
+mentor/MDSG
+mentorship
+menu/MS
+meow/MDSG
+mercantile
+mercantilism/M
+mercenary/SM
+mercer/MS
+mercerize/GDS
+merchandise/MZGDRS
+merchandiser/M
+merchandising/M
+merchant/MBS
+merchantman/M
+merchantmen
+merciful/UY
+merciless/PY
+mercilessness/M
+mercurial/Y
+mercuric
+mercury/M
+mercy/SM
+mere/MYTS
+meretricious/YP
+meretriciousness/M
+merganser/MS
+merge/DRSZG
+merger/M
+meridian/MS
+meringue/MS
+merino/MS
+merit/CSM
+merited/U
+meriting
+meritless
+meritocracy/SM
+meritocratic
+meritorious/PY
+meritoriousness/M
+mermaid/SM
+merman/M
+mermen
+merrily
+merriment/M
+merriness/M
+merry/TRP
+merrymaker/MS
+merrymaking/M
+mesa/MS
+mescal/MS
+mescalin
+mescaline/M
+mesdames
+mesdemoiselles
+mesh/MDSG
+mesmeric
+mesmerism/M
+mesmerize/ZGDRS
+mesmerizer/M
+mesomorph/M
+mesomorphs
+meson/SM
+mesosphere/SM
+mesquite/SM
+mess/MDSG
+message/MGDS
+messeigneurs
+messenger/SM
+messiah/M
+messiahs
+messianic
+messieurs
+messily
+messiness/M
+messmate/SM
+messy/PTR
+mestizo/MS
+met
+meta
+metabolic
+metabolically
+metabolism/SM
+metabolite/SM
+metabolize/DSG
+metacarpal/SM
+metacarpi
+metacarpus/M
+metadata
+metal/SMD
+metalanguage/MS
+metallic
+metallurgic
+metallurgical
+metallurgist/MS
+metallurgy/M
+metalwork/MRZG
+metalworker/M
+metalworking/M
+metamorphic
+metamorphism/M
+metamorphose/GDS
+metamorphosis/M
+metaphor/MS
+metaphoric
+metaphorical/Y
+metaphysical/Y
+metaphysics/M
+metastases
+metastasis/M
+metastasize/DSG
+metastatic
+metatarsal/MS
+metatarsi
+metatarsus/M
+metatheses
+metathesis/M
+mete/MZGDRS
+metempsychoses
+metempsychosis/M
+meteor/MS
+meteoric
+meteorically
+meteorite/SM
+meteoroid/SM
+meteorologic
+meteorological
+meteorologist/SM
+meteorology/M
+meter/GMD
+metformin
+methadone/M
+methamphetamine/M
+methane/M
+methanol/M
+methinks
+method/MS
+methodical/YP
+methodicalness/M
+methodological/Y
+methodology/SM
+methotrexate
+methought
+meths
+methyl/M
+meticulous/YP
+meticulousness/M
+metier/MS
+metric/S
+metrical/Y
+metricate/GNDS
+metrication/M
+metricize/GDS
+metro/SM
+metronome/MS
+metropolis/MS
+metropolitan
+mettle/M
+mettlesome
+mew/SGMD
+mewl/DSG
+mews/M
+mezzanine/MS
+mezzo/SM
+mfg
+mfr/S
+mg
+mgr
+mi/MNX
+miasma/MS
+mic/S
+mica/M
+mice
+mick/S
+mickey/MS
+micro/SM
+microaggression/SM
+microbe/MS
+microbial
+microbiological
+microbiologist/MS
+microbiology/M
+microbrewery/SM
+microchip/MS
+microcircuit/SM
+microcode
+microcomputer/MS
+microcosm/MS
+microcosmic
+microdot/SM
+microeconomics/M
+microelectronic/S
+microelectronics/M
+microfiber/MS
+microfiche/M
+microfilm/GMDS
+microfinance
+microfloppies
+microgroove/SM
+microlight/MS
+microloan/MS
+micromanage/ZGDRSL
+micromanagement/M
+micromanager/M
+micrometeorite/SM
+micrometer/MS
+micron/MS
+microorganism/MS
+microphone/SM
+microplastics
+microprocessor/MS
+microscope/SM
+microscopic
+microscopical/Y
+microscopy/M
+microsecond/MS
+microsurgery/M
+microwave/DSMGB
+microwaveable
+mid
+midair/M
+midday/M
+midden/MS
+middle/MGS
+middlebrow/SM
+middleman/M
+middlemen
+middlemost
+middleweight/MS
+middy/SM
+midfield/RZ
+midge/SM
+midget/MS
+midi/MS
+midland/MS
+midlife/M
+midmost
+midnight/M
+midpoint/MS
+midrib/MS
+midriff/MS
+midsection/MS
+midshipman/M
+midshipmen
+midships
+midsize
+midst/M
+midstream/M
+midsummer/M
+midterm/MS
+midtown/M
+midway/MS
+midweek/MS
+midwife/MGDS
+midwifery/SM
+midwinter/M
+midwives
+midyear/MS
+mien/M
+miff/DSG
+might've
+might/M
+mightily
+mightiness/M
+mightn't
+mighty/TRP
+mignonette/SM
+migraine/MS
+migrant/MS
+migrate/AGDS
+migration/SM
+migratory
+mikado/MS
+mike/MGDS
+mil/SZMR
+milady/SM
+milch
+mild/MRYTP
+mildew/SMDG
+mildness/M
+mile/MS
+mileage/SM
+milepost/MS
+miler/M
+milestone/MS
+milf/MS
+milieu/SM
+militancy/M
+militant/MYS
+militarily
+militarism/M
+militarist/SM
+militaristic
+militarization/CM
+militarize/CDSG
+military/M
+militate/GDS
+militia/SM
+militiaman/M
+militiamen
+milk/MDRSZG
+milker/M
+milkiness/M
+milkmaid/MS
+milkman/M
+milkmen
+milkshake/SM
+milksop/MS
+milkweed/SM
+milky/RTP
+mill/MDRSZGJ
+millage/M
+millennia
+millennial/M
+millennium/MS
+miller/M
+millet/M
+milliard/MS
+millibar/MS
+milligram/MS
+milliliter/MS
+millimeter/MS
+milliner/MS
+millinery/M
+milling/M
+million/HSM
+millionaire/SM
+millionairess/S
+millionth/M
+millionths
+millipede/SM
+millisecond/SM
+millpond/SM
+millrace/SM
+millstone/SM
+millstream/MS
+millwright/SM
+milometer/S
+milquetoast/SM
+milt/MDSG
+mime/MGDS
+mimeograph/GMD
+mimeographs
+mimetic
+mimic/SM
+mimicked
+mimicker/SM
+mimicking
+mimicry/SM
+mimosa/SM
+min
+minaret/MS
+minatory
+mince/DRSMZG
+mincemeat/M
+mincer/M
+mind's
+mind/ADRSZG
+mindbogglingly
+minded/P
+mindful/YP
+mindfulness/M
+mindless/YP
+mindlessness/M
+mindset/MS
+mine/MZGNDRSX
+minefield/SM
+miner/M
+mineral/MS
+mineralogical
+mineralogist/MS
+mineralogy/M
+minestrone/M
+minesweeper/SM
+mingle/DSG
+mingy
+mini/MS
+miniature/MS
+miniaturist/MS
+miniaturization/M
+miniaturize/GDS
+minibar/S
+minibike/SM
+minibus/MS
+minicab/S
+minicam/MS
+minicomputer/SM
+minifloppies
+minim/SM
+minima
+minimal/Y
+minimalism/M
+minimalist/MS
+minimization/M
+minimize/DSG
+minimum/MS
+mining/M
+minion/M
+miniseries/M
+miniskirt/MS
+minister/SGMD
+ministerial
+ministrant/MS
+ministration/MS
+ministry/SM
+minivan/MS
+mink/MS
+minnesinger/MS
+minnow/SM
+minor/SMDG
+minority/SM
+minoxidil/M
+minster/MS
+minstrel/SM
+minstrelsy/M
+mint/MDRSZG
+mintage/M
+minter/M
+minty/RT
+minuend/MS
+minuet/SM
+minus/MS
+minuscule/MS
+minute/PDRSMYTG
+minuteman/M
+minutemen
+minuteness/M
+minutia/M
+minutiae
+minx/MS
+miracle/MS
+miraculous/Y
+mirage/SM
+mire/MGDS
+mirror/GSMD
+mirth/M
+mirthful/PY
+mirthfulness/M
+mirthless/Y
+miry/RT
+misaddress/DSG
+misadventure/MS
+misaligned
+misalignment/M
+misalliance/MS
+misanthrope/SM
+misanthropic
+misanthropically
+misanthropist/MS
+misanthropy/M
+misapplication/M
+misapply/DSGNX
+misapprehend/GSD
+misapprehension/MS
+misappropriate/XDSGN
+misappropriation/M
+misbegotten
+misbehave/GDS
+misbehavior/M
+misc
+miscalculate/DSXGN
+miscalculation/M
+miscall/DSG
+miscarriage/MS
+miscarry/GDS
+miscast/SG
+miscegenation/M
+miscellaneous/Y
+miscellany/SM
+mischance/SM
+mischief/M
+mischievous/YP
+mischievousness/M
+miscibility/M
+miscible
+misclassified
+miscommunication/S
+misconceive/GDS
+misconception/SM
+misconduct/MDGS
+misconstruction/MS
+misconstrue/GDS
+miscount/MDSG
+miscreant/SM
+miscue/DSMG
+misdeal/GMS
+misdealt
+misdeed/MS
+misdemeanor/MS
+misdiagnose/GDS
+misdiagnosis/M
+misdid
+misdirect/SDG
+misdirection/M
+misdo/JG
+misdoes
+misdoing/M
+misdone
+miser/SBMY
+miserableness/M
+miserably
+miserliness/M
+misery/SM
+misfeasance/M
+misfeature/S
+misfile/GDS
+misfire/MGDS
+misfit/SM
+misfitted
+misfitting
+misfortune/SM
+misgiving/MS
+misgovern/SDGL
+misgovernment/M
+misguidance/M
+misguide/DSG
+misguided/Y
+mishandle/DSG
+mishap/SM
+mishear/GS
+misheard
+mishit/S
+mishitting
+mishmash/MS
+misidentify/GDS
+misinform/DGS
+misinformation/M
+misinterpret/SGD
+misinterpretation/SM
+misjudge/DSG
+misjudgment/SM
+mislabel/GSD
+mislaid
+mislay/GS
+mislead/GS
+misleading/Y
+misled
+mismanage/LGDS
+mismanagement/M
+mismatch/GMDS
+misname/GDS
+misnomer/MS
+misogamist/MS
+misogamy/M
+misogynist/SM
+misogynistic
+misogynous
+misogyny/M
+misplace/GLDS
+misplacement/M
+misplay/GMDS
+misprint/GMDS
+misprision/M
+mispronounce/DSG
+mispronunciation/SM
+misquotation/MS
+misquote/MGDS
+misread/GJS
+misreading/M
+misremember/GDS
+misreport/MDGS
+misrepresent/GDS
+misrepresentation/MS
+misrule/MGDS
+miss's
+miss/EDSGV
+missal/ESM
+missed/U
+misshape/GDS
+misshapen
+missile/MS
+missilery/M
+mission/AMS
+missionary/SM
+missioner/SM
+missive/MS
+misspeak/GS
+misspell/GDJS
+misspelling/M
+misspend/GS
+misspent
+misspoke
+misspoken
+misstate/GDSL
+misstatement/SM
+misstep/MS
+missus/MS
+mist's
+mist/CDRSZG
+mistakable/U
+mistake/BMGS
+mistaken/Y
+mister's
+mistily
+mistime/GDS
+mistiness/M
+mistletoe/M
+mistook
+mistral/MS
+mistranslated
+mistreat/LDGS
+mistreatment/M
+mistress/MS
+mistrial/MS
+mistrust/MDSG
+mistrustful/Y
+misty/PRT
+mistype/GS
+misunderstand/SGJ
+misunderstanding/M
+misunderstood
+misuse/DSMG
+mite/MZRS
+miter/MDG
+mitigate/DSGN
+mitigated/U
+mitigation/M
+mitochondria
+mitochondrial
+mitochondrion
+mitoses
+mitosis/M
+mitotic
+mitral
+mitt/MNSX
+mitten/M
+mitzvah
+mix/ZGMDRSB
+mixed/U
+mixer/M
+mixture/SM
+mizzen/MS
+mizzenmast/SM
+mkay
+mks
+ml
+mm
+mnemonic/MS
+mnemonically
+mo/CKHS
+moan/MDRSZG
+moaner/M
+moat/MDS
+mob's
+mob/CS
+mobbed/C
+mobbing/C
+mobile/MS
+mobility/M
+mobilization/CM
+mobilizations
+mobilize/CDSG
+mobilizer/SM
+mobster/SM
+moccasin/SM
+mocha/SM
+mock/DRSZG
+mocker/M
+mockery/SM
+mocking/Y
+mockingbird/SM
+mod/STM
+modal/SM
+modality/S
+modded
+modding
+mode/MS
+model/ZGSJMDR
+modeler/M
+modeling/M
+modem/SM
+moderate/MYGNPDS
+moderateness/M
+moderation/M
+moderator/SM
+modern/MYPS
+modernism/M
+modernist/SM
+modernistic
+modernity/M
+modernization/M
+modernize/DRSZG
+modernizer/M
+modernness/M
+modest/Y
+modesty/M
+modicum/SM
+modifiable
+modification/M
+modified/U
+modifier/M
+modify/DRSXZGN
+modish/YP
+modishness/M
+modular
+modularization
+modulate/CGNDS
+modulation/CM
+modulations
+modulator/MS
+module/MS
+modulo
+modulus
+moggy
+mogul/SM
+mohair/M
+moi
+moiety/SM
+moil/MDSG
+moire/SM
+moist/XTPNRY
+moisten/DRZG
+moistener/M
+moistness/M
+moisture/M
+moisturize/ZGDRS
+moisturizer/M
+molar/SM
+molasses/M
+mold/MDRJSZG
+moldboard/SM
+molder/GMD
+moldiness/M
+molding/M
+moldy/TPR
+mole/MS
+molecular
+molecularity/M
+molecule/SM
+molehill/SM
+moleskin/M
+molest/DRZGS
+molestation/M
+molested/U
+molester/M
+moll/MS
+mollification/M
+mollify/DSNG
+molluscan
+mollusk/SM
+molly/SM
+mollycoddle/DSMG
+molt/MDNRSZG
+molter/M
+molybdenum/M
+mom/SM
+moment/MS
+momenta
+momentarily
+momentariness/M
+momentary/P
+momentous/PY
+momentousness/M
+momentum/M
+mommy/SM
+monad
+monarch/M
+monarchic
+monarchical
+monarchism/M
+monarchist/MS
+monarchistic
+monarchs
+monarchy/SM
+monastery/SM
+monastic/MS
+monastical/Y
+monasticism/M
+monaural
+monetarily
+monetarism/M
+monetarist/MS
+monetary
+monetization/C
+monetize/CGDS
+money/SMD
+moneybag/MS
+moneybox/S
+moneylender/SM
+moneymaker/SM
+moneymaking/M
+monger/MDGS
+mongol/S
+mongolism/M
+mongoloid/MS
+mongoose/MS
+mongrel/SM
+monies
+moniker/SM
+monism/M
+monist/MS
+monition/SM
+monitor/SMDG
+monitory
+monk/MS
+monkey/MDGS
+monkeyshine/SM
+monkish
+monkshood/SM
+mono/M
+monochromatic
+monochrome/MS
+monocle/DSM
+monoclonal
+monocotyledon/SM
+monocotyledonous
+monocular
+monodic
+monodist/SM
+monody/SM
+monogamist/MS
+monogamous/Y
+monogamy/M
+monogram/SM
+monogrammed
+monogramming
+monograph/M
+monographs
+monolingual/MS
+monolith/M
+monolithic
+monoliths
+monologist/SM
+monologue/SM
+monomania/M
+monomaniac/MS
+monomaniacal
+monomer/SM
+mononucleosis/M
+monophonic
+monoplane/SM
+monopolist/SM
+monopolistic
+monopolization/M
+monopolize/DRSZG
+monopolizer/M
+monopoly/SM
+monorail/MS
+monosyllabic
+monosyllable/MS
+monotheism/M
+monotheist/SM
+monotheistic
+monotone/MS
+monotonic
+monotonically
+monotonous/PY
+monotonousness/M
+monotony/M
+monounsaturated
+monoxide/MS
+monseigneur/M
+monsieur/M
+monsignor/SM
+monsoon/SM
+monsoonal
+monster/SM
+monstrance/ASM
+monstrosity/SM
+monstrous/Y
+montage/SM
+month/MY
+monthly/SM
+months
+monument/MS
+monumental/Y
+moo/SGMD
+mooch/ZGMDRS
+moocher/M
+mood/MS
+moodily
+moodiness/M
+moody/TPR
+moon/MDSG
+moonbeam/MS
+moonless
+moonlight/SMDRZG
+moonlighter/M
+moonlighting/M
+moonlit
+moonscape/SM
+moonshine/MZRS
+moonshiner/M
+moonshot/MS
+moonstone/MS
+moonstruck
+moonwalk/MS
+moor/MDJSG
+moorhen/S
+mooring/M
+moorland/MS
+moose/M
+moot/DSG
+mop/SZGMDR
+mope/MS
+moped/SM
+moper/M
+mopey
+mopier
+mopiest
+mopish
+mopped
+moppet/MS
+mopping
+moraine/SM
+moral/SMY
+morale/M
+moralism
+moralist/MS
+moralistic
+moralistically
+moralities
+morality/UM
+moralization/CM
+moralize/CGDS
+moralizer/MS
+morass/MS
+moratorium/SM
+moray/SM
+morbid/YP
+morbidity/M
+morbidness/M
+mordancy/M
+mordant/SMY
+more/MS
+moreish
+morel/SM
+moreover
+mores/M
+morgue/MS
+moribund
+morn/MJSG
+morning/M
+morocco/M
+moron/SM
+moronic
+moronically
+morose/YP
+moroseness/M
+morph/GD
+morpheme/MS
+morphemic
+morphia/M
+morphine/M
+morphing/M
+morphological
+morphology/M
+morphs
+morrow/MS
+morsel/MS
+mortal/MYS
+mortality/M
+mortar/MDSG
+mortarboard/SM
+mortgage's
+mortgage/AGDS
+mortgagee/MS
+mortgagor/MS
+mortician/MS
+mortification/M
+mortify/NGDS
+mortise/DSMG
+mortuary/SM
+mosaic/MS
+mosey/SGD
+mosh/DSG
+mosque/MS
+mosquito/M
+mosquitoes
+moss/MS
+mossback/SM
+mossy/TR
+most/MY
+mot/SM
+mote's
+mote/KCXSVN
+motel/SM
+motet/SM
+moth/M
+mothball/GMDS
+mother/MDYSG
+motherboard/SM
+motherfucker/MS!
+motherfucking/!
+motherhood/M
+motherland/MS
+motherless
+motherliness/M
+moths
+motif/SM
+motile/S
+motility/M
+motion/KCM
+motioned
+motioning
+motionless/YP
+motionlessness/M
+motivate/CDSG
+motivated/U
+motivation/SM
+motivational
+motivator/SM
+motive/MS
+motiveless
+motley/MS
+motlier
+motliest
+motocross/MS
+motor/SGMD
+motorbike/MGDS
+motorboat/MS
+motorcade/MS
+motorcar/SM
+motorcycle/DSMG
+motorcyclist/MS
+motorist/SM
+motorization/M
+motorize/DSG
+motorman/M
+motormen
+motormouth/M
+motormouths
+motorway/SM
+mottle/GDS
+motto/M
+mottoes
+moue/MS
+mound/SGMD
+mount/EASGMD
+mountable
+mountain/SM
+mountaineer/SMDG
+mountaineering/M
+mountainous
+mountainside/SM
+mountaintop/SM
+mountebank/MS
+mounted/U
+mounter/MS
+mounting/SM
+mourn/SZGDR
+mourned/U
+mourner/M
+mournful/YP
+mournfulness/M
+mourning/M
+mouse/DRSMZG
+mouser/M
+mousetrap/SM
+mousetrapped
+mousetrapping
+mousiness/M
+moussaka/S
+mousse/MGDS
+mousy/PTR
+mouth/GMD
+mouthfeel
+mouthful/MS
+mouthiness/M
+mouthpiece/MS
+mouths
+mouthwash/MS
+mouthwatering
+mouthy/PTR
+mouton/M
+movable/SM
+move/AMZGDRSB
+moved/U
+movement/SM
+mover/AM
+movie/SM
+moviegoer/SM
+moving/Y
+mow/SZGMDR
+mower/M
+moxie/M
+mozzarella/M
+mp
+mpg
+mph
+mt
+mtg
+mtge
+mu/SM
+much/M
+mucilage/M
+mucilaginous
+muck/MDSG
+muckrake/DRSZG
+muckraker/M
+mucky/TR
+mucous
+mucus/M
+mud/M
+muddily
+muddiness/M
+muddle/MGDS
+muddleheaded
+muddy/PTGDRS
+mudflap/S
+mudflat/MS
+mudguard/SM
+mudpack/S
+mudroom/MS
+mudslide/MS
+mudslinger/SM
+mudslinging/M
+muenster/M
+muesli
+muezzin/MS
+muff/MDSG
+muffin/MS
+muffle/ZGDRS
+muffler/M
+mufti/SM
+mug/SM
+mugful/MS
+mugged
+mugger/MS
+mugginess/M
+mugging/MS
+muggins
+muggle/MS
+muggy/PTR
+mugshot/MS
+mugwump/MS
+mujaheddin
+mukluk/MS
+mulatto/M
+mulattoes
+mulberry/SM
+mulch/GMDS
+mulct/SGMD
+mule/MS
+muleskinner/MS
+muleteer/MS
+mulish/PY
+mulishness/M
+mull/DSG
+mullah/M
+mullahs
+mullein/M
+mullet/MS
+mulligan/SM
+mulligatawny/M
+mullion/SMD
+multi
+multicellular
+multichannel
+multicolored
+multicultural
+multiculturalism/M
+multidimensional
+multidisciplinary
+multifaceted
+multifamily
+multifarious/PY
+multifariousness/M
+multiform
+multigrain
+multilateral/Y
+multilayered
+multilevel
+multilingual
+multilingualism/M
+multimedia/M
+multimillionaire/SM
+multinational/SM
+multipart
+multiparty
+multiplayer/M
+multiple/MS
+multiplex/ZGMDRS
+multiplexer/M
+multiplicand/MS
+multiplication/M
+multiplicative
+multiplicity/SM
+multiplier/M
+multiply/NZGDRSX
+multiprocessing
+multiprocessor/SM
+multipurpose
+multiracial
+multistage
+multistory
+multitask/GS
+multitasking/M
+multitude/SM
+multitudinous
+multivariate
+multiverse/SM
+multivitamin/MS
+multiyear
+mum
+mumble/MZGDRS
+mumbler/M
+mumbletypeg/M
+mummer/MS
+mummery/M
+mummification/M
+mummify/GNDS
+mummy/SM
+mumps/M
+mun
+munch/GDS
+munchie/S
+munchies/M
+munchkin/SM
+mundane/SY
+mung/DSG
+municipal/SMY
+municipality/SM
+munificence/M
+munificent/Y
+munition/MDGS
+mural/SM
+muralist/SM
+murder/ZGMDRS
+murderer/M
+murderess/MS
+murderous/Y
+murk/MS
+murkily
+murkiness/M
+murky/PTR
+murmur/ZGJMDRS
+murmurer/M
+murmuring/M
+murmurous
+murrain/M
+muscat/MS
+muscatel/SM
+muscle/MGDS
+musclebound
+muscleman
+musclemen
+muscly
+muscular/Y
+muscularity/M
+musculature/M
+musculoskeletal
+muse/MGDSJ
+musette/MS
+museum/MS
+mush/MDRSZG
+mushiness/M
+mushroom/GSMD
+mushy/PTR
+music/SM
+musical/MYS
+musicale/MS
+musicality/M
+musician/SMY
+musicianship/M
+musicological
+musicologist/MS
+musicology/M
+musing/MY
+musk/M
+muskeg/MS
+muskellunge/MS
+musket/MS
+musketeer/MS
+musketry/M
+muskie/M
+muskiness/M
+muskmelon/SM
+muskox/MN
+muskrat/MS
+musky/PTRS
+muslin/M
+muss/MDSG
+mussel/MS
+mussy/TR
+must've
+must/MRSZ
+mustache/MDS
+mustachio/SMD
+mustang/MS
+mustard/M
+muster/GMD
+mustily
+mustiness/M
+mustn't
+musty/PTR
+mutability/M
+mutably
+mutagen/MS
+mutagenic
+mutant/MS
+mutate/XGNVDS
+mutation/M
+mutational
+mute/MYTGDRSPB
+muteness/M
+mutilate/DSGNX
+mutilation/M
+mutilator/SM
+mutineer/SM
+mutinous/Y
+mutiny/GDSM
+mutt/MS
+mutter/ZGJMDRS
+mutterer/M
+muttering/M
+mutton/M
+muttonchops/M
+muttony
+mutual/Y
+mutuality/M
+muumuu/MS
+muzak
+muzzily
+muzzle/DSMG
+muzzy/P
+my
+mycologist/SM
+mycology/M
+myelitis/M
+myna/MS
+myocardial
+myocardium
+myopia/M
+myopic
+myopically
+myriad/SM
+myrmidon/MS
+myrrh/M
+myrtle/SM
+mys
+myself
+mysterious/PY
+mysteriousness/M
+mystery/SM
+mystic/SM
+mystical/Y
+mysticism/M
+mystification/CM
+mystify/CDSGN
+mystique/M
+myth/M
+mythic
+mythical
+mythological
+mythologist/SM
+mythologize/DSG
+mythology/SM
+myths
+myxomatosis
+n/IKTH
+naan/S
+nab/S
+nabbed
+nabbing
+nabob/SM
+nacelle/SM
+nacho/SM
+nacre/M
+nacreous
+nadir/SM
+nae
+naff/RT
+nag/SM
+nagged
+nagger/MS
+nagging
+nagware
+nah
+naiad/SM
+naif/MS
+nail/MDSG
+nailbrush/MS
+naive/RYT
+naivete/M
+naivety/M
+naked/PY
+nakedness/M
+name's
+name/AGDS
+nameable/U
+named/U
+nameless/Y
+namely
+nameplate/MS
+namesake/SM
+nanny/SM
+nanobot/S
+nanometer/S
+nanosecond/SM
+nanotechnology/SM
+nanotube
+nap/SM
+napalm/MDSG
+nape/MS
+naphtha/M
+naphthalene/M
+napkin/MS
+napless
+napoleon/SM
+napped
+napper/MS
+napping
+nappy/TRSM
+narc/MS
+narcissism/M
+narcissist/MS
+narcissistic
+narcissus/M
+narcolepsy/M
+narcoleptic
+narcoses
+narcosis/M
+narcotic/SM
+narcotization/M
+narcotize/GDS
+nark
+narky
+narrate/GNVDSX
+narration/M
+narrative/SM
+narrator/SM
+narrow/PTGMDRYS
+narrowness/M
+narwhal/MS
+nary
+nasal/SMY
+nasality/M
+nasalization/M
+nasalize/DSG
+nascence/AM
+nascent/A
+nastily
+nastiness/M
+nasturtium/SM
+nasty/PTR
+natal
+natch
+nation/MS
+national/MYS
+nationalism/M
+nationalist/SM
+nationalistic
+nationalistically
+nationality/SM
+nationalization/MS
+nationalize/CDSG
+nationhood/M
+nationwide
+native/MS
+nativity/SM
+natl
+natter/GMDS
+nattily
+nattiness/M
+natty/PTR
+natural's
+natural/UPY
+naturalism/M
+naturalist/SM
+naturalistic
+naturalization/M
+naturalize/DSG
+naturalness/UM
+naturals
+nature's
+nature/CS
+naturism
+naturist/S
+naught/MS
+naughtily
+naughtiness/M
+naughty/PTR
+nausea/M
+nauseam
+nauseate/GDS
+nauseating/Y
+nauseous/PY
+nauseousness/M
+nautical/Y
+nautilus/MS
+naval
+nave/MS
+navel/SM
+navigability/M
+navigable
+navigate/DSGN
+navigation/M
+navigational
+navigator/MS
+navvy/S
+navy/SM
+nay/SM
+naysayer/MS
+ne'er
+neanderthal/MS
+neap/MS
+near/DRYSPTG
+nearby
+nearness/M
+nearshore
+nearside
+nearsighted/YP
+nearsightedness/M
+neat/NRYPXT
+neaten/GD
+neath
+neatness/M
+nebula/M
+nebulae
+nebular
+nebulous/PY
+nebulousness/M
+necessarily/U
+necessary/SM
+necessitate/DSG
+necessitous
+necessity/SM
+neck/MDSG
+neckband/S
+neckerchief/MS
+necking/M
+necklace/MGDSJ
+neckline/MS
+necktie/MS
+necrology/M
+necromancer/SM
+necromancy/M
+necrophilia
+necrophiliac/S
+necropolis/MS
+necroses
+necrosis/M
+necrotic
+nectar/M
+nectarine/MS
+nee
+need/MDSG
+needed/U
+needful/Y
+neediness/M
+needle/MGDS
+needlepoint/M
+needless/YP
+needlessness/M
+needlewoman/M
+needlewomen
+needlework/M
+needn't
+needy/PTR
+nefarious/YP
+nefariousness/M
+neg
+negate/DSGNVX
+negation/M
+negative/MYGPDS
+negativeness/M
+negativism/M
+negativity/M
+neglect/SGMD
+neglectful/YP
+neglectfulness/M
+negligee/MS
+negligence/M
+negligent/Y
+negligible
+negligibly
+negotiability/M
+negotiable/A
+negotiate/ADSGN
+negotiation/AM
+negotiations
+negotiator/MS
+negritude/M
+negro
+negroid
+neigh/MDG
+neighbor/SMDYG
+neighborhood/SM
+neighborliness/M
+neighs
+neither
+nelson/SM
+nematode/SM
+nemeses
+nemesis/M
+neoclassic
+neoclassical
+neoclassicism/M
+neocolonialism/M
+neocolonialist/MS
+neocon/SM
+neoconservative/SM
+neocortex
+neodymium/M
+neolithic
+neologism/SM
+neon/M
+neonatal
+neonate/MS
+neophilia
+neophyte/MS
+neoplasm/MS
+neoplastic
+neoprene/M
+nepenthe/M
+nephew/SM
+nephrite/M
+nephritic
+nephritis/M
+nephropathy
+nepotism/M
+nepotist/SM
+nepotistic
+neptunium/M
+nerd/MS
+nerdy/RT
+nerve's
+nerve/UDSG
+nerveless/YP
+nervelessness/M
+nerviness/M
+nervous/YP
+nervousness/M
+nervy/TPR
+nest/MDSG
+nestle/GJDS
+nestling/M
+net/SM
+netball
+netbook/MS
+nether
+nethermost
+netherworld/M
+netiquette/S
+netted
+netter/S
+netting/M
+nettle/MGDS
+nettlesome
+network/SGMD
+networking/M
+neural/Y
+neuralgia/M
+neuralgic
+neurasthenia/M
+neurasthenic/MS
+neuritic/MS
+neuritis/M
+neurological/Y
+neurologist/SM
+neurology/M
+neuron/MS
+neuronal
+neuroscience
+neuroses
+neurosis/M
+neurosurgeon/MS
+neurosurgery/M
+neurosurgical
+neurotic/MS
+neurotically
+neuroticism
+neurotransmitter/SM
+neut
+neuter/MDGS
+neutral/SMY
+neutralism/M
+neutralist/SM
+neutrality/M
+neutralization/M
+neutralize/DRSZG
+neutralizer/M
+neutrino/SM
+neutron/SM
+never
+nevermore
+nevertheless
+nevi
+nevus/M
+new/STMRYP
+newbie/MS
+newborn/SM
+newcomer/SM
+newel/SM
+newfangled
+newfound
+newline/S
+newlywed/SM
+newness/M
+news/M
+newsagent/S
+newsboy/SM
+newscast/SMRZ
+newscaster/M
+newsdealer/SM
+newsflash/S
+newsgirl/SM
+newsgroup/MS
+newshound/S
+newsletter/MS
+newsman/M
+newsmen
+newspaper/MS
+newspaperman/M
+newspapermen
+newspaperwoman/M
+newspaperwomen
+newspeak
+newsprint/M
+newsreader/S
+newsreel/MS
+newsroom/MS
+newsstand/SM
+newsweekly/SM
+newswoman/M
+newswomen
+newsworthiness/M
+newsworthy/P
+newsy/TR
+newt/MS
+newton/MS
+next/M
+nexus/MS
+niacin/M
+nib/SM
+nibble/MZGDRS
+nibbler/M
+nice/PYTR
+niceness/M
+nicety/SM
+niche/SM
+nick/MDRSZG
+nickel/MS
+nickelodeon/SM
+nicker/MDG
+nickle/S
+nickname/DSMG
+nicotine/M
+niece/SM
+nifedipine
+niff
+niffy
+nifty/TR
+nigga/MS!
+niggard/SMY
+niggardliness/M
+niggaz/!
+nigger/SM!
+niggle/MZGDRS
+niggler/M
+nigh/RT
+night/SMY
+nightcap/SM
+nightclothes/M
+nightclub/SM
+nightclubbed
+nightclubbing
+nightdress/MS
+nightfall/M
+nightgown/SM
+nighthawk/SM
+nightie/SM
+nightingale/SM
+nightlife/M
+nightlight/S
+nightlong
+nightmare/SM
+nightmarish
+nightshade/SM
+nightshirt/SM
+nightspot/MS
+nightstand/SM
+nightstick/SM
+nighttime/M
+nightwatchman
+nightwatchmen
+nightwear/M
+nihilism/M
+nihilist/MS
+nihilistic
+nil/M
+nimbi
+nimble/TPR
+nimbleness/M
+nimbly
+nimbus/M
+nimby
+nimrod/MS
+nincompoop/SM
+nine/MS
+ninepin/MS
+ninepins/M
+nineteen/SMH
+nineteenth/M
+nineteenths
+ninetieth/M
+ninetieths
+ninety/HSM
+ninja/SM
+ninny/SM
+ninth/M
+ninths
+niobium/M
+nip/SM
+nipped
+nipper/MS
+nippiness/M
+nipping
+nipple/MS
+nippy/TPR
+nirvana/M
+nisei/M
+nit/SMR
+niter/M
+nitpick/SZGDR
+nitpicker/M
+nitpicking/M
+nitrate/DSMGN
+nitration/M
+nitric
+nitrification/M
+nitrite/SM
+nitro
+nitrocellulose/M
+nitrogen/M
+nitrogenous
+nitroglycerin/M
+nitwit/MS
+nix/GMDS
+no/SM
+nob/SY
+nobble/GDS
+nobelium/M
+nobility/M
+noble/RSPMT
+nobleman/M
+noblemen
+nobleness/M
+noblewoman/M
+noblewomen
+nobody/SM
+nocturnal/Y
+nocturne/MS
+nod/SM
+nodal
+nodded
+nodding
+noddle/MS
+noddy
+node/MS
+nodular
+nodule/MS
+noel/MS
+noes
+noggin/MS
+nohow
+noise/DSMG
+noiseless/PY
+noiselessness/M
+noisemaker/MS
+noisily
+noisiness/M
+noisome
+noisy/PTR
+nomad/SM
+nomadic
+nomenclature/MS
+nominal/Y
+nominate/ACGNVDS
+nomination's/A
+nomination/CSM
+nominative/SM
+nominator/CSM
+nominee/MS
+non
+nonabrasive
+nonabsorbent/SM
+nonacademic
+nonacceptance/M
+nonacid
+nonactive/MS
+nonaddictive
+nonadhesive
+nonadjacent
+nonadjustable
+nonadministrative
+nonage/MS
+nonagenarian/MS
+nonaggression/M
+nonalcoholic
+nonaligned
+nonalignment/M
+nonallergic
+nonappearance/MS
+nonassignable
+nonathletic
+nonattendance/M
+nonautomotive
+nonavailability/M
+nonbasic
+nonbeliever/MS
+nonbelligerent/MS
+nonbinding
+nonbreakable
+nonburnable
+noncaloric
+noncancerous
+nonce/M
+nonchalance/M
+nonchalant/Y
+nonchargeable
+nonclerical/MS
+nonclinical
+noncollectable
+noncom/MS
+noncombat
+noncombatant/MS
+noncombustible
+noncommercial/MS
+noncommittal/Y
+noncommunicable
+noncompeting
+noncompetitive
+noncompliance/M
+noncomplying
+noncomprehending
+nonconducting
+nonconductor/MS
+nonconforming
+nonconformism
+nonconformist/MS
+nonconformity/M
+nonconsecutive
+nonconstructive
+noncontagious
+noncontinuous
+noncontributing
+noncontributory
+noncontroversial
+nonconvertible
+noncooperation/M
+noncorroding
+noncorrosive
+noncredit
+noncriminal/SM
+noncritical
+noncrystalline
+noncumulative
+noncustodial
+nondairy
+nondeductible/M
+nondelivery/SM
+nondemocratic
+nondenominational
+nondepartmental
+nondepreciating
+nondescript
+nondestructive
+nondetachable
+nondeterminism
+nondeterministic
+nondisciplinary
+nondisclosure/M
+nondiscrimination/M
+nondiscriminatory
+nondramatic
+nondrinker/MS
+nondrying
+none
+noneducational
+noneffective
+nonelastic
+nonelectric
+nonelectrical
+nonempty
+nonenforceable
+nonentity/SM
+nonequivalent/MS
+nonessential
+nonesuch/MS
+nonetheless
+nonevent/MS
+nonexchangeable
+nonexclusive
+nonexempt/M
+nonexistence/M
+nonexistent
+nonexplosive/MS
+nonfactual
+nonfading
+nonfat
+nonfatal
+nonfattening
+nonferrous
+nonfiction/M
+nonfictional
+nonflammable
+nonflowering
+nonfluctuating
+nonflying
+nonfood/M
+nonfreezing
+nonfunctional
+nongovernmental
+nongranular
+nonhazardous
+nonhereditary
+nonhuman
+nonidentical
+noninclusive
+nonindependent
+nonindustrial
+noninfectious
+noninflammatory
+noninflationary
+noninflected
+nonintellectual/MS
+noninterchangeable
+noninterference/M
+nonintervention/M
+nonintoxicating
+noninvasive
+nonirritating
+nonissue
+nonjudgmental
+nonjudicial
+nonlegal
+nonlethal
+nonlinear
+nonliterary
+nonliving/M
+nonmagnetic
+nonmalignant
+nonmember/MS
+nonmetal/SM
+nonmetallic
+nonmigratory
+nonmilitant
+nonmilitary
+nonnarcotic/SM
+nonnative/MS
+nonnegotiable
+nonnuclear
+nonnumerical
+nonobjective
+nonobligatory
+nonobservance/M
+nonobservant
+nonoccupational
+nonoccurence
+nonofficial
+nonoperational
+nonoperative
+nonparallel/MS
+nonpareil/MS
+nonparticipant/MS
+nonparticipating
+nonpartisan/SM
+nonpaying
+nonpayment/SM
+nonperformance/M
+nonperforming
+nonperishable
+nonperson/MS
+nonphysical/Y
+nonplus/S
+nonplussed
+nonplussing
+nonpoisonous
+nonpolitical
+nonpolluting
+nonporous
+nonpracticing
+nonprejudicial
+nonprescription
+nonproductive
+nonprofessional/SM
+nonprofit/SMB
+nonproliferation/M
+nonpublic
+nonpunishable
+nonracial
+nonradioactive
+nonrandom
+nonreactive
+nonreciprocal/SM
+nonreciprocating
+nonrecognition/M
+nonrecoverable
+nonrecurring
+nonredeemable
+nonrefillable
+nonrefundable
+nonreligious
+nonrenewable
+nonrepresentational
+nonresident/MS
+nonresidential
+nonresidual/M
+nonresistance/M
+nonresistant
+nonrestrictive
+nonreturnable/MS
+nonrhythmic
+nonrigid
+nonsalaried
+nonscheduled
+nonscientific
+nonscoring
+nonseasonal
+nonsectarian
+nonsecular
+nonsegregated
+nonsense/M
+nonsensical/Y
+nonsensitive
+nonsexist
+nonsexual
+nonskid
+nonslip
+nonsmoker/SM
+nonsmoking
+nonsocial
+nonspeaking
+nonspecialist/MS
+nonspecializing
+nonspecific
+nonspiritual/SM
+nonstaining
+nonstandard
+nonstarter/MS
+nonstick
+nonstop
+nonstrategic
+nonstriking
+nonstructural
+nonsuccessive
+nonsupport/GM
+nonsurgical
+nonsustaining
+nonsympathizer/M
+nontarnishable
+nontaxable
+nontechnical
+nontenured
+nontheatrical
+nonthinking
+nonthreatening
+nontoxic
+nontraditional
+nontransferable
+nontransparent
+nontrivial
+nontropical
+nonuniform
+nonunion
+nonuser/MS
+nonvenomous
+nonverbal
+nonviable
+nonviolence/M
+nonviolent/Y
+nonvirulent
+nonvocal
+nonvocational
+nonvolatile
+nonvoter/MS
+nonvoting
+nonwhite/MS
+nonworking
+nonyielding
+nonzero
+noodle/MGDS
+nook/MS
+nookie
+nooky
+noon/M
+noonday/M
+noontide/M
+noontime/M
+noose/SM
+nope
+nor
+nor'easter
+norm/MS
+normal/MY
+normalcy/M
+normality/M
+normalization/M
+normalize/DSG
+normative
+north/ZMR
+northbound
+northeast/MRZ
+northeaster/MY
+northeastern
+northeastward/S
+norther/MY
+northerly/SM
+northern/ZR
+northerner/M
+northernmost
+northward/S
+northwest/ZMR
+northwester/MY
+northwestern
+northwestward/S
+nose/MGDS
+nosebag/S
+nosebleed/MS
+nosecone/SM
+nosedive/DSMG
+nosegay/SM
+nosh/MDRSZG
+nosher/M
+nosily
+nosiness/M
+nostalgia/M
+nostalgic
+nostalgically
+nostril/MS
+nostrum/MS
+nosy/RPT
+not/B
+notability/SM
+notable/SM
+notably
+notarial
+notarization/M
+notarize/GDS
+notary/SM
+notate/GDS
+notation/FCSM
+notch/GMDS
+note's
+note/FCSDG
+notebook/MS
+notelet/S
+notepad/S
+notepaper/M
+noteworthiness/M
+noteworthy/P
+nothing/PSM
+nothingness/M
+notice/MGDS
+noticeable/U
+noticeably
+noticeboard/S
+noticed/U
+notifiable
+notification/M
+notifier/M
+notify/NDRSXZG
+notion/MS
+notional/Y
+notoriety/M
+notorious/Y
+notwithstanding
+notwork/S
+nougat/MS
+noun/KMS
+nourish/DSLG
+nourishment/M
+nous
+nova/MS
+novae
+novel/SM
+novelette/SM
+novelist/SM
+novelization/MS
+novelize/DSG
+novella/MS
+novelty/SM
+novena/MS
+novene
+novice/MS
+novitiate/MS
+now/M
+nowadays/M
+noway/S
+nowhere/M
+nowise
+nowt
+noxious
+nozzle/MS
+nu/SM
+nuance/MDS
+nub/SM
+nubbin/MS
+nubby/TR
+nubile
+nuclear/K
+nucleate/DSGN
+nucleation/M
+nuclei
+nucleic
+nucleoli
+nucleolus/M
+nucleon/SM
+nucleoside
+nucleotide
+nucleus/M
+nude/MTRS
+nudge/GDSM
+nudism/M
+nudist/SM
+nudity/M
+nugatory
+nugget/SM
+nuisance/MS
+nuke/MGDS
+null/S
+nullification/M
+nullify/NDSG
+nullity/M
+numb/ZTGPDRYS
+number's
+number/ASDG
+numbered/U
+numberless
+numbness/M
+numerable/I
+numeracy/IM
+numeral/SM
+numerate/XGNDS
+numeration/M
+numerator/MS
+numeric
+numerical/Y
+numerologist/MS
+numerology/M
+numerous/Y
+numinous
+numismatic/S
+numismatics/M
+numismatist/SM
+numskull/MS
+nun/SM
+nuncio/SM
+nunnery/SM
+nuptial/MS
+nurse/MZGDRS
+nurselings
+nursemaid/MS
+nurser/M
+nursery/SM
+nurseryman/M
+nurserymen
+nursing/M
+nursling/SM
+nurture/DRSMZG
+nurturer/M
+nut/SM
+nutcase/S
+nutcracker/MS
+nuthatch/MS
+nuthouse/S
+nutmeat/SM
+nutmeg/SM
+nutpick/SM
+nutria/SM
+nutrient/MS
+nutriment/MS
+nutrition/M
+nutritional/Y
+nutritionist/SM
+nutritious/YP
+nutritiousness/M
+nutritive
+nutshell/MS
+nutted
+nutter/S
+nuttiness/M
+nutting
+nutty/RTP
+nuzzle/DRSMZG
+nuzzler/M
+nybble/S
+nylon/MS
+nylons/M
+nymph/M
+nymphet/MS
+nympho/S
+nymphomania/M
+nymphomaniac/SM
+nymphs
+o
+o'clock
+o'er
+oaf/SM
+oafish/PY
+oafishness/M
+oak/SMN
+oakum/M
+oar/SGMD
+oarlock/SM
+oarsman/M
+oarsmen
+oarswoman/M
+oarswomen
+oases
+oasis/M
+oat/SMN
+oatcake/SM
+oath/M
+oaths
+oatmeal/M
+oats/M
+ob/S
+obbligato/MS
+obduracy/M
+obdurate/PY
+obdurateness/M
+obedience/EM
+obedient/EY
+obeisance/SM
+obeisant
+obelisk/MS
+obese
+obesity/M
+obey/EDSG
+obfuscate/GNXDS
+obfuscation/M
+obi/SM
+obit/MS
+obituary/SM
+obj
+object/SGVMD
+objectify/NGDS
+objection/SMB
+objectionable/U
+objectionably
+objective/SMYP
+objectiveness/M
+objectivity/M
+objector/MS
+objurgate/XGNDS
+objurgation/M
+oblate/NX
+oblation/M
+obligate/DSXGN
+obligation/M
+obligatorily
+obligatory
+oblige/EGDS
+obliging/Y
+oblique/SMYP
+obliqueness/M
+obliquity/M
+obliterate/DSGN
+obliteration/M
+oblivion/M
+oblivious/YP
+obliviousness/M
+oblong/MS
+obloquy/M
+obnoxious/YP
+obnoxiousness/M
+oboe/MS
+oboist/MS
+obscene/RYT
+obscenity/SM
+obscurantism/M
+obscurantist/SM
+obscure/DRSYTG
+obscurity/SM
+obsequies
+obsequious/PY
+obsequiousness/M
+obsequy/M
+observably
+observance/MS
+observant/Y
+observation/SM
+observational
+observatory/SM
+observe/DRSBZG
+observed/U
+observer/M
+obsess/DSGV
+obsession/SM
+obsessional/Y
+obsessive/PSMY
+obsessiveness/M
+obsidian/M
+obsolesce/DSG
+obsolescence/M
+obsolescent
+obsolete/GDS
+obstacle/MS
+obstetric/S
+obstetrical
+obstetrician/SM
+obstetrics/M
+obstinacy/M
+obstinate/Y
+obstreperous/YP
+obstreperousness/M
+obstruct/DGVS
+obstructed/U
+obstruction/SM
+obstructionism/M
+obstructionist/MS
+obstructive/YP
+obstructiveness/M
+obtain/DBLGS
+obtainable/U
+obtainment/M
+obtrude/DSG
+obtrusion/M
+obtrusive/UPY
+obtrusiveness/UM
+obtuse/YTRP
+obtuseness/M
+obverse/SM
+obviate/DSGN
+obviation/M
+obvious/PY
+obviousness/M
+ocarina/MS
+occasion/GMDS
+occasional/Y
+occidental/SM
+occlude/GDS
+occlusion/SM
+occlusive
+occult/M
+occultism/M
+occultist/SM
+occupancy/M
+occupant/SM
+occupation/AM
+occupational/Y
+occupations
+occupied/U
+occupier/SM
+occupy/ADSG
+occur/AS
+occurred/A
+occurrence/SM
+occurring/A
+ocean/SM
+oceanfront/SM
+oceangoing
+oceanic/M
+oceanographer/SM
+oceanographic
+oceanography/M
+oceanology/M
+ocelot/MS
+och/R
+ocher/M
+ocker/S
+octagon/MS
+octagonal
+octal
+octane/MS
+octave/MS
+octavo/MS
+octet/SM
+octogenarian/SM
+octopus/MS
+ocular/MS
+oculist/SM
+oculomotor
+odalisque/SM
+odd/STRYLP
+oddball/SM
+oddity/SM
+oddment/SM
+oddness/M
+odds/M
+ode/SM
+odious/YP
+odiousness/M
+odium/M
+odometer/MS
+odor/MDS
+odoriferous
+odorless
+odorous
+odyssey/MS
+oedipal
+oenology/M
+oenophile/SM
+oeuvre/MS
+of
+off/SZGDRJ
+offal/M
+offbeat/MS
+offend/ZGDRS
+offender/M
+offense/MS
+offensive's
+offensive/IPY
+offensiveness/IM
+offensives
+offer/JGMD
+offering/M
+offertory/SM
+offhand
+offhanded/PY
+offhandedness/M
+office/MZRS
+officeholder/SM
+officer/M
+official/MYS
+officialdom/M
+officialese
+officialism/M
+officiant/SM
+officiate/DSG
+officiator/MS
+officious/PY
+officiousness/M
+offing/M
+offish
+offline
+offload/SDG
+offprint/SM
+offset/MS
+offsetting
+offshoot/MS
+offshore/G
+offside
+offsite
+offspring/M
+offstage/S
+offtrack
+oft
+often/TR
+oftentimes
+ofttimes
+ogle/MZGDRS
+ogler/M
+ogre/MS
+ogreish
+ogress/MS
+oh/M
+ohm/SM
+ohmmeter/MS
+oho
+ohs
+oi
+oik/S
+oil/SGMD
+oilcan/S
+oilcloth/M
+oilcloths
+oilfield/S
+oiliness/M
+oilman
+oilmen
+oilskin/MS
+oilskins/M
+oily/RPT
+oink/MDSG
+ointment/SM
+okapi/SM
+okay/MSG
+okra/MS
+old/TMNRP
+oldie/SM
+oldish
+oldness/M
+oldster/MS
+ole/SMV
+oleaginous
+oleander/MS
+oleo/M
+oleomargarine/M
+olfactory/SM
+oligarch/M
+oligarchic
+oligarchical
+oligarchs
+oligarchy/SM
+oligonucleotide/S
+oligopoly/SM
+olive/SM
+om/SMNX
+ombudsman/M
+ombudsmen
+omega/SM
+omelet/MS
+omen/M
+omicron/MS
+ominous/YP
+ominousness/M
+omission/MS
+omit/S
+omitted
+omitting
+omnibus/MS
+omnipotence/M
+omnipotent
+omnipresence/M
+omnipresent
+omniscience/M
+omniscient
+omnivore/MS
+omnivorous/PY
+omnivorousness/M
+on/Y
+onboard
+once/M
+oncogene/SM
+oncologist/SM
+oncology/M
+oncoming
+one/SXMNP
+oneness/M
+onerous/PY
+onerousness/M
+oneself
+onetime
+ongoing
+onion/M
+onionskin/M
+online
+onlooker/SM
+onlooking
+onomatopoeia/M
+onomatopoeic
+onomatopoetic
+onrush/MSG
+onscreen
+onset/MS
+onshore
+onside
+onsite
+onslaught/MS
+onstage
+onto
+ontogeny/M
+ontological
+ontology/M
+onus/MS
+onward
+onyx/MS
+oodles/M
+ooh/GD
+oohs
+oomph
+oops
+ooze/MGDS
+oozy/TR
+op/SMDG
+opacity/M
+opal/MS
+opalescence/M
+opalescent
+opaque/PYTGDRS
+opaqueness/M
+opcode/S
+ope/S
+open/ZTGJPMDRYS
+opencast
+opened/U
+opener/M
+openhanded/P
+openhandedness/M
+openhearted
+opening/M
+openness/M
+openwork/M
+opera/MS
+operable/I
+operand/S
+operate/DSGNVX
+operatic
+operatically
+operation/M
+operational/Y
+operative/SM
+operator/SM
+operetta/SM
+ophthalmic
+ophthalmologist/SM
+ophthalmology/M
+opiate/SM
+opine/GNXDS
+opinion/M
+opinionated
+opioid/SM
+opium/M
+opossum/MS
+opp
+opponent/SM
+opportune/IY
+opportunism/M
+opportunist/SM
+opportunistic
+opportunistically
+opportunity/SM
+oppose/DSG
+opposed/U
+opposite/SMYNX
+opposition/M
+oppress/DSGV
+oppression/M
+oppressive/YP
+oppressiveness/M
+oppressor/MS
+opprobrious/Y
+opprobrium/M
+opt/SGD
+optic/MS
+optical/Y
+optician/SM
+optics/M
+optima
+optimal/Y
+optimism/SM
+optimist/SM
+optimistic
+optimistically
+optimization/MS
+optimize/DRSG
+optimum/SM
+option/SMDG
+optional/Y
+optometrist/MS
+optometry/M
+opulence/M
+opulent/Y
+opus/MS
+or
+oracle/SM
+oracular
+oral/MYS
+orality
+orange/SMP
+orangeade/MS
+orangery/SM
+orangutan/SM
+orate/GNXDS
+oration/M
+orator/SM
+oratorical/Y
+oratorio/MS
+oratory/SM
+orb/SM
+orbicular
+orbit/MDRZGS
+orbital/SM
+orbiter/M
+orc/SM
+orchard/SM
+orchestra/MS
+orchestral
+orchestrate/DSXGN
+orchestration/M
+orchid/SM
+ordain/SDLG
+ordainment/M
+ordeal/SM
+order/EAMDGS
+ordered/U
+orderings
+orderliness/EM
+orderly/PSM
+ordinal/SM
+ordinance/SM
+ordinarily
+ordinariness/M
+ordinary/SMP
+ordinate/MNSX
+ordination/M
+ordnance/M
+ordure/M
+ore/SM
+oregano/M
+org
+organ/MS
+organdy/M
+organelle/MS
+organic/SM
+organically/I
+organism/MS
+organismic
+organist/MS
+organization/ASM
+organizational/Y
+organize/AESDG
+organized/U
+organizer/MS
+organza/M
+orgasm/SM
+orgasmic
+orgiastic
+orgy/SM
+oriel/MS
+orient's
+orient/AEDGS
+oriental/MS
+orientalist/S
+orientate/EDSGN
+orientation/AEM
+orientations
+orienteering
+orifice/MS
+orig
+origami/M
+origin/SM
+original/MYS
+originality/M
+originate/DSGN
+origination/M
+originator/SM
+oriole/SM
+orison/SM
+ormolu/M
+ornament/SGMD
+ornamental
+ornamentation/M
+ornate/YP
+ornateness/M
+orneriness/M
+ornery/PRT
+ornithological
+ornithologist/MS
+ornithology/M
+orotund
+orotundity/SM
+orphan/SMDG
+orphanage/MS
+orris/MS
+orthodontia/M
+orthodontic/S
+orthodontics/M
+orthodontist/SM
+orthodox/U
+orthodoxy/SM
+orthogonal
+orthogonality
+orthographic
+orthographically
+orthography/SM
+orthopedic/S
+orthopedics/M
+orthopedist/MS
+orzo/M
+oscillate/GNDSX
+oscillation/M
+oscillator/SM
+oscillatory
+oscilloscope/MS
+osculate/DSXGN
+osculation/M
+osier/MS
+osmium/M
+osmosis/M
+osmotic
+osprey/SM
+ossicles
+ossification/M
+ossify/NGDS
+ostensible
+ostensibly
+ostentation/M
+ostentatious/Y
+osteoarthritis/M
+osteopath/M
+osteopathic
+osteopaths
+osteopathy/M
+osteoporosis/M
+ostler/S
+ostracism/M
+ostracize/GDS
+ostrich/MS
+other/MSP
+otherwise
+otherworldly
+otiose
+otter/MS
+ottoman/MS
+oubliette/MS
+ouch
+ought
+oughtn't
+ounce/MS
+our/S
+ourselves
+oust/ZGDRS
+ouster/M
+out/SJGMDR
+outage/SM
+outargue/GDS
+outback/MS
+outbalance/DSG
+outbid/S
+outbidding
+outboard/MS
+outboast/DSG
+outbound
+outbox/MS
+outbreak/MS
+outbuilding/MS
+outburst/SM
+outcast/MS
+outclass/DSG
+outcome/MS
+outcrop/MS
+outcropped
+outcropping/SM
+outcry/SM
+outdated
+outdid
+outdistance/GDS
+outdo/G
+outdoes
+outdone
+outdoor/S
+outdoors/M
+outdoorsy
+outdraw/GS
+outdrawn
+outdrew
+outercourse
+outermost
+outerwear/M
+outface/GDS
+outfall/S
+outfield/SMRZ
+outfielder/M
+outfight/SG
+outfit/SM
+outfitted
+outfitter/MS
+outfitting
+outflank/GSD
+outflow/MS
+outfought
+outfox/GDS
+outgo/MJG
+outgoes
+outgrew
+outgrow/HGS
+outgrown
+outgrowth/M
+outgrowths
+outguess/GDS
+outgun/S
+outgunned
+outgunning
+outhit/S
+outhitting
+outhouse/SM
+outing/M
+outlaid
+outlandish/PY
+outlandishness/M
+outlast/DSG
+outlaw/SGMD
+outlay/SGM
+outlet/SM
+outlier/S
+outline/MGDS
+outlive/GDS
+outlook/MS
+outlying
+outmaneuver/GDS
+outmatch/GDS
+outmoded
+outnumber/DSG
+outpace/GDS
+outpatient/MS
+outperform/GSD
+outplace/L
+outplacement/M
+outplay/GDS
+outpoint/DGS
+outpost/MS
+outpouring/MS
+outproduce/DSG
+output/SM
+outputted
+outputting
+outrace/GDS
+outrage/MGDS
+outrageous/Y
+outran
+outrank/GDS
+outre
+outreach/MDSG
+outrider/MS
+outrigger/SM
+outright
+outrun/S
+outrunning
+outscore/GDS
+outsell/GS
+outset/SM
+outshine/GS
+outshone
+outshout/GDS
+outside/MZRS
+outsider/M
+outsize/MS
+outskirt/MS
+outsmart/GDS
+outsold
+outsource/DSG
+outsourcing/M
+outspend/SG
+outspent
+outspoken/YP
+outspokenness/M
+outspread/GS
+outstanding/Y
+outstation/MS
+outstay/DGS
+outstretch/DSG
+outstrip/S
+outstripped
+outstripping
+outta
+outtake/MS
+outvote/GDS
+outward/YS
+outwear/GS
+outweigh/GD
+outweighs
+outwit/S
+outwith
+outwitted
+outwitting
+outwore
+outwork/MDRSZG
+outworn
+ouzo/MS
+ova
+oval/MS
+ovarian
+ovary/SM
+ovate/NX
+ovation/M
+oven/MS
+ovenbird/SM
+ovenproof
+ovenware
+over/MYS
+overabundance/M
+overabundant
+overachieve/ZGDRS
+overachiever/M
+overact/GVSD
+overage/SM
+overaggressive
+overall/SM
+overalls/M
+overambitious
+overanxious
+overarching
+overarm/GSD
+overate
+overattentive
+overawe/DSG
+overbalance/MGDS
+overbear/GS
+overbearing/Y
+overbid/SM
+overbidding
+overbite/MS
+overblown
+overboard
+overbold
+overbook/DGS
+overbore
+overborne
+overbought
+overbuild/SG
+overbuilt
+overburden/GSD
+overbuy/GS
+overcame
+overcapacity/M
+overcapitalize/DSG
+overcareful
+overcast/MGS
+overcautious
+overcharge/DSMG
+overclock/GD
+overcloud/SGD
+overcoat/MS
+overcome/GS
+overcompensate/DSGN
+overcompensation/M
+overconfidence/M
+overconfident
+overconscientious
+overcook/DGS
+overcritical
+overcrowd/SDG
+overcrowding/M
+overdecorate/DSG
+overdependent
+overdevelop/SDG
+overdid
+overdo/G
+overdoes
+overdone
+overdose/MGDS
+overdraft/SM
+overdraw/GS
+overdrawn
+overdress/GMDS
+overdrew
+overdrive/SM
+overdub/SM
+overdubbed
+overdubbing
+overdue
+overeager
+overeat/GSN
+overemotional
+overemphasis/M
+overemphasize/GDS
+overenthusiastic
+overestimate/MGNDS
+overestimation/M
+overexcite/DSG
+overexercise/GDS
+overexert/SDG
+overexertion/M
+overexpose/GDS
+overexposure/M
+overextend/DGS
+overfed
+overfeed/GS
+overfill/DGS
+overflew
+overflight/MS
+overflow/MDSG
+overflown
+overfly/GS
+overfond
+overfull
+overgeneralize/DSG
+overgenerous
+overgraze/DSG
+overgrew
+overground
+overgrow/HSG
+overgrown
+overgrowth/M
+overhand/MDS
+overhang/MSG
+overhasty
+overhaul/MDSG
+overhead/MS
+overhear/SG
+overheard
+overheat/DSG
+overhung
+overindulge/GDS
+overindulgence/M
+overindulgent
+overinflated
+overjoy/GSD
+overkill/M
+overladen
+overlaid
+overlain
+overland
+overlap/SM
+overlapped
+overlapping
+overlarge
+overlay/GSM
+overleaf
+overlie
+overload/GMDS
+overlong
+overlook/GMDS
+overlord/MS
+overly/SG
+overmanned
+overmanning
+overmaster/SDG
+overmodest
+overmuch/S
+overnice
+overnight/MS
+overoptimism/M
+overoptimistic
+overpaid
+overparticular
+overpass/MS
+overpay/GS
+overplay/GDS
+overpopulate/GNDS
+overpopulation/M
+overpower/SDG
+overpowering/Y
+overpraise/DSG
+overprecise
+overprice/DSG
+overprint/SMDG
+overproduce/GDS
+overproduction/M
+overprotect/SDGV
+overqualified
+overran
+overrate/GDS
+overreach/GDS
+overreact/SDG
+overreaction/SM
+overrefined
+overridden
+override/MGS
+overripe/M
+overrode
+overrule/GDS
+overrun/SM
+overrunning
+oversampling
+oversaw
+oversea/S
+oversee/RSZ
+overseeing
+overseen
+overseer/M
+oversell/GS
+oversensitive/P
+oversensitiveness/M
+oversexed
+overshadow/DSG
+overshare/DSG
+overshoe/MS
+overshoot/GS
+overshot
+oversight/SM
+oversimple
+oversimplification/M
+oversimplify/DSNGX
+oversize
+oversleep/GS
+overslept
+oversold
+overspecialization/M
+overspecialize/GDS
+overspend/SG
+overspent
+overspread/GS
+overstaffed
+overstate/DSLG
+overstatement/MS
+overstay/DSG
+overstep/S
+overstepped
+overstepping
+overstimulate/DSG
+overstock/GSD
+overstretch/GDS
+overstrict
+overstrung
+overstuffed
+oversubscribe/DSG
+oversubtle
+oversupply/GDS
+oversuspicious
+overt/Y
+overtake/GS
+overtaken
+overtax/GDS
+overthink/SG
+overthought
+overthrew
+overthrow/SMG
+overthrown
+overtime/MS
+overtire/GDS
+overtone/MS
+overtook
+overture/MS
+overturn/DSG
+overuse/DSMG
+overvaluation/S
+overvalue/DSG
+overview/MS
+overweening/Y
+overweight/M
+overwhelm/SGD
+overwhelming/Y
+overwinter/SDG
+overwork/GMDS
+overwrite/GS
+overwritten
+overwrote
+overwrought
+overzealous
+oviduct/SM
+oviparous
+ovoid/MS
+ovular
+ovulate/DSGN
+ovulation/M
+ovule/MS
+ovum/M
+ow
+owe/DSG
+owl/SM
+owlet/MS
+owlish/Y
+own/ESGD
+owner/MS
+ownership/M
+ox/MN
+oxalate
+oxblood/M
+oxbow/MS
+oxcart/SM
+oxford/SM
+oxidant/MS
+oxidase
+oxidation/M
+oxidative
+oxide/MS
+oxidization/M
+oxidize/ZGDRS
+oxidizer/M
+oxtail/S
+oxyacetylene/M
+oxygen/M
+oxygenate/DSGN
+oxygenation/M
+oxymora
+oxymoron/M
+oyster/SM
+oz
+ozone/M
+p/NRXTGJ
+pH
+pa/SMH
+pablum/M
+pabulum/M
+pace/MZGDRS
+pacemaker/SM
+pacer/M
+pacesetter/SM
+pacey
+pachyderm/MS
+pachysandra/MS
+pacific
+pacifically
+pacification/M
+pacifier/M
+pacifism/M
+pacifist/SM
+pacifistic
+pacify/ZGDRSN
+pack's
+pack/AUGSD
+package's
+package/AGDS
+packager/SM
+packaging/M
+packer/MS
+packet/MS
+packing's
+packinghouse/SM
+packsaddle/MS
+pact/MS
+pacy/RT
+pad/SM
+padded
+padding/M
+paddle/MZGDRS
+paddler/M
+paddock/MDGS
+paddy/SM
+padlock/MDSG
+padre/SM
+paean/SM
+paella/MS
+pagan/SM
+paganism/M
+page/MZGDRS
+pageant/MS
+pageantry/M
+pageboy/SM
+pager/M
+paginate/DSGN
+pagination/M
+pagoda/MS
+pah
+paid/AU
+pail/MS
+pailful/SM
+pain/MDSG
+painful/PY
+painfuller
+painfullest
+painfulness/M
+painkiller/MS
+painkilling
+painless/PY
+painlessness/M
+painstaking/MY
+paint/SZGJMDR
+paintball
+paintbox/MS
+paintbrush/MS
+painted/U
+painter/MY
+painting/M
+paintwork
+pair/AMDSG
+paired/U
+pairing/S
+pairwise
+paisley/SM
+pajama/S
+pajamas/M
+pal/SMY
+palace/MS
+paladin/SM
+palanquin/SM
+palatable/U
+palatal/SM
+palatalization/M
+palatalize/GDS
+palate/MBS
+palatial/Y
+palatinate/MS
+palatine/MS
+palaver/GSMD
+palazzi
+palazzo
+pale/MYTGPDRSJ
+paleface/MS
+paleness/M
+paleo
+paleographer/MS
+paleography/M
+paleolithic
+paleontologist/SM
+paleontology/M
+palette/SM
+palfrey/SM
+palimony/M
+palimpsest/MS
+palindrome/MS
+palindromic
+paling/M
+palisade/SM
+palish
+pall/MDSG
+palladium/M
+pallbearer/MS
+pallet/MS
+palliate/DSGNV
+palliation/M
+palliative/SM
+pallid/YP
+pallidness/M
+pallor/M
+palm/MDSG
+palmate
+palmetto/SM
+palmist/SM
+palmistry/M
+palmtop/SM
+palmy/TR
+palomino/MS
+palpable
+palpably
+palpate/DSGN
+palpation/M
+palpitate/XGNDS
+palpitation/M
+palsy/GDSM
+paltriness/M
+paltry/RPT
+pampas/M
+pamper/DSG
+pamphlet/MS
+pamphleteer/MS
+pan/SM
+panacea/SM
+panache/M
+panama/MS
+panatella/S
+pancake/DSMG
+panchromatic
+pancreas/MS
+pancreatic
+pancreatitis
+panda/SM
+pandemic/SM
+pandemonium/M
+pander/MDRZGS
+panderer/M
+pane/KM
+panegyric/SM
+panel/SGJMD
+paneling/M
+panelist/MS
+panes
+pang/MS
+panhandle/DRSMZG
+panhandler/M
+panic/SM
+panicked
+panicking
+panicky
+panned
+pannier/SM
+panning
+panoply/SM
+panorama/SM
+panoramic
+panpipes/M
+pansy/SM
+pant/MDSG
+pantaloons/M
+pantechnicon/S
+pantheism/M
+pantheist/SM
+pantheistic
+pantheon/SM
+panther/MS
+pantie/MS
+panto/S
+pantomime/MGDS
+pantomimic
+pantomimist/SM
+pantry/SM
+pantsuit/SM
+pantyhose/M
+pantyliner/M
+pantywaist/SM
+pap/SM
+papa/MS
+papacy/SM
+papal
+paparazzi/M
+paparazzo
+papaya/MS
+paper/SZGMDR
+paperback/SM
+paperbark/S
+paperboard/M
+paperboy/SM
+paperclip/S
+paperer/M
+papergirl/SM
+paperhanger/SM
+paperhanging/M
+paperless
+paperweight/MS
+paperwork/M
+papery
+papilla/M
+papillae
+papillary
+papist/MS
+papoose/MS
+pappy/SM
+paprika/M
+papyri
+papyrus/M
+par/SZGMDRBJ
+para/MS
+parable/MS
+parabola/SM
+parabolic
+paracetamol/S
+parachute/DSMG
+parachutist/MS
+parade/MZGDRS
+parader/M
+paradigm/SM
+paradigmatic
+paradisaical
+paradise/SM
+paradox/MS
+paradoxical/Y
+paraffin/M
+paragliding
+paragon/MS
+paragraph/GMD
+paragraphs
+parakeet/SM
+paralegal/MS
+parallax/MS
+parallel/SGMD
+paralleled/U
+parallelism/MS
+parallelization
+parallelized
+parallelogram/SM
+paralyses
+paralysis/M
+paralytic/SM
+paralyze/DSG
+paralyzing/Y
+paramagnetic
+paramecia
+paramecium/M
+paramedic/MS
+paramedical/MS
+parameter/MS
+parameterize/D
+parametric
+paramilitary/SM
+paramount
+paramountcy
+paramour/SM
+paranoia/M
+paranoiac/MS
+paranoid/SM
+paranormal
+parapet/MS
+paraphernalia/M
+paraphrase/DSMG
+paraplegia/M
+paraplegic/SM
+paraprofessional/MS
+parapsychologist/MS
+parapsychology/M
+paraquat/M
+parasailing
+parascending
+parasite/SM
+parasitic
+parasitical/Y
+parasitism/M
+parasol/MS
+parasympathetic/S
+parathion/M
+parathyroid/MS
+paratroop/RZS
+paratrooper/M
+paratroops/M
+paratyphoid/M
+parboil/DSG
+parcel/GMDS
+parch/LGDS
+parchment/SM
+pardner/S
+pardon/ZGMDRBS
+pardonable/U
+pardonably/U
+pardoner/M
+pare/S
+paregoric/M
+parent/GMDS
+parentage/M
+parental
+parentheses
+parenthesis/M
+parenthesize/DSG
+parenthetic
+parenthetical/Y
+parenthood/M
+parenting/M
+parer/M
+pares/S
+paresis/M
+parfait/MS
+pariah/M
+pariahs
+paribus
+parietal
+parimutuel/MS
+paring/M
+parish/MS
+parishioner/MS
+parity/ESM
+park/MDSG
+parka/SM
+parking/M
+parkland
+parkour
+parkway/MS
+parky
+parlance/M
+parlay/GMDS
+parley/GMDS
+parliament/SM
+parliamentarian/SM
+parliamentary
+parlor/MS
+parlous
+parmigiana
+parochial/Y
+parochialism/M
+parodist/SM
+parody/GDSM
+parole/MGDS
+parolee/MS
+parotid
+paroxysm/SM
+paroxysmal
+parquet/MDSG
+parquetry/M
+parred
+parricidal
+parricide/MS
+parring
+parrot/GMDS
+parry/GDSM
+parse/DRSG
+parsec/MS
+parsimonious/Y
+parsimony/M
+parsley/M
+parsnip/MS
+parson/MS
+parsonage/MS
+part's
+part/CDSG
+partake/ZGRS
+partaken
+partaker/M
+parterre/SM
+parthenogenesis/M
+partial/MYS
+partiality/M
+participant/SM
+participate/DSGN
+participation/M
+participator/MS
+participatory
+participial/M
+participle/MS
+particle/SM
+particleboard/M
+particular/SMY
+particularity/SM
+particularization/M
+particularize/DSG
+particulate/SM
+parting/MS
+partisan/SM
+partisanship/M
+partition/GMDS
+partitive/MS
+partly
+partner/MDSG
+partnership/MS
+partook
+partridge/SM
+parturition/M
+partway
+party/GDSM
+parvenu/MS
+pascal/MS
+paschal
+pasha/SM
+pass/M
+passably
+passage/MS
+passageway/MS
+passbook/MS
+passe/DRSBXZGNV
+passel/MS
+passenger/SM
+passer/M
+passerby/M
+passersby
+passim
+passing/MY
+passion/EM
+passionate/EY
+passionflower/SM
+passionless
+passive/PMYS
+passiveness/M
+passivity/M
+passivization
+passivize/DSG
+passkey/MS
+passphrase/S
+passport/MS
+password/MS
+past/AMS
+pasta/SM
+paste/DSMG
+pasteboard/M
+pastel/MS
+pastern/MS
+pasteurization/M
+pasteurize/ZGDRS
+pasteurized/U
+pasteurizer/M
+pastiche/MS
+pastie
+pastille/MS
+pastime/MS
+pastiness/M
+pastor/MS
+pastoral/MS
+pastorate/MS
+pastrami/M
+pastry/SM
+pasturage/M
+pasture/DSMG
+pastureland/M
+pasty/PTRSM
+pat/SM
+patch/EGMDS
+patchily
+patchiness/M
+patchouli
+patchwork/SM
+patchy/TPR
+pate/MS
+patella/MS
+patellae
+patent/GMDYS
+paterfamilias/MS
+paternal/Y
+paternalism/M
+paternalist/S
+paternalistic
+paternity/M
+paternoster/MS
+path/M
+pathetic
+pathetically
+pathfinder/SM
+pathless
+pathogen/SM
+pathogenic
+pathological/Y
+pathologist/SM
+pathology/M
+pathos/M
+paths
+pathway/MS
+patience/M
+patient/IMST
+patienter
+patiently
+patina/MS
+patine
+patio/SM
+patisserie/S
+patois/M
+patresfamilias
+patriarch/M
+patriarchal
+patriarchate/MS
+patriarchs
+patriarchy/SM
+patrician/SM
+patricidal
+patricide/SM
+patrimonial
+patrimony/SM
+patriot/SM
+patriotic/U
+patriotically
+patriotism/M
+patrol/MS
+patrolled
+patrolling
+patrolman/M
+patrolmen
+patrolwoman/M
+patrolwomen
+patron/MS
+patronage/MS
+patroness/MS
+patronize/ZGDRS
+patronizer/M
+patronizing/Y
+patronymic/SM
+patronymically
+patroon/SM
+patsy/SM
+patted
+patter/MDGS
+pattern/SMDG
+patting
+patty/SM
+paucity/M
+paunch/MS
+paunchy/RT
+pauper/MS
+pauperism/M
+pauperize/DSG
+pause/DSMG
+pave/AGDS
+paved/U
+pavement/MS
+pavilion/SM
+paving/MS
+pavlova/S
+paw/SGMD
+pawl/MS
+pawn/MDSG
+pawnbroker/MS
+pawnbroking/M
+pawnshop/MS
+pawpaw/MS
+pay's
+pay/ASGBL
+payback/SM
+paycheck/MS
+payday/MS
+payed
+payee/SM
+payer/SM
+payload/SM
+paymaster/SM
+payment/ASM
+payoff/MS
+payola/M
+payout/MS
+payphone/S
+payroll/SM
+payslip/SM
+paywall/SM
+payware
+pct
+pd
+pea/SM
+peace/SM
+peaceable
+peaceably
+peaceful/PY
+peacefulness/M
+peacekeeper/SM
+peacekeeping/M
+peacemaker/MS
+peacemaking/M
+peacetime/M
+peach/MS
+peachy/TR
+peacock/MS
+peafowl/MS
+peahen/MS
+peak/MDSG
+peaky
+peal/AMDSG
+peanut/MS
+pear/MYS
+pearl/SGMD
+pearly/RT
+peasant/SM
+peasantry/M
+peashooter/SM
+peat/M
+peaty/TR
+pebble/MGDS
+pebbly
+pecan/SM
+peccadillo/M
+peccadilloes
+peccary/SM
+peck/MDRSZG
+peckish
+pecs
+pectic
+pectin/M
+pectoral/MS
+pectoralis
+peculate/GNDS
+peculation/M
+peculator/SM
+peculiar/Y
+peculiarity/SM
+pecuniary
+pedagogic
+pedagogical/Y
+pedagogue/SM
+pedagogy/M
+pedal/SGMD
+pedalo/S
+pedant/MS
+pedantic
+pedantically
+pedantry/M
+peddle/ZGDRS
+peddler/M
+pederast/MS
+pederasty/M
+pedestal/MS
+pedestrian/SM
+pedestrianization
+pedestrianize/GDS
+pediatric/S
+pediatrician/MS
+pediatrics/M
+pedicab/SM
+pedicure/MGDS
+pedicurist/MS
+pedigree/MDS
+pediment/MS
+pedometer/MS
+pedophile/S
+pedophilia
+peduncle/MS
+pee/DRSMZ
+peeing
+peek/MDSG
+peekaboo/M
+peel/MDRSJZG
+peeled/U
+peeler/M
+peeling/M
+peen/MS
+peep/MDRSZG
+peepbo
+peeper/M
+peephole/MS
+peepshow/MS
+peer/MDG
+peerage/SM
+peeress/MS
+peerless
+peeve/DSMG
+peevish/PY
+peevishness/M
+peewee/MS
+peewit/S
+peg/SM
+pegboard/MS
+pegged
+pegging
+peignoir/SM
+pejoration/M
+pejorative/SMY
+peke/MS
+pekineses
+pekingese/SM
+pekoe/M
+pelagic
+pelf/M
+pelican/MS
+pellagra/M
+pellet/GMDS
+pellucid
+pelmet/S
+pelt/MDSG
+pelvic
+pelvis/MS
+pemmican/M
+pen/M
+penal
+penalization/M
+penalize/DSG
+penalty/SM
+penance/MS
+pence
+penchant/SM
+pencil/GMDJS
+pend/CDSG
+pendant/MS
+pendent/MS
+pendulous
+pendulum/MS
+penetrability/M
+penetrable
+penetrate/DSGNVX
+penetrating/Y
+penetration/M
+penfriend/S
+penguin/MS
+penicillin/M
+penile
+peninsula/SM
+peninsular
+penis/MS
+penitence/M
+penitent/SMY
+penitential
+penitentiary/SM
+penknife/M
+penknives
+penlight/SM
+penman/M
+penmanship/M
+penmen
+pennant/MS
+penned
+penniless
+penning
+pennon/MS
+penny/SM
+pennyweight/MS
+pennyworth
+penologist/MS
+penology/M
+pension/BZGMDRS
+pensioner/M
+pensive/PY
+pensiveness/M
+pent
+pentacle/MS
+pentagon/MS
+pentagonal
+pentagram/SM
+pentameter/SM
+pentathlete/MS
+pentathlon/MS
+penthouse/SM
+penuche/M
+penultimate/SM
+penumbra/MS
+penumbrae
+penurious/PY
+penuriousness/M
+penury/M
+peon/MS
+peonage/M
+peony/SM
+people/MGDS
+pep/SM
+pepped
+pepper/GMDS
+peppercorn/SM
+peppermint/SM
+pepperoni/MS
+peppery
+peppiness/M
+pepping
+peppy/TPR
+pepsin/M
+peptic/MS
+peptide/S
+peradventure/M
+perambulate/XGNDS
+perambulation/M
+perambulator/MS
+percale/MS
+perceive/BGDS
+perceived/U
+percent/MS
+percentage/SM
+percentile/SM
+perceptible
+perceptibly
+perception/SM
+perceptional
+perceptive/PY
+perceptiveness/M
+perceptual/Y
+perch/GMDS
+perchance
+percipience/M
+percipient
+percolate/GNDS
+percolation/M
+percolator/SM
+percussion/AM
+percussionist/MS
+percussive
+perdition/M
+perdurable
+peregrinate/DSXGN
+peregrination/M
+peregrine/MS
+peremptorily
+peremptory
+perennial/SMY
+perestroika/M
+perfect/PTGMDRYS
+perfecta/MS
+perfectibility/M
+perfectible
+perfection/SM
+perfectionism/M
+perfectionist/SM
+perfectness/M
+perfidious/Y
+perfidy/SM
+perforate/GNXDS
+perforation/M
+perforce
+perform/SDRZG
+performance/SM
+performative
+performed/U
+performer/M
+perfume/DRSMZG
+perfumer/M
+perfumery/SM
+perfunctorily
+perfunctory
+perfusion
+pergola/SM
+perhaps
+pericardia
+pericardial
+pericarditis
+pericardium/M
+perigee/SM
+perihelia
+perihelion/M
+peril/SGMD
+perilous/Y
+perimeter/SM
+perinatal
+perinea
+perineum/M
+period/MS
+periodic
+periodical/SMY
+periodicity/M
+periodontal
+periodontics/M
+periodontist/SM
+peripatetic/MS
+peripheral/MYS
+periphery/SM
+periphrases
+periphrasis/M
+periphrastic
+periscope/SM
+perish/BDRSZG
+perishable/MS
+peristalses
+peristalsis/M
+peristaltic
+peristyle/SM
+peritoneal
+peritoneum/MS
+peritonitis/M
+periwig/SM
+periwinkle/SM
+perjure/DRSZG
+perjurer/M
+perjury/SM
+perk/MDSG
+perkily
+perkiness/M
+perky/TPR
+perm/MDSG
+permafrost/M
+permanence/M
+permanency/M
+permanent/SMY
+permeability/M
+permeable
+permeate/GNDS
+permeation/M
+permissible
+permissibly
+permission/MS
+permissive/PY
+permissiveness/M
+permit/MS
+permitted
+permitting
+permittivity
+permutation/SM
+permute/DSG
+pernicious/YP
+perniciousness/M
+peroration/MS
+peroxide/MGDS
+perpendicular/SMY
+perpendicularity/M
+perpetrate/DSGN
+perpetration/M
+perpetrator/MS
+perpetual/SMY
+perpetuate/DSGN
+perpetuation/M
+perpetuity/M
+perplex/GDS
+perplexed/Y
+perplexing/Y
+perplexity/SM
+perquisite/SM
+persecute/GNXDS
+persecution/M
+persecutor/SM
+perseverance/M
+persevere/DSG
+persiflage/M
+persimmon/SM
+persist/SGD
+persistence/M
+persistent/Y
+persnickety
+person/UMS
+persona/SM
+personable
+personae
+personage/MS
+personal/MYS
+personality/SM
+personalize/CDSG
+personalty/M
+personification/M
+personify/GDSNX
+personnel/M
+perspective/MS
+perspex
+perspicacious/Y
+perspicacity/M
+perspicuity/M
+perspicuous
+perspiration/M
+perspire/GDS
+persuade/BZGDRS
+persuaded/U
+persuader/M
+persuasion/SM
+persuasive/PY
+persuasiveness/M
+pert/RYPT
+pertain/GSD
+pertinacious/Y
+pertinacity/M
+pertinence/M
+pertinent/Y
+pertness/M
+perturb/DGS
+perturbation/SM
+perturbed/U
+pertussis/M
+peruke/MS
+perusal/MS
+peruse/GDS
+perv/S
+pervade/DSG
+pervasive/PY
+pervasiveness/M
+perverse/PXYN
+perverseness/M
+perversion/M
+perversity/M
+pervert/SGMD
+peseta/MS
+peskily
+peskiness/M
+pesky/TPR
+peso/MS
+pessary/S
+pessimal
+pessimism/M
+pessimist/SM
+pessimistic
+pessimistically
+pest/MRSZ
+pester/GD
+pesticide/MS
+pestiferous
+pestilence/SM
+pestilent
+pestilential
+pestle/MGDS
+pesto/M
+pet/SZMR
+petabyte/MS
+petajoule/S
+petal/SMD
+petard/MS
+petawatt/S
+petcock/SM
+peter/GMD
+petiole/SM
+petite/MS
+petition/ZGMDRS
+petitionary
+petitioner/M
+petrel/MS
+petrifaction/M
+petrify/DSG
+petrochemical/SM
+petrodollar/MS
+petrol/M
+petrolatum/M
+petroleum/M
+petrologist/SM
+petrology/M
+petted
+petticoat/MS
+pettifog/S
+pettifogged
+pettifogger/SM
+pettifoggery/M
+pettifogging
+pettily
+pettiness/M
+petting/M
+pettish/Y
+petty/PTR
+petulance/M
+petulant/Y
+petunia/MS
+pew/SM
+pewee/SM
+pewit/SM
+pewter/MS
+peyote/M
+pf
+pfennig/MS
+pg
+phaeton/MS
+phage/S
+phagocyte/SM
+phalanger/SM
+phalanges
+phalanx/MS
+phalli
+phallic
+phallocentric
+phallocentrism
+phallus/M
+phantasm/MS
+phantasmagoria/MS
+phantasmagorical
+phantasmal
+phantom/SM
+pharaoh/M
+pharaohs
+pharisaic
+pharisee/SM
+pharmaceutic/MS
+pharmaceutical/SM
+pharmaceutics/M
+pharmacist/MS
+pharmacologic
+pharmacological
+pharmacologist/SM
+pharmacology/M
+pharmacopoeia/MS
+pharmacotherapy
+pharmacy/SM
+pharyngeal
+pharynges
+pharyngitis/M
+pharynx/M
+phase/DSMG
+phaseout/SM
+phat
+pheasant/MS
+phenacetin/M
+phenobarbital/M
+phenol/M
+phenom/MS
+phenomena
+phenomenal/Y
+phenomenological
+phenomenology
+phenomenon/MS
+phenotype
+phenytoin
+pheromone/MS
+phew
+phi/SM
+phial/SM
+philander/ZGDRS
+philanderer/M
+philandering/M
+philanthropic
+philanthropically
+philanthropist/MS
+philanthropy/SM
+philatelic
+philatelist/MS
+philately/M
+philharmonic/SM
+philippic/MS
+philistine/MS
+philistinism/M
+philodendron/SM
+philological
+philologist/MS
+philology/M
+philosopher/MS
+philosophic
+philosophical/Y
+philosophize/DRSZG
+philosophizer/M
+philosophy/SM
+philter/MS
+phish/ZGDR
+phisher/M
+phlebitis/M
+phlegm/M
+phlegmatic
+phlegmatically
+phloem/M
+phlox/M
+phobia/MS
+phobic/MS
+phoebe/MS
+phoenix/MS
+phone/DSMG
+phonecard/S
+phoneme/MS
+phonemic
+phonemically
+phonetic/S
+phonetically
+phonetician/SM
+phonetics/M
+phoneyed
+phoneying
+phonic/S
+phonically
+phonics/M
+phoniness/M
+phonograph/M
+phonographic
+phonographs
+phonological/Y
+phonologist/MS
+phonology/M
+phonon
+phony/PTGDRSM
+phooey
+phosphate/MS
+phosphodiesterase
+phosphor/MS
+phosphorescence/M
+phosphorescent/Y
+phosphoric
+phosphorous
+phosphorus/M
+phosphorylation
+photo/SGMD
+photocell/MS
+photocopier/M
+photocopy/DRSMZG
+photoelectric
+photoelectrically
+photoengrave/DRSJZG
+photoengraver/M
+photoengraving/M
+photofinishing/M
+photogenic
+photogenically
+photograph/MDRZG
+photographer/M
+photographic
+photographically
+photographs/A
+photography/M
+photojournalism/M
+photojournalist/SM
+photometer/MS
+photon/MS
+photosensitive
+photostat/SM
+photostatic
+photostatted
+photostatting
+photosynthesis/M
+photosynthesize/GDS
+photosynthetic
+phototropic
+phototropism
+phototypesetter
+phototypesetting
+photovoltaic
+phrasal
+phrase's
+phrase/AGDS
+phrasebook/S
+phraseology/M
+phrasing/MS
+phreaking
+phrenologist/SM
+phrenology/M
+phyla
+phylactery/SM
+phylogeny/M
+phylum/M
+phys
+physic/SM
+physical/MYS
+physicality
+physician/SM
+physicist/SM
+physicked
+physicking
+physics/M
+physio/S
+physiognomy/SM
+physiography/M
+physiologic
+physiological/Y
+physiologist/MS
+physiology/M
+physiotherapist/MS
+physiotherapy/M
+physique/MS
+phytoplankton
+pi/SMDRHZG
+pianissimo/SM
+pianist/MS
+piano/SM
+pianoforte/SM
+pianola/S
+piaster/MS
+piazza/MS
+pibroch/M
+pibrochs
+pic/SM
+pica/M
+picador/MS
+picante
+picaresque
+picayune
+piccalilli/M
+piccolo/MS
+pick/MDRSJZG
+pickax/GMDS
+picker/M
+pickerel/MS
+picket/ZGMDRS
+pickings/M
+pickle/MGDS
+pickpocket/SM
+pickup/MS
+picky/PTR
+picnic/MS
+picnicked
+picnicker/SM
+picnicking
+picot/SM
+pictogram/S
+pictograph/M
+pictographs
+pictorial/MYS
+picture/MGDS
+picturesque/PY
+picturesqueness/M
+piddle/MGDS
+piddly
+pidgin/MS
+pie/SM
+piebald/MS
+piece/DSMG
+piecemeal
+piecework/MRZ
+pieceworker/M
+piecrust/SM
+pieing
+pier/M
+pierce/JGDS
+piercing/MY
+piety/M
+piezoelectric
+piffle/MG
+pig/SML
+pigeon/MS
+pigeonhole/DSMG
+pigged
+piggery/S
+pigging
+piggish/PY
+piggishness/M
+piggy/TRSM
+piggyback/MDSG
+pigheaded/PY
+pigheadedness/M
+piglet/MS
+pigment/MDS
+pigmentation/M
+pigpen/MS
+pigskin/MS
+pigsty/SM
+pigswill
+pigtail/MS
+pike/MZGDRS
+piker/M
+pikestaff/SM
+pilaf/SM
+pilaster/MS
+pilchard/MS
+pile/MGDSJ
+pileup/MS
+pilfer/ZGDRS
+pilferage/M
+pilferer/M
+pilgrim/MS
+pilgrimage/MS
+piling/M
+pill/MDSG
+pillage/MZGDRS
+pillager/M
+pillar/MDS
+pillbox/MS
+pillion/MS
+pillock/S
+pillory/GDSM
+pillow/GMDS
+pillowcase/MS
+pillowslip/MS
+pilot/DGSM
+pilothouse/SM
+pimento/MS
+pimiento/MS
+pimp/GMDYS
+pimpernel/MS
+pimple/DSM
+pimply/RT
+pin/SM
+pinafore/MS
+pinata/MS
+pinball/M
+pincer/MS
+pinch/GMDS
+pincushion/MS
+pine's
+pine/AGDS
+pineapple/MS
+pinewood/S
+piney
+pinfeather/SM
+ping/GMD
+pinhead/SM
+pinhole/SM
+pinier
+piniest
+pinion/SMDG
+pink/TGPMDRS
+pinkeye/M
+pinkie/SM
+pinkish
+pinkness/M
+pinko/MS
+pinnacle/SM
+pinnate
+pinned/U
+pinning/U
+pinny/S
+pinochle/M
+pinon/MS
+pinpoint/SGMD
+pinprick/MS
+pinsetter/SM
+pinstripe/DSM
+pint/MS
+pinto/MS
+pinup/MS
+pinwheel/GSMD
+pinyin/M
+pinyon/SM
+pioneer/SGMD
+pious/YP
+piousness/M
+pip/SZGMDR
+pipe/MS
+pipeline/SM
+piper/M
+pipette/SM
+pipework
+piping/M
+pipit/MS
+pipped
+pippin/SM
+pipping
+pipsqueak/SM
+piquancy/M
+piquant/Y
+pique/MGDS
+piracy/M
+piranha/SM
+pirate/DSMG
+piratical/Y
+pirogi/M
+piroshki/M
+pirouette/DSMG
+piscatorial
+pismire/SM
+piss/ZGMDRS
+pissoir/S
+pistachio/SM
+piste/S
+pistil/SM
+pistillate
+pistol/SM
+piston/SM
+pit/SM
+pita/MS
+pitapat/SM
+pitch/MDRSZG
+pitchblende/M
+pitcher/M
+pitchfork/MDSG
+pitchman/M
+pitchmen
+piteous/YP
+piteousness/M
+pitfall/SM
+pith/M
+pithead/S
+pithily
+pithiness/M
+pithy/RTP
+pitiable
+pitiably
+pitiful/Y
+pitiless/PY
+pitilessness/M
+piton/MS
+pitta/S
+pittance/MS
+pitted
+pitting
+pituitary/SM
+pity/GDSM
+pitying/Y
+pivot/MDGS
+pivotal
+pix/M
+pixel/MS
+pixie/MS
+pizza/MS
+pizzazz/M
+pizzeria/SM
+pizzicati
+pizzicato/M
+pj's
+pk
+pkg
+pkt
+pkwy
+pl
+placard/SMDG
+placate/DSGN
+placation/M
+placatory
+place's
+place/AESDLG
+placebo/SM
+placed/U
+placeholder/MS
+placekick/MDRZGS
+placekicker/M
+placement/EASM
+placenta/SM
+placental/S
+placer/SM
+placid/Y
+placidity/M
+placings
+placket/SM
+plagiarism/SM
+plagiarist/SM
+plagiarize/DRSZG
+plagiarizer/M
+plagiary/M
+plague/DSMG
+plaice
+plaid/MS
+plain/MRYTSP
+plainchant
+plainclothes
+plainclothesman/M
+plainclothesmen
+plainness/M
+plainsman/M
+plainsmen
+plainsong/M
+plainspoken
+plaint/SMV
+plaintiff/SM
+plaintive/Y
+plait/MDGS
+plan/ZMRS
+planar
+plane's
+plane/CGDS
+planeload/MS
+planer/M
+planet/SM
+planetarium/SM
+planetary
+plangency/M
+plangent
+plank/MDGS
+planking/M
+plankton/M
+planned/U
+planner/SM
+planning/S
+plant/MDRZGSJ
+plantain/SM
+plantar
+plantation/MS
+planter/M
+planting/M
+plantlike
+plaque/SM
+plash/MDSG
+plasma/M
+plasmon
+plaster/SZGMDR
+plasterboard/M
+plasterer/M
+plastic/SM
+plasticity/M
+plasticize/DSG
+plastique
+plat/XGMDNS
+plate/MS
+plateau/SMDG
+plateful/SM
+platelet/SM
+platen/M
+platform/SGMD
+plating/M
+platinum/M
+platitude/SM
+platitudinous
+platonic
+platoon/SGMD
+platted
+platter/SM
+platting
+platy/M
+platypus/MS
+platys
+plaudit/SM
+plausibility/M
+plausible
+plausibly
+play/AEGMDS
+playable/EU
+playact/SGD
+playacting/M
+playback/MS
+playbill/MS
+playbook/MS
+playboy/SM
+player/SM
+playfellow/SM
+playful/PY
+playfulness/M
+playgirl/MS
+playgoer/MS
+playground/SM
+playgroup/S
+playhouse/MS
+playlist/MS
+playmate/MS
+playoff/SM
+playpen/SM
+playroom/SM
+playschool/S
+plaything/SM
+playtime/M
+playwright/SM
+plaza/MS
+plea/MS
+plead/DRZGSJ
+pleader/M
+pleading/MY
+pleasant/UTYP
+pleasanter
+pleasantness/UM
+pleasantry/SM
+please/EDSG
+pleasing/YS
+pleasurably
+pleasure/MGDSB
+pleasureful
+pleat/MDGS
+pleb/S
+plebby
+plebe/MS
+plebeian/MS
+plebiscite/MS
+plectra
+plectrum/MS
+pledge/DSMG
+plenary/SM
+plenipotentiary/SM
+plenitude/SM
+plenteous
+plentiful/Y
+plenty/M
+plenum/S
+pleonasm/MS
+plethora/M
+pleura/M
+pleurae
+pleurisy/M
+plexus/MS
+pliability/M
+pliable
+pliancy/M
+pliant/Y
+pliers/M
+plight/SMDG
+plimsoll/S
+plinth/M
+plinths
+plod/S
+plodded
+plodder/MS
+plodding/S
+plonk/DRSZG
+plop/MS
+plopped
+plopping
+plosive/S
+plot/MS
+plotted
+plotter/SM
+plotting
+plover/SM
+plow/GMDS
+plowman/M
+plowmen
+plowshare/MS
+ploy's
+ploy/S
+pluck/MDSG
+pluckily
+pluckiness/M
+plucky/RPT
+plug's
+plug/US
+plugged/U
+plugging/U
+plughole/S
+plugin/SM
+plum/GMDS
+plumage/M
+plumb/MDRSZGJ
+plumbed/U
+plumber/M
+plumbing/M
+plume/MS
+plummet/SGMD
+plummy
+plump/MDRYSTGP
+plumpness/M
+plumy/RT
+plunder/SZGMDR
+plunderer/M
+plunge/DRSMZG
+plunger/M
+plunk/MDSG
+pluperfect/SM
+plural/SM
+pluralism/M
+pluralist/MS
+pluralistic
+plurality/SM
+pluralization/M
+pluralize/GDS
+plus/MS
+plush/MRYTP
+plushness/M
+plushy/RT
+plutocracy/SM
+plutocrat/SM
+plutocratic
+plutonium/M
+pluvial
+ply/AGDSM
+plywood/M
+pm
+pneumatic
+pneumatically
+pneumococcal
+pneumococci
+pneumococcus
+pneumonia/M
+poach/DRSZG
+poacher/M
+poaching/M
+pock/GMDS
+pocket/SMDG
+pocketbook/SM
+pocketful/SM
+pocketknife/M
+pocketknives
+pockmark/MDGS
+pod/SM
+podcast/SMG
+podded
+podding
+podiatrist/SM
+podiatry/M
+podium/SM
+poem/MS
+poesy/M
+poet/MS
+poetaster/MS
+poetess/MS
+poetic/S
+poetical/Y
+poetry/M
+pogrom/SM
+poi/M
+poignancy/M
+poignant/Y
+poinciana/SM
+poinsettia/SM
+point/MDRSZG
+pointblank
+pointed/Y
+pointer/M
+pointillism/M
+pointillist/SM
+pointless/PY
+pointlessness/M
+pointy/TR
+poise/MGDS
+poison/SJZGMDR
+poisoner/M
+poisoning/M
+poisonous/Y
+poke/MZGDRS
+poker/M
+pokey/MS
+poky/TR
+pol/SGMD
+polar
+polarity/SM
+polarization/CM
+polarize/CDSG
+pole/MS
+poleaxe/GDS
+polecat/MS
+polemic/MS
+polemical/Y
+polemicist/SM
+polemics/M
+polestar/SM
+police/DSMG
+policeman/M
+policemen
+policewoman/M
+policewomen
+policy/SM
+policyholder/MS
+policymaker/S
+polio/MS
+poliomyelitis/M
+polish/ZGMDRS
+polished/U
+polisher/M
+politburo/MS
+polite/RYTP
+politeness/M
+politesse/M
+politic/S
+political/Y
+politician/SM
+politicization/M
+politicize/CDSG
+politicking/M
+politico/SM
+politics/M
+polity/SM
+polka/MDSG
+poll/GMDNS
+pollack/MS
+pollard/S
+pollen/M
+pollinate/GNDS
+pollination/M
+pollinator/SM
+polling/M
+polliwog/SM
+pollster/SM
+pollutant/MS
+pollute/ZGNDRS
+polluted/U
+polluter/M
+pollution/M
+polo/M
+polonaise/SM
+polonium/M
+poltergeist/MS
+poltroon/SM
+poly
+polyacrylamide
+polyamory/S
+polyandrous
+polyandry/M
+polyclinic/SM
+polyester/MS
+polyethylene/M
+polygamist/MS
+polygamous
+polygamy/M
+polyglot/SM
+polygon/SM
+polygonal
+polygraph/GMD
+polygraphs
+polyhedral
+polyhedron/SM
+polymath/M
+polymaths
+polymer/SM
+polymeric
+polymerization/M
+polymerize/GDS
+polymorphic
+polymorphous
+polynomial/MS
+polyp/MS
+polyphonic
+polyphony/M
+polypropylene/M
+polys
+polysemous
+polystyrene/M
+polysyllabic
+polysyllable/MS
+polytechnic/MS
+polytheism/M
+polytheist/SM
+polytheistic
+polythene
+polyunsaturate/DS
+polyurethane/MS
+polyvinyl
+pom/S
+pomade/DSMG
+pomander/SM
+pomegranate/MS
+pommel/SGMD
+pommy/S
+pomp/M
+pompadour/SMD
+pompano/MS
+pompom/SM
+pomposity/M
+pompous/YP
+pompousness/M
+ponce/GDS
+poncho/SM
+poncy
+pond/MS
+ponder/SZGDR
+ponderer/M
+ponderous/YP
+ponderousness/M
+pone/MS
+pong/GDS
+pongee/M
+poniard/MS
+pontiff/SM
+pontifical/Y
+pontificate/DSMG
+pontoon/SM
+pony/GDSM
+ponytail/MS
+poo/SGD
+pooch/MDSG
+poodle/SM
+poof/MS
+poofter/S
+pooh/GMD
+poohs
+pool/GMDS
+poolroom/MS
+poolside/S
+poop/GMDS
+poor/TRYP
+poorboy/M
+poorhouse/SM
+poorness/M
+pop/SM
+popcorn/M
+pope/MS
+popgun/SM
+popinjay/MS
+poplar/SM
+poplin/M
+popover/SM
+poppa/MS
+poppadom/S
+popped
+popper/SM
+poppet/S
+popping
+poppy/SM
+poppycock/M
+populace/MS
+popular/Y
+popularity/UM
+popularization/M
+popularize/DSG
+populate/ACGDS
+populated/U
+population/CM
+populations
+populism/M
+populist/MS
+populous/P
+populousness/M
+popup/MS
+porcelain/SM
+porch/MS
+porcine
+porcupine/SM
+pore/MGDS
+porgy/SM
+pork/ZMR
+porker/M
+porky/RSMT
+porn/M
+porno/M
+pornographer/MS
+pornographic
+pornographically
+pornography/M
+porosity/M
+porous/P
+porousness/M
+porphyritic
+porphyry/M
+porpoise/MGDS
+porridge/M
+porringer/SM
+port's/A
+port/CAEGDS
+portability/M
+portable/MS
+portage/DSMG
+portal/SM
+portcullis/MS
+portend/SGD
+portent/SM
+portentous/YP
+porter/ASM
+porterhouse/SM
+portfolio/MS
+porthole/MS
+portico/M
+porticoes
+portiere/MS
+portion/KSGMD
+portliness/M
+portly/RPT
+portmanteau/MS
+portrait/MS
+portraitist/SM
+portraiture/M
+portray/SGD
+portrayal/MS
+portulaca/M
+pose's/A
+pose/CAKEGDS
+poser/EKSM
+poseur/SM
+posh/TR
+posit/DSGV
+position/CKEMS
+positional/KE
+positioned/K
+positioning/AK
+positive/MYPS
+positiveness/M
+positivism
+positivist/S
+positron/MS
+poss
+posse/MS
+possess/AEVGSD
+possession/ASM
+possessive/SMYP
+possessiveness/M
+possessor/SM
+possibility/SM
+possible/SM
+possibly
+possum/SM
+post/ZGMDRSJ
+postage/M
+postal
+postbag/S
+postbox/S
+postcard/SM
+postcode/S
+postcolonial
+postconsonantal
+postdate/DSG
+postdoc/MS
+postdoctoral
+poster/M
+posterior/SM
+posterity/M
+postgraduate/SM
+posthaste
+posthumous/Y
+posthypnotic
+postie/S
+postilion/SM
+postindustrial
+posting/M
+postlude/SM
+postman/M
+postmark/SMDG
+postmaster/MS
+postmen
+postmenopausal
+postmeridian
+postmistress/MS
+postmodern
+postmodernism/M
+postmodernist/MS
+postmortem/SM
+postnasal
+postnatal
+postoperative
+postpaid
+postpartum
+postpone/DSGL
+postponement/SM
+postprandial
+postscript/SM
+postseason/SM
+postsynaptic
+postulate/XDSMGN
+postulation/M
+postural
+posture/MGJDS
+posturing/M
+postwar
+postwoman
+postwomen
+posy/SM
+pot/CSM
+potability/M
+potable/SM
+potash/M
+potassium/M
+potato/M
+potatoes
+potbelly/DSM
+potboiler/SM
+potency/M
+potent/Y
+potentate/MS
+potential/MYS
+potentiality/SM
+potentiate/GDS
+potful/SM
+pothead/SM
+pother/SMDG
+potherb/SM
+potholder/MS
+pothole/DRSMZG
+pothook/SM
+potion/SM
+potluck/MS
+potpie/SM
+potpourri/SM
+potsherd/SM
+potshot/MS
+pottage/M
+potted
+potter/GSMD
+pottery/SM
+potting
+potty/PRSMT
+pouch/MDSG
+pouf/S
+pouffe/S
+poulterer/MS
+poultice/DSMG
+poultry/M
+pounce/DSMG
+pound's
+pound/KDSG
+poundage/M
+pounding/SM
+pour/GDSJ
+pout/ZGMDRS
+pouter/M
+poverty/M
+pow
+powder/GSMD
+powdery
+power/MDSG
+powerboat/MS
+powerful/Y
+powerhouse/SM
+powerless/PY
+powerlessness/M
+powwow/SGMD
+pox/MS
+pp
+ppm
+ppr
+pr
+practicability/M
+practicably
+practical/SMY
+practicality/SM
+practice/DSMGB
+practiced/U
+practicum/SM
+practitioner/SM
+praetor/SM
+praetorian
+pragmatic/MS
+pragmatical/Y
+pragmatism/M
+pragmatist/MS
+prairie/SM
+praise/EDSMG
+praiseworthiness/M
+praiseworthy/P
+praline/SM
+pram/MS
+prance/DRSMZG
+prancer/M
+prancing/Y
+prang/DSG
+prank/MS
+prankster/SM
+praseodymium/M
+prat/S
+prate/MZGDRS
+prater/M
+pratfall/SM
+prattle/DRSMZG
+prattler/M
+prawn/MDSG
+pray/ZGDRS
+prayer/M
+prayerful/Y
+preach/DRSZGL
+preacher/M
+preachment/M
+preachy/RT
+preadolescence/SM
+preadolescent
+preamble/MGDS
+prearrange/LGDS
+prearrangement/M
+preassigned
+precancel/SMDG
+precancerous
+precarious/PY
+precariousness/M
+precast
+precaution/MS
+precautionary
+precede/DSG
+precedence/M
+precedent/SM
+precept/SM
+preceptor/SM
+precinct/MS
+preciosity/M
+precious/YP
+preciousness/M
+precipice/SM
+precipitant/MS
+precipitate/XMYGNDS
+precipitation/M
+precipitous/Y
+precis/M
+precise/DRSYTGNP
+preciseness/M
+precision/M
+preclude/GDS
+preclusion/M
+precocious/YP
+precociousness/M
+precocity/M
+precognition/M
+precognitive
+precolonial
+preconceive/GDS
+preconception/SM
+precondition/MDGS
+precook/GSD
+precursor/SM
+precursory
+predate/DSG
+predator/MS
+predatory
+predawn
+predecease/GDS
+predecessor/SM
+predefined
+predesignate/GDS
+predestination/M
+predestine/DSG
+predetermination/M
+predetermine/ZGDRS
+predeterminer/M
+predicable
+predicament/MS
+predicate/MGNVDS
+predication/M
+predicative/Y
+predict/BGVSD
+predictability/UM
+predictable/U
+predictably/U
+prediction/SM
+predictor/MS
+predigest/GDS
+predilection/SM
+predispose/GDS
+predisposition/MS
+prednisone
+predominance/M
+predominant/Y
+predominate/YGDS
+preemie/SM
+preeminence/M
+preeminent/Y
+preempt/GVSD
+preemption/M
+preemptive/Y
+preen/DSG
+preexist/DGS
+preexistence/M
+pref
+prefab/SM
+prefabbed
+prefabbing
+prefabricate/DSGN
+prefabrication/M
+preface/DSMG
+prefatory
+prefect/SM
+prefecture/MS
+prefer/SBL
+preferably
+preference/MS
+preferential/Y
+preferment/M
+preferred
+preferring
+prefigure/GDS
+prefix/MDSG
+preform/GSD
+prefrontal
+pregame/SM
+pregnancy/SM
+pregnant
+preheat/GSD
+prehensile
+prehistorian/S
+prehistoric
+prehistorical/Y
+prehistory/M
+prehuman
+preinstalled
+prejudge/GDS
+prejudgment/SM
+prejudice/MGDS
+prejudiced/U
+prejudicial
+prekindergarten/SM
+prelacy/M
+prelate/SM
+prelim/SM
+preliminary/SM
+preliterate
+prelude/MS
+premarital
+premature/Y
+premed/SM
+premedical
+premeditate/DSGN
+premeditated/U
+premeditation/M
+premenstrual
+premier/SGMD
+premiere/MS
+premiership/MS
+premise/DSMG
+premium/SM
+premix/GDS
+premolar/SM
+premonition/MS
+premonitory
+prenatal/Y
+prenup/SM
+prenuptial
+preoccupation/SM
+preoccupy/DSG
+preoperative
+preordain/GDS
+preowned
+prep/MS
+prepackage/DSG
+prepacked
+prepaid
+preparation/SM
+preparatory
+prepare/GDS
+prepared/UP
+preparedness/UM
+prepay/GSL
+prepayment/MS
+prepend
+preponderance/SM
+preponderant/Y
+preponderate/GDS
+preposition/SM
+prepositional/Y
+prepossess/GDS
+prepossessing/U
+prepossession/SM
+preposterous/Y
+prepped
+prepping
+preppy/TRSM
+prepubescence/M
+prepubescent/SM
+prepuce/MS
+prequel/MS
+prerecord/GSD
+preregister/SGD
+preregistration/M
+prerequisite/MS
+prerogative/SM
+pres
+presage/MGDS
+presbyopia/M
+presbyter/SM
+presbytery/SM
+preschool/SZMR
+preschooler/M
+prescience/M
+prescient/Y
+prescribe/DSG
+prescript/SVM
+prescription/SM
+prescriptive/Y
+preseason/SM
+presence/SM
+present/LMDRYZGSB
+presentably
+presentation/ASM
+presenter/M
+presentiment/SM
+presentment/SM
+preservation/M
+preservationist/SM
+preservative/SM
+preserve/BDRSMZG
+preserver/M
+preset/S
+presetting
+preshrank
+preshrink/GS
+preshrunk
+preside/GDS
+presidency/SM
+president/MS
+presidential
+presidium/M
+presort/DGS
+press's
+press/ACGSD
+pressed/U
+presser/MS
+pressie/S
+pressing/SMY
+pressman/M
+pressmen
+pressure/DSMG
+pressurization/M
+pressurize/CGDS
+pressurizer/SM
+prestidigitation/M
+prestige/M
+prestigious
+presto/SM
+presumably
+presume/GDSB
+presumption/SM
+presumptive
+presumptuous/YP
+presumptuousness/M
+presuppose/DSG
+presupposition/MS
+pretax
+preteen/MS
+pretend/DRZGS
+pretender/M
+pretense/SXMN
+pretension/M
+pretentious/UY
+pretentiousness/M
+preterit/SM
+preterm
+preternatural/Y
+pretest/DGS
+pretext/MS
+pretrial/S
+prettify/GDS
+prettily
+prettiness/M
+pretty/TGDRSMP
+pretzel/MS
+prevail/DGS
+prevalence/M
+prevalent
+prevaricate/DSGNX
+prevarication/M
+prevaricator/SM
+prevent/DBSGV
+preventable/U
+preventative/MS
+prevention/M
+preventive/SM
+preview/MDRSZG
+previous/Y
+prevision/MS
+prewar
+prey/GMDS
+prezzie/S
+priapic
+price's
+price/AGDS
+priceless
+pricey
+pricier
+priciest
+prick/MDRYSZG
+pricker/M
+prickle/MGDS
+prickliness/M
+prickly/PRT
+pride/MGDS
+prideful/Y
+prier/M
+priest/SMY
+priestess/MS
+priesthood/SM
+priestliness/M
+priestly/RTP
+prig/MS
+priggish/P
+priggishness/M
+prim/ZGDRYP
+primacy/M
+primal
+primarily
+primary/SM
+primate/MS
+prime/MS
+primer/M
+primeval
+priming/M
+primitive/SPMY
+primitiveness/M
+primmer
+primmest
+primness/M
+primogenitor/SM
+primogeniture/M
+primordial/Y
+primp/DSG
+primrose/SM
+primula/S
+prince/SMY
+princedom/SM
+princeliness/M
+princely/PRT
+princess/MS
+principal/SMY
+principality/SM
+principle/DSM
+principled/U
+print/AMDSG
+printable/U
+printer/MS
+printing/SM
+printmaking
+printout/SM
+prion/S
+prior/MS
+prioress/MS
+prioritization
+prioritize/DSG
+priority/SM
+priory/SM
+prism/MS
+prismatic
+prison/SZMR
+prisoner/M
+prissily
+prissiness/M
+prissy/PTR
+pristine
+prithee
+privacy/M
+private/XMYTNRS
+privateer/SM
+privation/CSM
+privatization/SM
+privatize/DSG
+privet/SM
+privilege/DSMG
+privileged/U
+privily
+privy/RSMT
+prize/MGDS
+prized/A
+prizefight/ZGSMR
+prizefighter/M
+prizefighting/M
+prizewinner/MS
+prizewinning
+pro/SM
+probabilistic
+probability/SM
+probable/SM
+probably
+probate/MN
+probation/ZMR
+probational
+probationary
+probationer/M
+probe/MGDSBJ
+probity/M
+problem/MS
+problematic/U
+problematical/Y
+probosces
+proboscis/MS
+procaine/M
+procedural
+procedure/SM
+proceed/GJDS
+proceeding/M
+proceeds/M
+process's
+process/AGDS
+processable
+processed/U
+procession/GD
+processional/MS
+processor/SM
+proclamation/MS
+proclivity/SM
+procrastinate/DSGN
+procrastination/M
+procrastinator/MS
+procreate/V
+proctor/GMDS
+procurement/M
+prod/MS
+prodigal/MYS
+prodigality/M
+prodigious/Y
+prodigy/SM
+produce's
+produce/AZGDRS
+producer/AM
+producible/A
+production/ASM
+productive/UY
+productiveness/M
+productivity/M
+prof/MS
+profanation/MS
+profane/PYGDS
+profaneness/M
+profanity/SM
+professed/Y
+profession/SM
+professional/MYS
+professionalism/M
+professionalization
+professionalize/DSG
+professor/SM
+professorial/Y
+professorship/SM
+proffer/GMDS
+proficiency/M
+proficient/MYS
+profit/BGD
+profitability/M
+profitable/U
+profitably/U
+profiteer/MDGS
+profiteering/M
+profiterole/SM
+profitless
+profligacy/M
+profligate/SMY
+proforma
+profound/RYTP
+profoundness/M
+profundity/SM
+profuse/PY
+profuseness/M
+progenitor/SM
+progeny/M
+progesterone/M
+progestin/S
+prognathous
+prognoses
+prognosis/M
+prognostic/MS
+prognosticate/XGNDS
+prognostication/M
+prognosticator/MS
+program/CAS
+programmable/MS
+programmatic
+programmed/AC
+programmer/MS
+programming/SM
+progress/MDSGV
+progression/MS
+progressive/PMYS
+progressiveness/M
+prohibit/DGVS
+prohibition/SM
+prohibitionist/MS
+prohibitive/Y
+prohibitory
+project/GMDS
+projectile/SM
+projection/SM
+projectionist/SM
+projector/MS
+prokaryote/MS
+prokaryotic
+prole/S
+proletarian/MS
+proletariat/M
+proliferate/DSGN
+proliferation/M
+prolific
+prolifically
+prolix/Y
+prolixity/M
+prologue/SM
+prolongation/SM
+prom/M
+promenade/MGDS
+promethium/M
+prominence/M
+prominent/Y
+promiscuity/M
+promiscuous/Y
+promise/DSMG
+promising/Y
+promissory
+promo/M
+promontory/SM
+promote/DRZG
+promoter/M
+promotional
+prompt/JPSMDRYZTG
+prompted/U
+prompter/M
+prompting/M
+promptitude/M
+promptness/M
+promulgate/GNDS
+promulgation/M
+promulgator/MS
+prone/P
+proneness/M
+prong/MDS
+pronghorn/MS
+pronominal/M
+pronounce/DSLG
+pronounceable/U
+pronouncement/SM
+pronto
+pronunciation/MS
+proof/ADGSM
+proofread/SRZG
+proofreader/M
+prop/MS
+propaganda/M
+propagandist/MS
+propagandize/GDS
+propagate/DSGN
+propagation/M
+propagator/SM
+propel/S
+propellant/MS
+propelled
+propeller/SM
+propelling
+propensity/SM
+proper/MRYT
+property/DSM
+prophecy/SM
+prophesier/M
+prophesy/DRSMZG
+prophet/SM
+prophetess/MS
+prophetic
+prophetical/Y
+prophylactic/SM
+prophylaxes
+prophylaxis/M
+propinquity/M
+propitiate/DSGN
+propitiation/M
+propitiatory
+propitious/Y
+proponent/SM
+proportion/ESM
+proportional/YS
+proportionality
+proportionate/EY
+proposal/MS
+propped
+propping
+propranolol
+proprietary/SM
+proprieties/M
+proprietor/SM
+proprietorial/Y
+proprietorship/M
+proprietress/MS
+propriety/SM
+propulsion/M
+propulsive
+prorate/DSG
+prorogation/M
+prorogue/GD
+prosaic
+prosaically
+proscenium/SM
+prosciutto/M
+proscribe/DG
+proscription/MS
+prose/M
+prosecute/DSXGN
+prosecution/M
+prosecutor/MS
+proselyte/DSMG
+proselytism/M
+proselytize/DRSZG
+proselytizer/M
+prosocial
+prosody/SM
+prospect/MDGVS
+prospective/Y
+prospector/SM
+prospectus/MS
+prosper/GSD
+prosperity/M
+prosperous/Y
+prostate/MS
+prostheses
+prosthesis/M
+prosthetic
+prostitute/MGNDS
+prostitution/M
+prostrate/GNXDS
+prostration/M
+prosy/RT
+protactinium/M
+protagonist/SM
+protean
+protect/GVSD
+protected/U
+protection/SM
+protectionism/M
+protectionist/MS
+protective/PY
+protectiveness/M
+protector/MS
+protectorate/MS
+protege/SM
+protegee/S
+protein/SM
+protestant/S
+protestation/MS
+protocol/MS
+proton/SM
+protoplasm/M
+protoplasmic
+prototype/MGS
+prototypical
+protozoa
+protozoan/MS
+protozoic
+protract/GD
+protrude/GDS
+protrusile
+protrusion/MS
+protuberance/MS
+protuberant
+proud/RYT
+prov/NB
+provability/M
+provably
+prove/EAGDS
+proved/U
+proven/U
+provenance/SM
+provender/M
+provenience/M
+proverbial/Y
+provide/DRSZG
+provided/U
+providence/M
+provident/Y
+providential/Y
+provider/M
+province/MS
+provincial/SMY
+provincialism/M
+provisional/Y
+proviso/SM
+provocateur/S
+provocative/PY
+provocativeness/M
+provoke/DRSZG
+provoked/U
+provoker/M
+provoking/Y
+provolone/M
+provost/SM
+prow/MS
+prowess/M
+prowl/MDRSZG
+prowler/M
+proximal
+proximate
+proximity/M
+proxy/SM
+prude/MS
+prudence/M
+prudent/Y
+prudential/Y
+prudery/M
+prudish/YP
+prudishness/M
+prune/MZGDRS
+pruner/M
+prurience/M
+prurient/Y
+pry/ZTGDRSM
+psalm/MS
+psalmist/SM
+psaltery/SM
+psephologist/S
+psephology
+pseud/S
+pseudo/S
+pseudonym/SM
+pseudonymous
+pseudoscience/MS
+pseudy
+pshaw/MS
+psi/SM
+psittacosis/M
+psoriasis/M
+psst
+psych/MDSG
+psyche/M
+psychedelia
+psychedelic/SM
+psychedelically
+psychiatric
+psychiatrist/SM
+psychiatry/M
+psychic/MS
+psychical/Y
+psycho/SM
+psychoactive
+psychoanalyses
+psychoanalysis/M
+psychoanalyst/SM
+psychoanalytic
+psychoanalytical/Y
+psychoanalyze/DSG
+psychobabble/M
+psychodrama/MS
+psychogenic
+psychokinesis
+psychokinetic
+psychological/Y
+psychologist/MS
+psychology/SM
+psychometric
+psychoneuroses
+psychoneurosis/M
+psychopath/M
+psychopathic
+psychopathology
+psychopaths
+psychopathy/M
+psychopharmacology
+psychophysiology
+psychos/S
+psychosis/M
+psychosomatic
+psychotherapist/MS
+psychotherapy/SM
+psychotic/SM
+psychotically
+psychotropic/MS
+psychs
+pt/C
+ptarmigan/MS
+pterodactyl/MS
+ptomaine/SM
+pub/SM
+pubertal
+puberty/M
+pubes/M
+pubescence/M
+pubescent
+pubic
+pubis/M
+public/AM
+publican/AMS
+publication/ASM
+publicist/MS
+publicity/M
+publicize/GDS
+publicly
+publish/AGDS
+publishable
+published/U
+publisher/MS
+publishing/M
+puce/M
+puck/ZMRS
+pucker/MDG
+puckish/YP
+puckishness/M
+pud/S
+pudding/SM
+puddle/DSMG
+puddling/M
+pudenda
+pudendum/M
+pudginess/M
+pudgy/PRT
+pueblo/SM
+puerile
+puerility/M
+puerperal
+puff/ZGMDRS
+puffball/SM
+puffer/M
+puffin/SM
+puffiness/M
+puffy/PRT
+pug/SM
+pugilism/M
+pugilist/SM
+pugilistic
+pugnacious/YP
+pugnaciousness/M
+pugnacity/M
+puke/MGDS
+pukka
+pulchritude/M
+pulchritudinous
+pule/GDS
+pull/ZGMDRS
+pullback/MS
+puller/M
+pullet/SM
+pulley/SM
+pullout/MS
+pullover/SM
+pulmonary
+pulp/GMDS
+pulpiness/M
+pulpit/SM
+pulpwood/M
+pulpy/RPT
+pulsar/SM
+pulsate/XGNDS
+pulsation/M
+pulse/AMGDS
+pulverization/M
+pulverize/DSG
+puma/MS
+pumice/SM
+pummel/SGD
+pump/ZGMDRS
+pumper/M
+pumpernickel/M
+pumpkin/MS
+pun/SM
+punch/MDRSZG
+punchbag/S
+puncheon/MS
+puncher/M
+punchline/S
+punchy/TR
+punctilio/M
+punctilious/PY
+punctiliousness/M
+punctual/Y
+punctuality/M
+punctuate/GNDS
+punctuation/M
+puncture/DSMG
+pundit/SM
+punditry/M
+pungency/M
+pungent/Y
+puniness/M
+punish/BLGDS
+punished/U
+punishing/Y
+punishment/MS
+punitive/Y
+punk/TMRS
+punned
+punnet/S
+punning
+punster/SM
+punt/ZGMDRS
+punter/M
+puny/TRP
+pup/SM
+pupa/M
+pupae
+pupal
+pupate/DSG
+pupil/MS
+pupped
+puppet/MS
+puppeteer/SM
+puppetry/M
+pupping
+puppy/SM
+purblind
+purchase/DRSMZGB
+purchaser/M
+purdah/M
+pure/PYTR
+purebred/SM
+puree/MDS
+pureeing
+pureness/M
+purgative/SM
+purgatorial
+purgatory/SM
+purge/MZGDRS
+purger/M
+purification/M
+purifier/M
+purify/NDRSZG
+purine/MS
+purism/M
+purist/MS
+puristic
+puritan/SM
+puritanical/Y
+puritanism/M
+purity/M
+purl/GMDS
+purlieu/SM
+purloin/SGD
+purple/MTRS
+purplish
+purport/SMDG
+purported/Y
+purpose/DSMYG
+purposed/A
+purposeful/YP
+purposefulness/M
+purposeless/PY
+purr/GMDS
+purse/MZGDRS
+purser/M
+pursuance/M
+pursuant
+pursue/ZGDRS
+pursuer/M
+pursuit/SM
+purulence/M
+purulent
+purvey/DSG
+purveyance/M
+purveyor/SM
+purview/M
+pus/M
+push/ZGMDRS
+pushbike/S
+pushcart/SM
+pushchair/S
+pusher/M
+pushily
+pushiness/M
+pushover/MS
+pushpin/S
+pushy/TRP
+pusillanimity/M
+pusillanimous/Y
+puss/MS
+pussy/TRSM
+pussycat/MS
+pussyfoot/DSG
+pustular
+pustule/SM
+put/ISM
+putative
+putout/MS
+putrefaction/M
+putrefactive
+putrefy/GDS
+putrescence/M
+putrescent
+putrid
+putsch/MS
+putt/ZGMDRS
+putted/I
+puttee/MS
+putter/MDRZG
+putterer/M
+putting/I
+putty/GDSM
+putz/S
+puzzle/MZGDRSL
+puzzlement/M
+puzzler/M
+pvt
+pwn/SGD
+pyelonephritis
+pygmy/SM
+pylon/SM
+pylori
+pyloric
+pylorus/M
+pyorrhea/M
+pyramid/GSMD
+pyramidal
+pyre/MS
+pyrimidine/MS
+pyrite/SM
+pyrites/M
+pyromania/M
+pyromaniac/SM
+pyrotechnic/S
+pyrotechnical
+pyrotechnics/M
+pyruvate
+python/SM
+pyx/MS
+pzazz
+q
+qr
+qt/S
+qty
+qua
+quack/GMDS
+quackery/M
+quad/MS
+quadrangle/SM
+quadrangular
+quadrant/MS
+quadraphonic
+quadratic/MS
+quadrature
+quadrennial
+quadrennium/MS
+quadriceps/MS
+quadrilateral/SM
+quadrille/XMNS
+quadrillion/M
+quadriplegia/M
+quadriplegic/SM
+quadrivium/M
+quadruped/MS
+quadrupedal
+quadruple/MGDS
+quadruplet/MS
+quadruplicate/MGNDS
+quadruplication/M
+quaff/GMDS
+quagmire/SM
+quahog/MS
+quail/GMDS
+quaint/PRYT
+quaintness/M
+quake/MGDS
+quaky
+qualification/EM
+qualified/U
+qualifier/SM
+qualify/EGXNDS
+qualitative/Y
+quality/SM
+qualm/MS
+qualmish
+quandary/SM
+quango/S
+quanta
+quantifiable
+quantification/M
+quantifier/M
+quantify/NDRSZG
+quantitation
+quantitative/Y
+quantity/SM
+quantization
+quantize
+quantum/M
+quarantine/MGDS
+quark/MS
+quarrel/SZGMDR
+quarreler/M
+quarrelsome/P
+quarrelsomeness/M
+quarry/DSMG
+quart/MS
+quarter/SGMDY
+quarterback/GMDS
+quarterdeck/MS
+quarterfinal/SM
+quarterly/SM
+quartermaster/MS
+quarterstaff/M
+quarterstaves
+quartet/SM
+quarto/MS
+quartz/M
+quasar/MS
+quash/GDS
+quasi
+quatrain/MS
+quaver/MDSG
+quavery
+quay/MS
+quayside/S
+queasily
+queasiness/M
+queasy/TPR
+queen/GMDYS
+queenly/RT
+queer/PTGMDRYS
+queerness/M
+quell/GDS
+quench/ZGDRSB
+quenchable/U
+quencher/M
+quenchless
+querulous/YP
+querulousness/M
+query/DSMG
+ques
+quesadilla/MS
+quest/IFAMS
+quested
+questing
+question/SMDRZGBJ
+questionable/U
+questionably/U
+questioned/U
+questioner/M
+questioning/MY
+questionnaire/SM
+queue's
+queue/CDS
+queuing
+quibble/DRSMZG
+quibbler/M
+quiche/SM
+quick/MNRYXTP
+quicken/DG
+quickfire
+quickie/SM
+quicklime/M
+quickness/M
+quicksand/MS
+quicksilver/M
+quickstep/MS
+quid/MS
+quiescence/M
+quiescent/Y
+quiet/SMDNRYXTGP
+quieten/DG
+quietism
+quietness/M
+quietude/IEM
+quietus/MS
+quiff/S
+quill/SM
+quilt/SMDRZG
+quilter/M
+quilting/M
+quin/S
+quince/SM
+quine/S
+quinidine
+quinine/M
+quinoa
+quinsy/M
+quint/SM
+quintessence/SM
+quintessential/Y
+quintet/SM
+quintuple/MGDS
+quintuplet/MS
+quip/MS
+quipped
+quipping
+quipster/SM
+quire's
+quire/IAS
+quirk/SMDG
+quirkiness/M
+quirky/RTP
+quirt/SM
+quisling/SM
+quit/S
+quitclaim/MS
+quite
+quittance/M
+quitter/SM
+quitting
+quiver/SMDG
+quivery
+quixotic
+quixotically
+quiz/M
+quizzed
+quizzer/SM
+quizzes
+quizzical/Y
+quizzing
+quo/H
+quoin/SM
+quoit/SMDG
+quondam
+quorate/I
+quorum/SM
+quot/B
+quota/SM
+quotability/M
+quotation/SM
+quote's
+quote/UDSG
+quotidian
+quotient/SM
+qwerty
+r/S
+rabbet/GMDS
+rabbi/SM
+rabbinate/M
+rabbinic
+rabbinical
+rabbit/GMDS
+rabble/MS
+rabid/PY
+rabidness/M
+rabies/M
+raccoon/MS
+race/MZGDRS
+racecourse/SM
+racegoer/S
+racehorse/MS
+raceme/MS
+racer/M
+racetrack/MS
+raceway/MS
+racial/Y
+racialism/M
+racialist/MS
+racily
+raciness/M
+racing/M
+racism/M
+racist/SM
+rack/GMDS
+racket/SMDG
+racketeer/SMDG
+racketeering/M
+raconteur/SM
+racquetball/SM
+racy/PRT
+rad/SM
+radar/SM
+radarscope/SM
+raddled
+radial/SMY
+radian/S
+radiance/M
+radiant/Y
+radiate/DSGNX
+radiation/M
+radiator/SM
+radical/SMY
+radicalism/M
+radicalization/M
+radicalize/DSG
+radicchio/M
+radii
+radio/MDGS
+radioactive/Y
+radioactivity/M
+radiocarbon/M
+radiogram/MS
+radiographer/SM
+radiography/M
+radioisotope/MS
+radiologist/SM
+radiology/M
+radioman/M
+radiomen
+radiometer/MS
+radiometric
+radiometry/M
+radiophone/SM
+radioscopy/M
+radiosonde/SM
+radiosurgery
+radiotelegraph/M
+radiotelegraphs
+radiotelegraphy/M
+radiotelephone/MS
+radiotherapist/MS
+radiotherapy/M
+radish/MS
+radium/M
+radius/M
+radon/M
+raffia/M
+raffish/YP
+raffishness/M
+raffle/DSMG
+raft/ZGMDRS
+rafter/M
+rafting/M
+rag/SGMD
+raga/MS
+ragamuffin/MS
+ragbag/M
+rage/MS
+ragga
+ragged/RYTP
+raggedness/M
+raggedy/RT
+ragging
+raging/Y
+raglan/SM
+ragout/SM
+ragtag/S
+ragtime/M
+ragweed/M
+ragwort
+rah
+raid/ZGMDRS
+raider/M
+rail's
+rail/CGDS
+railcard/S
+railing/SM
+raillery/SM
+railroad/SZGMDR
+railroader/M
+railroading/M
+railway/SM
+railwayman
+railwaymen
+raiment/M
+rain/GMDS
+rainbow/SM
+raincoat/SM
+raindrop/SM
+rainfall/SM
+rainmaker/SM
+rainmaking/M
+rainproof
+rainstorm/MS
+rainwater/M
+rainy/RT
+raise/MZGDRS
+raiser/M
+raisin/SM
+rajah/M
+rajahs
+rake/MGDS
+rakish/YP
+rakishness/M
+rally/DSMG
+ram/SM
+ramble/DRSMZGJ
+rambler/M
+rambunctious/PY
+rambunctiousness/M
+ramekin/SM
+ramie/M
+ramification/M
+ramify/DSXNG
+ramjet/SM
+rammed
+ramming
+ramp/GMS
+rampage/DSMG
+rampancy/M
+rampant/Y
+rampart/SM
+ramrod/SM
+ramrodded
+ramrodding
+ramshackle
+ran/A
+ranch/MDRSZG
+rancher/M
+ranching/M
+rancid/P
+rancidity/M
+rancidness/M
+rancor/M
+rancorous/Y
+rand/M
+randiness/M
+random/PSY
+randomization/M
+randomize/DSG
+randomness/MS
+randy/RTP
+ranee/MS
+rang/ZR
+range's
+range/CGDS
+rangefinder/S
+ranger/M
+ranginess/M
+rangy/RTP
+rank/TGJPMDRYS
+ranking/M
+rankle/DSG
+rankness/M
+ransack/SGD
+ransom/SZGMDR
+ransomer/M
+ransomware
+rant/ZGMDJRS
+ranter/M
+rap/SZGMDR
+rapacious/PY
+rapaciousness/M
+rapacity/M
+rape/MS
+raper/M
+rapeseed/M
+rapid/PMRYTS
+rapidity/M
+rapidness/M
+rapier/SM
+rapine/M
+rapist/SM
+rapped
+rappel/SM
+rappelled
+rappelling
+rapper/SM
+rapping
+rapport/MS
+rapporteur/S
+rapprochement/SM
+rapscallion/MS
+rapt/YP
+raptness/M
+raptor/S
+rapture/MS
+rapturous/Y
+rare/YTGPDRS
+rarebit/MS
+rarefaction/M
+rarefy/GDS
+rareness/M
+rarity/SM
+rascal/SMY
+rash/ZTMRSYP
+rasher/M
+rashness/M
+rasp/GMDS
+raspberry/SM
+raspy/RT
+raster
+rat/SM
+ratatouille/M
+ratbag/S
+ratchet/GMDS
+rate/JXMZGNDRS
+rated/U
+ratepayer/S
+rater/M
+rather
+rathskeller/SM
+ratification/M
+ratifier/M
+ratify/NDRSZG
+rating/M
+ratio/MS
+ratiocinate/GNDS
+ratiocination/M
+ration/MDG
+rational/SMY
+rationale/MS
+rationalism/M
+rationalist/SM
+rationalistic
+rationality/M
+rationalization/MS
+rationalize/DSG
+ratlike
+ratline/SM
+rattan/SM
+ratted
+ratter/SM
+ratting
+rattle/DRSMZGJ
+rattlebrain/SMD
+rattler/M
+rattlesnake/SM
+rattletrap/SM
+rattly
+rattrap/SM
+ratty/RT
+raucous/YP
+raucousness/M
+raunchily
+raunchiness/M
+raunchy/TRP
+ravage/DRSMZG
+ravager/M
+ravages/M
+rave/JMZGDRS
+ravel's
+ravel/UDSG
+raveling/S
+raven/MDSG
+ravenous/Y
+ravine/SM
+raving/M
+ravioli/SM
+ravish/DRSZGL
+ravisher/M
+ravishing/Y
+ravishment/M
+raw/PTMR
+rawboned
+rawhide/M
+rawness/M
+ray/SM
+rayon/M
+raze/GDS
+razor/MS
+razorback/MS
+razz/GMDS
+razzmatazz/M
+rcpt
+rd
+re/DSMYTGVJ
+reach/MDSGB
+reachable/U
+reacquire/DSG
+react/V
+reactance
+reactant/SM
+reactionary/SM
+reactivity
+read/ZGMRBJS
+readability/SM
+reader/M
+readership/SM
+readily
+readiness/M
+reading/M
+readmitted
+readout/SM
+ready/DRSTGP
+reafforestation
+real/TMRYPS
+realism/M
+realist/SM
+realistic/U
+realistically/U
+realities
+reality/UM
+realization/MS
+realize/DSBG
+realized/U
+realm/MS
+realness/M
+realpolitik/M
+realty/M
+ream/ZGMDRS
+reamer/M
+reap/ZGDRS
+reaper/M
+rear/GMDS
+rearguard/MS
+rearmost
+rearward/S
+reason/SMDRZGB
+reasonable/UP
+reasonableness/UM
+reasonably/U
+reasoner/M
+reasoning/M
+reassuring/Y
+rebate/M
+rebel/MS
+rebellion/MS
+rebellious/YP
+rebelliousness/M
+rebid/S
+rebidding
+rebirth/M
+reboil/SDG
+rebuild/SG
+rebuke/DSMG
+rebuking/Y
+rebuttal/MS
+rec'd
+rec/M
+recalcitrance/M
+recalcitrant
+recant/SDG
+recantation/SM
+recap/MS
+recapitalization
+recce/S
+recd
+receipt/SMDG
+receivables/M
+receive/DRSZGB
+receiver/M
+receivership/M
+recent/RYTP
+recentness/M
+receptacle/SM
+reception/MS
+receptionist/SM
+receptive/PY
+receptiveness/M
+receptivity/M
+receptor/SM
+recess/MDSGV
+recessional/SM
+recessionary
+recessive/SM
+recherche
+recidivism/M
+recidivist/SM
+recipe/SM
+recipient/SM
+reciprocal/SMY
+reciprocate/GNDS
+reciprocation/M
+reciprocity/M
+recital/SM
+recitalist/MS
+recitative/MS
+reciter/SM
+reckless/YP
+recklessness/M
+reckon/SJDG
+reckoning/M
+reclamation/M
+recline/DRSZG
+recliner/M
+recluse/SMV
+recognizable/U
+recognizably/U
+recognize/DRSGB
+recognized/U
+recombination
+recompense/DSMG
+recompilation
+recompile/GD
+recon/S
+reconcile/GDSB
+reconciliation/S
+recondite
+reconfiguration
+reconfigure/D
+reconnaissance/MS
+reconnoiter/DGS
+reconstruct/V
+reconstructed/U
+recorded/U
+recorder/MS
+recording/MS
+recoup/DG
+recourse/M
+recoverable/U
+recovery/SM
+recreant/MS
+recreational
+recriminate/DSGNX
+recrimination/M
+recriminatory
+recrudesce/GDS
+recrudescence/M
+recrudescent
+recruit/LSMDRZG
+recruiter/M
+recruitment/M
+rectal/Y
+rectangle/MS
+rectangular
+rectifiable
+rectification/M
+rectifier/M
+rectify/XNDRSZG
+rectilinear
+rectitude/M
+recto/MS
+rector/SM
+rectory/SM
+rectum/SM
+recumbent
+recuperate/GNVDS
+recuperation/M
+recur/S
+recurred
+recurrence/SM
+recurring
+recursion/S
+recuse/DSG
+recyclable/SM
+recycling/M
+red/PSM
+redact/SDG
+redaction/M
+redactor/SM
+redbird/SM
+redbreast/MS
+redbrick
+redcap/SM
+redcoat/SM
+redcurrant/S
+redden/SDG
+redder
+reddest
+reddish
+redeem/RZB
+redeemer/M
+redemption/M
+redemptive
+redhead/SMD
+redirection
+redistrict/GD
+redivide/GDS
+redlining/M
+redneck/SM
+redness/M
+redo/G
+redolence/M
+redolent
+redoubt/SBM
+redoubtably
+redound/SDG
+redraw/SG
+redskin/SM
+reduce/DRSZG
+reducer/M
+reducible
+reductase/M
+reduction/SM
+reductionist
+reductive
+redundancy/SM
+redundant/Y
+redwood/SM
+redye/DS
+reediness/M
+reedy/RTP
+reef/ZGMDRS
+reefer/M
+reek/GMDS
+reel's
+reel/UGDS
+reeve/G
+reexport/SDG
+ref/SZM
+refashion/DGS
+refection/M
+refectory/SM
+refer/B
+referee/DSM
+refereeing
+reference/MGDS
+referendum/MS
+referent/SM
+referential
+referral/SM
+referred
+referrer/SM
+referring
+reffed
+reffing
+refill/BM
+refined/U
+refinement/SM
+refiner/SM
+refinery/S
+refitting
+reflate/XDSGN
+reflationary
+reflect/GVSD
+reflection/MS
+reflective/Y
+reflectivity
+reflector/MS
+reflexive/SMY
+reflexivity
+reflexology
+reforge/DSG
+reform/MZ
+reformat/V
+reformatory/SM
+reformatting
+reformed/U
+reformist/S
+refortify/GDS
+refract/SGVD
+refraction/M
+refractory/SM
+refrain/SGMD
+refresh/ZGLDRS
+refresher/M
+refreshing/Y
+refreshment/SM
+refreshments/M
+refrigerant/SM
+refrigerate/DSGN
+refrigeration/M
+refrigerator/MS
+refuge/SM
+refugee/SM
+refulgence/M
+refulgent
+refund/B
+refurbishment/MS
+refusal/MS
+refutation/MS
+refute/BDRSZG
+refuter/M
+reg
+regal/DYG
+regalement/M
+regalia/M
+regard/ESMDG
+regardless
+regards/M
+regather/DGS
+regatta/SM
+regency/SM
+regeneracy/M
+regenerate/V
+regex/M
+regexp/S
+reggae/M
+regicidal
+regicide/MS
+regime/SM
+regimen/SM
+regiment/MDGS
+regimental
+regimentation/M
+region/SM
+regional/Y
+regionalism/MS
+register/GMDS
+registered/U
+registrant/MS
+registrar/MS
+registration/SM
+registry/SM
+regnant
+regress/MDSGV
+regression/MS
+regret/SM
+regretful/Y
+regrettable
+regrettably
+regretted
+regretting
+regrind/GS
+reground
+regroup/DGS
+regular/MYS
+regularity/SM
+regularization/M
+regularize/DSG
+regulate/CDSGNV
+regulated/U
+regulation/CM
+regulations
+regulator/MS
+regulatory
+regurgitate/DSGN
+regurgitation/M
+rehab/MS
+rehabbed
+rehabbing
+rehabilitate/GNVDS
+rehabilitation/M
+rehang/SDG
+rehears/GD
+rehearsal/MS
+rehearsed/U
+rehi
+rehung
+reify/NDSG
+reign/MDSG
+reimburse/BDSGL
+reimbursement/MS
+rein/GD
+reindeer/M
+reinforce/LGDS
+reinforcement/SM
+reinitialize
+reinstall/DG
+reinstatement/M
+reinsurance
+reiterate/V
+reject/GSMD
+rejection/SM
+rejoice/JGDS
+rejoicing/M
+rejoinder/SM
+rejuvenate/DSGN
+rejuvenation/M
+rel
+relate/DRSBXZGNV
+relatedness/M
+relater/M
+relation/M
+relational
+relationship/MS
+relative/MYS
+relativism/M
+relativist/S
+relativistic
+relativity/M
+relax/DRSZG
+relaxant/MS
+relaxation/SM
+relaxer/M
+relay/D
+release/B
+released/U
+relegate/GNDS
+relent/SGD
+relentless/PY
+relentlessness/M
+relevance/M
+relevancy/M
+relevant/Y
+reliability/UM
+reliable/U
+reliably/U
+reliance/M
+reliant
+relic/MS
+relief/SM
+relieve/ZGDRS
+reliever/M
+religion/SM
+religiosity
+religious/MYP
+religiousness/M
+reline/DSG
+relinquish/LDSG
+relinquishment/M
+reliquary/SM
+relish/GMDS
+relist/SGD
+relocate/B
+reluctance/M
+reluctant/Y
+rely/GDS
+rem/M
+remain/SGD
+remainder/GMDS
+remand/SGD
+remapping
+remark/B
+remarkableness/M
+remarkably
+remarked/U
+remediable
+remedy/GDSM
+remember/DG
+remembered/U
+remembrance/MS
+reminder/M
+reminisce/GDS
+reminiscence/MS
+reminiscent/Y
+remiss/PY
+remissness/M
+remit/S
+remittance/SM
+remitted
+remitting/U
+remix/DSG
+remnant/MS
+remodel/GDS
+remold/SGD
+remonstrant/SM
+remonstrate/DSG
+remorse/M
+remorseful/Y
+remorseless/PY
+remorselessness/M
+remote/RSMYTP
+remoteness/M
+removal/SM
+remunerate/GNVXDS
+remuneration/M
+renaissance/MS
+renal
+renascence/S
+rend/GS
+render/SGMDJ
+rendering/M
+rendezvous/GMDS
+rendition/MS
+renegade/DSMG
+renege/DRSZG
+reneger/M
+renew/DSBG
+renewal/MS
+rennet/M
+rennin/M
+renounce/LDSG
+renouncement/M
+renovate/DSXGN
+renovation/M
+renovator/MS
+renown/MD
+rent/ZGMDRS
+rental/SM
+renter/M
+renunciation/SM
+reopen/SDG
+reorg/MDSG
+rep/SM
+repaint/GDS
+repair/BZR
+repairer/M
+repairman/M
+repairmen
+reparable
+reparation/MS
+reparations/M
+repartee/M
+repatriate/XDSMGN
+repatriation/M
+repeat/SMDRZGB
+repeatability
+repeatable/U
+repeatably
+repeated/Y
+repeater/M
+repeating/M
+repel/S
+repelled
+repellent/SM
+repelling
+repent/SDG
+repentance/M
+repentant/Y
+repercussion/S
+repertoire/MS
+repertory/SM
+repetition/MS
+repetitious/YP
+repetitiousness/M
+repetitive/YP
+repetitiveness/M
+rephotograph/DG
+replaceable
+replant/GSD
+replenish/LGDS
+replenishment/M
+replete/PDSGN
+repleteness/M
+repletion/M
+replica/SM
+replicate/DSGNX
+replication/M
+replicator/S
+reportage/M
+reported/Y
+reportorial
+reposeful
+reposition
+repository/SM
+reprehend/DGS
+reprehensibility/M
+reprehensible
+reprehensibly
+reprehension/M
+represent/GDS
+representational
+representative/MS
+represented/U
+repression/MS
+repressive/PY
+reprieve/DSMG
+reprimand/GSMD
+reprisal/SM
+reprise/SMG
+reproach/GMDSB
+reproachful/Y
+reprobate/MS
+reproductive
+reprogramming
+reproving/Y
+reptile/SM
+reptilian/MS
+republic/S
+republicanism/M
+repudiate/XGNDS
+repudiation/M
+repudiator/MS
+repugnance/M
+repugnant
+repulsion/M
+repulsive/YP
+repulsiveness/M
+repurchase/GDS
+reputability/M
+reputably/E
+reputation/MS
+repute/DSMGB
+reputed/Y
+request/GDR
+requiem/SM
+require/LDG
+requirement/MS
+requisite/XMNS
+requisition/GMD
+requital/M
+requite/DRSZG
+requited/U
+requiter/M
+reread/SG
+rerecord/GDS
+rerunning
+resample/GDS
+resat
+rescind/SDG
+rescission/M
+rescue/DRSMZG
+rescuer/M
+reseal/B
+resemble/DSG
+resend
+resent/LSDG
+resentful/YP
+resentfulness/M
+resentment/MS
+reserpine/M
+reservation/MS
+reserved/UY
+reservedness/M
+reservist/SM
+reservoir/SM
+resetting
+reshipping
+residence/SM
+residency/SM
+resident/MS
+residential
+residua
+residual/MS
+residue/SM
+residuum/M
+resignation/SM
+resigned/Y
+resilience/M
+resiliency/M
+resilient/Y
+resinous
+resist/SMDRZG
+resistance/SM
+resistant/U
+resistible
+resistivity
+resistless
+resistor/MS
+resit/S
+resitting
+resold
+resole/DSG
+resolute/PY
+resoluteness/M
+resolve/RBM
+resolved/U
+resonance/SM
+resonant/Y
+resonate/GDS
+resonator/SM
+resorption/M
+resound/SGD
+resounding/Y
+resourceful/YP
+resourcefulness/M
+resp
+respect/ESGVMD
+respectability/M
+respectable
+respectably
+respectful/EY
+respectfulness/M
+respective/Y
+respell/SGD
+respiration/M
+respirator/SM
+respiratory
+respire/DG
+resplendence/M
+resplendent/Y
+respond/SGD
+respondent/SM
+response/MS
+responsibility/SM
+responsible
+responsibly
+responsive/UYP
+responsiveness/UM
+rest/GVMDS
+restate/GDS
+restaurant/SM
+restaurateur/MS
+restful/YP
+restfuller
+restfullest
+restfulness/M
+restitution/M
+restive/YP
+restiveness/M
+restless/PY
+restlessness/M
+restoration/SM
+restorative/SM
+restorer/SM
+restrained/U
+restraint/MS
+restrict/SDGV
+restricted/U
+restriction/MS
+restrictive/YP
+restrictiveness/M
+restring/SG
+restroom/SM
+restructuring/SM
+result/GSMD
+resultant/SM
+resume/DSMG
+resumption/MS
+resupply/DSG
+resurgence/MS
+resurgent
+resurrect/GSD
+resurrection/MS
+resuscitate/GNDS
+resuscitation/M
+resuscitator/SM
+retailer/MS
+retain/SDRZG
+retainer/M
+retake/G
+retaliate/DSGNVX
+retaliation/M
+retaliatory
+retard/SMDRZG
+retardant/SM
+retardation/M
+retarder/M
+retch/DSG
+reteach/GS
+retention/M
+retentive/YP
+retentiveness/M
+rethink/SGM
+rethought
+reticence/M
+reticent/Y
+reticulated
+reticulation/MS
+reticulum
+retina/SM
+retinal
+retinoblastoma
+retinue/SM
+retiree/SM
+retirement/MS
+retort/GMD
+retrace/GDS
+retract/DBG
+retractile
+retraction/S
+retrain/DGS
+retread/D
+retrenchment/MS
+retribution/MS
+retributive
+retrieval/SM
+retrieve/DRSMZGB
+retriever/M
+retro/MS
+retroactive/Y
+retrofire/GDS
+retrofit/SM
+retrofitted
+retrofitting
+retrograde/DSG
+retrogress/GVDS
+retrogression/M
+retrorocket/MS
+retrospect/MDSGV
+retrospection/M
+retrospective/MYS
+retrovirus/MS
+retsina/M
+returnable/SM
+returnee/SM
+rev/ZVM
+revamping/M
+reveal/GJSD
+revealed/U
+revealing/Y
+reveille/M
+revel/JMDRSZG
+revelation/SM
+revelatory
+reveler/M
+revelry/SM
+revenge/MGDS
+revenuer/SM
+reverb
+reverberate/DSGNX
+reverberation/M
+revere/DSG
+reverence/DSMG
+reverend/SM
+reverent/Y
+reverential/Y
+reverie/MS
+revers/M
+reversal/SM
+reverse/Y
+reversibility
+reversible
+reversibly
+revert/GSD
+revertible
+revetment/SM
+revile/DRSLZG
+revilement/M
+reviler/M
+reviser/MS
+revision/SM
+revisionism/M
+revisionist/SM
+revival/MS
+revivalism/M
+revivalist/SM
+revive/DSG
+revivification/M
+revocable
+revoke/DSG
+revolt/GD
+revolting/Y
+revolution/SM
+revolutionary/SM
+revolutionist/SM
+revolutionize/DSG
+revolve/BZGDRS
+revolver/M
+revue/MS
+revulsion/M
+revved
+revving
+rewarded/U
+rewarding/U
+rewarm/GSD
+rewash/GDS
+reweave/GS
+rewedding
+rewind/MB
+rewound
+rewrite/MGS
+rhapsodic
+rhapsodical
+rhapsodize/GDS
+rhapsody/SM
+rhea/MS
+rhenium/M
+rheostat/SM
+rhesus/MS
+rhetoric/M
+rhetorical/Y
+rhetorician/SM
+rheum/M
+rheumatic/MS
+rheumatically
+rheumatism/M
+rheumatoid
+rheumy
+rhinestone/SM
+rhinitis/M
+rhino/MS
+rhinoceros/MS
+rhinoplasty
+rhinovirus/MS
+rhizome/MS
+rho/SM
+rhodium/M
+rhododendron/SM
+rhomboid/SM
+rhomboidal
+rhombus/MS
+rhubarb/MS
+rhyme/MZGDRS
+rhymer/M
+rhymester/MS
+rhythm/SM
+rhythmic
+rhythmical/Y
+rial/MS
+rib/SM
+ribald
+ribaldry/M
+ribbed
+ribber/SM
+ribbing
+ribbon/SM
+riboflavin/M
+rice/MZGDRS
+ricer/M
+rich/TMRSYP
+richness/M
+rick/GMDS
+rickets/M
+rickety/RT
+rickrack/M
+rickshaw/MS
+ricochet/GMDS
+ricotta/M
+rid/S
+riddance/M
+ridden
+ridding
+riddle/DSMG
+ride/MZGRS
+rider/M
+riderless
+ridership/M
+ridge/MGDS
+ridgepole/SM
+ridgy
+ridicule/MGDS
+ridiculous/YP
+ridiculousness/M
+riding/M
+rife/TR
+riff/GMDS
+riffle/DSMG
+riffraff/M
+rifle/MZGDRS
+rifleman/M
+riflemen
+rifler/M
+rifling/M
+rift/GMDS
+rig/SM
+rigatoni/M
+rigged
+rigger/SM
+rigging/M
+right/MDRYSPTG
+righteous/UP
+righteously
+righteousness/UM
+rightful/PY
+rightfulness/M
+rightism/M
+rightist/SM
+rightmost
+rightness/M
+righto
+rightsize/DSG
+rightward/S
+rigid/YP
+rigidity/M
+rigidness/M
+rigmarole/MS
+rigor/MS
+rigorous/YP
+rigorousness/M
+rile/GDS
+rill/MS
+rim/SGMD
+rime/MS
+rimless
+rimmed
+rimming
+rind/MS
+ring/ZGMDRJ
+ringer/M
+ringgit/MS
+ringleader/MS
+ringlet/MS
+ringlike
+ringmaster/MS
+ringside/M
+ringtone/SM
+ringworm/M
+rink/MS
+rinse/MGDS
+riot/ZGMDRS
+rioter/M
+rioting/M
+riotous/PY
+rip/SXTMNR
+riparian
+ripcord/MS
+ripe/YP
+ripen/DG
+ripened/U
+ripeness/M
+ripoff/SM
+riposte/MGDS
+ripped
+ripper/SM
+ripping
+ripple/DSMG
+ripply
+ripsaw/SM
+riptide/MS
+rise/JMZGRS
+risen
+riser/M
+risibility/M
+risible
+rising/M
+risk/GMDS
+riskily
+riskiness/M
+risky/RPT
+risotto/MS
+risque
+rissole/S
+rite/MS
+ritual/SMY
+ritualism/M
+ritualistic
+ritualistically
+ritualized
+ritzy/RT
+riv/ZNR
+rival/MDSG
+rivaled/U
+rivalry/SM
+rive/CGDS
+river/M
+riverbank/SM
+riverbed/MS
+riverboat/SM
+riverfront
+riverside/MS
+rivet/MDRSZG
+riveter/M
+riviera/S
+rivulet/MS
+riyal/MS
+rm
+roach/GMDS
+road/IMS
+roadbed/SM
+roadblock/MDSG
+roadhouse/SM
+roadie/MS
+roadkill/M
+roadrunner/SM
+roadshow/SM
+roadside/SM
+roadster/SM
+roadway/SM
+roadwork/SM
+roadworthy
+roam/ZGDRS
+roamer/M
+roaming/M
+roan/MS
+roar/ZGMDRS
+roarer/M
+roaring/M
+roast/ZGMDRSJ
+roaster/M
+roasting/M
+rob/S
+robbed
+robber/MS
+robbery/SM
+robbing
+robe's
+robe/EGDS
+robin/MS
+robocall/SGMD
+robot/MS
+robotic/S
+robotics/M
+robotize/GDS
+robust/RYPT
+robustness/M
+rock/ZGMDRS
+rockabilly/M
+rockbound
+rocker/M
+rockery/S
+rocket/MDSG
+rocketry/M
+rockfall/SM
+rockiness/M
+rocky/TRP
+rococo/M
+rod/SM
+rode
+rodent/MS
+rodeo/MS
+roe/SM
+roebuck/SM
+roentgen/MS
+roger/GDS
+rogue's
+rogue/KS
+roguery/M
+roguish/YP
+roguishness/M
+roil/GDS
+roister/ZGDRS
+roisterer/M
+role/MS
+roll/MDRZGJS
+rollback/SM
+roller/M
+rollerblading
+rollerskating/M
+rollick/SDG
+rollicking/M
+rollmop/S
+rollover/SM
+romaine/MS
+roman/M
+romance/MZGDRS
+romancer/M
+romantic/MS
+romantically
+romanticism/M
+romanticist/SM
+romanticize/DSG
+romeo/MS
+romp/MDRZGS
+romper/M
+rondo/SM
+rood/MS
+roof/MDRZGS
+roofer/M
+roofing/M
+roofless
+rooftop/SM
+rook/MDGS
+rookery/SM
+rookie/SM
+room/MDRZGS
+roomer/M
+roomette/SM
+roomful/SM
+roominess/M
+roommate/SM
+roomy/RTP
+roost/SMDRZG
+rooster/M
+root/MDRZGS
+rooter/M
+rootkit/SM
+rootless/P
+rootlet/SM
+rope/MZGDRS
+roper/M
+ropy/RT
+rosary/SM
+rose/MS
+roseate
+rosebud/SM
+rosebush/MS
+rosemary/M
+rosette/SM
+rosewater/M
+rosewood/MS
+rosily
+rosin/SMDG
+rosiness/M
+roster/SM
+rostrum/MS
+rosy/RTP
+rot/SM
+rota/S
+rotary/SM
+rotate/DSGNX
+rotation/M
+rotational
+rotatory
+rote/M
+rotgut/M
+rotisserie/SM
+rotogravure/MS
+rotor/SM
+rototiller/MS
+rotted
+rotten/TPRY
+rottenness/M
+rotter/S
+rotting
+rottweiler/S
+rotund/P
+rotunda/MS
+rotundity/M
+rotundness/M
+roue/MS
+rouge/DSMG
+rough/MDNRYXTGP
+roughage/M
+roughcast
+roughen/GD
+roughhouse/MGDS
+roughneck/GMDS
+roughness/M
+roughs
+roughshod
+roulette/M
+round/PSMDRYZTG
+roundabout/SM
+roundel/S
+roundelay/MS
+roundhouse/SM
+roundish
+roundness/M
+roundup/MS
+roundworm/SM
+rouse/DSG
+roust/SDG
+roustabout/SM
+rout/MRZS
+route's
+route/ADSG
+routeing
+router/M
+routine/MYS
+routinize/GDS
+roux
+rove/ZGDRS
+rover/M
+row/SZGMDR
+rowan/S
+rowboat/MS
+rowdily
+rowdiness/M
+rowdy/PRSMT
+rowdyism/M
+rowel/SMDG
+rower/M
+rowing/M
+rowlock/S
+royal/SMY
+royalist/SM
+royalties/M
+royalty/SM
+rpm
+rps
+rt
+rte
+rub/SM
+rubato/SM
+rubbed
+rubber/SM
+rubberize/GDS
+rubberneck/MDRSZG
+rubbernecker/M
+rubbery
+rubbing/S
+rubbish/MDSG
+rubbishy
+rubble/M
+rubdown/SM
+rube/MS
+rubella/M
+rubicund
+rubidium/M
+ruble/SM
+rubric/SM
+ruby/RSMT
+ruched
+ruck/DGS
+rucksack/MS
+ruckus/MS
+ructions
+rudder/SM
+rudderless
+ruddiness/M
+ruddy/RTP
+rude/YTRP
+rudeness/M
+rudiment/SM
+rudimentary
+rue/DSMG
+rueful/PY
+ruefulness/M
+ruff/MDYGS
+ruffian/MYS
+ruffle/DSMG
+ruffled/U
+rug/SM
+rugby/M
+rugged/PTRY
+ruggedness/M
+rugger
+rugrat/SM
+ruin/MDGS
+ruination/M
+ruinous/Y
+rule/MZGJDRS
+ruler/M
+ruling/M
+rum/SM
+rumba/SMDG
+rumble/DSJMG
+rumbling/M
+rumbustious
+ruminant/MS
+ruminate/XGNVDS
+rumination/M
+ruminative/Y
+rummage/DSMG
+rummer
+rummest
+rummy/M
+rumor/SMDG
+rumormonger/SM
+rump/MYS
+rumple/DSMG
+rumpus/MS
+run/ASM
+runabout/MS
+runaround/SM
+runaway/MS
+rundown/SM
+rune/MS
+rung/MS
+runic
+runlet/SM
+runnel/SM
+runner/SM
+running/M
+runny/RT
+runoff/SM
+runt/MS
+runtime
+runty/RT
+runway/SM
+rupee/SM
+rupiah/M
+rupiahs
+rupture/MGDS
+rural
+ruse/MS
+rush/MDRSZG
+rusher/M
+rushy
+rusk/MS
+russet/SM
+rust/MDGS
+rustic/SM
+rustically
+rusticate/GDS
+rustication/M
+rusticity/M
+rustiness/M
+rustle/DRSJMZG
+rustler/M
+rustproof/SDG
+rusty/RPNT
+rut/SM
+rutabaga/SM
+ruthenium/M
+rutherfordium/M
+ruthless/YP
+ruthlessness/M
+rutted
+rutting
+rutty/RT
+rye/M
+s/NYXB
+sabbath/M
+sabbaths
+sabbatical/SM
+saber/MS
+sable/MS
+sabot/MS
+sabotage/DSMG
+saboteur/SM
+sabra/MS
+sac/SM
+saccharin/M
+saccharine
+sacerdotal
+sachem/SM
+sachet/SM
+sack/ZGMDRJS
+sackcloth/M
+sacker/M
+sackful/MS
+sacking/M
+sacra
+sacrament/MS
+sacramental
+sacred/YP
+sacredness/M
+sacrifice/DSMG
+sacrificial/Y
+sacrilege/MS
+sacrilegious/Y
+sacristan/MS
+sacristy/SM
+sacroiliac/MS
+sacrosanct/P
+sacrosanctness/M
+sacrum/M
+sad/PY
+sadden/SDG
+sadder
+saddest
+saddle's
+saddle/UDSG
+saddlebag/MS
+saddler/S
+saddlery
+sades
+sadhu/S
+sadism/M
+sadist/SM
+sadistic
+sadistically
+sadness/M
+sadomasochism/M
+sadomasochist/MS
+sadomasochistic
+safari/SGMD
+safe/MYTPRS
+safeguard/SMDG
+safekeeping/M
+safeness/M
+safety/SM
+safflower/MS
+saffron/MS
+sag/SM
+saga/MS
+sagacious/Y
+sagacity/M
+sage/MYTRS
+sagebrush/M
+sagged
+sagging
+saggy/RT
+sago/M
+saguaro/MS
+sahib/MS
+said/U
+sail/GMDSJ
+sailboard/MRZGS
+sailboarder/M
+sailboarding/M
+sailboat/MS
+sailcloth/M
+sailfish/MS
+sailing/M
+sailor/SM
+sailplane/MS
+saint/MDYS
+sainthood/M
+saintlike
+saintliness/M
+saintly/PRT
+saith
+sake/M
+salaam/SMDG
+salable/U
+salacious/PY
+salaciousness/M
+salacity/M
+salad/MS
+salamander/SM
+salami/SM
+salary/DSM
+sale/ABMS
+saleroom/S
+salesclerk/SM
+salesgirl/SM
+saleslady/SM
+salesman/M
+salesmanship/M
+salesmen
+salespeople/M
+salesperson/MS
+salesroom/S
+saleswoman/M
+saleswomen
+salience/M
+salient/SMY
+saline/SM
+salinity/M
+saliva/M
+salivary
+salivate/GNDS
+salivation/M
+sallow/RTP
+sallowness/M
+sally/DSMG
+salmon/SM
+salmonella/M
+salmonellae
+salon/MS
+saloon/SM
+salsa/MS
+salt's
+salt/CTGDS
+saltbox/MS
+saltcellar/SM
+salted/U
+salter
+saltine/SM
+saltiness/M
+saltpeter/M
+saltshaker/SM
+saltwater/M
+salty/RTP
+salubrious/I
+salutary
+salutation/MS
+salutatorian/MS
+salutatory
+salute/DSMG
+salvage/DSMG
+salvageable
+salvation/M
+salve/MZGDRS
+salver/M
+salvo/MS
+samarium/M
+samba/MDSG
+same/SP
+sameness/M
+samey
+samizdat/S
+samosa/S
+samovar/SM
+sampan/SM
+sample/DRSMZGJ
+sampler/M
+sampling/M
+samurai/SM
+sanatorium/SM
+sanctification/M
+sanctify/GDSN
+sanctimonious/YP
+sanctimoniousness/M
+sanctimony/M
+sanction/GSMD
+sanctioned/U
+sanctity/M
+sanctuary/SM
+sanctum/SM
+sand/ZGMDRS
+sandal/SM
+sandalwood/M
+sandbag/SM
+sandbagged
+sandbagger/SM
+sandbagging
+sandbank/MS
+sandbar/SM
+sandblast/ZGMDRS
+sandblaster/M
+sandbox/MS
+sandcastle/MS
+sander/M
+sandhog/SM
+sandiness/M
+sandlot/SM
+sandlotter/MS
+sandman/M
+sandmen
+sandpaper/GMDS
+sandpiper/MS
+sandpit/S
+sandstone/M
+sandstorm/SM
+sandwich/MDSG
+sandy/RTP
+sane/IYTR
+saneness/M
+sang/S
+sangfroid/M
+sangria/M
+sanguinary
+sanguine/Y
+sanitarian/SM
+sanitarium/SM
+sanitary/IU
+sanitation/M
+sanitize/ZGDRS
+sanity/IM
+sank
+sans
+sanserif
+sap/SM
+sapience/M
+sapiens
+sapient
+sapless
+sapling/MS
+sapped
+sapper/S
+sapphire/SM
+sappiness/M
+sapping
+sappy/PRT
+saprophyte/SM
+saprophytic
+sapsucker/SM
+sapwood/M
+saran/M
+sarcasm/MS
+sarcastic
+sarcastically
+sarcoma/MS
+sarcophagi
+sarcophagus/M
+sardine/MS
+sardonic
+sardonically
+sarge/MS
+sari/MS
+sarky
+sarnie/S
+sarong/SM
+sarsaparilla/MS
+sartorial/Y
+sash/MS
+sashay/SGMD
+sass/GMDS
+sassafras/MS
+sassy/RT
+sat
+satanic
+satanical/Y
+satanism/M
+satanist/MS
+satay
+satchel/MS
+sate/GDS
+sateen/M
+satellite/DSMG
+satiable/I
+satiate/GNDS
+satiation/M
+satiety/M
+satin/M
+satinwood/SM
+satiny
+satire/SM
+satiric
+satirical/Y
+satirist/SM
+satirize/DSG
+satisfaction/EM
+satisfactions
+satisfactorily/U
+satisfactory/U
+satisfied/U
+satisfy/EDSG
+satisfying/U
+satisfyingly
+satori/M
+satrap/SM
+satsuma/S
+saturate/DSGN
+saturated/U
+saturation/M
+saturnine
+satyr/MS
+satyriasis/M
+satyric
+sauce/MZGDRS
+saucepan/SM
+saucer/M
+saucily
+sauciness/M
+saucy/RPT
+sauerkraut/M
+sauna/MDSG
+saunter/MDGS
+saurian
+sauropod/SM
+sausage/MS
+saute/MS
+sauteed
+sauteing
+savage/DRSMYTGP
+savageness/M
+savagery/SM
+savanna/MS
+savant/SM
+save/BJMZGDRS
+saved/U
+saver/M
+saving/M
+savings/M
+savior/SM
+savor/MDSG
+savoriness/M
+savory/PTRSM
+savoy/MS
+savvy/DRSMTG
+saw/SGMD
+sawbones/M
+sawbuck/MS
+sawdust/M
+sawfly/SM
+sawhorse/SM
+sawmill/MS
+sawyer/SM
+sax/MS
+saxifrage/SM
+saxophone/MS
+saxophonist/SM
+say's
+say/USG
+saying/SM
+scab/MS
+scabbard/MS
+scabbed
+scabbiness/M
+scabbing
+scabby/PTR
+scabies/M
+scabrous
+scad/MS
+scaffold/SMG
+scaffolding/M
+scag/S
+scagged
+scalability
+scalar/S
+scalawag/MS
+scald/MDSG
+scale's
+scale/CGDS
+scaleless
+scalene
+scaliness/M
+scallion/MS
+scallop/GSMD
+scalp/MDRSZG
+scalpel/SM
+scalper/M
+scaly/RTP
+scam/MS
+scammed
+scammer/S
+scamming
+scamp/MRSZ
+scamper/GMD
+scampi/M
+scan/MS
+scandal/SM
+scandalize/DSG
+scandalmonger/SM
+scandalous/Y
+scandium/M
+scanned
+scanner/SM
+scanning
+scansion/M
+scant/CDSTG
+scanter
+scantily
+scantiness/M
+scantly
+scantness/M
+scanty/RSPT
+scapegoat/SGMD
+scapegrace/MS
+scapula/M
+scapulae
+scapular/SM
+scar/GMDS
+scarab/SM
+scarce/RYTP
+scarceness/M
+scarcity/SM
+scare/MS
+scarecrow/MS
+scaremonger/SMG
+scarf/MDSG
+scarification/M
+scarify/NDSG
+scarily
+scariness/M
+scarlatina/M
+scarlet/M
+scarp/MDRSZG
+scarper/DG
+scarred
+scarring
+scarves
+scary/RTP
+scat/MS
+scathing/Y
+scatological
+scatology/M
+scatted
+scatter/GJSMD
+scatterbrain/SMD
+scattering/M
+scattershot
+scatting
+scatty
+scavenge/ZGDRS
+scavenger/M
+scenario/MS
+scenarist/MS
+scene/MS
+scenery/M
+scenic
+scenically
+scent/CMS
+scented/U
+scenting
+scentless
+scepter/MS
+sch
+schadenfreude
+schedule's
+schedule/ADSG
+scheduled/U
+scheduler/S
+schema
+schemata
+schematic/SM
+schematically
+schematize/GDS
+scheme/DRSMZG
+schemer/M
+scherzo/MS
+schilling/MS
+schism/SM
+schismatic/SM
+schist/M
+schistosomiasis
+schizo/SM
+schizoid/MS
+schizophrenia/M
+schizophrenic/SM
+schlemiel/SM
+schlep/SM
+schlepped
+schlepping
+schlock/M
+schmaltz/M
+schmaltzy/TR
+schmo/M
+schmoes
+schmooze/DRSZG
+schmuck/MS
+schnapps/M
+schnauzer/SM
+schnitzel/SM
+schnook/MS
+schnoz/MS
+schnozzle/SM
+scholar/MYS
+scholarship/MS
+scholastic
+scholastically
+scholasticism
+school/SGMD
+schoolbag/MS
+schoolbook/SM
+schoolboy/MS
+schoolchild/M
+schoolchildren/M
+schooldays
+schooled/U
+schoolfellow/SM
+schoolgirl/SM
+schoolhouse/SM
+schooling/M
+schoolkid/S
+schoolmarm/SM
+schoolmarmish
+schoolmaster/MS
+schoolmate/SM
+schoolmistress/MS
+schoolroom/SM
+schoolteacher/MS
+schoolwork/M
+schoolyard/SM
+schooner/SM
+schuss/GMDS
+schussboomer/MS
+schwa/MS
+sci
+sciatic
+sciatica/M
+science/FMS
+scientific/U
+scientifically/U
+scientist/SM
+scimitar/SM
+scintilla/MS
+scintillate/DSGN
+scintillation/M
+scion/MS
+scissor/GDS
+scleroses
+sclerosis/M
+sclerotic
+scoff/MDRSZG
+scoffer/M
+scofflaw/MS
+scold/MDSGJ
+scolding/M
+scoliosis/M
+sconce/SM
+scone/MS
+scoop/MDSG
+scoopful/MS
+scoot/DRSZG
+scooter/M
+scope/MGDS
+scorbutic
+scorch/MDRSZG
+scorcher/M
+score/MZGDRS
+scoreboard/SM
+scorecard/MS
+scorekeeper/MS
+scoreless
+scoreline/S
+scorer/M
+scorn/MDRSZG
+scorner/M
+scornful/Y
+scorpion/MS
+scotch/MDSG
+scotchs
+scoundrel/MS
+scour/DRSZG
+scourer/M
+scourge/DSMG
+scout/MDRSZG
+scouting/M
+scoutmaster/MS
+scow/MS
+scowl/MDSG
+scrabble/MZGDRS
+scrabbler/M
+scrag/MS
+scraggly/RT
+scraggy/TR
+scram/S
+scramble's
+scramble/UGDS
+scrambler/MS
+scrammed
+scramming
+scrap/MDRSZGJ
+scrapbook/SM
+scrape/SM
+scraper/M
+scrapheap/SM
+scrapie
+scrapped
+scrapper/MS
+scrapping
+scrappy/TR
+scrapyard/SM
+scratch/GMDS
+scratchcard/S
+scratched/U
+scratchily
+scratchiness/M
+scratchpad/S
+scratchy/PRT
+scrawl/SMDG
+scrawly
+scrawniness/M
+scrawny/PTR
+scream/SMDRZG
+screamer/M
+screaming/Y
+scree/MDS
+screech/GMDS
+screechy/TR
+screed/S
+screen/SJMDG
+screening/M
+screenplay/SM
+screensaver/SM
+screenshot/S
+screenwriter/SM
+screenwriting/M
+screw's
+screw/UDSG
+screwball/MS
+screwdriver/MS
+screwiness/M
+screwworm/SM
+screwy/PRT
+scribal
+scribble/MZGDRS
+scribbler/M
+scribe's
+scribe/CKIS
+scrim/MS
+scrimmage/MGDS
+scrimp/SDG
+scrimshaw/MDGS
+scrip/MS
+script/FSMDG
+scripted/U
+scriptural
+scripture/MS
+scriptwriter/SM
+scrivener/SM
+scrod/M
+scrofula/M
+scrofulous
+scrog/S
+scroll/GSMD
+scrooge/MS
+scrota
+scrotal
+scrotum/M
+scrounge/DRSZG
+scrounger/M
+scroungy/TR
+scrub/MS
+scrubbed
+scrubber/SM
+scrubbing
+scrubby/RT
+scruff/SM
+scruffily
+scruffiness/M
+scruffy/RPT
+scrum/S
+scrumhalf
+scrumhalves
+scrummage/S
+scrummed
+scrumming
+scrump/SGD
+scrumptious/Y
+scrumpy
+scrunch/MDSG
+scrunchy/SM
+scruple/MGDS
+scrupulosity/M
+scrupulous/UPY
+scrupulousness/UM
+scrutineer/S
+scrutinize/GDS
+scrutiny/M
+scuba/MDSG
+scud/MS
+scudded
+scudding
+scuff/MDSG
+scuffle/MGDS
+scull/MDRSZG
+sculler/M
+scullery/SM
+scullion/SM
+sculpt/SGD
+sculptor/SM
+sculptress/MS
+sculptural
+sculpture/DSMG
+scum/MS
+scumbag/MS
+scummed
+scumming
+scummy/TR
+scupper/MDGS
+scurf/M
+scurfy
+scurrility/M
+scurrilous/PY
+scurrilousness/M
+scurry/GDSM
+scurvily
+scurvy/TRM
+scutcheon/SM
+scuttle/MGDS
+scuttlebutt/M
+scuzzy/TR
+scythe/DSMG
+sea/SM
+seabed/SM
+seabird/MS
+seaboard/SM
+seaborne
+seacoast/SM
+seafarer/SM
+seafaring/M
+seafloor/SM
+seafood/M
+seafront/SM
+seagoing
+seagull/MS
+seahorse/MS
+seal's
+seal/AUSDG
+sealant/MS
+sealer/SM
+sealskin/M
+seam/GMDNS
+seaman/M
+seamanship/M
+seamless/Y
+seamount/MS
+seamstress/MS
+seamy/RT
+seance/SM
+seaplane/SM
+seaport/MS
+sear/GMDS
+search/AZGMDRS
+searchable/U
+searcher/AM
+searching/Y
+searchlight/MS
+searing/Y
+seascape/SM
+seashell/SM
+seashore/SM
+seasick/P
+seasickness/M
+seaside/MS
+season/SGMDBJ
+seasonable/U
+seasonably/U
+seasonal/Y
+seasonality
+seasoned/U
+seasoning/M
+seat's
+seat/UGDS
+seating/M
+seatmate/SM
+seawall/MS
+seaward/MS
+seawater/M
+seaway/SM
+seaweed/MS
+seaworthiness/M
+seaworthy/P
+sebaceous
+seborrhea/M
+sebum
+sec'y
+sec/SM
+secant/SM
+secateurs
+secede/DSG
+secession/M
+secessionist/MS
+seclude/GDS
+seclusion/M
+seclusive
+second/SLZGMDRY
+secondarily
+secondary/SM
+seconder/M
+secondhand
+secondment/S
+secrecy/M
+secret/SGVMDY
+secretarial
+secretariat/MS
+secretary/SM
+secretaryship/M
+secrete/XNS
+secretion/M
+secretive/PY
+secretiveness/M
+secretory
+sect/IMS
+sectarian/MS
+sectarianism/M
+sectary/SM
+section/AESM
+sectional/MS
+sectionalism/M
+sectioned
+sectioning
+sector/ESM
+secular
+secularism/M
+secularist/SM
+secularization/M
+secularize/DSG
+secure/DRSYTG
+secured/U
+security/ISM
+secy
+sedan/MS
+sedate/DRSYTGNVP
+sedateness/M
+sedation/M
+sedative/SM
+sedentary
+sedge/M
+sedgy
+sediment/MS
+sedimentary
+sedimentation/M
+sedition/M
+seditious
+seduce/DRSZG
+seducer/M
+seduction/SM
+seductive/YP
+seductiveness/M
+seductress/MS
+sedulous/Y
+see/RSMZ
+seed's
+seed/AGDS
+seedbed/MS
+seedcase/MS
+seeded/U
+seeder/SM
+seediness/M
+seedless
+seedling/MS
+seedpod/MS
+seedy/RPT
+seeing/S
+seek/ZGRS
+seeker/M
+seem/GDS
+seeming/Y
+seemliness/UM
+seemly/URTP
+seen/U
+seep/GDS
+seepage/M
+seer/M
+seersucker/M
+seesaw/SMDG
+seethe/DSG
+segfault/S
+segment/GSMD
+segmentation/M
+segmented/U
+segregate/CDSGN
+segregated/U
+segregation/CM
+segregationist/MS
+segue/MGDS
+segueing
+seigneur/SM
+seignior/SM
+seine/MZGDRS
+seiner/M
+seismic
+seismically
+seismograph/ZMR
+seismographer/M
+seismographic
+seismographs
+seismography/M
+seismologic
+seismological
+seismologist/MS
+seismology/M
+seize/GDS
+seizure/MS
+seldom
+select/CSGVD
+selection/SM
+selective/Y
+selectivity/M
+selectman/M
+selectmen
+selectness/M
+selector/MS
+selenium/M
+selenographer/MS
+selenography/M
+self/M
+selfie/SM
+selfish/UYP
+selfishness/UM
+selfless/PY
+selflessness/M
+selfsame
+sell's
+sell/AZGRS
+seller's
+selloff/MS
+sellotape/DSG
+sellout/MS
+seltzer/MS
+selvage/MS
+selves
+semantic/S
+semantically
+semanticist/MS
+semantics/M
+semaphore/DSMG
+semblance/ASM
+semen/M
+semester/SM
+semi/MS
+semiannual/Y
+semiarid
+semiautomatic/MS
+semibreve/S
+semicircle/SM
+semicircular
+semicolon/MS
+semiconducting
+semiconductor/MS
+semiconscious
+semidarkness/M
+semidetached
+semifinal/SM
+semifinalist/MS
+semigloss/S
+semimonthly/SM
+seminal
+seminar/MS
+seminarian/SM
+seminary/SM
+semiofficial
+semiotic/S
+semiotics/M
+semipermeable
+semiprecious
+semiprivate
+semipro/S
+semiprofessional/SM
+semiquaver/S
+semiretired
+semiskilled
+semisolid
+semisweet
+semitone/SM
+semitrailer/MS
+semitransparent
+semitropical
+semivowel/SM
+semiweekly/SM
+semiyearly
+semolina/M
+sempstress/MS
+senate/SM
+senator/MS
+senatorial
+send/ZGRS
+sender/M
+sendoff/MS
+senescence/M
+senescent
+senile
+senility/M
+senior/SM
+seniority/M
+senna/M
+senor/MS
+senora/SM
+senorita/SM
+sensation/MS
+sensational/Y
+sensationalism/M
+sensationalist/MS
+sensationalize/GDS
+sense/MGDS
+senseless/PY
+senselessness/M
+sensibilities
+sensibility/IM
+sensible/P
+sensibleness/M
+sensibly/I
+sensitive/SMYP
+sensitiveness/M
+sensitivities
+sensitivity/IM
+sensitization/CM
+sensitize/CDSG
+sensor/SM
+sensory
+sensual/Y
+sensualist/SM
+sensuality/M
+sensuous/YP
+sensuousness/M
+sent/FAU
+sentence/MGDS
+sententious/Y
+sentience/IM
+sentient/I
+sentiment/SM
+sentimental/Y
+sentimentalism/M
+sentimentalist/MS
+sentimentality/M
+sentimentalization/M
+sentimentalize/GDS
+sentinel/MS
+sentry/SM
+sepal/MS
+separability/IM
+separable
+separably/I
+separate/XMYGNVDSP
+separateness/M
+separation/M
+separatism/M
+separatist/MS
+separator/MS
+sepia/M
+sepsis/M
+septa
+septal
+septet/SM
+septic
+septicemia/M
+septicemic
+septuagenarian/MS
+septum/M
+sepulcher/GMDS
+sepulchral
+seq
+sequel/SM
+sequence/MZGDRS
+sequencing/M
+sequential/FY
+sequester/SDG
+sequestrate/XGNDS
+sequestration/M
+sequin/SMD
+sequinned
+sequitur
+sequoia/MS
+seraglio/MS
+serape/SM
+seraph/M
+seraphic
+seraphs
+sere/TR
+serenade/MGDS
+serendipitous
+serendipity/M
+serene/RPYT
+sereneness/M
+serenity/M
+serf/MS
+serfdom/M
+serge/M
+sergeant/MS
+serial/SMY
+serialization/SM
+serialize/GDSB
+series/M
+serif/MS
+serigraph/M
+serigraphs
+serine
+serious/PY
+seriousness/M
+sermon/SM
+sermonize/GDS
+serology/M
+serotonin
+serous
+serpent/MS
+serpentine/M
+serrate/XND
+serration/M
+serried
+serum/MS
+servant/MS
+serve's/AF
+serve/FACGDS
+server/SM
+servery/S
+service/EMS
+serviceability/M
+serviceable
+serviced
+serviceman/M
+servicemen
+servicewoman/M
+servicewomen
+servicing
+serviette/MS
+servile
+servility/M
+serving's
+servings
+servitor/MS
+servitude/M
+servo/MS
+servomechanism/SM
+servomotor/MS
+sesame/SM
+sesquicentennial/MS
+session/MS
+set/AISM
+setback/MS
+setscrew/SM
+setsquare/S
+sett/BJZGRS
+settee/MS
+setter/M
+setting/M
+settle's
+settle/AUGDS
+settlement/AM
+settlements
+settler/SM
+setup/MS
+seven/MHS
+seventeen/SMH
+seventeenth/M
+seventeenths
+seventh/M
+sevenths
+seventieth/M
+seventieths
+seventy/SMH
+sever/ETGDS
+several/MY
+severance/SM
+severe/YPR
+severeness/M
+severity/M
+sew/ASGD
+sewage/M
+sewer/MS
+sewerage/M
+sewing/M
+sewn/A
+sex/GMDS
+sexagenarian/SM
+sexily
+sexiness/M
+sexism/M
+sexist/MS
+sexless
+sexologist/SM
+sexology/M
+sexpot/MS
+sextant/SM
+sextet/MS
+sexting
+sexton/MS
+sextuplet/SM
+sexual/Y
+sexuality/M
+sexy/PTR
+sf
+sh
+shabbily
+shabbiness/M
+shabby/PTR
+shack/MDSG
+shackle's
+shackle/UGDS
+shad/GMDSJ
+shade/MS
+shadily
+shadiness/M
+shading/M
+shadow/SGMD
+shadowbox/GDS
+shadowy/RT
+shady/RPT
+shaft/MDSG
+shag/MS
+shagged
+shagginess/M
+shagging
+shaggy/TPR
+shah/M
+shahs
+shake/MZGRS
+shakedown/SM
+shaken/U
+shakeout/MS
+shaker/M
+shakeup/MS
+shakily
+shakiness/M
+shaky/RPT
+shale/M
+shall
+shallot/MS
+shallow/TPMRYS
+shallowness/M
+shalom
+shalt
+sham/GMDS
+shaman/SM
+shamanic
+shamanism
+shamanistic
+shamble/MGDS
+shambles/M
+shambolic
+shame/MS
+shamefaced/Y
+shameful/PY
+shamefulness/M
+shameless/YP
+shamelessness/M
+shammed
+shamming
+shampoo/ZGMDRS
+shampooer/M
+shamrock/MS
+shan't
+shandy/S
+shanghai/DSG
+shank/MS
+shantung/M
+shanty/SM
+shantytown/SM
+shape's
+shape/AGDS
+shaped/U
+shapeless/YP
+shapelessness/M
+shapeliness/M
+shapely/PTR
+shard/MS
+share/MZGDRS
+shareable
+sharecrop/S
+sharecropped
+sharecropper/MS
+sharecropping
+shareholder/SM
+shareholding/S
+sharer/M
+shareware/M
+sharia/M
+shariah
+shark/MDSG
+sharkskin/M
+sharp/MDNRYSPXZTG
+sharpen/ADGS
+sharpener/MS
+sharper/M
+sharpie/MS
+sharpish
+sharpness/M
+sharpshooter/SM
+sharpshooting/M
+shatter/GMDS
+shatterproof
+shave/MZGDRSJ
+shaven/U
+shaver/M
+shaving/M
+shawl/MS
+shay/MS
+she'd
+she'll
+she/DSM
+sheaf/M
+shear/MDRSZG
+shearer/M
+sheath/JM
+sheathe/UGDS
+sheathing/M
+sheaths
+sheave/DSMG
+shebang/MS
+shebeen/S
+shed/MS
+shedding
+sheen/M
+sheeny/TR
+sheep/M
+sheepdog/MS
+sheepfold/SM
+sheepherder/MS
+sheepish/YP
+sheepishness/M
+sheepskin/MS
+sheer/MDRSPTG
+sheerness/M
+sheet/MSG
+sheeting/M
+sheetlike
+sheikdom/MS
+sheikh/M
+sheikhs
+sheila/S
+shekel/SM
+shelf/M
+shell/MDRSG
+shellac/MS
+shellacked
+shellacking/MS
+shellfire/M
+shellfish/MS
+shelter/GMDS
+shelve/GDS
+shelving/M
+shenanigan/SM
+shepherd/SMDG
+shepherdess/MS
+sherbet/SM
+sheriff/SM
+sherry/SM
+shew/GDS
+shewn
+shh
+shiatsu/M
+shibboleth/M
+shibboleths
+shield/MDGS
+shift/GMDS
+shiftily
+shiftiness/M
+shiftless/PY
+shiftlessness/M
+shifty/RPT
+shiitake/SM
+shill/GMDSJ
+shillelagh/M
+shillelaghs
+shilling/M
+shim/MS
+shimmed
+shimmer/SMDG
+shimmery
+shimming
+shimmy/DSMG
+shin/ZGMDRS
+shinbone/SM
+shindig/SM
+shine/MS
+shiner/M
+shingle/DSMG
+shinguard/M
+shininess/M
+shinned
+shinning
+shinny/DSG
+shinsplints/M
+shiny/TRP
+ship's
+ship/ALS
+shipboard/MS
+shipbuilder/SM
+shipbuilding/M
+shipload/SM
+shipmate/SM
+shipment/AM
+shipments
+shipowner/MS
+shipped/A
+shipper/SM
+shipping/M
+shipshape
+shipwreck/GMDS
+shipwright/MS
+shipyard/SM
+shire/MS
+shirk/ZGDRS
+shirker/M
+shirr/GMDSJ
+shirring/M
+shirt/GMDS
+shirtfront/SM
+shirting/M
+shirtless
+shirtsleeve/SM
+shirttail/SM
+shirtwaist/MS
+shirty
+shit/SM!
+shitfaced/!
+shithead/S!
+shitload/!
+shitted/!
+shitting/!
+shitty/RT!
+shiv/ZMRS
+shiver/MDG
+shivery
+shoal/GMDS
+shoat/MS
+shock/ZGMDRS
+shocker/M
+shocking/Y
+shockproof
+shod/U
+shoddily
+shoddiness/M
+shoddy/PRMT
+shoe/MS
+shoehorn/GMDS
+shoeing
+shoelace/MS
+shoemaker/SM
+shoeshine/SM
+shoestring/SM
+shoetree/MS
+shogun/MS
+shogunate/M
+shone
+shoo/GDS
+shook
+shoot/ZGMRSJ
+shooter/M
+shooting/M
+shootout/MS
+shop/MS
+shopaholic/MS
+shopfitter/S
+shopfitting
+shopfront/S
+shopkeeper/MS
+shoplift/DRZGS
+shoplifter/M
+shoplifting/M
+shoppe/MZGDRS
+shopper/M
+shopping/M
+shoptalk/M
+shopworn
+shore/MGDS
+shorebird/SM
+shoreline/MS
+shoring/M
+short/XTGMDNRYSP
+shortage/MS
+shortbread/M
+shortcake/MS
+shortchange/DSG
+shortcoming/MS
+shortcrust
+shortcut/MS
+shorten/JGD
+shortening/M
+shortfall/MS
+shorthand/MD
+shorthorn/MS
+shortish
+shortlist/DGS
+shortness/M
+shortsighted/PY
+shortsightedness/M
+shortstop/MS
+shortwave/MS
+shorty/SM
+shot/MS
+shotgun/SM
+shotgunned
+shotgunning
+should
+should've
+shoulder/MDGS
+shouldn't
+shout/ZGMDRS
+shouter/M
+shove/MGDS
+shovel/MDSG
+shovelful/SM
+show/JZGMDRS
+showbiz/M
+showboat/MDGS
+showcase/MGDS
+showdown/MS
+shower/MDG
+showerproof
+showery
+showgirl/MS
+showground/S
+showily
+showiness/M
+showing/M
+showjumping
+showman/M
+showmanship/M
+showmen
+shown
+showoff/SM
+showpiece/SM
+showplace/SM
+showroom/MS
+showstopper/MS
+showstopping
+showtime
+showy/TRP
+shpt
+shrank
+shrapnel/M
+shred/MS
+shredded
+shredder/MS
+shredding
+shrew/MS
+shrewd/RYPT
+shrewdness/M
+shrewish
+shriek/MDSG
+shrift/M
+shrike/MS
+shrill/DRSPTG
+shrillness/M
+shrilly
+shrimp/MDRSZG
+shrine/MS
+shrink/MSBG
+shrinkage/M
+shrive/GDS
+shrivel/SGD
+shriven
+shroud/GMDS
+shrub/MS
+shrubbery/SM
+shrubby/RT
+shrug/MS
+shrugged
+shrugging
+shrunk/N
+shtick/MS
+shuck/GMDS
+shucks/S
+shudder/MDSG
+shuffle/AMGDS
+shuffleboard/SM
+shuffler/SM
+shun/S
+shunned
+shunning
+shunt/MSDG
+shush/DSG
+shut/S
+shutdown/SM
+shuteye/M
+shutoff/SM
+shutout/SM
+shutter/SMDG
+shutterbug/MS
+shutting
+shuttle/DSMG
+shuttlecock/GMDS
+shy/TGDRSMY
+shyer
+shyest
+shyness/M
+shyster/SM
+sibilant/SM
+sibling/SM
+sibyl/MS
+sibylline
+sic/S
+sicced
+siccing
+sick/PXTGDNRYS
+sickbay/S
+sickbed/SM
+sicken/DG
+sickening/Y
+sickie/MS
+sickish
+sickle/MS
+sickly/RT
+sickness/MS
+sicko/MS
+sickout/SM
+sickroom/MS
+side's
+side/AGDS
+sidearm/SM
+sidebar/SM
+sideboard/SM
+sideburns/M
+sidecar/SM
+sidekick/SM
+sidelight/MS
+sideline/DSMG
+sidelong
+sideman/M
+sidemen
+sidepiece/MS
+sidereal
+sidesaddle/MS
+sideshow/MS
+sidesplitting
+sidestep/MS
+sidestepped
+sidestepping
+sidestroke/DSMG
+sideswipe/DSMG
+sidetrack/SMDG
+sidewalk/MS
+sidewall/MS
+sideways
+sidewinder/SM
+siding/MS
+sidle/MGDS
+siege/MS
+sienna/M
+sierra/MS
+siesta/MS
+sieve/MGDS
+sift/ZGDRS
+sifted/U
+sifter/M
+sigh/GMD
+sighs
+sight/GMDYSJ
+sighting/M
+sightless
+sightly/UTR
+sightread
+sightseeing/M
+sightseer/MS
+sigma/MS
+sign's/C
+sign/AFCGDS
+signage/M
+signal/MDRYSZG
+signaler/M
+signalization/M
+signalize/GDS
+signalman/M
+signalmen
+signatory/SM
+signature/MS
+signboard/MS
+signed/U
+signer/CMS
+signet/MS
+significance/IM
+significant/IY
+signification/M
+signify/XDSNG
+signing's/C
+signings
+signor/FMS
+signora/SM
+signore
+signori
+signorina/MS
+signorine
+signpost/GSMD
+silage/M
+silence/DRSMZG
+silencer/M
+silent/MRYST
+silhouette/DSMG
+silica/M
+silicate/MS
+siliceous
+silicon/SM
+silicone/M
+silicosis/M
+silk/MNS
+silkily
+silkiness/M
+silkscreen/SM
+silkworm/MS
+silky/TRP
+sill/MS
+silliness/M
+silly/TRSMP
+silo/MS
+silt/GMDS
+silty/TR
+silver/GMDS
+silverfish/MS
+silversmith/M
+silversmiths
+silverware/M
+silvery
+sim/SM
+simian/MS
+similar/Y
+similarity/ESM
+simile/MS
+similitude/EM
+simmer/GMDS
+simonize/DSG
+simony/M
+simpatico
+simper/GMDS
+simpering/Y
+simple/TRP
+simpleminded
+simpleness/M
+simpleton/SM
+simplex
+simplicity/M
+simplification/M
+simplify/DSXNG
+simplistic
+simplistically
+simply
+simulacra
+simulacrum/S
+simulate/EDSGN
+simulation/EM
+simulations
+simulator/EMS
+simulcast/GMDS
+simultaneity/M
+simultaneous/Y
+sin/ASM
+since
+sincere/IYT
+sincerer
+sincerity/IM
+sine/MS
+sinecure/MS
+sinew/MS
+sinewy
+sinful/PY
+sinfulness/M
+sing/BZGMDRYS
+singalong/S
+singe/MS
+singeing
+singer/M
+singing/M
+single/PMGDS
+singleness/M
+singles/M
+singlet/S
+singleton/SM
+singletree/SM
+singsong/SMDG
+singular/SMY
+singularity/SM
+sinister
+sink/BZGMRS
+sinkable/U
+sinker/M
+sinkhole/SM
+sinless
+sinned
+sinner/MS
+sinning
+sinology
+sinuosity/M
+sinuous/Y
+sinus/MS
+sinusitis/M
+sinusoidal
+sip/SM
+siphon/GMDS
+sipped
+sipper/SM
+sipping
+sir/SXMN
+sire/CMGDS
+siren/M
+sirloin/SM
+sirocco/SM
+sirrah
+sirree/M
+sis/MS
+sisal/M
+sissified
+sissy/RSMT
+sister/ASM
+sisterhood/MS
+sisterliness/M
+sisterly/P
+sit/S
+sitar/SM
+sitarist/MS
+sitcom/SM
+site/MGDS
+sitemap/SM
+sitter/SM
+sitting/SM
+situ
+situate/DSXGN
+situation/M
+situational
+six/MSH
+sixfold
+sixpence/MS
+sixshooter/M
+sixteen/SMH
+sixteenth/M
+sixteenths
+sixth/M
+sixths
+sixtieth/M
+sixtieths
+sixty/SMH
+sizable
+size's
+size/AGDS
+sizer
+sizing/M
+sizzle/DRSMZG
+ska/M
+skate/MZGDRS
+skateboard/MDRSZG
+skateboarder/M
+skateboarding/M
+skater/M
+skating/M
+skedaddle/MGDS
+skeet/ZMR
+skein/MS
+skeletal
+skeleton/SM
+skeptic/SM
+skeptical/Y
+skepticism/M
+sketch/MDRSZG
+sketchbook/S
+sketcher/M
+sketchily
+sketchiness/M
+sketchpad/S
+sketchy/RTP
+skew/MDRZGS
+skewbald/S
+skewer/MDG
+ski/SZGMDR
+skibob/S
+skid/MS
+skidded
+skidding
+skidpan/S
+skier/M
+skiff/SM
+skiffle
+skiing/M
+skill's
+skill/CSD
+skilled/U
+skillet/SM
+skillful/UY
+skillfulness/M
+skim/MS
+skimmed
+skimmer/SM
+skimming
+skimp/SDG
+skimpily
+skimpiness/M
+skimpy/RTP
+skin/MS
+skincare/M
+skinflint/MS
+skinful
+skinhead/MS
+skinless
+skinned
+skinniness/M
+skinning
+skinny/RMTP
+skint
+skintight
+skip/MS
+skipped
+skipper/SMDG
+skipping
+skirmish/ZGMDRS
+skirt/SMDG
+skit/MS
+skitter/GSD
+skittish/YP
+skittishness/M
+skittle/S
+skive/DRSZG
+skivvy/DSMG
+skoal/SM
+skua/S
+skulduggery/M
+skulk/SDRZG
+skulker/M
+skull/SM
+skullcap/MS
+skunk/SMDG
+sky/GSM
+skycap/SM
+skydive/DRSZG
+skydiver/M
+skydiving/M
+skyjack/JZGSDR
+skyjacker/M
+skyjacking/M
+skylark/SGMD
+skylight/MS
+skyline/SM
+skyrocket/GSMD
+skyscraper/SM
+skyward/S
+skywriter/SM
+skywriting/M
+slab/MS
+slabbed
+slabbing
+slack/PXZTGMDNRYS
+slacken/DG
+slacker/M
+slackness/M
+slacks/M
+slag/MS
+slagged
+slagging
+slagheap/S
+slain
+slake/GDS
+slalom/MSDG
+slam/MS
+slammed
+slammer/SM
+slamming
+slander/MZGDRS
+slanderer/M
+slanderous
+slang/M
+slangy/RT
+slant/MSDG
+slanting/Y
+slantwise
+slap/MS
+slapdash
+slaphappy
+slapped
+slapper/S
+slapping
+slapstick/M
+slash/MDRSZG
+slasher/M
+slat/MDGS
+slate/SM
+slather/SDG
+slatted
+slattern/SMY
+slaughter/MDRZGS
+slaughterer/M
+slaughterhouse/MS
+slave/DRSMZG
+slaveholder/MS
+slaver/MDG
+slavery/M
+slavish/PY
+slavishness/M
+slaw/M
+slay/DRZGJS
+slayer/M
+slaying/M
+sleaze/SM
+sleazebag/S
+sleazeball/S
+sleazily
+sleaziness/M
+sleazy/PRT
+sled/MS
+sledded
+sledder/SM
+sledding
+sledge/DSMG
+sledgehammer/GSMD
+sleek/SDRYTGP
+sleekness/M
+sleep/SMRZG
+sleeper/M
+sleepily
+sleepiness/M
+sleepless/PY
+sleeplessness/M
+sleepover/SM
+sleepwalk/ZGSDR
+sleepwalker/M
+sleepwalking/M
+sleepwear/M
+sleepy/RPT
+sleepyhead/MS
+sleet/SMDG
+sleety
+sleeve/DSM
+sleeveless
+sleigh/MDG
+sleighs
+sleight/SM
+slender/PRT
+slenderize/DSG
+slenderness/M
+slept
+sleuth/MG
+sleuths
+slew/MDGS
+slice/DRSMZG
+slicer/M
+slick/SMDRYZTGP
+slicker/M
+slickness/M
+slid
+slide/RSMZG
+slider/M
+slideshow/MS
+slight/SMDRYTGP
+slightness/M
+slim/PS
+slime/M
+sliminess/M
+slimline
+slimmed
+slimmer/S
+slimmest
+slimming/M
+slimness/M
+slimy/RTP
+sling/SMG
+slingback/S
+slingshot/SM
+slink/SG
+slinky/RT
+slip/MS
+slipcase/MS
+slipcover/MS
+slipknot/MS
+slippage/MS
+slipped
+slipper/SM
+slipperiness/M
+slippery/PRT
+slipping
+slippy
+slipshod
+slipstream/SM
+slipway/SM
+slit/MS
+slither/SGMD
+slithery
+slitter
+slitting
+sliver/GSMD
+slob/MS
+slobbed
+slobber/MDSG
+slobbery
+slobbing
+sloe/MS
+slog/MS
+slogan/SM
+sloganeering
+slogged
+slogging
+sloop/SM
+slop/MDGS
+slope/SM
+slopped
+sloppily
+sloppiness/M
+slopping
+sloppy/PTR
+slops/M
+slosh/DSG
+slot/MS
+sloth/M
+slothful/YP
+slothfulness/M
+sloths
+slotted
+slotting
+slouch/ZGMDRS
+sloucher/M
+slouchy/TR
+slough/GMD
+sloughs
+sloven/SMY
+slovenliness/M
+slovenly/PTR
+slow/DRYTGSP
+slowcoach/S
+slowdown/SM
+slowness/M
+slowpoke/SM
+sludge/M
+sludgy/RT
+slue/MGDS
+slug/MS
+sluggard/MS
+slugged
+slugger/SM
+slugging
+sluggish/PY
+sluggishness/M
+sluice/DSMG
+slum/MS
+slumber/GSMD
+slumberous
+slumdog/SM
+slumlord/MS
+slummed
+slummer
+slumming
+slummy/RT
+slump/SMDG
+slung
+slunk
+slur/MS
+slurp/SMDG
+slurred
+slurring
+slurry/M
+slush/M
+slushiness/M
+slushy/RPT
+slut/MS
+sluttish
+slutty/RT
+sly/TRY
+slyness/M
+smack/SMDRZG
+smacker/M
+small/SMRTP
+smallholder/S
+smallholding/S
+smallish
+smallness/M
+smallpox/M
+smarmy/RT
+smart/SMDNRYXTGP
+smarten/DG
+smartness/M
+smartphone/SM
+smarts/M
+smartwatch/MS
+smarty/SM
+smartypants/M
+smash/MDRSZG
+smasher/M
+smashup/SM
+smattering/MS
+smear/SMDG
+smeary/RT
+smell/SMDG
+smelliness/M
+smelly/RPT
+smelt/SMDRZG
+smelter/M
+smidgen/MS
+smilax/M
+smile/DSMG
+smiley/SM
+smiling/Y
+smirch/GMDS
+smirk/SMDG
+smite/SG
+smith/M
+smithereens/M
+smiths
+smithy/SM
+smitten
+smock/SMDG
+smocking/M
+smog/MS
+smoggy/RT
+smoke/DRSMZG
+smokehouse/MS
+smokeless
+smoker/M
+smokescreen/SM
+smokestack/SM
+smokey
+smokiness/M
+smoking/M
+smoky/RTP
+smolder/SGMD
+smooch/MDSG
+smoochy
+smooth/PDRYTG
+smoothie/MS
+smoothness/M
+smooths
+smorgasbord/SM
+smote
+smother/GSMD
+smudge/DSMG
+smudgy/TR
+smug/YP
+smugger
+smuggest
+smuggle/ZGDRS
+smuggler/M
+smuggling/M
+smugness/M
+smurf/S
+smut/MS
+smuttiness/M
+smutty/TRP
+snack/SMDG
+snaffle/DSMG
+snafu/SM
+snag/MS
+snagged
+snagging
+snail/SMDG
+snake/DSMG
+snakebite/MS
+snakelike
+snakeskin
+snaky/RT
+snap's
+snap/US
+snapdragon/SM
+snapped/U
+snapper/MS
+snappily
+snappiness/M
+snapping/U
+snappish/YP
+snappishness/M
+snappy/TRP
+snapshot/SM
+snare/DSMG
+snarf/SDG
+snark/S
+snarky/TR
+snarl's
+snarl/USDG
+snarling/Y
+snarly/TR
+snatch/ZGMDRS
+snatcher/M
+snazzily
+snazzy/TR
+sneak/SMDRZG
+sneaker/M
+sneakily
+sneakiness/M
+sneaking/Y
+sneaky/TRP
+sneer/SJMDG
+sneering/Y
+sneeze/DSMG
+snick/SDRZG
+snicker/MDG
+snide/RYT
+sniff/SMDRZG
+sniffer/M
+sniffle/DSMG
+sniffy/RT
+snifter/SM
+snip/MDRZGS
+snipe/SM
+sniper/M
+snipped
+snippet/SM
+snipping
+snippy/RT
+snips/M
+snit/MS
+snitch/MDSG
+snivel/SMDRZG
+sniveler/M
+snob/MS
+snobbery/M
+snobbish/PY
+snobbishness/M
+snobby/RT
+snog/S
+snogged
+snogging
+snood/SM
+snooker/MDSG
+snoop/SMDRZG
+snooper/M
+snoopy/TR
+snoot/SM
+snootily
+snootiness/M
+snooty/PTR
+snooze/DSMG
+snore/DRSMZG
+snorer/M
+snorkel/ZGMDRS
+snorkeler/M
+snorkeling/M
+snort/SMDRZG
+snorter/M
+snot/MS
+snottily
+snottiness/M
+snotty/TPR
+snout/SM
+snow/MDGS
+snowball/GSMD
+snowbank/SM
+snowbird/SM
+snowblower/MS
+snowboard/ZGMDRS
+snowboarder/M
+snowboarding/M
+snowbound
+snowdrift/SM
+snowdrop/SM
+snowfall/SM
+snowfield/SM
+snowflake/SM
+snowiness/M
+snowline
+snowman/M
+snowmen
+snowmobile/DSMG
+snowplow/SGMD
+snowshed
+snowshoe/SM
+snowshoeing
+snowstorm/SM
+snowsuit/SM
+snowy/PRT
+snub/MS
+snubbed
+snubbing
+snuff/SMDRYZG
+snuffbox/MS
+snuffer/M
+snuffle/MGDS
+snug/MYSP
+snugged
+snugger
+snuggest
+snugging
+snuggle/MGDS
+snugness/M
+so
+soak/MDGSJ
+soaking/M
+soap/MDGS
+soapbox/MS
+soapiness/M
+soapstone/M
+soapsuds/M
+soapy/RPT
+soar/MDGS
+sob/SM
+sobbed
+sobbing/Y
+sober/SDRYPTG
+soberness/M
+sobriety/IM
+sobriquet/SM
+soc
+soccer/M
+sociability/M
+sociable/SM
+sociably
+social/SMY
+socialism/M
+socialist/SM
+socialistic
+socialite/SM
+socialization/M
+socialize/DSG
+societal
+society/SM
+socioeconomic
+socioeconomically
+sociological/Y
+sociologist/SM
+sociology/M
+sociopath/M
+sociopaths
+sociopolitical
+sock/MDGS
+socket/SM
+sockeye/SM
+sod/SM
+soda/MS
+sodded
+sodden/Y
+sodding
+sodium/M
+sodomite/MS
+sodomize/GDS
+sodomy/M
+soever
+sofa/MS
+soft/NRYXTP
+softback
+softball/MS
+softbound
+softcover
+soften/DRZG
+softener/M
+softhearted
+softness/M
+software/M
+softwood/SM
+softy/SM
+soggily
+sogginess/M
+soggy/RTP
+soigne
+soignee
+soil/MDGS
+soiled/U
+soiree/SM
+sojourn/ZGMDRS
+sojourner/M
+sol/SM
+solace/DSMG
+solar
+solaria
+solarium/M
+sold
+solder/ZGSMDR
+solderer/M
+soldier/MDYSG
+soldiery/M
+sole/FSDGM
+solecism/SM
+solely
+solemn/PTRY
+solemness/M
+solemnify/DSG
+solemnity/SM
+solemnization/M
+solemnize/DSG
+solemnness/M
+solenoid/MS
+solicit/GDS
+solicitation/SM
+solicited/U
+solicitor/SM
+solicitous/PY
+solicitousness/M
+solicitude/M
+solid/PSMRYT
+solidarity/M
+solidi
+solidification/M
+solidify/DSNG
+solidity/M
+solidness/M
+solidus/M
+soliloquies
+soliloquize/DSG
+soliloquy/M
+solipsism/M
+solipsistic
+solitaire/MS
+solitariness/M
+solitary/SMP
+solitude/M
+solo/MDGS
+soloist/MS
+solstice/MS
+solubility/IM
+soluble/MS
+solute's
+solute/AXN
+solutes
+solution's/AE
+solvable/IU
+solve/EADSG
+solved/U
+solvency/IM
+solvent/IMS
+solver/SM
+somatic
+somatosensory
+somber/PY
+somberness/M
+sombrero/MS
+some
+somebody/SM
+someday
+somehow
+someone/MS
+someplace
+somersault/MDGS
+somerset/SM
+somersetted
+somersetting
+something/SM
+sometime/S
+someway/S
+somewhat/S
+somewhere
+somnambulism/M
+somnambulist/SM
+somnolence/M
+somnolent
+son/SM
+sonar/SM
+sonata/SM
+sonatina/SM
+song/MS
+songbird/SM
+songbook/SM
+songfest/SM
+songster/MS
+songstress/MS
+songwriter/SM
+songwriting
+sonic
+sonnet/SM
+sonny/SM
+sonogram/SM
+sonority/M
+sonorous/YP
+sonorousness/M
+sonsofbitches
+soon/RT
+soot/M
+sooth/MDRSZG
+soothe
+soother/M
+soothing/Y
+soothsayer/MS
+soothsaying/M
+sooty/RT
+sop/SM
+soph
+sophism/M
+sophist/MS
+sophistic
+sophistical
+sophisticate/DSMGN
+sophisticated/U
+sophistication/M
+sophistry/SM
+sophomore/MS
+sophomoric
+soporific/MS
+soporifically
+sopped
+sopping
+soppy/RT
+soprano/MS
+sorbet/SM
+sorcerer/MS
+sorceress/MS
+sorcery/M
+sordid/PY
+sordidness/M
+sore/MYTRSP
+sorehead/MS
+soreness/M
+sorghum/M
+sorority/SM
+sorrel/SM
+sorrily
+sorriness/M
+sorrow/SMDG
+sorrowful/YP
+sorrowfulness/M
+sorry/RTP
+sort/FASGDM
+sorta
+sorted/U
+sorter/SM
+sortie/DSM
+sortieing
+sot/SM
+sottish
+sou'wester
+sou/SMH
+souffle/SM
+sough/MDG
+soughs
+sought/U
+souk/S
+soul/MS
+soulful/YP
+soulfulness/M
+soulless/YP
+soulmate/SM
+sound/JPSMDRYZTG
+soundalike/S
+soundbar/S
+soundbite/S
+soundboard/MS
+soundcheck/S
+sounder/M
+sounding/M
+soundless/Y
+soundness/UM
+soundproof/GDS
+soundproofing/M
+soundscape/S
+soundtrack/SM
+soup/MDGS
+soupcon/MS
+soupy/RT
+sour/MDRYTGSP
+source/ADSMG
+sourdough/M
+sourdoughs
+sourish
+sourness/M
+sourpuss/MS
+sousaphone/MS
+souse/DSMG
+south/M
+southbound
+southeast/ZMR
+southeaster/MY
+southeastern
+southeastward/S
+southerly/SM
+southern/SZMR
+southerner/M
+southernmost
+southpaw/SM
+southward/MS
+southwest/ZMR
+southwester/MY
+southwestern
+southwestward/S
+souvenir/SM
+sovereign/SM
+sovereignty/M
+soviet/SM
+sow's
+sow/ASGD
+sower/SM
+sown/A
+soy/M
+soybean/MS
+sozzled
+spa/SM
+space/DRSMZG
+spacecraft/MS
+spaceflight/MS
+spaceman/M
+spacemen
+spaceport/SM
+spacer/M
+spaceship/SM
+spacesuit/SM
+spacetime
+spacewalk/SGMD
+spacewoman/M
+spacewomen
+spacey
+spacial
+spacier
+spaciest
+spaciness/M
+spacing/M
+spacious/YP
+spaciousness/M
+spade/DSMG
+spadeful/MS
+spadework/M
+spadices
+spadix/M
+spaghetti/M
+spake
+spam/MS
+spammed
+spammer/SM
+spamming
+span/MS
+spandex/M
+spangle/DSMG
+spangly
+spaniel/SM
+spank/SMDGJ
+spanking/M
+spanned
+spanner/SM
+spanning
+spar/MS
+spare/DRSMYTGP
+spareness/M
+spareribs/M
+sparing/UY
+spark/SMDYG
+sparkle/DRSMZG
+sparkler/M
+sparky/RT
+sparred
+sparring
+sparrow/SM
+sparrowhawk/S
+sparse/RYTP
+sparseness/M
+sparsity/M
+spartan
+spasm/SM
+spasmodic
+spasmodically
+spastic/SM
+spat/MS
+spate/SM
+spathe/SM
+spatial/Y
+spatted
+spatter/SGMD
+spatting
+spatula/SM
+spavin/MD
+spawn/SMDG
+spay/DGS
+speak/SRZGJ
+speakeasy/SM
+speaker/M
+speakerphone/S
+spear/SMDG
+spearfish/GMDS
+speargun
+spearhead/GMDS
+spearmint/M
+spec/MS
+special/SMY
+specialism/S
+specialist/MS
+specialization/MS
+specialize/GDS
+specialty/SM
+specie/SM
+species/M
+specif
+specifiable
+specific/MS
+specifically
+specification/M
+specificity/M
+specified/U
+specify/XNZDRSG
+specimen/SM
+specious/YP
+speciousness/M
+speck/SMDG
+speckle/MGDS
+specs/M
+spectacle/SM
+spectacles/M
+spectacular/MYS
+spectate/DSG
+spectator/SM
+specter/AMS
+spectra
+spectral
+spectrometer/MS
+spectroscope/MS
+spectroscopic
+spectroscopy/M
+spectrum/M
+speculate/DSXGNV
+speculation/M
+speculative/Y
+speculator/MS
+sped
+speech/MS
+speechify/DSG
+speechless/YP
+speechlessness/M
+speechwriter/S
+speed/SMRZG
+speedboat/SM
+speeder/M
+speedily
+speediness/M
+speeding/M
+speedometer/MS
+speedster/SM
+speedup/MS
+speedway/SM
+speedwell/M
+speedy/TPR
+speleological
+speleologist/MS
+speleology/M
+spell/JSMDRZG
+spellbind/ZGRS
+spellbinder/M
+spellbound
+spellcheck/MDRZGS
+spellchecker/M
+spelldown/SM
+speller/M
+spelling/M
+spelunker/MS
+spelunking/M
+spend/BSRZG
+spender/M
+spending/M
+spendthrift/MS
+spent/U
+sperm/SM
+spermatozoa
+spermatozoon/M
+spermicidal
+spermicide/MS
+spew/MDRZGS
+spewer/M
+sphagnum/MS
+sphere/SM
+spherical/Y
+spheroid/SM
+spheroidal
+sphincter/MS
+sphinx/MS
+spic/S
+spice/DSMG
+spicily
+spiciness/M
+spicule/MS
+spicy/PRT
+spider/SM
+spiderweb/MS
+spidery
+spiel/SMDG
+spiff/SDG
+spiffy/TR
+spigot/SM
+spike/DSMG
+spikiness/M
+spiky/RPT
+spill/SMDG
+spillage/MS
+spillover/SM
+spillway/MS
+spin/MS
+spinach/M
+spinal/SMY
+spindle/MGDS
+spindly/TR
+spine/SM
+spineless/YP
+spinet/SM
+spinless
+spinnaker/SM
+spinner/MS
+spinneret/SM
+spinney/S
+spinning/M
+spinster/SM
+spinsterhood/M
+spinsterish
+spiny/RT
+spiracle/SM
+spiral/SGMDY
+spire's
+spire/IFAS
+spirea/SM
+spirit's
+spirit/ISGD
+spirited/Y
+spiritless
+spiritual/MYS
+spiritualism/M
+spiritualist/MS
+spiritualistic
+spirituality/M
+spirituous
+spirochete/SM
+spiry
+spit/MDGS
+spitball/SM
+spite/ASM
+spiteful/PY
+spitefuller
+spitefullest
+spitefulness/M
+spitfire/SM
+spitted
+spitting
+spittle/M
+spittoon/MS
+spiv/S
+splanchnic
+splash/GMDS
+splashdown/MS
+splashily
+splashiness/M
+splashy/RTP
+splat/SM
+splatted
+splatter/GSMD
+splatting
+splay/SMDG
+splayfeet
+splayfoot/MD
+spleen/SM
+splendid/RYT
+splendor/MS
+splendorous
+splenectomy
+splenetic
+splice/DRSMZG
+splicer/M
+spliff/S
+spline/S
+splint/SZGMDR
+splinter/MDG
+splintery
+split/SM
+splitting/MS
+splodge/S
+splosh/DSG
+splotch/MDSG
+splotchy/TR
+splurge/DSMG
+splutter/GMDS
+spoil's
+spoil/CSDRZG
+spoilage/M
+spoiled/U
+spoiler/CM
+spoilsport/MS
+spoke/SM
+spoken/U
+spokesman/M
+spokesmen
+spokespeople
+spokesperson/MS
+spokeswoman/M
+spokeswomen
+spoliation/CM
+sponge/DRSMZG
+sponger/M
+sponginess/M
+spongy/RPT
+sponsor/MDGS
+sponsorship/M
+spontaneity/M
+spontaneous/Y
+spoof/SMDG
+spook/SMDG
+spookiness/M
+spooky/RPT
+spool/SMDG
+spoon/SMDG
+spoonbill/MS
+spoonerism/MS
+spoonful/SM
+spoor/SMDG
+sporadic
+sporadically
+spore/DSMG
+sporran/S
+sport/SMDGV
+sportiness/M
+sporting/Y
+sportive/Y
+sportscast/MRZGS
+sportscaster/M
+sportsman/M
+sportsmanlike/U
+sportsmanship/M
+sportsmen
+sportspeople
+sportsperson
+sportswear/M
+sportswoman/M
+sportswomen
+sportswriter/SM
+sporty/TPR
+spot/CMS
+spotless/PY
+spotlessness/M
+spotlight/GSMD
+spotlit
+spotted
+spotter/MS
+spottily
+spottiness/M
+spotting
+spotty/TPR
+spousal/MS
+spouse/SM
+spout/SMDG
+sprain/GSMD
+sprang
+sprat/SM
+sprawl/GSMD
+spray's
+spray/ASDG
+sprayer/MS
+spread/ZGBSMR
+spreadeagled
+spreader/M
+spreadsheet/MS
+spree/DSM
+spreeing
+sprig/SM
+sprigged
+sprightliness/M
+sprightly/RTP
+spring/GSM
+springboard/MS
+springbok/MS
+springily
+springiness/M
+springlike
+springtime/M
+springy/RPT
+sprinkle/DRSJMZG
+sprinkler/M
+sprinkling/M
+sprint/ZGSMDR
+sprinter/M
+sprite/SM
+spritz/ZGMDRS
+spritzer/M
+sprocket/MS
+sprog/S
+sprout/GSMD
+spruce/DRSPMYTG
+spruceness/M
+sprung
+spry/RYT
+spryness/M
+spud/MS
+spume/DSMG
+spumoni/M
+spumy
+spun
+spunk/SM
+spunky/TR
+spur/MS
+spurge/M
+spurious/PY
+spuriousness/M
+spurn/SDG
+spurred
+spurring
+spurt/SMDG
+sputa
+sputnik/MS
+sputter/MDGS
+sputum/M
+spy/GDSM
+spyglass/MS
+spymaster/S
+spyware/M
+sq
+sqq
+squab/SM
+squabble/MZGDRS
+squabbler/M
+squad/SM
+squadron/MS
+squalid/PTRY
+squalidness/M
+squall/SGMD
+squally
+squalor/M
+squamous
+squander/GDS
+square/PDRSMYTG
+squareness/M
+squarish
+squash/GMDS
+squashy/TR
+squat/SMP
+squatness/M
+squatted
+squatter/MS
+squattest
+squatting
+squaw/SM
+squawk/SZGMDR
+squawker/M
+squeak/SZGMDR
+squeaker/M
+squeakily
+squeakiness/M
+squeaky/TRP
+squeal/SZGMDR
+squealer/M
+squeamish/PY
+squeamishness/M
+squeegee/MDS
+squeegeeing
+squeeze/BMZGDRS
+squeezebox/S
+squeezer/M
+squelch/GMDS
+squelchy
+squib/SM
+squid/SM
+squidgy
+squiffy
+squiggle/DSMG
+squiggly
+squint/STGMDR
+squire/DSMG
+squirm/SGMD
+squirmy/RT
+squirrel/SGMD
+squirt/SGMD
+squish/GMDS
+squishy/RT
+sriracha
+ssh
+st
+stab/MYS
+stabbed
+stabber/MS
+stabbing/MS
+stability/IM
+stabilization/CM
+stabilize/CDSG
+stabilizer/MS
+stable/DRSMTG
+stableman/M
+stablemate/S
+stablemen
+stably/U
+staccato/MS
+stack/SMDG
+stadium/MS
+staff's
+staff/ASDG
+staffer/MS
+staffing/M
+stag/MDGSJ
+stage/SM
+stagecoach/MS
+stagecraft/M
+stagehand/MS
+stagestruck
+stagflation/M
+stagger/MDGS
+staggering/Y
+staging/M
+stagnancy/M
+stagnant/Y
+stagnate/DSGN
+stagnation/M
+stagy/RT
+staid/PRYT
+staidness/M
+stain/SMDG
+stained/U
+stainless/M
+stair/SM
+staircase/MS
+stairway/MS
+stairwell/SM
+stake/DSMG
+stakeholder/MS
+stakeout/SM
+stalactite/MS
+stalagmite/MS
+stale/DRSTGP
+stalemate/DSMG
+staleness/M
+stalk/SMDRJZG
+stalker/M
+stalking/M
+stall's
+stall/SDG
+stallholder/S
+stallion/MS
+stalwart/MYS
+stamen/SM
+stamina/M
+stammer/ZGMDRS
+stammerer/M
+stammering/Y
+stamp/SMDRZG
+stampede/MGDS
+stamper/M
+stance/ISM
+stanch/TGDRS
+stanchion/SM
+stand/SMRJZG
+standalone
+standard/MS
+standardization/M
+standardize/DSG
+standby/M
+standbys
+standee/MS
+stander/M
+standing/M
+standoff/MS
+standoffish
+standout/MS
+standpipe/SM
+standpoint/MS
+standstill/MS
+stank
+stanza/SM
+staph/M
+staphylococcal
+staphylococci
+staphylococcus/M
+staple/DRSMZG
+stapler/M
+star/MDRZGS
+starboard/M
+starburst/S
+starch/GMDS
+starchily
+starchiness/M
+starchy/PTR
+stardom/M
+stardust/M
+stare/SM
+starer/M
+starfish/MS
+starfruit
+stargaze/DRSZG
+stargazer/M
+stark/RYPZT
+starkness/M
+starless
+starlet/MS
+starlight/M
+starling/SM
+starlit
+starred
+starring
+starry/TR
+starstruck
+start/ASMDG
+starter/MS
+startle/GDS
+startling/Y
+startup/MS
+starvation/M
+starve/DSJG
+starveling/MS
+stash/MDSG
+stasis
+stat/MS
+state/DRSMYGNLX
+statecraft/M
+stated/U
+statehood/M
+statehouse/MS
+stateless/P
+statelessness/M
+stateliness/M
+stately/PRT
+statement/AMS
+statemented
+statementing
+stateroom/MS
+stateside
+statesman/M
+statesmanlike
+statesmanship/M
+statesmen
+stateswoman/M
+stateswomen
+statewide
+static/SM
+statically
+station/MDRZG
+stationary
+stationer/M
+stationery/M
+stationmaster/S
+statistic/MS
+statistical/Y
+statistician/SM
+statuary/M
+statue/SM
+statuesque
+statuette/MS
+stature/MS
+status/MS
+statute/MS
+statutorily
+statutory
+staunch/PDRSYTG
+staunchness/M
+stave/DSMG
+stay/MDRZGS
+std
+stdio
+stead/SM
+steadfast/YP
+steadfastness/M
+steadily/U
+steadiness/UM
+steady/TGPDRSM
+steak/SM
+steakhouse/SM
+steal/SMHG
+stealth/M
+stealthily
+stealthiness/M
+stealthy/TPR
+steam/SMDRZG
+steamboat/MS
+steamer/M
+steamfitter/SM
+steamfitting/M
+steaminess/M
+steampunk
+steamroll/ZGDRS
+steamroller/MDG
+steamship/MS
+steamy/TPR
+steed/SM
+steel/SMDG
+steeliness/M
+steelmaker/S
+steelworker/SM
+steelworks/M
+steely/PTR
+steelyard/SM
+steep/SMDNRYPXTG
+steepen/GD
+steeple/MS
+steeplechase/MS
+steeplejack/SM
+steepness/M
+steer/SMDBG
+steerage/M
+steering/M
+steersman/M
+steersmen
+stegosauri
+stegosaurus/MS
+stein/SM
+stellar
+stem/MS
+stemless
+stemmed
+stemming
+stemware/M
+stench/MS
+stencil/GMDS
+steno/SM
+stenographer/SM
+stenographic
+stenography/M
+stenosis
+stent/SM
+stentorian
+step/IMS
+stepbrother/SM
+stepchild/M
+stepchildren/M
+stepdad/MS
+stepdaughter/SM
+stepfather/SM
+stepladder/MS
+stepmom/MS
+stepmother/SM
+stepparent/SM
+steppe/DRSMZG
+stepper/M
+steppingstone/SM
+stepsister/MS
+stepson/MS
+stereo/SM
+stereophonic
+stereoscope/MS
+stereoscopic
+stereotype/DSMG
+stereotypical
+sterile
+sterility/M
+sterilization/SM
+sterilize/DRSZG
+sterilizer/M
+sterling/M
+stern/SMRYPT
+sternness/M
+sternum/MS
+steroid/MS
+steroidal
+stertorous
+stet/S
+stethoscope/MS
+stetson/MS
+stetted
+stetting
+stevedore/SM
+stew/MDGS
+steward/GMDS
+stewardess/MS
+stewardship/M
+stick/SMRZG
+sticker/M
+stickily
+stickiness/M
+stickleback/SM
+stickler/MS
+stickpin/MS
+stickup/MS
+sticky/PTRSM
+stiff/SMDNRYPXTG
+stiffen/ZGDR
+stiffener/M
+stiffening/M
+stiffness/M
+stifle/DSJG
+stifling/Y
+stigma/SM
+stigmata
+stigmatic
+stigmatization/M
+stigmatize/GDS
+stile/SM
+stiletto/SM
+still's
+still/ITGSD
+stillbirth/M
+stillbirths
+stillborn
+stiller
+stillness/M
+stilt/SMD
+stilted/Y
+stimulant/SM
+stimulate/DSGNV
+stimulation/M
+stimuli
+stimulus/M
+sting/ZGSMR
+stinger/M
+stingily
+stinginess/M
+stingray/SM
+stingy/RTP
+stink/ZGSMR
+stinkbug/SM
+stinker/M
+stinky/RT
+stint/GSMD
+stipend/SM
+stipendiary/S
+stipple/DSMG
+stippling/M
+stipulate/XDSGN
+stipulation/M
+stir/MS
+stirred
+stirrer/SM
+stirring/SY
+stirrup/SM
+stitch's
+stitch/ADSG
+stitchery/M
+stitching/M
+stoat/SM
+stochastic
+stock's
+stock/AGSD
+stockade/DSMG
+stockbreeder/MS
+stockbroker/SM
+stockbroking/M
+stockholder/SM
+stockily
+stockiness/M
+stockinette/M
+stocking/SM
+stockist/S
+stockpile/MGDS
+stockpot/SM
+stockroom/MS
+stocktaking/M
+stocky/RTP
+stockyard/MS
+stodge
+stodgily
+stodginess/M
+stodgy/RTP
+stogie/MS
+stoic/SM
+stoical/Y
+stoicism/M
+stoke/DRSZG
+stoker/M
+stole/SM
+stolen
+stolid/RYTP
+stolidity/M
+stolidness/M
+stolon/MS
+stomach/MDRZG
+stomachache/SM
+stomacher/M
+stomachs
+stomp/GSMD
+stone/DRSMZG
+stonemason/MS
+stoner/M
+stonewall/GSD
+stoneware/M
+stonewashed
+stonework/M
+stonily
+stoniness/M
+stonkered
+stonking
+stony/TRP
+stood
+stooge/MS
+stool/SM
+stoop/GSMD
+stop's
+stop/US
+stopcock/SM
+stopgap/SM
+stoplight/MS
+stopover/MS
+stoppable/U
+stoppage/MS
+stopped/U
+stopper/GSMD
+stopping/U
+stopple/DSMG
+stopwatch/MS
+storage/M
+store's
+store/ADSG
+storefront/MS
+storehouse/MS
+storekeeper/SM
+storeroom/SM
+stork/SM
+storm/GSMD
+stormily
+storminess/M
+stormy/RPT
+story/DSM
+storyboard/MS
+storybook/SM
+storyteller/MS
+storytelling/M
+stoup/SM
+stout/TSMRYP
+stouthearted
+stoutness/M
+stove/SM
+stovepipe/SM
+stow/DGS
+stowage/M
+stowaway/MS
+straddle/DRSMZG
+straddler/M
+strafe/MGDS
+straggle/DRSZG
+straggler/M
+straggly/TR
+straight/SPXTMNRY
+straightaway/SM
+straightedge/SM
+straighten/ZGDR
+straightener/M
+straightforward/YPS
+straightforwardness/M
+straightness/M
+straightway
+strain's
+strain/FADSG
+strainer/ASM
+strait/MNSX
+straiten/GD
+straitjacket/SGMD
+straitlaced
+strand/MDSG
+strange/PRYZT
+strangeness/M
+stranger/M
+strangle/ZGDRS
+stranglehold/SM
+strangler/M
+strangulate/GNDS
+strangulation/M
+strap's
+strap/US
+strapless/MS
+strapped/U
+strapping/M
+strata
+stratagem/SM
+strategic/S
+strategical/Y
+strategics/M
+strategist/SM
+strategy/SM
+strati
+stratification/M
+stratify/DSGN
+stratosphere/SM
+stratospheric
+stratum/M
+stratus/M
+straw/GSMD
+strawberry/SM
+stray/GSMD
+streak/MDRSZG
+streaker/M
+streaky/TR
+stream/MDRSZG
+streamer/M
+streamline/DSG
+street/MS
+streetcar/MS
+streetlamp/S
+streetlight/SM
+streetwalker/SM
+streetwise
+strength/M
+strengthen/AGDS
+strengthener/MS
+strengths
+strenuous/PY
+strenuousness/M
+strep/M
+streptococcal
+streptococci
+streptococcus/M
+streptomycin/M
+stress/MDSG
+stressed/U
+stressful
+stressors
+stretch/BZGMDRS
+stretcher/MDG
+stretchmarks
+stretchy/TR
+strew/GSDH
+strewn
+stria/M
+striae
+striated
+striation/MS
+stricken
+strict/RYPT
+strictness/M
+stricture/SM
+stridden
+stride/MGS
+stridency/M
+strident/Y
+strife/M
+strike/MZGRSJ
+strikebound
+strikebreaker/SM
+strikebreaking
+strikeout/MS
+striker/M
+striking/Y
+string/MDRSZG
+stringency/M
+stringent/Y
+stringer/M
+stringiness/M
+stringy/PTR
+strip/GSMD
+stripe/MS
+stripey
+stripling/MS
+stripped
+stripper/MS
+stripping
+striptease/MZGDRS
+stripteaser/M
+stripy
+strive/GS
+striven
+strobe/MS
+stroboscope/MS
+stroboscopic
+strode
+stroke/MGDS
+stroll/MDRSZG
+stroller/M
+strong/RYT
+strongbox/MS
+stronghold/MS
+strongman/M
+strongmen
+strongroom/S
+strontium/M
+strop/SM
+strophe/SM
+strophic
+stropped
+stroppily
+stropping
+stroppy/TRP
+strove
+struck
+structural/Y
+structuralism
+structuralist/S
+structure's
+structure/AGDS
+structured/U
+strudel/SM
+struggle/MGDS
+strum/SM
+strummed
+strumming
+strumpet/MS
+strung/UA
+strut/SM
+strutted
+strutting
+strychnine/M
+stub/MS
+stubbed
+stubbing
+stubble/M
+stubbly
+stubborn/RYPT
+stubbornness/M
+stubby/RT
+stucco/MDG
+stuccoes
+stuck/U
+stud/MYS
+studbook/MS
+studded
+studding/M
+student/SM
+studentship/S
+studied/U
+studiedly
+studio/MS
+studious/PY
+studiousness/M
+studly/RT
+study's
+study/AGDS
+stuff/GSMDJ
+stuffily
+stuffiness/M
+stuffing/M
+stuffy/RPT
+stultification/M
+stultify/DSNG
+stumble/DRSMZG
+stumbler/M
+stump/GSMD
+stumpy/TR
+stun/S
+stung
+stunk
+stunned
+stunner/S
+stunning/Y
+stunt/GSMD
+stuntman
+stuntmen
+stupefaction/M
+stupefy/DSG
+stupendous/Y
+stupid/TMRYS
+stupidity/SM
+stupor/MS
+sturdily
+sturdiness/M
+sturdy/TRP
+sturgeon/SM
+stutter/MDRSZG
+stutterer/M
+sty/SM
+style's
+style/ADSG
+styli
+stylish/PY
+stylishness/M
+stylist/SM
+stylistic/S
+stylistically
+stylize/DSG
+stylus/MS
+stymie/MDS
+stymieing
+styptic/SM
+suasion/EM
+suave/RYTP
+suaveness/M
+suavity/M
+sub/SM
+subaltern/MS
+subaqua
+subarctic
+subarea/MS
+subatomic
+subbasement/SM
+subbed
+subbing
+subbranch/MS
+subcategory/SM
+subclass
+subcommittee/SM
+subcompact/SM
+subconscious/PMY
+subconsciousness/M
+subcontinent/SM
+subcontinental
+subcontract/MDSG
+subcontractor/MS
+subculture/MS
+subcutaneous/Y
+subdivide/GDS
+subdivision/SM
+subdomain/MS
+subdominant
+subdue/DSG
+subeditor/S
+subfamily/SM
+subfreezing
+subgroup/MS
+subhead/GJMS
+subheading/M
+subhuman/MS
+subj
+subject/GVMDS
+subjection/M
+subjective/Y
+subjectivity/M
+subjoin/GDS
+subjugate/GNDS
+subjugation/M
+subjunctive/SM
+sublease/MGDS
+sublet/SM
+subletting
+sublieutenant/S
+sublimate/GNDS
+sublimation/M
+sublime/YTGDRS
+subliminal/Y
+sublimity/M
+sublingual
+submarginal
+submarine/MZRS
+submariner/M
+submerge/GDS
+submergence/M
+submerse/GNDS
+submersible/MS
+submersion/M
+submicroscopic
+submission/MS
+submissive/PY
+submissiveness/M
+submit/AS
+submitted/A
+submitter
+submitting/A
+subnormal
+suborbital
+suborder/MS
+subordinate/DSMGN
+subordination/IM
+suborn/SGD
+subornation/M
+subpar
+subparagraph
+subpart
+subplot/MS
+subpoena/GMDS
+subprime
+subprofessional/SM
+subprogram/S
+subroutine/SM
+subscribe/UASDG
+subscriber/MS
+subscript/MS
+subscription/MS
+subsection/MS
+subsequent/Y
+subservience/M
+subservient/Y
+subset/SM
+subside/GDS
+subsidence/M
+subsidiarity
+subsidiary/SM
+subsidization/M
+subsidize/ZGDRS
+subsidizer/M
+subsidy/SM
+subsist/SDG
+subsistence/M
+subsoil/M
+subsonic
+subspace
+subspecies/M
+substance/SM
+substandard
+substantial/IY
+substantiate/GNDSX
+substantiated/U
+substantiation/FM
+substantive/SMY
+substation/MS
+substituent
+substitute/XMGNDS
+substitution/M
+substrata
+substrate/MS
+substratum/M
+substructure/SM
+subsume/DSG
+subsumption
+subsurface/M
+subsystem/SM
+subteen/SM
+subtenancy/M
+subtenant/SM
+subtend/SDG
+subterfuge/SM
+subterranean
+subtext/SM
+subtitle/DSMG
+subtle/TR
+subtlety/SM
+subtly
+subtopic/SM
+subtotal/SGMD
+subtract/GSD
+subtraction/SM
+subtrahend/SM
+subtropic/S
+subtropical
+subtropics/M
+suburb/MS
+suburban/SM
+suburbanite/SM
+suburbia/M
+subvention/SM
+subversion/M
+subversive/SPMY
+subversiveness/M
+subvert/SDG
+subway/MS
+subzero
+succeed/GDS
+success/VMS
+successful/UY
+succession/SM
+successive/Y
+successor/SM
+succinct/RYTP
+succinctness/M
+succor/SGMD
+succotash/M
+succubi
+succubus
+succulence/M
+succulency/M
+succulent/SM
+succumb/GDS
+such
+suchlike
+suck/MDRZGS
+sucker/GMD
+suckle/DSJG
+suckling/M
+sucrose/M
+suction/SMDG
+sudden/PY
+suddenness/M
+suds/M
+sudsy/TR
+sue/DSG
+suede/M
+suet/M
+suety
+suffer/DRZGSJ
+sufferance/M
+sufferer/M
+suffering/M
+suffice/DSG
+sufficiency/IM
+sufficient/IY
+suffix/MDSG
+suffixation/M
+suffocate/GNDS
+suffocation/M
+suffragan/MS
+suffrage/M
+suffragette/SM
+suffragist/MS
+suffuse/DSGN
+suffusion/M
+sugar/GSMD
+sugarcane/M
+sugarcoat/GDS
+sugarless
+sugarplum/MS
+sugary/RT
+suggest/GVSDR
+suggestibility/M
+suggestible
+suggestion/SM
+suggestive/YP
+suggestiveness/M
+suicidal
+suicide/SM
+suit/BMDGS
+suitability/UM
+suitableness/M
+suitably/U
+suitcase/SM
+suite/SM
+suited/U
+suiting/M
+suitor/MS
+sukiyaki/M
+sulfa/M
+sulfate/SM
+sulfide/SM
+sulfonamides
+sulfur/MDSG
+sulfuric
+sulfurous
+sulk/MDGS
+sulkily
+sulkiness/M
+sulky/TRSMP
+sullen/RYPT
+sullenness/M
+sullied/U
+sully/GDS
+sultan/MS
+sultana/SM
+sultanate/MS
+sultrily
+sultriness/M
+sultry/RPT
+sum/SM
+sumac/M
+summarily
+summarize/GDS
+summary/SM
+summat
+summation/FMS
+summed
+summer/MDSG
+summerhouse/SM
+summertime/M
+summery
+summing
+summit/MS
+summitry/M
+summon/DRSZG
+summoner/M
+summons/GMDS
+sumo/M
+sump/MS
+sumptuous/PY
+sumptuousness/M
+sun/SM
+sunbath/ZGMDRS
+sunbathe
+sunbather/M
+sunbathing/M
+sunbaths
+sunbeam/SM
+sunbed/S
+sunbelt/SM
+sunblock/MS
+sunbonnet/SM
+sunburn/SGMD
+sunburst/MS
+sundae/MS
+sundeck/S
+sunder/DSG
+sundial/SM
+sundown/SM
+sundress/S
+sundries/M
+sundry/S
+sunfish/MS
+sunflower/MS
+sung/U
+sunglasses/M
+sunhat/S
+sunk/N
+sunlamp/SM
+sunless
+sunlight/M
+sunlit
+sunned
+sunniness/M
+sunning
+sunny/TRP
+sunrise/SM
+sunroof/SM
+sunscreen/MS
+sunset/MS
+sunshade/MS
+sunshine/M
+sunshiny
+sunspot/SM
+sunstroke/M
+suntan/MS
+suntanned
+suntanning
+suntrap/S
+sunup/M
+sup/SZMR
+super/M
+superabundance/MS
+superabundant
+superannuate/GNDS
+superannuation/M
+superb/RYT
+supercargo/M
+supercargoes
+supercharge/ZGDRS
+supercharger/M
+supercilious/PY
+superciliousness/M
+supercity/SM
+supercomputer/MS
+superconducting
+superconductive
+superconductivity/M
+superconductor/SM
+supercritical
+superego/MS
+supererogation/M
+supererogatory
+superficial/Y
+superficiality/M
+superfine
+superfluity/M
+superfluous/YP
+superfluousness/M
+superglue
+supergrass/S
+superhero/MS
+superheroes
+superhighway/SM
+superhuman
+superimpose/GDS
+superimposition/M
+superintend/DSG
+superintendence/M
+superintendency/M
+superintendent/SM
+superior/MS
+superiority/M
+superlative/SMY
+superman/M
+supermarket/SM
+supermassive
+supermen
+supermodel/SM
+supermom/MS
+supernal
+supernatural/SY
+supernova/MS
+supernovae
+supernumerary/SM
+superpose/GDS
+superposition/M
+superpower/SM
+supersaturate/GNDS
+supersaturation/M
+superscribe/GDS
+superscript/MS
+superscription/M
+supersede/GDS
+supersize/GDS
+supersonic
+superspreader/SM
+superstar/MS
+superstardom
+superstate/S
+superstition/MS
+superstitious/Y
+superstore/MS
+superstructure/MS
+supertanker/MS
+superuser/S
+supervene/GDS
+supervention/M
+supervise/XGNDS
+supervised/U
+supervision/M
+supervisor/MS
+supervisory
+superwoman/M
+superwomen
+supine/Y
+supp/DRZG
+supper/M
+suppertime
+suppl
+supplant/SDG
+supple/TLPR
+supplement/MDGS
+supplemental
+supplementary
+supplementation/M
+suppleness/M
+suppliant/SM
+supplicant/MS
+supplicate/GDS
+supplication/M
+supplier/M
+supply/ZGDRSMXN
+support/MDRSBZGV
+supportable/UI
+supported/U
+supporter/M
+suppose/GDS
+supposed/Y
+supposition/MS
+suppository/SM
+suppress/GVDS
+suppressant/MS
+suppressible
+suppression/M
+suppressor/SM
+suppurate/DSGN
+suppuration/M
+supra
+supranational
+supremacist/MS
+supremacy/M
+supreme/Y
+supremo/S
+supt
+surcease/DSMG
+surcharge/DSMG
+surcingle/SM
+sure/PYTR
+surefire
+surefooted
+sureness/M
+surety/SM
+surf/MDRZGS
+surface's
+surface/AGDS
+surfboard/MDSG
+surfeit/MDSG
+surfer/M
+surfing/M
+surge/DSMG
+surgeon/MS
+surgery/SM
+surgical/Y
+surliness/M
+surly/PTR
+surmise/MGDS
+surmount/DGSB
+surmountable/I
+surname/MS
+surpass/GDS
+surpassed/U
+surplice/MS
+surplus/MS
+surplussed
+surplussing
+surprise/DSMGJ
+surprising/UY
+surreal
+surrealism/M
+surrealist/SM
+surrealistic
+surrealistically
+surrender/MDSG
+surreptitious/PY
+surreptitiousness/M
+surrey/MS
+surrogacy/M
+surrogate/SM
+surround/GSDJ
+surrounding/M
+surroundings/M
+surtax/MDSG
+surtitle/S
+surveillance/M
+survey's
+survey/ADGS
+surveying/M
+surveyor/SM
+survival/SM
+survivalist/SM
+survive/DSGB
+survivor/SM
+susceptibility/SM
+susceptible/I
+sushi/M
+suspect/SMDG
+suspected/U
+suspend/SDRZG
+suspender/M
+suspense/XMN
+suspenseful
+suspension/M
+suspicion/SM
+suspicious/Y
+suss/DSG
+sustain/SDBG
+sustainability
+sustainable/U
+sustainably
+sustenance/M
+sutler/MS
+suttee
+suture/MGDS
+suzerain/MS
+suzerainty/M
+svelte/TR
+swab/MS
+swabbed
+swabbing
+swaddle/DSG
+swag/MS
+swagged
+swagger/SMDRG
+swagging
+swain/SM
+swallow/GSMD
+swallowtail/MS
+swam
+swami/SM
+swamp/GSMD
+swampland/M
+swampy/RT
+swan/MS
+swank/TGSMDR
+swankily
+swankiness/M
+swanky/RPT
+swanned
+swanning
+swansong/S
+swap/MS
+swapped
+swapping
+sward/SM
+swarm/GSMD
+swarthy/TR
+swash/GMDS
+swashbuckler/SM
+swashbuckling/M
+swastika/SM
+swat/MS
+swatch/MS
+swath/GMDS
+swathe/M
+swaths
+swatted
+swatter/SMDG
+swatting
+sway/MDGS
+swayback/MD
+swayed/U
+swear/ZGSR
+swearer/M
+swearword/MS
+sweat/ZGSMDR
+sweatband/MS
+sweater/M
+sweatpants/M
+sweats/M
+sweatshirt/SM
+sweatshop/MS
+sweatsuit/S
+sweaty/RT
+swede/SM
+sweep/ZGSMRJ
+sweeper/M
+sweeping/MY
+sweepings/M
+sweepstakes/M
+sweet/XTSMNRYP
+sweetbread/SM
+sweetbrier/SM
+sweetcorn
+sweetened/U
+sweetener/MS
+sweetening/M
+sweetheart/SM
+sweetie/SM
+sweetish
+sweetmeat/MS
+sweetness/M
+swell/TGSMDRJ
+swellhead/MDS
+swelling/M
+swelter/SGMD
+swept
+sweptback
+swerve/MGDS
+swerving/U
+swift/PTSMRY
+swiftness/M
+swig/MS
+swigged
+swigging
+swill/GSMD
+swim/MS
+swimmer/SM
+swimming/MY
+swimsuit/SM
+swimwear
+swindle/DRSMZG
+swindler/M
+swine/SM
+swineherd/SM
+swing/ZGSMR
+swingeing
+swinger/M
+swinish
+swipe/DSMG
+swirl/GSMD
+swirly
+swish/TGMDRS
+switch/MDRSZGB
+switchback/MS
+switchblade/SM
+switchboard/SM
+switcher/M
+switchover
+swivel/MDGS
+swiz
+swizz
+swizzle/DSG
+swollen
+swoon/SGMD
+swoop/SGMD
+swoosh/MDSG
+sword/SM
+swordfish/MS
+swordplay/M
+swordsman/M
+swordsmanship/M
+swordsmen
+swore
+sworn
+swot/S
+swotted
+swotting
+swum
+swung
+sybarite/SM
+sybaritic
+sycamore/MS
+sycophancy/M
+sycophant/SM
+sycophantic
+syllabic
+syllabicate/GNDS
+syllabication/M
+syllabification/M
+syllabify/DSNG
+syllable/MS
+syllabub/S
+syllabus/MS
+syllogism/MS
+syllogistic
+sylph/M
+sylphic
+sylphlike
+sylphs
+sylvan
+symbioses
+symbiosis/M
+symbiotic
+symbiotically
+symbol/MS
+symbolic
+symbolical/Y
+symbolism/M
+symbolization/M
+symbolize/DSG
+symbology
+symmetric
+symmetrical/Y
+symmetry/SM
+sympathetic/U
+sympathetically/U
+sympathies/M
+sympathize/ZGDRS
+sympathizer/M
+sympathy/SM
+symphonic
+symphony/SM
+symposium/MS
+symptom/MS
+symptomatic
+symptomatically
+syn/H
+synagogal
+synagogue/SM
+synapse/MS
+synaptic
+sync/MDSG
+synchronicity
+synchronization/SM
+synchronize/GDS
+synchronous/Y
+synchrony
+syncopate/DSGN
+syncopation/M
+syncope/M
+syndicalism
+syndicalist/S
+syndicate/DSMGN
+syndication/M
+syndrome/SM
+synergism/M
+synergistic
+synergy/SM
+synfuel/MS
+synod/SM
+synonym/SM
+synonymous
+synonymy/M
+synopses
+synopsis/M
+synoptic
+synovial
+syntactic
+syntactical/Y
+syntax/M
+syntheses
+synthesis/M
+synthesize/ZGDRS
+synthesizer/M
+synthetic/SM
+synthetically
+synths
+syphilis/M
+syphilitic/SM
+syringe/DSMG
+syrup/SM
+syrupy
+sysadmin/S
+sysop/S
+system/SM
+systematic/U
+systematical/Y
+systematization/M
+systematize/GDS
+systemic/MS
+systemically
+systole/SM
+systolic
+t/SDNXGBJ
+ta
+tab/SM
+tabbed
+tabbing
+tabbouleh/M
+tabby/SM
+tabernacle/SM
+tabla/MS
+table/MGDS
+tableau/M
+tableaux
+tablecloth/M
+tablecloths
+tableland/SM
+tablespoon/SM
+tablespoonful/SM
+tablet/SM
+tabletop/MS
+tableware/M
+tabloid/SM
+taboo/MDSG
+tabor/MS
+tabular
+tabulate/DSGNX
+tabulation/M
+tabulator/SM
+tachograph
+tachographs
+tachometer/SM
+tachycardia/M
+tachyon
+tacit/PY
+tacitness/M
+taciturn/Y
+taciturnity/M
+tack/ZGMDRS
+tacker/M
+tackiness/M
+tackle/DRSMZG
+tackler/M
+tacky/RTP
+taco/MS
+tact/FM
+tactful/YP
+tactfulness/M
+tactic/SM
+tactical/Y
+tactician/MS
+tactile
+tactility/M
+tactless/PY
+tactlessness/M
+tad/SM
+tadpole/MS
+taffeta/M
+taffrail/SM
+taffy/SM
+tag/SM
+tagged
+tagger/SM
+tagging
+tagliatelle
+tagline/MS
+taiga/MS
+tail/ACSDMG
+tailback/MS
+tailboard/S
+tailbone/S
+tailcoat/MS
+tailgate/MZGDRS
+tailgater/M
+tailless
+taillight/MS
+tailor/SGMD
+tailoring/M
+tailpiece/S
+tailpipe/SM
+tailspin/SM
+tailwind/SM
+taint/MDSG
+tainted/U
+take/AIMS
+takeaway/S
+taken/A
+takeoff/MS
+takeout/MS
+takeover/SM
+taker/MS
+taking/SM
+takings/M
+talc/M
+talcum/M
+tale/MS
+talebearer/MS
+talent/SMD
+talented/U
+tali
+talisman/MS
+talk/ZGMDRS
+talkative/PY
+talkativeness/M
+talker/M
+talkie/RSMT
+talky
+tall/TRP
+tallboy/MS
+tallier/M
+tallish
+tallness/M
+tallow/M
+tallowy
+tally/DRSMZG
+tallyho/MDGS
+talon/MS
+talus/MS
+tam/SM
+tamale/SM
+tamarack/MS
+tamarind/MS
+tambourine/MS
+tame/BYZTGDRSP
+tamed/U
+tameness/M
+tamer/M
+tamoxifen
+tamp/ZGDRS
+tamper/ZGDR
+tamperer/M
+tampon/SM
+tan/SM
+tanager/MS
+tanbark/M
+tandem/SM
+tandoori/M
+tang/MS
+tangelo/MS
+tangent/MS
+tangential/Y
+tangerine/MS
+tangibility/IM
+tangible/IMS
+tangibleness/M
+tangibly/I
+tangle's
+tangle/UDSG
+tango/MDSG
+tangy/RT
+tank/ZGMDRS
+tankard/MS
+tanker/M
+tankful/MS
+tanned/U
+tanner/SM
+tannery/SM
+tannest
+tannin/M
+tanning/M
+tansy/M
+tantalization/M
+tantalize/ZGDRS
+tantalizer/M
+tantalizing/Y
+tantalum/M
+tantamount
+tantra/M
+tantrum/SM
+tap/SZGMDR
+tapas
+tape/MS
+tapeline/MS
+taper/MDG
+tapestry/SM
+tapeworm/MS
+tapioca/M
+tapir/MS
+tapped/U
+tapper/MS
+tappet/MS
+tapping
+taproom/SM
+taproot/SM
+tar/SGMD
+taramasalata
+tarantella/MS
+tarantula/SM
+tarball/S
+tardily
+tardiness/M
+tardy/TPR
+tare/MS
+target/MDGS
+tariff/MS
+tarmac/MS
+tarmacadam
+tarmacked
+tarmacking
+tarn/MS
+tarnish/GMDS
+tarnished/U
+taro/MS
+tarot/MS
+tarp/MS
+tarpaulin/MS
+tarpon/MS
+tarragon/SM
+tarred
+tarring
+tarry/TGDRS
+tarsal/MS
+tarsi
+tarsus/M
+tart/PTGMDRYS
+tartan/MS
+tartar/MS
+tartaric
+tartness/M
+tarty/T
+taser/GMDS
+task/GMDS
+taskbar
+taskmaster/MS
+taskmistress/MS
+tassel/MDSG
+taste/JMZGDRS
+tasted/U
+tasteful/EPY
+tastefulness/EM
+tasteless/PY
+tastelessness/M
+taster/M
+tastily
+tastiness/M
+tasting/M
+tasty/TRP
+tat/SZR
+tatami/MS
+tater/M
+tatted
+tatter/MDSG
+tatterdemalion/MS
+tattie
+tatting/M
+tattle/MZGDRS
+tattler/M
+tattletale/MS
+tattoo/MDRSZG
+tattooer/M
+tattooist/SM
+tatty/TRS
+tau/SM
+taught/UA
+taunt/ZGMDRS
+taunter/M
+taunting/Y
+taupe/M
+taut/PXTNRY
+tauten/DG
+tautness/M
+tautological/Y
+tautologous
+tautology/SM
+tavern/MS
+tawdrily
+tawdriness/M
+tawdry/RTP
+tawny/TRM
+tax/BZGMDRS
+taxa
+taxation/M
+taxer/M
+taxi/GMDS
+taxicab/SM
+taxidermist/SM
+taxidermy/M
+taximeter/MS
+taxiway/S
+taxman
+taxmen
+taxon
+taxonomic
+taxonomist/MS
+taxonomy/SM
+taxpayer/MS
+taxpaying
+tb/S
+tbsp
+tea/SM
+teabag/S
+teacake/SM
+teach/ZGRSBJ
+teachable/U
+teacher/M
+teaching/M
+teacup/MS
+teacupful/MS
+teak/MS
+teakettle/SM
+teal/MS
+tealight/MS
+team/GMDS
+teammate/MS
+teamster/MS
+teamwork/M
+teapot/MS
+tear/GMDS
+tearaway/S
+teardrop/SM
+tearful/Y
+teargas/MS
+teargassed
+teargassing
+tearjerker/MS
+tearoom/SM
+teary/TR
+tease/MZGDRS
+teasel/MS
+teaser/M
+teasing/Y
+teaspoon/SM
+teaspoonful/SM
+teat/MS
+teatime/S
+tech/M
+techie/S
+technetium/M
+technical/Y
+technicality/SM
+technician/SM
+technicolor
+technique/SM
+techno
+technobabble
+technocracy/SM
+technocrat/MS
+technocratic
+technological/Y
+technologist/MS
+technology/SM
+technophobe/S
+techs
+tectonic/S
+tectonics/M
+ted/S
+teddy/S
+tedious/PY
+tediousness/M
+tedium/M
+tee/DSMH
+teeing
+teem/GDS
+teen/MS
+teenage/RZ
+teenager/M
+teeny/TR
+teenybopper/MS
+teeter/MDSG
+teethe/GDS
+teething/M
+teetotal/RZ
+teetotaler/M
+teetotalism/M
+tektite/SM
+tel
+telecast/SZGMR
+telecaster/M
+telecommunication/MS
+telecommunications/M
+telecommute/ZGDRS
+telecommuter/M
+telecommuting/M
+teleconference/MGDS
+teleconferencing/M
+telegenic
+telegram/MS
+telegraph/MDRZG
+telegrapher/M
+telegraphese
+telegraphic
+telegraphically
+telegraphist/SM
+telegraphs
+telegraphy/M
+telekinesis/M
+telekinetic
+telemarketer/SM
+telemarketing/M
+telemeter/SM
+telemetry/SM
+teleological
+teleology
+telepathic
+telepathically
+telepathy/M
+telephone/DRSMZG
+telephoner/M
+telephonic
+telephonist/S
+telephony/M
+telephoto/SM
+telephotography/M
+teleplay/MS
+teleport
+teleportation
+teleprinter/MS
+teleprocessing/M
+teleprompter/SM
+telesales
+telescope/DSMG
+telescopic
+telescopically
+teletext/MS
+telethon/MS
+teletype/S
+teletypewriter/MS
+televangelism/M
+televangelist/MS
+televise/XGNDS
+television/M
+teleworker/S
+teleworking
+telex/MDSG
+tell/AGS
+teller/SM
+telling/Y
+telltale/SM
+tellurium/M
+telly/SM
+telnet
+temblor/MS
+temerity/M
+temp/MDRZTGS
+temper/MDG
+tempera/LSM
+temperament/MS
+temperamental/Y
+temperance/IM
+temperate/IY
+temperateness/M
+temperature/SM
+tempest/SM
+tempestuous/YP
+tempestuousness/M
+template's
+template/S
+temple/SM
+tempo/SM
+temporal/Y
+temporarily
+temporariness/M
+temporary/FSM
+temporize/ZGDRS
+temporizer/M
+tempt/SDRZG
+temptation/MS
+tempter/M
+tempting/Y
+temptress/MS
+tempura/M
+ten/BMH
+tenability/M
+tenable/U
+tenably
+tenacious/YP
+tenaciousness/M
+tenacity/M
+tenancy/SM
+tenant/SMDG
+tenanted/U
+tenantry/M
+tench
+tend/IEFDGS
+tended/U
+tendency/SM
+tendentious/YP
+tendentiousness/M
+tender/SMDRYTGP
+tenderfoot/MS
+tenderhearted/P
+tenderheartedness/M
+tenderize/ZGDRS
+tenderizer/M
+tenderloin/SM
+tenderness/M
+tendinitis/M
+tendon/SM
+tendril/SM
+tenement/SM
+tenet/SM
+tenfold
+tenner/S
+tennis/M
+tenon/SMDG
+tenor/SM
+tenpin/SM
+tenpins/M
+tense/DRSMYTGNXP
+tenseness/M
+tensile
+tension/ESM
+tensity/IM
+tensor/S
+tent/DGSM
+tentacle/DSM
+tentative/PY
+tentativeness/M
+tenterhook/MS
+tenth/MY
+tenths
+tenuity/M
+tenuous/PY
+tenuousness/M
+tenure/DSMG
+tepee/SM
+tepid/YP
+tepidity/M
+tepidness/M
+tequila/SM
+terabit/SM
+terabyte/MS
+terahertz/M
+terajoule/S
+terapixel/MS
+terawatt/S
+terbium/M
+tercentenary/SM
+tercentennial/SM
+teriyaki
+term/MDYGS
+termagant/MS
+terminable/IC
+terminal/MYS
+terminate/DSGNX
+termination/CSM
+terminator/S
+termini
+terminological/Y
+terminology/SM
+terminus/M
+termite/SM
+tern/IMS
+ternary/SM
+terr
+terrace/DSMG
+terracotta/M
+terrain/SM
+terrapin/MS
+terrarium/SM
+terrazzo/MS
+terrestrial/SMY
+terrible/P
+terribleness/M
+terribly
+terrier/M
+terrific
+terrifically
+terrify/GDS
+terrifying/Y
+terrine/S
+territorial/MS
+territoriality
+territory/SM
+terror/SM
+terrorism/M
+terrorist/SM
+terrorize/DSG
+terry/RMZ
+terrycloth/M
+terse/RYTP
+terseness/M
+tertiary
+tessellate/DSXGN
+tessellation/M
+test's/AFK
+test/AKFCDGS
+testable/CF
+testament/MS
+testamentary
+testate/S
+testator/MS
+testatrices
+testatrix/M
+tested/U
+tester/KSM
+testes
+testicle/MS
+testicular
+testifier/M
+testify/ZGDRS
+testily
+testimonial/MS
+testimony/SM
+testiness/M
+testings
+testis/M
+testosterone/M
+testy/PRT
+tetanus/M
+tetchily
+tetchy/PRT
+tether/SMDG
+tetra/SM
+tetracycline/M
+tetrahedral
+tetrahedron/MS
+tetrameter/SM
+text/FMS
+textbook/SM
+texted
+textile/MS
+texting
+textual/FY
+textural
+texture/MGDS
+thalami
+thalamus/M
+thalidomide/M
+thallium/M
+than
+thane/SM
+thank/SDG
+thankful/YP
+thankfulness/M
+thankless/PY
+thanklessness/M
+thanksgiving/SM
+that'd
+that'll
+that/M
+thatch/MDRSZG
+thatcher/M
+thatching/M
+thaw/MDGS
+the/JG
+theater/SM
+theatergoer/SM
+theatrical/YS
+theatricality/M
+theatricals/M
+theatrics/M
+thee/S
+theft/SM
+their/S
+theism/M
+theist/SM
+theistic
+them
+thematic
+thematically
+theme/DSM
+themselves
+then/M
+thence
+thenceforth
+thenceforward
+theocracy/SM
+theocratic
+theodolite/S
+theologian/SM
+theological/Y
+theology/SM
+theorem/MS
+theoretic
+theoretical/Y
+theoretician/SM
+theorist/SM
+theorize/DSG
+theory/SM
+theosophic
+theosophical
+theosophist/SM
+theosophy/M
+therapeutic/S
+therapeutically
+therapeutics/M
+therapist/SM
+therapy/SM
+there/M
+thereabout/S
+thereafter
+thereat
+thereby
+therefor
+therefore
+therefrom
+therein
+theremin/SM
+thereof
+thereon
+thereto
+theretofore
+thereunder
+thereunto
+thereupon
+therewith
+therm/SM
+thermal/MYS
+thermionic
+thermodynamic/S
+thermodynamics/M
+thermometer/MS
+thermometric
+thermonuclear
+thermoplastic/SM
+thermos/MS
+thermostat/MS
+thermostatic
+thermostatically
+thesauri
+thesaurus/MS
+these/S
+thesis/M
+thespian/SM
+theta/SM
+thew/MS
+they
+they'd
+they'll
+they're
+they've
+thiamine/M
+thick/PMNRYXT
+thicken/DRJZG
+thickener/M
+thickening/M
+thicket/MS
+thickheaded/M
+thickness/MS
+thicko/S
+thickset
+thief/M
+thieve/DSG
+thievery/M
+thieving/M
+thievish
+thigh/M
+thighbone/MS
+thighs
+thimble/MS
+thimbleful/SM
+thin/YSP
+thine
+thing/M
+thingamabob/SM
+thingamajig/SM
+thingumabob/S
+thingummy/S
+thingy/S
+think/SRBZG
+thinkable/U
+thinker/M
+thinking's
+thinned
+thinner/MS
+thinness/M
+thinnest
+thinning
+third/SMY
+thirst/SGMD
+thirstily
+thirstiness/M
+thirsty/TPR
+thirteen/SMH
+thirteenth/M
+thirteenths
+thirtieth/M
+thirtieths
+thirty/HSM
+this
+thistle/MS
+thistledown/M
+thither
+tho
+thole/SM
+thong/SM
+thoracic
+thorax/MS
+thorium/M
+thorn/SM
+thorniness/M
+thorny/PRT
+thorough/RYPT
+thoroughbred/MS
+thoroughfare/MS
+thoroughgoing
+thoroughness/M
+those
+thou/MS
+though
+thought/SM
+thoughtful/YP
+thoughtfulness/M
+thoughtless/PY
+thoughtlessness/M
+thousand/MHS
+thousandfold
+thousandth/M
+thousandths
+thrall/SMDG
+thralldom/M
+thrash/JMDRSZG
+thrasher/M
+thrashing/M
+thread/SMDRZG
+threadbare
+threader/M
+threadlike
+thready/TR
+threat/SMNX
+threaten/DG
+threatening/Y
+three/SM
+threefold
+threepence/M
+threescore/MS
+threesome/SM
+threnody/SM
+thresh/MDRSZG
+thresher/M
+threshold/SM
+threw
+thrice
+thrift/SM
+thriftily
+thriftiness/M
+thriftless
+thrifty/PTR
+thrill/SMDRZG
+thriller/M
+thrilling/Y
+thrive/DSG
+throat/SM
+throatily
+throatiness/M
+throaty/RTP
+throb/SM
+throbbed
+throbbing
+throe/SM
+thrombi
+thrombolytic
+thromboses
+thrombosis/M
+thrombotic
+thrombus/M
+throne's
+throne/S
+throng/GSMD
+throttle/DRSMZG
+throttler/M
+through
+throughout
+throughput/M
+throw/SMRZG
+throwaway/SM
+throwback/SM
+thrower/M
+thrown
+thru
+thrum/SM
+thrummed
+thrumming
+thrush/MS
+thrust/GSM
+thruway/MS
+thud/MS
+thudded
+thudding
+thug/MS
+thuggery/M
+thuggish
+thulium/M
+thumb/SMDG
+thumbnail/SM
+thumbprint/SM
+thumbscrew/SM
+thumbtack/SM
+thump/SMDG
+thumping/M
+thunder/ZGMDRS
+thunderbolt/SM
+thunderclap/SM
+thundercloud/MS
+thunderer/M
+thunderhead/SM
+thunderous/Y
+thundershower/SM
+thunderstorm/SM
+thunderstruck
+thundery
+thunk/S
+thus
+thwack/ZGSMDR
+thwacker/M
+thwart/GSMD
+thy
+thyme/M
+thymine/M
+thymus/MS
+thyroid/MS
+thyroidal
+thyself
+ti/MRZ
+tiara/SM
+tibia/M
+tibiae
+tibial
+tic/SM
+tick/MDRZGS
+ticker/M
+ticket/GSMD
+ticking/M
+tickle/DRSMZG
+tickler/M
+ticklish/YP
+ticklishness/M
+ticktacktoe/M
+ticktock/MS
+tidal/Y
+tidbit/SM
+tiddler/S
+tiddly
+tiddlywink/S
+tiddlywinks/M
+tide/MGJDS
+tideland/SM
+tidemark/S
+tidewater/MS
+tideway/MS
+tidily/U
+tidiness/UM
+tidings/M
+tidy/DRSMTGP
+tie's
+tie/AUSD
+tieback/MS
+tiebreak/RSZ
+tiebreaker/M
+tiepin/S
+tier/MD
+tiff/MDGS
+tiger/SM
+tigerish
+tight/SNRYPXT
+tighten/ZGDR
+tightener/M
+tightfisted
+tightness/M
+tightrope/MS
+tights/M
+tightwad/MS
+tigress/MS
+til
+tilapia
+tilde/SM
+tile/MZGDRS
+tiler/M
+tiling/M
+till's
+till/EDRZGS
+tillable
+tillage/M
+tiller/EM
+tilt/MDGS
+timber/SMDG
+timberland/M
+timberline/MS
+timbre/SM
+timbrel/SM
+time/MYZGJDRS
+timekeeper/MS
+timekeeping/M
+timeless/PY
+timelessness/M
+timeline/MS
+timeliness/UM
+timely/UPRT
+timeout/SM
+timepiece/MS
+timer/M
+timescale/S
+timeserver/SM
+timeserving/M
+timeshare/S
+timestamp/SMD
+timetable/DSMG
+timeworn
+timezone
+timid/RYTP
+timidity/M
+timidness/M
+timing/M
+timorous/PY
+timorousness/M
+timothy/M
+timpani/M
+timpanist/SM
+tin/SM
+tincture/MGDS
+tinder/M
+tinderbox/MS
+tine/MS
+tinfoil/M
+ting/MDYG
+tinge/SM
+tingeing
+tingle/DSMGJ
+tingling/M
+tininess/M
+tinker/ZGSMDR
+tinkerer/M
+tinkle/DSMG
+tinned
+tinniness/M
+tinning
+tinnitus/M
+tinny/PRT
+tinplate/M
+tinpot
+tinsel/GSMD
+tinsmith/M
+tinsmiths
+tint/MDGS
+tintinnabulation/MS
+tintype/MS
+tinware/M
+tiny/RTP
+tip/SM
+tipped
+tipper/SM
+tippet/SM
+tippex/GDS
+tipping
+tipple/DRSMZG
+tippler/M
+tipsily
+tipsiness/M
+tipster/MS
+tipsy/RPT
+tiptoe/DSM
+tiptoeing
+tiptop/SM
+tirade/SM
+tiramisu/MS
+tire's
+tire/AGDS
+tired/PRYT
+tiredness/M
+tireless/YP
+tirelessness/M
+tiresome/PY
+tiresomeness/M
+tissue/SM
+tit/SM
+titan/SM
+titanic
+titanium/M
+titch/S
+titchy
+tithe/DRSMZG
+tither/M
+titian/M
+titillate/DSGN
+titillating/Y
+titillation/M
+titivate/DSGN
+titivation/M
+title/DSMG
+titled/U
+titleholder/MS
+titlist/MS
+titmice
+titmouse/M
+titter/SGMD
+tittle/SM
+titty/S
+titular
+tizz
+tizzy/SM
+tn
+tnpk
+to/IU
+toad/MS
+toadstool/MS
+toady/DSMG
+toadyism/M
+toast/SMDRZG
+toaster/M
+toastmaster/SM
+toastmistress/MS
+toasty/TRS
+tobacco/MS
+tobacconist/SM
+toboggan/ZGSMDR
+tobogganer/M
+tobogganing/M
+toccata/S
+tocopherol
+tocsin/SM
+today/M
+toddle/DRSMZG
+toddler/M
+toddy/SM
+toe/DSM
+toecap/SM
+toehold/MS
+toeing
+toenail/MS
+toerag/S
+toff/S
+toffee/SM
+tofu/M
+tog/SM
+toga/MDS
+together/P
+togetherness/M
+togged
+togging
+toggle/DSMG
+togs/M
+toil/MDRZGS
+toiler/M
+toilet/MDGS
+toiletry/SM
+toilette/M
+toilsome
+toke/MGDS
+token/SM
+tokenism/M
+told/AU
+tole/M
+tolerable/I
+tolerably/I
+tolerance/IM
+tolerances
+tolerant/IY
+tolerate/GNDS
+toleration/M
+toll/MDGS
+tollbooth/M
+tollbooths
+tollgate/SM
+tollway/SM
+toluene/M
+tom/SM
+tomahawk/SGMD
+tomato/M
+tomatoes
+tomb/MDGS
+tombola/S
+tomboy/MS
+tomboyish
+tombstone/MS
+tomcat/MS
+tome/MS
+tomfoolery/SM
+tomographic
+tomography/M
+tomorrow/MS
+tomtit/MS
+ton/SM
+tonal/Y
+tonality/SM
+tone's
+tone/IZGDRS
+tonearm/SM
+toneless/Y
+toner/IM
+tong/MDGS
+tongue/MGDS
+tongueless
+tonic/SM
+tonight/M
+tonnage/SM
+tonne/SM
+tonsil/MS
+tonsillectomy/SM
+tonsillitis/M
+tonsorial
+tonsure/DSMG
+tony/RT
+too
+took/A
+tool's
+tool/ADGS
+toolbar/SM
+toolbox/MS
+toolkit
+toolmaker/MS
+toot/MDRZGS
+tooter/M
+tooth/MD
+toothache/MS
+toothbrush/MS
+toothily
+toothless
+toothpaste/SM
+toothpick/SM
+toothsome
+toothy/RT
+tootle/GDS
+tootsie/S
+top/SM
+topaz/MS
+topcoat/SM
+topdressing/SM
+topee/S
+topflight
+topi
+topiary/M
+topic/SM
+topical/Y
+topicality/M
+topknot/SM
+topless
+topmast/SM
+topmost
+topnotch
+topographer/SM
+topographic
+topographical/Y
+topography/SM
+topological/Y
+topology
+topped
+topper/MS
+topping/SM
+topple/GDS
+topsail/SM
+topside/SM
+topsoil/M
+topspin/M
+toque/SM
+tor/SM
+torch/GMDS
+torchbearer/MS
+torchlight/M
+tore
+toreador/MS
+torment/SMDG
+tormenting/Y
+tormentor/MS
+torn
+tornado/M
+tornadoes
+torpedo/GMD
+torpedoes
+torpid/Y
+torpidity/M
+torpor/M
+torque/MGDS
+torrent/SM
+torrential
+torrid/YP
+torridity/M
+torridness/M
+torsion/M
+torsional
+torso/SM
+tort's
+tort/FEAS
+torte/SM
+tortellini/M
+tortilla/MS
+tortoise/MS
+tortoiseshell/SM
+tortoni/M
+tortuous/PY
+tortuousness/M
+torture/DRSMZG
+torturer/M
+torturous
+torus
+tosh
+toss/MDRSZG
+tossup/MS
+tot/SGMD
+total/GSMDY
+totalitarian/SM
+totalitarianism/M
+totality/SM
+totalizator/SM
+tote/MS
+totem/SM
+totemic
+totted
+totter/ZGMDRS
+totterer/M
+totting
+toucan/MS
+touch/AGMDS
+touchdown/SM
+touche/BJ
+touched/U
+touchily
+touchiness/M
+touching/Y
+touchline/S
+touchpaper/S
+touchscreen/MS
+touchstone/MS
+touchy/RPT
+tough/XTGMDNRYP
+toughen/ZGDR
+toughener/M
+toughie/SM
+toughness/M
+toughs
+toupee/MS
+tour/CFSGDM
+tourism/M
+tourist/MS
+touristic
+touristy
+tourmaline/M
+tournament/SM
+tourney/MS
+tourniquet/MS
+tousle/GDS
+tout/MDGS
+tow/SZGMDR
+toward/S
+towboat/MS
+towel/JGSMD
+towelette/SM
+toweling/M
+tower/GMD
+towhead/MDS
+towhee/MS
+towline/MS
+town/MS
+townee/S
+townhouse/MS
+townie/MS
+townsfolk/M
+township/MS
+townsman/M
+townsmen
+townspeople/M
+townswoman/M
+townswomen
+towpath/M
+towpaths
+towrope/SM
+toxemia/M
+toxic
+toxicity/SM
+toxicological
+toxicologist/SM
+toxicology/M
+toxin/SM
+toy/SGMD
+toyboy/S
+tr
+trabecula
+trabecular
+trabecule
+trace/JDRSMZG
+traceability
+traceable/U
+tracer/M
+tracery/SM
+trachea/M
+tracheae
+tracheal
+tracheotomy/SM
+tracing/M
+track/ZGSMDR
+trackball/SM
+tracker/M
+trackless
+tracksuit/S
+tract's
+tract/CEKFAS
+tractability/IM
+tractable/I
+tractably/I
+traction/EFACKM
+tractor/FCKMS
+trad
+trade/JDRSMZG
+trademark/SGMD
+trader/M
+tradesman/M
+tradesmen
+tradespeople/M
+tradeswoman/M
+tradeswomen
+trading/M
+tradition/MS
+traditional/Y
+traditionalism/M
+traditionalist/SM
+traduce/DRSZG
+traducer/M
+traffic/SM
+trafficked
+trafficker/SM
+trafficking/M
+tragedian/SM
+tragedienne/MS
+tragedy/SM
+tragic
+tragically
+tragicomedy/SM
+tragicomic
+trail/ZGSMDR
+trailblazer/MS
+trailblazing/M
+trailer/M
+train/ZGSMDRB
+trained/U
+trainee/SM
+trainer/M
+training/M
+trainload/MS
+trainman/M
+trainmen
+trainspotter/S
+trainspotting
+traipse/DSMG
+trait/SM
+traitor/SM
+traitorous/Y
+trajectory/SM
+tram/MS
+tramcar/S
+tramlines
+trammed
+trammel/SGMD
+trammeled/U
+tramming
+tramp/ZGSMDR
+tramper/M
+trample/DRSMZG
+trampler/M
+trampoline/MGDS
+tramway/S
+trance/MS
+tranche/S
+tranquil/RYT
+tranquility/M
+tranquilize/ZGDRS
+tranquilizer/M
+trans/I
+transact/DGS
+transaction/SM
+transactional
+transactor/MS
+transatlantic
+transceiver/SM
+transcend/GSD
+transcendence/M
+transcendent
+transcendental/Y
+transcendentalism/M
+transcendentalist/SM
+transcontinental
+transcribe/ZGDRS
+transcriber/M
+transcript/MS
+transcription/SM
+transducer/MS
+transduction
+transect/DSG
+transept/MS
+transfer/MBS
+transferal/MS
+transference/M
+transferred
+transferring
+transfiguration/M
+transfigure/GDS
+transfinite
+transfix/DSG
+transform/BSZGMDR
+transformation/SM
+transformational
+transformer/M
+transfuse/DSXGN
+transfusion/M
+transgender/S
+transgenic
+transgress/GDS
+transgression/SM
+transgressor/SM
+transience/M
+transiency/M
+transient/SMY
+transistor/SM
+transistorize/DSG
+transit/SGMD
+transition/GSMD
+transitional/Y
+transitive/ISMY
+transitiveness/M
+transitivity/M
+transitory
+transl
+translatable/U
+translate/DSGNBX
+translated/U
+translation/M
+translator/SM
+transliterate/DSGNX
+transliteration/M
+translocation
+translucence/M
+translucency/M
+translucent/Y
+transmigrate/GNDS
+transmigration/M
+transmissible
+transmission/MS
+transmit/S
+transmittable
+transmittal/M
+transmittance/M
+transmitted
+transmitter/SM
+transmitting
+transmogrification/M
+transmogrify/DSNG
+transmutation/SM
+transmute/BDSG
+transnational/MS
+transoceanic
+transom/SM
+transpacific
+transparency/SM
+transparent/Y
+transphobia/M
+transphobic
+transpiration/M
+transpire/DSG
+transplant/MDGS
+transplantation/M
+transpolar
+transponder/SM
+transport/BSZGMDR
+transportation/M
+transporter/M
+transpose/DSG
+transposition/MS
+transsexual/SM
+transsexualism/M
+transship/SL
+transshipment/M
+transshipped
+transshipping
+transubstantiation/M
+transversal
+transverse/MYS
+transvestism/M
+transvestite/MS
+trap/MS
+trapdoor/MS
+trapeze/SM
+trapezium/SM
+trapezoid/SM
+trapezoidal
+trappable
+trapped
+trapper/SM
+trapping/S
+trappings/M
+trapshooting/M
+trash/GMDS
+trashcan/MS
+trashiness/M
+trashy/RPT
+trauma/MS
+traumatic
+traumatically
+traumatize/GDS
+travail/SGMD
+travel/MDRSZGJ
+traveled/U
+traveler/M
+traveling/M
+travelogue/MS
+traversal/SM
+traverse/DSMG
+travesty/GDSM
+trawl/ZGSMDR
+trawler/M
+tray/MS
+treacherous/PY
+treacherousness/M
+treachery/SM
+treacle/M
+treacly
+tread/AGSM
+treadle/DSMG
+treadmill/MS
+treas
+treason/BM
+treasonous
+treasure/DRSMZG
+treasurer/M
+treasury/SM
+treat/AGSMD
+treatable
+treated/U
+treatise/SM
+treatment/MS
+treaty/SM
+treble/MGDS
+tree/MDS
+treeing
+treeless
+treelike
+treeline
+treetop/SM
+trefoil/SM
+trek/MS
+trekked
+trekker/SM
+trekking
+trellis/GMDS
+trematode/MS
+tremble/DSMG
+tremendous/Y
+tremolo/SM
+tremor/MS
+tremulous/PY
+tremulousness/M
+trench's
+trench/ADSG
+trenchancy/M
+trenchant/Y
+trencher/MS
+trencherman/M
+trenchermen
+trend/GSMD
+trendily
+trendiness/M
+trendsetter/S
+trendsetting
+trendy/RSMPT
+trepidation/M
+trespass/MDRSZG
+trespasser/M
+tress/EMS
+trestle/MS
+trews
+trey/MS
+triad/SM
+triage/MD
+trial/ASM
+trialed
+trialing
+triangle/SM
+triangular/Y
+triangulate/GNDS
+triangulation/M
+triathlete/S
+triathlon/SM
+tribal
+tribalism/M
+tribe/SM
+tribesman/M
+tribesmen
+tribeswoman/M
+tribeswomen
+tribulation/SM
+tribunal/SM
+tribune/MS
+tributary/SM
+tribute's
+tribute/FS
+trice/M
+tricentennial/MS
+triceps/MS
+triceratops/M
+trichina/M
+trichinae
+trichinosis/M
+trick/GSMD
+trickery/M
+trickily
+trickiness/M
+trickle/MGDS
+trickster/SM
+tricky/TRP
+tricolor/SM
+tricycle/SM
+trident/MS
+tried/U
+triennial/MYS
+trier/SM
+trifecta/SM
+trifle/MZGDRS
+trifler/M
+trifocals/M
+trig/M
+trigger/MDSG
+triglyceride/MS
+trigonometric
+trigonometrical
+trigonometry/M
+trike/SM
+trilateral/S
+trilby/SM
+trill/GSMD
+trillion/SMH
+trillionth/M
+trillionths
+trillium/M
+trilobite/SM
+trilogy/SM
+trim/PMYS
+trimaran/MS
+trimester/SM
+trimmed/U
+trimmer/SM
+trimmest
+trimming/SM
+trimmings/M
+trimness/M
+trimonthly
+trinitrotoluene/M
+trinity/SM
+trinket/SM
+trio/MS
+trip/MYS
+tripartite
+tripe/M
+triple/MGDS
+triplet/SM
+triplex/MS
+triplicate/MGDS
+tripod/MS
+tripodal
+tripos
+tripped
+tripper/SM
+tripping
+triptych/M
+triptychs
+tripwire/S
+trireme/SM
+trisect/SDG
+trisection/M
+trite/FPYT
+triteness/FM
+triter
+tritium/M
+triumph/GMD
+triumphal
+triumphalism
+triumphalist
+triumphant/Y
+triumphs
+triumvir/MS
+triumvirate/SM
+trivalent
+trivet/MS
+trivia/M
+trivial/Y
+triviality/SM
+trivialization/M
+trivialize/GDS
+trivium/M
+trochaic
+trochee/SM
+trod/AU
+trodden/A
+troglodyte/SM
+troika/MS
+troll/SGMD
+trolley/SM
+trolleybus/MS
+trollop/SM
+trombone/MS
+trombonist/MS
+tromp/SGD
+tron/S
+troop/SZGMDR
+trooper/M
+troopship/MS
+trope/SM
+trophy/SM
+tropic/MS
+tropical/Y
+tropics/M
+tropism/SM
+troposphere/SM
+trot/MS
+troth/M
+trotted
+trotter/SM
+trotting
+troubadour/MS
+trouble/DSMG
+troubled/U
+troublemaker/MS
+troubleshoot/DRZGS
+troubleshooter/M
+troubleshooting/M
+troubleshot
+troublesome/Y
+trough/M
+troughs
+trounce/DRSZG
+trouncer/M
+troupe/MZGDRS
+trouper/M
+trouser/SM
+trousers/M
+trousseau/M
+trousseaux
+trout/SM
+trove/SM
+trow/DSG
+trowel/MDSG
+troy/S
+truancy/M
+truant/GMDS
+truce/SM
+truck/SZGMDR
+trucker/M
+trucking/M
+truckle/MGDS
+truckload/SM
+truculence/M
+truculent/Y
+trudge/MGDS
+true/MTGDRS
+truelove/SM
+truffle/MS
+trug/S
+truism/MS
+truly/U
+trump/SGMD
+trumpery/M
+trumpet/ZGMDRS
+trumpeter/M
+truncate/GNDS
+truncation/M
+truncheon/SM
+trundle/MZGDRS
+trundler/M
+trunk/SGM
+truss/GMDS
+trust/ESGMD
+trustee/MS
+trusteeship/SM
+trustful/EY
+trustfulness/M
+trusting/Y
+trustworthiness/M
+trustworthy/TPR
+trusty/TRSM
+truth/ZMR
+truther/M
+truthful/UYP
+truthfulness/UM
+truthiness
+truths/U
+try's
+try/AGDS
+trying/Y
+tryout/SM
+tryptophan
+tryst/SMDG
+tsarists
+tsetse/MS
+tsp
+tsunami/SM
+ttys
+tub/SZGMDR
+tuba/MS
+tubal
+tubby/TR
+tube/MS
+tubeless/M
+tuber/M
+tubercle/SM
+tubercular
+tuberculin/M
+tuberculosis/M
+tuberculous
+tuberose/M
+tuberous
+tubful/MS
+tubing/M
+tubular
+tubule/MS
+tuck/MDRSZG
+tucker/MDG
+tuft/MDRSZG
+tufter/M
+tug/SM
+tugboat/MS
+tugged
+tugging
+tuition/IM
+tularemia/M
+tulip/SM
+tulle/M
+tum/S
+tumble/DRSMZG
+tumbledown
+tumbler/M
+tumbleweed/SM
+tumbling/M
+tumbrel/SM
+tumescence/M
+tumescent
+tumid
+tumidity/M
+tummy/SM
+tumor/SM
+tumorous
+tumult/SM
+tumultuous/Y
+tun/SZGMDR
+tuna/MS
+tundra/SM
+tune/MS
+tuneful/YP
+tunefulness/M
+tuneless/Y
+tuner/M
+tuneup/SM
+tungsten/M
+tunic/SM
+tunnel/JSMDRZG
+tunneler/M
+tunny/SM
+tuple/S
+tuppence
+tuppenny
+tuque/SM
+turban/SMD
+turbid
+turbidity/M
+turbine/SM
+turbo/SM
+turbocharge/ZGDRS
+turbocharger/M
+turbofan/SM
+turbojet/SM
+turboprop/SM
+turbot/SM
+turbulence/M
+turbulent/Y
+turd/MS
+turducken/SM
+tureen/SM
+turf/MDSG
+turfy
+turgid/Y
+turgidity/M
+turkey/SM
+turmeric/SM
+turmoil/MS
+turn/AMDRSZG
+turnabout/SM
+turnaround/SM
+turnbuckle/SM
+turncoat/SM
+turner/AM
+turning/MS
+turnip/SM
+turnkey/MS
+turnoff/MS
+turnout/MS
+turnover/MS
+turnpike/MS
+turnstile/SM
+turntable/SM
+turpentine/M
+turpitude/M
+turps
+turquoise/SM
+turret/SMD
+turtle/SM
+turtledove/SM
+turtleneck/SMD
+tush/MS
+tusk/MDS
+tussle/DSMG
+tussock/MS
+tussocky
+tut/SM
+tutelage/M
+tutelary
+tutor/SMDG
+tutored/U
+tutorial/SM
+tutorship/M
+tutted
+tutti/SM
+tutting
+tutu/MS
+tux/MS
+tuxedo/SM
+twaddle/MZGDRS
+twaddler/M
+twain/M
+twang/SMDG
+twangy/RT
+twas
+twat/S
+tweak/SMDG
+twee
+tweed/SM
+tweeds/M
+tweedy/RT
+tween
+tweet's
+tweet/ASDG
+tweeter/SM
+tweezers/M
+twelfth/M
+twelfths
+twelve/SM
+twelvemonth/M
+twelvemonths
+twentieth/M
+twentieths
+twenty/SMH
+twerk/SDG
+twerp/SM
+twice
+twiddle/MGDS
+twiddly
+twig/MS
+twigged
+twigging
+twiggy/TR
+twilight/M
+twilit
+twill/MD
+twin/MDRSZG
+twine/SM
+twiner/M
+twinge/DSMG
+twink/SY
+twinkle/MGJDS
+twinkling/M
+twinned
+twinning
+twinset/S
+twirl/SMDRZG
+twirler/M
+twirly
+twist's
+twist/USDG
+twister/MS
+twisty/TR
+twit/MS
+twitch/GMDS
+twitchy/RT
+twitted
+twitter/MDSG
+twittery
+twitting
+twixt
+two/SM
+twofer/SM
+twofold
+twopence/SM
+twopenny
+twosome/SM
+twp
+tycoon/SM
+tying/AU
+tyke/MS
+tympani/M
+tympanic
+tympanist/MS
+tympanum/SM
+type's
+type/AGDS
+typecast/GS
+typeface/MS
+typescript/MS
+typeset/S
+typesetter/MS
+typesetting/M
+typewrite/RSZG
+typewriter/M
+typewriting/M
+typewritten
+typewrote
+typhoid/M
+typhoon/MS
+typhus/M
+typical/UY
+typicality/M
+typification/M
+typify/NGDS
+typing/M
+typist/SM
+typo/MS
+typographer/SM
+typographic
+typographical/Y
+typography/M
+typology/SM
+tyrannic
+tyrannical/Y
+tyrannicidal
+tyrannicide/S
+tyrannize/GDS
+tyrannosaur/MS
+tyrannosaurus/MS
+tyrannous
+tyranny/SM
+tyrant/SM
+tyro/MS
+tzatziki
+u/S
+ubiquitous/Y
+ubiquity/M
+udder/SM
+ufologist/SM
+ufology/M
+ugh
+ugliness/M
+ugly/RTP
+uh
+uhf
+ukase/SM
+ukulele/SM
+ulcer/SM
+ulcerate/XDSGN
+ulceration/M
+ulcerous
+ulna/M
+ulnae
+ulnar
+ulster/MS
+ult
+ulterior
+ultimate/MY
+ultimatum/MS
+ultimo
+ultra/SM
+ultraconservative/SM
+ultrahigh
+ultralight/SM
+ultramarine/M
+ultramodern
+ultrasensitive
+ultrashort
+ultrasonic
+ultrasonically
+ultrasound/MS
+ultraviolet/M
+ululate/DSGNX
+ululation/M
+um
+umbel/SM
+umber/M
+umbilical
+umbilici
+umbilicus/M
+umbra/SM
+umbrage/M
+umbrella/SM
+umiak/SM
+umlaut/MS
+ump/SGMD
+umpire/MGDS
+umpteen/H
+unabridged/MS
+unacceptability
+unacceptable
+unaccommodating
+unaccountably
+unadventurous
+unaesthetic
+unalterably
+unambitious
+unanimity/M
+unanimous/Y
+unapparent
+unappetizing
+unappreciative
+unary
+unassertive
+unassimilable
+unassuming/Y
+unavailing/Y
+unaware/S
+unbeknownst
+unbend/SG
+unbent
+unbid
+unblinking/Y
+unblushing/Y
+unbosom/DG
+unbound/D
+unbox/GDS
+unbreakable
+unbroken
+uncanny/T
+uncap/S
+uncaring
+uncatalogued
+unceasing/Y
+unchangeable
+uncharacteristic
+uncharitable
+unchaste/RT
+uncial/M
+uncle/SM
+unclean/DRPT
+uncleanly/T
+unclear/DRT
+uncomfortable
+uncommon/T
+uncompelling
+uncomplaining/Y
+uncomplicated
+uncomprehending/Y
+uncompromising/Y
+unconditional/Y
+uncongenial
+unconscionable
+unconscionably
+unconscious/M
+unconstitutional/Y
+uncontrollably
+uncontroversial
+uncool
+uncooperative
+uncouth/Y
+uncrushable
+unction/SM
+unctuous/YP
+unctuousness/M
+uncut
+undaunted/Y
+undecided/SM
+undemonstrative/Y
+undeniably
+under
+underachieve/LZGDRS
+underachiever/M
+underact/SDG
+underage
+underappreciated
+underarm/SM
+underbelly/SM
+underbid/S
+underbidding
+underbrush/M
+undercarriage/MS
+undercharge/MGDS
+underclass/MS
+underclassman/M
+underclassmen
+underclothes/M
+underclothing/M
+undercoat/GJSMD
+undercoating/M
+undercover
+undercurrent/SM
+undercut/SM
+undercutting
+underdeveloped
+underdevelopment/M
+underdog/SM
+underdone
+underemployed
+underemployment/M
+underestimate/DSMGNX
+underestimation/M
+underexpose/GDS
+underexposure/MS
+underfed
+underfeed/GS
+underfloor
+underflow
+underfoot
+underfunded
+underfur/M
+undergarment/SM
+undergo/G
+undergoes
+undergone
+undergrad/S
+undergraduate/SM
+underground/MS
+undergrowth/M
+underhand
+underhanded/PY
+underhandedness/M
+underinflated
+underlain
+underlay/SM
+underlie/S
+underline/MGDS
+underling/MS
+underlip/SM
+underlying
+undermanned
+undermentioned
+undermine/GDS
+undermost
+underneath/M
+underneaths
+undernourished
+undernourishment/M
+underpaid
+underpants/M
+underpart/MS
+underpass/MS
+underpay/GSL
+underpayment/SM
+underpin/S
+underpinned
+underpinning/MS
+underplay/DGS
+underpopulated
+underprivileged
+underproduction/M
+underrate/GDS
+underrepresented
+underscore/DSMG
+undersea/S
+undersecretary/SM
+undersell/GS
+undersexed
+undershirt/SM
+undershoot/SG
+undershorts/M
+undershot
+underside/MS
+undersign/DGS
+undersigned/M
+undersized
+underskirt/SM
+undersold
+understaffed
+understand/SGBJ
+understandably
+understanding/MY
+understate/DSLG
+understatement/SM
+understood
+understudy/GDSM
+undertake/ZGJRS
+undertaken
+undertaker/M
+undertaking/M
+underthings/M
+undertone/MS
+undertook
+undertow/SM
+underused
+underutilized
+undervaluation/M
+undervalue/DSG
+underwater
+underway
+underwear/M
+underweight/M
+underwent
+underwhelm/DGS
+underwire/DS
+underworld/MS
+underwrite/ZGRS
+underwriter/M
+underwritten
+underwrote
+undesirable/MS
+undies/M
+undo
+undoubted/Y
+undramatic
+undue
+undulant
+undulate/DSXGN
+undulation/M
+undying
+unearthliness/M
+unease/M
+uneasy/T
+uneatable
+uneconomic
+unemployed/M
+unending
+unenterprising
+unequal/DY
+unerring/Y
+unessential
+uneven/Y
+unexceptionably
+unexcited
+unexciting
+unexpected/YP
+unexpectedness/M
+unfailing/Y
+unfair/PTRY
+unfaltering
+unfamiliar
+unfathomably
+unfed
+unfeeling/Y
+unfeminine
+unfit/S
+unfitting
+unfix/GDS
+unflagging/Y
+unflappability/M
+unflappable
+unflappably
+unflattering
+unflinching/Y
+unforgettably
+unforgivably
+unfortunate/MS
+unfriendly/T
+unfrock/DG
+unfruitful
+unfunny
+ungainliness/M
+ungainly/RPT
+ungenerous
+ungentle
+ungodly/T
+ungraceful/Y
+ungrudging
+unguarded
+unguent/SM
+ungulate/MS
+unhandy/T
+unhappy/T
+unhealthful
+unhealthy/T
+unhistorical
+unholy/T
+unhurt
+unicameral
+unicellular
+unicorn/SM
+unicycle/SM
+unidirectional
+unification/AM
+uniform/SMDYG
+uniformity/M
+unify/AGDSN
+unilateral/Y
+unilateralism
+unimportant
+unimpressive
+uninformative
+uninhibited/Y
+uninsured
+unintelligent
+unintended
+uninteresting
+uninterrupted/Y
+uninterruptible
+uninviting
+union/ASM
+unionism/M
+unionist/MS
+unique/YTRP
+uniqueness/M
+unisex/M
+unison/M
+unitary
+unite/AEGSD
+unitedly
+unities
+unitize/DSG
+unity/EM
+univalent
+univalve/SM
+universal/MYS
+universalism
+universalist
+universality/M
+universalize/DSG
+universe/SM
+university/SM
+univocal
+unjust/Y
+unkempt
+unkind/T
+unkindly/T
+unknowable/M
+unknown/SM
+unleaded/M
+unless
+unlike/PB
+unlikely/T
+unlit
+unlock/DSG
+unlovable
+unlovely/TR
+unloving
+unlucky/T
+unmanly/T
+unmarried
+unmeaning
+unmentionable/MS
+unmentionables/M
+unmet
+unmindful
+unmissable
+unmistakably
+unmoral
+unmovable
+unmusical
+unnecessary
+unnerving/Y
+unobservant
+unoffensive
+unofficial/Y
+unoriginal
+unpeople
+unperceptive
+unpersuasive
+unpick/GDS
+unpin/S
+unpleasing
+unpolitical
+unpopular
+unpractical
+unprecedented/Y
+unprofessional/Y
+unpromising
+unpropitious
+unquestioning/Y
+unquiet/TR
+unread/B
+unready
+unreal
+unreasoning
+unregenerate
+unrelated
+unrelenting/Y
+unrelieved/Y
+unremarkable
+unremitting/Y
+unrepentant
+unreported
+unrepresentative
+unrest/M
+unrevealing
+unripe/TR
+unroll/GDS
+unromantic
+unruliness/M
+unruly/RTP
+unsafe/YTR
+unsaleable
+unsavory
+unscathed
+unseeing/Y
+unseemly/T
+unseen/M
+unsentimental
+unset
+unshakable
+unshakably
+unshapely
+unshockable
+unshorn
+unsightliness/M
+unsightly/PT
+unsmiling
+unsociable
+unsocial
+unsold
+unsound/PRYT
+unspeakable
+unspeakably
+unspecific
+unspectacular
+unsporting
+unstable
+unsteady/TRP
+unstinting/Y
+unstrapping
+unsubstantial
+unsubtle
+unsuitable
+unsure
+unsuspecting/Y
+unsymmetrical
+untactful
+unthinkably
+unthinking/Y
+untidy/PTR
+until
+untimely/T
+untiring/Y
+untouchable/MS
+untoward
+untrue/RT
+untrustworthy
+untruth/M
+unutterable
+unutterably
+unwarrantable
+unwary/T
+unwavering
+unwed
+unwelcome/G
+unwell
+unwieldiness/M
+unwieldy/TRP
+unwise/RYT
+unworried
+unworthy/T
+unwound
+unwrapping
+unyielding
+up/S
+upbeat/MS
+upbraid/SGD
+upbringing/MS
+upchuck/SGD
+upcoming
+upcountry/M
+update/MGDRS
+updraft/MS
+upend/SGD
+upfront
+upgrade/MGDS
+upheaval/MS
+upheld
+uphill/MS
+uphold/ZGRS
+upholder/M
+upholster/ASGD
+upholsterer/MS
+upholstery/M
+upkeep/M
+upland/MS
+uplift/JSMDG
+upload/SDG
+upmarket
+upmost
+upon
+upped
+upper/SM
+uppercase/M
+upperclassman/M
+upperclassmen
+upperclasswoman
+upperclasswomen
+uppercut/MS
+uppercutting
+uppermost
+upping
+uppish
+uppity
+upraise/DSG
+uprear/GSD
+upright/MYPS
+uprightness/M
+uprising/SM
+upriver
+uproar/SM
+uproarious/Y
+uproot/GSD
+upscale
+upset/SM
+upsetting
+upshot/SM
+upside/SM
+upsilon/MS
+upstage/GDS
+upstairs
+upstanding
+upstart/MDSG
+upstate/M
+upstream
+upstroke/SM
+upsurge/MGDS
+upswing/MS
+uptake/SM
+uptempo
+upthrust/GSM
+uptick/SM
+uptight
+uptown/M
+uptrend
+upturn/GSMD
+upward/SY
+upwind
+uracil/M
+uranium/M
+urban
+urbane/RYT
+urbanity/M
+urbanization/M
+urbanize/DSG
+urbanologist/MS
+urbanology/M
+urchin/SM
+urea/M
+uremia/M
+uremic
+ureter/SM
+urethane/M
+urethra/M
+urethrae
+urethral
+urge/MGDS
+urgency/M
+urgent/Y
+uric
+urinal/SM
+urinalyses
+urinalysis/M
+urinary
+urinate/GNDS
+urination/M
+urine/M
+urn/SM
+urogenital
+urological
+urologist/MS
+urology/M
+ursine
+urticaria/M
+usability/M
+usable/UA
+usage/SM
+use/AEDSMG
+used/U
+useful/PY
+usefulness/M
+useless/YP
+uselessness/M
+user/MS
+username/MS
+usher/SMDG
+usherette/SM
+usu
+usual's
+usual/UY
+usurer/SM
+usurious
+usurp/SDRZG
+usurpation/M
+usurper/M
+usury/M
+utensil/SM
+uteri
+uterine
+uterus/M
+utilitarian/MS
+utilitarianism/M
+utility/SM
+utilization/M
+utilize/GBDS
+utmost/M
+utopia/SM
+utter/SDYG
+utterance/SM
+uttermost/M
+uveitis
+uvula/SM
+uvular/MS
+uxorious
+v/AS
+vac/S
+vacancy/SM
+vacant/Y
+vacate/DSG
+vacation/ZGMDRS
+vacationer/M
+vacationist/SM
+vaccinate/GNDSX
+vaccination/M
+vaccine/SM
+vacillate/XGNDS
+vacillation/M
+vacuity/M
+vacuole/MS
+vacuous/YP
+vacuousness/M
+vacuum/GSMD
+vagabond/SMDG
+vagabondage/M
+vagarious
+vagary/SM
+vagina/SM
+vaginae
+vaginal/Y
+vaginitis
+vagrancy/M
+vagrant/MS
+vague/RYTP
+vagueness/M
+vagus
+vain/RYT
+vainglorious/Y
+vainglory/M
+val
+valance/MS
+vale/MS
+valediction/MS
+valedictorian/SM
+valedictory/SM
+valence/MS
+valency/SM
+valentine/SM
+valet/SMDG
+valetudinarian/MS
+valetudinarianism/M
+valiance/M
+valiant/Y
+valid/Y
+validate/IGNDS
+validation/IM
+validations
+validity/IM
+validness/M
+valise/SM
+valley/SM
+valor/M
+valorous/Y
+valuable/MS
+valuate/DSG
+valuation/CAMS
+value's
+value/CAGSD
+valueless
+valuer/SM
+valve/DSMG
+valveless
+valvular
+vamoose/DSG
+vamp/AMDGS
+vampire/SM
+van/SM
+vanadium/M
+vandal/SM
+vandalism/M
+vandalize/DSG
+vane/MS
+vanguard/MS
+vanilla/SM
+vanish/JDSG
+vanity/SM
+vanned
+vanning
+vanquish/ZGDRS
+vanquisher/M
+vantage/SM
+vape/GDS
+vapid/YP
+vapidity/M
+vapidness/M
+vapor/SM
+vaporization/M
+vaporize/DRSZG
+vaporizer/M
+vaporous
+vaporware
+vapory
+vaquero/MS
+var/S
+variability/IM
+variable/ISM
+variably/I
+variance/SM
+variant/MS
+variate/NX
+variation/M
+varicolored
+varicose
+varied/U
+variegate/DSGN
+variegation/M
+varietal/SM
+variety/SM
+various/Y
+varlet/SM
+varmint/MS
+varnish/GMDS
+varnished/U
+varsity/SM
+vary/DSG
+varying/U
+vascular
+vase/MS
+vasectomy/SM
+vasoconstriction
+vasomotor
+vassal/SM
+vassalage/M
+vast/MRYTSP
+vastness/M
+vat/SM
+vatted
+vatting
+vaudeville/M
+vaudevillian/MS
+vault/SMDRZG
+vaulter/M
+vaulting/M
+vaunt/SMDG
+vb
+veal/M
+vector/SGMD
+veejay/SM
+veep/MS
+veer/MDGS
+veg/M
+vegan/SM
+veganism
+vegeburger/S
+veges
+vegetable/SM
+vegetarian/SM
+vegetarianism/M
+vegetate/GNVDS
+vegetation/M
+vegged
+vegges
+veggie/SM
+veggieburger/S
+vegging
+vehemence/M
+vehemency/M
+vehement/Y
+vehicle/MS
+vehicular
+veil's
+veil/UDGS
+vein/MDGS
+vela
+velar/SM
+veld/MS
+vellum/M
+velocipede/MS
+velocity/SM
+velodrome/S
+velour/MS
+velum/M
+velvet/M
+velveteen/M
+velvety
+venal/Y
+venality/M
+venation/M
+vend/DGS
+vendetta/SM
+vendible
+vendor/MS
+veneer/MDGS
+venerability/M
+venerable
+venerate/DSGN
+veneration/M
+venereal
+vengeance/M
+vengeful/AY
+venial
+venireman/M
+veniremen
+venison/M
+venom/M
+venomous/Y
+venous
+vent's
+vent/DGS
+ventilate/GNDS
+ventilation/M
+ventilator/SM
+ventilatory
+ventral
+ventricle/SM
+ventricular
+ventriloquism/M
+ventriloquist/SM
+ventriloquy/M
+venture/DSMG
+venturesome/PY
+venturesomeness/M
+venturous/PY
+venturousness/M
+venue/ASM
+veracious/Y
+veracity/M
+veranda/SM
+verapamil
+verb/KMS
+verbal/MYS
+verbalization/M
+verbalize/GDS
+verbatim
+verbena/SM
+verbiage/MS
+verbose/Y
+verbosity/M
+verboten
+verdant/Y
+verdict/SM
+verdigris/GMDS
+verdure/M
+verge's
+verge/FDSG
+verger/MS
+verifiable/U
+verification/M
+verified/U
+verify/DSNG
+verily
+verisimilitude/M
+veritable
+veritably
+verity/SM
+vermicelli/M
+vermiculite/M
+vermiform
+vermilion/M
+vermin/M
+verminous
+vermouth/M
+vernacular/MS
+vernal
+vernier/SM
+veronica/M
+verruca/SM
+verrucae
+versa
+versatile
+versatility/M
+verse/AFNGMSDX
+versed/U
+versification/M
+versifier/M
+versify/ZGNDRS
+version/AFIMS
+versioned
+versioning
+verso/SM
+versus
+vert/A
+vertebra/M
+vertebrae
+vertebral
+vertebrate/IMS
+vertex/MS
+vertical/MYS
+vertices
+vertiginous
+vertigo/M
+verve/M
+very/RT
+vesicle/SM
+vesicular
+vesiculate
+vesper/MS
+vessel/MS
+vest's
+vest/ILDGS
+vestal/MS
+vestibule/MS
+vestige/SM
+vestigial/Y
+vesting/M
+vestment/IMS
+vestry/SM
+vestryman/M
+vestrymen
+vet/SM
+vetch/MS
+veteran/SM
+veterinarian/MS
+veterinary/SM
+veto/MDG
+vetoes
+vetted
+vetting
+vex/GDS
+vexation/SM
+vexatious/Y
+vhf
+vi
+via
+viability/M
+viable
+viably
+viaduct/SM
+vial/MS
+viand/SM
+vibe/MS
+vibes/M
+vibraharp/SM
+vibrancy/M
+vibrant/Y
+vibraphone/MS
+vibraphonist/MS
+vibrate/GNDSX
+vibration/M
+vibrato/MS
+vibrator/SM
+vibratory
+viburnum/SM
+vicar/SM
+vicarage/SM
+vicarious/YP
+vicariousness/M
+vice/CMS
+viced
+vicegerent/SM
+vicennial
+viceregal
+viceroy/MS
+vichyssoise/M
+vicing
+vicinity/M
+vicious/YP
+viciousness/M
+vicissitude/SM
+victim/MS
+victimization/M
+victimize/GDS
+victimless
+victor/MS
+victorious/Y
+victory/SM
+victual/SMDG
+vicuna/MS
+videlicet
+video/GSMD
+videocassette/SM
+videoconferencing
+videodisc/MS
+videophone/MS
+videotape/DSMG
+videotex
+vie/DS
+view/AMDRSZG
+viewable
+viewer/AM
+viewership/M
+viewfinder/SM
+viewing/SM
+viewpoint/MS
+vigesimal
+vigil/SM
+vigilance/M
+vigilant/Y
+vigilante/SM
+vigilantism/M
+vigilantist/M
+vignette/DSMG
+vignettist/MS
+vigor/M
+vigorous/Y
+vii
+viii
+viking/MS
+vile/YTPR
+vileness/M
+vilification/M
+vilify/DSNG
+villa/SM
+village/RSMZ
+villager/M
+villain/SM
+villainous
+villainy/SM
+villein/SM
+villeinage/M
+villi
+villus/M
+vim/M
+vinaigrette/M
+vincible/I
+vindicate/XDSGN
+vindication/M
+vindicator/MS
+vindictive/PY
+vindictiveness/M
+vine/MS
+vinegar/M
+vinegary
+vineyard/MS
+vino/M
+vinous
+vintage/MS
+vintner/MS
+vinyl/SM
+viol/MBS
+viola/SM
+violable/I
+violate/GNDSX
+violation/M
+violator/SM
+violence/M
+violent/Y
+violet/MS
+violin/MS
+violincello/S
+violinist/SM
+violist/MS
+violoncellist/SM
+violoncello/MS
+viper/SM
+viperous
+virago/M
+viragoes
+viral
+vireo/SM
+virgin/MS
+virginal/SM
+virginity/M
+virgule/MS
+virile
+virility/M
+virologist/SM
+virology/M
+virtual/Y
+virtualization
+virtue/SM
+virtuosity/M
+virtuoso/M
+virtuous/YP
+virtuousness/M
+virulence/M
+virulent/Y
+virus/MS
+visa/MDSG
+visage/MS
+viscera
+visceral/Y
+viscid
+viscose/M
+viscosity/M
+viscount/SM
+viscountcy/SM
+viscountess/MS
+viscous
+viscus/M
+vise/ACMGDS
+visibility/IM
+visible/I
+visibly/I
+vision/KGDSM
+visionary/SM
+visit's
+visit/ASGD
+visitant/MS
+visitation/MS
+visitor/MS
+visor/SM
+vista/SM
+visual/SMY
+visualization/SM
+visualize/DRSZG
+visualizer/M
+vita/M
+vitae
+vital/SY
+vitality/M
+vitalization/AM
+vitalize/CAGSD
+vitals/M
+vitamin/MS
+vitiate/GNDS
+vitiation/M
+viticulture/M
+viticulturist/MS
+vitreous
+vitrifaction/M
+vitrification/M
+vitrify/GNDS
+vitrine/SM
+vitriol/M
+vitriolic
+vitriolically
+vittles/M
+vituperate/GNVDS
+vituperation/M
+viva/MS
+vivace
+vivacious/PY
+vivaciousness/M
+vivacity/M
+vivaria
+vivarium/SM
+vivid/RYTP
+vividness/M
+vivify/ADSG
+viviparous
+vivisect/DGS
+vivisection/M
+vivisectional
+vivisectionist/SM
+vixen/SM
+vixenish/Y
+viz
+vizier/SM
+vlf
+vocab
+vocable/MS
+vocabulary/SM
+vocal/SMY
+vocalic
+vocalist/SM
+vocalization/MS
+vocalize/DSG
+vocation/FIKASM
+vocational/Y
+vocative/MS
+vociferate/DSGN
+vociferation/M
+vociferous/YP
+vociferousness/M
+vodka/SM
+vogue/SM
+voguish
+voice/IDSMG
+voiced/U
+voiceless/PY
+voicelessness/M
+voicemail/SM
+void/MDSGB
+voila
+voile/M
+vol/S
+volatile
+volatility/M
+volatilize/DSG
+volcanic
+volcanism
+volcano/M
+volcanoes
+vole/MS
+volition/M
+volitional
+volley/GSMD
+volleyball/MS
+volt/AMS
+voltage/MS
+voltaic
+voltmeter/SM
+volubility/M
+voluble
+volubly
+volume/SM
+volumetric
+voluminous/YP
+voluminousness/M
+voluntarily/I
+voluntarism/M
+voluntary/SM
+volunteer/SGMD
+volunteerism/M
+voluptuary/SM
+voluptuous/PY
+voluptuousness/M
+volute/SM
+vomit/SMDG
+voodoo/GSMD
+voodooism/M
+voracious/PY
+voraciousness/M
+voracity/M
+vortex/MS
+votary/SM
+vote's
+vote/CGVDS
+voter/SM
+vouch/DRSZG
+voucher/M
+vouchsafe/DSG
+vow/SGMD
+vowel/SM
+voyage/MZGDRS
+voyager/M
+voyageur/SM
+voyeur/MS
+voyeurism/M
+voyeuristic
+vulcanization/M
+vulcanize/GDS
+vulgar/RYT
+vulgarian/MS
+vulgarism/MS
+vulgarity/SM
+vulgarization/M
+vulgarize/ZGDRS
+vulgarizer/M
+vulnerabilities
+vulnerability/IM
+vulnerable/I
+vulnerably/I
+vulpine
+vulture/SM
+vulturous
+vulva/M
+vulvae
+vuvuzela/MS
+vying
+w/DNXTGVJ
+wabbit/S
+wack/MRTS
+wackiness/M
+wacko/SM
+wacky/RPT
+wad/SZGMDR
+wadded
+wadding/M
+waddle/DSMG
+wade/MS
+wader/M
+waders/M
+wadge/S
+wadi/MS
+wafer/SM
+waffle/MZGDRS
+waffler/M
+waft/MDGS
+wag/SZGMDR
+wage/MS
+waged/U
+wager/ZGMDR
+wagerer/M
+wagged
+waggery/SM
+wagging
+waggish/YP
+waggishness/M
+waggle/MGDS
+wagon/ZSMR
+wagoner/M
+wagtail/SM
+waif/MS
+wail/MDRZGS
+wailer/M
+wailing/M
+wain/MS
+wainscot/SJMDG
+wainscoting/M
+wainwright/MS
+waist/SM
+waistband/MS
+waistcoat/MS
+waistline/MS
+wait/MDRZGS
+waiter/M
+waiting/M
+waitperson/MS
+waitress/MS
+waitstaff/M
+waive/DRSZG
+waiver/M
+wake/MGJDS
+wakeful/PY
+wakefulness/M
+waken/GSD
+waldo/S
+waldoes
+wale/MGDS
+walk/MDRZGS
+walkabout/S
+walkaway/MS
+walker/M
+walkies
+walking/M
+walkout/SM
+walkover/MS
+walkway/SM
+wall/MDGS
+wallaby/SM
+wallah
+wallahs
+wallboard/M
+wallet/MS
+walleye/DSM
+wallflower/MS
+wallop/MDSJG
+walloping/M
+wallow/MDSG
+wallpaper/SMDG
+wally/S
+walnut/MS
+walrus/MS
+waltz/ZGMDRS
+waltzer/M
+wampum/M
+wan/GPDY
+wand/MS
+wander/DRSJZG
+wanderer/M
+wanderings/M
+wanderlust/SM
+wane/MS
+wangle/MZGDRS
+wangler/M
+wank/DRZGS
+wanna
+wannabe/SM
+wannabee/S
+wanner
+wanness/M
+wannest
+want/MDGS
+wanted/U
+wanton/MDYSPG
+wantonness/M
+wapiti/MS
+war/SM
+warble/MZGDRS
+warbler/M
+warbonnet/SM
+ward/AMDGS
+warden/MS
+warder/MS
+wardress/S
+wardrobe/SM
+wardroom/SM
+ware/MS
+warehouse/DSMG
+warez
+warfare/M
+warfarin
+warhead/MS
+warhorse/SM
+warily/U
+wariness/UM
+warlike
+warlock/MS
+warlord/MS
+warm/PDRYHZTGS
+warmblooded
+warmer/M
+warmhearted/P
+warmheartedness/M
+warmish
+warmness/M
+warmonger/SMG
+warmongering/M
+warmth/M
+warn/JDGS
+warning/M
+warp/MDGS
+warpaint
+warpath/M
+warpaths
+warplane/MS
+warrant/GMDS
+warranted/U
+warranty/DSMG
+warred
+warren/MS
+warring
+warrior/SM
+warship/SM
+wart/MS
+warthog/SM
+wartime/M
+warty/TR
+wary/UPRT
+was
+wasabi
+wash/BJMDRSZG
+washable/SM
+washbasin/SM
+washboard/SM
+washbowl/SM
+washcloth/M
+washcloths
+washed/U
+washer/M
+washerwoman/M
+washerwomen
+washing/M
+washout/MS
+washrag/MS
+washroom/MS
+washstand/SM
+washtub/MS
+washy/TR
+wasn't
+wasp/MS
+waspish/YP
+waspishness/M
+wassail/SMDG
+wast
+wastage/M
+waste/DRSMZG
+wastebasket/MS
+wasteful/PY
+wastefulness/M
+wasteland/SM
+wastepaper/M
+waster/M
+wastewater
+wastrel/SM
+watch/BZGMDRS
+watchable/U
+watchband/MS
+watchdog/SM
+watcher/M
+watchful/YP
+watchfulness/M
+watchmaker/MS
+watchmaking/M
+watchman/M
+watchmen
+watchstrap/S
+watchtower/SM
+watchword/MS
+water/GSMD
+waterbed/MS
+waterbird/SM
+waterboard/MDJSG
+waterboarding/M
+waterborne
+watercolor/MS
+watercourse/SM
+watercraft/M
+watercress/M
+waterfall/SM
+waterfowl/SM
+waterfront/MS
+waterhole/SM
+wateriness/M
+waterlily/SM
+waterline/MS
+waterlogged
+watermark/MDGS
+watermelon/SM
+watermill/MS
+waterproof/SMDG
+waterproofing/M
+waters/M
+watershed/MS
+waterside/MS
+waterspout/SM
+watertight
+waterway/MS
+waterwheel/SM
+waterworks/M
+watery/PTR
+watt/MS
+wattage/M
+wattle/MGDS
+wave/MZGDRS
+waveband/S
+waveform
+wavefront
+wavelength/M
+wavelengths
+wavelet/SM
+wavelike
+waver/ZGMDR
+waverer/M
+wavering/Y
+waviness/M
+wavy/PRT
+wax/GMDNS
+waxiness/M
+waxwing/SM
+waxwork/SM
+waxy/RPT
+way/SM
+waybill/SM
+wayfarer/MS
+wayfaring/SM
+waylaid
+waylay/RSZG
+waylayer/M
+wayside/SM
+wayward/PY
+waywardness/M
+wazoo/S
+we
+we'd
+we'll
+we're
+we've
+weak/PNRYXT
+weaken/DRZG
+weakener/M
+weakfish/MS
+weakish
+weakling/SM
+weakness/MS
+weal/MHS
+wealth/M
+wealthiness/M
+wealthy/TRP
+wean/DGS
+weapon/MS
+weaponize/GDS
+weaponless
+weaponry/M
+wear/MRBJSZG
+wearable/U
+wearer/M
+wearied/U
+wearily
+weariness/M
+wearisome/Y
+weary/TGDRSP
+weasel/MDYSG
+weather/SMDG
+weatherboard/SG
+weathercock/MS
+weathering/M
+weatherization/M
+weatherize/DSG
+weatherman/M
+weathermen
+weatherperson/MS
+weatherproof/GSD
+weatherstrip/S
+weatherstripped
+weatherstripping/M
+weave/DRSMZG
+weaver/M
+weaving/M
+web/SM
+webbed
+webbing/M
+webcam/MS
+webcast/SMG
+webfeet
+webfoot/M
+webinar/SM
+webisode/MS
+weblog/MS
+webmaster/SM
+webmistress/MS
+website/SM
+wed/AS
+wedded/A
+wedder
+wedding/SM
+wedge/DSMG
+wedgie/MS
+wedlock/M
+wee/RSMT
+weed/MDRSZG
+weeder/M
+weedkiller/S
+weedless
+weedy/TR
+weeing
+week/MYS
+weekday/SM
+weekend/SZGMDR
+weekly/SM
+weeknight/SM
+ween/DSG
+weenie/MTRS
+weensy/RT
+weeny
+weep/MRJSZG
+weeper/M
+weepie
+weepy/TRSM
+weevil/MS
+weft/MS
+weigh's
+weigh/AGD
+weighbridge/S
+weighs/A
+weight/MDSJG
+weighted/U
+weightily
+weightiness/M
+weightless/YP
+weightlessness/M
+weightlifter/MS
+weightlifting/M
+weighty/PTR
+weir/MS
+weird/PTRY
+weirdie/MS
+weirdness/M
+weirdo/MS
+welcome/MGDS
+weld/MDRBSZG
+welder/M
+welfare/M
+welkin/M
+well/MDPSG
+wellhead/SM
+wellie
+wellington/MS
+wellness/M
+wellspring/MS
+welly/S
+welsh/ZGDRS
+welsher/M
+welt/MDRSZG
+welter/GMD
+welterweight/SM
+wen/M
+wench/MS
+wend/DSG
+went
+wept
+were
+weren't
+werewolf/M
+werewolves
+west/M
+westbound
+westerly/SM
+western/SZMR
+westerner/M
+westernization/M
+westernize/GDS
+westernmost
+westward/S
+wet/SMYP
+wetback/SM
+wetland/SM
+wetness/M
+wetter/SM
+wettest
+wetting
+wetware/S
+whack/SJZGMDR
+whacker/M
+whale/DRSMZG
+whaleboat/MS
+whalebone/M
+whaler/M
+whaling/M
+wham/MS
+whammed
+whamming
+whammy/SM
+wharf/M
+wharves
+what/MS
+whatchamacallit/MS
+whatever
+whatnot/M
+whatshername
+whatshisname
+whatsit/S
+whatsoever
+wheal/SM
+wheat/MN
+wheatgerm
+wheatmeal
+whee
+wheedle/DRSZG
+wheedler/M
+wheel/SMDRG
+wheelbarrow/SM
+wheelbase/SM
+wheelchair/SM
+wheelhouse/MS
+wheelie/SM
+wheelwright/MS
+wheeze/DSMG
+wheezily
+wheeziness/M
+wheezy/PRT
+whelk/SMD
+whelm/SDG
+whelp/SMDG
+when/MS
+whence
+whenever
+whensoever
+where/SM
+whereabouts/M
+whereas
+whereat
+whereby
+wherefore/MS
+wherein
+whereof
+whereon
+wheresoever
+whereto
+whereupon
+wherever
+wherewith
+wherewithal/M
+wherry/SM
+whet/S
+whether
+whetstone/SM
+whetted
+whetting
+whew
+whey/M
+which
+whichever
+whiff/SMDG
+whiffletree/MS
+while/DSMG
+whilom
+whilst
+whim/MS
+whimper/MDGS
+whimsical/Y
+whimsicality/M
+whimsy/SM
+whine/DRSMZG
+whiner/M
+whinge/DRSZG
+whingeing
+whinny/GDSM
+whiny/RT
+whip/MS
+whipcord/M
+whiplash/MS
+whipped
+whipper/MS
+whippersnapper/MS
+whippet/MS
+whipping/SM
+whippletree/SM
+whippoorwill/MS
+whipsaw/MDGS
+whir/MS
+whirl/SMDG
+whirligig/MS
+whirlpool/MS
+whirlwind/MS
+whirlybird/SM
+whirred
+whirring
+whisk/SMDRZG
+whisker/MD
+whiskery
+whiskey/MS
+whiskys
+whisper/MDRSZG
+whisperer/M
+whist/M
+whistle/MZGDRS
+whistler/M
+whit/MDNRSXTGJ
+white/SPM
+whitebait
+whiteboard/S
+whitecap/SM
+whitefish/MS
+whitehead/MS
+whitelist/GDS
+whiten/ZGDRJ
+whitener/M
+whiteness/M
+whitening/M
+whiteout/SM
+whitetail/MS
+whitewall/SM
+whitewash/MDSG
+whitewater/M
+whitey/SM
+whither
+whiting/M
+whitish
+whittle/ZGDRS
+whittler/M
+whiz/M
+whizkid/M
+whizzbang/MS
+whizzed
+whizzes
+whizzing
+who'd
+who'll
+who're
+who've
+who/M
+whoa
+whodunit/MS
+whoever
+whole/SMP
+wholefood/S
+wholegrain
+wholehearted/YP
+wholeheartedness/M
+wholemeal
+wholeness/M
+wholesale/MZGDRS
+wholesaler/M
+wholesome/UP
+wholesomely
+wholesomeness/UM
+wholewheat
+wholly
+whom
+whomever
+whomsoever
+whoop/SMDRZG
+whoopee/S
+whooper/M
+whoosh/MDSG
+whop/S
+whopped
+whopper/SM
+whopping
+whore/SMG
+whorehouse/MS
+whoreish
+whorish
+whorl/SMD
+whose
+whoso
+whosoever
+whup/S
+whupped
+whupping
+why'd
+why/M
+whys
+wick/MDRSZ
+wicked/TPRY
+wickedness/M
+wicker/M
+wickerwork/M
+wicket/SM
+wide/YTRP
+widemouthed
+widen/SDRZG
+widener/M
+wideness/M
+widescreen/MS
+widespread
+widget/S
+widow/SMDRZG
+widower/M
+widowhood/M
+width/M
+widths
+wield/SDRZG
+wielder/M
+wiener/SM
+wienie/SM
+wife/MY
+wifeless
+wig/SM
+wigeon/M
+wigged
+wigging
+wiggle/DRSMZG
+wiggler/M
+wiggly/TR
+wight/SM
+wiglet/SM
+wigwag/SM
+wigwagged
+wigwagging
+wigwam/SM
+wiki/MS
+wild/MRYSTP
+wildcard/MS
+wildcat/MS
+wildcatted
+wildcatter/MS
+wildcatting
+wildebeest/MS
+wilderness/MS
+wildfire/MS
+wildflower/SM
+wildfowl/M
+wildlife/M
+wildness/M
+wilds/M
+wile/MGDS
+wiliness/M
+will/MDS
+willful/PY
+willfulness/M
+willies/M
+willing/UPY
+willingness/UM
+williwaw/MS
+willow/SM
+willowy
+willpower/M
+willy/S
+wilt/MDSG
+wily/RTP
+wimp/MDSG
+wimpish
+wimple/DSMG
+wimpy/RT
+win/SGMD
+wince/DSMG
+winch/MDSG
+wind's
+wind/UASG
+windbag/SM
+windblown
+windbreak/SZMR
+windbreaker/M
+windburn/MD
+windcheater/S
+windchill/M
+winded
+winder/SM
+windfall/MS
+windflower/MS
+windily
+windiness/M
+winding's
+windjammer/SM
+windlass/MS
+windless
+windmill/MDGS
+window/SMDG
+windowless
+windowpane/SM
+windowsill/SM
+windpipe/MS
+windproof
+windrow/SM
+windscreen/SM
+windshield/SM
+windsock/MS
+windstorm/MS
+windsurf/ZGDRS
+windsurfer/M
+windsurfing/M
+windswept
+windup/SM
+windward/M
+windy/RTP
+wine/MS
+wineglass/MS
+winegrower/MS
+winemaker/MS
+winery/SM
+wing/MDRZG
+wingding/MS
+wingless
+winglike
+wingnut/SM
+wingspan/MS
+wingspread/SM
+wingtip/SM
+wink/MDRSZG
+winker/M
+winkle/DSMG
+winnable/U
+winner/SM
+winning/MYS
+winnow/ZGSDR
+winnower/M
+wino/MS
+winsome/YTRP
+winsomeness/M
+winter/GSMD
+wintergreen/M
+winterize/GDS
+wintertime/M
+wintry/TR
+winy/RT
+wipe/MZGDRS
+wiper/M
+wire's
+wire/AGDS
+wired/S
+wirehair/MS
+wireless/MS
+wiretap/MS
+wiretapped
+wiretapper/SM
+wiretapping/M
+wiriness/M
+wiring/M
+wiry/RTP
+wisdom/M
+wise/MYTGDRS
+wiseacre/SM
+wisecrack/MDSG
+wiseguy/S
+wish/MDRSZG
+wishbone/SM
+wisher/M
+wishful/Y
+wishlist's
+wisp/MS
+wispy/RT
+wist
+wisteria/SM
+wistful/YP
+wistfulness/M
+wit/SM
+witch/MDSG
+witchcraft/M
+witchery/M
+with
+withal
+withdraw/SG
+withdrawal/MS
+withdrawn
+withdrew
+withe/DRSMZG
+wither/JGD
+withering/Y
+withers/M
+withheld
+withhold/SG
+withholding/M
+within/M
+without
+withstand/GS
+withstood
+witless/PY
+witlessness/M
+witness/MDSG
+wits/M
+witted
+witter/SGD
+witticism/SM
+wittily
+wittiness/M
+witting/UY
+witty/RPT
+wive/GDS
+wiz
+wizard/SMY
+wizardry/M
+wizened
+wk/Y
+woad/M
+wobble/MGDS
+wobbliness/M
+wobbly/RTP
+wodge/S
+woe/SM
+woebegone
+woeful/YP
+woefuller
+woefullest
+woefulness/M
+wog/S
+wok/SMN
+woke
+wold/MS
+wolf/MDSG
+wolfhound/SM
+wolfish
+wolfram/M
+wolverine/SM
+wolves
+woman/M
+womanhood/M
+womanish
+womanize/DRSZG
+womanizer/M
+womankind/M
+womanlike/M
+womanliness/M
+womanly/RPT
+womb/MS
+wombat/MS
+womble/S
+women/M
+womenfolk/SM
+womenfolks/M
+won't
+won/M
+wonder/MDGLS
+wonderful/YP
+wonderfulness/M
+wondering/Y
+wonderland/MS
+wonderment/M
+wondrous/Y
+wonk/MS
+wonky/TR
+wont/MD
+wonted/U
+woo/SZGDR
+wood/MDNSG
+woodbine/M
+woodblock/MS
+woodcarver/MS
+woodcarving/SM
+woodchuck/MS
+woodcock/SM
+woodcraft/M
+woodcut/SM
+woodcutter/SM
+woodcutting/M
+wooden/RYTP
+woodenness/M
+woodiness/M
+woodland/SM
+woodlice
+woodlot/SM
+woodlouse
+woodman/M
+woodmen
+woodpecker/MS
+woodpile/SM
+woods/M
+woodshed/SM
+woodsiness/M
+woodsman/M
+woodsmen
+woodsy/RTP
+woodwind/MS
+woodwork/MRZG
+woodworker/M
+woodworking/M
+woodworm/S
+woody/TPRSM
+wooer/M
+woof/MDRSZG
+woofer/M
+wool/MNX
+woolen/M
+woolgathering/M
+wooliness
+woolliness/M
+woolly/RSMPT
+woozily
+wooziness/M
+woozy/TRP
+wop/S!
+word's
+word/ADSG
+wordage/M
+wordbook/SM
+wordily
+wordiness/M
+wording/SM
+wordless/Y
+wordplay/M
+wordsmith
+wordsmiths
+wordy/TPR
+wore
+work's
+work/ADJSG
+workable/U
+workaday
+workaholic/SM
+workaround/S
+workbasket/S
+workbench/MS
+workbook/MS
+workday/SM
+worker/MS
+workfare/M
+workflow/MS
+workforce/M
+workhorse/SM
+workhouse/SM
+working's
+workingman/M
+workingmen
+workings/M
+workingwoman/M
+workingwomen
+workload/MS
+workman/M
+workmanlike
+workmanship/M
+workmate/S
+workmen
+workout/SM
+workplace/MS
+workroom/MS
+works/M
+worksheet/MS
+workshop/MS
+workshy
+worksite/S
+workspace
+workstation/MS
+worktable/MS
+worktop/S
+workup/MS
+workweek/SM
+world/SM
+worldlier
+worldliness/UM
+worldly/UTP
+worldview/SM
+worldwide
+worm/MDSG
+wormhole/MS
+wormwood/M
+wormy/TR
+worn/U
+worried/Y
+worrier/M
+worriment/M
+worrisome
+worry/ZGDRSMJ
+worrying/Y
+worrywart/SM
+worse/M
+worsen/DSG
+worship/ZGSMDR
+worshiper/M
+worshipful
+worst/SGMD
+worsted/M
+wort/M
+worth/M
+worthies
+worthily/U
+worthiness/UM
+worthless/PY
+worthlessness/M
+worthwhile
+worthy's
+worthy/UPRT
+wot
+wotcha
+would've
+would/S
+wouldn't
+wouldst
+wound/SGMDR
+wove/A
+woven/AU
+wow/SGMD
+wpm
+wrack/GSMD
+wraith/M
+wraiths
+wrangle/DRSMZGJ
+wrangler/M
+wrap's
+wrap/US
+wraparound/SM
+wrapped/U
+wrapper/SM
+wrapping/MS
+wrasse/MS
+wrath/M
+wrathful/Y
+wreak/SGD
+wreath/MDSG
+wreathe
+wreaths
+wreck/SZGMDR
+wreckage/M
+wrecker/M
+wren/MS
+wrench/MDSG
+wrest/SGMD
+wrestle/MZGDRS
+wrestler/M
+wrestling/M
+wretch/MS
+wretched/TPRY
+wretchedness/M
+wriggle/MZGDRS
+wriggler/M
+wriggly
+wright/MS
+wring/SZGMR
+wringer/M
+wrinkle/MGDS
+wrinkled/U
+wrinkly/TRSM
+wrist/SM
+wristband/MS
+wristwatch/MS
+writ/MRBJSZG
+write/S
+writer/M
+writhe/MGDS
+writing/M
+written/AU
+wrong/STGMPDRY
+wrongdoer/SM
+wrongdoing/SM
+wrongful/PY
+wrongfulness/M
+wrongheaded/YP
+wrongheadedness/M
+wrongness/M
+wrote/A
+wroth
+wrought
+wrung
+wry/Y
+wryer
+wryest
+wryness/M
+wt
+wunderkind/S
+wurst/SM
+wuss/MS
+wussy/RSMT
+x
+xci
+xcii
+xciv
+xcix
+xcvi
+xcvii
+xenon/M
+xenophobe/MS
+xenophobia/M
+xenophobic
+xerographic
+xerography/M
+xerox/MDSG
+xi/SM
+xii
+xiii
+xiv
+xix
+xor
+xref/S
+xterm/M
+xv
+xvi
+xvii
+xviii
+xx
+xxi
+xxii
+xxiii
+xxiv
+xxix
+xxv
+xxvi
+xxvii
+xxviii
+xxx
+xxxi
+xxxii
+xxxiii
+xxxiv
+xxxix
+xxxv
+xxxvi
+xxxvii
+xxxviii
+xylem/M
+xylene
+xylophone/SM
+xylophonist/MS
+y'all
+y/F
+ya
+yacht/SMDG
+yachting/M
+yachtsman/M
+yachtsmen
+yachtswoman/M
+yachtswomen
+yahoo/SM
+yak/SM
+yakked
+yakking
+yam/SM
+yammer/SZGMDR
+yammerer/M
+yang/M
+yank/MDSG
+yap/SM
+yapped
+yapping
+yard/MS
+yardage/MS
+yardarm/MS
+yardman/M
+yardmaster/MS
+yardmen
+yardstick/MS
+yarmulke/SM
+yarn/MS
+yarrow/M
+yashmak/S
+yaw/SGMD
+yawl/MS
+yawn/MDRSZG
+yawner/M
+yaws/M
+yd
+ye/RST
+yea/SM
+yeah/M
+yeahs
+year/MYS
+yearbook/MS
+yearling/MS
+yearlong
+yearly/SM
+yearn/GSJD
+yearning/M
+yeast/SM
+yeasty/RT
+yegg/MS
+yell/MDSG
+yellow/MDRTGPS
+yellowhammer/S
+yellowish
+yellowness/M
+yellowy
+yelp/MDSG
+yen/SM
+yeoman/M
+yeomanry/M
+yeomen
+yep/SM
+yes/MS
+yeshiva/SM
+yessed
+yessing
+yesterday/MS
+yesteryear/M
+yet
+yeti/MS
+yew/SM
+yid/S
+yield/JSGMD
+yikes
+yin/M
+yip/SM
+yipe
+yipped
+yippee
+yipping
+yo
+yob/S
+yobbo/S
+yodel/SMDRZG
+yodeler/M
+yoga/M
+yogi/MS
+yogic
+yogurt/SM
+yoke's
+yoke/UGDS
+yokel/SM
+yolk/MDS
+yon
+yonder
+yonks
+yore/M
+you'd
+you'll
+you're
+you've
+you/SMH
+young/TMR
+youngish
+youngster/MS
+your/S
+yourself
+yourselves
+youth/M
+youthful/YP
+youthfulness/M
+youths
+yow
+yowl/MDSG
+yr/S
+ytterbium/M
+yttrium/M
+yuan/M
+yucca/SM
+yuck
+yucky/TR
+yuk/SM
+yukked
+yukking
+yukky
+yule/M
+yuletide/M
+yum
+yummy/TR
+yup/SM
+yuppie/MS
+yuppify/GDS
+yurt/MS
+z/DNXTGJ
+zaniness/M
+zany/RSMPT
+zap/SM
+zapped
+zapper/MS
+zapping
+zappy
+zeal/M
+zealot/MS
+zealotry/M
+zealous/YP
+zealousness/M
+zebra/SM
+zebu/MS
+zed/SM
+zeitgeist/SM
+zenith/M
+zeniths
+zenned
+zeolite/S
+zephyr/MS
+zeppelin/MS
+zero/MDHSG
+zeroes
+zest/MS
+zestful/YP
+zestfulness/M
+zesty/RT
+zeta/MS
+zigzag/SM
+zigzagged
+zigzagging
+zilch/M
+zillion/MS
+zinc/MS
+zincked
+zincking
+zine/S
+zinfandel/M
+zing/MDRZG
+zinger/M
+zingy/RT
+zinnia/MS
+zip's
+zip/US
+zipped/U
+zipper/MDGS
+zipping/U
+zippy/TR
+zircon/MS
+zirconium/M
+zit/SM
+zither/MS
+zloty/SM
+zlotys
+zodiac/MS
+zodiacal
+zombie/MS
+zonal/Y
+zone's
+zone/AGDS
+zoning/M
+zonked
+zoo/SM
+zookeeper/SM
+zoological/Y
+zoologist/SM
+zoology/M
+zoom/MDSG
+zoophyte/SM
+zoophytic
+zooplankton
+zorch
+zoster
+zounds
+zucchini/MS
+zwieback/M
+zydeco/M
+zygote/SM
+zygotic
+zymurgy/M
diff --git a/crates/ide-spell/src/dict/software.txt b/crates/ide-spell/src/dict/software.txt
new file mode 100644
index 000000000..0a92977c9
--- /dev/null
+++ b/crates/ide-spell/src/dict/software.txt
@@ -0,0 +1,463 @@
+# Programming terms the en_US dictionary lacks (IDEA bundles a similar "software terms" list).
+# One lowercase word per line; checked case-insensitively.
+abi
+accessor
+accessors
+addr
+admin
+aggregator
+alloc
+allocator
+amd
+analytics
+api
+apis
+app
+apps
+arg
+argc
+args
+argv
+arity
+arm
+async
+atomics
+attr
+attrs
+auth
+authn
+authz
+autocomplete
+autoload
+backend
+backends
+backoff
+backtrace
+bitfield
+bitflags
+bitmask
+bitset
+bitwise
+blob
+blobs
+bool
+boolean
+booleans
+borrowck
+bundler
+buf
+bufs
+builtin
+builtins
+bytecode
+cacheable
+callback
+callbacks
+callee
+callees
+callsite
+cfg
+changelog
+changeset
+charset
+checkbox
+checksum
+chmod
+chown
+cli
+codebase
+codec
+codegen
+codepoint
+codepoints
+color
+colors
+colorize
+combinator
+combinators
+commandline
+config
+configs
+configurable
+const
+consts
+constexpr
+coroutine
+coroutines
+cpu
+cpus
+crate
+crates
+css
+csv
+ctor
+ctx
+ctrl
+cwd
+daemon
+dao
+datagram
+dataset
+datasource
+datatype
+datetime
+db
+dbg
+dealloc
+debounce
+debounced
+debouncer
+decl
+decls
+decrement
+dedup
+dedupe
+deduplicate
+deinit
+del
+delim
+deps
+deque
+deref
+dereference
+deserialization
+deserialize
+deserialized
+deserializer
+desc
+dest
+dev
+devs
+dict
+dicts
+diff
+diffs
+dir
+dirs
+dirname
+dll
+dns
+docstring
+docstrings
+dom
+dtor
+dto
+dyn
+elem
+elems
+enum
+enums
+env
+envs
+eof
+eol
+eq
+errno
+esc
+eval
+exe
+expr
+exprs
+ext
+failover
+fallback
+fallthrough
+favicon
+fd
+fds
+fifo
+filename
+filenames
+filepath
+filesystem
+filesystems
+filetype
+fixme
+fmt
+fn
+fns
+foo
+bar
+baz
+qux
+frontend
+fs
+func
+funcs
+gc
+getter
+getters
+gettext
+github
+gitignore
+glob
+globals
+globbing
+goroutine
+goroutines
+gpu
+grpc
+gui
+gzip
+hardcode
+hardcoded
+hashable
+hashmap
+hashset
+hasher
+heapify
+hex
+hostname
+href
+html
+http
+https
+hunspell
+iframe
+ident
+idx
+impl
+impls
+init
+inits
+initializer
+inline
+inlined
+inlining
+int
+ints
+io
+iter
+iterable
+iterables
+iters
+javadoc
+jit
+js
+json
+jsx
+jwt
+kotlin
+kwargs
+lambda
+lambdas
+len
+lexer
+lhs
+lib
+libc
+libs
+linter
+localhost
+lookahead
+lookbehind
+lookup
+lookups
+lsp
+lvalue
+malloc
+markdown
+memcpy
+memoize
+memoized
+metadata
+middleware
+minified
+minify
+mixin
+mixins
+mmap
+modal
+monorepo
+msg
+msgs
+multiline
+mut
+mutex
+mutexes
+namespace
+namespaced
+namespaces
+nav
+nginx
+noop
+npm
+nullable
+num
+nums
+oauth
+obj
+objs
+offscreen
+ok
+opcode
+opcodes
+os
+param
+params
+parsable
+parser
+parsers
+passthrough
+pathname
+pid
+pids
+pixmap
+placeholder
+plugin
+plugins
+png
+popup
+popups
+postfix
+pre
+precompute
+precomputed
+prefetch
+preload
+prepend
+prepended
+printf
+println
+proc
+procs
+protobuf
+proxied
+ptr
+ptrs
+pubsub
+py
+quickfix
+rect
+rects
+redis
+refactor
+refactored
+refactoring
+refactorings
+regex
+regexes
+regexp
+renderer
+repl
+repo
+repos
+req
+res
+resize
+resizable
+resolver
+resp
+rhs
+rpc
+runnable
+runtime
+runtimes
+rustc
+rustfmt
+rvalue
+scalability
+schemas
+scrollbar
+sdk
+sdks
+semver
+serializable
+serialization
+serializer
+setter
+setters
+sha
+shader
+signup
+sizeof
+smtp
+sql
+sqlite
+src
+ssh
+ssl
+stacktrace
+stderr
+stdin
+stdio
+stdlib
+stdout
+str
+strs
+struct
+structs
+subclass
+subclasses
+subcommand
+subcommands
+subdirectory
+subdirectories
+submodule
+submodules
+subprocess
+subtree
+svg
+symlink
+symlinks
+sync
+syscall
+syscalls
+tcp
+templating
+termination
+timestamp
+timestamps
+tls
+tmp
+todo
+todos
+tokenize
+tokenized
+tokenizer
+toml
+toolchain
+toolchains
+toolbar
+tooltip
+tooltips
+tsx
+tuple
+tuples
+txt
+typeof
+ui
+uid
+uint
+unary
+unicode
+unix
+unmount
+unregister
+unset
+unsubscribe
+untracked
+uri
+uris
+url
+urls
+usize
+utf
+util
+utils
+uuid
+val
+vals
+var
+vars
+vec
+vecs
+viewport
+vm
+whitespace
+wildcard
+workspace
+workspaces
+xml
+yaml
+yml
diff --git a/crates/ide-spell/src/lib.rs b/crates/ide-spell/src/lib.rs
new file mode 100644
index 000000000..f8cb34e08
--- /dev/null
+++ b/crates/ide-spell/src/lib.rs
@@ -0,0 +1,338 @@
+//! Spell checking for IDEA's "Proofreading › Typo" inspection: words of
+//! comments, string literals and declared names (regions come from the
+//! syntax layer), checked against the bundled en_US Hunspell dictionary, a
+//! list of programming terms and the user's accepted words and dictionaries.
+
+mod words;
+
+use ide_core::{Pos, Range};
+use parking_lot::Mutex;
+use serde::{Deserialize, Serialize};
+use specta::Type;
+use std::collections::{HashMap, HashSet};
+use std::path::{Path, PathBuf};
+use std::sync::{Arc, OnceLock};
+use std::time::SystemTime;
+
+pub use words::{MIN_WORD_CHARS, WordSpan, words};
+
+/// Where a region's words come from; strings and comments understand escapes.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum RegionKind {
+ Comment,
+ String,
+ /// A declared identifier (`camelCase` / `snake_case` split).
+ Name,
+ /// Plain text / Markdown prose.
+ Prose,
+}
+
+/// A byte range of the text to check.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct Region {
+ pub start: usize,
+ pub end: usize,
+ pub kind: RegionKind,
+}
+
+/// A misspelt word.
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
+pub struct Typo {
+ /// UTF-16 range of the word.
+ pub range: Range,
+ pub word: String,
+}
+
+/// At most this many typos are reported per text.
+pub const MAX_TYPOS: usize = 2000;
+
+fn english() -> &'static spellbook::Dictionary {
+ static DICT: OnceLock<spellbook::Dictionary> = OnceLock::new();
+ DICT.get_or_init(|| {
+ let aff = include_str!("dict/en_US.aff");
+ let dic = include_str!("dict/en_US.dic");
+ spellbook::Dictionary::new(aff, dic).expect("bundled en_US dictionary parses")
+ })
+}
+
+fn software_terms() -> &'static HashSet<&'static str> {
+ static TERMS: OnceLock<HashSet<&'static str>> = OnceLock::new();
+ TERMS.get_or_init(|| {
+ include_str!("dict/software.txt")
+ .lines()
+ .map(str::trim)
+ .filter(|l| !l.is_empty() && !l.starts_with('#'))
+ .collect()
+ })
+}
+
+/// Words of a custom dictionary file: a plain word list or a Hunspell `.dic`
+/// (leading count line and `/FLAGS` ignored). Cached by modification time.
+fn dictionary_file(path: &Path) -> Arc<HashSet<String>> {
+ type Cache = HashMap<PathBuf, (Option<SystemTime>, Arc<HashSet<String>>)>;
+ static CACHE: OnceLock<Mutex<Cache>> = OnceLock::new();
+ let modified = std::fs::metadata(path).and_then(|m| m.modified()).ok();
+ let mut cache = CACHE.get_or_init(Default::default).lock();
+ if let Some((at, words)) = cache.get(path)
+ && *at == modified
+ {
+ return words.clone();
+ }
+ let words: HashSet<String> = match std::fs::read_to_string(path) {
+ Ok(text) => parse_word_list(&text),
+ Err(e) => {
+ tracing::debug!("custom dictionary {}: {e}", path.display());
+ HashSet::new()
+ }
+ };
+ let words = Arc::new(words);
+ cache.insert(path.to_path_buf(), (modified, words.clone()));
+ words
+}
+
+/// Lowercased words of a word list / Hunspell `.dic` text.
+pub fn parse_word_list(text: &str) -> HashSet<String> {
+ let mut lines = text.lines().map(str::trim).peekable();
+ if lines.peek().is_some_and(|l| !l.is_empty() && l.chars().all(|c| c.is_ascii_digit())) {
+ lines.next();
+ }
+ lines
+ .filter(|l| !l.is_empty() && !l.starts_with('#'))
+ .map(|l| l.split('/').next().unwrap_or(l).trim().to_lowercase())
+ .filter(|w| !w.is_empty())
+ .collect()
+}
+
+/// The dictionary plus the user's accepted words and custom dictionaries.
+#[derive(Default)]
+pub struct Speller {
+ accepted: HashSet<String>,
+ custom: Vec<Arc<HashSet<String>>>,
+}
+
+impl Speller {
+ pub fn new<S: AsRef<str>>(accepted: impl IntoIterator<Item = S>, dictionaries: &[PathBuf]) -> Self {
+ Self {
+ accepted: accepted.into_iter().map(|w| w.as_ref().trim().to_lowercase()).collect(),
+ custom: dictionaries.iter().map(|p| dictionary_file(p)).collect(),
+ }
+ }
+
+ /// Whether `word` is spelt correctly. Case is forgiven the way identifiers
+ /// need it: `url` passes for `URL`, `paris` for `Paris`.
+ pub fn is_correct(&self, word: &str) -> bool {
+ let lower = word.to_lowercase();
+ if self.accepted.contains(&lower)
+ || software_terms().contains(lower.as_str())
+ || self.custom.iter().any(|d| d.contains(&lower))
+ {
+ return true;
+ }
+ let dict = english();
+ if dict.check(word) || dict.check(&lower) {
+ return true;
+ }
+ let mut chars = lower.chars();
+ let capitalized: String = chars.next().into_iter().flat_map(char::to_uppercase).chain(chars).collect();
+ dict.check(&capitalized) || dict.check(&lower.to_uppercase())
+ }
+
+ /// Replacements for `word`, best first, in the word's case style.
+ pub fn suggest(&self, word: &str, limit: usize) -> Vec<String> {
+ let mut out = Vec::new();
+ english().suggest(word, &mut out);
+ if out.is_empty() && word.chars().next().is_some_and(char::is_uppercase) {
+ english().suggest(&word.to_lowercase(), &mut out);
+ out = out.into_iter().map(|s| capitalize(&s)).collect();
+ }
+ let mut seen = HashSet::new();
+ out.retain(|s| s != word && seen.insert(s.clone()));
+ out.truncate(limit);
+ out
+ }
+
+ /// Misspelt words of `regions` (document order) in `text`; `None` when
+ /// `cancelled` fires.
+ pub fn check(&self, text: &str, regions: &[Region], cancelled: &dyn Fn() -> bool) -> Option<Vec<Typo>> {
+ let mut spans = Vec::new();
+ let mut verdicts: HashMap<&str, bool> = HashMap::new();
+ let mut bad: Vec<WordSpan> = Vec::new();
+ for (i, r) in regions.iter().enumerate() {
+ if i % 64 == 0 && cancelled() {
+ return None;
+ }
+ spans.clear();
+ words(text, r.start, r.end, r.kind, &mut spans);
+ for w in &spans {
+ let word = &text[w.start..w.end];
+ let ok = *verdicts.entry(word).or_insert_with(|| self.is_correct(word));
+ if !ok {
+ bad.push(*w);
+ }
+ }
+ if bad.len() >= MAX_TYPOS {
+ bad.truncate(MAX_TYPOS);
+ break;
+ }
+ }
+ bad.sort_by_key(|w| w.start);
+ bad.dedup();
+ let mut index = Utf16Walker::new(text);
+ Some(
+ bad.into_iter()
+ .map(|w| Typo {
+ range: Range::new(index.pos(w.start), index.pos(w.end)),
+ word: text[w.start..w.end].to_string(),
+ })
+ .collect(),
+ )
+ }
+}
+
+fn capitalize(s: &str) -> String {
+ let mut chars = s.chars();
+ chars.next().into_iter().flat_map(char::to_uppercase).chain(chars).collect()
+}
+
+/// Regions of a plain-text / Markdown document: everything but fenced code
+/// blocks and inline code spans.
+pub fn prose_regions(text: &str) -> Vec<Region> {
+ let mut out = Vec::new();
+ let mut fence: Option<&str> = None;
+ let mut offset = 0;
+ for line in text.split_inclusive('\n') {
+ let start = offset;
+ offset += line.len();
+ let trimmed = line.trim_start();
+ let marker = ["```", "~~~"].into_iter().find(|m| trimmed.starts_with(m));
+ match (fence, marker) {
+ (Some(open), Some(m)) if m == open => {
+ fence = None;
+ continue;
+ }
+ (Some(_), _) => continue,
+ (None, Some(m)) => {
+ fence = Some(m);
+ continue;
+ }
+ (None, None) => {}
+ }
+ // Text between backtick pairs is code.
+ let mut in_code = false;
+ let mut seg = start;
+ for (i, c) in line.char_indices() {
+ if c == '`' {
+ if !in_code && seg < start + i {
+ out.push(Region { start: seg, end: start + i, kind: RegionKind::Prose });
+ }
+ in_code = !in_code;
+ seg = start + i + 1;
+ }
+ }
+ if !in_code && seg < offset {
+ out.push(Region { start: seg, end: offset, kind: RegionKind::Prose });
+ }
+ }
+ out
+}
+
+/// Byte offset → line / UTF-16 column, for increasing offsets.
+struct Utf16Walker<'a> {
+ text: &'a str,
+ byte: usize,
+ pos: Pos,
+}
+
+impl<'a> Utf16Walker<'a> {
+ fn new(text: &'a str) -> Self {
+ Self { text, byte: 0, pos: Pos::new(0, 0) }
+ }
+
+ fn pos(&mut self, target: usize) -> Pos {
+ if target < self.byte {
+ *self = Self::new(self.text);
+ }
+ for c in self.text[self.byte..target].chars() {
+ if c == '\n' {
+ self.pos = Pos::new(self.pos.line + 1, 0);
+ } else {
+ self.pos.col += c.len_utf16() as u32;
+ }
+ }
+ self.byte = target;
+ self.pos
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn whole(text: &str, kind: RegionKind) -> Vec<Region> {
+ vec![Region { start: 0, end: text.len(), kind }]
+ }
+
+ #[test]
+ fn flags_misspellings_only() {
+ let s = Speller::default();
+ let text = "// Recieve the mesage from the server's backend";
+ let typos = s.check(text, &whole(text, RegionKind::Comment), &|| false).unwrap();
+ let words: Vec<_> = typos.iter().map(|t| t.word.as_str()).collect();
+ assert_eq!(words, ["Recieve", "mesage"]);
+ assert_eq!(typos[0].range, Range::new(Pos::new(0, 3), Pos::new(0, 10)));
+ }
+
+ #[test]
+ fn identifiers_forgive_case_and_terms() {
+ let s = Speller::default();
+ for ok in ["url", "Paris", "json", "parser", "println"] {
+ assert!(s.is_correct(ok), "{ok}");
+ }
+ assert!(!s.is_correct("lenght"));
+ }
+
+ #[test]
+ fn accepted_words_and_custom_dictionaries() {
+ let dir = std::env::temp_dir().join(format!("ide-spell-{}", std::process::id()));
+ std::fs::create_dir_all(&dir).unwrap();
+ let dic = dir.join("team.dic");
+ std::fs::write(&dic, "2\nfrobnicate/S\nQuuxify\n").unwrap();
+ let s = Speller::new(["Openidea"], std::slice::from_ref(&dic));
+ assert!(s.is_correct("openidea"));
+ assert!(s.is_correct("frobnicate"));
+ assert!(s.is_correct("quuxify"));
+ assert!(!s.is_correct("zorblax"));
+ let _ = std::fs::remove_dir_all(dir);
+ }
+
+ #[test]
+ fn utf16_ranges() {
+ let s = Speller::default();
+ let text = "// 中文 é\n// wrng";
+ let typos = s.check(text, &whole(text, RegionKind::Comment), &|| false).unwrap();
+ assert_eq!(typos.len(), 1);
+ assert_eq!(typos[0].range, Range::new(Pos::new(1, 3), Pos::new(1, 7)));
+ }
+
+ #[test]
+ fn suggestions() {
+ let s = Speller::default();
+ let out = s.suggest("mesage", 5);
+ assert!(out.iter().any(|w| w == "message"), "{out:?}");
+ assert!(s.suggest("Recieve", 5).iter().any(|w| w == "Receive"));
+ }
+
+ #[test]
+ fn markdown_skips_code() {
+ let text = "Some prose `codez` here\n```\nfn wrng() {}\n```\nmore\n";
+ let regions = prose_regions(text);
+ let spans: Vec<_> = regions.iter().map(|r| &text[r.start..r.end]).collect();
+ assert_eq!(spans, ["Some prose ", " here\n", "more\n"]);
+ }
+
+ #[test]
+ fn cancellation() {
+ let s = Speller::default();
+ assert!(s.check("x", &whole("x", RegionKind::Comment), &|| true).is_none());
+ }
+}
diff --git a/crates/ide-spell/src/words.rs b/crates/ide-spell/src/words.rs
new file mode 100644
index 000000000..430fb877f
--- /dev/null
+++ b/crates/ide-spell/src/words.rs
@@ -0,0 +1,171 @@
+//! Words worth spell checking in a region of source text, IDEA style:
+//! identifiers split at `camelCase` / `snake_case` boundaries; URLs, e-mail
+//! addresses, escapes, hex, acronyms, short tokens and tokens with digits skipped.
+
+use crate::RegionKind;
+
+/// Shorter words are never checked.
+pub const MIN_WORD_CHARS: usize = 3;
+
+/// Byte range of a word in the text the region came from.
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct WordSpan {
+ pub start: usize,
+ pub end: usize,
+}
+
+/// Words of `text[start..end]` in order, as absolute byte ranges.
+pub fn words(text: &str, start: usize, end: usize, kind: RegionKind, out: &mut Vec<WordSpan>) {
+ let Some(slice) = text.get(start..end) else { return };
+ let escapes = !matches!(kind, RegionKind::Name);
+ let mut chunk_start = None;
+ for (i, c) in slice.char_indices().chain(std::iter::once((slice.len(), ' '))) {
+ if c.is_whitespace() {
+ if let Some(s) = chunk_start.take() {
+ chunk(slice, s, i, escapes, start, out);
+ }
+ } else if chunk_start.is_none() {
+ chunk_start = Some(i);
+ }
+ }
+}
+
+/// URLs, e-mail addresses and the like are not prose.
+fn skip_chunk(chunk: &str) -> bool {
+ if chunk.contains("://") || chunk.starts_with("www.") {
+ return true;
+ }
+ match chunk.find('@') {
+ Some(at) => chunk[at + 1..].contains('.') && at > 0,
+ None => false,
+ }
+}
+
+fn chunk(slice: &str, from: usize, to: usize, escapes: bool, base: usize, out: &mut Vec<WordSpan>) {
+ let text = &slice[from..to];
+ if skip_chunk(text) {
+ return;
+ }
+ let mut run: Option<usize> = None;
+ let mut chars = text.char_indices().peekable();
+ while let Some((i, c)) = chars.next() {
+ let word_char = c.is_alphanumeric() || c == '_' || c == '\'';
+ if word_char {
+ run.get_or_insert(i);
+ continue;
+ }
+ if let Some(s) = run.take() {
+ token(text, s, i, base + from, out);
+ }
+ // `\n`, `\t`, `é`: the escape letter is not part of the next word.
+ if escapes && c == '\\' {
+ chars.next();
+ }
+ }
+ if let Some(s) = run {
+ token(text, s, text.len(), base + from, out);
+ }
+}
+
+/// One alphanumeric run (`parseHTMLDoc`, `max_len`, `don't`).
+fn token(text: &str, mut s: usize, mut e: usize, base: usize, out: &mut Vec<WordSpan>) {
+ let trim = |c: char| c == '\'' || c == '_';
+ while s < e && text[s..e].starts_with(trim) {
+ s += 1;
+ }
+ while e > s && text[s..e].ends_with(trim) {
+ e -= 1;
+ }
+ let tok = &text[s..e];
+ if tok.is_empty() || tok.chars().any(|c| c.is_ascii_digit()) {
+ return;
+ }
+ if tok.len() >= 6 && tok.chars().all(|c| c.is_ascii_hexdigit()) {
+ return;
+ }
+ for (ps, pe) in pieces(tok) {
+ let w = &tok[ps..pe];
+ let w = w.trim_matches('\'');
+ if w.is_empty() {
+ continue;
+ }
+ let ws = s + ps + tok[ps..pe].find(w).unwrap_or(0);
+ if checkable(w) {
+ out.push(WordSpan { start: base + ws, end: base + ws + w.len() });
+ }
+ }
+}
+
+/// `snake_case` and `camelCase` / `HTTPServer` pieces of a token.
+fn pieces(tok: &str) -> Vec<(usize, usize)> {
+ let mut out = Vec::new();
+ let mut offset = 0;
+ for part in tok.split('_') {
+ let chars: Vec<(usize, char)> = part.char_indices().collect();
+ let mut start = 0;
+ for k in 1..chars.len() {
+ let (i, c) = chars[k];
+ let prev = chars[k - 1].1;
+ let next_lower = chars.get(k + 1).is_some_and(|&(_, n)| n.is_lowercase());
+ let boundary =
+ (prev.is_lowercase() && c.is_uppercase()) || (prev.is_uppercase() && c.is_uppercase() && next_lower);
+ if boundary {
+ out.push((offset + start, offset + i));
+ start = i;
+ }
+ }
+ if !part.is_empty() {
+ out.push((offset + start, offset + part.len()));
+ }
+ offset += part.len() + 1;
+ }
+ out
+}
+
+/// Long enough, not an acronym, and in a script the bundled dictionary covers.
+fn checkable(w: &str) -> bool {
+ let letters = w.chars().filter(|c| c.is_alphabetic()).count();
+ if letters < MIN_WORD_CHARS {
+ return false;
+ }
+ if !w.chars().any(|c| c.is_lowercase()) {
+ return false;
+ }
+ // Latin letters only (through Latin Extended-B): CJK, Cyrillic, … are not checked.
+ w.chars().all(|c| c == '\'' || (c.is_alphabetic() && (c as u32) < 0x250))
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn split(text: &str, kind: RegionKind) -> Vec<&str> {
+ let mut out = Vec::new();
+ words(text, 0, text.len(), kind, &mut out);
+ out.into_iter().map(|w| &text[w.start..w.end]).collect()
+ }
+
+ #[test]
+ fn splits_identifiers() {
+ assert_eq!(split("parseHTMLDocument", RegionKind::Name), ["parse", "Document"]);
+ assert_eq!(split("max_line_length", RegionKind::Name), ["max", "line", "length"]);
+ assert_eq!(split("getUserName", RegionKind::Name), ["get", "User", "Name"]);
+ assert_eq!(split("XMLHttpRequest", RegionKind::Name), ["Http", "Request"]);
+ }
+
+ #[test]
+ fn skips_noise() {
+ assert_eq!(
+ split("see https://exmple.com/foo or mail [email protected], id 0xdeadbeef v2beta", RegionKind::Comment),
+ ["see", "mail"]
+ );
+ assert_eq!(split("deadbeefcafe NASA ok", RegionKind::Comment), Vec::<&str>::new());
+ assert_eq!(split("\"line\\nbreak\\twith tab\"", RegionKind::String), ["line", "break", "with", "tab"]);
+ assert_eq!(split("// 中文注释 naïve", RegionKind::Comment), ["naïve"]);
+ }
+
+ #[test]
+ fn keeps_apostrophes_inside_words() {
+ assert_eq!(split("'don't' shouldn't", RegionKind::Comment), ["don't", "shouldn't"]);
+ }
+}
diff --git a/crates/ide-vcs/src/history.rs b/crates/ide-vcs/src/history.rs
index 6c007448f..5d0c9e782 100644
--- a/crates/ide-vcs/src/history.rs
+++ b/crates/ide-vcs/src/history.rs
@@ -1,7 +1,7 @@
//! Commit history (topological walk) and per-commit changed files via gitoxide.
use crate::repo::{gx, resolve, to_string};
-use crate::{ChangeKind, ChangedFile, Commit, LogQuery, Repo};
+use crate::{ChangeKind, ChangedFile, Commit, LogOrder, LogQuery, Repo};
use gix::ObjectId;
use gix::bstr::ByteSlice;
use ide_core::{IdeError, IdeResult};
@@ -72,6 +72,7 @@ pub(crate) fn log(r: &Repo, q: &LogQuery) -> IdeResult<Vec<Commit>> {
let limit = if q.limit == 0 { usize::MAX } else { q.limit as usize };
let mut to_skip = q.skip as usize;
+ let path_walk = path_filter.is_some();
type Walk<'a> = Box<dyn Iterator<Item = IdeResult<(ObjectId, Vec<ObjectId>)>> + 'a>;
let walk: Walk<'_> = if let Some(range) = range {
let ids = range_ids(r, range, path_filter.as_deref())?;
@@ -81,29 +82,64 @@ pub(crate) fn log(r: &Repo, q: &LogQuery) -> IdeResult<Vec<Commit>> {
Ok((id, commit.parent_ids().map(|p| p.detach()).collect()))
}))
} else if let Some(rel) = path_filter {
- Box::new(PathWalk::new(&repo, tips, rel)?)
+ Box::new(PathWalk::new(&repo, tips, rel, q.first_parent)?)
} else if repo.is_shallow().unwrap_or(false) {
// Topological order needs complete history; shallow clones fall back to date order.
- let walk = repo
- .rev_walk(tips)
- .sorting(gix::revision::walk::Sorting::ByCommitTime(Default::default()))
- .all()
- .map_err(gx)?;
+ let mut walk = repo.rev_walk(tips).sorting(gix::revision::walk::Sorting::ByCommitTime(Default::default()));
+ if q.first_parent {
+ walk = walk.first_parent_only();
+ }
+ let walk = walk.all().map_err(gx)?;
Box::new(walk.map(|info| info.map(|i| (i.id, i.parent_ids.to_vec())).map_err(gx)))
} else {
+ use gix::traverse::commit::{Parents, topo};
let graph = repo.commit_graph_if_enabled().ok().flatten();
- let topo = gix::traverse::commit::topo::Builder::from_iters(&repo.objects, tips, None::<Vec<ObjectId>>)
- .sorting(gix::traverse::commit::topo::Sorting::TopoOrder)
+ let sorting = match q.order {
+ LogOrder::Topo => topo::Sorting::TopoOrder,
+ LogOrder::Date => topo::Sorting::DateOrder,
+ };
+ let topo = topo::Builder::from_iters(&repo.objects, tips, None::<Vec<ObjectId>>)
+ .sorting(sorting)
+ .parents(if q.first_parent { Parents::First } else { Parents::All })
.with_commit_graph(graph)
.build()
.map_err(gx)?;
Box::new(topo.map(|info| info.map(|i| (i.id, i.parent_ids.to_vec())).map_err(gx)))
};
+ let shape = Shape {
+ no_merges: q.no_merges,
+ first_parent: q.first_parent,
+ since: q.since_ms.map(|ms| (ms / 1000.0).floor() as i64),
+ until: q.until_ms.map(|ms| (ms / 1000.0).ceil() as i64),
+ };
+ // Walks in (roughly) commit time order can stop once they are well past `since`.
+ let time_ordered = range.is_none() && (q.order == LogOrder::Date || path_walk);
+ let mut older_run = 0usize;
+
let mut out = Vec::new();
for item in walk {
- let (id, parents) = item?;
+ let (id, mut parents) = item?;
+ if q.first_parent {
+ parents.truncate(1);
+ }
let commit = repo.find_commit(id).map_err(gx)?;
+ let commit_time = commit.time().map(|t| t.seconds).unwrap_or(0);
+ if shape.is_active() {
+ let merge = commit.parent_ids().nth(1).is_some();
+ if shape.since.is_some_and(|s| commit_time < s) {
+ older_run += 1;
+ if time_ordered && older_run >= OLDER_RUN_LIMIT {
+ break;
+ }
+ continue;
+ }
+ older_run = 0;
+ if !shape.shows(merge, commit_time) {
+ continue;
+ }
+ parents = shape.rewrite_parents(&repo, &parents)?;
+ }
let sig = commit.author().map_err(gx)?;
let name = to_string(sig.name.trim().as_bstr());
let email = to_string(sig.email.trim().as_bstr());
@@ -136,6 +172,7 @@ pub(crate) fn log(r: &Repo, q: &LogQuery) -> IdeResult<Vec<Commit>> {
summary,
message: message.trim_end().to_string(),
refs: decorations.get(&id).cloned().unwrap_or_default(),
+ commit_time_ms: commit_time as f64 * 1000.0,
});
if out.len() >= limit {
break;
@@ -144,6 +181,66 @@ pub(crate) fn log(r: &Repo, q: &LogQuery) -> IdeResult<Vec<Commit>> {
Ok(out)
}
+/// Consecutive commits older than `since` after which a time-ordered walk stops.
+const OLDER_RUN_LIMIT: usize = 64;
+
+/// Which commits the Log graph shows independently of the detail filters (author, text):
+/// `--no-merges` and the date range. Hidden commits are skipped and the parents of shown
+/// ones rewritten past them, like git's parent rewriting.
+struct Shape {
+ no_merges: bool,
+ first_parent: bool,
+ /// Commit time bounds in seconds; `since` inclusive, `until` exclusive.
+ since: Option<i64>,
+ until: Option<i64>,
+}
+
+/// Upper bound of commits visited while rewriting one commit's parents.
+const REWRITE_LIMIT: usize = 4096;
+
+impl Shape {
+ fn is_active(&self) -> bool {
+ self.no_merges || self.since.is_some() || self.until.is_some()
+ }
+
+ fn shows(&self, merge: bool, time: i64) -> bool {
+ !(self.no_merges && merge) && self.since.is_none_or(|s| time >= s) && self.until.is_none_or(|u| time < u)
+ }
+
+ /// `parents` with each hidden one replaced by its nearest shown ancestors; parents
+ /// older than `since` are dropped (their history is not shown).
+ fn rewrite_parents(&self, repo: &gix::Repository, parents: &[ObjectId]) -> IdeResult<Vec<ObjectId>> {
+ let mut out: Vec<ObjectId> = Vec::new();
+ let mut seen: HashSet<ObjectId> = HashSet::new();
+ let mut stack: Vec<ObjectId> = parents.iter().rev().copied().collect();
+ let mut visited = 0usize;
+ while let Some(p) = stack.pop() {
+ if !seen.insert(p) || !repo.has_object(p) {
+ continue;
+ }
+ visited += 1;
+ if visited > REWRITE_LIMIT {
+ break;
+ }
+ let commit = repo.find_commit(p).map_err(gx)?;
+ let time = commit.time().map(|t| t.seconds).unwrap_or(0);
+ if self.since.is_some_and(|s| time < s) {
+ continue;
+ }
+ let ids: Vec<ObjectId> = commit.parent_ids().map(|i| i.detach()).collect();
+ if self.shows(ids.len() > 1, time) {
+ if !out.contains(&p) {
+ out.push(p);
+ }
+ continue;
+ }
+ let next = if self.first_parent { &ids[..ids.len().min(1)] } else { &ids[..] };
+ stack.extend(next.iter().rev());
+ }
+ Ok(out)
+ }
+}
+
/// Commit ids of a revision range (`A..B`, `A...B`, `^A B`…), topologically ordered, via
/// `git rev-list` so every rev syntax git understands (`@{u}`, `HEAD~3`) works.
fn range_ids(r: &Repo, range: &str, path: Option<&str>) -> IdeResult<Vec<ObjectId>> {
@@ -234,10 +331,11 @@ struct PathWalk<'r> {
seen: HashSet<ObjectId>,
memo: HashMap<ObjectId, Option<ObjectId>>,
seq: u64,
+ first_parent: bool,
}
impl<'r> PathWalk<'r> {
- fn new(repo: &'r gix::Repository, tips: Vec<ObjectId>, rel: String) -> IdeResult<Self> {
+ fn new(repo: &'r gix::Repository, tips: Vec<ObjectId>, rel: String, first_parent: bool) -> IdeResult<Self> {
let mut walk = PathWalk {
repo,
rel,
@@ -245,6 +343,7 @@ impl<'r> PathWalk<'r> {
seen: Default::default(),
memo: Default::default(),
seq: 0,
+ first_parent,
};
for tip in tips {
walk.push(tip)?;
@@ -268,7 +367,12 @@ impl<'r> PathWalk<'r> {
let commit = self.repo.find_commit(id).map_err(gx)?;
let parents: Vec<ObjectId> = commit.parent_ids().map(|p| p.detach()).collect();
// Parents cut off by a shallow boundary are treated as absent.
- let present: Vec<ObjectId> = parents.iter().copied().filter(|p| self.repo.has_object(p)).collect();
+ let present: Vec<ObjectId> = parents
+ .iter()
+ .copied()
+ .filter(|p| self.repo.has_object(p))
+ .take(if self.first_parent { 1 } else { usize::MAX })
+ .collect();
let mine = path_entry(self.repo, id, &self.rel, &mut self.memo)?;
let mut same_parent = None;
for p in &present {
diff --git a/crates/ide-vcs/src/lib.rs b/crates/ide-vcs/src/lib.rs
index 6194db2a1..44e2dae9a 100644
--- a/crates/ide-vcs/src/lib.rs
+++ b/crates/ide-vcs/src/lib.rs
@@ -88,6 +88,20 @@ pub struct Commit {
pub summary: String,
pub message: String,
pub refs: Vec<String>,
+ /// Committer time (Log › View Options › Commit Timestamp).
+ #[serde(default)]
+ pub commit_time_ms: f64,
+}
+
+/// Order of the Git Log (Graph Options › Sort).
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub enum LogOrder {
+ /// `--topo-order`: lines of history are not intermixed.
+ #[default]
+ Topo,
+ /// `--date-order`: commit time, but never a parent before its children.
+ Date,
}
#[derive(Clone, Debug, Default, Serialize, Deserialize, Type)]
@@ -115,6 +129,21 @@ pub struct LogQuery {
/// More author needles next to `author`; a commit matches any of them (Log User filter).
#[serde(default)]
pub authors: Vec<String>,
+ #[serde(default)]
+ pub order: LogOrder,
+ /// Follow only the first parent of merges (`--first-parent`).
+ #[serde(default)]
+ pub first_parent: bool,
+ /// Leave out merge commits (`--no-merges`); their children link to their parents.
+ #[serde(default)]
+ pub no_merges: bool,
+ /// Committer time bounds (epoch ms; `since` inclusive, `until` exclusive). Parents
+ /// outside the range are rewritten to their nearest shown ancestors (or dropped when
+ /// older), so the graph stays connected.
+ #[serde(default)]
+ pub since_ms: Option<f64>,
+ #[serde(default)]
+ pub until_ms: Option<f64>,
}
#[derive(Clone, Debug, Serialize, Deserialize, Type)]
@@ -397,6 +426,7 @@ pub mod changelists;
mod cli;
mod diff;
mod history;
+mod manage;
mod ops;
mod patch;
mod refs;
@@ -409,6 +439,7 @@ mod write;
pub use cli::{detected_git_executable, git_version, set_git_executable};
pub use diff::build_partial_patch;
+pub use manage::{MergeOptions, RebaseOptions, RemoteEdit, Worktree};
pub use remotes::Remote;
pub use roots::Repos;
@@ -420,6 +451,11 @@ pub fn clone(url: &str, dest: &Path, cancel: &CancellationToken, on_output: &dyn
cli::run_streaming(parent, &["clone", "--progress", "--", url, &dest], cancel, on_output)
}
+/// Creates an empty repository in `dir` (`git init`).
+pub fn init(dir: &Path) -> IdeResult<()> {
+ cli::run(dir, &["init", "-q"], None).map(|_| ())
+}
+
/// Line hunks of `new_text` against `old_text` (CRLF-normalised, Histogram diff), in the
/// order [`build_partial_patch`] indexes them.
pub fn diff_hunks(old_text: &str, new_text: &str) -> Vec<LineHunk> {
diff --git a/crates/ide-vcs/src/manage.rs b/crates/ide-vcs/src/manage.rs
new file mode 100644
index 000000000..2276e7155
--- /dev/null
+++ b/crates/ide-vcs/src/manage.rs
@@ -0,0 +1,343 @@
+//! Git menu dialogs: Merge / Rebase / Pull with options, Manage Remotes and Worktrees.
+
+use crate::Repo;
+use crate::cli::{self, run};
+use ide_core::{CancellationToken, IdeError, IdeResult};
+use serde::{Deserialize, Serialize};
+use specta::Type;
+use std::path::Path;
+
+/// Merge dialog › Modify options (shared by the Pull dialog).
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct MergeOptions {
+ #[serde(default)]
+ pub no_ff: bool,
+ #[serde(default)]
+ pub ff_only: bool,
+ #[serde(default)]
+ pub squash: bool,
+ #[serde(default)]
+ pub no_commit: bool,
+ /// `-m`: message of the merge commit (Merge dialog only).
+ #[serde(default)]
+ pub message: Option<String>,
+}
+
+/// Rebase dialog options.
+#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct RebaseOptions {
+ /// `--onto <newbase>`: replay `upstream..HEAD` onto this revision instead.
+ #[serde(default)]
+ pub onto: Option<String>,
+ #[serde(default)]
+ pub rebase_merges: bool,
+ #[serde(default)]
+ pub keep_empty: bool,
+}
+
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct Worktree {
+ pub path: ide_core::IpcPath,
+ /// Checked-out commit; `None` for a bare main repository.
+ pub head: Option<String>,
+ /// Short branch name; `None` when HEAD is detached.
+ pub branch: Option<String>,
+ /// The main working tree (cannot be removed).
+ pub main: bool,
+ pub locked: bool,
+ pub prunable: bool,
+}
+
+/// Manage Remotes edits.
+#[derive(Clone, Debug, Serialize, Deserialize, Type)]
+#[serde(tag = "op", rename_all = "camelCase")]
+pub enum RemoteEdit {
+ Add {
+ name: String,
+ url: String,
+ },
+ Remove {
+ name: String,
+ },
+ /// Renames `name` to `new_name` (when different) and sets its URL.
+ Edit {
+ name: String,
+ new_name: String,
+ url: String,
+ },
+}
+
+fn arg(value: &str, what: &str) -> IdeResult<String> {
+ let v = value.trim();
+ if v.is_empty() || v.starts_with('-') {
+ return Err(IdeError::invalid(format!("invalid {what} '{value}'")));
+ }
+ Ok(v.to_string())
+}
+
+fn merge_flags(o: &MergeOptions) -> IdeResult<Vec<&'static str>> {
+ if o.ff_only && (o.no_ff || o.squash) {
+ return Err(IdeError::invalid("--ff-only cannot be combined with --no-ff or --squash"));
+ }
+ if o.no_ff && o.squash {
+ return Err(IdeError::invalid("--no-ff cannot be combined with --squash"));
+ }
+ let mut flags = Vec::new();
+ if o.no_ff {
+ flags.push("--no-ff");
+ }
+ if o.ff_only {
+ flags.push("--ff-only");
+ }
+ if o.squash {
+ flags.push("--squash");
+ }
+ if o.no_commit {
+ flags.push("--no-commit");
+ }
+ Ok(flags)
+}
+
+/// `git merge` arguments for the Merge dialog (local changes are stashed and restored).
+pub(crate) fn merge_args(branches: &[String], o: &MergeOptions) -> IdeResult<Vec<String>> {
+ if branches.is_empty() {
+ return Err(IdeError::invalid("no branch to merge"));
+ }
+ let mut args: Vec<String> = vec!["merge".into(), "--autostash".into()];
+ args.extend(merge_flags(o)?.into_iter().map(String::from));
+ match o.message.as_deref().map(str::trim).filter(|m| !m.is_empty()) {
+ Some(m) => args.extend(["-m".into(), m.to_string()]),
+ None => args.push("--no-edit".into()),
+ }
+ for b in branches {
+ args.push(arg(b, "branch")?);
+ }
+ Ok(args)
+}
+
+/// `git rebase` arguments for the Rebase dialog.
+pub(crate) fn rebase_args(upstream: &str, o: &RebaseOptions) -> IdeResult<Vec<String>> {
+ let mut args: Vec<String> = vec!["rebase".into(), "--autostash".into()];
+ if o.rebase_merges {
+ args.push("--rebase-merges".into());
+ }
+ if o.keep_empty {
+ args.push("--keep-empty".into());
+ }
+ if let Some(onto) = o.onto.as_deref().map(str::trim).filter(|s| !s.is_empty()) {
+ args.extend(["--onto".into(), arg(onto, "revision")?]);
+ }
+ args.push(arg(upstream, "revision")?);
+ Ok(args)
+}
+
+/// `git pull` arguments for the Pull dialog: `remote` and its `branches` (none = the
+/// upstream's configured merge branch).
+pub(crate) fn pull_args(remote: &str, branches: &[String], rebase: bool, o: &MergeOptions) -> IdeResult<Vec<String>> {
+ let mut args: Vec<String> = vec!["pull".into(), "--progress".into(), "--autostash".into()];
+ if rebase {
+ if o.no_ff || o.ff_only || o.squash || o.no_commit {
+ return Err(IdeError::invalid("--rebase cannot be combined with merge options"));
+ }
+ args.push("--rebase".into());
+ } else {
+ args.push("--no-rebase".into());
+ args.extend(merge_flags(o)?.into_iter().map(String::from));
+ }
+ args.push(arg(remote, "remote")?);
+ for b in branches {
+ args.push(arg(b, "branch")?);
+ }
+ Ok(args)
+}
+
+/// Parses `git worktree list --porcelain`.
+pub(crate) fn parse_worktrees(text: &str) -> Vec<Worktree> {
+ let mut out: Vec<Worktree> = Vec::new();
+ for block in text.split("\n\n") {
+ let mut wt: Option<Worktree> = None;
+ let mut bare = false;
+ for line in block.lines() {
+ let (key, value) = line.split_once(' ').unwrap_or((line, ""));
+ match key {
+ "worktree" => {
+ wt = Some(Worktree {
+ path: value.into(),
+ head: None,
+ branch: None,
+ main: out.is_empty(),
+ locked: false,
+ prunable: false,
+ })
+ }
+ "HEAD" => {
+ if let Some(w) = wt.as_mut() {
+ w.head = Some(value.to_string());
+ }
+ }
+ "branch" => {
+ if let Some(w) = wt.as_mut() {
+ w.branch = Some(value.strip_prefix("refs/heads/").unwrap_or(value).to_string());
+ }
+ }
+ "locked" => {
+ if let Some(w) = wt.as_mut() {
+ w.locked = true;
+ }
+ }
+ "prunable" => {
+ if let Some(w) = wt.as_mut() {
+ w.prunable = true;
+ }
+ }
+ "bare" => bare = true,
+ _ => {}
+ }
+ }
+ if let Some(mut w) = wt {
+ if bare {
+ w.head = None;
+ }
+ out.push(w);
+ }
+ }
+ out
+}
+
+impl Repo {
+ /// Merges `branches` into the current branch (Git › Merge…).
+ pub fn merge_with(&self, branches: &[String], options: &MergeOptions) -> IdeResult<()> {
+ let args = merge_args(branches, options)?;
+ let args: Vec<&str> = args.iter().map(String::as_str).collect();
+ run(self.root(), &args, None).map(|_| ())
+ }
+
+ /// Rebases the current branch onto `upstream` (or `upstream..HEAD` onto `options.onto`).
+ pub fn rebase_with(&self, upstream: &str, options: &RebaseOptions) -> IdeResult<()> {
+ let args = rebase_args(upstream, options)?;
+ let args: Vec<&str> = args.iter().map(String::as_str).collect();
+ run(self.root(), &args, None).map(|_| ())
+ }
+
+ /// Git › Pull…: pulls `branches` of `remote` into the current branch.
+ pub fn pull_from(
+ &self,
+ remote: &str,
+ branches: &[String],
+ rebase: bool,
+ options: &MergeOptions,
+ cancel: &CancellationToken,
+ on_output: &dyn Fn(String),
+ ) -> IdeResult<()> {
+ let args = pull_args(remote, branches, rebase, options)?;
+ let args: Vec<&str> = args.iter().map(String::as_str).collect();
+ cli::run_streaming(self.root(), &args, cancel, on_output)
+ }
+
+ /// Manage Remotes: adds, removes or edits a remote.
+ pub fn edit_remote(&self, edit: &RemoteEdit) -> IdeResult<()> {
+ match edit {
+ RemoteEdit::Add { name, url } => {
+ let (name, url) = (arg(name, "remote name")?, arg(url, "URL")?);
+ run(self.root(), &["remote", "add", "--", &name, &url], None)?;
+ }
+ RemoteEdit::Remove { name } => {
+ let name = arg(name, "remote name")?;
+ run(self.root(), &["remote", "remove", &name], None)?;
+ }
+ RemoteEdit::Edit { name, new_name, url } => {
+ let (name, new_name, url) =
+ (arg(name, "remote name")?, arg(new_name, "remote name")?, arg(url, "URL")?);
+ if name != new_name {
+ run(self.root(), &["remote", "rename", &name, &new_name], None)?;
+ }
+ run(self.root(), &["remote", "set-url", "--", &new_name, &url], None)?;
+ }
+ }
+ Ok(())
+ }
+
+ /// Working trees of the repository, the main one first.
+ pub fn worktrees(&self) -> IdeResult<Vec<Worktree>> {
+ let out = run(self.root(), &["worktree", "list", "--porcelain"], None)?;
+ Ok(parse_worktrees(&out.stdout_str()))
+ }
+
+ /// Git › New Worktree…: checks out `commitish` at `path`, on a new branch `new_branch`
+ /// when given (otherwise `commitish` must be a branch not checked out elsewhere).
+ pub fn add_worktree(&self, path: &Path, commitish: &str, new_branch: Option<&str>) -> IdeResult<()> {
+ let path = path.to_string_lossy().into_owned();
+ let commitish = arg(commitish, "revision")?;
+ let mut args: Vec<String> = vec!["worktree".into(), "add".into()];
+ if let Some(b) = new_branch.map(str::trim).filter(|b| !b.is_empty()) {
+ args.extend(["-b".into(), arg(b, "branch name")?]);
+ }
+ args.extend(["--".into(), path, commitish]);
+ let args: Vec<&str> = args.iter().map(String::as_str).collect();
+ run(self.root(), &args, None).map(|_| ())
+ }
+
+ pub fn remove_worktree(&self, path: &Path, force: bool) -> IdeResult<()> {
+ let path = path.to_string_lossy().into_owned();
+ let mut args = vec!["worktree", "remove"];
+ if force {
+ args.push("--force");
+ }
+ args.extend(["--", &path]);
+ run(self.root(), &args, None).map(|_| ())
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn merge_args_follow_the_options() {
+ let o = MergeOptions { no_ff: true, message: Some("Merge it".into()), ..Default::default() };
+ assert_eq!(
+ merge_args(&["dev".into()], &o).unwrap(),
+ ["merge", "--autostash", "--no-ff", "-m", "Merge it", "dev"]
+ );
+ assert_eq!(
+ merge_args(&["a".into(), "b".into()], &MergeOptions::default()).unwrap(),
+ ["merge", "--autostash", "--no-edit", "a", "b"]
+ );
+ let bad = MergeOptions { ff_only: true, squash: true, ..Default::default() };
+ assert!(merge_args(&["dev".into()], &bad).is_err());
+ assert!(merge_args(&["--evil".into()], &MergeOptions::default()).is_err());
+ assert!(merge_args(&[], &MergeOptions::default()).is_err());
+ }
+
+ #[test]
+ fn rebase_and_pull_args() {
+ let o = RebaseOptions { onto: Some("main".into()), rebase_merges: true, keep_empty: false };
+ assert_eq!(
+ rebase_args("feature~3", &o).unwrap(),
+ ["rebase", "--autostash", "--rebase-merges", "--onto", "main", "feature~3"]
+ );
+ assert_eq!(
+ pull_args("origin", &["main".into()], false, &MergeOptions { ff_only: true, ..Default::default() })
+ .unwrap(),
+ ["pull", "--progress", "--autostash", "--no-rebase", "--ff-only", "origin", "main"]
+ );
+ assert_eq!(
+ pull_args("origin", &[], true, &MergeOptions::default()).unwrap(),
+ ["pull", "--progress", "--autostash", "--rebase", "origin"]
+ );
+ assert!(pull_args("origin", &[], true, &MergeOptions { squash: true, ..Default::default() }).is_err());
+ }
+
+ #[test]
+ fn parses_worktree_list() {
+ let text = "worktree /repo\nHEAD 1111\nbranch refs/heads/main\n\nworktree /wt/fix\nHEAD 2222\ndetached\nlocked\n\nworktree /wt/gone\nHEAD 3333\nbranch refs/heads/old\nprunable gitdir file points to non-existent location\n";
+ let wts = parse_worktrees(text);
+ assert_eq!(wts.len(), 3);
+ assert!(wts[0].main && wts[0].branch.as_deref() == Some("main"));
+ assert!(!wts[1].main && wts[1].branch.is_none() && wts[1].locked);
+ assert!(wts[2].prunable && wts[2].head.as_deref() == Some("3333"));
+ }
+}
diff --git a/crates/ide-vcs/tests/log_shape.rs b/crates/ide-vcs/tests/log_shape.rs
new file mode 100644
index 000000000..a6802f353
--- /dev/null
+++ b/crates/ide-vcs/tests/log_shape.rs
@@ -0,0 +1,175 @@
+//! Git Log graph options (order, first parent, no merges, date range) and the Git menu
+//! dialogs' operations (merge / rebase with options, remotes, worktrees).
+
+use ide_vcs::*;
+use std::path::Path;
+use std::process::Command;
+
+fn git(dir: &Path, args: &[&str], time: Option<i64>) -> String {
+ let mut cmd = Command::new("git");
+ cmd.current_dir(dir)
+ .args(["-c", "init.defaultBranch=main", "-c", "user.name=Test", "-c", "[email protected]"])
+ .args(["-c", "commit.gpgsign=false", "-c", "core.hooksPath=.git/hooks"])
+ .args(args)
+ .env("GIT_TERMINAL_PROMPT", "0");
+ if let Some(t) = time {
+ let date = format!("@{t} +0000");
+ cmd.env("GIT_AUTHOR_DATE", &date).env("GIT_COMMITTER_DATE", &date);
+ }
+ let out = cmd.output().expect("git runs");
+ assert!(out.status.success(), "git {args:?} failed: {}", String::from_utf8_lossy(&out.stderr));
+ String::from_utf8_lossy(&out.stdout).trim().to_string()
+}
+
+fn commit(dir: &Path, file: &str, msg: &str, time: i64) -> String {
+ std::fs::write(dir.join(file), msg).unwrap();
+ git(dir, &["add", "-A"], None);
+ git(dir, &["commit", "-q", "-m", msg], Some(time));
+ git(dir, &["rev-parse", "HEAD"], None)
+}
+
+struct History {
+ _tmp: tempfile::TempDir,
+ repo: Repo,
+ c1: String,
+ s1: String,
+ c2: String,
+ m: String,
+ c3: String,
+}
+
+/// c1 ← s1 (side) ; c1 ← c2 ← m (merges s1) ← c3, committed at 1000…5000 s.
+fn history() -> History {
+ let tmp = tempfile::tempdir().unwrap();
+ let dir = tmp.path().to_path_buf();
+ git(&dir, &["init", "-q"], None);
+ let c1 = commit(&dir, "a.txt", "c1", 1000);
+ git(&dir, &["checkout", "-q", "-b", "side"], None);
+ let s1 = commit(&dir, "s.txt", "s1", 2000);
+ git(&dir, &["checkout", "-q", "main"], None);
+ let c2 = commit(&dir, "b.txt", "c2", 3000);
+ git(&dir, &["merge", "-q", "--no-ff", "-m", "merge side", "side"], Some(4000));
+ let m = git(&dir, &["rev-parse", "HEAD"], None);
+ let c3 = commit(&dir, "c.txt", "c3", 5000);
+ let repo = Repo::discover(&dir).unwrap().expect("repository");
+ History { _tmp: tmp, repo, c1, s1, c2, m, c3 }
+}
+
+fn log(h: &History, q: LogQuery) -> Vec<Commit> {
+ h.repo.log(&LogQuery { branches: vec!["main".into()], ..q }).unwrap()
+}
+
+fn ids(commits: &[Commit]) -> Vec<String> {
+ commits.iter().map(|c| c.id.clone()).collect()
+}
+
+fn parents_of(commits: &[Commit], id: &str) -> Vec<String> {
+ commits.iter().find(|c| c.id == id).unwrap().parents.clone()
+}
+
+#[test]
+fn date_order_follows_commit_time_and_reports_it() {
+ let h = history();
+ let out = log(&h, LogQuery { order: LogOrder::Date, ..Default::default() });
+ assert_eq!(ids(&out), vec![h.c3.clone(), h.m.clone(), h.c2.clone(), h.s1.clone(), h.c1.clone()]);
+ assert_eq!(out[0].commit_time_ms, 5_000_000.0);
+}
+
+#[test]
+fn no_merges_links_children_to_the_merge_parents() {
+ let h = history();
+ let out = log(&h, LogQuery { no_merges: true, ..Default::default() });
+ assert!(!ids(&out).contains(&h.m));
+ assert_eq!(out.len(), 4);
+ assert_eq!(parents_of(&out, &h.c3), vec![h.c2.clone(), h.s1.clone()]);
+}
+
+#[test]
+fn first_parent_skips_merged_branches() {
+ let h = history();
+ let out = log(&h, LogQuery { first_parent: true, ..Default::default() });
+ assert_eq!(ids(&out), vec![h.c3.clone(), h.m.clone(), h.c2.clone(), h.c1.clone()]);
+ assert_eq!(parents_of(&out, &h.m), vec![h.c2.clone()]);
+}
+
+#[test]
+fn date_range_keeps_the_graph_connected() {
+ let h = history();
+ let since = log(&h, LogQuery { since_ms: Some(2_500_000.0), ..Default::default() });
+ assert_eq!(ids(&since), vec![h.c3.clone(), h.m.clone(), h.c2.clone()]);
+ // Older parents are not shown, so they are dropped.
+ assert_eq!(parents_of(&since, &h.m), vec![h.c2.clone()]);
+ assert!(parents_of(&since, &h.c2).is_empty());
+
+ let window = log(&h, LogQuery { since_ms: Some(1_500_000.0), until_ms: Some(4_500_000.0), ..Default::default() });
+ let mut got = ids(&window);
+ got.sort();
+ let mut want = vec![h.m.clone(), h.c2.clone(), h.s1.clone()];
+ want.sort();
+ assert_eq!(got, want);
+
+ // A commit newer than `until` is skipped and its child links past it.
+ let until = log(&h, LogQuery { until_ms: Some(3_500_000.0), order: LogOrder::Date, ..Default::default() });
+ assert_eq!(ids(&until), vec![h.c2.clone(), h.s1.clone(), h.c1.clone()]);
+ let combined = log(&h, LogQuery { until_ms: Some(4_500_000.0), no_merges: true, ..Default::default() });
+ assert!(!ids(&combined).contains(&h.m) && !ids(&combined).contains(&h.c3));
+}
+
+#[test]
+fn merge_with_options_and_rebase_onto() {
+ let tmp = tempfile::tempdir().unwrap();
+ let dir = tmp.path();
+ git(dir, &["init", "-q"], None);
+ let base = commit(dir, "a.txt", "base", 1000);
+ git(dir, &["checkout", "-q", "-b", "feature"], None);
+ let f1 = commit(dir, "f.txt", "f1", 2000);
+ git(dir, &["checkout", "-q", "main"], None);
+ let repo = Repo::discover(dir).unwrap().unwrap();
+
+ let ff_only = MergeOptions { ff_only: true, squash: true, ..Default::default() };
+ assert!(repo.merge_with(&["feature".into()], &ff_only).is_err());
+ let no_ff = MergeOptions { no_ff: true, message: Some("Merge feature now".into()), ..Default::default() };
+ repo.merge_with(&["feature".into()], &no_ff).unwrap();
+ assert_eq!(git(dir, &["log", "-1", "--format=%P %s"], None), format!("{base} {f1} Merge feature now"));
+
+ git(dir, &["checkout", "-q", "-b", "topic", &base], None);
+ commit(dir, "t.txt", "topic", 3000);
+ repo.rebase_with("main", &RebaseOptions::default()).unwrap();
+ assert_eq!(git(dir, &["rev-list", "--count", "main..topic"], None), "1");
+ assert_eq!(git(dir, &["merge-base", "main", "topic"], None), git(dir, &["rev-parse", "main"], None));
+}
+
+#[test]
+fn remotes_and_worktrees_are_managed() {
+ let tmp = tempfile::tempdir().unwrap();
+ let dir = tmp.path().join("work");
+ std::fs::create_dir(&dir).unwrap();
+ git(&dir, &["init", "-q"], None);
+ commit(&dir, "a.txt", "base", 1000);
+ let repo = Repo::discover(&dir).unwrap().unwrap();
+
+ repo.edit_remote(&RemoteEdit::Add { name: "origin".into(), url: "https://example.com/a.git".into() }).unwrap();
+ repo.edit_remote(&RemoteEdit::Edit {
+ name: "origin".into(),
+ new_name: "upstream".into(),
+ url: "https://example.com/b.git".into(),
+ })
+ .unwrap();
+ assert_eq!(
+ repo.remotes().unwrap(),
+ vec![Remote { name: "upstream".into(), url: "https://example.com/b.git".into() }]
+ );
+ assert!(repo.edit_remote(&RemoteEdit::Add { name: "--bad".into(), url: "x".into() }).is_err());
+ repo.edit_remote(&RemoteEdit::Remove { name: "upstream".into() }).unwrap();
+ assert!(repo.remotes().unwrap().is_empty());
+
+ let wt = tmp.path().join("work-fix");
+ repo.add_worktree(&wt, "main", Some("fix")).unwrap();
+ let list = repo.worktrees().unwrap();
+ assert_eq!(list.len(), 2);
+ assert!(list[0].main && list[0].branch.as_deref() == Some("main"));
+ assert_eq!(list[1].branch.as_deref(), Some("fix"));
+ assert!(wt.join("a.txt").exists());
+ repo.remove_worktree(&wt, false).unwrap();
+ assert_eq!(repo.worktrees().unwrap().len(), 1);
+}
diff --git a/crates/ide-vfs/Cargo.toml b/crates/ide-vfs/Cargo.toml
index b635d508f..bec96e84a 100644
--- a/crates/ide-vfs/Cargo.toml
+++ b/crates/ide-vfs/Cargo.toml
@@ -18,6 +18,7 @@ chardetng.workspace = true
trash.workspace = true
tracing.workspace = true
parking_lot.workspace = true
+zip = { version = "=2.4.2", default-features = false, features = ["deflate"] }
[dev-dependencies]
tempfile.workspace = true
diff --git a/crates/ide-vfs/src/archive.rs b/crates/ide-vfs/src/archive.rs
new file mode 100644
index 000000000..f69155396
--- /dev/null
+++ b/crates/ide-vfs/src/archive.rs
@@ -0,0 +1,337 @@
+//! Read-only browsing of zip archives (jar, zip, war…), IDEA's `jar://` file
+//! system: `<archive>!` is the archive's root and `<archive>!/<entry>` an entry
+//! inside it. Listing and reading go through a small cache of parsed central
+//! directories, refreshed when the archive changes on disk.
+
+use crate::{EntryKind, FileEntry, mtime_ms, natural_cmp};
+use ide_core::{IdeError, IdeResult};
+use parking_lot::Mutex;
+use std::collections::HashMap;
+use std::fs::File;
+use std::io::Read;
+use std::path::{Path, PathBuf};
+use std::sync::{Arc, LazyLock};
+use std::time::SystemTime;
+
+/// File extensions browsed as zip archives.
+pub const ARCHIVE_EXTENSIONS: &[&str] = &["jar", "zip", "war", "ear", "aar", "srcjar"];
+
+/// Separator between the archive and the entry path (`/jdk/lib/src.zip!/java.base/…`).
+pub const ARCHIVE_SEPARATOR: char = '!';
+
+/// Parsed archives kept open.
+const CACHE_SIZE: usize = 8;
+
+/// Whether `path` names a file browsed as an archive (by extension).
+pub fn is_archive_file(path: &Path) -> bool {
+ path.extension()
+ .and_then(|e| e.to_str())
+ .is_some_and(|e| ARCHIVE_EXTENSIONS.iter().any(|a| a.eq_ignore_ascii_case(e)))
+}
+
+/// `(archive, entry)` for `<archive>!` (entry `""`) or `<archive>!/<entry>`;
+/// `None` for ordinary paths. The entry is `/`-separated without leading or trailing `/`.
+pub fn split_archive_path(path: &Path) -> Option<(PathBuf, String)> {
+ let s = path.to_str()?;
+ for (i, _) in s.match_indices(ARCHIVE_SEPARATOR) {
+ let rest = &s[i + 1..];
+ if !(rest.is_empty() || rest.starts_with(['/', '\\'])) {
+ continue;
+ }
+ let archive = Path::new(&s[..i]);
+ if is_archive_file(archive) {
+ let entry = rest.replace('\\', "/");
+ return Some((archive.to_path_buf(), entry.trim_matches('/').to_owned()));
+ }
+ }
+ None
+}
+
+/// Whether `path` lies inside an archive (`<archive>!…`).
+pub fn is_archive_path(path: &Path) -> bool {
+ split_archive_path(path).is_some()
+}
+
+/// The root of `archive` as a browsable folder: `<archive>!`.
+pub fn archive_root(archive: &Path) -> PathBuf {
+ let mut s = archive.as_os_str().to_owned();
+ s.push("!");
+ PathBuf::from(s)
+}
+
+/// `<archive>!/<entry>` (the root for an empty entry).
+pub fn archive_entry_path(archive: &Path, entry: &str) -> PathBuf {
+ let entry = entry.trim_matches('/');
+ if entry.is_empty() {
+ return archive_root(archive);
+ }
+ let mut s = archive.as_os_str().to_owned();
+ s.push("!/");
+ s.push(entry);
+ PathBuf::from(s)
+}
+
+struct Node {
+ dir: bool,
+ size: u64,
+ /// Index in the zip's central directory (`None` for implicit directories).
+ index: Option<usize>,
+ children: Vec<String>,
+}
+
+struct Archive {
+ stamp: (Option<SystemTime>, u64),
+ mtime_ms: f64,
+ /// Entry path (`""` = root) → node.
+ nodes: HashMap<String, Node>,
+ zip: Mutex<zip::ZipArchive<File>>,
+}
+
+/// Most recently used first.
+type Cache = Vec<(PathBuf, Arc<Archive>)>;
+
+static CACHE: LazyLock<Mutex<Cache>> = LazyLock::new(Default::default);
+
+fn zip_error(archive: &Path, e: zip::result::ZipError) -> IdeError {
+ match e {
+ zip::result::ZipError::Io(e) => e.into(),
+ zip::result::ZipError::FileNotFound => IdeError::not_found(format!("entry not found in {}", archive.display())),
+ e => IdeError::invalid(format!("{}: {e}", archive.display())),
+ }
+}
+
+/// Normalises a zip entry name: `/`-separated, no leading `/` or `./`, no trailing `/`.
+fn clean_name(name: &str) -> Option<String> {
+ let parts: Vec<&str> = name.split(['/', '\\']).filter(|p| !p.is_empty() && *p != ".").collect();
+ (!parts.is_empty() && !parts.contains(&"..")).then(|| parts.join("/"))
+}
+
+fn parent_of(name: &str) -> (&str, &str) {
+ match name.rfind('/') {
+ Some(i) => (&name[..i], &name[i + 1..]),
+ None => ("", name),
+ }
+}
+
+impl Archive {
+ fn open(path: &Path, stamp: (Option<SystemTime>, u64), mtime_ms: f64) -> IdeResult<Self> {
+ let mut zip = zip::ZipArchive::new(File::open(path)?).map_err(|e| zip_error(path, e))?;
+ let mut nodes: HashMap<String, Node> = HashMap::new();
+ nodes.insert(String::new(), Node { dir: true, size: 0, index: None, children: Vec::new() });
+ for i in 0..zip.len() {
+ let Ok(file) = zip.by_index_raw(i) else { continue };
+ let Some(name) = clean_name(file.name()) else { continue };
+ let (dir, size) = (file.is_dir(), file.size());
+ drop(file);
+ let mut parent = parent_of(&name).0;
+ while !nodes.contains_key(parent) {
+ nodes.insert(parent.to_owned(), Node { dir: true, size: 0, index: None, children: Vec::new() });
+ parent = parent_of(parent).0;
+ }
+ let node = nodes.entry(name).or_insert(Node { dir, size: 0, index: None, children: Vec::new() });
+ node.dir |= dir;
+ node.index = Some(i);
+ node.size = if node.dir { 0 } else { size };
+ }
+ let links: Vec<(String, String)> = nodes
+ .keys()
+ .filter(|k| !k.is_empty())
+ .map(|k| {
+ let (parent, base) = parent_of(k);
+ (parent.to_owned(), base.to_owned())
+ })
+ .collect();
+ for (parent, base) in links {
+ if let Some(p) = nodes.get_mut(&parent) {
+ p.dir = true;
+ p.children.push(base);
+ }
+ }
+ Ok(Self { stamp, mtime_ms, nodes, zip: Mutex::new(zip) })
+ }
+}
+
+/// The parsed archive at `path`, from the cache unless it changed on disk.
+fn archive(path: &Path) -> IdeResult<Arc<Archive>> {
+ let meta = std::fs::metadata(path)?;
+ if !meta.is_file() {
+ return Err(IdeError::invalid(format!("{} is not an archive", path.display())));
+ }
+ let stamp = (meta.modified().ok(), meta.len());
+ {
+ let mut cache = CACHE.lock();
+ if let Some(i) = cache.iter().position(|(p, a)| p == path && a.stamp == stamp) {
+ let hit = cache.remove(i);
+ let a = hit.1.clone();
+ cache.insert(0, hit);
+ return Ok(a);
+ }
+ }
+ let parsed = Arc::new(Archive::open(path, stamp, mtime_ms(&meta))?);
+ let mut cache = CACHE.lock();
+ cache.retain(|(p, _)| p != path);
+ cache.insert(0, (path.to_path_buf(), parsed.clone()));
+ cache.truncate(CACHE_SIZE);
+ Ok(parsed)
+}
+
+/// Lists one folder of an archive (`dir` = `""` for its root): directories
+/// first, then files, in natural order. Entries are never ignored or excluded.
+pub fn read_archive_dir(archive_path: &Path, dir: &str) -> IdeResult<Vec<FileEntry>> {
+ let a = archive(archive_path)?;
+ let dir = dir.trim_matches('/');
+ let node = a
+ .nodes
+ .get(dir)
+ .ok_or_else(|| IdeError::not_found(format!("{dir} not found in {}", archive_path.display())))?;
+ if !node.dir {
+ return Err(IdeError::invalid(format!("{dir} is not a directory")));
+ }
+ let mut entries: Vec<FileEntry> = node
+ .children
+ .iter()
+ .filter_map(|name| {
+ let full = if dir.is_empty() { name.clone() } else { format!("{dir}/{name}") };
+ let child = a.nodes.get(&full)?;
+ Some(FileEntry {
+ name: name.clone(),
+ path: archive_entry_path(archive_path, &full).into(),
+ kind: if child.dir { EntryKind::Dir } else { EntryKind::File },
+ size: child.size,
+ mtime_ms: a.mtime_ms,
+ ignored: false,
+ excluded: false,
+ hidden: name.starts_with('.'),
+ target_kind: None,
+ })
+ })
+ .collect();
+ entries.sort_by(|a, b| {
+ let (da, db) = (a.kind == EntryKind::Dir, b.kind == EntryKind::Dir);
+ db.cmp(&da).then_with(|| natural_cmp(&a.name, &b.name))
+ });
+ Ok(entries)
+}
+
+/// Uncompressed size of an archive entry.
+pub(crate) fn entry_size(archive_path: &Path, entry: &str) -> IdeResult<(u64, f64)> {
+ let a = archive(archive_path)?;
+ let node = a
+ .nodes
+ .get(entry)
+ .ok_or_else(|| IdeError::not_found(format!("{entry} not found in {}", archive_path.display())))?;
+ if node.dir {
+ return Err(IdeError::invalid(format!("{entry} is a directory")));
+ }
+ Ok((node.size, a.mtime_ms))
+}
+
+/// The contents of a file inside an archive, and the archive's mtime (ms).
+pub fn read_archive_entry(archive_path: &Path, entry: &str) -> IdeResult<(Vec<u8>, f64)> {
+ let a = archive(archive_path)?;
+ let index = match a.nodes.get(entry) {
+ Some(Node { dir: false, index: Some(i), .. }) => *i,
+ Some(_) => return Err(IdeError::invalid(format!("{entry} is a directory"))),
+ None => return Err(IdeError::not_found(format!("{entry} not found in {}", archive_path.display()))),
+ };
+ let mut zip = a.zip.lock();
+ let mut file = zip.by_index(index).map_err(|e| zip_error(archive_path, e))?;
+ let mut bytes = Vec::with_capacity(file.size().min(crate::MAX_OPEN_SIZE) as usize);
+ file.read_to_end(&mut bytes)?;
+ Ok((bytes, a.mtime_ms))
+}
+
+#[cfg(test)]
+pub(crate) mod tests {
+ use super::*;
+ use std::io::Write;
+
+ /// Writes a zip with `files` (`name` ending in `/` = explicit directory entry).
+ pub(crate) fn write_zip(path: &Path, files: &[(&str, &str)]) {
+ let mut w = zip::ZipWriter::new(File::create(path).unwrap());
+ let opts = zip::write::SimpleFileOptions::default();
+ for (name, text) in files {
+ if name.ends_with('/') {
+ w.add_directory(*name, opts).unwrap();
+ } else {
+ w.start_file(*name, opts).unwrap();
+ w.write_all(text.as_bytes()).unwrap();
+ }
+ }
+ w.finish().unwrap();
+ }
+
+ #[test]
+ fn splits_archive_paths() {
+ assert_eq!(split_archive_path(Path::new("/a/b.txt")), None);
+ assert_eq!(split_archive_path(Path::new("/a/x!/y")), None, "not an archive extension");
+ assert_eq!(split_archive_path(Path::new("/a/s.zip!")), Some((PathBuf::from("/a/s.zip"), String::new())));
+ assert_eq!(
+ split_archive_path(Path::new("/a/lib.JAR!/org/x/A.java")),
+ Some((PathBuf::from("/a/lib.JAR"), "org/x/A.java".into()))
+ );
+ assert_eq!(split_archive_path(Path::new("/a/s.zip!/dir/")), Some((PathBuf::from("/a/s.zip"), "dir".into())));
+ assert_eq!(archive_entry_path(Path::new("/a/s.zip"), "x/y.java"), PathBuf::from("/a/s.zip!/x/y.java"));
+ assert_eq!(archive_entry_path(Path::new("/a/s.zip"), ""), PathBuf::from("/a/s.zip!"));
+ assert!(is_archive_path(Path::new("/a/s.zip!/x")));
+ }
+
+ #[test]
+ fn lists_and_reads_entries_with_implicit_directories() {
+ let tmp = tempfile::tempdir().unwrap();
+ let zip = tmp.path().join("src.zip");
+ write_zip(
+ &zip,
+ &[
+ ("java.base/java/lang/String.java", "class String {}"),
+ ("java.base/java/lang/Object.java", "class Object {}"),
+ ("java.base/java/util/", ""),
+ ("java.base/module-info.java", "module java.base {}"),
+ ("README", "hi"),
+ ("../evil", "x"),
+ ],
+ );
+ let names = |dir: &str| -> Vec<(String, EntryKind)> {
+ read_archive_dir(&zip, dir).unwrap().into_iter().map(|e| (e.name, e.kind)).collect()
+ };
+ assert_eq!(names(""), vec![("java.base".into(), EntryKind::Dir), ("README".into(), EntryKind::File)]);
+ assert_eq!(
+ names("java.base"),
+ vec![("java".into(), EntryKind::Dir), ("module-info.java".into(), EntryKind::File)]
+ );
+ assert_eq!(names("java.base/java"), vec![("lang".into(), EntryKind::Dir), ("util".into(), EntryKind::Dir)]);
+ let lang = read_archive_dir(&zip, "java.base/java/lang").unwrap();
+ assert_eq!(lang.iter().map(|e| e.name.as_str()).collect::<Vec<_>>(), ["Object.java", "String.java"]);
+ assert_eq!(*lang[1].path, *archive_entry_path(&zip, "java.base/java/lang/String.java"));
+ assert!(names("java.base/java/util").is_empty());
+ assert_eq!(read_archive_entry(&zip, "java.base/java/lang/String.java").unwrap().0, b"class String {}");
+ assert_eq!(read_archive_entry(&zip, "missing").unwrap_err().kind, ide_core::error::ErrorKind::NotFound);
+ assert!(read_archive_entry(&zip, "java.base").is_err());
+ assert!(read_archive_dir(&zip, "README").is_err());
+
+ // A rewritten archive is re-read.
+ write_zip(&zip, &[("only.txt", "1")]);
+ let f = File::options().write(true).open(&zip).unwrap();
+ f.set_modified(SystemTime::now() + std::time::Duration::from_secs(5)).unwrap();
+ assert_eq!(names(""), vec![("only.txt".into(), EntryKind::File)]);
+ }
+
+ #[test]
+ fn read_dir_and_load_text_go_through_archives() {
+ let tmp = tempfile::tempdir().unwrap();
+ let jar = tmp.path().join("lib-sources.jar");
+ write_zip(&jar, &[("org/x/A.java", "class A {}\n"), ("org/x/B.class", "\0\0bin")]);
+ let root = crate::read_dir(&archive_root(&jar), &[]).unwrap();
+ assert_eq!(root.iter().map(|e| e.name.as_str()).collect::<Vec<_>>(), ["org"]);
+ assert_eq!(crate::read_dir(&jar, &[]).unwrap().len(), 1, "the archive file itself lists its root");
+ let a = crate::load_text(&archive_entry_path(&jar, "org/x/A.java")).unwrap();
+ assert_eq!((a.text.as_str(), a.encoding.as_str(), a.binary), ("class A {}\n", "utf-8", false));
+ assert!(crate::load_text(&archive_entry_path(&jar, "org/x/B.class")).unwrap().binary);
+ let gbk = crate::load_text_as(&archive_entry_path(&jar, "org/x/A.java"), "gbk").unwrap();
+ assert_eq!(gbk.encoding, "gbk");
+ let probe = crate::probe(&archive_entry_path(&jar, "org/x/B.class")).unwrap();
+ assert!(probe.binary && probe.size == 5);
+ let range = crate::read_range(&archive_entry_path(&jar, "org/x/A.java"), 6, 3).unwrap();
+ assert_eq!((range.offset, range.data.as_str(), range.total), (6, crate::base64(b"A {").as_str(), 11));
+ }
+}
diff --git a/crates/ide-vfs/src/bytes.rs b/crates/ide-vfs/src/bytes.rs
index 00e4f60de..128b1cef2 100644
--- a/crates/ide-vfs/src/bytes.rs
+++ b/crates/ide-vfs/src/bytes.rs
@@ -36,8 +36,24 @@ pub struct ByteRange {
pub total: u64,
}
+/// Entry bytes of an archive path (`<archive>!/<entry>`), `None` for ordinary paths.
+fn archive_bytes(path: &Path, limit: u64) -> IdeResult<Option<Vec<u8>>> {
+ let Some((archive, entry)) = crate::split_archive_path(path) else { return Ok(None) };
+ let (size, _) = crate::archive::entry_size(&archive, &entry)?;
+ if size > limit {
+ return Err(IdeError::invalid(format!("{} is too large ({} MiB)", path.display(), size / (1024 * 1024))));
+ }
+ Ok(Some(crate::read_archive_entry(&archive, &entry)?.0))
+}
+
/// Reads only the head of the file to classify it.
pub fn probe(path: &Path) -> IdeResult<FileProbe> {
+ if let Some((archive, entry)) = crate::split_archive_path(path) {
+ let (size, _) = crate::archive::entry_size(&archive, &entry)?;
+ let head =
+ if size > crate::MAX_OPEN_SIZE { Vec::new() } else { crate::read_archive_entry(&archive, &entry)?.0 };
+ return Ok(FileProbe { size, binary: looks_binary(&head), too_large: size > READ_ONLY_THRESHOLD });
+ }
let meta = fs::metadata(path)?;
if meta.is_dir() {
return Err(IdeError::invalid(format!("{} is a directory", path.display())));
@@ -49,6 +65,12 @@ pub fn probe(path: &Path) -> IdeResult<FileProbe> {
/// Reads up to `len` bytes (capped at [`MAX_RANGE_LEN`]) from `offset`.
pub fn read_range(path: &Path, offset: u64, len: u32) -> IdeResult<ByteRange> {
+ if let Some(bytes) = archive_bytes(path, crate::MAX_OPEN_SIZE)? {
+ let total = bytes.len() as u64;
+ let offset = offset.min(total);
+ let end = (offset + u64::from(len.min(MAX_RANGE_LEN))).min(total);
+ return Ok(ByteRange { offset, data: base64(&bytes[offset as usize..end as usize]), total });
+ }
let mut file = File::open(path)?;
let total = file.metadata()?.len();
let offset = offset.min(total);
@@ -79,6 +101,9 @@ pub fn image_mime(path: &Path) -> Option<&'static str> {
pub fn read_data_url(path: &Path) -> IdeResult<String> {
let mime =
image_mime(path).ok_or_else(|| IdeError::invalid(format!("{} is not a supported image", path.display())))?;
+ if let Some(bytes) = archive_bytes(path, MAX_IMAGE_SIZE)? {
+ return Ok(format!("data:{mime};base64,{}", base64(&bytes)));
+ }
let meta = fs::metadata(path)?;
if meta.len() > MAX_IMAGE_SIZE {
return Err(IdeError::invalid(format!(
diff --git a/crates/ide-vfs/src/encoding.rs b/crates/ide-vfs/src/encoding.rs
index cc381db89..6a3d1d8d4 100644
--- a/crates/ide-vfs/src/encoding.rs
+++ b/crates/ide-vfs/src/encoding.rs
@@ -94,7 +94,34 @@ pub(crate) fn decode(bytes: &[u8]) -> (String, &'static Encoding, bool, bool) {
(text.into_owned(), enc, false, false)
}
+/// Bytes of a file inside an archive (size-checked) and the archive's mtime.
+fn archive_bytes(path: &Path) -> IdeResult<Option<(Vec<u8>, f64)>> {
+ let Some((archive, entry)) = crate::split_archive_path(path) else { return Ok(None) };
+ let (size, _) = crate::archive::entry_size(&archive, &entry)?;
+ if size > MAX_OPEN_SIZE {
+ return Err(IdeError::invalid(format!(
+ "{} is too large to open ({} MiB)",
+ path.display(),
+ size / (1024 * 1024)
+ )));
+ }
+ crate::read_archive_entry(&archive, &entry).map(Some)
+}
+
pub(crate) fn load_text(path: &Path) -> IdeResult<LoadedText> {
+ if let Some((bytes, mtime_ms)) = archive_bytes(path)? {
+ let len = bytes.len() as u64;
+ let (text, enc, has_bom, binary) = decode_owned(bytes);
+ return Ok(LoadedText {
+ text,
+ encoding: encoding_label(enc),
+ has_bom,
+ binary,
+ large: len > LARGE_FILE_THRESHOLD,
+ too_large: len > READ_ONLY_THRESHOLD,
+ mtime_ms,
+ });
+ }
let meta = fs::metadata(path)?;
if meta.is_dir() {
return Err(IdeError::invalid(format!("{} is a directory", path.display())));
@@ -126,7 +153,10 @@ pub(crate) fn load_text_as(path: &Path, encoding: &str) -> IdeResult<LoadedText>
let enc = Encoding::for_label(encoding.trim().as_bytes())
.ok_or_else(|| IdeError::invalid(format!("unknown encoding {encoding:?}")))?;
let mut loaded = load_text(path)?;
- let bytes = fs::read(path)?;
+ let bytes = match archive_bytes(path)? {
+ Some((bytes, _)) => bytes,
+ None => fs::read(path)?,
+ };
let (body, has_bom) = match Encoding::for_bom(&bytes) {
Some((bom_enc, len)) if bom_enc == enc => (&bytes[len..], true),
_ => (&bytes[..], false),
diff --git a/crates/ide-vfs/src/lib.rs b/crates/ide-vfs/src/lib.rs
index ee528ac46..baa0c7962 100644
--- a/crates/ide-vfs/src/lib.rs
+++ b/crates/ide-vfs/src/lib.rs
@@ -1,5 +1,6 @@
//! File system access for the IDE. The UI never touches the disk directly.
+mod archive;
mod bytes;
mod encoding;
mod ops;
@@ -14,6 +15,10 @@ use std::fs;
use std::path::{Path, PathBuf};
use std::sync::Arc;
+pub use archive::{
+ ARCHIVE_EXTENSIONS, archive_entry_path, archive_root, is_archive_file, is_archive_path, read_archive_dir,
+ read_archive_entry, split_archive_path,
+};
pub use bytes::{ByteRange, FileProbe, MAX_RANGE_LEN, base64, image_mime, probe, read_data_url, read_range};
use encoding::SNIFF_LEN;
pub use encoding::{LARGE_FILE_THRESHOLD, MAX_OPEN_SIZE, READ_ONLY_THRESHOLD, encode, write_atomic};
@@ -100,7 +105,15 @@ pub fn natural_cmp(a: &str, b: &str) -> Ordering {
/// Symlinks are reported as [`EntryKind::Symlink`] but sorted (and sized) by
/// what they point to. `excluded` reflects `excludes` (relative to the enclosing
/// repository root, else to `dir`); `ignored` also the applicable `.gitignore`/`.ignore` files.
+///
+/// Inside an archive (`<archive>!/<entry>`, or the archive file itself) lists its entries.
pub fn read_dir(dir: &Path, excludes: &[String]) -> IdeResult<Vec<FileEntry>> {
+ if let Some((archive, entry)) = split_archive_path(dir) {
+ return read_archive_dir(&archive, &entry);
+ }
+ if is_archive_file(dir) && fs::metadata(dir).is_ok_and(|m| m.is_file()) {
+ return read_archive_dir(dir, "");
+ }
if !fs::metadata(dir)?.is_dir() {
return Err(IdeError::invalid(format!("{} is not a directory", dir.display())));
}
diff --git a/crates/ide-vfs/src/watch.rs b/crates/ide-vfs/src/watch.rs
index 570aeb877..3cc884e46 100644
--- a/crates/ide-vfs/src/watch.rs
+++ b/crates/ide-vfs/src/watch.rs
@@ -12,7 +12,7 @@ use ide_core::{IdeError, IdeEvent, IdeResult, SharedSink};
use notify_debouncer_full::notify::event::{ModifyKind, RenameMode};
use notify_debouncer_full::notify::{self, EventKind, RecommendedWatcher, RecursiveMode, Watcher as _};
use notify_debouncer_full::{DebounceEventResult, DebouncedEvent, Debouncer, NoCache, new_debouncer_opt};
-use parking_lot::{Condvar, Mutex};
+use parking_lot::{Condvar, Mutex, RwLock};
use std::collections::{BTreeMap, BTreeSet, HashSet};
use std::path::{Component, Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
@@ -47,8 +47,11 @@ type OnChange = Box<dyn Fn(&FsBatch) + Send + Sync>;
/// no callback runs after `drop` returns.
pub struct Watcher {
inner: Inner,
+ excludes: SharedExcludes,
}
+type SharedExcludes = Arc<RwLock<ExcludeMatcher>>;
+
enum Inner {
Recursive(#[allow(dead_code)] Debouncer<RecommendedWatcher, NoCache>),
PerDirectory { state: Arc<DirState>, thread: Option<JoinHandle<()>> },
@@ -68,6 +71,7 @@ impl Watcher {
) -> IdeResult<Self> {
let root = dunce::canonicalize(root)?;
let filter = EventFilter::new(root.clone(), &excludes);
+ let shared = filter.excludes.clone();
let emit = move |batch: &FsBatch| {
sink.emit(IdeEvent::FsChanged {
created: batch.created.iter().map(Into::into).collect(),
@@ -76,10 +80,18 @@ impl Watcher {
});
on_change(batch);
};
- match mode {
+ let inner = match mode {
WatchMode::Recursive => Self::start_recursive(root, filter, emit),
WatchMode::PerDirectory => Self::start_per_directory(root, filter, emit),
- }
+ }?;
+ Ok(Self { inner, excludes: shared })
+ }
+
+ /// Replaces the exclude globs (Settings › Project Structure / File Types
+ /// changed): later events below newly excluded folders are dropped. In
+ /// per-directory mode, folders no longer excluded are watched once they change.
+ pub fn set_excludes(&self, excludes: &[String]) {
+ *self.excludes.write() = ExcludeMatcher::new(excludes);
}
/// Number of OS-level watches (1 in recursive mode).
@@ -94,7 +106,7 @@ impl Watcher {
root: PathBuf,
filter: EventFilter,
emit: impl Fn(&FsBatch) + Send + 'static,
- ) -> IdeResult<Self> {
+ ) -> IdeResult<Inner> {
// No file-id cache: building it walks and stats the whole tree before `watch` returns,
// which made opening large projects block for seconds. Renames arrive as remove + create.
let handler = move |result: DebounceEventResult| match result {
@@ -116,14 +128,14 @@ impl Watcher {
debouncer
.watch(&root, RecursiveMode::Recursive)
.map_err(|e| io_error(format!("cannot watch {}: {e}", root.display())))?;
- Ok(Self { inner: Inner::Recursive(debouncer) })
+ Ok(Inner::Recursive(debouncer))
}
fn start_per_directory(
root: PathBuf,
filter: EventFilter,
emit: impl Fn(&FsBatch) + Send + 'static,
- ) -> IdeResult<Self> {
+ ) -> IdeResult<Inner> {
let state = Arc::new(DirState {
filter,
watcher: Mutex::new(None),
@@ -160,7 +172,7 @@ impl Watcher {
.spawn(move || state.run(emit))
.map_err(|e| io_error(format!("cannot start file watcher: {e}")))?
};
- Ok(Self { inner: Inner::PerDirectory { state, thread: Some(thread) } })
+ Ok(Inner::PerDirectory { state, thread: Some(thread) })
}
}
@@ -359,13 +371,17 @@ fn merge(prev: Option<Change>, next: Change) -> Change {
pub(crate) struct EventFilter {
root: PathBuf,
- excludes: ExcludeMatcher,
+ excludes: SharedExcludes,
gitignore: GitignoreStack,
}
impl EventFilter {
pub fn new(root: PathBuf, excludes: &[String]) -> Self {
- Self { gitignore: GitignoreStack::new(&root), excludes: ExcludeMatcher::new(excludes), root }
+ Self {
+ gitignore: GitignoreStack::new(&root),
+ excludes: Arc::new(RwLock::new(ExcludeMatcher::new(excludes))),
+ root,
+ }
}
/// `Some(true)` for interesting VCS metadata, `Some(false)` for other `.git`
@@ -405,13 +421,15 @@ impl EventFilter {
_ => false,
};
}
- !self.excludes.is_excluded(rel) && !self.gitignore.is_ignored(dir, true)
+ !self.excludes.read().is_excluded(rel) && !self.gitignore.is_ignored(dir, true)
}
/// Whether a path found by scanning a new directory would be reported.
fn is_reported(&self, path: &Path, is_dir: bool) -> bool {
let Ok(rel) = path.strip_prefix(&self.root) else { return false };
- Self::git_internal(rel).is_none() && !self.excludes.is_excluded(rel) && !self.gitignore.is_ignored(path, is_dir)
+ Self::git_internal(rel).is_none()
+ && !self.excludes.read().is_excluded(rel)
+ && !self.gitignore.is_ignored(path, is_dir)
}
fn classify(&self, path: &Path, change: Change, out: &mut BTreeMap<PathBuf, Change>) {
@@ -507,7 +525,7 @@ impl EventFilter {
(c, _) => c,
};
if let Ok(rel) = path.strip_prefix(&self.root) {
- if self.excludes.is_excluded(rel) {
+ if self.excludes.read().is_excluded(rel) {
continue;
}
let is_dir = meta.as_ref().is_some_and(|m| m.is_dir());
@@ -654,6 +672,9 @@ mod tests {
assert!(w(".git") && w(".git/refs") && w(".git/refs/heads") && w(".git/info"));
assert!(!w(".git/objects") && !w(".git/objects/ab") && !w(".git/logs"));
assert!(!filter.should_watch_dir(Path::new("/elsewhere")));
+ // Excludes are replaced in place (Watcher::set_excludes).
+ *filter.excludes.write() = ExcludeMatcher::new(&["gen".into()]);
+ assert!(w("node_modules") && !w("src/gen"));
}
fn watcher_state(w: &Watcher) -> &DirState {
diff --git a/crates/ide-workspace/Cargo.toml b/crates/ide-workspace/Cargo.toml
index dcbd58a48..b963c5e3a 100644
--- a/crates/ide-workspace/Cargo.toml
+++ b/crates/ide-workspace/Cargo.toml
@@ -23,3 +23,4 @@ globset.workspace = true
[dev-dependencies]
tempfile.workspace = true
encoding_rs.workspace = true
+zip = { version = "=2.4.2", default-features = false, features = ["deflate"] }
diff --git a/crates/ide-workspace/examples/open_large.rs b/crates/ide-workspace/examples/open_large.rs
index 9c63ac27e..9fb418fdf 100644
--- a/crates/ide-workspace/examples/open_large.rs
+++ b/crates/ide-workspace/examples/open_large.rs
@@ -17,7 +17,8 @@ fn main() {
std::fs::write(&path, &text).expect("write");
drop(text);
- let docs = Documents::new(Arc::new(NullSink), Box::new(|_| LanguageId::plain_text()));
+ let docs =
+ Documents::new(Arc::new(NullSink), Box::new(|_: &std::path::Path, _: Option<&str>| LanguageId::plain_text()));
let rss0 = resident_bytes().unwrap_or(0);
let t = Instant::now();
let info = docs.open(&path).expect("open");
diff --git a/crates/ide-workspace/src/documents.rs b/crates/ide-workspace/src/documents.rs
index 5e94f1a63..ca420936b 100644
--- a/crates/ide-workspace/src/documents.rs
+++ b/crates/ide-workspace/src/documents.rs
@@ -46,6 +46,9 @@ pub struct TextSnapshot {
pub text: String,
}
+/// Language of a file from its path and first line (hashbangs).
+pub type DetectLanguage = dyn Fn(&Path, Option<&str>) -> LanguageId + Send + Sync;
+
/// Registry of open documents keyed by path, with ref-counting so split
/// editors on the same file share one buffer.
///
@@ -55,7 +58,7 @@ pub struct Documents {
registry: Mutex<Registry>,
observers: RwLock<Vec<Arc<dyn DocumentObserver>>>,
sink: SharedSink,
- detect_language: Box<dyn Fn(&Path) -> LanguageId + Send + Sync>,
+ detect_language: Box<DetectLanguage>,
editorconfig: EditorConfig,
defaults: RwLock<FileDefaults>,
}
@@ -148,7 +151,7 @@ fn read_only_error(path: &Path) -> IdeError {
}
impl Documents {
- pub fn new(sink: SharedSink, detect_language: Box<dyn Fn(&Path) -> LanguageId + Send + Sync>) -> Self {
+ pub fn new(sink: SharedSink, detect_language: Box<DetectLanguage>) -> Self {
Self {
registry: Mutex::default(),
observers: RwLock::default(),
@@ -238,13 +241,19 @@ impl Documents {
}
let defaults = self.file_defaults();
let loaded = ide_vfs::load_text_with_fallback(path, defaults.fallback_for(&absolute(path)))?;
- let language = (self.detect_language)(path);
- let meta = std::fs::metadata(path).ok();
- let writable = meta.as_ref().map(|m| !m.permissions().readonly()).unwrap_or(true);
+ let language = (self.detect_language)(path, loaded.text.lines().next());
+ // Archive entries (`<jar>!/<entry>`) are read-only and kept from language
+ // servers and Local History, which only know real files.
+ let in_archive = ide_vfs::is_archive_path(path);
+ let meta = if in_archive { None } else { std::fs::metadata(path).ok() };
+ let writable = !in_archive && meta.as_ref().map(|m| !m.permissions().readonly()).unwrap_or(true);
let empty_file = meta.as_ref().is_some_and(|m| m.len() == 0);
- let observed = !(loaded.binary || loaded.too_large);
- let editorconfig =
- if loaded.binary || !defaults.editorconfig { None } else { self.editorconfig.resolve(&absolute(path)) };
+ let observed = !(loaded.binary || loaded.too_large || in_archive);
+ let editorconfig = if loaded.binary || in_archive || !defaults.editorconfig {
+ None
+ } else {
+ self.editorconfig.resolve(&absolute(path))
+ };
let mut doc = Document::new(&loaded.text);
let (mut encoding, mut has_bom) = (loaded.encoding, loaded.has_bom);
// An empty file has nothing to detect: Code Style / File Encodings defaults apply.
@@ -577,6 +586,37 @@ impl Documents {
self.registry.lock().docs.keys().copied().collect()
}
+ /// Detects the language of every open file again (file type associations
+ /// changed). A document whose language changes is reopened for the
+ /// observers, so it moves to the matching language servers and syntax tree,
+ /// and reported as [`IdeEvent::DocLanguage`]. Returns the changed documents.
+ pub fn redetect_languages(&self) -> Vec<DocId> {
+ let slots: Vec<(DocId, Slot)> = self.registry.lock().docs.iter().map(|(id, e)| (*id, e.slot.clone())).collect();
+ let mut changed = Vec::new();
+ for (id, slot) in slots {
+ let mut st = slot.lock();
+ if st.closed || st.uri.is_some() {
+ continue;
+ }
+ let text = st.doc.text();
+ let language = (self.detect_language)(&st.path, text.lines().next());
+ if language == st.language {
+ continue;
+ }
+ st.language = language.clone();
+ if st.observed {
+ let info = Self::info_with_text(id, &st, text);
+ for o in self.observers() {
+ o.closed(id, &st.path);
+ o.opened(&info);
+ }
+ }
+ self.sink.emit(IdeEvent::DocLanguage { doc: id, language });
+ changed.push(id);
+ }
+ changed
+ }
+
/// Changes the line ending used on save; marks the document dirty.
pub fn set_line_ending(&self, doc: DocId, le: LineEnding) -> IdeResult<()> {
self.with_doc(doc, |st| {
diff --git a/crates/ide-workspace/src/file_moves.rs b/crates/ide-workspace/src/file_moves.rs
index 249f3d94d..dbac62857 100644
--- a/crates/ide-workspace/src/file_moves.rs
+++ b/crates/ide-workspace/src/file_moves.rs
@@ -241,7 +241,7 @@ mod tests {
use std::sync::Arc;
fn documents() -> Documents {
- Documents::new(Arc::new(|_| {}), Box::new(|_: &Path| LanguageId::new("plaintext")))
+ Documents::new(Arc::new(|_| {}), Box::new(|_: &Path, _: Option<&str>| LanguageId::new("plaintext")))
}
fn apply(documents: &Documents) -> impl Fn(&WorkspaceEdit) -> IdeResult<()> + '_ {
diff --git a/crates/ide-workspace/src/lib.rs b/crates/ide-workspace/src/lib.rs
index ab8ac7592..ba006750b 100644
--- a/crates/ide-workspace/src/lib.rs
+++ b/crates/ide-workspace/src/lib.rs
@@ -14,7 +14,7 @@ pub mod roots;
pub mod settings;
pub mod text_refs;
-pub use documents::{DocumentInfo, Documents, TextSnapshot};
+pub use documents::{DetectLanguage, DocumentInfo, Documents, TextSnapshot};
pub use editorconfig::{EditorConfig, EditorConfigProps};
pub use file_defaults::FileDefaults;
pub use file_moves::{FileMove, FileMoves, UndoOutcome};
diff --git a/crates/ide-workspace/src/recent.rs b/crates/ide-workspace/src/recent.rs
index b6b40ea31..3c05e178b 100644
--- a/crates/ide-workspace/src/recent.rs
+++ b/crates/ide-workspace/src/recent.rs
@@ -62,6 +62,20 @@ impl RecentProjects {
self.persist(&items)
}
+ /// Shows `path` as `name` (File › Rename Project…); `None` restores its folder name.
+ pub fn rename(&self, path: &Path, name: Option<&str>) -> IdeResult<()> {
+ let mut items = self.items.lock();
+ let Some(item) = items.iter_mut().find(|p| p.path == path) else { return Ok(()) };
+ let name = name.map(str::to_owned).unwrap_or_else(|| {
+ path.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_else(|| path.display().to_string())
+ });
+ if item.name == name {
+ return Ok(());
+ }
+ item.name = name;
+ self.persist(&items)
+ }
+
pub fn remove(&self, path: &Path) -> IdeResult<()> {
let mut items = self.items.lock();
let before = items.len();
@@ -116,4 +130,17 @@ mod tests {
std::fs::write(cfg.join("recent.json"), "not json").unwrap();
assert!(RecentProjects::load(&cfg).list().is_empty());
}
+
+ #[test]
+ fn rename_shows_a_custom_name_until_reset() {
+ let tmp = tempfile::tempdir().unwrap();
+ let recent = RecentProjects::load(tmp.path());
+ recent.touch(Path::new("/p/app"), None).unwrap();
+ recent.rename(Path::new("/p/app"), Some("Shop Backend")).unwrap();
+ recent.rename(Path::new("/p/unknown"), Some("x")).unwrap();
+ assert_eq!(RecentProjects::load(tmp.path()).list()[0].name, "Shop Backend");
+ recent.rename(Path::new("/p/app"), None).unwrap();
+ assert_eq!(recent.list()[0].name, "app");
+ assert_eq!(recent.list().len(), 1);
+ }
}
diff --git a/crates/ide-workspace/src/settings.rs b/crates/ide-workspace/src/settings.rs
index 64309df32..b7afa4b12 100644
--- a/crates/ide-workspace/src/settings.rs
+++ b/crates/ide-workspace/src/settings.rs
@@ -2,6 +2,7 @@ use ide_core::settings::Settings;
use ide_core::{IdeError, IdeResult, project_dir};
use parking_lot::RwLock;
use serde_json::Value as Json;
+use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use toml_edit::{DocumentMut, Item, Table, TableLike};
@@ -230,6 +231,52 @@ impl SettingsStore {
*self.effective.write() = settings.clone();
settings
}
+
+ /// File › Manage IDE Settings › Export Settings…: the global layer plus
+ /// frontend-held IDE state (`storage`: keymaps' companions such as live
+ /// templates, macros) as one JSON file.
+ pub fn export_bundle(&self, path: &Path, storage: BTreeMap<String, String>) -> IdeResult<()> {
+ let settings = match std::fs::read_to_string(&self.global_file) {
+ Ok(t) => t,
+ Err(e) if e.kind() == std::io::ErrorKind::NotFound => String::new(),
+ Err(e) => return Err(e.into()),
+ };
+ let bundle = SettingsBundle { format: BUNDLE_FORMAT.into(), version: BUNDLE_VERSION, settings, storage };
+ let json = serde_json::to_vec_pretty(&bundle).map_err(|e| IdeError::internal(e.to_string()))?;
+ ide_vfs::write_atomic(path, &json)?;
+ Ok(())
+ }
+
+ /// Import Settings…: replaces the global layer with the bundle's (validated
+ /// first) and returns the new effective settings and the bundle's `storage`.
+ pub fn import_bundle(&self, path: &Path) -> IdeResult<(Settings, BTreeMap<String, String>)> {
+ let bytes = std::fs::read(path)?;
+ let bundle: SettingsBundle = serde_json::from_slice(&bytes)
+ .map_err(|e| IdeError::invalid(format!("not an OpenIDEA settings file: {e}")))?;
+ if bundle.format != BUNDLE_FORMAT || bundle.version > BUNDLE_VERSION {
+ return Err(IdeError::invalid("not an OpenIDEA settings file, or one from a newer version"));
+ }
+ let layer = parse_layer(&bundle.settings).map_err(|e| IdeError::invalid(format!("invalid settings: {e}")))?;
+ try_merge(&mut defaults_json(), layer).map_err(|e| IdeError::invalid(format!("invalid settings: {e}")))?;
+ if let Some(dir) = self.global_file.parent() {
+ std::fs::create_dir_all(dir)?;
+ }
+ ide_vfs::write_atomic(&self.global_file, bundle.settings.as_bytes())?;
+ Ok((self.reload(), bundle.storage))
+ }
+}
+
+const BUNDLE_FORMAT: &str = "openidea-settings";
+const BUNDLE_VERSION: u32 = 1;
+
+#[derive(serde::Serialize, serde::Deserialize)]
+struct SettingsBundle {
+ format: String,
+ version: u32,
+ /// The global `settings.toml`, verbatim (comments included).
+ settings: String,
+ #[serde(default)]
+ storage: BTreeMap<String, String>,
}
#[cfg(test)]
@@ -320,4 +367,68 @@ mod tests {
let reloaded = SettingsStore::load(&cfg, Some(&proj)).effective();
assert_eq!(reloaded, store.effective());
}
+
+ #[test]
+ fn inspection_profiles_live_in_their_layers() {
+ let tmp = tempfile::tempdir().unwrap();
+ let cfg = tmp.path().join("cfg");
+ let proj = tmp.path().join("proj");
+ std::fs::create_dir_all(&cfg).unwrap();
+ let store = SettingsStore::load(&cfg, Some(&proj));
+ store.set(SettingsScope::Global, "inspections.default", json!({"lsp:ruff:F401": {"enabled": false}})).unwrap();
+ store.set(SettingsScope::Project, "inspections.project", json!({"lsp:ruff": {"severity": "typo"}})).unwrap();
+ let s = store.set(SettingsScope::Project, "inspections.profile", json!("project")).unwrap();
+ assert_eq!(s.inspections.profile, "project");
+ assert_eq!(s.inspections.default["lsp:ruff:F401"].enabled, Some(false));
+ assert_eq!(s.inspections.project["lsp:ruff"].severity, Some(ide_core::settings::InspectionLevel::Typo));
+ assert!(store.set(SettingsScope::Project, "inspections.project", json!({"x": {"severity": "loud"}})).is_err());
+ let global = std::fs::read_to_string(cfg.join("settings.toml")).unwrap();
+ assert!(!global.contains("profile"), "{global}");
+ }
+
+ #[test]
+ fn settings_bundle_round_trips_and_rejects_invalid_files() {
+ let tmp = tempfile::tempdir().unwrap();
+ let (a, b) = (tmp.path().join("a"), tmp.path().join("b"));
+ std::fs::create_dir_all(&a).unwrap();
+ let source = SettingsStore::load(&a, None);
+ source.set(SettingsScope::Global, "editor.fontSize", json!(17)).unwrap();
+ source.set(SettingsScope::Global, "general.powerSaveMode", json!(true)).unwrap();
+ let file = tmp.path().join("settings.json");
+ let storage = BTreeMap::from([("openidea.macros.v1".to_owned(), "[]".to_owned())]);
+ source.export_bundle(&file, storage.clone()).unwrap();
+
+ let target = SettingsStore::load(&b, None);
+ let (settings, imported) = target.import_bundle(&file).unwrap();
+ assert_eq!(settings.editor.font_size, 17.0);
+ assert!(settings.general.power_save_mode);
+ assert_eq!(imported, storage);
+ assert_eq!(target.effective(), source.effective());
+
+ let bad = tmp.path().join("bad.json");
+ std::fs::write(&bad, r#"{"format":"openidea-settings","version":1,"settings":"[editor]\nfontSize = \"x\"\n"}"#)
+ .unwrap();
+ assert!(target.import_bundle(&bad).is_err());
+ std::fs::write(&bad, r#"{"format":"other","version":1,"settings":""}"#).unwrap();
+ assert!(target.import_bundle(&bad).is_err());
+ assert_eq!(target.effective().editor.font_size, 17.0);
+ }
+
+ #[test]
+ fn main_toolbar_can_be_set_and_reset() {
+ let tmp = tempfile::tempdir().unwrap();
+ let store = SettingsStore::load(tmp.path(), None);
+ let s = store
+ .set(
+ SettingsScope::Global,
+ "appearance.mainToolbar",
+ json!({"left": ["project"], "right": [], "hidden": ["vcs.branch"]}),
+ )
+ .unwrap();
+ let toolbar = s.appearance.main_toolbar.unwrap();
+ assert_eq!(toolbar.left, ["project"]);
+ assert_eq!(toolbar.hidden, ["vcs.branch"]);
+ let s = store.set(SettingsScope::Global, "appearance.mainToolbar", Json::Null).unwrap();
+ assert_eq!(s.appearance.main_toolbar, None);
+ }
}
diff --git a/crates/ide-workspace/tests/documents.rs b/crates/ide-workspace/tests/documents.rs
index 30176e3a6..04614deae 100644
--- a/crates/ide-workspace/tests/documents.rs
+++ b/crates/ide-workspace/tests/documents.rs
@@ -47,7 +47,7 @@ fn fixture() -> Fixture {
};
let docs = Documents::new(
sink,
- Box::new(|p: &Path| match p.extension().and_then(|e| e.to_str()) {
+ Box::new(|p: &Path, _: Option<&str>| match p.extension().and_then(|e| e.to_str()) {
Some("rs") => LanguageId::new("rust"),
_ => LanguageId::plain_text(),
}),
@@ -61,6 +61,51 @@ fn change(from: u32, to: u32, insert: &str) -> ChangeSet {
ChangeSet { changes: vec![TextChange { from, to, insert: insert.into() }] }
}
+#[test]
+fn redetect_reopens_documents_whose_language_changed() {
+ let tmp = tempfile::tempdir().unwrap();
+ let events: Arc<Mutex<Vec<IdeEvent>>> = Arc::default();
+ let sink: SharedSink = {
+ let events = events.clone();
+ Arc::new(move |e: IdeEvent| events.lock().push(e))
+ };
+ let foo_is_python = Arc::new(Mutex::new(false));
+ let docs = {
+ let foo_is_python = foo_is_python.clone();
+ Documents::new(
+ sink,
+ Box::new(move |p: &Path, first: Option<&str>| {
+ if p.extension().is_some_and(|e| e == "foo") && *foo_is_python.lock() {
+ LanguageId::new("python")
+ } else if first.is_some_and(|l| l.starts_with("#!")) {
+ LanguageId::new("shellscript")
+ } else {
+ LanguageId::plain_text()
+ }
+ }),
+ )
+ };
+ let rec = Arc::new(Recorder::default());
+ docs.add_observer(rec.clone());
+ let foo = tmp.path().join("a.foo");
+ let script = tmp.path().join("run");
+ fs::write(&foo, "x = 1\n").unwrap();
+ fs::write(&script, "#!/bin/sh\necho\n").unwrap();
+ let a = docs.open(&foo).unwrap();
+ assert_eq!(a.language.as_str(), "plaintext");
+ assert_eq!(docs.open(&script).unwrap().language.as_str(), "shellscript", "the first line is detected");
+
+ assert!(docs.redetect_languages().is_empty());
+ *foo_is_python.lock() = true;
+ assert_eq!(docs.redetect_languages(), vec![a.id]);
+ assert_eq!(docs.snapshot(a.id).unwrap().language.as_str(), "python");
+ let log = rec.log.lock().clone();
+ assert_eq!(log[log.len() - 2..], ["close".to_owned(), "open v0 python".to_owned()]);
+ assert!(events.lock().iter().any(
+ |e| matches!(e, IdeEvent::DocLanguage { doc, language } if *doc == a.id && language.as_str() == "python")
+ ));
+}
+
fn dirty_events(events: &[IdeEvent]) -> Vec<bool> {
events.iter().filter_map(|e| if let IdeEvent::DocDirty { dirty, .. } = e { Some(*dirty) } else { None }).collect()
}
@@ -450,3 +495,20 @@ fn toggling_the_writable_bit_updates_the_open_document() {
assert!(f.docs.set_writable(&other, false).unwrap());
assert!(fs::metadata(&other).unwrap().permissions().readonly());
}
+
+#[test]
+fn archive_entries_open_read_only_without_observers() {
+ use std::io::Write;
+ let f = fixture();
+ let jar = f.root.join("lib-sources.jar");
+ let mut w = zip::ZipWriter::new(fs::File::create(&jar).unwrap());
+ w.start_file("org/x/Main.rs", zip::write::SimpleFileOptions::default()).unwrap();
+ w.write_all(b"fn main() {}\n").unwrap();
+ w.finish().unwrap();
+ let path = ide_vfs::archive_entry_path(&jar, "org/x/Main.rs");
+ let info = f.docs.open(&path).unwrap();
+ assert_eq!((info.text.as_str(), info.language.as_str(), info.read_only), ("fn main() {}\n", "rust", true));
+ assert_eq!(*info.path, *path);
+ assert!(f.rec.log.lock().is_empty(), "language servers / history never see archive entries");
+ f.docs.close(info.id);
+}
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index df445e1f1..795196c05 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -54,6 +54,7 @@ ide-profiler.workspace = true
ide-http.workspace = true
ide-db.workspace = true
ide-web.workspace = true
+ide-spell.workspace = true
ide-tools = { path = "../crates/ide-tools" }
ide-plugin = { path = "../crates/ide-plugin" }
ide-docker = { path = "../crates/ide-docker" }
diff --git a/src-tauri/src/commands/analysis.rs b/src-tauri/src/commands/analysis.rs
index 76b9cfaea..3646f8310 100644
--- a/src-tauri/src/commands/analysis.rs
+++ b/src-tauri/src/commands/analysis.rs
@@ -189,7 +189,7 @@ pub async fn analysis_locate_duplicates(
) -> IdeResult<DuplicatesReport> {
let project = state.project(window.label())?;
let cancel = state.begin_request(request);
- let languages = state.languages.clone();
+ let languages = project.languages.clone();
let syntax = state.syntax();
let result = blocking(move || {
let files = files_in_scope(&project, &scope, &cancel)?;
@@ -256,7 +256,7 @@ pub async fn structural_search(
) -> IdeResult<()> {
let project = state.project(window.label())?;
let cancel = state.begin_request(request);
- let languages = state.languages.clone();
+ let languages = project.languages.clone();
let syntax = state.syntax();
let events = on_event.clone();
let result = blocking(move || {
diff --git a/src-tauri/src/commands/app.rs b/src-tauri/src/commands/app.rs
index 4aa1ff342..4a48827e0 100644
--- a/src-tauri/src/commands/app.rs
+++ b/src-tauri/src/commands/app.rs
@@ -69,14 +69,33 @@ pub async fn open_project(window: Window, path: PathBuf) -> IdeResult<ProjectInf
}
fn project_info(project: &crate::state::Project) -> ProjectInfo {
+ let settings = project.settings.effective();
+ let custom = settings.general.project_name.trim();
ProjectInfo {
- name: project.root.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default(),
+ name: if custom.is_empty() {
+ project.root.file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_default()
+ } else {
+ custom.to_owned()
+ },
is_git: !project.repos.read().is_empty(),
- settings: project.settings.effective(),
+ settings,
root: project.root.clone().into(),
}
}
+/// File › Rename Project…: the project's display name (title bar, recent
+/// projects); an empty `name` restores the folder name. Stored in the project's settings.
+#[tauri::command]
+#[specta::specta]
+pub fn project_rename(window: Window, state: State<'_, AppState>, name: String) -> IdeResult<ProjectInfo> {
+ let project = state.project(window.label())?;
+ let name = name.trim();
+ let value = if name.is_empty() { serde_json::Value::Null } else { serde_json::Value::String(name.to_owned()) };
+ project.settings.set(SettingsScope::Project, "general.projectName", value)?;
+ state.recent.rename(&project.root, (!name.is_empty()).then_some(name))?;
+ Ok(project_info(&project))
+}
+
#[tauri::command]
#[specta::specta]
pub fn close_project(window: Window, state: State<'_, AppState>) {
@@ -156,6 +175,15 @@ pub fn settings_set(
.set_file_defaults(ide_workspace::FileDefaults::from_settings(&effective, Some(&project.root)));
}
}
+ // File type associations re-detect open documents (off the command thread).
+ if key == "files" || key.starts_with("files.fileType") {
+ let affected = if project_scope { current.iter().cloned().collect() } else { state.projects() };
+ tauri::async_runtime::spawn_blocking(move || {
+ for project in affected {
+ project.apply_file_types(&project.settings.effective());
+ }
+ });
+ }
// A new interpreter / toolchain / server executable restarts the language servers it affects.
if ["languages", "tools"].iter().any(|k| key == *k || key.starts_with(&format!("{k}."))) {
let affected = if project_scope { current.iter().cloned().collect() } else { state.projects() };
@@ -165,6 +193,16 @@ pub fn settings_set(
}
}
let roots_changed = key == "projectStructure" || key.starts_with("projectStructure.");
+ // Content roots and excludes (files.exclude, ignored names, excluded folders) reach the
+ // index and the watchers without reopening the project (the rescan runs in the background).
+ if roots_changed || key == "files" || key.starts_with("files.") {
+ let affected = if project_scope { current.iter().cloned().collect() } else { state.projects() };
+ tauri::async_runtime::spawn_blocking(move || {
+ for project in affected {
+ project.refresh_index_scope();
+ }
+ });
+ }
// A project value concerns only that project's window (and its settings window).
let event = ide_core::IdeEvent::SettingsChanged { key };
if project_scope {
@@ -182,6 +220,48 @@ pub fn settings_set(
Ok(settings)
}
+/// File › Manage IDE Settings › Export Settings…: the global settings plus the
+/// frontend's IDE-level `storage` (live / file templates, macros) to `path`.
+#[tauri::command]
+#[specta::specta]
+pub async fn settings_export(
+ state: State<'_, AppState>,
+ path: PathBuf,
+ storage: std::collections::BTreeMap<String, String>,
+) -> IdeResult<()> {
+ state.global_settings.export_bundle(&path, storage)
+}
+
+#[derive(Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct SettingsImport {
+ /// Effective settings of the calling window after the import.
+ pub settings: Settings,
+ /// IDE state the frontend keeps (written back to its storage).
+ pub storage: std::collections::BTreeMap<String, String>,
+}
+
+/// Import Settings…: replaces the global settings with the file's; every window re-reads them.
+#[tauri::command]
+#[specta::specta]
+pub async fn settings_import(window: Window, state: State<'_, AppState>, path: PathBuf) -> IdeResult<SettingsImport> {
+ let (_, storage) = state.global_settings.import_bundle(&path)?;
+ for project in state.projects() {
+ let effective = project.settings.reload();
+ project
+ .documents
+ .set_file_defaults(ide_workspace::FileDefaults::from_settings(&effective, Some(&project.root)));
+ let lsp = project.lsp.clone();
+ tauri::async_runtime::spawn(async move { lsp.reconfigure().await });
+ }
+ state.sink.emit(ide_core::IdeEvent::SettingsChanged { key: String::new() });
+ let settings = match state.project(window.label()) {
+ Ok(p) => p.settings.effective(),
+ Err(_) => state.global_settings.effective(),
+ };
+ Ok(SettingsImport { settings, storage })
+}
+
/// Effective source / test / resource / excluded roots of the window's project:
/// auto-detected from build files, overridden by Settings › Project Structure.
#[tauri::command]
diff --git a/src-tauri/src/commands/coverage.rs b/src-tauri/src/commands/coverage.rs
index 2ca7f9d13..8fe66f2d7 100644
--- a/src-tauri/src/commands/coverage.rs
+++ b/src-tauri/src/commands/coverage.rs
@@ -1,7 +1,7 @@
//! Run with Coverage: launch plans and coverage reports.
use crate::state::AppState;
-use ide_core::{IdeError, IdeResult};
+use ide_core::{IdeError, IdeResult, IpcPath};
use ide_coverage::{CoveragePrepared, CoverageReportSpec, CoverageSuite};
use ide_run::RunConfig;
use tauri::{State, Window};
@@ -37,3 +37,12 @@ pub async fn coverage_prepare(
pub async fn coverage_collect(report: CoverageReportSpec) -> IdeResult<CoverageSuite> {
blocking(move || ide_coverage::collect(&report)).await
}
+
+/// Reads a report collected elsewhere (CI): lcov, a Go cover profile or JaCoCo XML,
+/// with paths mapped into this project.
+#[tauri::command]
+#[specta::specta]
+pub async fn coverage_import(window: Window, state: State<'_, AppState>, path: IpcPath) -> IdeResult<CoverageSuite> {
+ let root = state.project(window.label())?.root.clone();
+ blocking(move || ide_coverage::import(&path, &root)).await
+}
diff --git a/src-tauri/src/commands/doc.rs b/src-tauri/src/commands/doc.rs
index 719dcbcad..0a69fad34 100644
--- a/src-tauri/src/commands/doc.rs
+++ b/src-tauri/src/commands/doc.rs
@@ -102,22 +102,32 @@ pub fn doc_set_line_ending(
state.project(window.label())?.documents.set_line_ending(doc, line_ending)
}
-/// Structure view: LSP document symbols when available, tree-sitter otherwise.
+/// Structure view: LSP document symbols when available (with tree-sitter
+/// visibility), tree-sitter otherwise.
/// Tree-sitter answers come from the per-document tree cache (incremental
/// re-parse); large documents get no syntax structure.
#[tauri::command]
#[specta::specta]
pub async fn doc_outline(window: Window, state: State<'_, AppState>, doc: DocId) -> IdeResult<Vec<OutlineItem>> {
let project = state.project(window.label())?;
- if let Ok(Some(items)) = project.lsp.document_symbols(doc).await {
- return Ok(items);
- }
+ let lsp = project.lsp.document_symbols(doc).await.ok().flatten();
blocking(move || {
- let snap = project.documents.text_snapshot(doc)?;
- if snap.large {
- return Ok(Vec::new());
- }
- Ok(project.syntax.outline(doc, &snap.language, snap.version, &snap.text))
+ let snap = match project.documents.text_snapshot(doc) {
+ Ok(snap) => snap,
+ Err(e) => return lsp.ok_or(e),
+ };
+ let syntax = || project.syntax.outline(doc, &snap.language, snap.version, &snap.text);
+ Ok(match lsp {
+ // Server symbols carry no visibility; borrow it from the syntax tree.
+ Some(mut items) => {
+ if !snap.large {
+ ide_language::merge_visibility(&mut items, &syntax());
+ }
+ items
+ }
+ None if snap.large => Vec::new(),
+ None => syntax(),
+ })
})
.await
}
diff --git a/src-tauri/src/commands/docker.rs b/src-tauri/src/commands/docker.rs
index ebeb116c0..aecac0a7b 100644
--- a/src-tauri/src/commands/docker.rs
+++ b/src-tauri/src/commands/docker.rs
@@ -2,7 +2,10 @@
use crate::state::AppState;
use ide_core::{IdeError, IdeResult, RequestId};
-use ide_docker::{ComposeOp, ContainerOp, DockerEvent, DockerLogLine, DockerObject, DockerSnapshot, PruneTarget};
+use ide_docker::{
+ ComposeOp, ContainerOp, DockerEndpoint, DockerEvent, DockerLogLine, DockerObject, DockerRegistry, DockerSettings,
+ DockerSnapshot, PruneTarget, RegistryAuth,
+};
use tauri::State;
use tauri::ipc::Channel;
@@ -25,35 +28,42 @@ async fn cancellable<T: Send + 'static>(
/// Availability plus containers, images, volumes and networks.
#[tauri::command]
#[specta::specta]
-pub async fn docker_snapshot() -> IdeResult<DockerSnapshot> {
- blocking(|| Ok(ide_docker::snapshot())).await
+pub async fn docker_snapshot(endpoint: DockerEndpoint) -> IdeResult<DockerSnapshot> {
+ blocking(move || Ok(ide_docker::snapshot(&endpoint))).await
}
#[tauri::command]
#[specta::specta]
-pub async fn docker_container_op(ids: Vec<String>, op: ContainerOp) -> IdeResult<()> {
- blocking(move || ide_docker::container_op(&ids, op)).await
+pub async fn docker_container_op(endpoint: DockerEndpoint, ids: Vec<String>, op: ContainerOp) -> IdeResult<()> {
+ blocking(move || ide_docker::container_op(&endpoint, &ids, op)).await
}
#[tauri::command]
#[specta::specta]
-pub async fn docker_remove(object: DockerObject, ids: Vec<String>, force: bool) -> IdeResult<()> {
- blocking(move || ide_docker::remove(object, &ids, force)).await
+pub async fn docker_remove(
+ endpoint: DockerEndpoint,
+ object: DockerObject,
+ ids: Vec<String>,
+ force: bool,
+) -> IdeResult<()> {
+ blocking(move || ide_docker::remove(&endpoint, object, &ids, force)).await
}
/// Pretty-printed `docker inspect` JSON.
#[tauri::command]
#[specta::specta]
-pub async fn docker_inspect(object: DockerObject, id: String) -> IdeResult<String> {
- blocking(move || ide_docker::inspect(object, &id)).await
+pub async fn docker_inspect(endpoint: DockerEndpoint, object: DockerObject, id: String) -> IdeResult<String> {
+ blocking(move || ide_docker::inspect(&endpoint, object, &id)).await
}
/// Streams a container's log lines until it stops or the request is cancelled.
#[tauri::command]
#[specta::specta]
+#[allow(clippy::too_many_arguments)]
pub async fn docker_logs(
state: State<'_, AppState>,
request: RequestId,
+ endpoint: DockerEndpoint,
id: String,
tail: u32,
follow: bool,
@@ -61,7 +71,7 @@ pub async fn docker_logs(
on_line: Channel<DockerLogLine>,
) -> IdeResult<()> {
cancellable(&state, request, move |cancel| {
- ide_docker::logs(&id, tail, follow, timestamps, cancel, &|line| {
+ ide_docker::logs(&endpoint, &id, tail, follow, timestamps, cancel, &|line| {
let _ = on_line.send(line);
})
})
@@ -74,26 +84,31 @@ pub async fn docker_logs(
pub async fn docker_events(
state: State<'_, AppState>,
request: RequestId,
+ endpoint: DockerEndpoint,
on_event: Channel<DockerEvent>,
) -> IdeResult<()> {
cancellable(&state, request, move |cancel| {
- ide_docker::watch_events(cancel, &|e| {
+ ide_docker::watch_events(&endpoint, cancel, &|e| {
let _ = on_event.send(e);
})
})
.await
}
+/// `docker pull`, logging in first when a saved registry with a password serves the image.
#[tauri::command]
#[specta::specta]
pub async fn docker_pull(
state: State<'_, AppState>,
request: RequestId,
+ endpoint: DockerEndpoint,
reference: String,
on_output: Channel<String>,
) -> IdeResult<()> {
+ let data_dir = state.data_dir.clone();
cancellable(&state, request, move |cancel| {
- ide_docker::pull(&reference, cancel, &|line| {
+ let auth = ide_docker::auth_for(&data_dir, &reference);
+ ide_docker::pull(&endpoint, &reference, auth.as_ref(), cancel, &|line| {
let _ = on_output.send(line);
})
})
@@ -105,11 +120,12 @@ pub async fn docker_pull(
pub async fn docker_prune(
state: State<'_, AppState>,
request: RequestId,
+ endpoint: DockerEndpoint,
target: PruneTarget,
on_output: Channel<String>,
) -> IdeResult<()> {
cancellable(&state, request, move |cancel| {
- ide_docker::prune(target, cancel, &|line| {
+ ide_docker::prune(&endpoint, target, cancel, &|line| {
let _ = on_output.send(line);
})
})
@@ -123,6 +139,7 @@ pub async fn docker_prune(
pub async fn docker_compose_op(
state: State<'_, AppState>,
request: RequestId,
+ endpoint: DockerEndpoint,
project: String,
files: Vec<String>,
working_dir: Option<String>,
@@ -130,9 +147,65 @@ pub async fn docker_compose_op(
on_output: Channel<String>,
) -> IdeResult<()> {
cancellable(&state, request, move |cancel| {
- ide_docker::compose_op(&project, &files, working_dir.as_deref(), op, cancel, &|line| {
+ ide_docker::compose_op(&endpoint, &project, &files, working_dir.as_deref(), op, cancel, &|line| {
let _ = on_output.send(line);
})
})
.await
}
+
+/// Docker connections and registries (app-wide).
+#[tauri::command]
+#[specta::specta]
+pub async fn docker_settings(state: State<'_, AppState>) -> IdeResult<DockerSettings> {
+ let data_dir = state.data_dir.clone();
+ blocking(move || Ok(ide_docker::load_settings(&data_dir))).await
+}
+
+#[tauri::command]
+#[specta::specta]
+pub async fn docker_save_settings(state: State<'_, AppState>, settings: DockerSettings) -> IdeResult<()> {
+ let data_dir = state.data_dir.clone();
+ blocking(move || ide_docker::save_settings(&data_dir, &settings)).await
+}
+
+/// Saves (`None`: forgets) a registry's password.
+#[tauri::command]
+#[specta::specta]
+pub async fn docker_set_registry_password(
+ state: State<'_, AppState>,
+ id: String,
+ password: Option<String>,
+) -> IdeResult<()> {
+ let data_dir = state.data_dir.clone();
+ blocking(move || ide_docker::set_registry_password(&data_dir, &id, password.as_deref())).await
+}
+
+/// Test login to `registry` (`password`, else the saved one) through `endpoint`'s daemon.
+#[tauri::command]
+#[specta::specta]
+pub async fn docker_registry_login(
+ state: State<'_, AppState>,
+ endpoint: DockerEndpoint,
+ registry: DockerRegistry,
+ password: Option<String>,
+) -> IdeResult<String> {
+ let data_dir = state.data_dir.clone();
+ blocking(move || {
+ let password = password
+ .or_else(|| ide_docker::registry_password(&data_dir, &registry.id))
+ .ok_or_else(|| IdeError::invalid("enter the registry password"))?;
+ let auth = RegistryAuth { address: registry.address, username: registry.username, password };
+ ide_docker::login(&endpoint, &auth)
+ })
+ .await
+}
+
+/// Environment for a Docker run configuration's command line: selects `endpoint`'s
+/// daemon and puts the docker executable on `PATH`.
+#[tauri::command]
+#[specta::specta]
+pub async fn docker_run_env(endpoint: DockerEndpoint) -> IdeResult<std::collections::BTreeMap<String, String>> {
+ endpoint.validate()?;
+ blocking(move || Ok(ide_docker::run_env(&endpoint))).await
+}
diff --git a/src-tauri/src/commands/lsp.rs b/src-tauri/src/commands/lsp.rs
index 75e3859b7..9a11ac0b8 100644
--- a/src-tauri/src/commands/lsp.rs
+++ b/src-tauri/src/commands/lsp.rs
@@ -26,6 +26,24 @@ pub async fn lsp_completion(
result
}
+/// Inline (ghost text) suggestions at `pos`; `automatic` when triggered by typing.
+#[tauri::command]
+#[specta::specta]
+pub async fn lsp_inline_completion(
+ window: Window,
+ state: State<'_, AppState>,
+ request: RequestId,
+ doc: DocId,
+ pos: Pos,
+ automatic: bool,
+) -> IdeResult<Vec<InlineCompletionItem>> {
+ let lsp = project!(window, state).lsp.clone();
+ let cancel = state.begin_request(request);
+ let result = lsp.inline_completion(doc, pos, automatic, cancel).await;
+ state.end_request(request);
+ result
+}
+
#[tauri::command]
#[specta::specta]
pub async fn lsp_resolve_completion(
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index da71eee91..2a312c052 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -30,6 +30,7 @@ pub mod refactor;
pub mod run;
pub mod sdk;
pub mod search;
+pub mod spell;
pub mod syntax;
pub mod term;
pub mod tools;
@@ -51,6 +52,9 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
app::settings_get,
app::settings_get_global,
app::settings_set,
+ app::settings_export,
+ app::settings_import,
+ app::project_rename,
app::project_roots,
app::cancel_request,
app::log_frontend,
@@ -108,11 +112,14 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
nav::fs_resolve_reference,
nav::path_completions,
nav::web_unresolved_references,
+ spell::spell_check,
+ spell::spell_suggest,
search::search_start,
search::replace_in_files,
search::replace_preview,
search::search_validate,
lsp::lsp_completion,
+ lsp::lsp_inline_completion,
lsp::lsp_resolve_completion,
lsp::lsp_hover,
lsp::lsp_signature_help,
@@ -170,12 +177,20 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
vcs::vcs_diff_hunks,
vcs::vcs_stage_hunks,
vcs::vcs_clone,
+ vcs::vcs_init,
vcs::vcs_git_version,
vcs::vcs_detected_git,
vcs::vcs_config_get,
vcs::vcs_operation,
vcs::vcs_create_tag,
vcs::vcs_tags,
+ vcs::vcs_merge_with,
+ vcs::vcs_rebase_with,
+ vcs::vcs_remotes,
+ vcs::vcs_edit_remote,
+ vcs::vcs_worktrees,
+ vcs::vcs_add_worktree,
+ vcs::vcs_remove_worktree,
vcs::vcs_diff_with_worktree,
vcs::vcs_diff_revisions,
vcs::vcs_create_patch,
@@ -199,11 +214,15 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
term::term_available_shells,
run::run_configs,
run::run_save_configs,
+ run::run_templates,
+ run::run_save_templates,
+ run::run_system_env,
run::run_start,
run::run_stop,
run::run_stdin,
run::run_list,
run::run_close_stdin,
+ run::run_resize,
run::run_test_reports,
build::build_model,
build::build_sync,
@@ -231,6 +250,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
tools::tools_uninstall,
sdk::sdk_detect,
sdk::sdk_python_effective,
+ sdk::sdk_project_libraries,
sdk::sdk_locate_tools,
sdk::sdk_python_create_venv,
sdk::sdk_python_packages,
@@ -248,6 +268,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
window::menu_configure,
window::menu_refresh,
window::menu_model,
+ window::menu_set_disabled,
window::app_log_location,
window::app_build_info,
window::app_check_update,
@@ -268,6 +289,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
debug::debug_redefine_classes,
coverage::coverage_prepare,
coverage::coverage_collect,
+ coverage::coverage_import,
web::web_browsers,
web::web_url,
web::web_open,
@@ -299,6 +321,11 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
docker::docker_pull,
docker::docker_prune,
docker::docker_compose_op,
+ docker::docker_settings,
+ docker::docker_save_settings,
+ docker::docker_set_registry_password,
+ docker::docker_registry_login,
+ docker::docker_run_env,
github::gh_availability,
github::gh_pr_list,
github::gh_pr_view,
diff --git a/src-tauri/src/commands/run.rs b/src-tauri/src/commands/run.rs
index 693a9d987..a95d00ed1 100644
--- a/src-tauri/src/commands/run.rs
+++ b/src-tauri/src/commands/run.rs
@@ -26,6 +26,28 @@ pub fn run_save_configs(window: Window, state: State<'_, AppState>, configs: Vec
ide_run::save_user_configs(&root, &configs)
}
+/// Configuration templates: per-type defaults applied to new configurations.
+#[tauri::command]
+#[specta::specta]
+pub fn run_templates(window: Window, state: State<'_, AppState>) -> IdeResult<Vec<RunConfig>> {
+ let root = state.project(window.label())?.root.clone();
+ ide_run::load_templates(&root)
+}
+
+#[tauri::command]
+#[specta::specta]
+pub fn run_save_templates(window: Window, state: State<'_, AppState>, templates: Vec<RunConfig>) -> IdeResult<()> {
+ let root = state.project(window.label())?.root.clone();
+ ide_run::save_templates(&root, &templates)
+}
+
+/// The environment runs inherit when "Include system environment variables" is on.
+#[tauri::command]
+#[specta::specta]
+pub fn run_system_env() -> std::collections::BTreeMap<String, String> {
+ ide_run::system_env()
+}
+
#[tauri::command]
#[specta::specta]
pub fn run_start(
@@ -69,6 +91,13 @@ pub fn run_stdin(state: State<'_, AppState>, id: RunId, data: String) -> IdeResu
state.processes.write_stdin(id, &data)
}
+/// Terminal size of a run started with "Emulate terminal in output console".
+#[tauri::command]
+#[specta::specta]
+pub fn run_resize(state: State<'_, AppState>, id: RunId, cols: u16, rows: u16) -> IdeResult<()> {
+ state.processes.resize(id, cols, rows)
+}
+
#[tauri::command]
#[specta::specta]
pub fn run_list(state: State<'_, AppState>) -> Vec<RunInfo> {
diff --git a/src-tauri/src/commands/sdk.rs b/src-tauri/src/commands/sdk.rs
index c92d6eef4..009ae004a 100644
--- a/src-tauri/src/commands/sdk.rs
+++ b/src-tauri/src/commands/sdk.rs
@@ -28,6 +28,33 @@ pub fn sdk_python_effective(window: Window, state: State<'_, AppState>) -> IdeRe
Ok(ide_sdk::apply::python_interpreter(&project.root, &project.settings.effective()).map(Into::into))
}
+/// SDK / library source folders shown under "External Libraries" in the Project view,
+/// with the Maven / Gradle dependency jars of the build model.
+#[tauri::command]
+#[specta::specta]
+pub async fn sdk_project_libraries(
+ window: Window,
+ state: State<'_, AppState>,
+) -> IdeResult<Vec<ide_sdk::libraries::LibraryGroup>> {
+ let project = state.project(window.label())?;
+ let (root, cache, settings) = (project.root.clone(), project.build_cache_dir(), project.settings.effective());
+ tauri::async_runtime::spawn_blocking(move || {
+ let model = crate::commands::build::load(&root, &cache, &settings);
+ let deps: Vec<ide_sdk::libraries::BuildDependency> = ide_build::dependency_coordinates(&root, &model)
+ .into_iter()
+ .map(|c| ide_sdk::libraries::BuildDependency {
+ gradle: c.gradle,
+ group: c.group_id,
+ artifact: c.artifact_id,
+ version: c.version,
+ })
+ .collect();
+ ide_sdk::libraries::project_libraries(&root, &settings, &deps)
+ })
+ .await
+ .map_err(join_err)
+}
+
/// Executables found for "run this file", and where single files are compiled to.
#[derive(Clone, Debug, serde::Serialize, specta::Type)]
#[serde(rename_all = "camelCase")]
diff --git a/src-tauri/src/commands/search.rs b/src-tauri/src/commands/search.rs
index 3b5d32655..212014d51 100644
--- a/src-tauri/src/commands/search.rs
+++ b/src-tauri/src/commands/search.rs
@@ -40,7 +40,14 @@ pub async fn search_start(
let cancel = state.begin_request(request);
let documents = project.documents.clone();
let root = project.root.clone();
- let languages = state.languages.clone();
+ // The whole project also covers the Project Structure content roots.
+ let content_roots = match query.scope {
+ ide_search::SearchScope::Project | ide_search::SearchScope::FileSet { set: ProjectFileSet::All } => {
+ project.content_roots()
+ }
+ _ => Vec::new(),
+ };
+ let languages = project.languages.clone();
let syntax = state.syntax();
let events = on_event.clone();
let summary = tauri::async_runtime::spawn_blocking(move || {
@@ -55,17 +62,29 @@ pub async fn search_start(
let found = syntax.literals(&language, text)?;
Some(found.into_iter().map(literal_range).collect())
};
- ide_search::search_in_context(
- &root,
- &query,
- Some(&filter),
- Some(&literals),
- &|p| documents.text_of(p),
- &cancel,
- &|file| {
- let _ = events.send(SearchEvent::File { file });
- },
- )
+ let mut total = ide_search::SearchSummary::default();
+ for dir in std::iter::once(&root).chain(&content_roots) {
+ let s = ide_search::search_in_context(
+ dir,
+ &query,
+ Some(&filter),
+ Some(&literals),
+ &|p| documents.text_of(p),
+ &cancel,
+ &|file| {
+ let _ = events.send(SearchEvent::File { file });
+ },
+ )?;
+ total.files += s.files;
+ total.matches += s.matches;
+ total.elapsed_ms += s.elapsed_ms;
+ total.limit_hit |= s.limit_hit;
+ total.cancelled |= s.cancelled;
+ if total.limit_hit || total.cancelled {
+ break;
+ }
+ }
+ Ok::<_, ide_core::IdeError>(total)
})
.await
.map_err(|e| ide_core::IdeError::internal(e.to_string()))?;
diff --git a/src-tauri/src/commands/spell.rs b/src-tauri/src/commands/spell.rs
new file mode 100644
index 000000000..50ccba33c
--- /dev/null
+++ b/src-tauri/src/commands/spell.rs
@@ -0,0 +1,90 @@
+//! Proofreading › Typo: spell checking of open documents.
+
+use super::doc::blocking;
+use crate::state::{AppState, Project};
+use ide_core::settings::SpellingSettings;
+use ide_core::{DocId, IdeError, IdeResult, RequestId};
+use ide_language::SpellingKind;
+use ide_spell::{Region, RegionKind, Speller, Typo};
+use std::path::{Path, PathBuf};
+use tauri::{State, Window};
+
+/// Languages checked as prose (all text but code spans).
+const PROSE: &[&str] = &["plaintext", "markdown", "restructuredtext", "asciidoc", "latex"];
+
+/// Custom dictionary paths: `~/…` from home, relative ones from the project root.
+fn dictionary_paths(settings: &SpellingSettings, root: &Path) -> Vec<PathBuf> {
+ settings
+ .custom_dictionaries
+ .iter()
+ .map(|p| p.trim())
+ .filter(|p| !p.is_empty())
+ .map(|p| match p.strip_prefix("~/") {
+ Some(rest) => dirs::home_dir().unwrap_or_default().join(rest),
+ None => root.join(p),
+ })
+ .collect()
+}
+
+fn speller(project: &Project) -> Speller {
+ let s = project.settings.effective().spelling;
+ let words = s.ide_words.iter().chain(&s.project_words);
+ Speller::new(words, &dictionary_paths(&s, &project.root))
+}
+
+/// Misspelt words in the comments, string literals and declared names of
+/// `doc` (all of its text for prose). Cancel with `cancel_request(request)`.
+#[tauri::command]
+#[specta::specta]
+pub async fn spell_check(
+ window: Window,
+ state: State<'_, AppState>,
+ doc: DocId,
+ request: RequestId,
+) -> IdeResult<Vec<Typo>> {
+ let project = state.project(window.label())?;
+ let syntax = state.syntax();
+ let cancel = state.begin_request(request);
+ let result = blocking(move || {
+ let snap = project.documents.text_snapshot(doc)?;
+ if snap.large {
+ return Ok(Vec::new());
+ }
+ let regions = if PROSE.contains(&snap.language.as_str()) {
+ ide_spell::prose_regions(&snap.text)
+ } else {
+ let Some(found) = syntax.spelling_regions(&snap.language, &snap.text) else { return Ok(Vec::new()) };
+ found
+ .into_iter()
+ .map(|r| Region {
+ start: r.start,
+ end: r.end,
+ kind: match r.kind {
+ SpellingKind::Comment => RegionKind::Comment,
+ SpellingKind::String => RegionKind::String,
+ SpellingKind::Name => RegionKind::Name,
+ },
+ })
+ .collect()
+ };
+ if cancel.is_cancelled() {
+ return Err(IdeError::cancelled());
+ }
+ speller(&project).check(&snap.text, &regions, &|| cancel.is_cancelled()).ok_or_else(IdeError::cancelled)
+ })
+ .await;
+ state.end_request(request);
+ result
+}
+
+/// Replacements for a misspelt `word`, best first (Typo › Change to…).
+#[tauri::command]
+#[specta::specta]
+pub async fn spell_suggest(window: Window, state: State<'_, AppState>, word: String) -> IdeResult<Vec<String>> {
+ let project = state.project(window.label()).ok();
+ blocking(move || {
+ let speller = project.as_deref().map(speller).unwrap_or_default();
+ Ok(speller.suggest(&word, 8))
+ })
+ .await
+}
diff --git a/src-tauri/src/commands/syntax.rs b/src-tauri/src/commands/syntax.rs
index 591dd4578..a43a3dd6b 100644
--- a/src-tauri/src/commands/syntax.rs
+++ b/src-tauri/src/commands/syntax.rs
@@ -129,7 +129,7 @@ pub async fn syntax_identifiers_in_files(
request: RequestId,
) -> IdeResult<Vec<FileIdentifiers>> {
let project = state.project(window.label())?;
- let languages = state.languages.clone();
+ let languages = project.languages.clone();
let cancel = state.begin_request(request);
let result = blocking(move || {
let load = |path: &std::path::Path| {
diff --git a/src-tauri/src/commands/vcs.rs b/src-tauri/src/commands/vcs.rs
index 5dcd00579..740762892 100644
--- a/src-tauri/src/commands/vcs.rs
+++ b/src-tauri/src/commands/vcs.rs
@@ -374,6 +374,13 @@ pub enum RemoteOp {
UpdateBranch {
branch: String,
},
+ /// Pull dialog: `branches` of `remote` (none = the configured merge branch).
+ PullFrom {
+ remote: String,
+ branches: Vec<String>,
+ rebase: bool,
+ options: MergeOptions,
+ },
}
/// Network operation; progress lines stream through `on_output`. Cancellable.
@@ -393,7 +400,7 @@ pub async fn vcs_remote(
let out = |line: String| {
let _ = on_output.send(line);
};
- let recorded = matches!(op, RemoteOp::Pull { .. }).then_some("Git pull");
+ let recorded = matches!(op, RemoteOp::Pull { .. } | RemoteOp::PullFrom { .. }).then_some("Git pull");
project.with_repo_recorded(repo.as_deref(), recorded, |r| match op {
RemoteOp::Fetch => r.fetch(&cancel, &out),
RemoteOp::Pull { rebase } => r.pull(rebase, &cancel, &out),
@@ -408,6 +415,9 @@ pub async fn vcs_remote(
None => r.push_branch(&branch, revision.as_deref(), force_with_lease, &cancel, &out),
},
RemoteOp::UpdateBranch { branch } => r.update_branch(&branch, &cancel, &out),
+ RemoteOp::PullFrom { remote, branches, rebase, options } => {
+ r.pull_from(&remote, &branches, rebase, &options, &cancel, &out)
+ }
})
})
.await
@@ -486,6 +496,14 @@ pub async fn vcs_clone(
result
}
+/// `git init` in `dir` (File › New Project… "Create Git repository").
+#[tauri::command]
+#[specta::specta]
+pub async fn vcs_init(state: State<'_, AppState>, dir: PathBuf) -> IdeResult<()> {
+ apply_git_executable(&state.global_settings.effective());
+ blocking(move || ide_vcs::init(&dir)).await
+}
+
#[derive(Serialize, Deserialize, Type)]
#[serde(rename_all = "camelCase")]
pub struct GitExecutableInfo {
@@ -629,6 +647,100 @@ pub async fn vcs_tags(window: Window, state: State<'_, AppState>, repo: Option<P
blocking(move || project.with_repo_at(repo.as_deref(), |r| r.tags())).await
}
+/// Merge dialog: merges `branches` into the current branch.
+#[tauri::command]
+#[specta::specta]
+pub async fn vcs_merge_with(
+ window: Window,
+ state: State<'_, AppState>,
+ repo: Option<PathBuf>,
+ branches: Vec<String>,
+ options: MergeOptions,
+) -> IdeResult<()> {
+ let project = state.project(window.label())?;
+ blocking(move || {
+ project.with_repo_recorded(repo.as_deref(), Some("Git merge"), |r| r.merge_with(&branches, &options))
+ })
+ .await
+}
+
+/// Rebase dialog: rebases the current branch onto `upstream` (or `--onto`).
+#[tauri::command]
+#[specta::specta]
+pub async fn vcs_rebase_with(
+ window: Window,
+ state: State<'_, AppState>,
+ repo: Option<PathBuf>,
+ upstream: String,
+ options: RebaseOptions,
+) -> IdeResult<()> {
+ let project = state.project(window.label())?;
+ blocking(move || {
+ project.with_repo_recorded(repo.as_deref(), Some("Git rebase"), |r| r.rebase_with(&upstream, &options))
+ })
+ .await
+}
+
+#[tauri::command]
+#[specta::specta]
+pub async fn vcs_remotes(window: Window, state: State<'_, AppState>, repo: Option<PathBuf>) -> IdeResult<Vec<Remote>> {
+ let project = state.project(window.label())?;
+ blocking(move || project.with_repo_at(repo.as_deref(), |r| r.remotes())).await
+}
+
+#[tauri::command]
+#[specta::specta]
+pub async fn vcs_edit_remote(
+ window: Window,
+ state: State<'_, AppState>,
+ repo: Option<PathBuf>,
+ edit: RemoteEdit,
+) -> IdeResult<()> {
+ let project = state.project(window.label())?;
+ blocking(move || project.with_repo_at(repo.as_deref(), |r| r.edit_remote(&edit))).await
+}
+
+#[tauri::command]
+#[specta::specta]
+pub async fn vcs_worktrees(
+ window: Window,
+ state: State<'_, AppState>,
+ repo: Option<PathBuf>,
+) -> IdeResult<Vec<Worktree>> {
+ let project = state.project(window.label())?;
+ blocking(move || project.with_repo_at(repo.as_deref(), |r| r.worktrees())).await
+}
+
+#[tauri::command]
+#[specta::specta]
+pub async fn vcs_add_worktree(
+ window: Window,
+ state: State<'_, AppState>,
+ repo: Option<PathBuf>,
+ path: PathBuf,
+ commitish: String,
+ new_branch: Option<String>,
+) -> IdeResult<()> {
+ let project = state.project(window.label())?;
+ blocking(move || {
+ project.with_repo_at(repo.as_deref(), |r| r.add_worktree(&path, &commitish, new_branch.as_deref()))
+ })
+ .await
+}
+
+#[tauri::command]
+#[specta::specta]
+pub async fn vcs_remove_worktree(
+ window: Window,
+ state: State<'_, AppState>,
+ repo: Option<PathBuf>,
+ path: PathBuf,
+ force: bool,
+) -> IdeResult<()> {
+ let project = state.project(window.label())?;
+ blocking(move || project.with_repo_at(repo.as_deref(), |r| r.remove_worktree(&path, force))).await
+}
+
/// Compare with Local: tracked files that differ between `rev` and the working tree.
#[tauri::command]
#[specta::specta]
diff --git a/src-tauri/src/commands/window.rs b/src-tauri/src/commands/window.rs
index 64725def7..20ecd5d10 100644
--- a/src-tauri/src/commands/window.rs
+++ b/src-tauri/src/commands/window.rs
@@ -150,13 +150,29 @@ pub fn menu_refresh(app: AppHandle, menu_state: State<'_, MenuState>, state: Sta
/// The menu bar for a title bar drawn by the frontend (Windows).
#[tauri::command]
#[specta::specta]
-pub fn menu_model(app: AppHandle, state: State<'_, AppState>) -> Vec<menu::MenuNode> {
+pub fn menu_model(app: AppHandle, state: State<'_, AppState>, menu_state: State<'_, MenuState>) -> Vec<menu::MenuNode> {
let mut spec = menu::spec(menu::Os::current());
if !updates_configured(&app) {
spec = menu::without_action(spec, "app.checkForUpdates");
}
let home = dirs::home_dir();
- menu::model(&spec, &menu::recent_items(&state.recent.list(), home.as_deref()))
+ let config = menu_state.config.lock().clone();
+ menu::model(&spec, &menu::recent_items(&state.recent.list(), home.as_deref()), &config)
+}
+
+/// Action ids the focused window cannot run now: their native menu items are
+/// disabled in place (no rebuild).
+#[tauri::command]
+#[specta::specta]
+pub fn menu_set_disabled(app: AppHandle, menu_state: State<'_, MenuState>, ids: Vec<String>) {
+ let disabled: std::collections::HashSet<String> = ids.into_iter().collect();
+ if *menu_state.disabled.lock() == disabled {
+ return;
+ }
+ *menu_state.disabled.lock() = disabled.clone();
+ if menu::native_menu_bar() {
+ menu::apply_disabled(&app, &disabled);
+ }
}
#[derive(Serialize, Deserialize, Type)]
diff --git a/src-tauri/src/menu.rs b/src-tauri/src/menu.rs
index 02c41f7ff..b3fdce8e5 100644
--- a/src-tauri/src/menu.rs
+++ b/src-tauri/src/menu.rs
@@ -20,15 +20,17 @@
use parking_lot::Mutex;
use serde::{Deserialize, Serialize};
use specta::Type;
-use std::collections::HashMap;
+use std::collections::{HashMap, HashSet};
use std::path::Path;
-use tauri::menu::{IsMenuItem, Menu, MenuItem, PredefinedMenuItem, Submenu};
+use tauri::menu::{IsMenuItem, Menu, MenuItem, MenuItemKind, PredefinedMenuItem, Submenu};
use tauri::{AppHandle, Runtime};
/// Event emitted to the focused window when an IDE menu item is clicked.
pub const MENU_EVENT: &str = "openidea://menu";
/// Prefix of Open Recent item ids; the rest of the id is the project path.
const RECENT_PREFIX: &str = "recent:";
+/// Prefix of items the frontend lists ([`MenuConfig::dynamic`]): `dyn:<action>` or `dyn:<action>|<arg>`.
+const DYNAMIC_PREFIX: &str = "dyn:";
/// Action run for an Open Recent entry (argument: the project path).
pub const OPEN_RECENT_ACTION: &str = "file.openRecentProject";
const MAX_RECENT: usize = 15;
@@ -145,6 +147,9 @@ pub enum Entry {
Separator,
/// Open Recent entries, filled from the recent-projects list.
RecentProjects,
+ /// Items the frontend lists under this slot name (registered tool windows,
+ /// saved layouts), from [`MenuConfig::dynamic`].
+ Dynamic(&'static str),
}
fn sub(id: &'static str, label: &'static str, children: Vec<Entry>) -> Entry {
@@ -161,6 +166,10 @@ fn hinted(id: &'static str, label: &'static str, hint: &'static str) -> Entry {
}
const SEP: Entry = Entry::Separator;
+/// [`Entry::Dynamic`] slots the frontend fills.
+pub const DYNAMIC_TOOL_WINDOWS: &str = "toolWindows";
+pub const DYNAMIC_LAYOUTS: &str = "toolWindowLayouts";
+
/// The menu bar for `os`. Labels are English defaults; the frontend replaces
/// them with `menu.<id>` strings from the active locale catalog.
pub fn spec(os: Os) -> Vec<Entry> {
@@ -194,6 +203,7 @@ pub fn spec(os: Os) -> Vec<Entry> {
}
let mut file = vec![
+ act("file.newProject", "New Project…"),
act("file.new", "New…"),
act("file.newScratchFile", "New Scratch File…"),
act("file.openProject", "Open…"),
@@ -204,16 +214,26 @@ pub fn spec(os: Os) -> Vec<Entry> {
vec![Entry::RecentProjects, SEP, act("welcome.recentProjects", "Manage Projects…")],
),
act("file.closeProject", "Close Project"),
+ act("file.renameProject", "Rename Project…"),
SEP,
act("file.save", "Save All"),
+ act("file.reloadAllFromDisk", "Reload All from Disk"),
sub("fileProperties", "File Properties", vec![act("file.toggleReadOnly", "Make File Read-only / Writable")]),
SEP,
+ act("file.invalidateCaches", "Invalidate Caches…"),
+ SEP,
+ sub(
+ "manageIdeSettings",
+ "Manage IDE Settings",
+ vec![act("file.exportSettings", "Export Settings…"), act("file.importSettings", "Import Settings…")],
+ ),
sub(
"newProjectsSetup",
"New Projects Setup",
vec![act("file.newProjectsSettings", "Settings for New Projects…")],
),
- act("file.invalidateCaches", "Invalidate Caches…"),
+ SEP,
+ act("file.togglePowerSave", "Power Save Mode"),
];
if !mac {
// macOS keeps Settings… and Quit in the application menu.
@@ -237,6 +257,34 @@ pub fn spec(os: Os) -> Vec<Entry> {
act("find.showUsages", "Show Usages"),
],
);
+ let macros = || {
+ sub(
+ "macros",
+ "Macros",
+ vec![
+ act("macro.startRecording", "Start Macro Recording"),
+ act("macro.stopRecording", "Stop Macro Recording"),
+ act("macro.playBack", "Play Back Last Macro"),
+ SEP,
+ act("macro.playSaved", "Play Saved Macros…"),
+ act("macro.edit", "Edit Macros…"),
+ ],
+ )
+ };
+ let bookmarks = || {
+ sub(
+ "bookmarks",
+ "Bookmarks",
+ vec![
+ act("navigate.toggleBookmark", "Toggle Bookmark"),
+ act("navigate.toggleBookmarkWithMnemonic", "Toggle Bookmark with Mnemonic"),
+ SEP,
+ act("navigate.showBookmarks", "Show All Bookmarks…"),
+ act("navigate.nextBookmark", "Next Bookmark"),
+ act("navigate.prevBookmark", "Previous Bookmark"),
+ ],
+ )
+ };
let edit = if mac {
vec![
Entry::Native(Native::Undo),
@@ -258,6 +306,9 @@ pub fn spec(os: Os) -> Vec<Entry> {
act("code.reverseLines", "Reverse Lines"),
SEP,
act("editor.toggleColumnSelection", "Column Selection Mode"),
+ SEP,
+ macros(),
+ bookmarks(),
]
} else {
// GTK/Win32 accelerators would swallow these keys before the webview, so
@@ -282,6 +333,9 @@ pub fn spec(os: Os) -> Vec<Entry> {
act("code.reverseLines", "Reverse Lines"),
SEP,
act("editor.toggleColumnSelection", "Column Selection Mode"),
+ SEP,
+ macros(),
+ bookmarks(),
]
};
menus.push(sub("edit", "Edit", edit));
@@ -293,37 +347,39 @@ pub fn spec(os: Os) -> Vec<Entry> {
sub(
"toolWindows",
"Tool Windows",
- vec![
- act("toolwindow.project", "Project"),
- act("toolwindow.bookmarks", "Bookmarks"),
- act("toolwindow.find", "Find"),
- act("toolwindow.run", "Run"),
- act("toolwindow.build", "Build"),
- act("toolwindow.debug", "Debug"),
- act("toolwindow.coverage", "Coverage"),
- act("toolwindow.profiler", "Profiler"),
- act("toolwindow.problems", "Problems"),
- act("toolwindow.structure", "Structure"),
- act("toolwindow.services", "Services"),
- act("toolwindow.git", "Git"),
- act("toolwindow.commit", "Commit"),
- act("toolwindow.terminal", "Terminal"),
- SEP,
- act("toolwindow.hideAll", "Hide All Tool Windows"),
- ],
+ vec![Entry::Dynamic(DYNAMIC_TOOL_WINDOWS), SEP, act("toolwindow.hideAll", "Hide All Tool Windows")],
),
sub(
"appearance",
"Appearance",
vec![
act("editor.toggleZen", "Enter Distraction Free Mode"),
+ act("window.toggleFullScreen", "Toggle Full Screen"),
+ act("view.toggleCompactMode", "Compact Mode"),
+ SEP,
+ act("view.zoomIn", "Zoom In IDE"),
+ act("view.zoomOut", "Zoom Out IDE"),
+ act("view.resetZoom", "Reset IDE Zoom"),
SEP,
act("view.toggleTheme", "Toggle Light/Dark Theme"),
+ act("toolbar.customize", "Customize Main Toolbar…"),
],
),
- act("view.notifications", "Notifications"),
SEP,
- act("window.toggleFullScreen", "Toggle Full Screen"),
+ act("code.quickDefinition", "Quick Definition"),
+ act("code.quickTypeDefinition", "Quick Type Definition"),
+ SEP,
+ act("navigate.recentLocations", "Recent Locations"),
+ act("navigate.recentFiles", "Recent Files"),
+ act("localHistory.recentChanges", "Recent Changes"),
+ SEP,
+ act("diff.compareWithClipboard", "Compare with Clipboard"),
+ SEP,
+ act("view.quickSwitchScheme", "Quick Switch Scheme…"),
+ SEP,
+ act("editor.resetFontSize", "Reset Font Size in All Editors"),
+ SEP,
+ act("view.notifications", "Notifications"),
],
));
@@ -337,8 +393,6 @@ pub fn spec(os: Os) -> Vec<Entry> {
act("navigate.gotoSymbol", "Symbol…"),
act("navigate.gotoLine", "Line/Column…"),
SEP,
- act("navigate.recentFiles", "Recent Files"),
- act("navigate.recentLocations", "Recent Locations"),
act("navigate.back", "Back"),
act("navigate.forward", "Forward"),
act("navigate.lastEditLocation", "Last Edit Location"),
@@ -360,8 +414,6 @@ pub fn spec(os: Os) -> Vec<Entry> {
act("navigate.nextError", "Next Highlighted Error"),
act("navigate.prevError", "Previous Highlighted Error"),
SEP,
- act("navigate.toggleBookmark", "Toggle Bookmark"),
- act("navigate.showBookmarks", "Show Bookmarks"),
act("navigate.selectIn", "Select In…"),
],
));
@@ -394,6 +446,7 @@ pub fn spec(os: Os) -> Vec<Entry> {
SEP,
act("code.reformat", "Reformat Code"),
act("code.optimizeImports", "Optimize Imports"),
+ act("code.cleanup", "Code Cleanup…"),
SEP,
act("code.commentLine", "Comment with Line Comment"),
act("code.commentBlock", "Comment with Block Comment"),
@@ -469,6 +522,7 @@ pub fn spec(os: Os) -> Vec<Entry> {
act("run.stop", "Stop"),
SEP,
act("run.chooseConfig", "Run…"),
+ act("runAnything.show", "Run Anything…"),
act("run.editConfigs", "Edit Configurations…"),
act("debug.attachToProcess", "Attach to Process…"),
SEP,
@@ -508,13 +562,20 @@ pub fn spec(os: Os) -> Vec<Entry> {
act("vcs.commit", "Commit…"),
act("vcs.push", "Push…"),
act("vcs.update", "Update Project…"),
+ act("vcs.pull", "Pull…"),
act("vcs.fetch", "Fetch"),
SEP,
+ act("vcs.merge", "Merge…"),
+ act("vcs.rebase", "Rebase…"),
+ SEP,
act("vcs.branches", "Branches…"),
act("vcs.newBranch", "New Branch…"),
act("vcs.newTag", "New Tag…"),
act("vcs.resetHead", "Reset HEAD…"),
SEP,
+ act("vcs.newWorktree", "New Worktree…"),
+ act("vcs.worktrees", "Worktrees…"),
+ SEP,
act("vcs.showDiff", "Show Diff"),
act("vcs.rollback", "Rollback…"),
act("vcs.annotate", "Annotate with Git Blame"),
@@ -552,6 +613,10 @@ pub fn spec(os: Os) -> Vec<Entry> {
act("github.openInBrowser", "Open on GitHub"),
],
),
+ act("vcs.manageRemotes", "Manage Remotes…"),
+ act("vcs.clone", "Clone…"),
+ SEP,
+ act("vcs.operations", "VCS Operations Popup…"),
],
));
@@ -573,14 +638,64 @@ pub fn spec(os: Os) -> Vec<Entry> {
window.extend([Entry::Native(Native::Minimize), Entry::Native(Native::Zoom), SEP]);
}
window.extend([
- act("window.new", "New Window"),
- accel("window.next", "Next Project Window", "CmdOrCtrl+`"),
- accel("window.previous", "Previous Project Window", "CmdOrCtrl+Shift+`"),
+ sub(
+ "toolWindowLayouts",
+ "Tool Window Layouts",
+ vec![
+ act("layout.save", "Save Current Layout as…"),
+ act("layout.restoreDefault", "Restore Default Layout"),
+ SEP,
+ Entry::Dynamic(DYNAMIC_LAYOUTS),
+ SEP,
+ act("layout.rename", "Rename Layout…"),
+ act("layout.delete", "Delete Layout…"),
+ ],
+ ),
+ SEP,
+ sub(
+ "activeToolWindow",
+ "Active Tool Window",
+ vec![
+ act("toolwindow.hideActive", "Hide Active Tool Window"),
+ act("toolwindow.maximize", "Maximize Tool Window"),
+ act("toolwindow.closeContent", "Close Active Tab"),
+ SEP,
+ act("toolwindow.jumpToLast", "Jump to Last Tool Window"),
+ act("toolwindow.focusEditor", "Focus Editor"),
+ ],
+ ),
+ sub(
+ "editorTabs",
+ "Editor Tabs",
+ vec![
+ act("editor.nextTab", "Select Next Tab"),
+ act("editor.prevTab", "Select Previous Tab"),
+ SEP,
+ act("editor.pinTab", "Pin Tab"),
+ act("editor.closeTab", "Close Tab"),
+ act("editor.closeOtherTabs", "Close Other Tabs"),
+ act("editor.closeAllTabs", "Close All Tabs"),
+ act("editor.reopenClosedTab", "Reopen Closed Tab"),
+ SEP,
+ act("editor.splitRight", "Split Right"),
+ act("editor.splitDown", "Split Down"),
+ act("editor.unsplit", "Unsplit"),
+ act("editor.moveToOppositeGroup", "Move to Opposite Group"),
+ ],
+ ),
SEP,
- act("editor.splitRight", "Split Right"),
- act("editor.splitDown", "Split Down"),
- act("editor.unsplit", "Unsplit"),
+ act("window.new", "New Window"),
]);
+ // ⌘` is macOS's window cycling; elsewhere Ctrl+` is Quick Switch Scheme and the keymap's
+ // Ctrl+Alt+] / Ctrl+Alt+[ switch windows.
+ if mac {
+ window.extend([
+ accel("window.next", "Next Project Window", "Cmd+`"),
+ accel("window.previous", "Previous Project Window", "Cmd+Shift+`"),
+ ]);
+ } else {
+ window.extend([act("window.next", "Next Project Window"), act("window.previous", "Previous Project Window")]);
+ }
if mac {
window.extend([SEP, Entry::Native(Native::BringAllToFront)]);
}
@@ -613,6 +728,13 @@ pub fn route(spec: &[Entry], id: &str) -> Option<MenuRoute> {
if let Some(path) = id.strip_prefix(RECENT_PREFIX) {
return Some(MenuRoute { action: OPEN_RECENT_ACTION.into(), arg: Some(path.into()) });
}
+ if let Some(rest) = id.strip_prefix(DYNAMIC_PREFIX) {
+ let (action, arg) = match rest.split_once('|') {
+ Some((action, arg)) => (action, Some(arg.to_owned())),
+ None => (rest, None),
+ };
+ return (!action.is_empty()).then(|| MenuRoute { action: action.into(), arg });
+ }
action_ids(spec).into_iter().any(|a| a == id).then(|| MenuRoute { action: id.into(), arg: None })
}
@@ -660,6 +782,28 @@ pub struct MenuConfig {
pub labels: HashMap<String, String>,
/// Action id → display shortcut from the JS keymap, e.g. `⇧⌘O`.
pub shortcuts: HashMap<String, String>,
+ /// [`Entry::Dynamic`] slot → its items, already localised.
+ #[serde(default)]
+ pub dynamic: HashMap<String, Vec<DynamicItem>>,
+}
+
+/// An item of a frontend-listed menu slot.
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Type)]
+#[serde(rename_all = "camelCase")]
+pub struct DynamicItem {
+ pub action: String,
+ pub arg: Option<String>,
+ pub label: String,
+}
+
+impl DynamicItem {
+ /// Native menu item id, decoded again by [`route`].
+ pub fn item_id(&self) -> String {
+ match &self.arg {
+ Some(arg) => format!("{DYNAMIC_PREFIX}{}|{arg}", self.action),
+ None => format!("{DYNAMIC_PREFIX}{}", self.action),
+ }
+ }
}
impl MenuConfig {
@@ -667,6 +811,18 @@ impl MenuConfig {
self.labels.get(&format!("menu.{id}")).cloned().unwrap_or_else(|| default.to_owned())
}
+ fn dynamic_items(&self, slot: &str) -> &[DynamicItem] {
+ self.dynamic.get(slot).map(Vec::as_slice).unwrap_or_default()
+ }
+
+ /// A dynamic item's text: its label, plus the action's shortcut unless it carries an argument.
+ fn dynamic_text(&self, item: &DynamicItem) -> String {
+ match self.shortcuts.get(&item.action).filter(|s| item.arg.is_none() && !s.is_empty()) {
+ Some(shortcut) => format!("{}\t{shortcut}", item.label),
+ None => item.label.clone(),
+ }
+ }
+
/// Item text with the keymap shortcut appended after a tab (display only).
pub fn item_text(&self, id: &str, default: &str, hint: Option<&str>) -> String {
let label = self.label(id, default);
@@ -680,6 +836,48 @@ impl MenuConfig {
#[derive(Default)]
pub struct MenuState {
pub config: Mutex<MenuConfig>,
+ /// Action ids the focused window reports as disabled (no context / not registered).
+ pub disabled: Mutex<HashSet<String>>,
+}
+
+/// The action an item id stands for, if it is an IDE action item.
+fn item_action(id: &str) -> Option<&str> {
+ if id.starts_with(RECENT_PREFIX) || id == "recent.none" || id.starts_with("submenu:") {
+ return None;
+ }
+ Some(id.strip_prefix(DYNAMIC_PREFIX).map_or(id, |rest| rest.split_once('|').map_or(rest, |(a, _)| a)))
+}
+
+/// Whether the item `id` is enabled given the disabled action ids.
+pub fn item_enabled(id: &str, disabled: &HashSet<String>) -> bool {
+ item_action(id).is_none_or(|a| !disabled.contains(a))
+}
+
+/// Updates the enabled state of the installed menu's items in place (no rebuild).
+pub fn apply_disabled<R: Runtime>(app: &AppHandle<R>, disabled: &HashSet<String>) {
+ fn walk<R: Runtime>(items: Vec<MenuItemKind<R>>, disabled: &HashSet<String>) {
+ for item in items {
+ match item {
+ MenuItemKind::MenuItem(i) => {
+ let enabled = item_enabled(i.id().as_ref(), disabled);
+ if i.is_enabled().is_ok_and(|e| e != enabled) {
+ let _ = i.set_enabled(enabled);
+ }
+ }
+ MenuItemKind::Submenu(s) => {
+ if let Ok(children) = s.items() {
+ walk(children, disabled)
+ }
+ }
+ _ => {}
+ }
+ }
+ }
+ if let Some(menu) = app.menu()
+ && let Ok(items) = menu.items()
+ {
+ walk(items, disabled);
+ }
}
pub struct RecentItem {
@@ -707,6 +905,7 @@ pub fn build<R: Runtime>(
os: Os,
config: &MenuConfig,
recent: &[RecentItem],
+ disabled: &HashSet<String>,
) -> tauri::Result<Menu<R>> {
let menu = Menu::new(app)?;
let mut spec = spec(os);
@@ -715,7 +914,7 @@ pub fn build<R: Runtime>(
}
for entry in spec {
if let Entry::Submenu { id, label, children } = entry {
- let submenu = build_submenu(app, config, recent, id, label, &children)?;
+ let submenu = build_submenu(app, config, recent, disabled, id, label, &children)?;
#[cfg(target_os = "macos")]
match id {
"window" => submenu.set_as_windows_menu_for_nsapp()?,
@@ -732,6 +931,7 @@ fn build_submenu<R: Runtime>(
app: &AppHandle<R>,
config: &MenuConfig,
recent: &[RecentItem],
+ disabled: &HashSet<String>,
id: &str,
label: &str,
children: &[Entry],
@@ -740,15 +940,23 @@ fn build_submenu<R: Runtime>(
for child in children {
match child {
Entry::Submenu { id, label, children } => {
- submenu.append(&build_submenu(app, config, recent, id, label, children)?)?
+ submenu.append(&build_submenu(app, config, recent, disabled, id, label, children)?)?
}
Entry::Action { id, label, accel, hint } => {
+ let enabled = item_enabled(id, disabled);
let item = match accel {
- Some(a) => MenuItem::with_id(app, *id, config.label(id, label), true, Some(*a))?,
- None => MenuItem::with_id(app, *id, config.item_text(id, label, *hint), true, None::<&str>)?,
+ Some(a) => MenuItem::with_id(app, *id, config.label(id, label), enabled, Some(*a))?,
+ None => MenuItem::with_id(app, *id, config.item_text(id, label, *hint), enabled, None::<&str>)?,
};
submenu.append(&item)?;
}
+ Entry::Dynamic(slot) => {
+ for d in config.dynamic_items(slot) {
+ let id = d.item_id();
+ let enabled = item_enabled(&id, disabled);
+ submenu.append(&MenuItem::with_id(app, id, config.dynamic_text(d), enabled, None::<&str>)?)?;
+ }
+ }
Entry::Native(n) => submenu.append(native(app, config, *n)?.as_ref())?,
Entry::Separator => submenu.append(&PredefinedMenuItem::separator(app)?)?,
Entry::RecentProjects => {
@@ -814,15 +1022,21 @@ pub enum MenuNode {
}
/// The spec as [`MenuNode`]s; native role items (macOS only) are left out.
-pub fn model(spec: &[Entry], recent: &[RecentItem]) -> Vec<MenuNode> {
+pub fn model(spec: &[Entry], recent: &[RecentItem], config: &MenuConfig) -> Vec<MenuNode> {
let mut out = Vec::new();
for e in spec {
match e {
Entry::Submenu { id, label, children } => out.push(MenuNode::Submenu {
id: (*id).into(),
label: (*label).into(),
- children: model(children, recent),
+ children: model(children, recent, config),
}),
+ Entry::Dynamic(slot) => out.extend(config.dynamic_items(slot).iter().map(|d| MenuNode::Action {
+ id: d.action.clone(),
+ label: d.label.clone(),
+ hint: None,
+ arg: d.arg.clone(),
+ })),
Entry::Action { id, label, hint, .. } => out.push(MenuNode::Action {
id: (*id).into(),
label: (*label).into(),
@@ -859,7 +1073,8 @@ pub fn install<R: Runtime>(app: &AppHandle<R>, menu_state: &MenuState, recent: &
let home = dirs::home_dir();
let items = recent_items(recent, home.as_deref());
let config = menu_state.config.lock().clone();
- match build(app, Os::current(), &config, &items).and_then(|m| app.set_menu(m)) {
+ let disabled = menu_state.disabled.lock().clone();
+ match build(app, Os::current(), &config, &items, &disabled).and_then(|m| app.set_menu(m)) {
Ok(_) => {}
Err(e) => tracing::warn!("failed to build the app menu: {e}"),
}
@@ -1107,14 +1322,131 @@ mod tests {
vec![Entry::Native(Native::Undo), act("file.save", "Save All"), SEP, Entry::RecentProjects],
)];
let recent = [RecentItem { path: "/p/a".into(), label: "a — ~/a".into() }];
- let MenuNode::Submenu { children, .. } = &model(&spec, &recent)[0] else { panic!("not a submenu") };
+ let MenuNode::Submenu { children, .. } = &model(&spec, &recent, &MenuConfig::default())[0] else {
+ panic!("not a submenu")
+ };
assert_eq!(children.len(), 3);
assert!(matches!(&children[0], MenuNode::Action { id, arg: None, .. } if id == "file.save"));
assert!(
matches!(&children[2], MenuNode::Action { id, arg: Some(p), .. } if id == OPEN_RECENT_ACTION && p == "/p/a")
);
- let MenuNode::Submenu { children, .. } = &model(&spec, &[])[0] else { panic!("not a submenu") };
+ let MenuNode::Submenu { children, .. } = &model(&spec, &[], &MenuConfig::default())[0] else {
+ panic!("not a submenu")
+ };
assert!(matches!(&children[2], MenuNode::Placeholder { id, .. } if id == "recent.none"));
}
+
+ fn dynamic_item(action: &str, arg: Option<&str>, label: &str) -> DynamicItem {
+ DynamicItem { action: action.into(), arg: arg.map(Into::into), label: label.into() }
+ }
+
+ #[test]
+ fn dynamic_items_route_with_their_argument() {
+ let spec = spec(Os::Mac);
+ let plain = dynamic_item("toolwindow.project", None, "Project");
+ let named = dynamic_item("layout.restore", Some("Review | wide"), "Review | wide");
+ assert_eq!(route(&spec, &plain.item_id()), Some(MenuRoute { action: "toolwindow.project".into(), arg: None }));
+ assert_eq!(
+ route(&spec, &named.item_id()),
+ Some(MenuRoute { action: "layout.restore".into(), arg: Some("Review | wide".into()) })
+ );
+ assert_eq!(route(&spec, "dyn:"), None);
+ }
+
+ #[test]
+ fn tool_windows_and_layouts_are_listed_by_the_frontend() {
+ fn slots(entries: &[Entry], out: &mut Vec<&'static str>) {
+ for e in entries {
+ match e {
+ Entry::Submenu { children, .. } => slots(children, out),
+ Entry::Dynamic(slot) => out.push(slot),
+ _ => {}
+ }
+ }
+ }
+ for os in ALL_OS {
+ let spec = spec(os);
+ let mut found = Vec::new();
+ slots(&spec, &mut found);
+ assert_eq!(found, [DYNAMIC_TOOL_WINDOWS, DYNAMIC_LAYOUTS], "{os:?}");
+ assert!(!action_ids(&spec).iter().any(|id| {
+ id.starts_with("toolwindow.")
+ && *id != "toolwindow.hideAll"
+ && ![
+ "toolwindow.hideActive",
+ "toolwindow.maximize",
+ "toolwindow.closeContent",
+ "toolwindow.jumpToLast",
+ "toolwindow.focusEditor",
+ ]
+ .contains(id)
+ }));
+ }
+ let mut config = MenuConfig::default();
+ config.dynamic.insert(
+ DYNAMIC_TOOL_WINDOWS.into(),
+ vec![dynamic_item("toolwindow.project", None, "Project"), dynamic_item("toolwindow.git", None, "Git")],
+ );
+ config.shortcuts.insert("toolwindow.project".into(), "⌘1".into());
+ assert_eq!(config.dynamic_text(&config.dynamic[DYNAMIC_TOOL_WINDOWS][0]), "Project\t⌘1");
+ assert_eq!(config.dynamic_text(&dynamic_item("toolwindow.project", Some("x"), "X")), "X");
+ let spec = vec![sub("toolWindows", "Tool Windows", vec![Entry::Dynamic(DYNAMIC_TOOL_WINDOWS), SEP])];
+ let MenuNode::Submenu { children, .. } = &model(&spec, &[], &config)[0] else { panic!("not a submenu") };
+ assert!(
+ matches!(&children[1], MenuNode::Action { id, arg: None, label, .. } if id == "toolwindow.git" && label == "Git")
+ );
+ let MenuNode::Submenu { children, .. } = &model(&spec, &[], &MenuConfig::default())[0] else { panic!() };
+ assert_eq!(children, &[MenuNode::Separator]);
+ }
+
+ #[test]
+ fn disabled_actions_disable_their_items_only() {
+ let disabled: HashSet<String> = ["refactor.rename".to_owned(), "layout.restore".to_owned()].into();
+ assert!(!item_enabled("refactor.rename", &disabled));
+ assert!(item_enabled("refactor.inline", &disabled));
+ assert!(!item_enabled("dyn:layout.restore|Review", &disabled));
+ assert!(item_enabled("dyn:toolwindow.git", &disabled));
+ assert!(item_enabled("recent:/p/refactor.rename", &disabled));
+ assert!(item_enabled("submenu:refactor", &disabled));
+ }
+
+ #[test]
+ fn idea_menu_items_are_present() {
+ for os in ALL_OS {
+ let ids = action_ids(&spec(os));
+ for required in [
+ "file.newProject",
+ "file.renameProject",
+ "file.reloadAllFromDisk",
+ "file.exportSettings",
+ "file.importSettings",
+ "file.togglePowerSave",
+ "macro.startRecording",
+ "macro.stopRecording",
+ "macro.playBack",
+ "macro.playSaved",
+ "macro.edit",
+ "navigate.toggleBookmark",
+ "navigate.showBookmarks",
+ "code.quickDefinition",
+ "code.quickTypeDefinition",
+ "localHistory.recentChanges",
+ "editor.resetFontSize",
+ "diff.compareWithClipboard",
+ "view.quickSwitchScheme",
+ "code.cleanup",
+ "runAnything.show",
+ "layout.save",
+ "layout.restoreDefault",
+ "layout.rename",
+ "layout.delete",
+ "toolwindow.hideActive",
+ "editor.closeOtherTabs",
+ "toolbar.customize",
+ ] {
+ assert!(ids.contains(&required), "{required} missing on {os:?}");
+ }
+ }
+ }
}
diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs
index 7b4fc6348..e0e436ce2 100644
--- a/src-tauri/src/state.rs
+++ b/src-tauri/src/state.rs
@@ -2,7 +2,7 @@ use crate::events::TauriSink;
use ide_core::{CancellationToken, IdeError, IdeEvent, IdeResult, RequestId, SharedSink};
use ide_dap::DebugManager;
use ide_index::ProjectIndex;
-use ide_language::{LanguageRegistry, Syntax, SyntaxCache};
+use ide_language::{FileTypes, LanguageRegistry, Syntax, SyntaxCache};
use ide_lsp::LspManager;
use ide_run::ProcessManager;
use ide_syntax::StructureService;
@@ -51,6 +51,8 @@ pub struct Project {
pub root: PathBuf,
/// Window-scoped event sink, for commands that emit project events.
pub sink: SharedSink,
+ /// The app's language definitions with this project's File Types applied.
+ pub languages: Arc<LanguageRegistry>,
pub settings: Arc<SettingsStore>,
pub documents: Arc<Documents>,
pub history: Arc<LocalHistory>,
@@ -72,7 +74,9 @@ pub struct Project {
pub db: Arc<ide_db::DbManager>,
/// HTTP Client responses (IDEA's `.idea/httpRequests`), in the app data dir.
pub http_history: Arc<ide_http::History>,
- _watcher: Watcher,
+ watcher: Watcher,
+ /// Watchers of the Project Structure content roots outside the project folder.
+ content_watchers: Mutex<Vec<(PathBuf, Watcher)>>,
_scratch_watcher: Option<Watcher>,
}
@@ -214,10 +218,19 @@ impl AppState {
let settings = SettingsStore::load(&self.config_dir, Some(&root));
let detected_roots = Arc::new(RwLock::new(ide_workspace::roots::detect(&root)));
let excludes = exclude_globs(&settings.effective(), &detected_roots.read());
+ let extra_roots = content_roots(&settings.effective(), &root);
mark("roots");
- let languages = self.languages.clone();
- let documents = Arc::new(Documents::new(sink.clone(), Box::new(move |p: &Path| languages.detect(p, None))));
+ // The project's own registry: File Types associations may be project-scoped.
+ let languages = Arc::new(self.languages.fork());
+ languages.set_file_types(FileTypes::from_settings(&settings.effective().files, Some(&root)));
+ let documents = {
+ let languages = languages.clone();
+ Arc::new(Documents::new(
+ sink.clone(),
+ Box::new(move |p: &Path, first: Option<&str>| languages.detect(p, first)),
+ ))
+ };
documents.set_file_defaults(ide_workspace::FileDefaults::from_settings(&settings.effective(), Some(&root)));
let history = Arc::new(LocalHistory::open(&self.data_dir.join("history"), &root)?);
{
@@ -233,13 +246,14 @@ impl AppState {
let index = ProjectIndex::open(
&root,
&self.data_dir.join("index").join(&project_key),
+ extra_roots.clone(),
excludes.clone(),
- self.languages.clone(),
+ languages.clone(),
self.syntax(),
sink.clone(),
)?;
mark("index");
- let lsp = LspManager::new(root.clone(), self.languages.clone(), sink.clone());
+ let lsp = LspManager::new(root.clone(), languages.clone(), sink.clone());
let settings = Arc::new(settings);
{
let settings = settings.clone();
@@ -301,7 +315,7 @@ impl AppState {
let history = history.clone();
Watcher::start(
&root.clone(),
- excludes,
+ excludes.clone(),
sink.clone(),
Box::new(move |batch| {
let changed: Vec<PathBuf> = batch.created.iter().chain(&batch.modified).cloned().collect();
@@ -314,6 +328,9 @@ impl AppState {
if touched.into_iter().any(ide_workspace::roots::affects_roots) {
let fresh = ide_workspace::roots::detect(&root);
if *detected_roots.read() != fresh {
+ // Detected excluded folders (`target`, `build`) leave the index too.
+ let effective = settings.effective();
+ index.set_scope(content_roots(&effective, &root), exclude_globs(&effective, &fresh));
*detected_roots.write() = fresh;
sink.emit(IdeEvent::ProjectRootsChanged { root: root.clone().into() });
}
@@ -356,6 +373,13 @@ impl AppState {
})
};
+ let content_watchers = extra_roots
+ .iter()
+ .filter_map(|r| {
+ let w = content_root_watcher(r, &excludes, &sink, &index, &documents, &history)?;
+ Some((r.clone(), w))
+ })
+ .collect();
mark("watcher");
let branch = repos.read().primary().and_then(|r| r.branch_info().ok()).and_then(|b| b.head);
{
@@ -366,6 +390,10 @@ impl AppState {
}
mark("git");
self.recent.touch(&root, branch)?;
+ let display_name = settings.effective().general.project_name;
+ if !display_name.trim().is_empty() {
+ self.recent.rename(&root, Some(display_name.trim()))?;
+ }
mark("recent");
tracing::info!("opened {} in window {window} in {} ms {laps:?}", root.display(), started.elapsed().as_millis());
@@ -374,6 +402,7 @@ impl AppState {
let project = Arc::new(Project {
root,
sink,
+ languages,
settings,
documents,
history,
@@ -387,7 +416,8 @@ impl AppState {
cache_dir: self.data_dir.join("cache").join(&project_key),
db,
http_history,
- _watcher: watcher,
+ watcher,
+ content_watchers: Mutex::new(content_watchers),
_scratch_watcher: scratch_watcher,
});
self.projects.write().insert(window.to_owned(), project.clone());
@@ -538,11 +568,15 @@ impl Project {
}
/// File masks (`ide_search::FileMask`) for Find in Files and inspections: the
- /// excluded roots and the ignored names (files, and everything under such folders).
+ /// excluded roots, the ignored names and the "Exclude files" patterns (files,
+ /// and everything under such folders).
pub fn search_excludes(&self) -> Vec<String> {
let mut out: Vec<String> =
self.roots().excluded_globs().iter().map(|d| format!("{}/**", d.trim_start_matches('/'))).collect();
- for name in &self.settings.effective().files.ignored_names {
+ let settings = self.settings.effective();
+ let names =
+ settings.files.ignored_names.iter().cloned().chain(settings.project_structure.exclude_file_patterns());
+ for name in names {
let name = name.trim();
if !name.is_empty() && !name.contains(['/', ',']) {
out.push(name.to_owned());
@@ -557,6 +591,45 @@ impl Project {
exclude_globs(&self.settings.effective(), &self.detected_roots.read())
}
+ /// Project Structure content roots besides the project folder (existing directories).
+ pub fn content_roots(&self) -> Vec<PathBuf> {
+ content_roots(&self.settings.effective(), &self.root)
+ }
+
+ /// Applies Settings › File Types; open documents whose language changed are
+ /// re-detected (language servers and syntax trees follow) and the index
+ /// re-parses the files whose language changed.
+ pub fn apply_file_types(&self, settings: &ide_core::settings::Settings) {
+ let before = Arc::new(self.languages.snapshot());
+ if self.languages.set_file_types(FileTypes::from_settings(&settings.files, Some(&self.root))) {
+ self.documents.redetect_languages();
+ self.index.languages_changed(before);
+ }
+ }
+
+ /// Applies changed content roots and exclude settings to the index (which
+ /// rescans in the background) and the file watchers, without reopening the project.
+ pub fn refresh_index_scope(&self) {
+ let (roots, excludes) = (self.content_roots(), self.exclude_globs());
+ self.index.set_scope(roots.clone(), excludes.clone());
+ self.watcher.set_excludes(&excludes);
+ let mut watchers = self.content_watchers.lock();
+ watchers.retain(|(p, _)| roots.contains(p));
+ for (_, w) in watchers.iter() {
+ w.set_excludes(&excludes);
+ }
+ for r in roots {
+ if watchers.iter().any(|(p, _)| *p == r) {
+ continue;
+ }
+ if let Some(w) =
+ content_root_watcher(&r, &excludes, &self.sink, &self.index, &self.documents, &self.history)
+ {
+ watchers.push((r, w));
+ }
+ }
+ }
+
/// Current text of `path`: the open buffer when available, else the file on disk.
pub fn text_of(&self, path: &Path) -> IdeResult<String> {
match self.documents.text_of(path) {
@@ -624,6 +697,44 @@ pub fn history_retention(settings: &ide_core::settings::Settings) -> ide_workspa
}
}
+/// Project Structure content roots outside `root` (existing absolute directories).
+fn content_roots(settings: &ide_core::settings::Settings, root: &Path) -> Vec<PathBuf> {
+ let mut out: Vec<PathBuf> = Vec::new();
+ for r in &settings.project_structure.content_roots {
+ let p = PathBuf::from(r.trim());
+ if p.is_absolute() && p.is_dir() && !p.starts_with(root) && !out.contains(&p) {
+ out.push(p);
+ }
+ }
+ out
+}
+
+/// Watches a content root outside the project: the index, open documents and
+/// Local History follow its changes like the project folder's.
+fn content_root_watcher(
+ dir: &Path,
+ excludes: &[String],
+ sink: &SharedSink,
+ index: &Arc<ProjectIndex>,
+ documents: &Arc<Documents>,
+ history: &Arc<LocalHistory>,
+) -> Option<Watcher> {
+ let (index, documents, history) = (index.clone(), documents.clone(), history.clone());
+ Watcher::start(
+ dir,
+ excludes.to_vec(),
+ sink.clone(),
+ Box::new(move |batch| {
+ let changed: Vec<PathBuf> = batch.created.iter().chain(&batch.modified).cloned().collect();
+ index.update(&changed, &batch.removed);
+ documents.on_disk_changed(&changed);
+ record_external_changes(&history, &changed, &batch.removed);
+ }),
+ )
+ .map_err(|e| tracing::warn!("content root watcher {}: {e}", dir.display()))
+ .ok()
+}
+
fn exclude_globs(settings: &ide_core::settings::Settings, detected: &[SourceFolder]) -> Vec<String> {
let mut globs = settings.file_excludes();
globs.extend(ProjectRoots::compute(detected.to_vec(), &settings.project_structure).excluded_globs());
diff --git a/src/bindings.ts b/src/bindings.ts
index 5ede6f18f..7b0a5b7c9 100644
--- a/src/bindings.ts
+++ b/src/bindings.ts
@@ -33,6 +33,18 @@ export const commands = {
* re-reads its effective settings.
*/
settingsSet: (scope: SettingsScope, key: string, value: string) => typedError<Settings_Serialize, IdeError>(__TAURI_INVOKE("settings_set", { scope, key, value })),
+ /**
+ * File › Manage IDE Settings › Export Settings…: the global settings plus the
+ * frontend's IDE-level `storage` (live / file templates, macros) to `path`.
+ */
+ settingsExport: (path: string, storage: { [key in string]: string }) => typedError<null, IdeError>(__TAURI_INVOKE("settings_export", { path, storage })),
+ /** Import Settings…: replaces the global settings with the file's; every window re-reads them. */
+ settingsImport: (path: string) => typedError<SettingsImport_Serialize, IdeError>(__TAURI_INVOKE("settings_import", { path })),
+ /**
+ * File › Rename Project…: the project's display name (title bar, recent
+ * projects); an empty `name` restores the folder name. Stored in the project's settings.
+ */
+ projectRename: (name: string) => typedError<ProjectInfo_Serialize, IdeError>(__TAURI_INVOKE("project_rename", { name })),
/**
* Effective source / test / resource / excluded roots of the window's project:
* auto-detected from build files, overridden by Settings › Project Structure.
@@ -91,7 +103,8 @@ export const commands = {
docSetEncoding: (doc: DocId, encoding: string, reload: boolean) => typedError<string, IdeError>(__TAURI_INVOKE("doc_set_encoding", { doc, encoding, reload })),
docSetLineEnding: (doc: DocId, lineEnding: LineEnding) => typedError<null, IdeError>(__TAURI_INVOKE("doc_set_line_ending", { doc, lineEnding })),
/**
- * Structure view: LSP document symbols when available, tree-sitter otherwise.
+ * Structure view: LSP document symbols when available (with tree-sitter
+ * visibility), tree-sitter otherwise.
* Tree-sitter answers come from the per-document tree cache (incremental
* re-parse); large documents get no syntax structure.
*/
@@ -198,6 +211,13 @@ export const commands = {
pathCompletions: (from: IpcPath, prefix: string) => typedError<PathCompletion[], IdeError>(__TAURI_INVOKE("path_completions", { from, prefix })),
/** Paths in an HTML document or stylesheet that name no existing file. */
webUnresolvedReferences: (doc: DocId) => typedError<FileReference[], IdeError>(__TAURI_INVOKE("web_unresolved_references", { doc })),
+ /**
+ * Misspelt words in the comments, string literals and declared names of
+ * `doc` (all of its text for prose). Cancel with `cancel_request(request)`.
+ */
+ spellCheck: (doc: DocId, request: RequestId) => typedError<Typo[], IdeError>(__TAURI_INVOKE("spell_check", { doc, request })),
+ /** Replacements for a misspelt `word`, best first (Typo › Change to…). */
+ spellSuggest: (word: string) => typedError<string[], IdeError>(__TAURI_INVOKE("spell_suggest", { word })),
/**
* Find in Files. Results stream through `on_event`; ends with `Done`.
* Cancel with `cancel_request(request)`.
@@ -218,6 +238,8 @@ export const commands = {
/** Validates a query (e.g. regex syntax) while the user types. */
searchValidate: (query: SearchQuery) => typedError<null, IdeError>(__TAURI_INVOKE("search_validate", { query })),
lspCompletion: (request: RequestId, doc: DocId, pos: Pos, trigger: string | null) => typedError<CompletionList, IdeError>(__TAURI_INVOKE("lsp_completion", { request, doc, pos, trigger })),
+ /** Inline (ghost text) suggestions at `pos`; `automatic` when triggered by typing. */
+ lspInlineCompletion: (request: RequestId, doc: DocId, pos: Pos, automatic: boolean) => typedError<InlineCompletionItem[], IdeError>(__TAURI_INVOKE("lsp_inline_completion", { request, doc, pos, automatic })),
lspResolveCompletion: (doc: DocId, item: CompletionItem) => typedError<CompletionItem, IdeError>(__TAURI_INVOKE("lsp_resolve_completion", { doc, item })),
lspHover: (request: RequestId, doc: DocId, pos: Pos) => typedError<{
contents: Markup,
@@ -328,6 +350,8 @@ export const commands = {
vcsStageHunks: (path: string, hunks: number[]) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_stage_hunks", { path, hunks })),
/** Clones a repository (Get from VCS). Works without an open project. */
vcsClone: (request: RequestId, url: string, dest: string, onOutput: Channel<string>) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_clone", { request, url, dest, onOutput })),
+ /** `git init` in `dir` (File › New Project… "Create Git repository"). */
+ vcsInit: (dir: string) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_init", { dir })),
/**
* Settings › Git › Test: runs `git --version` on `path`, or on the auto-detected
* executable when `path` is empty.
@@ -344,6 +368,15 @@ export const commands = {
vcsOperation: (repo: string | null, request: RequestId, op: GitOperation, onOutput: Channel<string>) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_operation", { repo, request, op, onOutput })),
vcsCreateTag: (repo: string | null, name: string, commit: string, message: string | null, force: boolean) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_create_tag", { repo, name, commit, message, force })),
vcsTags: (repo: string | null) => typedError<string[], IdeError>(__TAURI_INVOKE("vcs_tags", { repo })),
+ /** Merge dialog: merges `branches` into the current branch. */
+ vcsMergeWith: (repo: string | null, branches: string[], options: MergeOptions) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_merge_with", { repo, branches, options })),
+ /** Rebase dialog: rebases the current branch onto `upstream` (or `--onto`). */
+ vcsRebaseWith: (repo: string | null, upstream: string, options: RebaseOptions) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_rebase_with", { repo, upstream, options })),
+ vcsRemotes: (repo: string | null) => typedError<Remote[], IdeError>(__TAURI_INVOKE("vcs_remotes", { repo })),
+ vcsEditRemote: (repo: string | null, edit: RemoteEdit) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_edit_remote", { repo, edit })),
+ vcsWorktrees: (repo: string | null) => typedError<Worktree[], IdeError>(__TAURI_INVOKE("vcs_worktrees", { repo })),
+ vcsAddWorktree: (repo: string | null, path: string, commitish: string, newBranch: string | null) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_add_worktree", { repo, path, commitish, newBranch })),
+ vcsRemoveWorktree: (repo: string | null, path: string, force: boolean) => typedError<null, IdeError>(__TAURI_INVOKE("vcs_remove_worktree", { repo, path, force })),
/** Compare with Local: tracked files that differ between `rev` and the working tree. */
vcsDiffWithWorktree: (repo: string | null, rev: string) => typedError<ChangedFile[], IdeError>(__TAURI_INVOKE("vcs_diff_with_worktree", { repo, rev })),
/** Files that differ between two revisions (the "N files updated" of Update Project). */
@@ -382,11 +415,18 @@ export const commands = {
/** Detected configs followed by user-defined ones (user ids win on conflict). */
runConfigs: () => typedError<RunConfig_Serialize[], IdeError>(__TAURI_INVOKE("run_configs")),
runSaveConfigs: (configs: RunConfig_Deserialize[]) => typedError<null, IdeError>(__TAURI_INVOKE("run_save_configs", { configs })),
+ /** Configuration templates: per-type defaults applied to new configurations. */
+ runTemplates: () => typedError<RunConfig_Serialize[], IdeError>(__TAURI_INVOKE("run_templates")),
+ runSaveTemplates: (templates: RunConfig_Deserialize[]) => typedError<null, IdeError>(__TAURI_INVOKE("run_save_templates", { templates })),
+ /** The environment runs inherit when "Include system environment variables" is on. */
+ runSystemEnv: () => __TAURI_INVOKE<{ [key in string]: string }>("run_system_env"),
runStart: (config: RunConfig_Deserialize, onOutput: Channel<OutputChunk>) => typedError<RunInfo, IdeError>(__TAURI_INVOKE("run_start", { config, onOutput })),
runStop: (id: RunId) => typedError<null, IdeError>(__TAURI_INVOKE("run_stop", { id })),
runStdin: (id: RunId, data: string) => typedError<null, IdeError>(__TAURI_INVOKE("run_stdin", { id, data })),
runList: () => __TAURI_INVOKE<RunInfo[]>("run_list"),
runCloseStdin: (id: RunId) => typedError<null, IdeError>(__TAURI_INVOKE("run_close_stdin", { id })),
+ /** Terminal size of a run started with "Emulate terminal in output console". */
+ runResize: (id: RunId, cols: number, rows: number) => typedError<null, IdeError>(__TAURI_INVOKE("run_resize", { id, cols, rows })),
/**
* Results from the JUnit XML reports (Surefire, Failsafe, Gradle) of the module at
* `module` (relative to the project root) written since `since_ms` (Unix epoch, ms).
@@ -449,6 +489,11 @@ export const commands = {
sdkDetect: (kind: SdkKind) => typedError<Sdk[], IdeError>(__TAURI_INVOKE("sdk_detect", { kind })),
/** The interpreter the project uses: the configured one, else its virtualenv. */
sdkPythonEffective: () => typedError<string | null, IdeError>(__TAURI_INVOKE("sdk_python_effective")),
+ /**
+ * SDK / library source folders shown under "External Libraries" in the Project view,
+ * with the Maven / Gradle dependency jars of the build model.
+ */
+ sdkProjectLibraries: () => typedError<LibraryGroup[], IdeError>(__TAURI_INVOKE("sdk_project_libraries")),
/** Looks up `names` (bare command names): `node_modules/.bin` above `near`, then the search path. */
sdkLocateTools: (names: string[], near: string | null) => typedError<LocatedTools, IdeError>(__TAURI_INVOKE("sdk_locate_tools", { names, near })),
/** `base -m venv location`; output lines stream through `on_output`. */
@@ -494,6 +539,11 @@ export const commands = {
menuRefresh: () => __TAURI_INVOKE<void>("menu_refresh"),
/** The menu bar for a title bar drawn by the frontend (Windows). */
menuModel: () => __TAURI_INVOKE<MenuNode[]>("menu_model"),
+ /**
+ * Action ids the focused window cannot run now: their native menu items are
+ * disabled in place (no rebuild).
+ */
+ menuSetDisabled: (ids: string[]) => __TAURI_INVOKE<void>("menu_set_disabled", { ids }),
appLogLocation: () => typedError<LogLocation, IdeError>(__TAURI_INVOKE("app_log_location")),
appBuildInfo: () => __TAURI_INVOKE<BuildInfo>("app_build_info"),
appCheckUpdate: () => typedError<UpdateCheck, IdeError>(__TAURI_INVOKE("app_check_update")),
@@ -541,6 +591,11 @@ export const commands = {
coveragePrepare: (config: RunConfig_Deserialize) => typedError<CoveragePrepared_Serialize, IdeError>(__TAURI_INVOKE("coverage_prepare", { config })),
/** Reads the report a coverage run left behind. */
coverageCollect: (report: CoverageReportSpec) => typedError<CoverageSuite, IdeError>(__TAURI_INVOKE("coverage_collect", { report })),
+ /**
+ * Reads a report collected elsewhere (CI): lcov, a Go cover profile or JaCoCo XML,
+ * with paths mapped into this project.
+ */
+ coverageImport: (path: IpcPath) => typedError<CoverageSuite, IdeError>(__TAURI_INVOKE("coverage_import", { path })),
/** The browsers installed on this machine. */
webBrowsers: () => typedError<Browser[], IdeError>(__TAURI_INVOKE("web_browsers")),
/** The built-in server's URL for `path` (started on first use). */
@@ -607,19 +662,32 @@ export const commands = {
*/
structuralSearch: (request: RequestId, scope: SearchScope, query: StructuralQuery, onEvent: Channel<StructuralEvent>) => typedError<null, IdeError>(__TAURI_INVOKE("structural_search", { request, scope, query, onEvent })),
/** Availability plus containers, images, volumes and networks. */
- dockerSnapshot: () => typedError<DockerSnapshot, IdeError>(__TAURI_INVOKE("docker_snapshot")),
- dockerContainerOp: (ids: string[], op: ContainerOp) => typedError<null, IdeError>(__TAURI_INVOKE("docker_container_op", { ids, op })),
- dockerRemove: (object: DockerObject, ids: string[], force: boolean) => typedError<null, IdeError>(__TAURI_INVOKE("docker_remove", { object, ids, force })),
+ dockerSnapshot: (endpoint: DockerEndpoint) => typedError<DockerSnapshot, IdeError>(__TAURI_INVOKE("docker_snapshot", { endpoint })),
+ dockerContainerOp: (endpoint: DockerEndpoint, ids: string[], op: ContainerOp) => typedError<null, IdeError>(__TAURI_INVOKE("docker_container_op", { endpoint, ids, op })),
+ dockerRemove: (endpoint: DockerEndpoint, object: DockerObject, ids: string[], force: boolean) => typedError<null, IdeError>(__TAURI_INVOKE("docker_remove", { endpoint, object, ids, force })),
/** Pretty-printed `docker inspect` JSON. */
- dockerInspect: (object: DockerObject, id: string) => typedError<string, IdeError>(__TAURI_INVOKE("docker_inspect", { object, id })),
+ dockerInspect: (endpoint: DockerEndpoint, object: DockerObject, id: string) => typedError<string, IdeError>(__TAURI_INVOKE("docker_inspect", { endpoint, object, id })),
/** Streams a container's log lines until it stops or the request is cancelled. */
- dockerLogs: (request: RequestId, id: string, tail: number, follow: boolean, timestamps: boolean, onLine: Channel<DockerLogLine>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_logs", { request, id, tail, follow, timestamps, onLine })),
+ dockerLogs: (request: RequestId, endpoint: DockerEndpoint, id: string, tail: number, follow: boolean, timestamps: boolean, onLine: Channel<DockerLogLine>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_logs", { request, endpoint, id, tail, follow, timestamps, onLine })),
/** Follows `docker events` until the daemon goes away or the request is cancelled. */
- dockerEvents: (request: RequestId, onEvent: Channel<DockerEvent>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_events", { request, onEvent })),
- dockerPull: (request: RequestId, reference: string, onOutput: Channel<string>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_pull", { request, reference, onOutput })),
- dockerPrune: (request: RequestId, target: PruneTarget, onOutput: Channel<string>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_prune", { request, target, onOutput })),
+ dockerEvents: (request: RequestId, endpoint: DockerEndpoint, onEvent: Channel<DockerEvent>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_events", { request, endpoint, onEvent })),
+ /** `docker pull`, logging in first when a saved registry with a password serves the image. */
+ dockerPull: (request: RequestId, endpoint: DockerEndpoint, reference: string, onOutput: Channel<string>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_pull", { request, endpoint, reference, onOutput })),
+ dockerPrune: (request: RequestId, endpoint: DockerEndpoint, target: PruneTarget, onOutput: Channel<string>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_prune", { request, endpoint, target, onOutput })),
/** `docker compose` start / stop / restart / down of a project found through labels. */
- dockerComposeOp: (request: RequestId, project: string, files: string[], workingDir: string | null, op: ComposeOp, onOutput: Channel<string>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_compose_op", { request, project, files, workingDir, op, onOutput })),
+ dockerComposeOp: (request: RequestId, endpoint: DockerEndpoint, project: string, files: string[], workingDir: string | null, op: ComposeOp, onOutput: Channel<string>) => typedError<null, IdeError>(__TAURI_INVOKE("docker_compose_op", { request, endpoint, project, files, workingDir, op, onOutput })),
+ /** Docker connections and registries (app-wide). */
+ dockerSettings: () => typedError<DockerSettings, IdeError>(__TAURI_INVOKE("docker_settings")),
+ dockerSaveSettings: (settings: DockerSettings) => typedError<null, IdeError>(__TAURI_INVOKE("docker_save_settings", { settings })),
+ /** Saves (`None`: forgets) a registry's password. */
+ dockerSetRegistryPassword: (id: string, password: string | null) => typedError<null, IdeError>(__TAURI_INVOKE("docker_set_registry_password", { id, password })),
+ /** Test login to `registry` (`password`, else the saved one) through `endpoint`'s daemon. */
+ dockerRegistryLogin: (endpoint: DockerEndpoint, registry: DockerRegistry, password: string | null) => typedError<string, IdeError>(__TAURI_INVOKE("docker_registry_login", { endpoint, registry, password })),
+ /**
+ * Environment for a Docker run configuration's command line: selects `endpoint`'s
+ * daemon and puts the docker executable on `PATH`.
+ */
+ dockerRunEnv: (endpoint: DockerEndpoint) => typedError<{ [key in string]: string }, IdeError>(__TAURI_INVOKE("docker_run_env", { endpoint })),
ghAvailability: () => typedError<GhAvailability, IdeError>(__TAURI_INVOKE("gh_availability")),
ghPrList: (query: PrListQuery) => typedError<PullRequestSummary[], IdeError>(__TAURI_INVOKE("gh_pr_list", { query })),
ghPrView: (number: number) => typedError<PullRequestDetails, IdeError>(__TAURI_INVOKE("gh_pr_view", { number })),
@@ -778,6 +846,8 @@ export type AppearanceSettings = {
* (status bar context menu); widgets not listed use their default.
*/
statusBarWidgets?: { [key in string]: boolean },
+ /** Customize Main Toolbar; `None` = the default toolbar. */
+ mainToolbar?: MainToolbarSettings | null,
};
export type ApplyOutcome = {
@@ -808,6 +878,16 @@ export type AutoImportSettings = {
optimizeOnTheFly?: boolean,
};
+/** A step run before a configuration launches; a failing step aborts the launch. */
+export type BeforeLaunchTask = {
+ /**
+ * `run` (another configuration, `target` = its id) | `build` | `tool` (external tool id) |
+ * `command` (a shell command line) | `toolWindow` (tool window id).
+ */
+ kind: string,
+ target?: string,
+};
+
export type BlameLine = {
commit: string,
author: string,
@@ -1095,6 +1175,14 @@ export type CodeStyleSettings_Deserialize = {
/** Enable EditorConfig support. */
editorconfig?: boolean,
languages?: { [key in string]: LanguageCodeStyle_Deserialize },
+ /** Formatter › Do not format: globs (`*.min.js`, `generated/**`) Reformat Code skips. */
+ doNotFormat?: string[],
+ /** Formatter › Turn formatter on/off with markers in code comments. */
+ formatterTagsEnabled?: boolean,
+ formatterOffTag?: string,
+ formatterOnTag?: string,
+ /** The markers are regular expressions. */
+ formatterTagsRegexp?: boolean,
};
/** Editor › Code Style (General tab + per-language overrides). */
@@ -1108,6 +1196,14 @@ export type CodeStyleSettings_Serialize = {
/** Enable EditorConfig support. */
editorconfig: boolean,
languages: { [key in string]: LanguageCodeStyle_Serialize },
+ /** Formatter › Do not format: globs (`*.min.js`, `generated/**`) Reformat Code skips. */
+ doNotFormat: string[],
+ /** Formatter › Turn formatter on/off with markers in code comments. */
+ formatterTagsEnabled: boolean,
+ formatterOffTag: string,
+ formatterOnTag: string,
+ /** The markers are regular expressions. */
+ formatterTagsRegexp: boolean,
};
export type Command = {
@@ -1132,6 +1228,8 @@ export type Commit = {
summary: string,
message: string,
refs: string[],
+ /** Committer time (Log › View Options › Commit Timestamp). */
+ commitTimeMs?: number | null,
};
/** Commit Options (IDEA's commit options popup). */
@@ -1209,6 +1307,12 @@ export type CompletionSettings = {
autoPopup?: boolean,
/** Insert the selected suggestion by pressing space, dot, or other context-dependent keys. */
insertOnSpecialKeys?: boolean,
+ /** Insert a sole suggestion of explicit (⌃Space) completion right away. */
+ autoInsertSingle?: boolean,
+ /** Sort suggestions by name instead of relevance. */
+ sortAlphabetically?: boolean,
+ /** Add `()` after function and method suggestions. */
+ insertParentheses?: boolean,
showDocumentation?: boolean,
documentationDelay?: number,
parameterInfo?: boolean,
@@ -1272,6 +1376,12 @@ export type CreatePullRequest = {
push: boolean,
};
+/** A named profile made with Copy. */
+export type CustomInspectionProfile = {
+ name?: string,
+ overrides?: { [key in string]: InspectionOverride },
+};
+
export type CustomKeymap = {
name?: string,
/** Bundled preset the keymap derives from, e.g. `intellij-macos`. */
@@ -1317,6 +1427,20 @@ export type DataSource = {
readOnly?: boolean,
/** SSH tunnel settings (`None`: never configured; kept but unused when not `enabled`). */
ssh?: DbSsh | null,
+ /** Wire-compatible product preset (`cockroachdb`, `tidb`…; empty: the driver itself). */
+ vendor?: string,
+ color?: DbColor | null,
+ comment?: string,
+ /** Connect with [`DataSource::url`] instead of the host / port / database fields. */
+ urlOnly?: boolean,
+ url?: string,
+ /** PEM files; `~/` is the home directory. */
+ sslCaFile?: string,
+ sslCertFile?: string,
+ sslKeyFile?: string,
+ options?: DbOptions,
+ introspection?: DbIntrospection,
+ properties?: DbProperty[],
};
/** System Settings › Date Formats (Git log, Local History, blame). */
@@ -1336,6 +1460,9 @@ export type DbCellValue = {
value: string | null,
};
+/** IDEA's data source colours (tree node and console tab tint), e.g. red for production. */
+export type DbColor = "red" | "orange" | "yellow" | "green" | "blue" | "violet";
+
export type DbColumnInfo = {
name: string,
dataType: string,
@@ -1394,6 +1521,41 @@ export type DbIndexInfo = {
columns: string[],
};
+/** Schemas tab: the databases / schemas the tree shows. Names may use `*` and `?`. */
+export type DbIntrospection = {
+ allDatabases?: boolean,
+ databases?: string[],
+ allSchemas?: boolean,
+ schemas?: string[],
+ /** `pg_catalog`, `information_schema`, `mysql`…, and PostgreSQL template databases. */
+ showSystem?: boolean,
+};
+
+/** Options tab: session settings applied to every connection. */
+export type DbOptions = {
+ transaction?: DbTxMode,
+ /** PostgreSQL `search_path` (unqualified names resolve there). */
+ defaultSchema?: string,
+ /** Session time zone (`TimeZone` / `time_zone`); empty keeps the default. */
+ timeZone?: string,
+ /** Statements run on every new connection. */
+ startupScript?: string,
+ /** Run `SELECT 1` this often while connected. */
+ keepAliveSecs?: number | null,
+ /** Disconnect after this long without statements (enforced by the UI, which sees the activity). */
+ autoDisconnectSecs?: number | null,
+};
+
+/**
+ * Advanced tab: a driver property. PostgreSQL: run-time parameters (and
+ * `application_name`); MySQL: session variables (and `charset`, `collation`);
+ * SQLite: pragmas. See [`crate::conn`].
+ */
+export type DbProperty = {
+ name?: string,
+ value?: string,
+};
+
export type DbQueryResult = {
statement: string,
columns: DbResultColumn[],
@@ -1443,7 +1605,11 @@ export type DbSshAuth = "password" |
/** `~/.ssh/config` (HostName, User, Port, IdentityFile, ProxyJump) and the SSH agent. */
"openSsh";
-export type DbSslMode = "disable" | "prefer" | "require";
+export type DbSslMode = "disable" | "prefer" | "require" |
+/** Require, and check the server certificate against the CA file. */
+"verifyCa" |
+/** [`DbSslMode::VerifyCa`], and check that the certificate names the host. */
+"verifyFull";
export type DbStatementOutcome = {
statement: SqlStatement,
@@ -1470,6 +1636,9 @@ export type DbTablePage = {
offset: number | null,
};
+/** Transaction control of the data source's consoles. */
+export type DbTxMode = "auto" | "manual";
+
/** What a session's adapter supports, for enabling actions. */
export type DebugCapabilities = {
restartFrame: boolean,
@@ -1534,6 +1703,11 @@ export type Diagnostic = {
code: string | null,
unnecessary?: boolean,
deprecated?: boolean,
+ /**
+ * Language server (or tool) that reported it, e.g. `basedpyright`; `source`
+ * is what the producer calls itself. Inspection profiles key on this.
+ */
+ server?: string | null,
};
/** Changes under a folder (Show History on a directory). */
@@ -1563,6 +1737,12 @@ context: string | null } |
/** The CLI is there but cannot reach a daemon (not started, wrong context…). */
{ kind: "daemonDown"; message: string; context: string | null };
+export type DockerConnection = {
+ id: string,
+ name: string,
+ endpoint: DockerEndpoint,
+};
+
export type DockerContainer = {
id: string,
name: string,
@@ -1583,6 +1763,20 @@ export type DockerContainer = {
composeFiles: string[],
};
+/** Which daemon a docker command talks to. */
+export type DockerEndpoint =
+/** Whatever the CLI is configured for (`DOCKER_HOST`, the current context). */
+{ kind: "default" } |
+/** A local daemon socket, e.g. `/var/run/docker.sock` (or a `npipe://` URL on Windows). */
+{ kind: "socket"; path: string } |
+/**
+ * A remote daemon, e.g. `tcp://build:2376` or `ssh://me@build`; with TLS when
+ * `tls_cert_dir` holds `ca.pem`, `cert.pem` and `key.pem`.
+ */
+{ kind: "tcp"; host: string; tlsCertDir: string | null } |
+/** A named `docker context`. */
+{ kind: "context"; name: string };
+
/** One relevant `docker events` entry. */
export type DockerEvent = {
/** `container`, `image`, `volume`, `network`. */
@@ -1617,6 +1811,20 @@ export type DockerNetwork = {
export type DockerObject = "container" | "image" | "volume" | "network";
+/** A registry to log in to (Docker Hub, GHCR, a private one). The password is stored separately. */
+export type DockerRegistry = {
+ id: string,
+ name: string,
+ /** `docker.io`, `ghcr.io`, `registry.example.com:5000`. */
+ address: string,
+ username?: string,
+};
+
+export type DockerSettings = {
+ connections?: DockerConnection[],
+ registries?: DockerRegistry[],
+};
+
/** Everything the Services tree shows, fetched in one go. */
export type DockerSnapshot = {
availability: DockerAvailability,
@@ -1628,6 +1836,8 @@ export type DockerSnapshot = {
networks: DockerNetwork[],
/** Lists that failed although the daemon answered (shown, not fatal). */
errors: string[],
+ /** Global CLI options selecting the connection's daemon (for `docker exec` in a terminal). */
+ globalArgs?: string[],
};
export type DockerVolume = {
@@ -1705,6 +1915,13 @@ export type DuplicatesReport = {
elapsedMs: number,
};
+/** An item of a frontend-listed menu slot. */
+export type DynamicItem = {
+ action: string,
+ arg: string | null,
+ label: string,
+};
+
/** Editor › General › Appearance. */
export type EditorAppearanceSettings = {
caretBlinking?: boolean,
@@ -1795,6 +2012,7 @@ export type EditorSettings_Deserialize = {
smartKeys?: SmartKeysSettings,
codeEditing?: CodeEditingSettings,
inlay?: InlayHintsSettings,
+ inlineCompletion?: InlineCompletionSettings,
/** Gutter icon groups turned off (`run`, `breakpoints`, `bookmarks`, `vcs`, `blame`). */
gutterIconsDisabled?: string[],
showGutterIcons?: boolean,
@@ -1830,6 +2048,7 @@ export type EditorSettings_Serialize = {
smartKeys: SmartKeysSettings,
codeEditing: CodeEditingSettings,
inlay: InlayHintsSettings,
+ inlineCompletion: InlineCompletionSettings,
/** Gutter icon groups turned off (`run`, `breakpoints`, `bookmarks`, `vcs`, `blame`). */
gutterIconsDisabled: string[],
showGutterIcons: boolean,
@@ -1839,13 +2058,22 @@ export type EditorSettings_Serialize = {
/** Editor › General › Editor Tabs. */
export type EditorTabsSettings = {
- /** `top` | `none`. */
+ /** `top` | `bottom` | `none`. */
placement?: string,
multipleRows?: boolean,
+ /** One row that doesn't fit: `scroll` the tabs panel | `squeeze` the tabs. */
+ oneRowOverflow?: string,
+ pinnedSeparateRow?: boolean,
+ showFileIcon?: boolean,
showExtension?: boolean,
+ showDirectoryForNonUnique?: boolean,
/** Mark modified tabs with an asterisk. */
markModified?: boolean,
+ showFullPathOnHover?: boolean,
showCloseButton?: boolean,
+ /** `right` | `left` (with `show_close_button`). */
+ closeButtonPosition?: string,
+ sortAlphabetically?: boolean,
previewTab?: boolean,
openAtEnd?: boolean,
tabLimit?: number,
@@ -2026,6 +2254,10 @@ export type FileSettings = {
localHistoryDays?: number,
/** Upper bound for a project's Local History in MB; the oldest revisions go first. */
localHistoryMaxMb?: number,
+ /** File Types › Recognized File Types: the user's changes, by language id. */
+ fileTypes?: { [key in string]: FileTypeAssociation },
+ /** Override File Type: file (project-relative and `/`-separated, or absolute) → language id. */
+ fileTypeOverrides?: { [key in string]: string },
};
export type FileStatus = {
@@ -2038,6 +2270,16 @@ export type FileStatus = {
renamedFrom: string | null,
};
+/** One language's file name and hashbang patterns on top of its definition. */
+export type FileTypeAssociation = {
+ /** Added file name patterns: `*.foo`, `Jenkinsfile`, `Dockerfile.*` (`*` and `?` wildcards). */
+ patterns?: string[],
+ /** Patterns of the definition (`*.ext`, file names) the user removed. */
+ removedPatterns?: string[],
+ /** Interpreters run by a `#!` first line, e.g. `node` for `#!/usr/bin/env node`. */
+ hashbangs?: string[],
+};
+
export type FoldKind = "region" | "comment" | "imports";
export type FoldRange = {
@@ -2091,6 +2333,13 @@ export type GeneralSettings = {
saveOnIdle?: boolean,
idleSeconds?: number,
dateFormat?: DateFormatSettings,
+ /**
+ * File › Power Save Mode: no automatic popups (completion, parameter info,
+ * quick documentation) or background highlighting (usages, code vision).
+ */
+ powerSaveMode?: boolean,
+ /** File › Rename Project… (project layer): the name shown for the project; empty = its folder name. */
+ projectName?: string,
};
/** Whether pull requests can be shown for the project, and why not. */
@@ -2332,6 +2581,8 @@ export type IdeEvent =
{ type: "docPatched"; doc: DocId; baseVersion: number; version: number; changes: TextChange[] } |
/** A document's dirty flag changed (saved / modified externally). */
{ type: "docDirty"; doc: DocId; dirty: boolean } |
+/** An open document's language changed (Settings › File Types, Override File Type). */
+{ type: "docLanguage"; doc: DocId; language: LanguageId } |
/** Full replacement of diagnostics for one file from one producer. */
{ type: "diagnostics"; path: IpcPath; source: string; items: Diagnostic[] } |
/** Progress of a background task; `fraction` is `None` when indeterminate. */
@@ -2411,6 +2662,8 @@ export type InlayHintsSettings = {
disabledLanguages?: string[],
/** Code vision: usages above declarations. */
codeVisionUsages?: boolean,
+ /** Code vision: last author of a declaration (VCS blame) beside its usages. */
+ codeVisionAuthor?: boolean,
};
export type InlayKind = "type" | "parameter" | "other";
@@ -2423,6 +2676,31 @@ export type InlayLabelPart = {
location: Location | null,
};
+/** One `textDocument/inlineCompletion` suggestion (ghost text at the caret). */
+export type InlineCompletionItem = {
+ /** Text that replaces `range`; snippets arrive as their plain text. */
+ insertText: string,
+ /** Replaced range; `None` inserts at the caret. */
+ range: Range | null,
+ /** What the typed text is matched against while the suggestion stays shown (default: `insert_text`). */
+ filterText: string | null,
+ /** Run after the suggestion is accepted. */
+ command: Command | null,
+ server: ServerId,
+};
+
+/**
+ * Editor › General › Inline Completion: ghost text from language servers that
+ * support `textDocument/inlineCompletion` (LSP 3.18).
+ */
+export type InlineCompletionSettings = {
+ enabled?: boolean,
+ /** Ask only once typing has paused for `pause_ms`, instead of right after each change. */
+ onlyOnPause?: boolean,
+ pauseMs?: number,
+ disabledLanguages?: string[],
+};
+
export type InspectEvent =
/** Files about to be inspected. */
{ type: "started"; total: number } |
@@ -2447,6 +2725,33 @@ export type InspectedFile = {
diagnostics: Diagnostic[],
};
+/** IDEA's highlighting levels. */
+export type InspectionLevel = "error" | "warning" | "weakWarning" | "serverProblem" | "typo" |
+/** Reported (Problems, Inspect Code) but not highlighted in the editor. */
+"none";
+
+/** Changes to one inspection; absent fields keep the inspection's defaults. */
+export type InspectionOverride = {
+ enabled?: boolean | null,
+ severity?: InspectionLevel | null,
+};
+
+export type InspectionSettings = {
+ /**
+ * Profile in effect for the project: `default`, `project`, or a copy
+ * as `ide:<key>` / `project:<key>`.
+ */
+ profile?: string,
+ /** The `Default` profile (IDE level): inspection id → override. */
+ default?: { [key in string]: InspectionOverride },
+ /** The `Project Default` profile (stored with the project). */
+ project?: { [key in string]: InspectionOverride },
+ /** Profiles copied at IDE level (global settings), by key. */
+ ideProfiles?: { [key in string]: CustomInspectionProfile },
+ /** Profiles copied at project level (project settings), by key. */
+ projectProfiles?: { [key in string]: CustomInspectionProfile },
+};
+
/** A command line that installs a missing tool (run in the Run tool window). */
export type InstallCommand = {
command: string,
@@ -2578,6 +2883,12 @@ export type LanguageInfo_Deserialize = {
indent: IndentConfig_Deserialize | null,
/** A debug adapter is configured (breakpoints make sense in these files). */
debuggable?: boolean,
+ /** Names of the configured language servers (Settings › Inspections). */
+ languageServers?: string[],
+ /** Exact file names and file-name patterns of the definition (Settings › File Types). */
+ filenames?: string[],
+ /** First-line regex of the definition (shebangs, `<?php`). */
+ firstLine?: string | null,
};
/** The UI-facing view of a language. */
@@ -2591,6 +2902,12 @@ export type LanguageInfo_Serialize = {
indent: IndentConfig_Serialize | null,
/** A debug adapter is configured (breakpoints make sense in these files). */
debuggable?: boolean,
+ /** Names of the configured language servers (Settings › Inspections). */
+ languageServers?: string[],
+ /** Exact file names and file-name patterns of the definition (Settings › File Types). */
+ filenames?: string[],
+ /** First-line regex of the definition (shebangs, `<?php`). */
+ firstLine?: string | null,
};
export type LanguagesSettings = {
@@ -2632,6 +2949,25 @@ export type LaunchConfig = {
extraJson: string | null,
};
+/** One SDK or library with its source folders (`< Python 3.12 (.venv) >`). */
+export type LibraryGroup = {
+ /** Display name, e.g. `Python 3.12 (.venv)`. */
+ name: string,
+ /** `python` | `jdk` | `nodeModules` | `nodeCore` | `rust` | `cargo` | `go` | `goModules` | `maven` | `gradle`. */
+ kind: string,
+ roots: LibraryRoot[],
+};
+
+export type LibraryRoot = {
+ /**
+ * Folder name, e.g. `python3.12` or `site-packages`, the package (`serde 1.0.200`)
+ * or the archive (`src.zip`, `guava-33.0.0-jre-sources.jar`).
+ */
+ name: string,
+ /** A folder, or an archive's root (`<archive>!`). */
+ path: IpcPath,
+};
+
/** Coverage of one source line. */
export type LineCoverage = {
/** 0-based. */
@@ -2740,6 +3076,13 @@ export type LogLocation = {
file: IpcPath | null,
};
+/** Order of the Git Log (Graph Options › Sort). */
+export type LogOrder =
+/** `--topo-order`: lines of history are not intermixed. */
+"topo" |
+/** `--date-order`: commit time, but never a parent before its children. */
+"date";
+
export type LogQuery = {
branch: string | null,
path: IpcPath | null,
@@ -2760,10 +3103,34 @@ export type LogQuery = {
branches?: string[],
/** More author needles next to `author`; a commit matches any of them (Log User filter). */
authors?: string[],
+ order?: LogOrder,
+ /** Follow only the first parent of merges (`--first-parent`). */
+ firstParent?: boolean,
+ /** Leave out merge commits (`--no-merges`); their children link to their parents. */
+ noMerges?: boolean,
+ /**
+ * Committer time bounds (epoch ms; `since` inclusive, `until` exclusive). Parents
+ * outside the range are rewritten to their nearest shown ancestors (or dropped when
+ * older), so the graph stays connected.
+ */
+ sinceMs?: number | null,
+ untilMs?: number | null,
};
export type LspRefreshKind = "inlayHints" | "semanticTokens" | "codeLens";
+/**
+ * Main toolbar entries per side, in order: title widget ids (`project`,
+ * `vcs.branch`…) or `action:<id>`. Widgets in neither list nor `hidden`
+ * (registered later) keep their default place.
+ */
+export type MainToolbarSettings = {
+ left?: string[],
+ right?: string[],
+ /** Widgets the user removed. */
+ hidden?: string[],
+};
+
export type Markup = {
/** `markdown` or `plaintext`. */
kind: string,
@@ -2864,6 +3231,8 @@ export type MenuConfig = {
labels: { [key in string]: string },
/** Action id → display shortcut from the JS keymap, e.g. `⇧⌘O`. */
shortcuts: { [key in string]: string },
+ /** [`Entry::Dynamic`] slot → its items, already localised. */
+ dynamic?: { [key in string]: DynamicItem[] },
};
/**
@@ -2876,6 +3245,16 @@ export type MenuNode = { kind: "submenu"; id: string; label: string; children: M
/** A disabled placeholder such as "No Recent Projects". */
{ kind: "placeholder"; id: string; label: string } | { kind: "separator" };
+/** Merge dialog › Modify options (shared by the Pull dialog). */
+export type MergeOptions = {
+ noFf?: boolean,
+ ffOnly?: boolean,
+ squash?: boolean,
+ noCommit?: boolean,
+ /** `-m`: message of the merge commit (Merge dialog only). */
+ message?: string | null,
+};
+
/**
* Who stands on each side of the conflicts of the operation in progress (merge editor
* titles, as IDEA labels them).
@@ -2996,6 +3375,8 @@ export type OutlineItem = {
/** The identifier itself; where navigation lands. */
selection_range: Range,
children: OutlineItem[],
+ /** Unknown (`None`) for language-server symbols and languages without the notion. */
+ visibility?: Visibility | null,
};
export type OutputChunk = { kind: "stdout"; text: string } | { kind: "stderr"; text: string } |
@@ -3317,6 +3698,10 @@ export type ProjectStructureSettings = {
excluded?: string[],
/** Auto-detected roots (from `pom.xml`, `build.gradle`, `Cargo.toml`, …) the user unmarked. */
unmarked?: string[],
+ /** Content roots besides the project folder (absolute paths), shown and searched with it. */
+ contentRoots?: string[],
+ /** "Exclude files": `;`-separated name patterns (`*.log;tmp*`) excluded at any depth. */
+ excludeFiles?: string,
};
export type PruneTarget = "containers" |
@@ -3410,6 +3795,14 @@ export type RebaseEntry = {
message?: string | null,
};
+/** Rebase dialog options. */
+export type RebaseOptions = {
+ /** `--onto <newbase>`: replay `upstream..HEAD` onto this revision instead. */
+ onto?: string | null,
+ rebaseMerges?: boolean,
+ keepEmpty?: boolean,
+};
+
export type RecentProject = {
path: IpcPath,
name: string,
@@ -3418,6 +3811,17 @@ export type RecentProject = {
branch: string | null,
};
+export type Remote = {
+ name: string,
+ /** Fetch URL. */
+ url: string,
+};
+
+/** Manage Remotes edits. */
+export type RemoteEdit = { op: "add"; name: string; url: string } | { op: "remove"; name: string } |
+/** Renames `name` to `new_name` (when different) and sets its URL. */
+{ op: "edit"; name: string; new_name: string; url: string };
+
export type RemoteOp = { op: "fetch" } | { op: "pull"; rebase: boolean } | { op: "push"; force_with_lease: boolean; set_upstream: boolean;
/** Push dialog › Push tags. */
tags?: PushTags | null } |
@@ -3429,7 +3833,9 @@ tags?: PushTags | null } |
*/
{ op: "pushBranch"; branch: string; revision: string | null; force_with_lease: boolean; target?: string | null } |
/** Fast-forwards local `branch` (not checked out) to its upstream. */
-{ op: "updateBranch"; branch: string };
+{ op: "updateBranch"; branch: string } |
+/** Pull dialog: `branches` of `remote` (none = the configured merge branch). */
+{ op: "pullFrom"; remote: string; branches: string[]; rebase: boolean; options: MergeOptions };
export type ReplaceEvent =
/** A file was changed (`replacements` > 0) or had nothing left to replace. */
@@ -3492,7 +3898,7 @@ export type RunConfig_Deserialize = {
debugAdapter: string | null,
/** "Allow multiple instances": Run on a running config starts another one instead of restarting it. */
allowParallel?: boolean,
-};
+} & RunExtras_Deserialize;
export type RunConfig_Serialize = {
/** Stable id, e.g. `npm:dev`, `cargo:run:app`, or a uuid for user-defined. */
@@ -3512,6 +3918,78 @@ export type RunConfig_Serialize = {
debugAdapter: string | null,
/** "Allow multiple instances": Run on a running config starts another one instead of restarting it. */
allowParallel?: boolean,
+} & RunExtras_Serialize;
+
+export type RunExtras = RunExtras_Serialize | RunExtras_Deserialize;
+
+export type RunExtras_Deserialize = {
+ /** Values of the configuration type's own form fields (the command line derives from them). */
+ params?: { [key in string]: string },
+ /** Folder in the Run/Debug Configurations tree. */
+ folder?: string | null,
+ /** Stored in the workspace (`.openidea/run.local.toml`, not shared) instead of `run.toml`. */
+ local?: boolean,
+ /** Off: the process gets only the configured variables. */
+ includeSystemEnv?: boolean,
+ /** `.env` files (relative to the project root) loaded before `env`, in order. */
+ envFiles?: string[],
+ /** "Redirect input from": the process reads this file as stdin. */
+ stdinFile?: string | null,
+ /** "Save console output to file" (overwritten on each run). */
+ outputFile?: string | null,
+ beforeLaunch?: BeforeLaunchTask[],
+ /** Compound configurations: ids of the configurations started together. */
+ compound?: string[],
+ showOnStdout?: boolean,
+ showOnStderr?: boolean,
+ /** Overrides Settings › Run › "Show the Run tool window when a process starts". */
+ openToolWindow?: boolean | null,
+ focusToolWindow?: boolean,
+ /**
+ * "Emulate terminal in output console": the process runs on a pseudo-terminal
+ * (colours, line editing, full-screen programs); the console renders it as a terminal.
+ */
+ emulateTerminal?: boolean,
+ /**
+ * Shell command line run on Stop before the process is signalled (e.g. `docker stop <name>`),
+ * with the run's working directory and environment.
+ */
+ stopCommand?: string | null,
+};
+
+export type RunExtras_Serialize = {
+ /** Values of the configuration type's own form fields (the command line derives from them). */
+ params?: { [key in string]: string },
+ /** Folder in the Run/Debug Configurations tree. */
+ folder?: string | null,
+ /** Stored in the workspace (`.openidea/run.local.toml`, not shared) instead of `run.toml`. */
+ local?: boolean,
+ /** Off: the process gets only the configured variables. */
+ includeSystemEnv?: boolean,
+ /** `.env` files (relative to the project root) loaded before `env`, in order. */
+ envFiles?: string[],
+ /** "Redirect input from": the process reads this file as stdin. */
+ stdinFile?: string | null,
+ /** "Save console output to file" (overwritten on each run). */
+ outputFile?: string | null,
+ beforeLaunch?: BeforeLaunchTask[],
+ /** Compound configurations: ids of the configurations started together. */
+ compound?: string[],
+ showOnStdout?: boolean,
+ showOnStderr?: boolean,
+ /** Overrides Settings › Run › "Show the Run tool window when a process starts". */
+ openToolWindow?: boolean | null,
+ focusToolWindow?: boolean,
+ /**
+ * "Emulate terminal in output console": the process runs on a pseudo-terminal
+ * (colours, line editing, full-screen programs); the console renders it as a terminal.
+ */
+ emulateTerminal?: boolean,
+ /**
+ * Shell command line run on Stop before the process is signalled (e.g. `docker stop <name>`),
+ * with the run's working directory and environment.
+ */
+ stopCommand?: string | null,
};
/** A process started from a run configuration. */
@@ -3523,6 +4001,8 @@ export type RunInfo = {
name: string,
pid: number | null,
running: boolean,
+ /** Runs on a pseudo-terminal: output is raw terminal data, input goes in keystroke by keystroke. */
+ pty: boolean,
};
/** Run/Debug configuration behaviour. */
@@ -3615,7 +4095,12 @@ export type SearchScope = { kind: "project" } | { kind: "directory"; path: IpcPa
* IDEA's named scopes over the project's roots ("Project Production Files" …).
* Walks the project like `Project`; the caller passes the matching [`PathFilter`].
*/
-{ kind: "fileSet"; set: ProjectFileSet };
+{ kind: "fileSet"; set: ProjectFileSet } |
+/**
+ * A custom scope: the project's files matching a [`ScopePattern`]
+ * (`file:src//*.ts&&!file:*test*`).
+ */
+{ kind: "pattern"; pattern: string };
export type SearchSummary = {
files: number,
@@ -3671,6 +4156,22 @@ export type SessionInfo = {
export type Settings = Settings_Serialize | Settings_Deserialize;
+export type SettingsImport = SettingsImport_Serialize | SettingsImport_Deserialize;
+
+export type SettingsImport_Deserialize = {
+ /** Effective settings of the calling window after the import. */
+ settings: Settings_Deserialize,
+ /** IDE state the frontend keeps (written back to its storage). */
+ storage: { [key in string]: string },
+};
+
+export type SettingsImport_Serialize = {
+ /** Effective settings of the calling window after the import. */
+ settings: Settings_Serialize,
+ /** IDE state the frontend keeps (written back to its storage). */
+ storage: { [key in string]: string },
+};
+
export type SettingsScope = "global" | "project";
export type Settings_Deserialize = {
@@ -3709,6 +4210,10 @@ export type Settings_Deserialize = {
* command the language definition launches (`elixir-ls`, `codelldb`).
*/
tools?: { [key in string]: ToolSettings },
+ /** Editor › Inspections profiles. */
+ inspections?: InspectionSettings,
+ /** Editor › Natural Languages › Spelling. */
+ spelling?: SpellingSettings,
};
export type Settings_Serialize = {
@@ -3747,6 +4252,10 @@ export type Settings_Serialize = {
* command the language definition launches (`elixir-ls`, `codelldb`).
*/
tools: { [key in string]: ToolSettings },
+ /** Editor › Inspections profiles. */
+ inspections: InspectionSettings,
+ /** Editor › Natural Languages › Spelling. */
+ spelling: SpellingSettings,
};
export type Severity = "error" | "warning" | "info" | "hint";
@@ -3804,6 +4313,16 @@ export type SourceFolder = {
detectedFrom: string | null,
};
+/** Editor › Natural Languages › Spelling. */
+export type SpellingSettings = {
+ /** Application-level dictionary: accepted words (IDE settings). */
+ ideWords?: string[],
+ /** Project-level dictionary: accepted words (project settings). */
+ projectWords?: string[],
+ /** Custom dictionaries: plain word lists or Hunspell `.dic` files. */
+ customDictionaries?: string[],
+};
+
export type SqlStatement = {
/** UTF-16 offsets of the statement text (whitespace trimmed, `;` excluded). */
from: number,
@@ -4188,6 +4707,13 @@ export type TypeScriptSettings = {
version?: string,
};
+/** A misspelt word. */
+export type Typo = {
+ /** UTF-16 range of the word. */
+ range: Range,
+ word: string,
+};
+
/** What [`FileMoves::undo`] did. */
export type UndoOutcome = {
/** Moves reverted (each `from` is the original location again). */
@@ -4262,6 +4788,11 @@ export type VirtualDocument = {
decompiled: boolean,
};
+/** Declared (or conventional) visibility of an outline symbol. */
+export type Visibility = "public" | "protected" |
+/** Package / module / assembly scope (Java default, `internal`, `pub(crate)`, Go unexported). */
+"package" | "private";
+
/**
* A web reference no language server resolves and where it points: `class="card"` →
* `.card` selectors, `id` → `#id` selectors, `href="#top"` → the element, `var(--x)` →
@@ -4301,6 +4832,18 @@ export type WorkspaceSymbol = {
location: Location,
};
+export type Worktree = {
+ path: IpcPath,
+ /** Checked-out commit; `None` for a bare main repository. */
+ head: string | null,
+ /** Short branch name; `None` when HEAD is detached. */
+ branch: string | null,
+ /** The main working tree (cannot be removed). */
+ main: boolean,
+ locked: boolean,
+ prunable: boolean,
+};
+
/* Tauri Specta runtime */
async function typedError<T, E>(result: Promise<T>): Promise<{ status: "ok"; data: T } | { status: "error"; error: E }> {
try {
diff --git a/src/editor/api.ts b/src/editor/api.ts
index 67bdbb2ef..477396d78 100644
--- a/src/editor/api.ts
+++ b/src/editor/api.ts
@@ -391,6 +391,28 @@ export function _provideOpenEditorPaths(provider: () => string[]) {
openPathsProvider = provider;
}
+// --- library sources -----------------------------------------------------------------
+
+const libraryRoots = new Map<string, readonly string[]>();
+
+/**
+ * Folders of library / SDK sources ("External Libraries") contributed by `owner`;
+ * files below them open read-only, like IDEA's library sources. Replaces the
+ * owner's previous roots; returns a disposer.
+ */
+export function setLibraryRoots(owner: string, roots: readonly string[]): () => void {
+ libraryRoots.set(owner, roots);
+ return () => {
+ if (libraryRoots.get(owner) === roots) libraryRoots.delete(owner);
+ };
+}
+
+export function isLibraryPath(path: string): boolean {
+ for (const roots of libraryRoots.values())
+ for (const r of roots) if (path === r || path.startsWith(r.endsWith("/") ? r : `${r}/`)) return true;
+ return false;
+}
+
// --- documents shown outside editor tabs ---------------------------------------
/**
diff --git a/src/editor/core/actions.ts b/src/editor/core/actions.ts
index 29d118456..f03ac4f82 100644
--- a/src/editor/core/actions.ts
+++ b/src/editor/core/actions.ts
@@ -36,7 +36,9 @@ import { cyclicExpandWord } from "./wordCompletion";
import { qualifiedReference } from "./copyReference";
import { symbolChain } from "./view/outline";
import { recordClipboard } from "./clipboardHistory";
-import { useOutline } from "./model/document";
+import { useDocMeta, useOutline } from "./model/document";
+import { fontZoom, setFontZoom } from "./cm/prefs";
+import { useEditorRegistry } from "@/editor/api";
import { useProject } from "@/platform/project";
import { toggleReadOnly } from "./fileAttributes";
import { openNavBarPopup } from "./view/NavBarPopup";
@@ -410,6 +412,32 @@ export function registerEditorActions(): () => void {
return ctrl.reloadFromDisk(paths.length ? paths : active ? [active] : []);
},
},
+ {
+ // IDEA's Synchronize: open documents without unsaved changes, the project tree and VCS status.
+ id: "file.reloadAllFromDisk",
+ title: "Reload All from Disk",
+ category: "File",
+ icon: "refresh",
+ when: "projectOpen",
+ keywords: ["synchronize", "refresh"],
+ run: async () => {
+ const meta = useDocMeta.getState();
+ await ctrl.reloadFromDisk(ctrl.openPaths().filter((p) => !meta[p]?.dirty));
+ void executeAction("project.refresh");
+ void executeAction("vcs.refresh");
+ },
+ },
+ {
+ id: "editor.resetFontSize",
+ title: "Reset Font Size in All Editors",
+ category: "View",
+ keywords: ["zoom", "font size", "mouse wheel"],
+ when: "projectOpen",
+ run: () => {
+ for (const ed of useEditorRegistry.getState().editors)
+ if (ed.view.state.field(fontZoom, false)) ed.view.dispatch({ effects: setFontZoom.of(0) });
+ },
+ },
{
id: "file.toggleReadOnly",
title: "Toggle Read-only Attribute",
diff --git a/src/editor/core/backend.ts b/src/editor/core/backend.ts
index e075ec6e9..6ac951d5a 100644
--- a/src/editor/core/backend.ts
+++ b/src/editor/core/backend.ts
@@ -52,6 +52,8 @@ export interface DocBackend {
onDirty(handler: (e: { doc: DocId; dirty: boolean }) => void): () => void;
/** Files changed on disk (used to refresh nothing but closed-file state). */
onFsChanged?(handler: (e: { removed: string[] }) => void): () => void;
+ /** An open document's language changed (Settings › File Types, Override File Type). */
+ onLanguage?(handler: (e: { doc: DocId; language: string }) => void): () => void;
}
export const ipcBackend: DocBackend = {
@@ -71,6 +73,7 @@ export const ipcBackend: DocBackend = {
onPatched: (h) => onIdeEvent("docPatched", (e) => h(e)),
onDirty: (h) => onIdeEvent("docDirty", (e) => h(e)),
onFsChanged: (h) => onIdeEvent("fsChanged", (e) => h(e)),
+ onLanguage: (h) => onIdeEvent("docLanguage", (e) => h(e)),
};
// ---------------------------------------------------------------------------
diff --git a/src/editor/core/cm/codeLens.ts b/src/editor/core/cm/codeLens.ts
index b5dfe064c..d417c5ec7 100644
--- a/src/editor/core/cm/codeLens.ts
+++ b/src/editor/core/cm/codeLens.ts
@@ -55,6 +55,7 @@ export function indentColumns(text: string, tabSize: number): number {
const ICONS: Record<string, string> = {
run: "M4 3l9 5-9 5z",
+ user: "M8 2a3 3 0 110 6 3 3 0 010-6zM2.5 14c0-3 2.5-5 5.5-5s5.5 2 5.5 5z",
debug: "M8 2a3 3 0 013 3v1h1v2h-1v1h1v2h-1a3 3 0 01-6 0H4V9h1V8H4V6h1V5a3 3 0 013-3z",
};
diff --git a/src/editor/core/cm/find.test.ts b/src/editor/core/cm/find.test.ts
index 94cd53d5b..6fa3c52f7 100644
--- a/src/editor/core/cm/find.test.ts
+++ b/src/editor/core/cm/find.test.ts
@@ -2,8 +2,14 @@ import { afterEach, describe, expect, it } from "vitest";
import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { setSearchQuery } from "@codemirror/search";
+import { StreamLanguage } from "@codemirror/language";
+import { literalKindAt } from "./literals";
import {
countMatches,
+ excludeCurrent,
+ findExcluded,
+ isExcluded,
+ toggleFindExcluded,
findExtension,
findNext,
findPrevious,
@@ -84,3 +90,70 @@ describe("find in selection", () => {
expect(mapScope({ from: 2, to: 5 }, s.changes({ from: 2, to: 5 }))).toBeNull();
});
});
+
+describe("search context, exclude and preserve case", () => {
+ const lang = StreamLanguage.define<null>({
+ token(stream) {
+ if (stream.match("//")) {
+ stream.skipToEnd();
+ return "comment";
+ }
+ if (stream.match(/^"[^"]*"/)) return "string";
+ stream.next();
+ return null;
+ },
+ });
+ const code = 'foo("foo") // foo\nfoo';
+ const base = { search: "", caseSensitive: false, wholeWord: false, regexp: false, replace: "" };
+ function makeCode(o: Partial<FindOptions>) {
+ const view = new EditorView({
+ state: EditorState.create({ doc: code, extensions: [lang, findExtension()] }),
+ parent: document.body,
+ });
+ views.push(view);
+ view.dispatch({ effects: setSearchQuery.of(makeQuery({ ...base, search: "foo", ...o })) });
+ return view;
+ }
+ const starts = (v: EditorView) => countMatches(v.state).starts;
+
+ it("filters matches by comment / string literal", () => {
+ expect(starts(makeCode({}))).toEqual([0, 5, 14, 18]);
+ expect(starts(makeCode({ context: "inComments" }))).toEqual([14]);
+ expect(starts(makeCode({ context: "inStringLiterals" }))).toEqual([5]);
+ expect(starts(makeCode({ context: "exceptComments" }))).toEqual([0, 5, 18]);
+ expect(starts(makeCode({ context: "exceptCommentsAndStringLiterals" }))).toEqual([0, 18]);
+ expect(literalKindAt(makeCode({}).state, 14)).toBe("comment");
+ });
+
+ it("excluded matches are skipped by next and replace all, until the query changes", () => {
+ const v = makeCode({ replace: "bar" });
+ findNext(v);
+ expect(sel(v)).toEqual([0, 3]);
+ excludeCurrent(v);
+ expect(sel(v)).toEqual([5, 8]);
+ expect(isExcluded(v.state, 0, 3)).toBe(true);
+ expect(countMatches(v.state).total).toBe(3);
+ replaceAll(v, false);
+ expect(v.state.doc.toString()).toBe('foo("bar") // bar\nbar');
+ v.dispatch({ effects: setSearchQuery.of(makeQuery({ ...base, search: "o" })) });
+ expect(v.state.field(findExcluded)).toEqual([]);
+ });
+
+ it("excluding an excluded match includes it again", () => {
+ const v = makeCode({});
+ v.dispatch({ effects: toggleFindExcluded.of({ from: 0, to: 3 }), selection: { anchor: 0, head: 3 } });
+ excludeCurrent(v);
+ expect(isExcluded(v.state, 0, 3)).toBe(false);
+ });
+
+ it("preserve case keeps each occurrence's case", () => {
+ const v = make("foo Foo FOO", { search: "foo", replace: "bar" });
+ replaceAll(v, true);
+ expect(v.state.doc.toString()).toBe("bar Bar BAR");
+ const w = make("Foo foo", { search: "foo", replace: "bar" });
+ findNext(w);
+ replaceNext(w, true);
+ expect(w.state.doc.toString()).toBe("Bar foo");
+ expect(sel(w)).toEqual([4, 7]);
+ });
+});
diff --git a/src/editor/core/cm/find.ts b/src/editor/core/cm/find.ts
index 0d28b3b02..6c8aedded 100644
--- a/src/editor/core/cm/find.ts
+++ b/src/editor/core/cm/find.ts
@@ -3,7 +3,9 @@
* @codemirror/search's query + commands; the bar itself is a React component
* (view/FindBar.tsx). Highlighting is ours because CodeMirror only highlights
* while its own panel is open. Match positions found by the bar's counter are
- * kept in `findMarks` for the overview lane.
+ * kept in `findMarks` for the overview lane. The search context (comments /
+ * string literals) and excluded matches filter matches through the query's
+ * `test`, so CodeMirror's own commands honour them too.
*/
import { EditorSelection, Prec, StateEffect, StateField, type ChangeDesc, type EditorState, type Extension } from "@codemirror/state";
import { Decoration, EditorView, ViewPlugin, type DecorationSet, type ViewUpdate } from "@codemirror/view";
@@ -18,6 +20,8 @@ import {
setSearchQuery,
} from "@codemirror/search";
import { scrollbarMarks, type ScrollbarMark } from "@/editor/api";
+import { contextAccepts, preserveCase, type SearchContext } from "@/platform/search";
+import { literalKindAt, literalsExtension } from "./literals";
export const setFindOpen = StateEffect.define<boolean>();
export const setFindMarks = StateEffect.define<number[]>();
@@ -51,6 +55,46 @@ export const findScope = StateField.define<FindScope | null>({
provide: (f) => Prec.lowest(EditorView.decorations.from(f, (s) => (s ? Decoration.set([scopeDeco.range(s.from, s.to)]) : Decoration.none))),
});
+/** IDEA's Exclude: matches skipped by Next / Previous and Replace All until the query changes. */
+export const toggleFindExcluded = StateEffect.define<FindScope>();
+
+export const findExcluded = StateField.define<readonly FindScope[]>({
+ create: () => [],
+ update(v, tr) {
+ for (const e of tr.effects) {
+ if (e.is(setSearchQuery) || (e.is(setFindOpen) && !e.value)) v = [];
+ else if (e.is(toggleFindExcluded)) {
+ const { from, to } = e.value;
+ v = v.some((x) => x.from === from && x.to === to)
+ ? v.filter((x) => x.from !== from || x.to !== to)
+ : [...v, { from, to }];
+ }
+ }
+ if (!tr.docChanged || !v.length) return v;
+ return v
+ .map((x) => ({ from: tr.changes.mapPos(x.from, 1), to: tr.changes.mapPos(x.to, -1) }))
+ .filter((x) => x.to > x.from);
+ },
+});
+
+export function isExcluded(state: EditorState, from: number, to: number): boolean {
+ return (state.field(findExcluded, false) ?? []).some((x) => x.from === from && x.to === to);
+}
+
+type MatchTest = (match: string, state: EditorState, from: number, to: number) => boolean;
+const tests = new Map<SearchContext, MatchTest>();
+
+/** One stable test per context, so equal options give equal queries (`SearchQuery.eq`). */
+function testFor(context: SearchContext): MatchTest {
+ let test = tests.get(context);
+ if (!test) {
+ test = (_match, state, from, to) =>
+ !isExcluded(state, from, to) && (context === "any" || contextAccepts(context, literalKindAt(state, from)));
+ tests.set(context, test);
+ }
+ return test;
+}
+
function scopeOf(state: EditorState): FindScope {
return state.field(findScope, false) ?? { from: 0, to: state.doc.length };
}
@@ -82,6 +126,7 @@ export const findMarks = StateField.define<number[]>({
const matchDeco = Decoration.mark({ class: "cm-openidea-findMatch" });
const currentDeco = Decoration.mark({ class: "cm-openidea-findMatch cm-openidea-findMatch-current" });
+const excludedDeco = Decoration.mark({ class: "cm-openidea-findExcluded" });
const MAX_VISIBLE = 2000;
function buildHighlights(view: EditorView): DecorationSet {
@@ -104,6 +149,8 @@ function buildHighlights(view: EditorView): DecorationSet {
ranges.push((m.from === main.from && m.to === main.to ? currentDeco : matchDeco).range(m.from, m.to));
}
}
+ for (const x of state.field(findExcluded, false) ?? [])
+ if (x.from >= scope.from && x.to <= scope.to) ranges.push(excludedDeco.range(x.from, x.to));
return Decoration.set(ranges, true);
}
@@ -120,7 +167,8 @@ const findHighlighter = ViewPlugin.fromClass(
u.selectionSet ||
u.startState.field(findOpen, false) !== u.state.field(findOpen, false) ||
getSearchQuery(u.startState) !== getSearchQuery(u.state) ||
- u.startState.field(findScope, false) !== u.state.field(findScope, false)
+ u.startState.field(findScope, false) !== u.state.field(findScope, false) ||
+ u.startState.field(findExcluded, false) !== u.state.field(findExcluded, false)
)
this.decorations = buildHighlights(u.view);
}
@@ -136,7 +184,9 @@ export function findExtension(): Extension {
}),
findOpen,
findScope,
+ findExcluded,
findMarks,
+ literalsExtension,
findHighlighter,
];
}
@@ -147,6 +197,10 @@ export interface FindOptions {
wholeWord: boolean;
regexp: boolean;
replace: string;
+ /** IDEA's search scope filter: anywhere, only / except comments and string literals. */
+ context?: SearchContext;
+ /** Replace keeps the case of each occurrence. */
+ preserveCase?: boolean;
}
export function makeQuery(o: FindOptions) {
@@ -158,6 +212,7 @@ export function makeQuery(o: FindOptions) {
wholeWord: o.wholeWord,
regexp: o.regexp,
replace: o.replace,
+ test: testFor(o.context ?? "any"),
});
}
@@ -251,30 +306,56 @@ export function findPrevious(view: EditorView): boolean {
return view.state.field(findScope, false) ? step(view, false) : cmFindPrevious(view);
}
+/** The text replacing `m`, keeping its case when `preserve` is set. */
+function insertFor(state: EditorState, query: SearchQuery, m: Match, preserve: boolean): string {
+ const insert = replacementFor(query, m);
+ return preserve ? preserveCase(state.sliceDoc(m.from, m.to), insert) : insert;
+}
+
/** Replaces the selected match (if it is one) and selects the next match. */
-export function replaceNext(view: EditorView): boolean {
+export function replaceNext(view: EditorView, preserve = false): boolean {
const { state } = view;
- if (!state.field(findScope, false)) return cmReplaceNext(view);
+ if (!state.field(findScope, false) && !preserve) return cmReplaceNext(view);
if (state.readOnly) return false;
const query = getSearchQuery(state);
const ms = matchesIn(state);
const { from, to } = state.selection.main;
const cur = ms.find((m) => m.from === from && m.to === to);
if (!cur) return step(view, true);
- const insert = replacementFor(query, cur);
- view.dispatch({ changes: { from: cur.from, to: cur.to, insert }, selection: EditorSelection.cursor(cur.from + insert.length), userEvent: "input.replace" });
- const next = matchesIn(view.state).find((m) => m.from >= cur.from + insert.length);
+ const insert = insertFor(state, query, cur, preserve);
+ view.dispatch({
+ changes: { from: cur.from, to: cur.to, insert },
+ selection: EditorSelection.cursor(cur.from + insert.length),
+ userEvent: "input.replace",
+ });
+ const after = matchesIn(view.state);
+ const next = after.find((m) => m.from >= cur.from + insert.length) ?? after[0];
if (next) selectMatch(view, next);
return true;
}
-export function replaceAll(view: EditorView): boolean {
+export function replaceAll(view: EditorView, preserve = false): boolean {
const { state } = view;
- if (!state.field(findScope, false)) return cmReplaceAll(view);
+ if (!state.field(findScope, false) && !preserve) return cmReplaceAll(view);
if (state.readOnly) return false;
const query = getSearchQuery(state);
- const changes = matchesIn(state).map((m) => ({ from: m.from, to: m.to, insert: replacementFor(query, m) }));
+ const changes = matchesIn(state).map((m) => ({
+ from: m.from,
+ to: m.to,
+ insert: insertFor(state, query, m, preserve),
+ }));
if (!changes.length) return false;
view.dispatch({ changes, userEvent: "input.replace.all" });
return true;
}
+
+/** IDEA's Exclude: skips the selected match (or includes it again) and selects the next one. */
+export function excludeCurrent(view: EditorView): boolean {
+ const { from, to } = view.state.selection.main;
+ const excluded = isExcluded(view.state, from, to);
+ if (!excluded && (from === to || !matchesIn(view.state).some((m) => m.from === from && m.to === to)))
+ return step(view, true);
+ view.dispatch({ effects: toggleFindExcluded.of({ from, to }) });
+ if (!excluded) step(view, true);
+ return true;
+}
diff --git a/src/editor/core/cm/literals.ts b/src/editor/core/cm/literals.ts
new file mode 100644
index 000000000..303b74bc0
--- /dev/null
+++ b/src/editor/core/cm/literals.ts
@@ -0,0 +1,95 @@
+/**
+ * Comments and string literals of a document, for the find bar's search
+ * context ("In Comments", "Except String Literals" …): from the Lezer syntax
+ * tree, or from the backend's tree-sitter highlights for languages without a
+ * CodeMirror mode.
+ */
+import { StateField, type EditorState } from "@codemirror/state";
+import { ensureSyntaxTree, syntaxTree } from "@codemirror/language";
+import { highlightTree, tagHighlighter, tags as t } from "@lezer/highlight";
+import type { SyntaxHighlightKind } from "@/platform/ipc";
+import type { LiteralKind } from "@/platform/search";
+import { setSyntaxHighlights } from "./syntaxHighlight";
+
+/** Sorted, non-overlapping `[from, to)` ranges. */
+export interface LiteralRange {
+ from: number;
+ to: number;
+ kind: LiteralKind;
+}
+
+const KINDS: Partial<Record<SyntaxHighlightKind, LiteralKind>> = {
+ comment: "comment",
+ docComment: "comment",
+ string: "string",
+ stringSpecial: "string",
+ escape: "string",
+};
+
+/** Literal ranges of the tree-sitter highlights, mapped through edits until the next refresh. */
+const treeSitterLiterals = StateField.define<readonly LiteralRange[]>({
+ create: () => [],
+ update(v, tr) {
+ for (const e of tr.effects) {
+ if (!e.is(setSyntaxHighlights)) continue;
+ const { kinds, data } = e.value;
+ const out: LiteralRange[] = [];
+ for (let i = 0; i + 2 < data.length; i += 3) {
+ const kind = KINDS[kinds[data[i + 2]!]!];
+ if (kind) push(out, data[i]!, data[i + 1]!, kind);
+ }
+ return out;
+ }
+ if (!tr.docChanged || !v.length) return v;
+ return v
+ .map((r) => ({ from: tr.changes.mapPos(r.from, 1), to: tr.changes.mapPos(r.to, -1), kind: r.kind }))
+ .filter((r) => r.to > r.from);
+ },
+});
+
+export const literalsExtension = treeSitterLiterals;
+
+const highlighter = tagHighlighter([
+ { tag: t.comment, class: "comment" },
+ { tag: t.string, class: "string" },
+]);
+
+function push(out: LiteralRange[], from: number, to: number, kind: LiteralKind) {
+ const last = out[out.length - 1];
+ if (last && last.kind === kind && last.to >= from) last.to = Math.max(last.to, to);
+ else if (to > from) out.push({ from, to, kind });
+}
+
+const cache = new WeakMap<object, readonly LiteralRange[]>();
+/** How long counting may wait for the parser to reach the end of the document. */
+const PARSE_BUDGET_MS = 50;
+
+/** Comments and string literals of `state` (cached per syntax tree). */
+export function literalRanges(state: EditorState): readonly LiteralRange[] {
+ const tree = ensureSyntaxTree(state, state.doc.length, PARSE_BUDGET_MS) ?? syntaxTree(state);
+ if (tree.length === 0) return state.field(treeSitterLiterals, false) ?? [];
+ const hit = cache.get(tree);
+ if (hit) return hit;
+ const out: LiteralRange[] = [];
+ highlightTree(tree, highlighter, (from, to, cls) => {
+ const kind: LiteralKind | null = cls.includes("comment") ? "comment" : cls.includes("string") ? "string" : null;
+ if (kind) push(out, from, to, kind);
+ });
+ cache.set(tree, out);
+ return out;
+}
+
+/** What `pos` lies in: a comment, a string literal or plain code (`null`). */
+export function literalKindAt(state: EditorState, pos: number): LiteralKind | null {
+ const ranges = literalRanges(state);
+ let lo = 0;
+ let hi = ranges.length - 1;
+ while (lo <= hi) {
+ const mid = (lo + hi) >> 1;
+ const r = ranges[mid]!;
+ if (pos < r.from) hi = mid - 1;
+ else if (pos >= r.to) lo = mid + 1;
+ else return r.kind;
+ }
+ return null;
+}
diff --git a/src/editor/core/cm/theme.ts b/src/editor/core/cm/theme.ts
index 8e75a9d9c..57cfb92e3 100644
--- a/src/editor/core/cm/theme.ts
+++ b/src/editor/core/cm/theme.ts
@@ -176,6 +176,10 @@ export const openideaTheme = EditorView.theme({
backgroundColor: "var(--editor-search)",
borderRadius: "2px",
},
+ ".cm-openidea-findExcluded": {
+ textDecoration: "line-through",
+ textDecorationColor: "var(--fg-muted)",
+ },
".cm-openidea-findScope": {
backgroundColor: "var(--editor-selection-inactive)",
},
diff --git a/src/editor/core/controller.ts b/src/editor/core/controller.ts
index ea49d27bc..de03f1b54 100644
--- a/src/editor/core/controller.ts
+++ b/src/editor/core/controller.ts
@@ -7,7 +7,7 @@ import { EditorSelection } from "@codemirror/state";
import { create } from "zustand";
import { setContext } from "@/platform/context";
import { shortcutLabel } from "@/platform/keymap";
-import { useProject } from "@/platform/project";
+import { basename, useProject } from "@/platform/project";
import { editorPrefs } from "@/platform/editorSettings";
import {
_emitEditorEvent,
@@ -50,6 +50,7 @@ import {
removePane,
reopenClosed,
setActivePane,
+ sortTabs,
splitPane,
tabOptions,
togglePin,
@@ -130,6 +131,11 @@ export function openFilePaths(s: TabsState): string[] {
return out;
}
+/** Editor Tabs › Sort tabs alphabetically: by file name. */
+function tabSortKey(input: EditorInput): string {
+ return basename(input.path ?? input.key);
+}
+
function isTextTab(tab: Tab | null | undefined): tab is Tab & { input: { path: string } } {
return !!tab && isTextInput(tab.input);
}
@@ -776,6 +782,7 @@ export class EditorController implements SlotHost {
});
s = r.state;
tabId = r.tabId;
+ if (tabs.sortAlphabetically) s = sortTabs(s, paneId, (t) => tabSortKey(t.input));
s = enforceTabLimit(
s,
paneId,
diff --git a/src/editor/core/index.ts b/src/editor/core/index.ts
index 85dc34797..ac7433e29 100644
--- a/src/editor/core/index.ts
+++ b/src/editor/core/index.ts
@@ -6,15 +6,18 @@
import {
provideEditorArea,
provideEditorService,
+ registerEditorBanner,
registerOverlay,
registerStatusItem,
} from "@/workbench/contributions";
-import { _provideCodePreview, _provideDocumentAttacher } from "@/editor/api";
+import { _provideCodePreview, _provideDocumentAttacher, editorsFor } from "@/editor/api";
+import { formatDocument } from "@/editor/lsp/format";
import { editorController } from "./controller";
import { attachDocument } from "./model/attachment";
import { previewExtensions } from "./cm/preview";
import { registerEditorActions } from "./actions";
import { installColorScheme } from "./colorSchemeRuntime";
+import { documentBanner } from "./view/Banner";
import { EditorAreaView } from "./view/EditorArea";
import { GotoLineDialog } from "./view/GotoLineDialog";
import { NavBarPopup } from "./view/NavBarPopup";
@@ -41,6 +44,10 @@ export function activate(): void | (() => void) {
openPaths: () => ctrl.openPaths(),
closePath: (path) => ctrl.closePath(path),
closeInput: (key) => ctrl.closeInput(key),
+ reformat: async (path) => {
+ const handle = editorsFor(path)[0];
+ return !!handle && (await formatDocument(handle.view, { explicit: false, selectionOnly: false })).applied;
+ },
});
_provideDocumentAttacher((path) => attachDocument(ctrl.manager, path));
_provideCodePreview((path) => previewExtensions(path, ctrl.manager.settings()?.editor));
@@ -48,6 +55,7 @@ export function activate(): void | (() => void) {
installColorScheme(),
provideEditorArea(EditorAreaView),
registerEditorActions(),
+ registerEditorBanner(documentBanner),
registerOverlay({ id: "editor.gotoLine", component: GotoLineDialog }),
registerOverlay({ id: "editor.navigationBar", component: NavBarPopup }),
installClipboardTracking(),
diff --git a/src/editor/core/model/document.ts b/src/editor/core/model/document.ts
index 981289c97..af36f5e0f 100644
--- a/src/editor/core/model/document.ts
+++ b/src/editor/core/model/document.ts
@@ -11,6 +11,7 @@ import type { DocId, DocumentInfo, EditorSettings, FileSettings, LineEnding, Out
import {
_emitEditorEvent,
_saveParticipants,
+ isLibraryPath,
mirroredChange,
remoteChange,
useEditorRegistry,
@@ -44,7 +45,7 @@ import {
import { setMethodLines, softWrapActive } from "../cm/prefs";
import type { EditorSlot } from "./slot";
-export type Banner = "binary" | "tooLarge" | "readOnly" | null;
+export type Banner = "binary" | "tooLarge" | "readOnly" | "library" | null;
/** A view attached to a document outside the tab system (see `attachment.ts`). */
export interface DocAttachmentTarget {
@@ -73,7 +74,9 @@ export const useOutline = create<Record<string, OutlineItem[]>>(() => ({}));
const REFRESH_DELAY = 450;
function bannerFor(info: DocumentInfo): Banner {
// Virtual documents (library classes) get their own notice from the editor area.
- if (!info.readOnly || info.uri) return null;
+ if (info.uri) return null;
+ if (isLibraryPath(info.path)) return "library";
+ if (!info.readOnly) return null;
if (!info.text.length) return "binary";
// The backend makes files above its size limit read-only and flags them `large`.
if (info.large) return "tooLarge";
@@ -181,6 +184,8 @@ export class DocModel {
editorconfig: EditorConfigProps | null = null;
desc: LanguageDescription | null;
language: LanguageSupport | null;
+ /** Too large for language support (no CodeMirror language, backend highlighting only). */
+ private large: boolean;
lastFocused: EditorSlot | null = null;
/** Bumped by every change (local or remote). */
changeCounter = 0;
@@ -200,6 +205,7 @@ export class DocModel {
this.editorconfig = info.editorconfig ?? null;
// `large`: the backend skips LSP and syntax trees for it; heavy UI features follow.
const large = !!info.large || info.text.length > HEAVY_LIMIT;
+ this.large = large;
this.desc = large ? null : findLanguageDescription(this.info?.uiMode ?? null, info.path);
this.language = loadedSupport(this.desc);
this.meta = {
@@ -209,7 +215,8 @@ export class DocModel {
uiMode: this.info?.uiMode ?? this.desc?.name ?? null,
encoding: info.encoding,
lineEnding: info.lineEnding,
- readOnly: info.readOnly,
+ // Library sources (External Libraries) open read-only, like IDEA's.
+ readOnly: info.readOnly || (!this.virtual && isLibraryPath(info.path)),
dirty: info.dirty,
banner: bannerFor(info),
indent: { tabSize: 4, insertSpaces: true },
@@ -322,6 +329,23 @@ export class DocModel {
this.scheduleRefresh();
}
+ /** The backend detected another language (Settings › File Types, Override File Type). */
+ setLanguage(language: string) {
+ if (this.closed || language === this.meta.language) return;
+ this.info = languageInfo(language);
+ this.desc = this.large ? null : findLanguageDescription(this.info?.uiMode ?? null, this.path);
+ this.language = loadedSupport(this.desc);
+ this.highlights = null;
+ this.setMeta({ language, uiMode: this.info?.uiMode ?? this.desc?.name ?? null });
+ for (const s of this.slots) {
+ s.reconfigure([compartments.language.reconfigure(this.language ?? [])]);
+ s.syncContributions(true);
+ }
+ this.applySettings();
+ if (this.desc && !this.language) void this.loadLanguage();
+ this.scheduleRefresh(0);
+ }
+
async loadLanguage() {
if (!this.desc) return;
const support = await loadSupport(this.desc);
@@ -397,7 +421,7 @@ export class DocModel {
setReadOnly(readOnly: boolean) {
if (readOnly === this.meta.readOnly) return;
const banner = this.meta.banner;
- this.setMeta({ readOnly, banner: readOnly ? (banner ?? (this.virtual ? null : "readOnly")) : banner === "readOnly" ? null : banner });
+ this.setMeta({ readOnly, banner: readOnly ? (banner ?? (this.virtual ? null : "readOnly")) : banner === "readOnly" || banner === "library" ? null : banner });
for (const s of this.slots) {
s.reconfigure([
compartments.readOnly.reconfigure(readOnlyExtension(readOnly)),
@@ -570,6 +594,7 @@ export class DocumentManager {
start() {
this.disposers.push(
this.backend.onPatched((e) => this.byId.get(e.doc)?.sync.remote(e)),
+ this.backend.onLanguage?.((e) => this.byId.get(e.doc)?.setLanguage(e.language)) ?? (() => {}),
this.backend.onDirty((e) => {
const m = this.byId.get(e.doc);
if (m && m.getMeta().dirty !== e.dirty) {
diff --git a/src/editor/core/model/model.test.ts b/src/editor/core/model/model.test.ts
index 360d0dfea..b432a8eb3 100644
--- a/src/editor/core/model/model.test.ts
+++ b/src/editor/core/model/model.test.ts
@@ -15,6 +15,7 @@ import {
paneIds,
promoteTab,
reopenClosed,
+ sortTabs,
splitPane,
tabOptions,
togglePin,
@@ -181,6 +182,15 @@ describe("tab model", () => {
s = cycleTab(s, -1);
expect(active(s)).toBe("c");
});
+
+ it("sorts tabs alphabetically, pinned ones first", () => {
+ let s = initialTabsState();
+ for (const p of ["c", "B", "a", "d"]) s = open(s, p);
+ s = togglePin(s, s.activePane, s.panes[s.activePane]!.tabs.find((t) => t.input.path === "d")!.id);
+ s = sortTabs(s, s.activePane, (t) => t.input.path!);
+ expect(labels(s)).toEqual(["d^", "a", "B", "c"]);
+ expect(sortTabs(s, s.activePane, (t) => t.input.path!)).toBe(s);
+ });
});
describe("navigation history", () => {
diff --git a/src/editor/core/model/tabs.ts b/src/editor/core/model/tabs.ts
index 7a460c20b..5e6ef31fe 100644
--- a/src/editor/core/model/tabs.ts
+++ b/src/editor/core/model/tabs.ts
@@ -320,6 +320,15 @@ function rank(pane: Pane, tab: Tab): number {
return i < 0 ? Number.MAX_SAFE_INTEGER : i;
}
+/** Editor Tabs › Sort tabs alphabetically: orders the pinned and the other tabs of a pane by `title`. */
+export function sortTabs(s: TabsState, paneId: string, title: (t: Tab) => string): TabsState {
+ const pane = paneOf(s, paneId);
+ const byTitle = (a: Tab, b: Tab) =>
+ title(a).localeCompare(title(b), undefined, { sensitivity: "base" }) || title(a).localeCompare(title(b));
+ const tabs = [...pane.tabs.filter((t) => t.pinned).sort(byTitle), ...pane.tabs.filter((t) => !t.pinned).sort(byTitle)];
+ return tabs.every((t, i) => t === pane.tabs[i]) ? s : withPane(s, { ...pane, tabs });
+}
+
export function cycleTab(s: TabsState, delta: number, paneId = s.activePane): TabsState {
const pane = paneOf(s, paneId);
if (pane.tabs.length < 2) return s;
diff --git a/src/editor/core/view/Banner.tsx b/src/editor/core/view/Banner.tsx
index 334fb8bbd..daa147df3 100644
--- a/src/editor/core/view/Banner.tsx
+++ b/src/editor/core/view/Banner.tsx
@@ -1,4 +1,6 @@
-import { Icon } from "@/ui";
+import { useMemo } from "react";
+import { Icon, T } from "@/ui";
+import { useEditorBanners, type EditorBannerContribution } from "@/workbench/contributions";
import { useDocMeta } from "../model/document";
import styles from "./EditorArea.module.css";
@@ -6,19 +8,18 @@ const TEXT = {
binary: "This file appears to be binary and is shown read-only.",
tooLarge: "The file is too large: editing and code insight are disabled.",
readOnly: "The file is read-only.",
+ library: "Library source (read-only).",
} as const;
/** Notice above read-only / binary / too-large documents. */
-export function Banner({ path }: { path: string }) {
- const banner = useDocMeta((s) => s[path]?.banner ?? null);
- if (!banner) return null;
- return (
- <div className={styles.banner} role="status">
- <Icon name={banner === "readOnly" ? "lock" : "info"} size={14} className={styles.bannerIcon} />
- <span>{TEXT[banner]}</span>
- </div>
- );
-}
+export const documentBanner: EditorBannerContribution = {
+ id: "editor.document",
+ order: -10,
+ useBanner: (path) => {
+ const banner = useDocMeta((s) => s[path]?.banner ?? null);
+ return banner ? { text: TEXT[banner], icon: banner === "readOnly" || banner === "library" ? "lock" : "info" } : null;
+ },
+};
/**
* Notice above a library class opened from a language server (IDEA's
@@ -39,3 +40,38 @@ export function VirtualBanner({ decompiled, description }: { decompiled: boolean
</div>
);
}
+
+function ContributedBanner({ banner, path }: { banner: EditorBannerContribution; path: string }) {
+ const b = banner.useBanner(path);
+ if (!b) return null;
+ return (
+ <div className={`${styles.banner} ${b.level === "warning" ? styles.libraryBanner : ""}`} role="status">
+ <Icon name={b.icon ?? (b.level === "warning" ? "warning" : "info")} size={14} className={styles.bannerIcon} />
+ <span className={styles.bannerText}>
+ <T>{b.text}</T>
+ </span>
+ <span className={styles.bannerSpacer} />
+ {b.actions?.map((a) => (
+ <button key={a.label} type="button" className={styles.bannerLink} onClick={a.run}>
+ <T>{a.label}</T>
+ </button>
+ ))}
+ </div>
+ );
+}
+
+/** Banners features contribute for `path` (`registerEditorBanner`), in order. */
+export function EditorBanners({ path }: { path: string }) {
+ const map = useEditorBanners((s) => s.banners);
+ const banners = useMemo(
+ () => [...map.values()].sort((a, b) => (a.order ?? 100) - (b.order ?? 100) || a.id.localeCompare(b.id)),
+ [map],
+ );
+ return (
+ <>
+ {banners.map((b) => (
+ <ContributedBanner key={b.id} banner={b} path={path} />
+ ))}
+ </>
+ );
+}
diff --git a/src/editor/core/view/EditorArea.module.css b/src/editor/core/view/EditorArea.module.css
index 6c2c15098..3455430c5 100644
--- a/src/editor/core/view/EditorArea.module.css
+++ b/src/editor/core/view/EditorArea.module.css
@@ -217,19 +217,45 @@
.tabsHidden {
display: none;
}
-.tabsMultiRow {
- height: auto;
- min-height: var(--h-header);
+.tabRows {
+ flex: none;
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
}
-.tabsMultiRow > [role="tablist"] {
- flex: 1;
- flex-wrap: wrap;
- overflow: visible;
- row-gap: 2px;
- padding: 3px 0;
+.tabsBottom > .tabs,
+.tabsBottom > .tabRows {
+ order: 1;
+}
+.tabsBottom .tabs {
+ border-bottom: none;
+ border-top: 1px solid var(--border-editor-tabs, var(--border));
+}
+/* Tabs on the left / right of the editor (a column). */
+.tabsVertical {
+ flex-direction: row;
}
-.tabsMultiRow > [role="tablist"] > * {
- height: calc(var(--h-header) - 6px);
+.tabsVertical > .tabs,
+.tabsVertical > .tabRows {
+ width: max-content;
+ min-width: 140px;
+ max-width: 260px;
+ border-bottom: none;
+ border-right: 1px solid var(--border-editor-tabs, var(--border));
+}
+.tabsVertical .tabRows > .tabs {
+ min-height: 0;
+ border-bottom: none;
+}
+.tabsVertical .tabRows > .tabs + .tabs {
+ flex: 1 1 auto;
+ border-top: 1px solid var(--border-editor-tabs, var(--border));
+}
+.tabsRight > .tabs,
+.tabsRight > .tabRows {
+ order: 1;
+ border-right: none;
+ border-left: 1px solid var(--border-editor-tabs, var(--border));
}
/* Breadcrumbs inside the editor (top or bottom of the text) */
@@ -251,3 +277,18 @@
.codeCrumbsBottom {
border-top: 1px solid var(--border-editor-tabs, var(--border));
}
+
+/* Contributed editor banners (registerEditorBanner): text, then right-aligned links. */
+.bannerLink {
+ flex: none;
+ padding: 0;
+ border: 0;
+ background: none;
+ color: var(--link);
+ font: inherit;
+ cursor: pointer;
+}
+.bannerLink:hover {
+ color: var(--link-hover);
+ text-decoration: underline;
+}
diff --git a/src/editor/core/view/EditorArea.tsx b/src/editor/core/view/EditorArea.tsx
index a87773e54..f36f4645a 100644
--- a/src/editor/core/view/EditorArea.tsx
+++ b/src/editor/core/view/EditorArea.tsx
@@ -42,7 +42,7 @@ import type { LayoutNode, SplitEdge, Tab } from "../model/tabs";
import { disambiguateTitles } from "../model/tabTitles";
import { TextEditorHost } from "./TextEditorHost";
import { FindBar } from "./FindBar";
-import { Banner, VirtualBanner } from "./Banner";
+import { EditorBanners, VirtualBanner } from "./Banner";
import { CodeBreadcrumbs } from "./StatusItems";
import styles from "./EditorArea.module.css";
@@ -147,12 +147,13 @@ function PaneView({ paneId }: { paneId: string }) {
const paths = tabs.map((t) => t.input.path ?? "");
const dirty = useDocMeta(useShallow((s) => paths.map((p) => !!s[p]?.dirty)));
const colors = useFileDecorations(useShallow(() => paths.map((p) => (p ? (getFileDecoration(p)?.color ?? "") : ""))));
+ const tints = useFileDecorations(useShallow(() => paths.map((p) => (p ? (getFileDecoration(p)?.tint ?? "") : ""))));
const hints = useTitleHints();
const [dropZone, setDropZone] = useState<DropZone | null>(null);
const tabPrefs = useEditorPrefs().tabs;
const distractionFree = useDistractionFree((s) => s.active);
- const { showExtension, markModified, showCloseButton } = tabPrefs;
+ const { showExtension, markModified, showCloseButton, showFileIcon, showDirectoryForNonUnique, showFullPathOnHover } = tabPrefs;
const items: TabItem[] = useMemo(() => {
const names = tabs.map((t) => tabTitle(t.input, kinds));
@@ -160,8 +161,9 @@ function PaneView({ paneId }: { paneId: string }) {
const full = names[i]!;
const dot = full.lastIndexOf(".");
const name = t.input.kind === "file" && !showExtension && dot > 0 ? full.slice(0, dot) : full;
- const dupe =
- t.input.kind === "file" && t.input.path
+ const dupe = !showDirectoryForNonUnique
+ ? null
+ : t.input.kind === "file" && t.input.path
? (hints.get(t.input.path) ?? null)
: names.filter((n) => n === name).length > 1 && t.input.path
? basename(dirname(t.input.path))
@@ -175,28 +177,47 @@ function PaneView({ paneId }: { paneId: string }) {
</>
),
text: dupe ? `${name} — ${dupe}` : name,
- icon: tabIcon(t.input, kinds),
+ icon: showFileIcon ? tabIcon(t.input, kinds) : undefined,
italic: t.preview,
modified: dirty[i],
closable: showCloseButton,
color: colors[i] || undefined,
- tooltip: virtualTooltip(t.input) ?? t.input.path ?? name,
+ tint: tints[i] || undefined,
+ tooltip: virtualTooltip(t.input) ?? (showFullPathOnHover ? (t.input.path ?? name) : undefined),
trailing: t.pinned ? <Icon name="pin" size={11} className={styles.pin} label="Pinned" /> : undefined,
};
});
- }, [tabs, kinds, dirty, colors, hints, showExtension, markModified, showCloseButton]);
+ }, [
+ tabs,
+ kinds,
+ dirty,
+ colors,
+ tints,
+ hints,
+ showExtension,
+ markModified,
+ showCloseButton,
+ showFileIcon,
+ showDirectoryForNonUnique,
+ showFullPathOnHover,
+ ]);
- const dnd: TabsDnd = useMemo(
- () => ({
+ const pinnedCount = tabs.filter((t) => t.pinned).length;
+ // Settings › Editor Tabs › Tab placement Left / Right: a vertical, scrolling column.
+ const vertical = tabPrefs.placement === "left" || tabPrefs.placement === "right";
+ const pinnedRow =
+ tabPrefs.pinnedSeparateRow && (vertical || !tabPrefs.multipleRows) && pinnedCount > 0 && pinnedCount < tabs.length;
+ const dnd = useMemo(() => {
+ const strip = (offset: number): TabsDnd => ({
type: EDITOR_TAB_MIME,
payload: (tabId) => JSON.stringify({ paneId, tabId }),
onDrop: (raw, index) => {
const p = parseTabPayload(raw);
- if (p) ctrl.moveTab(p.paneId, p.tabId, paneId, index);
+ if (p) ctrl.moveTab(p.paneId, p.tabId, paneId, index + offset);
},
- }),
- [ctrl, paneId],
- );
+ });
+ return { all: strip(0), rest: strip(pinnedCount) };
+ }, [ctrl, paneId, pinnedCount]);
if (!pane) return null;
const active = pane.tabs.find((t) => t.id === pane.active) ?? null;
@@ -236,42 +257,65 @@ function PaneView({ paneId }: { paneId: string }) {
},
};
+ const hidden = tabPrefs.placement === "none" || distractionFree;
+ const strip = (stripItems: TabItem[], stripDnd: TabsDnd, trailing: ReactNode) => (
+ <Tabs
+ className={clsx(styles.tabs, !pinnedRow && hidden && styles.tabsHidden)}
+ variant="editor"
+ orientation={vertical ? "vertical" : "horizontal"}
+ aria-label="Editor tabs"
+ items={stripItems}
+ activeId={pane.active}
+ panelIdPrefix={`editor-${paneId}`}
+ dnd={stripDnd}
+ layout={tabPrefs.multipleRows ? "wrap" : tabPrefs.oneRowOverflow === "squeeze" ? "squeeze" : "scroll"}
+ closePosition={tabPrefs.closeButtonPosition === "left" ? "left" : "right"}
+ onSelect={(id) => ctrl.activate(paneId, id)}
+ onClose={(id) => ctrl.closeTab(paneId, id)}
+ onCloseOthers={(id) => ctrl.closeOthers(paneId, id)}
+ onDoubleClick={(id) => {
+ // IDEA: a preview tab becomes a regular one; any other tab maximizes the editor.
+ if (pane.tabs.find((t) => t.id === id)?.preview) ctrl.keepTab(paneId, id);
+ else void executeAction("toolwindow.hideAll");
+ }}
+ onContextMenu={(id, e) => {
+ const tab = pane.tabs.find((t) => t.id === id);
+ if (!tab) return;
+ e.preventDefault();
+ // Contributed groups (Run '…') may read a background tab's file first (bounded wait).
+ const at = { x: e.clientX, y: e.clientY };
+ const path = tab.input.kind === "file" ? tab.input.path : undefined;
+ if (!path) return showContextMenu(at, ctrl.tabMenu(paneId, tab));
+ void prepareMenuGroups("editorTab", { paths: [path] }).then(() => showContextMenu(at, ctrl.tabMenu(paneId, tab)));
+ }}
+ trailing={trailing}
+ />
+ );
+ const actions = active ? <EditorTabActions paneId={paneId} tab={active} /> : undefined;
+
return (
<section
- className={clsx(styles.pane, multiPane && !isActivePane && styles.inactivePane)}
+ className={clsx(
+ styles.pane,
+ multiPane && !isActivePane && styles.inactivePane,
+ tabPrefs.placement === "bottom" && styles.tabsBottom,
+ vertical && styles.tabsVertical,
+ tabPrefs.placement === "right" && styles.tabsRight,
+ )}
data-pane-id={paneId}
aria-label="Editor"
onFocus={onFocus}
onBlur={onBlur}
>
- <Tabs
- className={clsx(styles.tabs, (tabPrefs.placement === "none" || distractionFree) && styles.tabsHidden, tabPrefs.multipleRows && styles.tabsMultiRow)}
- variant="editor"
- aria-label="Editor tabs"
- items={items}
- activeId={pane.active}
- panelIdPrefix={`editor-${paneId}`}
- dnd={dnd}
- onSelect={(id) => ctrl.activate(paneId, id)}
- onClose={(id) => ctrl.closeTab(paneId, id)}
- onCloseOthers={(id) => ctrl.closeOthers(paneId, id)}
- onDoubleClick={(id) => {
- // IDEA: a preview tab becomes a regular one; any other tab maximizes the editor.
- if (pane.tabs.find((t) => t.id === id)?.preview) ctrl.keepTab(paneId, id);
- else void executeAction("toolwindow.hideAll");
- }}
- onContextMenu={(id, e) => {
- const tab = pane.tabs.find((t) => t.id === id);
- if (!tab) return;
- e.preventDefault();
- // Contributed groups (Run '…') may read a background tab's file first (bounded wait).
- const at = { x: e.clientX, y: e.clientY };
- const path = tab.input.kind === "file" ? tab.input.path : undefined;
- if (!path) return showContextMenu(at, ctrl.tabMenu(paneId, tab));
- void prepareMenuGroups("editorTab", { paths: [path] }).then(() => showContextMenu(at, ctrl.tabMenu(paneId, tab)));
- }}
- trailing={active ? <EditorTabActions paneId={paneId} tab={active} /> : undefined}
- />
+ {pinnedRow ? (
+ // Settings › Editor Tabs › Show pinned tabs in a separate row.
+ <div className={clsx(styles.tabRows, hidden && styles.tabsHidden)}>
+ {strip(items.slice(0, pinnedCount), dnd.all, vertical ? actions : undefined)}
+ {strip(items.slice(pinnedCount), dnd.rest, vertical ? undefined : actions)}
+ </div>
+ ) : (
+ strip(items, dnd.all, actions)
+ )}
<div
className={styles.content}
role="tabpanel"
@@ -303,7 +347,11 @@ function PaneContent({ paneId, tab }: { paneId: string; tab: Tab }) {
const host = <TextEditorHost key={tab.id} tabId={tab.id} />;
return (
<>
- {virtual ? <VirtualBanner decompiled={virtual.decompiled} description={virtual.description} /> : <Banner path={tab.input.path} />}
+ {virtual ? (
+ <VirtualBanner decompiled={virtual.decompiled} description={virtual.description} />
+ ) : (
+ <EditorBanners path={tab.input.path} />
+ )}
<FindBar paneId={paneId} />
{crumbs && <CodeBreadcrumbs path={tab.input.path!} tabId={tab.id} position="top" />}
{wrapper ? (
diff --git a/src/editor/core/view/FindBar.tsx b/src/editor/core/view/FindBar.tsx
index be0e0fa45..b8e35a5aa 100644
--- a/src/editor/core/view/FindBar.tsx
+++ b/src/editor/core/view/FindBar.tsx
@@ -1,20 +1,26 @@
/**
* IDEA-style Find / Replace bar at the top of the editor (⌘F / ⌘R): search
- * field with Match Case / Words / Regex toggles (⌥C / ⌥W / ⌥X), In Selection
- * (on by default when Replace opens over a multi-line selection), n/N counter,
- * ↑/↓ (⇧↵ / ↵), Replace / Replace All, Esc closes.
+ * field with Match Case / Words / Regex toggles (⌥C / ⌥W / ⌥X), New Line
+ * (⇧⌘↵, multi-line queries), recent searches (magnifier ▾ / ⌥↓), the filter
+ * menu (Search In Selection ⌥E — on by default when Replace opens over a
+ * multi-line selection — and the search scope: anywhere, in / except comments
+ * and string literals), n/N counter, ↑/↓ (⇧↵ / ↵), Replace / Replace All /
+ * Exclude with Preserve Case, Esc closes.
*/
-import { useEffect, useLayoutEffect, useRef, type KeyboardEvent } from "react";
+import { useEffect, useLayoutEffect, useRef, useState, type KeyboardEvent } from "react";
import { create } from "zustand";
import clsx from "clsx";
import type { EditorView } from "@codemirror/view";
-import { Button, IconButton, SearchField, T } from "@/ui";
+import { Button, IconButton, Menu, SearchField, T, type MenuItem } from "@/ui";
+import { SEARCH_CONTEXTS, rememberSearch, searchHistory } from "@/platform/search";
import { editorController, useFindBars, useTabs } from "../controller";
import {
countMatches,
+ excludeCurrent,
findNext,
findPrevious,
findScope,
+ isExcluded,
regexValid,
replaceAll,
replaceNext,
@@ -29,14 +35,23 @@ import styles from "./EditorArea.module.css";
import { hasPrimaryModifier } from "@/platform/keymap";
/** The query is shared by all panes and survives closing the bar, like IDEA. */
-export const useFindOptions = create<FindOptions>(() => ({
+export const useFindOptions = create<Required<FindOptions>>(() => ({
search: "",
caseSensitive: false,
wholeWord: false,
regexp: false,
replace: "",
+ context: "any",
+ preserveCase: false,
}));
-const useFindCounts = create<Record<string, { total: number; current: number; capped: boolean } | null>>(() => ({}));
+interface Counts {
+ total: number;
+ current: number;
+ capped: boolean;
+ /** The selection is an excluded match (Exclude reads "Include"). */
+ excluded: boolean;
+}
+const useFindCounts = create<Record<string, Counts | null>>(() => ({}));
/** Whether the bar of a pane is limited to a selection ("In Selection"). */
const useFindScoped = create<Record<string, boolean>>(() => ({}));
/** The selection the bar was opened over, for toggling "In Selection" on later. */
@@ -124,11 +139,18 @@ function recount(paneId: string) {
if (!view) return;
const opts = useFindOptions.getState();
const r = countMatches(view.state);
- useFindCounts.setState({ [paneId]: opts.search ? r : null });
+ const { from, to } = view.state.selection.main;
+ useFindCounts.setState({ [paneId]: opts.search ? { ...r, excluded: isExcluded(view.state, from, to) } : null });
useFindScoped.setState({ [paneId]: !!view.state.field(findScope, false) });
view.dispatch({ effects: setFindMarks.of(opts.search ? r.starts : []) });
}
+function rememberQuery(replace: boolean) {
+ const o = useFindOptions.getState();
+ rememberSearch("find", o.search);
+ if (replace) rememberSearch("replace", o.replace);
+}
+
export function FindBar({ paneId }: { paneId: string }) {
const bar = useFindBars((s) => s[paneId]);
if (!bar) return null;
@@ -142,6 +164,11 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
const scoped = useFindScoped((s) => !!s[paneId]);
const inputRef = useRef<HTMLInputElement>(null);
const replaceRef = useRef<HTMLInputElement>(null);
+ const findBoxRef = useRef<HTMLDivElement>(null);
+ const replaceBoxRef = useRef<HTMLDivElement>(null);
+ const filterRef = useRef<HTMLButtonElement>(null);
+ const [historyMenu, setHistoryMenu] = useState<"find" | "replace" | null>(null);
+ const [filterMenu, setFilterMenu] = useState(false);
const setOpts = (patch: Partial<FindOptions>) => useFindOptions.setState(patch);
// Opening (or ⌘F again): focus + select the field.
@@ -191,6 +218,7 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
);
const close = () => {
+ rememberQuery(replace);
closeFindBar(paneId);
activeView(paneId)?.focus();
};
@@ -199,21 +227,38 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
if (view) cmd(view);
recount(paneId);
};
- const toggle = (key: "caseSensitive" | "wholeWord" | "regexp") =>
+ const doReplace = () => {
+ rememberQuery(true);
+ run((v) => replaceNext(v, opts.preserveCase));
+ };
+ const doReplaceAll = () => {
+ rememberQuery(true);
+ run((v) => replaceAll(v, opts.preserveCase));
+ };
+ const toggle = (key: "caseSensitive" | "wholeWord" | "regexp" | "preserveCase") =>
useFindOptions.setState((o) => ({ [key]: !o[key] }));
const onKeyDown = (e: KeyboardEvent, field: "find" | "replace") => {
+ const target = e.target as HTMLTextAreaElement | HTMLInputElement;
+ // Inside a multi-line query the arrows move the caret between its lines.
+ const multiLine = target.value.includes("\n");
if (e.key === "Escape") {
e.preventDefault();
e.stopPropagation();
close();
- } else if (e.key === "Enter" || e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "F3") {
+ } else if (e.key === "ArrowDown" && e.altKey && !e.metaKey && !e.ctrlKey) {
+ e.preventDefault();
+ setHistoryMenu(field);
+ } else if (e.key === "Enter" || e.key === "F3" || (!multiLine && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
e.preventDefault();
const back = e.key === "ArrowUp" || (e.shiftKey && e.key !== "ArrowDown");
if (field === "replace" && e.key === "Enter" && !e.shiftKey) {
- if (hasPrimaryModifier(e)) run(replaceAll);
- else run(replaceNext);
- } else run(back ? findPrevious : findNext);
+ if (hasPrimaryModifier(e)) doReplaceAll();
+ else doReplace();
+ } else {
+ if (e.key === "Enter") rememberQuery(false);
+ run(back ? findPrevious : findNext);
+ }
} else if (e.altKey && !e.metaKey && !e.ctrlKey) {
const map: Record<string, "caseSensitive" | "wholeWord" | "regexp"> = {
KeyC: "caseSensitive",
@@ -227,6 +272,15 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
} else if (e.code === "KeyE") {
e.preventDefault();
toggleScope(paneId);
+ } else if (replace && e.code === "KeyP") {
+ e.preventDefault();
+ doReplace();
+ } else if (replace && e.code === "KeyA") {
+ e.preventDefault();
+ doReplaceAll();
+ } else if (replace && e.code === "KeyL") {
+ e.preventDefault();
+ run(excludeCurrent);
}
} else if (e.key === "Tab" && !e.shiftKey && field === "find" && replace) {
e.preventDefault();
@@ -244,52 +298,72 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
? "0 results"
: `${count.current || "?"}/${count.total}${count.capped ? "+" : ""}`;
+ const historyItems = (kind: "find" | "replace"): MenuItem[] => {
+ const h = searchHistory(kind);
+ return h.length
+ ? [
+ { kind: "header", label: kind === "find" ? "Recent Searches" : "Recent Replacements" },
+ ...h.map((q) => ({
+ label: q.replace(/\n/g, "⏎"),
+ verbatim: true,
+ run: () => setOpts(kind === "find" ? { search: q } : { replace: q }),
+ })),
+ ]
+ : [{ label: kind === "find" ? "No recent searches" : "No recent replacements", disabled: true }];
+ };
+ const filterItems: MenuItem[] = [
+ { label: "Search In Selection", shortcut: "⌥E", checked: scoped || undefined, run: () => toggleScope(paneId) },
+ { kind: "separator" },
+ { kind: "header", label: "Search Scope" },
+ ...SEARCH_CONTEXTS.map((c) => ({
+ label: c.label,
+ checked: c.value === opts.context ? true : undefined,
+ run: () => setOpts({ context: c.value }),
+ })),
+ ];
+ const canReplace = !!opts.search && !invalid;
+
return (
<div className={styles.find} role="search" aria-label={replace ? "Replace in file" : "Find in file"}>
- <SearchField
- ref={inputRef}
- className={styles.findField}
- value={opts.search}
- onChange={(search) => setOpts({ search })}
- placeholder="Find"
- aria-label="Find"
- invalid={invalid || none}
- onKeyDown={(e) => onKeyDown(e, "find")}
- toggles={[
- {
- id: "case",
- icon: "case",
- title: "Match Case",
- shortcut: "⌥C",
- pressed: opts.caseSensitive,
- onToggle: () => toggle("caseSensitive"),
- },
- {
- id: "word",
- icon: "word",
- title: "Words",
- shortcut: "⌥W",
- pressed: opts.wholeWord,
- onToggle: () => toggle("wholeWord"),
- },
- {
- id: "regex",
- icon: "regex",
- title: "Regex",
- shortcut: "⌥X",
- pressed: opts.regexp,
- onToggle: () => toggle("regexp"),
- },
- {
- id: "scope",
- icon: "filter",
- title: "In Selection",
- shortcut: "⌥E",
- pressed: scoped,
- onToggle: () => toggleScope(paneId),
- },
- ]}
- />
+ <div ref={findBoxRef} className={styles.findField}>
+ <SearchField
+ ref={inputRef}
+ value={opts.search}
+ onChange={(search) => setOpts({ search })}
+ placeholder="Find"
+ aria-label="Find"
+ invalid={invalid || none}
+ multiline
+ onHistory={() => setHistoryMenu("find")}
+ onKeyDown={(e) => onKeyDown(e, "find")}
+ toggles={[
+ {
+ id: "case",
+ icon: "case",
+ title: "Match Case",
+ shortcut: "⌥C",
+ pressed: opts.caseSensitive,
+ onToggle: () => toggle("caseSensitive"),
+ },
+ {
+ id: "word",
+ icon: "word",
+ title: "Words",
+ shortcut: "⌥W",
+ pressed: opts.wholeWord,
+ onToggle: () => toggle("wholeWord"),
+ },
+ {
+ id: "regex",
+ icon: "regex",
+ title: "Regex",
+ shortcut: "⌥X",
+ pressed: opts.regexp,
+ onToggle: () => toggle("regexp"),
+ },
+ ]}
+ />
+ </div>
<div className={styles.findButtons}>
<span className={clsx(styles.findCount, (none || invalid) && styles.findCountNone)} aria-live="polite">
{counter}
@@ -302,6 +376,14 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
onClick={() => run(findPrevious)}
/>
<IconButton icon="arrow-down" title="Next Occurrence" shortcut="↵" size="small" onClick={() => run(findNext)} />
+ <IconButton
+ ref={filterRef}
+ icon="filter"
+ title="Filter Search Results"
+ size="small"
+ pressed={scoped || opts.context !== "any"}
+ onClick={() => setFilterMenu(true)}
+ />
<IconButton
icon="replace"
title={replace ? "Hide Replace" : "Show Replace"}
@@ -313,26 +395,61 @@ function FindBarInner({ paneId, replace, seq }: { paneId: string; replace: boole
<IconButton icon="close" title="Close" shortcut="⎋" size="small" className={styles.findClose} onClick={close} />
{replace && (
<>
- <SearchField
- ref={replaceRef}
- className={styles.findField}
- value={opts.replace}
- onChange={(value) => setOpts({ replace: value })}
- placeholder="Replace"
- aria-label="Replace"
- leadingIcon="replace"
- onKeyDown={(e) => onKeyDown(e, "replace")}
- />
+ <div ref={replaceBoxRef} className={styles.findField}>
+ <SearchField
+ ref={replaceRef}
+ value={opts.replace}
+ onChange={(value) => setOpts({ replace: value })}
+ placeholder="Replace"
+ aria-label="Replace"
+ multiline
+ onHistory={() => setHistoryMenu("replace")}
+ onKeyDown={(e) => onKeyDown(e, "replace")}
+ toggles={[
+ {
+ id: "preserveCase",
+ icon: "preserve-case",
+ title: "Preserve Case",
+ pressed: opts.preserveCase,
+ onToggle: () => toggle("preserveCase"),
+ },
+ ]}
+ />
+ </div>
<div className={styles.replaceButtons}>
- <Button size="small" onClick={() => run(replaceNext)} disabled={!opts.search || invalid}>
+ <Button size="small" title="Replace (⌥P)" onClick={doReplace} disabled={!canReplace}>
<T>Replace</T>
</Button>
- <Button size="small" onClick={() => run(replaceAll)} disabled={!opts.search || invalid}>
+ <Button size="small" title="Replace All (⌥A)" onClick={doReplaceAll} disabled={!canReplace}>
<T>Replace All</T>
</Button>
+ <Button
+ size="small"
+ title={count?.excluded ? "Include (⌥L)" : "Exclude (⌥L)"}
+ onClick={() => run(excludeCurrent)}
+ disabled={!canReplace || (!count?.total && !count?.excluded)}
+ >
+ {count?.excluded ? <T>Include</T> : <T>Exclude</T>}
+ </Button>
</div>
</>
)}
+ <Menu
+ open={historyMenu !== null}
+ anchor={historyMenu === "replace" ? replaceBoxRef : findBoxRef}
+ items={historyMenu ? historyItems(historyMenu) : []}
+ placement="bottom-start"
+ aria-label="Recent searches"
+ onClose={() => setHistoryMenu(null)}
+ />
+ <Menu
+ open={filterMenu}
+ anchor={filterRef}
+ items={filterItems}
+ placement="bottom-end"
+ aria-label="Filter search results"
+ onClose={() => setFilterMenu(false)}
+ />
</div>
);
}
diff --git a/src/editor/core/view/banner.test.tsx b/src/editor/core/view/banner.test.tsx
new file mode 100644
index 000000000..f11109139
--- /dev/null
+++ b/src/editor/core/view/banner.test.tsx
@@ -0,0 +1,21 @@
+import { describe, expect, it } from "vitest";
+import { act, render, screen } from "@testing-library/react";
+import { registerEditorBanner } from "@/workbench/contributions";
+import { useDocMeta, type DocMeta } from "../model/document";
+import { documentBanner, EditorBanners } from "./Banner";
+
+describe("editor banners", () => {
+ it("shows the document notice through the banner extension point, before contributed ones", () => {
+ const off = [
+ registerEditorBanner(documentBanner),
+ registerEditorBanner({ id: "test.other", useBanner: () => ({ text: "Other notice" }) }),
+ ];
+ act(() => useDocMeta.setState({ "/p/a.bin": { banner: "binary" } as DocMeta }));
+ render(<EditorBanners path="/p/a.bin" />);
+ const notices = screen.getAllByRole("status").map((n) => n.textContent);
+ expect(notices).toEqual(["This file appears to be binary and is shown read-only.", "Other notice"]);
+ act(() => useDocMeta.setState({ "/p/a.bin": { banner: null } as DocMeta }));
+ expect(screen.getAllByRole("status").map((n) => n.textContent)).toEqual(["Other notice"]);
+ off.forEach((f) => f());
+ });
+});
diff --git a/src/editor/lsp/actions.ts b/src/editor/lsp/actions.ts
index 38cbadc41..3f84c521e 100644
--- a/src/editor/lsp/actions.ts
+++ b/src/editor/lsp/actions.ts
@@ -15,11 +15,38 @@ import { workflowSettings, type ActionsOnSaveValid } from "@/platform/workflowSe
import { startRename } from "./rename";
import { formatDocument, reformatDialog } from "./format";
import { showHint } from "./hint";
-import { refactorThis, runRefactoring, safeDelete } from "@/editor/refactor";
+import { refactorThis, runRefactoring, safeDelete, showNothingHere } from "@/editor/refactor";
+import { evaluateWhen } from "@/platform/context";
/** Editor actions apply to the active text editor unless a tool window or popup owns the keyboard. */
export const EDITOR_WHEN = "textEditorActive && (editorFocus || popupOpen || !toolWindowFocus)";
+/**
+ * Languages whose servers offer Generate (constructors, accessors, overrides…).
+ * Elsewhere the Generate shortcut (⌘N / Alt+Insert) yields to the New popup, as in IDEA.
+ */
+const GENERATE_LANGUAGES = [
+ "java",
+ "kotlin",
+ "scala",
+ "groovy",
+ "rust",
+ "go",
+ "typescript",
+ "typescriptreact",
+ "javascript",
+ "javascriptreact",
+ "c",
+ "cpp",
+ "objective-c",
+ "objective-cpp",
+ "csharp",
+ "swift",
+ "dart",
+ "php",
+];
+export const GENERATE_KEY_WHEN = GENERATE_LANGUAGES.map((id) => `editorLangId == ${id}`).join(" || ");
+
function withEditor(run: (view: EditorView) => unknown): Action["run"] {
return () => {
const ed = activeEditor();
@@ -59,6 +86,19 @@ const optimizeImports = (v: EditorView) =>
label: "Optimize Imports",
});
+interface CleanupOptions {
+ fixAll?: boolean;
+ optimizeImports?: boolean;
+ reformat?: boolean;
+}
+
+/** Code Cleanup of one document: the server's fix-all, organize imports, then reformat. */
+async function cleanup(view: EditorView, o: CleanupOptions) {
+ if (o.fixAll !== false) await applyKindSilently(view, "source.fixAll");
+ if (o.optimizeImports !== false) await applyKindSilently(view, "source.organizeImports");
+ if (o.reformat !== false) await formatDocument(view, { explicit: false });
+}
+
/** Code action titles of Implement Methods (⌃I) and Override Methods (⌃O). */
export const IMPLEMENT_TITLE = /\bimplement\b|\b(add|generate) (missing|unimplemented|all missing)\b|missing (members|methods|trait items)/i;
export const OVERRIDE_TITLE = /\boverride\b/i;
@@ -108,6 +148,9 @@ export function registerLspActions(): () => void {
keywords: ["javadoc", "docs", "hover"],
}),
editorAction("code.quickDefinition", "Quick Definition", "Code", quickDefinition),
+ editorAction("code.quickTypeDefinition", "Quick Type Definition", "View", (v) => quickDefinition(v, "typeDefinition"), {
+ keywords: ["type declaration", "preview"],
+ }),
editorAction("code.showIntentions", "Show Context Actions", "Code", showIntentions, {
keywords: ["intention", "quick fix", "lightbulb"],
}),
@@ -120,6 +163,18 @@ export function registerLspActions(): () => void {
editorAction("code.optimizeImports", "Optimize Imports", "Code", optimizeImports, { keywords: ["organize imports"] }),
// Project view / editor tab variants: `{ path }` of a file, opened first.
{ id: "code.reformatFile", title: "Reformat File", category: "Code", hidden: true, when: "projectOpen", run: inFile(reformat) },
+ {
+ id: "code.cleanupFile",
+ title: "Code Cleanup in File",
+ description: "Code Cleanup on `{ path, fixAll?, optimizeImports?, reformat? }` (all steps by default), opened first.",
+ category: "Code",
+ hidden: true,
+ when: "projectOpen",
+ run: (c) => {
+ const o = (c.arg ?? {}) as CleanupOptions;
+ return inFile((v) => cleanup(v, o))(c);
+ },
+ },
{
id: "code.optimizeImportsFile",
title: "Optimize Imports in File",
@@ -136,7 +191,18 @@ export function registerLspActions(): () => void {
editorAction("navigate.nextError", "Next Highlighted Error", "Navigate", (v) => gotoDiagnostic(v, 1)),
editorAction("navigate.prevError", "Previous Highlighted Error", "Navigate", (v) => gotoDiagnostic(v, -1)),
editorAction("find.highlightUsages", "Highlight Usages in File", "Find", highlightUsages),
- editorAction("refactor.thisMenu", "Refactor This…", "Refactor", (v) => refactorThis(v, startRename)),
+ {
+ // Also outside an editor, where nothing applies: IDEA's "Nothing here" popup.
+ id: "refactor.thisMenu",
+ title: "Refactor This…",
+ category: "Refactor",
+ when: "projectOpen",
+ run: ({ ctx }) => {
+ const ed = activeEditor();
+ if (ed && evaluateWhen(EDITOR_WHEN, ctx)) return refactorThis(ed.view, startRename);
+ showNothingHere();
+ },
+ },
editorAction("refactor.rename", "Rename…", "Refactor", startRename),
editorAction("refactor.extractVariable", "Introduce Variable…", "Refactor", (v) => runRefactoring(v, "extractVariable")),
editorAction("refactor.extractMethod", "Extract Method…", "Refactor", (v) => runRefactoring(v, "extractMethod")),
@@ -146,12 +212,17 @@ export function registerLspActions(): () => void {
editorAction("refactor.move", "Move…", "Refactor", (v) => runRefactoring(v, "move")),
editorAction("refactor.changeSignature", "Change Signature…", "Refactor", (v) => runRefactoring(v, "changeSignature")),
editorAction("refactor.safeDelete", "Safe Delete…", "Refactor", safeDelete),
- editorAction("code.generate", "Generate…", "Code", (v) =>
- runKindAction(v, "", {
- title: /^(generate|implement|override|add (missing|derive|impl|getter|setter|constructor)|create (constructor|getter|setter))/i,
- none: "Nothing to generate here",
- label: "Generate",
- }),
+ editorAction(
+ "code.generate",
+ "Generate…",
+ "Code",
+ (v) =>
+ runKindAction(v, "", {
+ title: /^(generate|implement|override|add (missing|derive|impl|getter|setter|constructor)|create (constructor|getter|setter))/i,
+ none: "Nothing to generate here",
+ label: "Generate",
+ }),
+ { keyWhen: GENERATE_KEY_WHEN },
),
editorAction("refactor.inline", "Inline…", "Refactor", (v) => runRefactoring(v, "inline")),
// Implement / Override Methods: the server's code actions for them (jdtls "Override/Implement
diff --git a/src/editor/lsp/authorLens.test.ts b/src/editor/lsp/authorLens.test.ts
new file mode 100644
index 000000000..c5b4c57ac
--- /dev/null
+++ b/src/editor/lsp/authorLens.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, it } from "vitest";
+import type { BlameLine } from "@/platform/ipc";
+import { authorLabel, authorSummary, authorTooltip } from "./authorLens";
+
+const line = (author: string, timeMs: number | null, commit = "a".repeat(40)): BlameLine => ({
+ commit,
+ author,
+ timeMs,
+ summary: "",
+});
+const UNCOMMITTED = "0".repeat(40);
+
+describe("code vision author", () => {
+ const blame = [
+ line("Ann", 100),
+ line("Thomas", 300),
+ line("Bob", 200),
+ line("Ann", 50),
+ line("Not Committed Yet", null, UNCOMMITTED),
+ line("Carol", 900),
+ ];
+
+ it("names the latest author of the range and counts the others", () => {
+ const s = authorSummary(blame, 0, 4)!;
+ expect(s.authors).toEqual(["Thomas", "Bob", "Ann"]);
+ expect(authorLabel(s)).toBe("Thomas +2");
+ expect(authorTooltip(s)).toBe("Last changed by Thomas; also Bob, Ann");
+ });
+
+ it("shows a single author without a count", () => {
+ const s = authorSummary(blame, 3, 3)!;
+ expect(authorLabel(s)).toBe("Ann");
+ expect(authorTooltip(s)).toBe("Last changed by Ann");
+ });
+
+ it("ignores uncommitted lines and lines past the blame", () => {
+ expect(authorSummary(blame, 4, 4)).toBeNull();
+ expect(authorLabel(authorSummary(blame, 4, 99)!)).toBe("Carol");
+ expect(authorSummary(blame, 10, 12)).toBeNull();
+ });
+});
diff --git a/src/editor/lsp/authorLens.ts b/src/editor/lsp/authorLens.ts
new file mode 100644
index 000000000..f35405258
--- /dev/null
+++ b/src/editor/lsp/authorLens.ts
@@ -0,0 +1,86 @@
+/**
+ * Code vision "author" hint beside the usages lens (IDEA's "Thomas +2"): the
+ * author of the latest commit touching a declaration's lines, plus how many
+ * other people changed them. Blame comes from `vcs_blame`, cached per file
+ * and document text; a VCS change (commit, checkout, …) drops the cache.
+ */
+import type { Text } from "@codemirror/state";
+import { call, commands, isTauri, onIdeEvent, type BlameLine } from "@/platform/ipc";
+
+export interface AuthorSummary {
+ author: string;
+ /** Other distinct authors of the range. */
+ others: number;
+ /** Every distinct author, latest change first. */
+ authors: string[];
+}
+
+const isUncommitted = (l: BlameLine) => /^0+$/.test(l.commit);
+
+/** Authors of 0-based lines `from..=to`; null when none of them is committed. */
+export function authorSummary(blame: readonly BlameLine[], from: number, to: number): AuthorSummary | null {
+ const latest = new Map<string, number>();
+ for (let i = Math.max(0, from); i <= to && i < blame.length; i++) {
+ const l = blame[i]!;
+ if (isUncommitted(l) || !l.author) continue;
+ const t = l.timeMs ?? 0;
+ if ((latest.get(l.author) ?? -Infinity) < t) latest.set(l.author, t);
+ }
+ if (!latest.size) return null;
+ const authors = [...latest.entries()].sort((a, b) => b[1] - a[1]).map(([a]) => a);
+ return { author: authors[0]!, others: authors.length - 1, authors };
+}
+
+export function authorLabel(s: AuthorSummary): string {
+ return s.others ? `${s.author} +${s.others}` : s.author;
+}
+
+export function authorTooltip(s: AuthorSummary): string {
+ return s.others ? `Last changed by ${s.author}; also ${s.authors.slice(1).join(", ")}` : `Last changed by ${s.author}`;
+}
+
+interface Entry {
+ text: Text | null;
+ lines: Promise<BlameLine[] | null>;
+}
+
+const cache = new Map<string, Entry>();
+const listeners = new Set<() => void>();
+let offVcs: (() => void) | null = null;
+
+/** Drops cached blame and tells editors to fetch it again (VCS changes). */
+export function clearBlameCache() {
+ cache.clear();
+ listeners.forEach((l) => l());
+}
+
+function watchVcs() {
+ if (!offVcs && isTauri()) offVcs = onIdeEvent("vcsChanged", clearBlameCache);
+}
+
+/** Called after a VCS change made cached blame stale; returns the unsubscribe function. */
+export function onBlameInvalidated(listener: () => void): () => void {
+ watchVcs();
+ listeners.add(listener);
+ return () => listeners.delete(listener);
+}
+
+/**
+ * Blame of `path` for the document `text`; null when the file isn't under
+ * version control (remembered until the next VCS change).
+ */
+export function blameFor(path: string, text: Text): Promise<BlameLine[] | null> {
+ watchVcs();
+ const hit = cache.get(path);
+ if (hit && (hit.text === text || hit.text === null)) return hit.lines;
+ const entry: Entry = { text, lines: Promise.resolve(null) };
+ entry.lines = call(commands.vcsBlame(path)).then(
+ (lines) => lines,
+ () => {
+ entry.text = null;
+ return null;
+ },
+ );
+ cache.set(path, entry);
+ return entry.lines;
+}
diff --git a/src/editor/lsp/codeLens.ts b/src/editor/lsp/codeLens.ts
index 70a33266a..66832e8fc 100644
--- a/src/editor/lsp/codeLens.ts
+++ b/src/editor/lsp/codeLens.ts
@@ -2,7 +2,8 @@
* "N usages" code lenses above declarations (IDEA's usages inlay). Cheap by
* construction: only declarations in (and near) the viewport are counted, one
* debounced pass after edits / scrolling, results cached per document text
- * and symbol, and at most a few reference requests in flight.
+ * and symbol, and at most a few reference requests in flight. Beside each
+ * count, the declaration's last author from VCS blame (`authorLens`).
*/
import { EditorSelection, MapMode, StateEffect, StateField, type Extension, type Text } from "@codemirror/state";
import { EditorView, ViewPlugin, type ViewUpdate } from "@codemirror/view";
@@ -14,6 +15,7 @@ import { debounce, docOf, isUnavailable, lspRequest } from "./lsp";
import { posToOffset } from "./positions";
import { onLspRefresh, serverBackoff } from "./availability";
import { editorPrefs } from "@/platform/editorSettings";
+import { authorLabel, authorSummary, authorTooltip, blameFor, onBlameInvalidated } from "./authorLens";
const LENS_KINDS = new Set<SymbolKind>([
"class",
@@ -38,6 +40,9 @@ export interface LensTarget {
/** 0-based line / UTF-16 col of the identifier. */
line: number;
col: number;
+ /** 0-based lines of the whole declaration. */
+ startLine: number;
+ endLine: number;
}
/** Servers name callbacks and anonymous functions (`<function>`, `map() callback`); they have no usages. */
@@ -48,7 +53,13 @@ export function lensTargets(items: readonly OutlineItem[]): LensTarget[] {
const out: LensTarget[] = [];
const walk = (list: readonly OutlineItem[]) => {
for (const it of list) {
- if (LENS_KINDS.has(it.kind) && !anonymous(it.name)) out.push({ name: it.name, line: it.selection_range.start.line, col: it.selection_range.start.col });
+ if (LENS_KINDS.has(it.kind) && !anonymous(it.name)) out.push({
+ name: it.name,
+ line: it.selection_range.start.line,
+ col: it.selection_range.start.col,
+ startLine: it.range.start.line,
+ endLine: it.range.end.line,
+ });
if (it.children.length) walk(it.children);
}
};
@@ -82,9 +93,8 @@ const lensField = StateField.define<CodeLens[]>({
provide: (f) => codeLenses.from(f),
});
-const enabled = () => {
- return editorPrefs().inlay.codeVisionUsages;
-};
+const usagesEnabled = () => editorPrefs().inlay.codeVisionUsages;
+const authorEnabled = () => editorPrefs().inlay.codeVisionAuthor;
function openUsages(view: EditorView, offset: number) {
view.dispatch({ selection: EditorSelection.cursor(offset), userEvent: "select.lens" });
@@ -101,6 +111,7 @@ class UsagesLensPlugin {
private generation = 0;
private unsubscribe: () => void;
private offReady: () => void;
+ private offBlame: () => void;
constructor(private view: EditorView) {
this.refresh();
@@ -112,6 +123,7 @@ class UsagesLensPlugin {
this.cache.clear();
this.refresh();
});
+ this.offBlame = onBlameInvalidated(() => this.refresh());
}
update(u: ViewUpdate) {
@@ -124,11 +136,15 @@ class UsagesLensPlugin {
const doc = docOf(view);
if (!doc) return;
const gen = ++this.generation;
- if (!enabled() || serverBackoff.active(doc.doc)) {
+ const usages = usagesEnabled() && !serverBackoff.active(doc.doc);
+ const authors = authorEnabled() && !doc.virtual;
+ if (!usages && !authors) {
if (view.state.field(lensField).length) view.dispatch({ effects: setLenses.of([]) });
return;
}
const text = view.state.doc;
+ // Blame runs beside the reference requests; it never holds up the counts.
+ const blame = authors ? blameFor(doc.path, text) : Promise.resolve(null);
if (this.cacheDoc !== text) {
this.cache = new Map();
this.cacheDoc = text;
@@ -144,7 +160,7 @@ class UsagesLensPlugin {
const lastLine = text.lineAt(to).number - 1 + MARGIN_LINES;
const visible = this.outline.targets.filter((t) => t.line >= firstLine && t.line <= lastLine).slice(0, MAX_PER_PASS);
const key = (t: LensTarget) => `${t.line}:${t.col}:${t.name}`;
- const todo = visible.filter((t) => !this.cache.has(key(t)));
+ const todo = usages ? visible.filter((t) => !this.cache.has(key(t))) : [];
let unavailable = false;
for (let i = 0; i < todo.length && !unavailable; i += CONCURRENCY) {
await Promise.all(
@@ -160,11 +176,15 @@ class UsagesLensPlugin {
if (gen !== this.generation || view.state.doc !== text) return;
}
if (unavailable) serverBackoff.mark(doc.doc);
+ const lines = await blame;
+ if (gen !== this.generation || view.state.doc !== text) return;
const lenses: CodeLens[] = [];
for (const t of visible) {
- const n = this.cache.get(key(t));
- if (n === undefined) continue;
const offset = posToOffset(text, { line: t.line, col: t.col });
+ const who = lines && authorSummary(lines, t.startLine, t.endLine);
+ if (who) lenses.push({ pos: offset, title: authorLabel(who), tooltip: authorTooltip(who), icon: "user", order: 20 });
+ const n = usages ? this.cache.get(key(t)) : undefined;
+ if (n === undefined) continue;
lenses.push({
pos: offset,
title: usagesLabel(n),
@@ -183,12 +203,16 @@ class UsagesLensPlugin {
this.refresh.cancel();
this.unsubscribe();
this.offReady();
+ this.offBlame();
this.generation++;
}
}
function sameLenses(a: readonly CodeLens[], b: readonly CodeLens[]) {
- return a.length === b.length && a.every((l, i) => l.pos === b[i]!.pos && l.title === b[i]!.title);
+ return (
+ a.length === b.length &&
+ a.every((l, i) => l.pos === b[i]!.pos && l.title === b[i]!.title && l.tooltip === b[i]!.tooltip)
+ );
}
export function usagesLensExtension(): Extension {
diff --git a/src/editor/lsp/completion.test.ts b/src/editor/lsp/completion.test.ts
index 0a92203ea..50698082f 100644
--- a/src/editor/lsp/completion.test.ts
+++ b/src/editor/lsp/completion.test.ts
@@ -3,8 +3,19 @@ import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import type { CompletionItem } from "@/bindings";
import { completionSymbolKind, identifierEnd, toCmCompletion, triggerCharacter } from "./completionItems";
-import { applyLspCompletion, commitsLookup, completionExtension, explicitCompletion, makeCompletion } from "./completion";
+import {
+ applyLspCompletion,
+ callParens,
+ commitsLookup,
+ completionExtension,
+ explicitCompletion,
+ makeCompletion,
+ matchRanges,
+ sortAlphabetically,
+} from "./completion";
import type { CompletionSource } from "@codemirror/autocomplete";
+import { useProject } from "@/platform/project";
+import type { Settings } from "@/platform/ipc";
function item(over: Partial<CompletionItem> = {}): CompletionItem {
return {
@@ -121,6 +132,7 @@ describe("applying completions", () => {
const { view, req } = setup("a.cr|Order.x");
const c = makeCompletion(
item({
+ kind: "field",
insertText: "create",
replaceRange: { start: { line: 0, col: 2 }, end: { line: 0, col: 4 } },
replaceRangeTab: { start: { line: 0, col: 2 }, end: { line: 0, col: 9 } },
@@ -145,6 +157,7 @@ describe("applying completions", () => {
const { view, req } = setup("\nfoo.ba|");
const c = makeCompletion(
item({
+ kind: "field",
insertText: "bar",
additionalEdits: [{ range: { start: { line: 0, col: 0 }, end: { line: 0, col: 0 } }, new_text: "import bar;" }],
}),
@@ -154,6 +167,20 @@ describe("applying completions", () => {
expect(view.state.doc.toString()).toBe("import bar;\nfoo.bar");
});
+ it("adds parentheses to a called function and opens its parameters", () => {
+ const { view, req } = setup("svc.cr|");
+ apply(view, makeCompletion(item({ insertText: "create", labelDetail: "(req: Req)" }), req), 4);
+ expect(view.state.doc.toString()).toBe("svc.create()");
+ expect(view.state.selection.main.head).toBe(11);
+ });
+
+ it("places the caret after the parentheses of a parameterless call", () => {
+ const { view, req } = setup("svc.cl|");
+ apply(view, makeCompletion(item({ insertText: "close", labelDetail: "()" }), req), 4);
+ expect(view.state.doc.toString()).toBe("svc.close()");
+ expect(view.state.selection.main.head).toBe(11);
+ });
+
it("expands snippets with fields", () => {
const { view, req } = setup("pri|");
apply(view, makeCompletion(item({ insertText: "println!(${1:arg})$0", isSnippet: true }), req), 0);
@@ -163,6 +190,39 @@ describe("applying completions", () => {
});
});
+describe("insert parentheses", () => {
+ const line = (text: string) => ({ from: 0, text });
+ it("applies to plain callables only", () => {
+ expect(callParens(item(), line("a.cr"), 2, 4)).toBe("inside");
+ expect(callParens(item({ kind: "field" }), line("a.cr"), 2, 4)).toBeNull();
+ expect(callParens(item({ isSnippet: true }), line("a.cr"), 2, 4)).toBeNull();
+ expect(callParens(item({ insertText: "create()" }), line("a.cr"), 2, 4)).toBeNull();
+ });
+
+ it("skips calls that already have parentheses and imports", () => {
+ expect(callParens(item(), line("a.cr(x)"), 2, 4)).toBeNull();
+ expect(callParens(item(), line("import { cr"), 9, 11)).toBeNull();
+ expect(callParens(item(), line("use crate::cr"), 11, 13)).toBeNull();
+ });
+});
+
+describe("sort suggestions alphabetically", () => {
+ const result = (labels: string[]) => ({ from: 0, options: labels.map((label) => ({ label })), validFor: /^\w*$/ });
+
+ it("filters and orders by name", () => {
+ const sorted = sortAlphabetically(result(["zeta", "Alpha", "beta", "gamma", "alphabet"]), "a");
+ expect(sorted.filter).toBe(false);
+ expect(sorted.options.map((o) => o.label)).toEqual(["Alpha", "alphabet", "beta", "gamma", "zeta"]);
+ expect(sortAlphabetically(result(["zeta", "Alpha", "beta"]), "al").options.map((o) => o.label)).toEqual(["Alpha"]);
+ });
+
+ it("matches substrings, then subsequences", () => {
+ expect(matchRanges("getValue", "val")).toEqual([3, 6]);
+ expect(matchRanges("getValue", "gv")).toEqual([0, 1, 3, 4]);
+ expect(matchRanges("getValue", "x")).toBeNull();
+ });
+});
+
describe("lookup commit characters", () => {
it("finishes only focused lookups unless the setting asks for it (IDEA)", () => {
expect(commitsLookup(".", true, false)).toBe(true);
@@ -206,6 +266,16 @@ describe("explicit completion", () => {
view.destroy();
});
+ it("keeps a sole candidate in the list when auto-insert is off", async () => {
+ useProject.setState({ settings: { editor: { completion: { autoInsertSingle: false } } } as unknown as Settings });
+ const view = editor(["println"]);
+ explicitCompletion(view);
+ await new Promise((r) => setTimeout(r, 300));
+ expect(view.state.doc.toString()).toBe("pri");
+ view.destroy();
+ useProject.setState({ settings: null });
+ });
+
it("shows the list when there are several candidates", async () => {
const view = editor(["println", "print"]);
explicitCompletion(view);
diff --git a/src/editor/lsp/completion.ts b/src/editor/lsp/completion.ts
index f557e100c..325a138d0 100644
--- a/src/editor/lsp/completion.ts
+++ b/src/editor/lsp/completion.ts
@@ -9,6 +9,7 @@
import {
acceptCompletion,
autocompletion,
+ closeCompletion,
completeFromList,
completionStatus,
currentCompletions,
@@ -24,7 +25,8 @@ import {
} from "@codemirror/autocomplete";
import { EditorSelection, Prec, type Text } from "@codemirror/state";
import { EditorView, ViewPlugin, keymap, type ViewUpdate } from "@codemirror/view";
-import { commands, isTauri, nextRequestId, type CompletionItem, type Markup, type RequestId } from "@/platform/ipc";
+import { call, commands, isTauri, nextRequestId, type CompletionItem, type Markup, type RequestId } from "@/platform/ipc";
+import { useProject } from "@/platform/project";
import { completionSymbolKind, identifierEnd, toCmCompletion, triggerCharacter } from "./completionItems";
import { lspSnippetToCm, snippetVariables } from "./snippet";
import { docOf, isUnavailable, lspDoc, lspRequest, reportLspError } from "./lsp";
@@ -35,6 +37,7 @@ import { triggerSignatureHelp } from "./signature";
import { serverBackoff } from "./availability";
import { pathCompletionSource } from "./fileReferences";
import { editorPrefs } from "@/platform/editorSettings";
+import { tx } from "@/platform/i18n";
import { showHint } from "./hint";
import { inplaceRenameActive } from "./inplaceRename";
@@ -177,6 +180,7 @@ export function applyLspCompletion(
.map((c) => ({ from: mapOld(c.from), to: mapOld(c.to), insert: c.insert }))
.filter((c) => c.to <= start || c.from >= end);
+ let insertedParens: ReturnType<typeof callParens> = null;
if (item.isSnippet) {
if (extra.length) {
const tr = state.update({ changes: extra, userEvent: "input.complete" });
@@ -186,10 +190,13 @@ export function applyLspCompletion(
}
snippet(lspSnippetToCm(item.insertText, snippetVariables(req.path)))(view, completion, start, end);
} else {
- const changes = state.changes([...extra, { from: start, to: end, insert: item.insertText }]);
+ const parens = editorPrefs().completion.insertParentheses ? callParens(item, state.doc.lineAt(start), start, end) : null;
+ insertedParens = parens;
+ const changes = state.changes([...extra, { from: start, to: end, insert: item.insertText + (parens ? "()" : "") }]);
+ const caret = changes.mapPos(end, 1) - (parens === "inside" ? 1 : 0);
view.dispatch({
changes,
- selection: EditorSelection.cursor(changes.mapPos(end, 1)),
+ selection: EditorSelection.cursor(caret),
userEvent: "input.complete",
annotations: pickedCompletion.of(completion),
scrollIntoView: true,
@@ -197,9 +204,34 @@ export function applyLspCompletion(
}
if (!completion.resolved && !item.additionalEdits.length && item.data != null) void applyLateEdits(view, completion, start);
+ if (insertedParens === "inside" && !item.command) setTimeout(() => triggerSignatureHelp(view), 0);
runCommand(view, item);
}
+const CALLABLE = new Set(["function", "method", "constructor"]);
+/** Lines where a callable is named, not called (imports, `use` paths). */
+const IMPORT_LINE = /^\s*(import|from|use|pub\s+use|export\s+\{|#include|require)\b/;
+
+/**
+ * Code Completion › Insert parentheses automatically: `()` after a function or
+ * method name inserted as plain text (snippets bring their own), with the
+ * caret `inside` unless the signature shows no parameters. Null when the
+ * name is followed by `(` or an identifier, or names an import.
+ */
+export function callParens(
+ item: Pick<CompletionItem, "kind" | "insertText" | "isSnippet" | "labelDetail" | "detail">,
+ line: { from: number; text: string },
+ start: number,
+ end: number,
+): "inside" | "after" | null {
+ if (item.isSnippet || !item.kind || !CALLABLE.has(item.kind) || /[(<[{]/.test(item.insertText)) return null;
+ const next = line.text.charAt(end - line.from);
+ if (next && /[(\p{L}\p{N}_$]/u.test(next)) return null;
+ if (IMPORT_LINE.test(line.text.slice(0, start - line.from))) return null;
+ const sig = item.labelDetail ?? item.detail ?? "";
+ return /^\s*\(\s*\)/.test(sig) || /^\s*fn\s*\(\s*\)|^\s*\(\)\s*(=>|->|:)/.test(sig) ? "after" : "inside";
+}
+
/**
* Some servers (tsserver auto-imports) only compute additional edits on
* resolve. Apply those that lie before the insertion once they arrive, if the
@@ -338,6 +370,57 @@ async function lspCompletionSource(ctx: CompletionContext): Promise<CompletionRe
};
}
+/**
+ * Code Completion › Sort suggestions alphabetically: the source's options are
+ * filtered here (prefix, substring, then subsequence) and listed by name;
+ * typing on re-filters the same options while the source's `validFor` holds.
+ */
+export function sortAlphabetically(result: CompletionResult, typed: string): CompletionResult {
+ if (result.filter === false) return result;
+ const matched = new Map<Completion, readonly number[]>();
+ for (const o of result.options) {
+ const m = matchRanges(o.label, typed);
+ if (m) matched.set(o, o.displayLabel ? [] : m);
+ }
+ const name = (c: Completion) => c.displayLabel ?? c.label;
+ const options = [...matched.keys()].sort(
+ (a, b) => name(a).localeCompare(name(b), undefined, { sensitivity: "base" }) || name(a).localeCompare(name(b)),
+ );
+ const { validFor } = result;
+ return {
+ from: result.from,
+ to: result.to,
+ options,
+ filter: false,
+ getMatch: (c) => matched.get(c) ?? [],
+ update: validFor
+ ? (_cur, from, to, ctx) => {
+ const text = ctx.state.sliceDoc(from, to);
+ const ok = typeof validFor === "function" ? validFor(text, from, to, ctx.state) : new RegExp(`^(?:${validFor.source})$`, validFor.flags).test(text);
+ return ok ? sortAlphabetically({ ...result, from }, text) : null;
+ }
+ : undefined,
+ };
+}
+
+/** Matched ranges of `typed` in `label`, ignoring case: a substring, else a subsequence; null without a match. */
+export function matchRanges(label: string, typed: string): number[] | null {
+ if (!typed) return [];
+ const lower = label.toLowerCase();
+ const p = typed.toLowerCase();
+ const at = lower.indexOf(p);
+ if (at >= 0) return [at, at + p.length];
+ const ranges: number[] = [];
+ let i = 0;
+ for (let j = 0; j < lower.length && i < p.length; j++) {
+ if (lower[j] !== p[i]) continue;
+ if (ranges.length && ranges[ranges.length - 1] === j) ranges[ranges.length - 1] = j + 1;
+ else ranges.push(j, j + 1);
+ i++;
+ }
+ return i === p.length ? ranges : null;
+}
+
/** Code Completion › Match case: first letter only, or every typed letter (as a subsequence). */
export function matchesCase(label: string, typed: string, mode: string): boolean {
if (!typed) return true;
@@ -370,7 +453,9 @@ function gated(source: CompletionSource): CompletionSource {
return (ctx) => {
const only = exclusiveSource(ctx);
if (only) return source === contributedSource ? only(ctx) : null;
- return !ctx.explicit && (!editorPrefs().completion.autoPopup || inplaceRenameActive(ctx.state)) ? null : source(ctx);
+ if (!ctx.explicit && (!editorPrefs().completion.autoPopup || inplaceRenameActive(ctx.state))) return null;
+ if (!editorPrefs().completion.sortAlphabetically) return source(ctx);
+ return Promise.resolve(source(ctx)).then((r) => r && sortAlphabetically(r, ctx.state.sliceDoc(r.from, r.to ?? ctx.pos)));
};
}
@@ -412,9 +497,9 @@ const lookupKeys = Prec.highest(
const itemChars = isLsp(selected) ? selected.lsp.commitCharacters : (selected.commitCharacters ?? []);
if (!commitsLookup(e.key, focusedLookups.has(view), editorPrefs().completion.insertOnSpecialKeys, itemChars)) return false;
if (!acceptCompletion(view)) return false;
- // A call snippet already opened the parenthesis: the typed one is consumed.
+ // A call snippet or inserted parentheses already opened the call: the typed one is consumed.
const head = view.state.selection.main.head;
- if (e.key === "(" && view.state.sliceDoc(head - 1, head) === "(") {
+ if (e.key === "(" && (view.state.sliceDoc(head - 1, head) === "(" || view.state.sliceDoc(head - 2, head) === "()")) {
e.preventDefault();
return true;
}
@@ -423,7 +508,7 @@ const lookupKeys = Prec.highest(
}),
);
-/** IDEA inserts a sole candidate right away on explicit invocation. */
+/** IDEA inserts a sole candidate right away on explicit invocation (Code Completion › Automatically insert single suggestions). */
const AUTO_INSERT_DELAY = 80; // past CodeMirror's interactionDelay
const lookupTracker = ViewPlugin.fromClass(
@@ -446,7 +531,7 @@ const lookupTracker = ViewPlugin.fromClass(
} else if (status === "active" && explicitPending.has(view)) {
explicitPending.delete(view);
const options = currentCompletions(u.state);
- if (options.length === 1) {
+ if (options.length === 1 && editorPrefs().completion.autoInsertSingle) {
const doc = u.state.doc;
setTimeout(() => {
const now = currentCompletions(view.state);
@@ -494,7 +579,33 @@ function typeColumn(c: Completion): Node | null {
return span;
}
-/** IDEA's advertiser bar under the list (one tip: "Press ↵ to insert, ⇥ to replace"). */
+/** Toggles Code Completion › Sort suggestions alphabetically (globally) and re-opens the lookup. */
+async function toggleSortByName(view: EditorView) {
+ const on = !editorPrefs().completion.sortAlphabetically;
+ if (isTauri()) {
+ const settings = await call(commands.settingsSet("global", "editor.completion.sortAlphabetically", JSON.stringify(on)));
+ useProject.setState({ settings });
+ }
+ if (!view.dom.isConnected) return;
+ closeCompletion(view);
+ startCompletion(view);
+}
+
+function sortToggle(view: EditorView): HTMLElement {
+ const button = document.createElement("button");
+ button.type = "button";
+ button.className = "cm-lsp-completion-sort";
+ button.textContent = tx("Sort by name");
+ const on = editorPrefs().completion.sortAlphabetically;
+ button.setAttribute("aria-pressed", String(on));
+ button.title = tx(on ? "Sort suggestions by relevance" : "Sort suggestions alphabetically");
+ // Keep the editor focused so the lookup survives the click.
+ button.addEventListener("mousedown", (e) => e.preventDefault());
+ button.addEventListener("click", () => void toggleSortByName(view).catch(() => {}));
+ return button;
+}
+
+/** IDEA's advertiser bar under the list (one tip: "Press ↵ to insert, ⇥ to replace") and its Sort by Name toggle. */
const completionFooter = ViewPlugin.fromClass(
class {
constructor(private view: EditorView) {}
@@ -512,7 +623,9 @@ const completionFooter = ViewPlugin.fromClass(
if (t.querySelector(":scope > .cm-lsp-completion-footer")) continue;
const footer = document.createElement("div");
footer.className = "cm-lsp-completion-footer";
- footer.textContent = "Press ↵ to insert, ⇥ to replace";
+ const tip = document.createElement("span");
+ tip.textContent = tx("Press ↵ to insert, ⇥ to replace");
+ footer.append(tip, sortToggle(this.view));
t.appendChild(footer);
}
},
diff --git a/src/editor/lsp/diagnostics.ts b/src/editor/lsp/diagnostics.ts
index f6351baf1..c1857ff5d 100644
--- a/src/editor/lsp/diagnostics.ts
+++ b/src/editor/lsp/diagnostics.ts
@@ -15,6 +15,13 @@ import { rangeToOffsets } from "./positions";
import { lspDoc } from "./lsp";
import { showHint } from "./hint";
import { editorPrefs } from "@/platform/editorSettings";
+import {
+ applyProfile,
+ inspectionProfile,
+ isTypoStyled,
+ noteDiagnosticCodes,
+ subscribeInspectionProfile,
+} from "@/platform/inspections";
type Listener = () => void;
@@ -29,13 +36,17 @@ export function setFileDiagnostics(path: string, source: string, items: Diagnost
} else {
if (!sources) byPath.set(path, (sources = new Map()));
sources.set(source, items.map((d) => ({ ...d, source: d.source ?? source })));
+ noteDiagnosticCodes(source, items);
}
listeners.get(path)?.forEach((l) => l());
}
+/** Diagnostics of `path` under the inspection profile in effect. */
export function diagnosticsFor(path: string): Diagnostic[] {
const sources = byPath.get(path);
- return sources ? [...sources.values()].flat() : [];
+ if (!sources) return [];
+ const profile = inspectionProfile();
+ return [...sources].flatMap(([source, items]) => applyProfile(profile, source, items));
}
export function subscribeDiagnostics(path: string, l: Listener): () => void {
@@ -49,7 +60,13 @@ export function subscribeDiagnostics(path: string, l: Listener): () => void {
}
export function installDiagnosticsEvents(): () => void {
- return onIdeEvent("diagnostics", (e) => setFileDiagnostics(e.path, e.source, e.items));
+ const off = onIdeEvent("diagnostics", (e) => setFileDiagnostics(e.path, e.source, e.items));
+ // Another inspection profile (or edits to it) re-filters every open file.
+ const offProfile = subscribeInspectionProfile(() => listeners.forEach((set) => set.forEach((l) => l())));
+ return () => {
+ off();
+ offProfile();
+ };
}
const SEVERITY_RANK: Record<Severity, number> = { error: 0, warning: 1, info: 2, hint: 3 };
@@ -63,7 +80,11 @@ export function toLintDiagnostics(doc: Text, items: readonly Diagnostic[]): Lint
if (to < line.to) to++;
else if (from > line.from) from--;
}
- const classes = [d.unnecessary && "cm-lsp-unnecessary", d.deprecated && "cm-lsp-deprecated"].filter(Boolean);
+ const classes = [
+ d.unnecessary && "cm-lsp-unnecessary",
+ d.deprecated && "cm-lsp-deprecated",
+ isTypoStyled(d) && "cm-lsp-typo",
+ ].filter(Boolean);
return {
from,
to,
@@ -87,7 +108,7 @@ export function diagnosticMarks(diags: readonly LintDiagnostic[]): ScrollbarMark
const out: ScrollbarMark[] = [];
for (const d of diags) {
const color = MARK_COLOR[d.severity];
- if (!color || d.markClass?.includes("cm-lsp-unnecessary")) continue;
+ if (!color || d.markClass?.includes("cm-lsp-unnecessary") || d.markClass?.includes("cm-lsp-typo")) continue;
out.push({ from: d.from, to: d.to, color, tooltip: d.message, priority: 3 - SEVERITY_RANK[d.severity] });
}
return out;
@@ -136,7 +157,7 @@ const diagnosticsSync = ViewPlugin.fromClass(
);
// Effects follow the IDEA schemes: errors wavy red; warnings wavy yellow (dark) or
-// a yellow background (light, via --editor-warning-*); weak warnings dotted.
+// a yellow background (light, via --editor-warning-*); weak warnings dotted; typos wavy green.
const lintTheme = EditorView.theme({
".cm-lintRange": { backgroundImage: "none", paddingBottom: "0" },
".cm-lintRange-error": {
@@ -156,6 +177,12 @@ const lintTheme = EditorView.theme({
textUnderlineOffset: "3px",
},
".cm-lintRange-hint": { textDecoration: "none" },
+ // Typo level: IDEA's green wavy underline.
+ ".cm-lintRange.cm-lsp-typo": {
+ textDecoration: "underline wavy color-mix(in srgb, var(--success) 85%, transparent)",
+ textDecorationSkipInk: "none",
+ textUnderlineOffset: "3px",
+ },
".cm-lintRange.cm-lsp-unnecessary": {
textDecoration: "none",
backgroundColor: "transparent",
diff --git a/src/editor/lsp/format.test.ts b/src/editor/lsp/format.test.ts
index 8f604b79b..eb66b954a 100644
--- a/src/editor/lsp/format.test.ts
+++ b/src/editor/lsp/format.test.ts
@@ -1,5 +1,12 @@
import { describe, expect, it } from "vitest";
import { Text } from "@codemirror/state";
+import {
+ formatExcluded,
+ guardFormatChanges,
+ guardTextEdits,
+ protectedRegions,
+ type FormatGuardOptions,
+} from "@/platform/formatGuard";
import { formattedLines } from "./format";
describe("formattedLines", () => {
@@ -26,3 +33,67 @@ describe("formattedLines", () => {
).toBe(3);
});
});
+
+describe("formatter markers and Do not format", () => {
+ const on: FormatGuardOptions = {
+ doNotFormat: [],
+ formatterTagsEnabled: true,
+ formatterOffTag: "@formatter:off",
+ formatterOnTag: "@formatter:on",
+ formatterTagsRegexp: false,
+ };
+ const lines = ["a = 1", "// @formatter:off", "b = 2", "// @formatter:on", "c = 3"];
+ const text = lines.join("\n");
+ const at = (line: number, col = 0) => lines.slice(0, line).join("\n").length + (line ? 1 : 0) + col;
+ const apply = (t: string, cs: readonly { from: number; to: number; insert: string }[]) =>
+ [...cs].sort((x, y) => y.from - x.from).reduce((s, c) => s.slice(0, c.from) + c.insert + s.slice(c.to), t);
+ const formatted = ["a = 1", "// @formatter:off", "b = 2", "// @formatter:on", "c = 3"].join("\n");
+ const expected = ["a = 1", "// @formatter:off", "b = 2", "// @formatter:on", "c = 3"].join("\n");
+
+ it("finds the regions between markers in comments", () => {
+ expect(protectedRegions(text, on)).toEqual([{ from: at(1), to: at(3, "// @formatter:on".length) }]);
+ expect(protectedRegions(text, { ...on, formatterTagsEnabled: false })).toEqual([]);
+ expect(protectedRegions('s = "@formatter:off"\nx', on)).toEqual([]);
+ // Without an on marker the region runs to the end.
+ expect(protectedRegions("x\n# @formatter:off\ny", on)).toEqual([{ from: 2, to: 20 }]);
+ const regexp = { ...on, formatterOffTag: "fmt:\\s*off", formatterOnTag: "fmt:\\s*on", formatterTagsRegexp: true };
+ expect(protectedRegions("// fmt: off\nx\n// fmt:on", regexp)).toEqual([{ from: 0, to: 23 }]);
+ });
+
+ it("drops edits inside a region and keeps the others", () => {
+ const changes = [
+ { from: at(0, 1), to: at(0, 3), insert: " " },
+ { from: at(2, 1), to: at(2, 3), insert: " " },
+ { from: at(4, 1), to: at(4, 3), insert: " " },
+ ];
+ expect(apply(text, guardFormatChanges(text, changes, on))).toBe(
+ ["a = 1", "// @formatter:off", "b = 2", "// @formatter:on", "c = 3"].join("\n"),
+ );
+ expect(guardFormatChanges(text, changes, { ...on, formatterTagsEnabled: false })).toEqual(changes);
+ });
+
+ it("splits a whole-file replacement around the regions", () => {
+ expect(apply(text, guardFormatChanges(text, [{ from: 0, to: text.length, insert: formatted }], on))).toBe(expected);
+ const edits = guardTextEdits(
+ text,
+ [{ range: { start: { line: 0, col: 0 }, end: { line: 4, col: 7 } }, new_text: formatted }],
+ on,
+ );
+ const asChanges = edits.map((e) => ({
+ from: at(e.range.start.line, e.range.start.col),
+ to: at(e.range.end.line, e.range.end.col),
+ insert: e.new_text,
+ }));
+ expect(apply(text, asChanges)).toBe(expected);
+ });
+
+ it("matches Do not format globs against names and project paths", () => {
+ const globs = ["*.min.js", "generated", "src/vendor/**", "docs/"];
+ expect(formatExcluded("/p/web/app.min.js", "/p", globs)).toBe(true);
+ expect(formatExcluded("/p/a/generated/x.ts", "/p", globs)).toBe(true);
+ expect(formatExcluded("/p/src/vendor/lib/x.ts", "/p", globs)).toBe(true);
+ expect(formatExcluded("/p/docs/a.md", "/p", globs)).toBe(true);
+ expect(formatExcluded("/p/src/app.js", "/p", globs)).toBe(false);
+ expect(formatExcluded("/p/other/docs.md", "/p", globs)).toBe(false);
+ });
+});
diff --git a/src/editor/lsp/format.ts b/src/editor/lsp/format.ts
index 01276154a..44802b524 100644
--- a/src/editor/lsp/format.ts
+++ b/src/editor/lsp/format.ts
@@ -12,9 +12,12 @@ import type { EditorView } from "@codemirror/view";
import { commands } from "@/platform/ipc";
import { shortcutLabel } from "@/platform/keymap";
import { executeAction } from "@/platform/actions";
+import { formatExcluded, formatGuardOptions, guardFormatChanges, type FormatGuardOptions } from "@/platform/formatGuard";
+import { useProject } from "@/platform/project";
import { CONTRIBUTED_FORMAT, contributedAt, whenSynced, type ContributedFormatter } from "@/editor/api";
import { docOf, lspRequest, reportLspError } from "./lsp";
import { offsetToPos, textEditsToChanges } from "./positions";
+import { tx, txTemplate } from "@/platform/i18n";
import { showHint } from "./hint";
import { openPopup, type ReformatOptions } from "./popupStore";
@@ -46,15 +49,15 @@ function formattedHint(view: EditorView, lines: number) {
const keys = shortcutLabel("code.reformatDialog");
showHint(view, () => {
const box = document.createElement("div");
- box.textContent = `Formatted ${lines} ${lines === 1 ? "line" : "lines"}`;
+ box.textContent = txTemplate(`Formatted ${lines} ${lines === 1 ? "line" : "lines"}`);
const more = document.createElement("div");
const link = document.createElement("button");
link.type = "button";
link.className = "cm-lsp-link-button";
- link.textContent = "Show";
+ link.textContent = tx("Show");
link.addEventListener("mousedown", (e) => e.preventDefault());
link.addEventListener("click", () => void executeAction("code.reformatDialog"));
- more.append(link, ` the Reformat dialog${keys ? `: ${keys}` : ""}`);
+ more.append(link, `${tx(" the Reformat dialog")}${keys ? `: ${keys}` : ""}`);
box.appendChild(more);
return box;
});
@@ -70,8 +73,15 @@ export async function formatDocument(
}
async function format(view: EditorView, opts: { explicit: boolean; selectionOnly?: boolean }): Promise<FormatResult> {
+ const { project, settings } = useProject.getState();
+ const guard = formatGuardOptions(settings);
+ const path = docOf(view)?.path;
+ if (path && formatExcluded(path, project?.root ?? null, guard.doNotFormat)) {
+ if (opts.explicit) showHint(view, "Formatting is turned off for this file (Code Style › Formatter › Do not format)");
+ return NOTHING;
+ }
const own = contributedAt<ContributedFormatter>(view.state, CONTRIBUTED_FORMAT, 0);
- if (own) return applyContributedFormat(view, own, opts);
+ if (own) return applyContributedFormat(view, own, opts, guard);
const doc = docOf(view);
if (!doc || doc.readOnly) return NOTHING;
// The server formats the backend's copy: let pending keystrokes reach it first.
@@ -92,7 +102,7 @@ async function format(view: EditorView, opts: { explicit: boolean; selectionOnly
if (opts.explicit) showHint(view, "The file changed while formatting; try again");
return NOTHING;
}
- const changes = textEditsToChanges(state.doc, edits);
+ const changes = guardFormatChanges(state.doc.toString(), textEditsToChanges(state.doc, edits), guard);
if (!changes.length) {
if (opts.explicit) showHint(view, "No lines changed: content is already properly formatted");
return NOTHING;
@@ -110,13 +120,18 @@ function applyContributedFormat(
view: EditorView,
format: ContributedFormatter,
opts: { explicit: boolean; selectionOnly?: boolean },
+ guard: FormatGuardOptions,
): FormatResult {
const state = view.state;
if (state.readOnly) return NOTHING;
const sel = state.selection.main;
const useSelection = (opts.selectionOnly ?? true) && !sel.empty;
- const changes = format(state, useSelection ? { from: sel.from, to: sel.to } : null).filter(
- (c) => state.sliceDoc(c.from, c.to) !== c.insert,
+ const changes = guardFormatChanges(
+ state.doc.toString(),
+ format(state, useSelection ? { from: sel.from, to: sel.to } : null)
+ .filter((c) => state.sliceDoc(c.from, c.to) !== c.insert)
+ .sort((a, b) => a.from - b.from),
+ guard,
);
if (!changes.length) {
if (opts.explicit) showHint(view, "No lines changed: content is already properly formatted");
diff --git a/src/editor/lsp/hint.ts b/src/editor/lsp/hint.ts
index bc9e89744..0d2d16941 100644
--- a/src/editor/lsp/hint.ts
+++ b/src/editor/lsp/hint.ts
@@ -6,6 +6,7 @@
import { StateEffect, StateField, type Extension } from "@codemirror/state";
import { EditorView, keymap, showTooltip, type Tooltip } from "@codemirror/view";
import { Prec } from "@codemirror/state";
+import { txTemplate } from "@/platform/i18n";
interface Hint {
pos: number;
@@ -33,7 +34,7 @@ const hintField = StateField.define<Hint | null>({
const dom = document.createElement("div");
dom.className = `cm-lsp-hint cm-lsp-hint-${h.tone}`;
dom.setAttribute("role", "status");
- if (typeof h.content === "string") dom.textContent = h.content;
+ if (typeof h.content === "string") dom.textContent = txTemplate(h.content);
else dom.appendChild(h.content());
return { dom };
},
diff --git a/src/editor/lsp/hover.ts b/src/editor/lsp/hover.ts
index 11ed5a94d..227ad85ae 100644
--- a/src/editor/lsp/hover.ts
+++ b/src/editor/lsp/hover.ts
@@ -230,20 +230,23 @@ async function definitionTarget(loc: Location, fallbackLanguage: string | null):
};
}
-/** ⌥Space: the definition's source in a popup, without leaving the editor; ← / → switch between several. */
-export async function quickDefinition(view: EditorView) {
+/**
+ * ⌥Space: the definition's source in a popup, without leaving the editor; ← / → switch between several.
+ * View › Quick Type Definition: the same for the symbol's type (`typeDefinition`).
+ */
+export async function quickDefinition(view: EditorView, kind: "definition" | "typeDefinition" = "definition") {
const doc = docOf(view);
if (!doc) return;
const pos = view.state.selection.main.head;
try {
- const found = await lspRequest(() => commands.lspGoto(doc.doc, offsetToPos(view.state.doc, pos), "definition"));
+ const found = await lspRequest(() => commands.lspGoto(doc.doc, offsetToPos(view.state.doc, pos), kind));
const seen = new Set<string>();
const locations = found.filter((l) => {
const key = `${l.path}:${l.range.start.line}:${l.range.start.col}`;
return !seen.has(key) && !!seen.add(key);
});
if (!locations.length) {
- showHint(view, "No definition found");
+ showHint(view, kind === "typeDefinition" ? "No type definition found" : "No definition found");
return;
}
const targets = (await Promise.all(locations.slice(0, MAX_TARGETS).map((l) => definitionTarget(l, doc.uiMode)))).filter(
diff --git a/src/editor/lsp/index.ts b/src/editor/lsp/index.ts
index ae2a22ad0..7ab85eda2 100644
--- a/src/editor/lsp/index.ts
+++ b/src/editor/lsp/index.ts
@@ -1,7 +1,7 @@
/**
* LSP-backed editor features: completion, diagnostics, hover / quick docs,
* parameter info, navigation, document highlights, intentions, rename,
- * formatting, inlay hints and semantic highlighting. Everything is contributed
+ * formatting, inlay hints, inline completion and semantic highlighting. Everything is contributed
* through `editor/api` as CodeMirror extensions plus actions; editor/core is
* never imported.
*/
@@ -18,6 +18,7 @@ import { parameterTabKeys, signatureExtension } from "./signature";
import { navigationExtension } from "./navigation";
import { intentionsExtension } from "./intentions";
import { inlayExtension } from "./inlay";
+import { inlineCompletionExtension, registerInlineCompletionActions } from "./inlineCompletion";
import { semanticExtension } from "./semantic";
import { usagesLensExtension } from "./codeLens";
import { autoImportExtension } from "./autoImport";
@@ -26,6 +27,7 @@ import { registerActionsOnSave, registerFormatOnSave, registerLspActions } from
import { lspTheme } from "./theme";
import { inspectionWidgetExtension } from "./inspectionWidget";
import { unresolvedReferences } from "./fileReferences";
+import { spellingExtension } from "./spelling";
import { DocumentationWindow, LspPopups, UsagesStatus } from "./Popups";
import { DOCUMENTATION_WINDOW } from "./docs";
import { prefetchMarkdown } from "./markdown";
@@ -45,10 +47,12 @@ export function lspExtensions(ctx: EditorDocContext): Extension[] {
navigationExtension(),
intentionsExtension(),
inlayExtension(),
+ inlineCompletionExtension(),
semanticExtension(),
usagesLensExtension(),
autoImportExtension(),
unresolvedReferences(),
+ spellingExtension(),
];
}
@@ -73,6 +77,7 @@ export function activate(): () => void {
component: DocumentationWindow,
}),
registerLspActions(),
+ registerInlineCompletionActions(),
registerNavigationActions(),
registerFormatOnSave(),
registerActionsOnSave(),
diff --git a/src/editor/lsp/inlineCompletion.test.ts b/src/editor/lsp/inlineCompletion.test.ts
new file mode 100644
index 000000000..ad418be09
--- /dev/null
+++ b/src/editor/lsp/inlineCompletion.test.ts
@@ -0,0 +1,138 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { EditorSelection, EditorState } from "@codemirror/state";
+import { EditorView } from "@codemirror/view";
+import type { InlineCompletionItem } from "@/bindings";
+
+const ipc = vi.hoisted(() => ({
+ lspInlineCompletion: vi.fn(),
+ lspExecuteCommand: vi.fn(async () => ({ status: "ok" as const, data: null })),
+ cancelRequest: vi.fn(async () => ({ status: "ok" as const, data: null })),
+}));
+vi.mock("@/platform/ipc", async (orig) => {
+ const real = await orig<typeof import("@/platform/ipc")>();
+ return { ...real, isTauri: () => true, commands: { ...real.commands, ...ipc } };
+});
+
+const {
+ acceptInline,
+ cycleInline,
+ dismissInline,
+ ghostField,
+ ghostText,
+ inlineCompletionExtension,
+ nextWord,
+ requestInline,
+ toSuggestions,
+} = await import("./inlineCompletion");
+const { lspDoc } = await import("./lsp");
+
+const item = (insertText: string, extra: Partial<InlineCompletionItem> = {}): InlineCompletionItem => ({
+ insertText,
+ range: null,
+ filterText: null,
+ command: null,
+ server: 1,
+ ...extra,
+});
+
+const views: EditorView[] = [];
+afterEach(() => {
+ views.splice(0).forEach((v) => v.destroy());
+ vi.clearAllMocks();
+});
+
+function editor(doc: string, caret = doc.length) {
+ const view = new EditorView({
+ state: EditorState.create({
+ doc,
+ selection: EditorSelection.cursor(caret),
+ extensions: [
+ lspDoc.of({ doc: 3, path: "/p/a.rs", language: "rust", virtual: false } as never),
+ inlineCompletionExtension(),
+ ],
+ }),
+ parent: document.body,
+ });
+ views.push(view);
+ return view;
+}
+
+const ghostDom = (v: EditorView) => v.dom.querySelector(".cm-inline-ghost")?.textContent ?? null;
+
+async function suggest(view: EditorView, ...items: InlineCompletionItem[]) {
+ ipc.lspInlineCompletion.mockResolvedValueOnce({ status: "ok", data: items });
+ return requestInline(view, true);
+}
+
+describe("inline completion", () => {
+ it("shows the server's suggestion as ghost text at the caret", async () => {
+ const view = editor("let x = fo");
+ expect(
+ await suggest(view, item("foo(1);", { range: { start: { line: 0, col: 8 }, end: { line: 0, col: 10 } } })),
+ ).toBe(true);
+ expect(ipc.lspInlineCompletion.mock.calls[0]!.slice(1)).toEqual([3, { line: 0, col: 10 }, true]);
+ expect(ghostDom(view)).toBe("o(1);");
+ });
+
+ it("stays while the typed text matches it and goes when it doesn't", async () => {
+ const view = editor("let x = ");
+ await suggest(view, item("foo()"));
+ view.dispatch({ changes: { from: 8, insert: "f" }, selection: EditorSelection.cursor(9), userEvent: "input.type" });
+ expect(ghostDom(view)).toBe("oo()");
+ view.dispatch({
+ changes: { from: 9, insert: "x" },
+ selection: EditorSelection.cursor(10),
+ userEvent: "input.type",
+ });
+ expect(view.state.field(ghostField)).toBeNull();
+ expect(ghostDom(view)).toBeNull();
+ });
+
+ it("accepts the whole suggestion or its next word, and runs its command", async () => {
+ const view = editor("x = ");
+ const command = { title: "accepted", command: "ghost.accepted", arguments: [] };
+ await suggest(view, item("compute(a, b)", { command }));
+ expect(acceptInline(view, true)).toBe(true);
+ expect(view.state.doc.toString()).toBe("x = compute");
+ expect(ghostDom(view)).toBe("(a, b)");
+ expect(acceptInline(view)).toBe(true);
+ expect(view.state.doc.toString()).toBe("x = compute(a, b)");
+ expect(view.state.selection.main.head).toBe(17);
+ expect(view.state.field(ghostField)).toBeNull();
+ expect(ipc.lspExecuteCommand).toHaveBeenCalledWith(3, command);
+ expect(acceptInline(view)).toBe(false);
+ });
+
+ it("cycles through variants and dismisses", async () => {
+ const view = editor("a");
+ const range = { start: { line: 0, col: 0 }, end: { line: 0, col: 1 } };
+ await suggest(view, item("abc", { range }), item("axe", { range }));
+ expect(ghostDom(view)).toBe("bc");
+ cycleInline(view, 1);
+ expect(ghostDom(view)).toBe("xe");
+ cycleInline(view, 1);
+ expect(ghostDom(view)).toBe("bc");
+ cycleInline(view, -1);
+ expect(ghostDom(view)).toBe("xe");
+ expect(dismissInline(view)).toBe(true);
+ expect(ghostDom(view)).toBeNull();
+ expect(dismissInline(view)).toBe(false);
+ });
+
+ it("drops suggestions that don't fit the caret, and trims text the suggestion replaces", () => {
+ const state = EditorState.create({ doc: "f()", selection: EditorSelection.cursor(2) });
+ const range = { start: { line: 0, col: 0 }, end: { line: 0, col: 3 } };
+ const found = toSuggestions(state, 2, [item("f(a)", { range }), item("g(b)", { range }), item("f(a)", { range })]);
+ expect(found).toHaveLength(1);
+ // `)` follows the caret and ends the suggestion: only `a` is new.
+ expect(ghostText(state, found[0]!)).toBe("a");
+ expect(ghostText(state, { ...found[0]!, text: "f(a, b) + 1" })).toBe("a, b) + 1");
+ });
+
+ it("splits the next word like IDEA", () => {
+ expect(nextWord("foo(bar)")).toBe("foo");
+ expect(nextWord("(bar)")).toBe("(");
+ expect(nextWord(" bar baz")).toBe(" bar");
+ expect(nextWord(" ")).toBe(" ");
+ });
+});
diff --git a/src/editor/lsp/inlineCompletion.ts b/src/editor/lsp/inlineCompletion.ts
new file mode 100644
index 000000000..29d265481
--- /dev/null
+++ b/src/editor/lsp/inlineCompletion.ts
@@ -0,0 +1,324 @@
+/**
+ * Inline completion (LSP 3.18 `textDocument/inlineCompletion`): a server's
+ * suggestion shown as gray text at the caret while typing (Settings › Editor ›
+ * General › Inline Completion). Tab accepts it, Escape dismisses it, ⌥] / ⌥[
+ * cycle through the server's variants and ⌘→ accepts the next word; typing what
+ * it shows keeps it. Requests are debounced and cancelled (RequestId) as typing
+ * goes on; only servers advertising `inlineCompletionProvider` are asked.
+ */
+import { completionStatus } from "@codemirror/autocomplete";
+import { EditorSelection, StateEffect, StateField, type EditorState, type Extension } from "@codemirror/state";
+import { Decoration, EditorView, ViewPlugin, WidgetType, type ViewUpdate } from "@codemirror/view";
+import { registerActions, type Action } from "@/platform/actions";
+import { setContext } from "@/platform/context";
+import { editorPrefs } from "@/platform/editorSettings";
+import {
+ call,
+ commands,
+ isCancelled,
+ isTauri,
+ nextRequestId,
+ type Command,
+ type InlineCompletionItem,
+ type RequestId,
+} from "@/platform/ipc";
+import { activeEditor } from "@/editor/api";
+import { docOf, isUnavailable, lspRequest } from "./lsp";
+import { offsetToPos, rangeToOffsets } from "./positions";
+import { showHint } from "./hint";
+
+/** A suggestion in document offsets: `text` replaces `[from, to)`. */
+export interface Suggestion {
+ from: number;
+ to: number;
+ text: string;
+ command: Command | null;
+}
+
+export interface Ghost {
+ items: Suggestion[];
+ index: number;
+ /** Caret the ghost is shown at. */
+ caret: number;
+}
+
+export const CONTEXT_KEY = "inlineCompletionVisible";
+/** Debounce while typing when "show only when typing pauses" is off. */
+const TYPING_DELAY = 75;
+/** Back-off after "no server supports inline completion", per document. */
+const BACKOFF_MS = 30_000;
+
+export const setGhost = StateEffect.define<Ghost | null>();
+const cycleGhost = StateEffect.define<1 | -1>();
+
+/** The suggestion still applies at the caret: what was typed since is a prefix of it. */
+function stillValid(state: EditorState, s: Suggestion): boolean {
+ const sel = state.selection;
+ if (sel.ranges.length !== 1 || !sel.main.empty) return false;
+ const caret = sel.main.head;
+ if (caret < s.from) return false;
+ const typed = state.doc.sliceString(s.from, caret);
+ return s.text.length > typed.length && s.text.startsWith(typed);
+}
+
+/** The text shown after the caret: the rest of the suggestion, without what already follows the caret and it replaces. */
+export function ghostText(state: EditorState, s: Suggestion): string {
+ const caret = state.selection.main.head;
+ const rest = s.text.slice(caret - s.from);
+ const after = s.to > caret ? state.doc.sliceString(caret, s.to) : "";
+ return after && rest.endsWith(after) ? rest.slice(0, rest.length - after.length) : rest;
+}
+
+export const ghostField = StateField.define<Ghost | null>({
+ create: () => null,
+ update(value, tr) {
+ for (const e of tr.effects) {
+ if (e.is(setGhost)) value = e.value;
+ else if (e.is(cycleGhost) && value && value.items.length > 1)
+ value = { ...value, index: (value.index + e.value + value.items.length) % value.items.length };
+ }
+ if (!value) return null;
+ let items = value.items;
+ if (tr.docChanged)
+ items = items.map((s) => ({
+ ...s,
+ from: tr.changes.mapPos(s.from, -1),
+ to: Math.max(tr.changes.mapPos(s.to, 1), tr.changes.mapPos(s.from, -1)),
+ }));
+ if (!tr.docChanged && !tr.selection && items === value.items) return value;
+ if (completionStatus(tr.state) === "active") return null;
+ const current = items[value.index];
+ const valid = items.filter((s) => stillValid(tr.state, s));
+ if (!valid.length) return null;
+ const index = current && valid.includes(current) ? valid.indexOf(current) : 0;
+ return { items: valid, index, caret: tr.state.selection.main.head };
+ },
+ provide: (f) =>
+ EditorView.decorations.compute([f], (state) => {
+ const g = state.field(f);
+ const s = g?.items[g.index];
+ const text = s ? ghostText(state, s) : "";
+ if (!g || !text) return Decoration.none;
+ const label = g.items.length > 1 ? `${g.index + 1}/${g.items.length}` : null;
+ return Decoration.set([Decoration.widget({ widget: new GhostWidget(text, label), side: 1 }).range(g.caret)]);
+ }),
+});
+
+class GhostWidget extends WidgetType {
+ constructor(
+ readonly text: string,
+ readonly label: string | null,
+ ) {
+ super();
+ }
+ eq(other: GhostWidget) {
+ return other.text === this.text && other.label === this.label;
+ }
+ toDOM() {
+ const el = document.createElement("span");
+ el.className = "cm-inline-ghost";
+ el.textContent = this.text;
+ if (this.label) el.title = `Suggestion ${this.label}`;
+ el.setAttribute("aria-hidden", "true");
+ return el;
+ }
+ ignoreEvent() {
+ return false;
+ }
+}
+
+/** Inline completion items → suggestions at `caret` of `state` (no range: inserted at the caret). */
+export function toSuggestions(state: EditorState, caret: number, items: readonly InlineCompletionItem[]): Suggestion[] {
+ const out: Suggestion[] = [];
+ for (const item of items) {
+ const { from, to } = item.range ? rangeToOffsets(state.doc, item.range) : { from: caret, to: caret };
+ const s = { from, to, text: item.insertText, command: item.command };
+ if (from <= caret && stillValid(state, s) && !out.some((o) => o.from === from && o.text === s.text)) out.push(s);
+ }
+ return out;
+}
+
+function enabledFor(language: string): boolean {
+ const p = editorPrefs().inlineCompletion;
+ return p.enabled && !p.disabledLanguages.includes(language);
+}
+
+const backoff = new Map<number, number>();
+let focused: EditorView | null = null;
+let inflight: RequestId | null = null;
+
+function cancelInflight() {
+ if (inflight !== null && isTauri()) void commands.cancelRequest(inflight);
+ inflight = null;
+}
+
+/** Asks the servers for suggestions at the caret and shows them; false when there are none. */
+export async function requestInline(view: EditorView, automatic: boolean): Promise<boolean> {
+ const doc = docOf(view);
+ const state = view.state;
+ const sel = state.selection;
+ if (!doc || sel.ranges.length !== 1 || !sel.main.empty || view.state.readOnly) return false;
+ if (automatic && (backoff.get(doc.doc) ?? 0) > Date.now()) return false;
+ cancelInflight();
+ const id = (inflight = nextRequestId());
+ const caret = sel.main.head;
+ try {
+ const items = await lspRequest(() =>
+ commands.lspInlineCompletion(id, doc.doc, offsetToPos(state.doc, caret), automatic),
+ );
+ if (view.state.doc !== state.doc || !view.state.selection.eq(sel)) return false;
+ const suggestions = toSuggestions(view.state, caret, items);
+ view.dispatch({ effects: setGhost.of(suggestions.length ? { items: suggestions, index: 0, caret } : null) });
+ return suggestions.length > 0;
+ } catch (e) {
+ if (isUnavailable(e)) backoff.set(doc.doc, Date.now() + BACKOFF_MS);
+ else if (!isCancelled(e)) console.debug("[lsp] inline completion", e);
+ if (!automatic && !isCancelled(e)) throw e;
+ return false;
+ } finally {
+ if (inflight === id) inflight = null;
+ }
+}
+
+function publish(view: EditorView) {
+ if (view.hasFocus) focused = view;
+ if (focused === view) setContext(CONTEXT_KEY, view.hasFocus && !!view.state.field(ghostField, false));
+}
+
+const typedChange = (u: ViewUpdate) =>
+ u.transactions.some((tr) => tr.isUserEvent("input.type") || tr.isUserEvent("delete"));
+
+const inlinePlugin = ViewPlugin.fromClass(
+ class {
+ private timer: ReturnType<typeof setTimeout> | undefined;
+ constructor(private view: EditorView) {}
+ update(u: ViewUpdate) {
+ if (u.docChanged || u.selectionSet) {
+ clearTimeout(this.timer);
+ cancelInflight();
+ }
+ if (u.docChanged && typedChange(u) && !u.state.field(ghostField)) this.schedule();
+ if (
+ u.focusChanged ||
+ u.docChanged ||
+ u.selectionSet ||
+ u.startState.field(ghostField) !== u.state.field(ghostField)
+ ) {
+ if (u.focusChanged && !u.view.hasFocus && u.state.field(ghostField))
+ queueMicrotask(() => {
+ if (this.view.dom.isConnected && !this.view.hasFocus) dismissInline(this.view);
+ });
+ publish(u.view);
+ }
+ }
+ schedule() {
+ const doc = docOf(this.view);
+ if (!doc || !enabledFor(doc.language) || !isTauri()) return;
+ const p = editorPrefs().inlineCompletion;
+ this.timer = setTimeout(
+ () => {
+ if (completionStatus(this.view.state) !== "active") void requestInline(this.view, true);
+ },
+ p.onlyOnPause ? p.pauseMs : TYPING_DELAY,
+ );
+ }
+ destroy() {
+ clearTimeout(this.timer);
+ if (focused === this.view) {
+ focused = null;
+ setContext(CONTEXT_KEY, false);
+ }
+ }
+ },
+);
+
+export function inlineCompletionExtension(): Extension {
+ return [ghostField, inlinePlugin];
+}
+
+/** The next word of a suggestion's rest: leading spaces plus one word or run of punctuation. */
+export function nextWord(rest: string): string {
+ return /^\s*(?:[\p{L}\p{N}_$]+|[^\p{L}\p{N}_$\s]+)|^\s+/u.exec(rest)?.[0] ?? rest;
+}
+
+/** Accepts the shown suggestion (`word`: only its next word). False when none is shown. */
+export function acceptInline(view: EditorView, word = false): boolean {
+ const g = view.state.field(ghostField, false);
+ const s = g?.items[g.index];
+ if (!g || !s) return false;
+ const caret = view.state.selection.main.head;
+ if (word) {
+ const chunk = nextWord(s.text.slice(caret - s.from));
+ view.dispatch({
+ changes: { from: caret, insert: chunk },
+ selection: EditorSelection.cursor(caret + chunk.length),
+ userEvent: "input.complete",
+ scrollIntoView: true,
+ });
+ return true;
+ }
+ view.dispatch({
+ changes: { from: s.from, to: Math.max(s.to, caret), insert: s.text },
+ selection: EditorSelection.cursor(s.from + s.text.length),
+ effects: setGhost.of(null),
+ userEvent: "input.complete",
+ scrollIntoView: true,
+ });
+ const doc = docOf(view);
+ if (s.command && doc && isTauri()) void call(commands.lspExecuteCommand(doc.doc, s.command)).catch(() => undefined);
+ return true;
+}
+
+export function dismissInline(view: EditorView): boolean {
+ if (!view.state.field(ghostField, false)) return false;
+ view.dispatch({ effects: setGhost.of(null) });
+ return true;
+}
+
+export function cycleInline(view: EditorView, dir: 1 | -1): boolean {
+ if (!view.state.field(ghostField, false)) return false;
+ view.dispatch({ effects: cycleGhost.of(dir) });
+ return true;
+}
+
+const VISIBLE = `editorTextFocus && ${CONTEXT_KEY}`;
+
+function onView(run: (view: EditorView) => unknown): Action["run"] {
+ return () => {
+ const view = activeEditor()?.view;
+ if (view) void run(view);
+ };
+}
+
+export function registerInlineCompletionActions(): () => void {
+ const shown = (id: string, title: string, run: (v: EditorView) => unknown): Action => ({
+ id,
+ title,
+ category: "Inline Completion",
+ when: VISIBLE,
+ run: onView(run),
+ });
+ return registerActions([
+ {
+ id: "editor.inlineCompletion.trigger",
+ title: "Call Inline Completion",
+ category: "Code",
+ when: "editorTextFocus",
+ keywords: ["ghost text", "inline suggestion"],
+ run: onView(async (v) => {
+ const doc = docOf(v);
+ if (!doc || !enabledFor(doc.language)) return showHint(v, "Inline completion is off for this language");
+ try {
+ if (!(await requestInline(v, false))) showHint(v, "No inline suggestions");
+ } catch (e) {
+ showHint(v, isUnavailable(e) ? "No language server provides inline completion" : String(e));
+ }
+ }),
+ },
+ shown("editor.inlineCompletion.accept", "Insert Inline Proposal", (v) => acceptInline(v)),
+ shown("editor.inlineCompletion.acceptWord", "Insert Inline Proposal: Next Word", (v) => acceptInline(v, true)),
+ shown("editor.inlineCompletion.dismiss", "Hide Inline Proposal", dismissInline),
+ shown("editor.inlineCompletion.next", "Show Next Inline Proposal", (v) => cycleInline(v, 1)),
+ shown("editor.inlineCompletion.previous", "Show Previous Inline Proposal", (v) => cycleInline(v, -1)),
+ ]);
+}
diff --git a/src/editor/lsp/intentions.ts b/src/editor/lsp/intentions.ts
index 82c5118c4..e11a0959b 100644
--- a/src/editor/lsp/intentions.ts
+++ b/src/editor/lsp/intentions.ts
@@ -17,6 +17,7 @@ import { editPreviewLines } from "./workspaceEdit";
import { serverBackoff } from "./availability";
import { iconNode } from "./iconMarkup";
import { editorPrefs } from "@/platform/editorSettings";
+import { spellingIntentions } from "./spelling";
const isQuickFix = (a: CodeAction) => !!a.kind && (a.kind === "quickfix" || a.kind.startsWith("quickfix."));
@@ -172,22 +173,29 @@ export async function intentionPreview(
/** ⌥↵ */
export async function showIntentions(view: EditorView) {
try {
- // Like IDEA, only applicable intentions are listed (servers also report disabled refactorings).
- const actions = await fetchIntentions(view);
- if (!actions.length) {
+ // Typo fixes come first and need no language server.
+ const local = spellingIntentions(view);
+ let actions: CodeAction[] = [];
+ try {
+ // Like IDEA, only applicable intentions are listed (servers also report disabled refactorings).
+ actions = await fetchIntentions(view);
+ } catch (e) {
+ if (!local.length) throw e;
+ }
+ if (!actions.length && !local.length) {
showHint(view, "No intentions available");
return;
}
const sorted = sortCodeActions(actions);
const resolved = new Map<CodeAction, Promise<CodeAction>>();
- const items = actionItems(view, sorted, resolved);
+ const items = [...local, ...actionItems(view, sorted, resolved)];
openPopup({
kind: "list",
anchor: caretAnchor(view, view.state.selection.main.head),
title: "Intentions",
items,
preview: (item, signal) => {
- const action = sorted[items.indexOf(item)];
+ const action = sorted[items.indexOf(item) - local.length];
return action ? intentionPreview(view, action, resolved, signal) : Promise.resolve(null);
},
});
@@ -291,18 +299,26 @@ const bulbPlugin = ViewPlugin.fromClass(
}
async run() {
const doc = docOf(this.view);
- if (!doc || doc.readOnly || serverBackoff.active(doc.doc) || !this.view.dom.isConnected) return;
+ if (!doc || doc.readOnly || !this.view.dom.isConnected) return;
const state = this.view.state;
- try {
- const actions = await fetchIntentions(this.view);
- if (this.view.state.doc !== state.doc || !this.view.state.selection.eq(state.selection)) return;
- const line = state.doc.lineAt(state.selection.main.head).number;
- this.view.dispatch({
- effects: setBulb.of(actions.length ? { line, quickFix: actions.some(isQuickFix) } : null),
- });
- } catch (e) {
- if (isUnavailable(e)) serverBackoff.mark(doc.doc);
+ const typoFix = spellingIntentions(this.view).length > 0;
+ const backoff = serverBackoff.active(doc.doc);
+ if (backoff && !typoFix) return;
+ let actions: CodeAction[] = [];
+ if (!backoff) {
+ try {
+ actions = await fetchIntentions(this.view);
+ } catch (e) {
+ if (isUnavailable(e)) serverBackoff.mark(doc.doc);
+ if (!typoFix) return;
+ }
}
+ if (this.view.state.doc !== state.doc || !this.view.state.selection.eq(state.selection)) return;
+ const line = state.doc.lineAt(state.selection.main.head).number;
+ const any = actions.length > 0 || typoFix;
+ this.view.dispatch({
+ effects: setBulb.of(any ? { line, quickFix: typoFix || actions.some(isQuickFix) } : null),
+ });
}
destroy() {
this.lookup.cancel();
diff --git a/src/editor/lsp/spelling.test.ts b/src/editor/lsp/spelling.test.ts
new file mode 100644
index 000000000..a654b0f59
--- /dev/null
+++ b/src/editor/lsp/spelling.test.ts
@@ -0,0 +1,101 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { EditorState, Text } from "@codemirror/state";
+import { EditorView } from "@codemirror/view";
+import type { Settings, Typo } from "@/bindings";
+
+const typos: Typo[] = [{ range: { start: { line: 0, col: 3 }, end: { line: 0, col: 9 } }, word: "mesage" }];
+const spellCheck = vi.fn(async () => ({ status: "ok" as const, data: typos }));
+const settingsSet = vi.fn(async (_scope: string, _key: string, value: string) => ({
+ status: "ok" as const,
+ data: { spelling: { ideWords: [], projectWords: JSON.parse(value), customDictionaries: [] } } as unknown as Settings,
+}));
+vi.mock("@/platform/ipc", async (orig) => {
+ const actual = await orig<typeof import("@/platform/ipc")>();
+ return {
+ ...actual,
+ isTauri: () => true,
+ commands: { ...actual.commands, spellCheck, settingsSet, cancelRequest: vi.fn(async () => {}) },
+ };
+});
+
+const { spellingExtension, spellingIntentions } = await import("./spelling");
+const { diagnosticsFor, toLintDiagnostics, diagnosticMarks } = await import("./diagnostics");
+const { lspDoc } = await import("./lsp");
+const { useProject } = await import("@/platform/project");
+
+const views: EditorView[] = [];
+afterEach(() => {
+ views.splice(0).forEach((v) => v.destroy());
+ useProject.setState({ project: null, settings: null });
+ vi.clearAllMocks();
+ vi.useRealTimers();
+});
+
+function editor(doc: string) {
+ const view = new EditorView({
+ state: EditorState.create({
+ doc,
+ extensions: [
+ lspDoc.of({ doc: 7, path: "/p/a.rs", language: "rust", uiMode: null, readOnly: false }),
+ spellingExtension(),
+ ],
+ }),
+ });
+ views.push(view);
+ return view;
+}
+
+async function settle() {
+ await vi.advanceTimersByTimeAsync(1000);
+}
+
+describe("Typo inspection", () => {
+ it("reports typos at the Typo level and offers fixes at the caret", async () => {
+ vi.useFakeTimers();
+ useProject.setState({ project: { root: "/p" } as never, settings: {} as never });
+ const view = editor("// mesage here");
+ await settle();
+ expect(spellCheck).toHaveBeenCalledWith(7, expect.any(Number));
+ const [diag] = diagnosticsFor("/p/a.rs");
+ expect(diag).toMatchObject({ message: "Typo: In word 'mesage'", severity: "info", typo: true });
+ const lint = toLintDiagnostics(view.state.doc, diagnosticsFor("/p/a.rs"));
+ expect(lint[0]!.markClass).toBe("cm-lsp-typo");
+ expect(diagnosticMarks(lint)).toEqual([]);
+
+ view.dispatch({ selection: { anchor: 5 } });
+ expect(spellingIntentions(view).map((i) => i.label)).toEqual([
+ "Typo: Change to…",
+ "Save 'mesage' to project-level dictionary",
+ "Save 'mesage' to application-level dictionary",
+ ]);
+ view.dispatch({ selection: { anchor: 12 } });
+ expect(spellingIntentions(view)).toEqual([]);
+
+ view.dispatch({ selection: { anchor: 5 } });
+ await spellingIntentions(view)[1]!.run();
+ expect(settingsSet).toHaveBeenCalledWith("project", "spelling.projectWords", JSON.stringify(["mesage"]));
+ // The dictionary change re-checks the file.
+ await settle();
+ expect(spellCheck).toHaveBeenCalledTimes(2);
+ });
+
+ it("does not run while the inspection is disabled", async () => {
+ vi.useFakeTimers();
+ useProject.setState({
+ settings: { inspections: { default: { "builtin:spelling": { enabled: false } } } } as never,
+ });
+ const view = editor("// mesage");
+ await settle();
+ expect(spellCheck).not.toHaveBeenCalled();
+ view.dispatch({ selection: { anchor: 5 } });
+ expect(spellingIntentions(view)).toEqual([]);
+ });
+
+ it("keeps lint conversion of plain info diagnostics unchanged", () => {
+ const doc = Text.of(["abc"]);
+ const out = toLintDiagnostics(doc, [
+ { range: { start: { line: 0, col: 0 }, end: { line: 0, col: 1 } }, severity: "info", message: "m", source: null, code: null },
+ ]);
+ expect(out[0]!.markClass).toBeUndefined();
+ });
+});
diff --git a/src/editor/lsp/spelling.ts b/src/editor/lsp/spelling.ts
new file mode 100644
index 000000000..cffb6f41c
--- /dev/null
+++ b/src/editor/lsp/spelling.ts
@@ -0,0 +1,202 @@
+/**
+ * Proofreading › Typo: misspelt words of comments, strings and declared names
+ * (the backend extracts and checks them off the UI thread), reported as
+ * diagnostics of the `spelling` producer at the Typo level, with the quick
+ * fixes "Change to…" and "Save 'word' to project / application dictionary".
+ */
+import { StateEffect, StateField, type EditorState, type Extension } from "@codemirror/state";
+import { EditorView, ViewPlugin } from "@codemirror/view";
+import { whenSynced } from "@/editor/api";
+import { call, commands, isCancelled, isTauri, nextRequestId, type RequestId } from "@/platform/ipc";
+import { useProject } from "@/platform/project";
+import { inspectionProfile, SPELLING_INSPECTION, SPELLING_PRODUCER } from "@/platform/inspections";
+import type { Settings } from "@/bindings";
+import { setFileDiagnostics } from "./diagnostics";
+import { docOf } from "./lsp";
+import { rangeToOffsets } from "./positions";
+import { showHint } from "./hint";
+import { caretAnchor, openPopup, type ListPopupItem } from "./popupStore";
+
+const CHECK_DELAY = 800;
+
+interface PlacedTypo {
+ from: number;
+ to: number;
+ word: string;
+}
+
+const setTypos = StateEffect.define<readonly PlacedTypo[]>();
+
+/** The last check's typos, mapped through later edits (for the quick fixes). */
+const typosField = StateField.define<readonly PlacedTypo[]>({
+ create: () => [],
+ update(typos, tr) {
+ for (const e of tr.effects) if (e.is(setTypos)) return e.value;
+ if (!tr.docChanged || !typos.length) return typos;
+ return typos
+ .map((t) => ({ ...t, from: tr.changes.mapPos(t.from, 1), to: tr.changes.mapPos(t.to, -1) }))
+ .filter((t) => t.to > t.from);
+ },
+});
+
+const spellingEnabled = () => inspectionProfile()[SPELLING_INSPECTION]?.enabled !== false;
+
+const spellingOf = (s: Settings | null) => s?.spelling;
+
+/** Lowercased words of the project and application dictionaries. */
+function dictionaryWords(level: "project" | "ide"): string[] {
+ const sp = spellingOf(useProject.getState().settings);
+ return [...((level === "project" ? sp?.projectWords : sp?.ideWords) ?? [])];
+}
+
+export async function saveToDictionary(word: string, level: "project" | "ide") {
+ const w = word.toLowerCase();
+ const list = dictionaryWords(level);
+ if (list.includes(w)) return;
+ const key = level === "project" ? "spelling.projectWords" : "spelling.ideWords";
+ const scope = level === "project" ? "project" : "global";
+ const settings = await call(commands.settingsSet(scope, key, JSON.stringify([...list, w].sort())));
+ useProject.setState({ settings });
+}
+
+function typoAt(state: EditorState, pos: number): PlacedTypo | undefined {
+ return state
+ .field(typosField, false)
+ ?.find((t) => t.from <= pos && pos <= t.to && state.sliceDoc(t.from, t.to) === t.word);
+}
+
+function replaceWord(view: EditorView, typo: PlacedTypo, replacement: string) {
+ if (view.state.sliceDoc(typo.from, typo.to) !== typo.word) return;
+ view.dispatch({
+ changes: { from: typo.from, to: typo.to, insert: replacement },
+ selection: { anchor: typo.from + replacement.length },
+ userEvent: "input.spelling",
+ });
+}
+
+async function changeTo(view: EditorView, typo: PlacedTypo) {
+ let suggestions: string[];
+ try {
+ suggestions = await call(commands.spellSuggest(typo.word));
+ } catch {
+ suggestions = [];
+ }
+ if (!suggestions.length) {
+ showHint(view, `No suggestions for '${typo.word}'`);
+ return;
+ }
+ openPopup({
+ kind: "list",
+ anchor: caretAnchor(view, typo.from),
+ title: `Change '${typo.word}' to`,
+ items: suggestions.map((s, i) => ({ id: `${i}`, label: s, run: () => replaceWord(view, typo, s) })),
+ });
+}
+
+/** Typo quick fixes at the caret (⌥↵), or none. */
+export function spellingIntentions(view: EditorView): ListPopupItem[] {
+ const doc = docOf(view);
+ const sel = view.state.selection.main;
+ if (!doc || doc.readOnly || !sel.empty || !spellingEnabled()) return [];
+ const typo = typoAt(view.state, sel.head);
+ if (!typo) return [];
+ const hasProject = !!useProject.getState().project;
+ return [
+ { id: "spelling.change", label: "Typo: Change to…", icon: "bulb-fix", emphasis: true, run: () => changeTo(view, typo) },
+ ...(hasProject
+ ? [
+ {
+ id: "spelling.saveProject",
+ label: `Save '${typo.word}' to project-level dictionary`,
+ icon: "bulb-fix",
+ run: () => saveToDictionary(typo.word, "project"),
+ },
+ ]
+ : []),
+ {
+ id: "spelling.saveIde",
+ label: `Save '${typo.word}' to application-level dictionary`,
+ icon: "bulb-fix",
+ run: () => saveToDictionary(typo.word, "ide"),
+ },
+ ];
+}
+
+/** Checks the file after edits (debounced), dictionary and profile changes. */
+export function spellingExtension(): Extension {
+ const plugin = ViewPlugin.define((view: EditorView) => {
+ const doc = docOf(view);
+ if (!doc || doc.virtual || !isTauri()) return {};
+ let timer: ReturnType<typeof setTimeout> | undefined;
+ let request: RequestId | null = null;
+ let seq = 0;
+ const cancel = () => {
+ if (request !== null) void commands.cancelRequest(request);
+ request = null;
+ };
+ const clear = () => {
+ setFileDiagnostics(doc.path, SPELLING_PRODUCER, []);
+ if (view.state.field(typosField).length) view.dispatch({ effects: setTypos.of([]) });
+ };
+ const run = async () => {
+ const mine = ++seq;
+ cancel();
+ if (!spellingEnabled()) {
+ clear();
+ return;
+ }
+ const id = nextRequestId();
+ request = id;
+ try {
+ await whenSynced(view);
+ if (mine !== seq) return;
+ const typos = await call(commands.spellCheck(doc.doc, id));
+ if (mine !== seq) return;
+ const text = view.state.doc;
+ setFileDiagnostics(
+ doc.path,
+ SPELLING_PRODUCER,
+ typos.map((t) => ({
+ range: t.range,
+ severity: "info",
+ message: `Typo: In word '${t.word}'`,
+ source: "Spelling",
+ code: null,
+ })),
+ );
+ const placed = typos.map((t) => ({ ...rangeToOffsets(text, t.range), word: t.word }));
+ view.dispatch({ effects: setTypos.of(placed) });
+ } catch (e) {
+ if (!isCancelled(e)) console.debug("[spelling]", e);
+ } finally {
+ if (request === id) request = null;
+ }
+ };
+ const schedule = (delay = CHECK_DELAY) => {
+ clearTimeout(timer);
+ timer = setTimeout(() => void run(), delay);
+ };
+ schedule(200);
+ let lastConfig = JSON.stringify([spellingOf(useProject.getState().settings), spellingEnabled()]);
+ const offSettings = useProject.subscribe((s, prev) => {
+ if (s.settings === prev.settings) return;
+ const next = JSON.stringify([spellingOf(s.settings), spellingEnabled()]);
+ if (next === lastConfig) return;
+ lastConfig = next;
+ schedule(0);
+ });
+ return {
+ update: (u) => {
+ if (u.docChanged) schedule();
+ },
+ destroy: () => {
+ clearTimeout(timer);
+ offSettings();
+ seq++;
+ cancel();
+ setFileDiagnostics(doc.path, SPELLING_PRODUCER, []);
+ },
+ };
+ });
+ return [typosField, plugin];
+}
diff --git a/src/editor/lsp/theme.ts b/src/editor/lsp/theme.ts
index d14aa914f..de719a2e8 100644
--- a/src/editor/lsp/theme.ts
+++ b/src/editor/lsp/theme.ts
@@ -152,7 +152,19 @@ export const lspTheme = EditorView.theme({
fontFamily: "var(--font-ui)",
fontSize: "var(--fs-small)",
whiteSpace: "nowrap",
+ gap: "12px",
+ justifyContent: "space-between",
},
+ ".cm-lsp-completion-sort": {
+ padding: "0",
+ border: "none",
+ background: "none",
+ color: "var(--fg-subtle)",
+ font: "inherit",
+ cursor: "pointer",
+ },
+ ".cm-lsp-completion-sort:hover": { color: "var(--fg)" },
+ '.cm-lsp-completion-sort[aria-pressed="true"]': { color: "var(--link)" },
".cm-tooltip.cm-completionInfo": {
...tooltipSurface,
padding: "8px 12px",
@@ -310,6 +322,8 @@ export const lspTheme = EditorView.theme({
},
// A part naming a declaration (⌘-click navigates there).
".cm-lsp-inlay-part:hover": { textDecoration: "underline", textUnderlineOffset: "2px" },
+ // Inline completion: the suggestion as gray text at the caret.
+ ".cm-inline-ghost": { color: "var(--fg-subtle)", whiteSpace: "pre" },
".cm-lsp-inlay-pl": { marginLeft: "4px" },
".cm-lsp-inlay-pr": { marginRight: "4px" },
diff --git a/src/editor/refactor/index.ts b/src/editor/refactor/index.ts
index 05e7775d1..822c7952d 100644
--- a/src/editor/refactor/index.ts
+++ b/src/editor/refactor/index.ts
@@ -4,5 +4,5 @@
* is not usable (see `@/editor/structure`).
*/
export { introduceFallback, type FallbackReason, type IntroduceKind } from "./introduce";
-export { refactorThis, runRefactoring } from "./refactorThis";
+export { refactorThis, runRefactoring, showNothingHere } from "./refactorThis";
export { askUsagesDetected, fileUsages, safeDelete, viewUsages, type FileUsages, type UsagesAnswer } from "./safeDelete";
diff --git a/src/editor/refactor/refactorThis.test.ts b/src/editor/refactor/refactorThis.test.ts
index bc0722fa4..280b603bb 100644
--- a/src/editor/refactor/refactorThis.test.ts
+++ b/src/editor/refactor/refactorThis.test.ts
@@ -188,8 +188,10 @@ describe("Refactor This", () => {
it("says so when nothing applies", async () => {
const v = editor();
await refactorThis(v, vi.fn());
- expect(useLspPopup.getState().popup).toBeNull();
- expect(showHint).toHaveBeenCalledWith(v, "No refactorings available at the caret");
+ expect(labels()).toEqual(["Nothing here"]);
+ const popup = useLspPopup.getState().popup as { items: { disabled?: string | null }[] };
+ expect(popup.items[0]!.disabled).toBeTruthy();
+ expect(showHint).not.toHaveBeenCalled();
});
it("cancels a superseded query and drops answers after the caret moved", async () => {
diff --git a/src/editor/refactor/refactorThis.ts b/src/editor/refactor/refactorThis.ts
index c421ae362..0e005fad5 100644
--- a/src/editor/refactor/refactorThis.ts
+++ b/src/editor/refactor/refactorThis.ts
@@ -261,8 +261,18 @@ export async function refactorThis(view: EditorView, rename: (view: EditorView)
// Superseded, or the caret moved / the text changed meanwhile: the answer is stale.
if (run.signal.aborted || view.state.doc !== state.doc || !view.state.selection.eq(state.selection)) return;
if (!items.length) {
- showHint(view, "No refactorings available at the caret");
+ showNothingHere(caretAnchor(view, state.selection.main.head));
return;
}
openPopup({ kind: "list", anchor: caretAnchor(view, state.selection.main.head), title: "Refactor This", items, numbered: true });
}
+
+/** IDEA's "Nothing here" popup: Refactor This where no refactoring applies (or outside an editor). */
+export function showNothingHere(anchor: { x: number; y: number } = { x: window.innerWidth / 2, y: window.innerHeight / 3 }) {
+ openPopup({
+ kind: "list",
+ anchor,
+ title: "Refactor This",
+ items: [{ id: "nothing", label: "Nothing here", disabled: "No refactoring applies here", run: () => {} }],
+ });
+}
diff --git a/src/features/analysis/AnalysisDialogs.tsx b/src/features/analysis/AnalysisDialogs.tsx
index 0f4fcd13d..91dcac9a3 100644
--- a/src/features/analysis/AnalysisDialogs.tsx
+++ b/src/features/analysis/AnalysisDialogs.tsx
@@ -8,12 +8,15 @@ import {
type StructuralFile,
type StructuralLanguage,
} from "@/platform/ipc";
-import { basename } from "@/platform/project";
-import { Checkbox, Dialog, Input, Select, Spinner, T } from "@/ui";
+import { executeAction } from "@/platform/actions";
+import { activeProfileId, listProfiles, validateInspections, type ProfileId } from "@/platform/inspections";
+import { basename, useProject } from "@/platform/project";
+import { Button, Checkbox, Dialog, Input, Select, Spinner, T } from "@/ui";
import { ScopeFields, openDialog } from "./dialogs";
import { locateDuplicates, loadDuplicateOptions } from "./duplicates";
import { runInspection } from "./inspect";
-import { defaultScope, type ScopeChoice } from "./scope";
+import { runCodeCleanup, type CleanupOptions } from "./cleanup";
+import { currentFile, defaultScope, type ScopeChoice } from "./scope";
import {
applyStructuralReplace,
buildReplaceEdit,
@@ -28,9 +31,21 @@ import styles from "./Analysis.module.css";
function InspectCodeDialog({ onClose }: { onClose: () => void }) {
const [scope, setScope] = useState<ScopeChoice>(() => defaultScope());
+ const [profile, setProfile] = useState<ProfileId>(activeProfileId);
+ const hasProject = useProject((s) => !!s.project);
+ const settings = useProject((s) => s.settings);
+ const profiles = useMemo(
+ () =>
+ listProfiles(validateInspections(settings?.inspections), hasProject).map((p) => ({
+ value: p.id,
+ label: p.label,
+ detail: p.level === "project" ? "Project" : "IDE",
+ })),
+ [hasProject, settings],
+ );
const ok = () => {
onClose();
- void runInspection(scope);
+ void runInspection(scope, profile);
};
return (
<Dialog
@@ -45,6 +60,24 @@ function InspectCodeDialog({ onClose }: { onClose: () => void }) {
>
<div className={styles.form}>
<ScopeFields name="inspect-scope" value={scope} onChange={setScope} />
+ <div className={styles.fieldRow}>
+ <span>
+ <T>Inspection profile:</T>
+ </span>
+ <Select
+ className={styles.grow}
+ aria-label="Inspection profile"
+ value={profile}
+ options={profiles}
+ onChange={setProfile}
+ />
+ <Button
+ aria-label="Configure inspections"
+ onClick={() => void executeAction("file.settings", "editor.inspections")}
+ >
+ …
+ </Button>
+ </div>
<div className={styles.hint}>
<T>Files are checked by their language servers; files without one are skipped.</T>
</div>
@@ -53,6 +86,53 @@ function InspectCodeDialog({ onClose }: { onClose: () => void }) {
);
}
+const CLEANUP_SCOPES = ["project", "directory", "file", "changed"] as const;
+
+function CodeCleanupDialog({ onClose }: { onClose: () => void }) {
+ const [scope, setScope] = useState<ScopeChoice>(() => defaultScope(currentFile() ? "file" : "project"));
+ const [options, setOptions] = useState<CleanupOptions>({ fixAll: true, optimizeImports: true, reformat: true });
+ const any = options.fixAll || options.optimizeImports || options.reformat;
+ const ok = () => {
+ if (!any) return;
+ onClose();
+ void runCodeCleanup(scope, options);
+ };
+ return (
+ <Dialog
+ open
+ title="Run Code Cleanup"
+ onClose={onClose}
+ width={440}
+ buttons={[
+ { label: "OK", role: "default", disabled: !any, onClick: ok },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <div className={styles.form}>
+ <ScopeFields name="cleanup-scope" value={scope} onChange={setScope} kinds={CLEANUP_SCOPES} />
+ <Checkbox
+ checked={options.fixAll}
+ onChange={(fixAll) => setOptions({ ...options, fixAll })}
+ label="Apply the language servers' automatic fixes"
+ />
+ <Checkbox
+ checked={options.optimizeImports}
+ onChange={(optimizeImports) => setOptions({ ...options, optimizeImports })}
+ label="Optimize imports"
+ />
+ <Checkbox
+ checked={options.reformat}
+ onChange={(reformat) => setOptions({ ...options, reformat })}
+ label="Reformat code"
+ />
+ <div className={styles.hint}>
+ <T>Files are cleaned up by their language servers and saved; files without one are skipped.</T>
+ </div>
+ </div>
+ </Dialog>
+ );
+}
+
function DuplicatesDialog({ onClose }: { onClose: () => void }) {
const [scope, setScope] = useState<ScopeChoice>(() => defaultScope());
const [options, setOptions] = useState<DuplicateOptions>(loadDuplicateOptions);
@@ -303,6 +383,7 @@ function ReplacePreviewDialog({ files, onClose }: { files: StructuralFile[]; onC
export const showInspectCodeDialog = () => openDialog((close) => <InspectCodeDialog onClose={close} />);
export const showDuplicatesDialog = () => openDialog((close) => <DuplicatesDialog onClose={close} />);
+export const showCodeCleanupDialog = () => openDialog((close) => <CodeCleanupDialog onClose={close} />);
export const showStructuralDialog = (replace: boolean) =>
openDialog((close) => <StructuralDialog replace={replace} onClose={close} />);
export const showReplacePreview = (files: StructuralFile[]) =>
diff --git a/src/features/analysis/analysis.test.ts b/src/features/analysis/analysis.test.ts
index c783b2a70..76320027f 100644
--- a/src/features/analysis/analysis.test.ts
+++ b/src/features/analysis/analysis.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from "vitest";
import type { Diagnostic, StructuralFile } from "@/platform/ipc";
+import { useCustomScopes } from "@/platform/search";
import { fragmentLines } from "./duplicates";
import { groupInspection, kindOf } from "./inspect";
import { buildInspectionNodes } from "./InspectionView";
@@ -149,6 +150,13 @@ describe("analysis scopes and fragments", () => {
expect(await resolveScope({ kind: "directory", directory: "" })).toBe("Choose a directory");
expect(await resolveScope({ kind: "file", directory: "" })).toBe("No file is open");
expect(await resolveScope({ kind: "changed", directory: "" })).toBe("There are no uncommitted files");
+ expect(await resolveScope({ kind: "custom", directory: "" })).toBe("Choose a scope");
+ useCustomScopes.setState({ root: null, scopes: [{ name: "Src", pattern: "file:src//*" }] });
+ expect(await resolveScope({ kind: "custom", directory: "", custom: "Src" })).toEqual({
+ kind: "pattern",
+ pattern: "file:src//*",
+ });
+ useCustomScopes.setState({ root: null, scopes: [] });
});
it("numbers fragment lines from the fragment's first line", () => {
diff --git a/src/features/analysis/cleanup.ts b/src/features/analysis/cleanup.ts
new file mode 100644
index 000000000..22e52d76c
--- /dev/null
+++ b/src/features/analysis/cleanup.ts
@@ -0,0 +1,136 @@
+/**
+ * Code › Code Cleanup…: the language servers' fix-all, organize imports and
+ * reformat over a scope, one file after another (opened, cleaned, saved; tabs
+ * opened only for the cleanup are closed again). Cancellable from the
+ * Background Tasks popup.
+ */
+import { executeAction } from "@/platform/actions";
+import { call, commands, isTauri, type FileEntry } from "@/platform/ipc";
+import { useProject } from "@/platform/project";
+import { maybeEditorService, notifications } from "@/workbench/contributions";
+import { confirm } from "@/workbench/messages";
+import { removeTask, upsertTask } from "@/workbench/tasks";
+import { changedFiles, currentFile, type ScopeChoice } from "./scope";
+
+export interface CleanupOptions {
+ fixAll: boolean;
+ optimizeImports: boolean;
+ reformat: boolean;
+}
+
+/** Above this many files the user confirms first. */
+const CONFIRM_ABOVE = 100;
+
+const extOf = (path: string) => {
+ const name = path.slice(path.lastIndexOf("/") + 1);
+ const i = name.lastIndexOf(".");
+ return i > 0 ? name.slice(i + 1).toLowerCase() : "";
+};
+
+/** Extensions of languages that have a language server (the only files a cleanup can change). */
+async function serverExtensions(): Promise<Set<string>> {
+ const out = new Set<string>();
+ for (const l of await commands.languages())
+ if (l.languageServers?.length) for (const e of l.extensions) out.add(e.replace(/^\./, "").toLowerCase());
+ return out;
+}
+
+/** Files under `dir`, skipping ignored, excluded and hidden entries and symlinks. */
+export async function walkFiles(
+ dir: string,
+ readDir: (path: string) => Promise<FileEntry[]>,
+ accept: (path: string) => boolean,
+ limit = 5000,
+): Promise<string[]> {
+ const out: string[] = [];
+ const queue = [dir];
+ while (queue.length && out.length < limit) {
+ let entries: FileEntry[];
+ try {
+ entries = await readDir(queue.shift()!);
+ } catch {
+ continue;
+ }
+ for (const e of entries) {
+ if (e.ignored || e.excluded || e.hidden || e.kind === "symlink") continue;
+ if (e.kind === "dir") queue.push(e.path);
+ else if (accept(e.path)) out.push(e.path);
+ }
+ }
+ return out.sort();
+}
+
+/** The files of `choice` a cleanup applies to, or a message why there are none. */
+export async function cleanupFiles(choice: ScopeChoice): Promise<string[] | string> {
+ const root = useProject.getState().project?.root;
+ if (!root) return "No project is open";
+ const exts = await serverExtensions();
+ const accept = (p: string) => exts.has(extOf(p));
+ const readDir = (p: string) => call(commands.fsReadDir(p));
+ let files: string[];
+ switch (choice.kind) {
+ case "file": {
+ const f = currentFile();
+ files = f ? [f] : [];
+ break;
+ }
+ case "changed":
+ files = (await changedFiles()).filter(accept);
+ break;
+ case "directory":
+ files = choice.directory.trim() ? await walkFiles(choice.directory.trim(), readDir, accept) : [];
+ break;
+ default:
+ files = await walkFiles(root, readDir, accept);
+ }
+ return files.length ? files : "No files with a language server in this scope";
+}
+
+let running: { cancelled: boolean } | null = null;
+
+export async function runCodeCleanup(choice: ScopeChoice, options: CleanupOptions): Promise<void> {
+ if (!isTauri() || running) return;
+ const files = await cleanupFiles(choice);
+ if (typeof files === "string") {
+ notifications().notify({ group: "analysis", level: "warning", title: "Code Cleanup", body: files, key: "code.cleanup" });
+ return;
+ }
+ if (
+ files.length > CONFIRM_ABOVE &&
+ !(await confirm({ title: "Code Cleanup", message: `Clean up ${files.length} files?`, ok: "Clean Up" }))
+ )
+ return;
+ const editors = maybeEditorService();
+ const wasOpen = new Set(editors?.openPaths?.() ?? []);
+ const run: { cancelled: boolean } = { cancelled: false };
+ running = run;
+ const id = "code.cleanup";
+ let done = 0;
+ try {
+ for (const path of files) {
+ if (run.cancelled) break;
+ upsertTask({
+ id,
+ title: "Code Cleanup",
+ message: path.slice(path.lastIndexOf("/") + 1),
+ fraction: done / files.length,
+ done: false,
+ cancel: () => (run.cancelled = true),
+ });
+ await executeAction("code.cleanupFile", { path, ...options });
+ await editors?.saveAll();
+ if (!wasOpen.has(path)) editors?.closePath?.(path);
+ done++;
+ }
+ } finally {
+ running = null;
+ upsertTask({ id, title: "Code Cleanup", message: null, fraction: 1, done: true });
+ if (run.cancelled) removeTask(id);
+ }
+ notifications().notify({
+ group: "analysis",
+ level: "info",
+ title: run.cancelled ? `Code Cleanup cancelled after ${done} of ${files.length} files` : `Code Cleanup processed ${done} files`,
+ key: "code.cleanup",
+ });
+}
diff --git a/src/features/analysis/dialogs.tsx b/src/features/analysis/dialogs.tsx
index b56039143..5006b728a 100644
--- a/src/features/analysis/dialogs.tsx
+++ b/src/features/analysis/dialogs.tsx
@@ -1,8 +1,10 @@
/** Dialog stack of the analysis feature and the shared "Specify Scope" fields. */
import { Fragment, type ReactNode } from "react";
import { create } from "zustand";
+import { executeAction } from "@/platform/actions";
import { isTauri } from "@/platform/ipc";
-import { Button, Input, T } from "@/ui";
+import { EDIT_SCOPES_ACTION, useCustomScopeList } from "@/platform/search";
+import { Button, IconButton, Input, Select, T } from "@/ui";
import { SCOPE_LABELS, currentFile, type ScopeChoice, type ScopeKind } from "./scope";
import styles from "./Analysis.module.css";
@@ -42,32 +44,38 @@ async function browseDirectory(initial: string): Promise<string | null> {
return typeof picked === "string" ? picked : null;
}
-const KINDS: ScopeKind[] = ["project", "directory", "file", "changed"];
+const KINDS: ScopeKind[] = ["project", "directory", "file", "changed", "custom"];
/** IDEA's "Specify Scope" radio group. */
export function ScopeFields({
value,
onChange,
name,
+ kinds = KINDS,
}: {
value: ScopeChoice;
onChange: (v: ScopeChoice) => void;
name: string;
+ /** The choices offered (default: all). */
+ kinds?: readonly ScopeKind[];
}) {
const file = currentFile();
+ const scopes = useCustomScopeList();
return (
<fieldset className={styles.scope}>
<legend className={styles.fieldLabel}>
<T>Scope</T>
</legend>
- {KINDS.map((kind) => (
+ {kinds.map((kind) => (
<label key={kind} className={styles.radioRow}>
<input
type="radio"
name={name}
checked={value.kind === kind}
disabled={kind === "file" && !file}
- onChange={() => onChange({ ...value, kind })}
+ onChange={() =>
+ onChange({ ...value, kind, custom: kind === "custom" ? (value.custom ?? scopes[0]?.name) : value.custom })
+ }
/>
<span>{kind === "file" && file ? `File '${file.split("/").pop()}'` : SCOPE_LABELS[kind]}</span>
</label>
@@ -87,6 +95,23 @@ export function ScopeFields({
</Button>
</div>
)}
+ {value.kind === "custom" && (
+ <div className={styles.dirRow}>
+ <Select<string>
+ className={styles.grow}
+ value={value.custom ?? null}
+ options={scopes.map((s) => ({ value: s.name, label: s.name, detail: s.pattern }))}
+ placeholder="No custom scopes"
+ onChange={(custom) => onChange({ ...value, custom })}
+ aria-label="Custom scope"
+ />
+ <IconButton
+ icon="more-horizontal"
+ title="Edit Scopes…"
+ onClick={() => void executeAction(EDIT_SCOPES_ACTION, value.custom ? { select: value.custom } : undefined)}
+ />
+ </div>
+ )}
</fieldset>
);
}
diff --git a/src/features/analysis/index.ts b/src/features/analysis/index.ts
index aa0116bdc..9be7b7951 100644
--- a/src/features/analysis/index.ts
+++ b/src/features/analysis/index.ts
@@ -5,7 +5,7 @@
import { registerActions } from "@/platform/actions";
import { useProject } from "@/platform/project";
import { registerOverlay, registerToolWindow } from "@/workbench/contributions";
-import { showDuplicatesDialog, showInspectCodeDialog, showStructuralDialog } from "./AnalysisDialogs";
+import { showCodeCleanupDialog, showDuplicatesDialog, showInspectCodeDialog, showStructuralDialog } from "./AnalysisDialogs";
import { AnalysisDialogHost } from "./dialogs";
import { resetDuplicates } from "./duplicates";
import { DuplicatesHeaderActions, DuplicatesView } from "./DuplicatesView";
@@ -51,6 +51,14 @@ export function activate(): () => void {
keywords: ["inspection", "analyze", "diagnostics", "problems"],
run: () => void showInspectCodeDialog(),
},
+ {
+ id: "code.cleanup",
+ title: "Code Cleanup…",
+ category: "Code",
+ when: "projectOpen",
+ keywords: ["fix all", "cleanup", "organize imports", "reformat"],
+ run: () => void showCodeCleanupDialog(),
+ },
{
id: "analyze.locateDuplicates",
title: "Locate Duplicates…",
diff --git a/src/features/analysis/inspect.ts b/src/features/analysis/inspect.ts
index 505aa4348..96100e72b 100644
--- a/src/features/analysis/inspect.ts
+++ b/src/features/analysis/inspect.ts
@@ -14,6 +14,14 @@ import {
type InspectSummary,
type RequestId,
} from "@/platform/ipc";
+import {
+ activeProfileId,
+ applyProfileMixed,
+ noteDiagnosticCodes,
+ producerOf,
+ profileOverrides,
+ type ProfileId,
+} from "@/platform/inspections";
import { notifications, toolWindowService } from "@/workbench/contributions";
import { describeScope, resolveScope, type ScopeChoice } from "./scope";
@@ -99,6 +107,8 @@ interface InspectState {
error: string | null;
/** Scope of the last run (Rerun). */
last: ScopeChoice | null;
+ /** Inspection profile of the last run. */
+ profile: ProfileId | null;
/** Problems excluded from the results (⌫), by `problemId`. */
excluded: ReadonlySet<string>;
}
@@ -112,6 +122,7 @@ const initialInspection = (): InspectState => ({
scopeLabel: null,
error: null,
last: null,
+ profile: null,
excluded: new Set(),
});
@@ -144,7 +155,8 @@ export function resetInspection() {
useInspection.setState(initialInspection());
}
-export async function runInspection(choice: ScopeChoice): Promise<void> {
+/** Inspect Code over `choice` with `profileId` (default: the profile in effect). */
+export async function runInspection(choice: ScopeChoice, profileId: ProfileId = activeProfileId()): Promise<void> {
const scope = await resolveScope(choice);
if (typeof scope === "string") {
notifications().notify({ group: "analysis", level: "warning", title: "Inspect Code", body: scope });
@@ -162,8 +174,10 @@ export async function runInspection(choice: ScopeChoice): Promise<void> {
error: null,
scopeLabel: describeScope(choice, scope),
last: choice,
+ profile: profileId,
excluded: new Set(),
});
+ const profile = profileOverrides(profileId);
toolWindowService().show("inspection");
if (!isTauri()) {
useInspection.setState({ running: false, error: "Inspect Code needs the desktop app" });
@@ -182,15 +196,23 @@ export async function runInspection(choice: ScopeChoice): Promise<void> {
case "started":
useInspection.setState({ total: ev.total });
break;
- case "file":
- if (ev.file.diagnostics.length) found.set(ev.file.path, ev.file);
+ case "file": {
+ const diagnostics = applyProfileMixed(profile, ev.file.diagnostics);
+ for (const d of ev.file.diagnostics) if (d.code) noteDiagnosticCodes(producerOf(d), [d]);
+ if (diagnostics.length) found.set(ev.file.path, { ...ev.file, diagnostics });
useInspection.setState({ done: ev.done });
flush ??= setTimeout(publish, 150);
break;
+ }
case "done":
if (flush) clearTimeout(flush);
inflight = null;
- useInspection.setState({ running: false, files: new Map(found), summary: ev.summary });
+ useInspection.setState({
+ running: false,
+ files: new Map(found),
+ // Problems the profile kept, not all the servers reported.
+ summary: { ...ev.summary, problems: [...found.values()].reduce((n, f) => n + f.diagnostics.length, 0) },
+ });
break;
}
};
@@ -205,6 +227,6 @@ export async function runInspection(choice: ScopeChoice): Promise<void> {
}
export function rerunInspection() {
- const last = useInspection.getState().last;
- if (last) void runInspection(last);
+ const { last, profile } = useInspection.getState();
+ if (last) void runInspection(last, profile ?? undefined);
}
diff --git a/src/features/analysis/scope.ts b/src/features/analysis/scope.ts
index c1f58efdd..723a667df 100644
--- a/src/features/analysis/scope.ts
+++ b/src/features/analysis/scope.ts
@@ -5,13 +5,16 @@
import { activeEditor } from "@/editor/api";
import { call, commands, isTauri, type SearchScope } from "@/platform/ipc";
import { useProject } from "@/platform/project";
+import { findCustomScope } from "@/platform/search";
-export type ScopeKind = "project" | "directory" | "file" | "changed";
+export type ScopeKind = "project" | "directory" | "file" | "changed" | "custom";
export interface ScopeChoice {
kind: ScopeKind;
/** Absolute directory for `directory`. */
directory: string;
+ /** Name of the custom scope for `custom` (`@/platform/search`). */
+ custom?: string;
}
export const SCOPE_LABELS: Record<ScopeKind, string> = {
@@ -19,6 +22,7 @@ export const SCOPE_LABELS: Record<ScopeKind, string> = {
directory: "Module or directory",
file: "Current file",
changed: "Uncommitted files",
+ custom: "Custom scope",
};
/** The file of the active editor, if it is a real file. */
@@ -66,6 +70,10 @@ export async function resolveScope(choice: ScopeChoice): Promise<SearchScope | s
}
return paths.length ? { kind: "files", paths } : "There are no uncommitted files";
}
+ case "custom": {
+ const scope = choice.custom ? findCustomScope(choice.custom) : null;
+ return scope ? { kind: "pattern", pattern: scope.pattern } : "Choose a scope";
+ }
}
}
@@ -84,5 +92,7 @@ export function describeScope(choice: ScopeChoice, scope: SearchScope): string {
return scope.kind === "files"
? `${scope.paths.length} uncommitted file${scope.paths.length === 1 ? "" : "s"}`
: "Uncommitted files";
+ case "custom":
+ return `Scope '${choice.custom ?? ""}'`;
}
}
diff --git a/src/features/app/NewProject.tsx b/src/features/app/NewProject.tsx
new file mode 100644
index 000000000..09035805f
--- /dev/null
+++ b/src/features/app/NewProject.tsx
@@ -0,0 +1,146 @@
+/**
+ * File › New Project…: an empty project folder (no framework templates),
+ * optionally a Git repository, opened in a new window (this one when it has
+ * no project).
+ */
+import { useEffect, useState } from "react";
+import { create } from "zustand";
+import { call, commands, isTauri } from "@/platform/ipc";
+import { useProject } from "@/platform/project";
+import { useTxTemplate } from "@/platform/i18n";
+import { Button, Checkbox, Dialog, Input, T } from "@/ui";
+import { defaultProjectDirectory, openProjectInWindow } from "./windows";
+import styles from "./app.module.css";
+
+const useNewProject = create<{ open: boolean }>(() => ({ open: false }));
+export const showNewProject = () => useNewProject.setState({ open: true });
+
+export function NewProjectOverlay() {
+ const open = useNewProject((s) => s.open);
+ return open ? <NewProjectDialog onClose={() => useNewProject.setState({ open: false })} /> : null;
+}
+
+/** Why `name` cannot be a project folder name, or null. */
+export function projectNameError(name: string): string | null {
+ const n = name.trim();
+ if (!n) return "Enter a project name";
+ if (/[/\\:*?"<>|]/.test(n) || n === "." || n === "..") return "The name contains characters a folder name cannot have";
+ return null;
+}
+
+export function joinPath(dir: string, name: string): string {
+ const sep = dir.includes("\\") && !dir.includes("/") ? "\\" : "/";
+ return dir.endsWith("/") || dir.endsWith("\\") ? `${dir}${name.trim()}` : `${dir}${sep}${name.trim()}`;
+}
+
+function errorText(e: unknown) {
+ return e instanceof Error ? e.message : String(e);
+}
+
+/** Creates `path` (or reuses it when it is an empty folder) and runs `git init` when asked. */
+export async function createProjectFolder(path: string, gitInit: boolean): Promise<void> {
+ let entries: unknown[] | null;
+ try {
+ entries = await call(commands.fsReadDir(path));
+ } catch {
+ entries = null;
+ }
+ if (entries && entries.length) throw new Error(`${path} already exists and is not empty`);
+ if (!entries) await call(commands.fsCreateDir(path));
+ if (gitInit) await call(commands.vcsInit(path));
+}
+
+/** Default Project Directory, else the parent of the open project. */
+function initialLocation(): string {
+ const preset = defaultProjectDirectory();
+ if (preset) return preset;
+ const root = useProject.getState().project?.root;
+ return root ? root.slice(0, Math.max(root.lastIndexOf("/"), 1)) : "";
+}
+
+function NewProjectDialog({ onClose }: { onClose: () => void }) {
+ const [name, setName] = useState("untitled");
+ const [location, setLocation] = useState(initialLocation);
+ const [git, setGit] = useState(true);
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const txTemplate = useTxTemplate();
+
+ useEffect(() => {
+ if (initialLocation()) return;
+ // Otherwise the user's home.
+ void import("@tauri-apps/api/path")
+ .then((p) => p.homeDir())
+ .then(setLocation)
+ .catch(() => {});
+ }, []);
+
+ const nameError = projectNameError(name);
+ const invalid = !!nameError || !location.trim();
+ const path = location.trim() && !nameError ? joinPath(location.trim(), name) : "";
+
+ const browse = async () => {
+ if (!isTauri()) return;
+ const { open } = await import("@tauri-apps/plugin-dialog");
+ const picked = await open({ directory: true, multiple: false, title: "Project Location", defaultPath: location || undefined });
+ const dir = Array.isArray(picked) ? picked[0] : picked;
+ if (dir) setLocation(dir);
+ };
+
+ const create = async () => {
+ if (invalid || busy) return;
+ setBusy(true);
+ setError(null);
+ try {
+ await createProjectFolder(path, git);
+ } catch (e) {
+ setBusy(false);
+ setError(errorText(e));
+ return;
+ }
+ onClose();
+ await openProjectInWindow(path, useProject.getState().project !== null);
+ };
+
+ return (
+ <Dialog
+ open
+ title="New Project"
+ onClose={onClose}
+ width={520}
+ buttons={[
+ { label: "Create", role: "default", disabled: invalid || busy, onClick: () => void create() },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <form
+ className={styles.newProject}
+ onSubmit={(e) => {
+ e.preventDefault();
+ void create();
+ }}
+ >
+ <label className={styles.newProjectRow}>
+ <span className={styles.newProjectLabel}>
+ <T>Name:</T>
+ </span>
+ <Input data-autofocus value={name} invalid={!!nameError} onChange={(e) => setName(e.target.value)} aria-label="Name" />
+ </label>
+ <div className={styles.newProjectRow}>
+ <span className={styles.newProjectLabel}>
+ <T>Location:</T>
+ </span>
+ <Input value={location} onChange={(e) => setLocation(e.target.value)} aria-label="Location" />
+ <Button onClick={() => void browse()} disabled={!isTauri()}>
+ <T>Browse…</T>
+ </Button>
+ </div>
+ <div className={styles.newProjectHint}>
+ {nameError ? txTemplate(nameError) : path && txTemplate(`Project will be created in: ${path}`)}
+ </div>
+ <Checkbox checked={git} onChange={setGit} label="Create Git repository" />
+ {error && <div className={styles.newProjectError}>{txTemplate(error)}</div>}
+ </form>
+ </Dialog>
+ );
+}
diff --git a/src/features/app/__tests__/menuBridge.test.ts b/src/features/app/__tests__/menuBridge.test.ts
index 546b60d4a..c4530f332 100644
--- a/src/features/app/__tests__/menuBridge.test.ts
+++ b/src/features/app/__tests__/menuBridge.test.ts
@@ -3,7 +3,65 @@ import { registerAction } from "@/platform/actions";
import { _resetI18nForTests, setLocale } from "@/platform/i18n";
import { useKeymap } from "@/platform/keymap";
import { resetDistractionFree, setDistractionFree } from "@/workbench/distractionFree";
-import { buildMenuConfig, menuShortcut, routeMenuEvent } from "../menuBridge";
+import { registerToolWindow } from "@/workbench/contributions";
+import { _reloadLayouts, saveLayout } from "@/workbench/toolwindows/layouts";
+import { setContext } from "@/platform/context";
+import {
+ buildMenuConfig,
+ disabledMenuActions,
+ dynamicMenuItems,
+ menuActionIds,
+ menuShortcut,
+ routeMenuEvent,
+} from "../menuBridge";
+
+describe("menu state from the frontend", () => {
+ it("lists registered tool windows by title and saved layouts", () => {
+ localStorage.clear();
+ _reloadLayouts();
+ const offs = [
+ registerToolWindow({ id: "zeta", title: "Terminal", icon: "terminal", anchor: "bottom", component: () => null }),
+ registerToolWindow({ id: "alpha", title: "Problems", icon: "problems", anchor: "bottom", component: () => null }),
+ ];
+ saveLayout("Review");
+ const dyn = dynamicMenuItems();
+ expect(dyn.toolWindows!.map((i) => [i.action, i.label])).toEqual([
+ ["toolwindow.alpha", "Problems"],
+ ["toolwindow.zeta", "Terminal"],
+ ]);
+ expect(dyn.toolWindowLayouts).toEqual([{ action: "layout.restore", arg: "Review", label: "Review" }]);
+ expect(buildMenuConfig("macos").dynamic).toEqual(dyn);
+ offs.forEach((d) => d());
+ localStorage.clear();
+ _reloadLayouts();
+ });
+
+ it("disables the registered actions that cannot run now", () => {
+ const offs = [
+ registerAction({ id: "test.menu.always", title: "A", run: () => {} }),
+ registerAction({ id: "test.menu.whenEditor", title: "B", when: "testMenuEditor", run: () => {} }),
+ ];
+ const ids = menuActionIds([
+ {
+ kind: "submenu",
+ id: "x",
+ label: "X",
+ children: [
+ { kind: "action", id: "test.menu.whenEditor", label: "B", hint: null, arg: null },
+ { kind: "action", id: "test.menu.always", label: "A", hint: null, arg: null },
+ ],
+ },
+ { kind: "action", id: "not.registered", label: "C", hint: null, arg: null },
+ ]);
+ expect([...ids].sort()).toEqual(["not.registered", "test.menu.always", "test.menu.whenEditor"]);
+ // Unregistered ids stay enabled: the action may register later (lazy features).
+ expect(disabledMenuActions(ids)).toEqual(["test.menu.whenEditor"]);
+ setContext("testMenuEditor", true);
+ expect(disabledMenuActions(ids)).toEqual([]);
+ setContext("testMenuEditor", false);
+ offs.forEach((d) => d());
+ });
+});
afterEach(() => {
_resetI18nForTests();
diff --git a/src/features/app/__tests__/newProject.test.ts b/src/features/app/__tests__/newProject.test.ts
new file mode 100644
index 000000000..abbeb6adc
--- /dev/null
+++ b/src/features/app/__tests__/newProject.test.ts
@@ -0,0 +1,36 @@
+import { describe, expect, it } from "vitest";
+import { joinPath, projectNameError } from "../NewProject";
+import { exportedStorage } from "../projectActions";
+
+describe("File › New Project…", () => {
+ it("validates the folder name", () => {
+ expect(projectNameError("demo")).toBeNull();
+ expect(projectNameError(" ")).toBe("Enter a project name");
+ expect(projectNameError("a/b")).not.toBeNull();
+ expect(projectNameError("..")).not.toBeNull();
+ });
+
+ it("joins the location and name with the location's separator", () => {
+ expect(joinPath("/Users/me/Projects", " demo ")).toBe("/Users/me/Projects/demo");
+ expect(joinPath("/Users/me/", "demo")).toBe("/Users/me/demo");
+ expect(joinPath("C:\\Users\\me", "demo")).toBe("C:\\Users\\me\\demo");
+ });
+});
+
+describe("Manage IDE Settings › Export Settings…", () => {
+ it("exports templates, macros and layouts, not per-project state", () => {
+ const data: Record<string, string> = {
+ "openidea.liveTemplates.v1": "[]",
+ "openidea.macros.v1": "{}",
+ "openidea.toolWindowLayouts.v1": "{}",
+ "openidea.runAnything.history.v1:/p": "[]",
+ };
+ const keys = Object.keys(data);
+ const storage = { length: keys.length, key: (i: number) => keys[i] ?? null, getItem: (k: string) => data[k] ?? null };
+ expect(Object.keys(exportedStorage(storage)).sort()).toEqual([
+ "openidea.liveTemplates.v1",
+ "openidea.macros.v1",
+ "openidea.toolWindowLayouts.v1",
+ ]);
+ });
+});
diff --git a/src/features/app/app.module.css b/src/features/app/app.module.css
index 30c501584..e62740c74 100644
--- a/src/features/app/app.module.css
+++ b/src/features/app/app.module.css
@@ -180,3 +180,37 @@
margin: 4px 0 0;
color: var(--fg-weak-warning);
}
+
+/* File › New Project… */
+.newProject {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ padding: 16px;
+}
+.newProjectRow {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+.newProjectRow > :nth-child(2) {
+ flex: 1;
+ min-width: 0;
+}
+.newProjectLabel {
+ flex: none;
+ width: 72px;
+ color: var(--fg);
+}
+.newProjectHint {
+ min-height: 1.5em;
+ padding-left: 80px;
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+ overflow-wrap: anywhere;
+}
+.newProjectError {
+ color: var(--danger);
+ font-size: var(--fs-small);
+ overflow-wrap: anywhere;
+}
diff --git a/src/features/app/index.ts b/src/features/app/index.ts
index 999d9f8e1..e40f925dc 100644
--- a/src/features/app/index.ts
+++ b/src/features/app/index.ts
@@ -11,6 +11,8 @@ import { buildInfo } from "./host";
import { KeymapReferenceOverlay } from "./KeymapReference";
import { installLocaleSync, registerLocalizedActions } from "./locale";
import { installMenuBridge } from "./menuBridge";
+import { NewProjectOverlay } from "./NewProject";
+import { projectActions, registerPowerSaveBanner } from "./projectActions";
import { installWindowTitle } from "./title";
import { installLaunchHandling, windowActions } from "./windows";
@@ -24,6 +26,9 @@ export function activate(): () => void {
registerOverlay({ id: "app.about", component: AboutOverlay }),
registerOverlay({ id: "app.keymapReference", component: KeymapReferenceOverlay }),
registerOverlay({ id: "app.invalidateCaches", component: InvalidateCachesOverlay }),
+ registerOverlay({ id: "app.newProject", component: NewProjectOverlay }),
+ registerLocalizedActions(projectActions),
+ registerPowerSaveBanner(),
registerInvalidateCachesActions(),
installMenuBridge(),
installWindowTitle(),
diff --git a/src/features/app/menuBridge.ts b/src/features/app/menuBridge.ts
index 074f7e061..4d0b5332b 100644
--- a/src/features/app/menuBridge.ts
+++ b/src/features/app/menuBridge.ts
@@ -7,12 +7,15 @@
* shortcut text of every keymap binding, so the menu shows the JS keymap's
* shortcuts without registering native accelerators (see src-tauri/src/menu.rs).
*/
-import { executeAction } from "@/platform/actions";
-import { keysWithPrefix, t, useI18n } from "@/platform/i18n";
-import { commands, isTauri, type MenuConfig } from "@/platform/ipc";
+import { executeAction, getAction, isActionEnabled, useActions } from "@/platform/actions";
+import { useContextKeys } from "@/platform/context";
+import { keysWithPrefix, t, tx, useI18n } from "@/platform/i18n";
+import { commands, isTauri, type DynamicItem, type MenuConfig, type MenuNode } from "@/platform/ipc";
import { bindingsFor, effectiveBindings, formatBinding, useKeymap } from "@/platform/keymap";
import { useProject } from "@/platform/project";
+import { useContributions } from "@/workbench/contributions";
import { isDistractionFree, useDistractionFree } from "@/workbench/distractionFree";
+import { useToolWindowLayouts } from "@/workbench/toolwindows/layouts";
import { hostOs, type HostOs } from "./host";
export const MENU_EVENT = "openidea://menu";
@@ -48,7 +51,37 @@ export function buildMenuConfig(os: HostOs): MenuConfig {
const first = bindingsFor(id)[0];
if (first) shortcuts[id] = menuShortcut(first, os);
}
- return { locale: useI18n.getState().locale, labels, shortcuts };
+ return { locale: useI18n.getState().locale, labels, shortcuts, dynamic: dynamicMenuItems() };
+}
+
+/** View › Tool Windows (every registered window, by title) and Window › Tool Window Layouts. */
+export function dynamicMenuItems(): Record<string, DynamicItem[]> {
+ const toolWindows = [...useContributions.getState().toolWindows.values()]
+ .map((tw) => ({ action: `toolwindow.${tw.id}`, arg: null, label: tx(tw.title) ?? tw.title }))
+ .sort((a, b) => a.label.localeCompare(b.label));
+ const layouts = useToolWindowLayouts
+ .getState()
+ .layouts.map((l) => ({ action: "layout.restore", arg: l.name, label: l.name }));
+ return { toolWindows, toolWindowLayouts: layouts };
+}
+
+/** Action ids of every IDE item in a menu model. */
+export function menuActionIds(nodes: readonly MenuNode[], out = new Set<string>()): Set<string> {
+ for (const n of nodes) {
+ if (n.kind === "submenu") menuActionIds(n.children, out);
+ else if (n.kind === "action") out.add(n.id);
+ }
+ return out;
+}
+
+/** The registered ones among `ids` that cannot run in the current context. */
+export function disabledMenuActions(ids: Iterable<string>): string[] {
+ const out: string[] = [];
+ for (const id of ids) {
+ const action = getAction(id);
+ if (action && !isActionEnabled(action)) out.push(id);
+ }
+ return out.sort();
}
export function installMenuBridge(): () => void {
@@ -73,9 +106,38 @@ export function installMenuBridge(): () => void {
else unlisten = off;
});
+ // Enablement of the native items follows this window's context (IDEA greys out
+ // what cannot run). Recomputed shortly after context changes, sent only when it changed.
+ let ids: Set<string> | null = null;
+ let lastDisabled = "";
+ let enableTimer: ReturnType<typeof setTimeout> | undefined;
+ const pushEnablement = (force = false) => {
+ clearTimeout(enableTimer);
+ enableTimer = setTimeout(() => {
+ if (!ids || disposed || !document.hasFocus()) return;
+ const dynamic = Object.values(dynamicMenuItems()).flatMap((items) => items.map((d) => d.action));
+ const disabled = disabledMenuActions(new Set([...ids, ...dynamic]));
+ const key = disabled.join(",");
+ if (!force && key === lastDisabled) return;
+ lastDisabled = key;
+ void commands.menuSetDisabled(disabled);
+ }, 120);
+ };
+ void commands
+ .menuModel()
+ .then((model) => {
+ ids = menuActionIds(model);
+ pushEnablement(true);
+ })
+ .catch(() => {});
+
push();
+ const onFocus = () => {
+ push();
+ pushEnablement(true);
+ };
// The native menu bar is shared: a focused window re-pushes its own window-scoped labels.
- window.addEventListener("focus", push);
+ window.addEventListener("focus", onFocus);
const unsubs = [
useI18n.subscribe((s, prev) => {
if (s.messages !== prev.messages) push();
@@ -84,6 +146,12 @@ export function installMenuBridge(): () => void {
useDistractionFree.subscribe((s, prev) => {
if (s.active !== prev.active) push();
}),
+ useContributions.subscribe((s, prev) => {
+ if (s.toolWindows !== prev.toolWindows) push();
+ }),
+ useToolWindowLayouts.subscribe(push),
+ useContextKeys.subscribe(() => pushEnablement()),
+ useActions.subscribe(() => pushEnablement()),
// Opening / closing a project changes the Open Recent list.
useProject.subscribe((s, prev) => {
if (s.project?.root !== prev.project?.root) void commands.menuRefresh();
@@ -92,7 +160,8 @@ export function installMenuBridge(): () => void {
return () => {
disposed = true;
clearTimeout(timer);
- window.removeEventListener("focus", push);
+ clearTimeout(enableTimer);
+ window.removeEventListener("focus", onFocus);
unlisten?.();
unsubs.forEach((u) => u());
};
diff --git a/src/features/app/projectActions.ts b/src/features/app/projectActions.ts
new file mode 100644
index 000000000..f53dc1dc1
--- /dev/null
+++ b/src/features/app/projectActions.ts
@@ -0,0 +1,182 @@
+/**
+ * File menu actions around the project and the IDE settings: New Project…,
+ * Rename Project…, Manage IDE Settings › Export / Import Settings… and Power
+ * Save Mode (with its editor banner).
+ */
+import { executeAction, type Action } from "@/platform/actions";
+import { isPowerSaveMode } from "@/platform/editorSettings";
+import { call, commands, isTauri } from "@/platform/ipc";
+import { useProject } from "@/platform/project";
+import { notifications, registerEditorBanner } from "@/workbench/contributions";
+import { promptInput } from "@/workbench/inputDialogs";
+import { showNewProject } from "./NewProject";
+
+/** localStorage prefixes of IDE-level state exported with the settings (templates, macros, layouts). */
+export const EXPORTED_STORAGE = [
+ "openidea.liveTemplates.",
+ "openidea.fileTemplates.",
+ "openidea.postfix.",
+ "openidea.macros.",
+ "openidea.toolWindowLayouts.",
+];
+
+export function exportedStorage(storage: Pick<Storage, "length" | "key" | "getItem"> = localStorage): Record<string, string> {
+ const out: Record<string, string> = {};
+ for (let i = 0; i < storage.length; i++) {
+ const key = storage.key(i);
+ if (!key || !EXPORTED_STORAGE.some((p) => key.startsWith(p))) continue;
+ const value = storage.getItem(key);
+ if (value !== null) out[key] = value;
+ }
+ return out;
+}
+
+function errorText(e: unknown) {
+ return e instanceof Error ? e.message : String(e);
+}
+
+async function exportSettings() {
+ const { save } = await import("@tauri-apps/plugin-dialog");
+ const path = await save({
+ title: "Export Settings",
+ defaultPath: "openidea-settings.json",
+ filters: [{ name: "OpenIDEA settings", extensions: ["json"] }],
+ });
+ if (!path) return;
+ try {
+ await call(commands.settingsExport(path, exportedStorage()));
+ notifications().notify({ level: "info", title: "Settings exported", body: path, key: "app.settingsExport" });
+ } catch (e) {
+ notifications().notify({ level: "error", title: "Cannot export settings", body: errorText(e), key: "app.settingsExport" });
+ }
+}
+
+async function importSettings() {
+ const { open } = await import("@tauri-apps/plugin-dialog");
+ const picked = await open({
+ title: "Import Settings",
+ multiple: false,
+ filters: [{ name: "OpenIDEA settings", extensions: ["json"] }],
+ });
+ const path = Array.isArray(picked) ? picked[0] : picked;
+ if (!path) return;
+ try {
+ const result = await call(commands.settingsImport(path));
+ for (const [key, value] of Object.entries(result.storage))
+ if (EXPORTED_STORAGE.some((p) => key.startsWith(p)))
+ try {
+ localStorage.setItem(key, value);
+ } catch {
+ /* storage full */
+ }
+ useProject.setState({ settings: result.settings });
+ notifications().notify({
+ level: "info",
+ title: "Settings imported",
+ body: "Restart to apply imported templates, macros and layouts.",
+ key: "app.settingsImport",
+ sticky: true,
+ actions: [{ label: "Restart", run: () => void executeAction("app.restart") }],
+ });
+ } catch (e) {
+ notifications().notify({ level: "error", title: "Cannot import settings", body: errorText(e), key: "app.settingsImport" });
+ }
+}
+
+async function renameProject() {
+ const project = useProject.getState().project;
+ if (!project) return;
+ const folder = project.root.slice(project.root.replace(/[\\/]+$/, "").search(/[^\\/]*$/));
+ const name = await promptInput({
+ title: "Rename Project",
+ label: "New project name:",
+ initial: project.name,
+ okLabel: "Rename",
+ validate: () => null,
+ hint: `Leave empty to use the folder name (${folder}).`,
+ });
+ if (name === null) return;
+ try {
+ const info = await call(commands.projectRename(name));
+ useProject.setState((s) => ({ project: s.project && { ...s.project, name: info.name }, settings: info.settings }));
+ void commands.menuRefresh();
+ } catch (e) {
+ notifications().notify({ level: "error", title: "Cannot rename project", body: errorText(e) });
+ }
+}
+
+async function togglePowerSave() {
+ const on = !isPowerSaveMode();
+ try {
+ useProject.setState({
+ settings: await call(commands.settingsSet("global", "general.powerSaveMode", JSON.stringify(on))),
+ });
+ } catch (e) {
+ notifications().notify({ level: "error", title: "Cannot change Power Save Mode", body: errorText(e) });
+ }
+}
+
+const desktop = (run: () => Promise<void>) => () => {
+ if (isTauri()) return run();
+ notifications().notify({ level: "warning", title: "This needs the desktop app" });
+};
+
+export function projectActions(): Action[] {
+ return [
+ {
+ id: "file.newProject",
+ title: "New Project…",
+ category: "File",
+ icon: "folder-open",
+ keywords: ["create project", "empty project", "git init"],
+ run: desktop(async () => showNewProject()),
+ },
+ {
+ id: "file.renameProject",
+ title: "Rename Project…",
+ category: "File",
+ keywords: ["project name"],
+ when: "projectOpen",
+ run: desktop(renameProject),
+ },
+ {
+ id: "file.exportSettings",
+ title: "Export Settings…",
+ category: "File",
+ keywords: ["backup settings", "keymap", "templates", "manage ide settings"],
+ run: desktop(exportSettings),
+ },
+ {
+ id: "file.importSettings",
+ title: "Import Settings…",
+ category: "File",
+ keywords: ["restore settings", "keymap", "templates", "manage ide settings"],
+ run: desktop(importSettings),
+ },
+ {
+ id: "file.togglePowerSave",
+ title: "Power Save Mode",
+ category: "File",
+ keywords: ["battery", "performance", "code insight"],
+ toggled: () => isPowerSaveMode(),
+ run: togglePowerSave,
+ },
+ ];
+}
+
+/** The banner above every editor while Power Save Mode is on. */
+export function registerPowerSaveBanner(): () => void {
+ return registerEditorBanner({
+ id: "app.powerSave",
+ order: 0,
+ useBanner: () => {
+ const on = useProject((s) => isPowerSaveMode(s.settings));
+ return on
+ ? {
+ text: "Power save mode is on: completion and documentation popups and usage highlighting are off.",
+ actions: [{ label: "Turn Off", run: () => void togglePowerSave() }],
+ }
+ : null;
+ },
+ });
+}
diff --git a/src/features/build-tools/ExecutePopup.tsx b/src/features/build-tools/ExecutePopup.tsx
index 5066ca40a..7327a929c 100644
--- a/src/features/build-tools/ExecutePopup.tsx
+++ b/src/features/build-tools/ExecutePopup.tsx
@@ -8,16 +8,9 @@ import { useMemo, useState, type KeyboardEvent } from "react";
import clsx from "clsx";
import type { BuildTool } from "@/platform/ipc";
import { HighlightedText, Input, List, Popup, Select, listNavigate, T } from "@/ui";
-import {
- goalCompletions,
- gradleTaskConfig,
- mavenGoalConfig,
- parseGoalLine,
- parseTaskLine,
- taskCompletions,
- type Completion,
-} from "./model";
-import { pushHistory, readHistory, runConfig, useBuild } from "./store";
+import { goalCompletions, taskCompletions, type Completion } from "./model";
+import { executeBuildLine } from "./runAnything";
+import { readHistory, useBuild } from "./store";
import styles from "./BuildTools.module.css";
export function ExecutePopupHost() {
@@ -58,20 +51,7 @@ function ExecutePopup({ tool }: { tool: BuildTool }) {
const execute = () => {
const text = line.trim();
- if (!text) return;
- if (tool === "maven" && maven) {
- const p = maven.projects.find((x) => x.pom === project);
- const goals = parseGoalLine(text);
- if (!p || !goals.length) return;
- runConfig(mavenGoalConfig(p, goals, maven, useBuild.getState().settings.maven), "run");
- } else if (gradle) {
- const p = gradle.projects.find((x) => x.path === project);
- const tasks = parseTaskLine(text);
- if (!p || !tasks.length) return;
- runConfig(gradleTaskConfig(gradle, p, tasks, useBuild.getState().settings.gradle), "run");
- }
- pushHistory(tool, text);
- close();
+ if (text && executeBuildLine(tool, text, project)) close();
};
const accept = (c: Completion | undefined) => {
diff --git a/src/features/build-tools/index.ts b/src/features/build-tools/index.ts
index f4c0fe933..066810adc 100644
--- a/src/features/build-tools/index.ts
+++ b/src/features/build-tools/index.ts
@@ -7,9 +7,10 @@ import { registerActions } from "@/platform/actions";
import { setContext } from "@/platform/context";
import { onIdeEvent, type BuildModel, type BuildTool } from "@/platform/ipc";
import { useProject } from "@/platform/project";
-import { registerOverlay, registerToolWindow } from "@/workbench/contributions";
+import { registerOverlay, registerRunAnythingProvider, registerToolWindow } from "@/workbench/contributions";
import { GradleView, MavenView } from "./BuildToolView";
import { ExecutePopupHost } from "./ExecutePopup";
+import { buildToolsRunAnything } from "./runAnything";
import { expandableKeys, gradleChildren, gradleRoots, mavenChildren, mavenRoots } from "./model";
import {
cancelSync,
@@ -83,6 +84,7 @@ export function activate(): () => void {
};
const disposers: Array<() => void> = [
registerOverlay({ id: "build-tools.execute", component: ExecutePopupHost }),
+ registerRunAnythingProvider(buildToolsRunAnything),
useBuild.subscribe((s, prev) => {
if (s.model !== prev.model || s.root !== prev.root) apply(s.root ? s.model : null, registered);
}),
diff --git a/src/features/build-tools/runAnything.ts b/src/features/build-tools/runAnything.ts
new file mode 100644
index 000000000..f1fa275a2
--- /dev/null
+++ b/src/features/build-tools/runAnything.ts
@@ -0,0 +1,97 @@
+/**
+ * Maven / Gradle command lines: what Execute Maven Goal / Execute Gradle Task
+ * run, and the Run Anything provider for `mvn …` / `gradle …` lines (with goal
+ * and task completion in the selected project).
+ */
+import type { BuildTool } from "@/platform/ipc";
+import type { RunAnythingItem, RunAnythingProvider } from "@/workbench/contributions";
+import {
+ goalCompletions,
+ gradleTaskConfig,
+ mavenGoalConfig,
+ parseGoalLine,
+ parseTaskLine,
+ taskCompletions,
+} from "./model";
+import { pushHistory, readHistory, runConfig, useBuild } from "./store";
+
+const COMMANDS: Record<BuildTool, RegExp> = {
+ maven: /^(\.\/)?mvnw?(\.cmd)?(\s|$)/,
+ gradle: /^(\.\/)?gradlew?(\.bat)?(\s|$)/,
+};
+const WORD: Record<BuildTool, string> = { maven: "mvn", gradle: "gradle" };
+
+/** The build tool a Run Anything line is for (`mvn clean`, `./gradlew build`), when the project has it. */
+export function lineTool(line: string): BuildTool | null {
+ const model = useBuild.getState().model;
+ if (model?.maven && COMMANDS.maven.test(line)) return "maven";
+ if (model?.gradle && COMMANDS.gradle.test(line)) return "gradle";
+ return null;
+}
+
+/** The project a line runs in: the given one, else the tool window's current one, else the first. */
+function projectFor(tool: BuildTool, key?: string | null) {
+ const { model, current } = useBuild.getState();
+ if (tool === "maven") {
+ const projects = model?.maven?.projects ?? [];
+ return projects.find((p) => p.pom === (key ?? current.maven)) ?? projects[0];
+ }
+ const projects = model?.gradle?.projects ?? [];
+ return projects.find((p) => p.path === (key ?? current.gradle)) ?? projects[0];
+}
+
+/** Runs goals / tasks typed for `tool` in a project; false when there is nothing to run. */
+export function executeBuildLine(tool: BuildTool, text: string, projectKey?: string | null): boolean {
+ const { model, settings } = useBuild.getState();
+ if (tool === "maven") {
+ const maven = model?.maven;
+ const project = projectFor("maven", projectKey);
+ const goals = parseGoalLine(text);
+ if (!maven || !project || !("pom" in project) || !goals.length) return false;
+ runConfig(mavenGoalConfig(project, goals, maven, settings.maven), "run");
+ } else {
+ const gradle = model?.gradle;
+ const project = projectFor("gradle", projectKey);
+ const tasks = parseTaskLine(text);
+ if (!gradle || !project || "pom" in project || !tasks.length) return false;
+ runConfig(gradleTaskConfig(gradle, project, tasks, settings.gradle), "run");
+ }
+ pushHistory(tool, text.replace(COMMANDS[tool], "").trim());
+ return true;
+}
+
+function completions(tool: BuildTool, rest: string) {
+ const model = useBuild.getState().model;
+ if (tool === "maven") {
+ const project = projectFor("maven");
+ return goalCompletions(rest, project && "pom" in project ? project.plugins : [], readHistory("maven"));
+ }
+ return model?.gradle ? taskCompletions(rest, model.gradle, readHistory("gradle")) : [];
+}
+
+export const buildToolsRunAnything: RunAnythingProvider = {
+ id: "build-tools",
+ group: "Build Tools",
+ order: 20,
+ items(query) {
+ const tool = lineTool(query);
+ if (!tool) return [];
+ const head = /^\S+\s*/.exec(query)![0];
+ return completions(tool, query.slice(head.length))
+ .slice(0, 50)
+ .map(
+ (c): RunAnythingItem => ({
+ key: `${c.detail === "recent" ? "h" : "c"}:${c.line}`,
+ label: `${WORD[tool]} ${c.line}`,
+ detail: c.detail,
+ icon: tool === "maven" ? "file-maven" : "file-gradle",
+ completion: `${WORD[tool]} ${c.detail === "recent" ? c.line : `${c.line} `}`,
+ run: () => void executeBuildLine(tool, c.line),
+ }),
+ );
+ },
+ execute(line) {
+ const tool = lineTool(line);
+ return !!tool && executeBuildLine(tool, line);
+ },
+};
diff --git a/src/features/build/index.ts b/src/features/build/index.ts
index 28dee3599..32e2993f9 100644
--- a/src/features/build/index.ts
+++ b/src/features/build/index.ts
@@ -35,7 +35,7 @@ export function activate(): () => void {
headerActions: BuildHeaderActions,
useBadge: useErrorBadge,
}),
- registerTitleItem({ id: "build.project", align: "right", priority: -1, component: BuildTitleItem }),
+ registerTitleItem({ id: "build.project", title: "Build Project", align: "right", priority: -1, component: BuildTitleItem }),
registerActions([
{
id: "build.buildProject",
@@ -45,7 +45,8 @@ export function activate(): () => void {
icon: "build-project",
when: WHEN,
keywords: ["compile", "make", "mvn", "gradle", "cargo", "tsc", "go build"],
- run: () => void startBuild("build"),
+ // Awaitable: Run's "Build" before launch task waits for the result.
+ run: async () => void (await startBuild("build")),
},
{
id: "build.buildModule",
diff --git a/src/features/build/store.ts b/src/features/build/store.ts
index f481cc451..4b75dca15 100644
--- a/src/features/build/store.ts
+++ b/src/features/build/store.ts
@@ -30,6 +30,8 @@ import { appendOutput, finishSummary, firstError, messageFiles, type BuildStatus
export const BUILD_TASK_ID = "build:compile";
export const BUILD_RUNNING = "build.running";
+/** Outcome of the last build (`success` | `failed` | `cancelled`), e.g. for Run's "Build" before launch task. */
+export const BUILD_LAST_STATUS = "build.lastStatus";
/** How builds reach the backend; replaced in tests. */
export interface BuildBackend {
@@ -205,6 +207,7 @@ export async function startBuild(kind: BuildKind, file: string | null = null): P
}
} finally {
if (useBuildRun.getState().request === request) useBuildRun.setState({ request: null });
+ setContext(BUILD_LAST_STATUS, result?.success ? "success" : useBuildRun.getState().status === "cancelled" ? "cancelled" : "failed");
setContext(BUILD_RUNNING, false);
upsertTask({ id: BUILD_TASK_ID, title: taskTitle, message: null, fraction: 1, done: true });
}
diff --git a/src/features/code-insight/UsagesView.tsx b/src/features/code-insight/UsagesView.tsx
index 12109ced2..26de1de20 100644
--- a/src/features/code-insight/UsagesView.tsx
+++ b/src/features/code-insight/UsagesView.tsx
@@ -225,7 +225,7 @@ export function UsagesView() {
return (
<div className={styles.view}>
- <div className={styles.toolbar} role="toolbar" aria-orientation="vertical" aria-label="Usages actions">
+ <div className={styles.toolbar} role="toolbar" aria-orientation="vertical" aria-label={tx("Usages actions")}>
<IconButton
icon="rerun"
title={tx("Rerun Find Usages")}
diff --git a/src/features/code-insight/problemsStore.test.ts b/src/features/code-insight/problemsStore.test.ts
index 0ab69b1b7..2428ad8c8 100644
--- a/src/features/code-insight/problemsStore.test.ts
+++ b/src/features/code-insight/problemsStore.test.ts
@@ -6,6 +6,7 @@ import {
countSeverities,
fileDiagnostics,
mergeDiagnostics,
+ profiledProblems,
projectCounts,
useProblems,
worstSeverity,
@@ -69,3 +70,14 @@ describe("store + decorations", () => {
expect(deco.get("/p/src/a.rs")).toEqual({ error: true, propagate: true, tooltip: "1 error, 1 warning" });
});
});
+
+describe("profiledProblems", () => {
+ it("applies the inspection profile per producer", () => {
+ let raw = mergeDiagnostics(new Map(), "/a", "ra", [d(1), d(2, "warning")]);
+ raw = mergeDiagnostics(raw, "/b", "eslint", [d(3)]);
+ const out = profiledProblems(raw, { "lsp:eslint": { enabled: false }, "lsp:ra": { severity: "weakWarning" } });
+ expect([...out.keys()]).toEqual(["/a"]);
+ expect(fileDiagnostics(out, "/a").map((x) => x.severity)).toEqual(["info", "info"]);
+ expect(fileDiagnostics(profiledProblems(raw, {}), "/b")).toHaveLength(1);
+ });
+});
diff --git a/src/features/code-insight/problemsStore.ts b/src/features/code-insight/problemsStore.ts
index 99a35bbc8..946a1934a 100644
--- a/src/features/code-insight/problemsStore.ts
+++ b/src/features/code-insight/problemsStore.ts
@@ -6,6 +6,12 @@
import { create } from "zustand";
import type { Diagnostic, Severity } from "@/bindings";
import { onIdeEvent } from "@/platform/ipc";
+import {
+ applyProfile,
+ inspectionProfile,
+ subscribeInspectionProfile,
+ type ProfileOverrides,
+} from "@/platform/inspections";
export type FileDiagnostics = ReadonlyMap<string, readonly Diagnostic[]>;
/** path → source → diagnostics. */
@@ -89,23 +95,46 @@ export function worstSeverity(diags: Iterable<Diagnostic>): Severity | null {
return best;
}
+/** `raw` under the inspection profile: disabled inspections dropped, severities remapped. */
+export function profiledProblems(raw: ProblemsMap, profile: ProfileOverrides): ProblemsMap {
+ let out: ProblemsMap = new Map();
+ for (const [path, sources] of raw) {
+ for (const [source, items] of sources) {
+ out = mergeDiagnostics(out, path, source, applyProfile(profile, source, items));
+ }
+ }
+ return out;
+}
+
interface ProblemsState {
+ /** As reported, before the inspection profile. */
+ raw: ProblemsMap;
+ /** What the views show. */
map: ProblemsMap;
}
-export const useProblems = create<ProblemsState>(() => ({ map: new Map() }));
+export const useProblems = create<ProblemsState>(() => ({ raw: new Map(), map: new Map() }));
export function applyDiagnosticsEvent(path: string, source: string, items: readonly Diagnostic[]) {
useProblems.setState((s) => {
- const map = mergeDiagnostics(s.map, path, source, items);
- return map === s.map ? s : { map };
+ const raw = mergeDiagnostics(s.raw, path, source, items);
+ if (raw === s.raw) return s;
+ const map = mergeDiagnostics(s.map, path, source, applyProfile(inspectionProfile(), source, items));
+ return { raw, map };
});
}
export function clearProblems() {
- useProblems.setState({ map: new Map() });
+ useProblems.setState({ raw: new Map(), map: new Map() });
}
export function installProblemsEvents(): () => void {
- return onIdeEvent("diagnostics", (e) => applyDiagnosticsEvent(e.path, e.source, e.items));
+ const off = onIdeEvent("diagnostics", (e) => applyDiagnosticsEvent(e.path, e.source, e.items));
+ const offProfile = subscribeInspectionProfile(() =>
+ useProblems.setState((s) => ({ map: profiledProblems(s.raw, inspectionProfile()) })),
+ );
+ return () => {
+ off();
+ offProfile();
+ };
}
diff --git a/src/features/coverage/Coverage.module.css b/src/features/coverage/Coverage.module.css
index 228a0f88e..9ff147f47 100644
--- a/src/features/coverage/Coverage.module.css
+++ b/src/features/coverage/Coverage.module.css
@@ -108,3 +108,42 @@
.link:hover {
color: var(--link-hover);
}
+.links {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 6px;
+}
+
+/* Manage Coverage Reports */
+.reports {
+ height: 260px;
+ margin: 12px;
+ border: 1px solid var(--border);
+ display: flex;
+ flex-direction: column;
+}
+.reportRow {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ min-width: 0;
+ flex: 1;
+ white-space: nowrap;
+}
+.reportDetail {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ color: var(--fg-subtle);
+}
+.reportTime {
+ flex: none;
+ font-size: var(--fs-small);
+ color: var(--fg-muted);
+}
+.reportsEmpty {
+ padding: 12px;
+ color: var(--fg-muted);
+}
diff --git a/src/features/coverage/CoverageView.tsx b/src/features/coverage/CoverageView.tsx
index 76837c530..20dd19515 100644
--- a/src/features/coverage/CoverageView.tsx
+++ b/src/features/coverage/CoverageView.tsx
@@ -35,13 +35,17 @@ export function CoverageHeaderActions() {
const visible = useCoverage((s) => s.visible);
const hasSuite = useCoverage((s) => !!s.activeId);
return (
- <IconButton
- icon={visible ? "close" : "eye"}
- size="small"
- title={visible ? "Hide Coverage" : "Show Coverage"}
- disabled={!hasSuite}
- onClick={() => setCoverageVisible(!visible)}
- />
+ <>
+ <IconButton icon="folder-open" size="small" action="coverage.importReport" />
+ <IconButton icon="list" size="small" action="coverage.manageReports" />
+ <IconButton
+ icon={visible ? "close" : "eye"}
+ size="small"
+ title={visible ? "Hide Coverage" : "Show Coverage"}
+ disabled={!hasSuite}
+ onClick={() => setCoverageVisible(!visible)}
+ />
+ </>
);
}
@@ -87,9 +91,14 @@ export function CoverageView() {
<span>
<T>Run a configuration with coverage to see which lines its tests execute.</T>
</span>
- <button type="button" className={styles.link} onClick={() => void executeAction("run.coverage")}>
- <T>Run with Coverage</T>
- </button>
+ <span className={styles.links}>
+ <button type="button" className={styles.link} onClick={() => void executeAction("run.coverage")}>
+ <T>Run with Coverage</T>
+ </button>
+ <button type="button" className={styles.link} onClick={() => void executeAction("coverage.importReport")}>
+ <T>Import a report collected in CI from disk</T>
+ </button>
+ </span>
</EmptyState>
);
}
diff --git a/src/features/coverage/coverage.test.ts b/src/features/coverage/coverage.test.ts
index 8749840fd..311aacc26 100644
--- a/src/features/coverage/coverage.test.ts
+++ b/src/features/coverage/coverage.test.ts
@@ -3,7 +3,7 @@ import { EditorState } from "@codemirror/state";
import type { CoverageSuite, FileCoverage, RunConfig } from "@/platform/ipc";
import { coverageMarkers } from "./gutter";
import { coverageBadges, coverageSupports, coverageTree, formatPercent, lineState, sortTree } from "./model";
-import { MAX_SUITES, addSuite, closeSuite, resetCoverage, setCoverageVisible, shownFileCoverage, useCoverage } from "./store";
+import { MAX_SUITES, addSuite, closeSuite, reportEntries, resetCoverage, setCoverageVisible, shownFileCoverage, useCoverage } from "./store";
function cfg(command: string, args: string[], extra: Partial<RunConfig> = {}): RunConfig {
return { id: "c", name: "c", kind: "shell", command, args, cwd: null, env: {}, detected: true, isTest: false, debugAdapter: null, ...extra };
@@ -115,4 +115,24 @@ describe("gutter and suites", () => {
expect(useCoverage.getState().activeId).toBe(s.suites[1]!.id);
resetCoverage();
});
+
+ it("replaces a re-imported report and lists remembered imports in Manage Coverage Reports", () => {
+ addSuite("tests", suite([file("/p/a.rs", 1, 2)]));
+ const first = addSuite("lcov.info", suite([file("/p/a.rs", 1, 2)]), "/ci/lcov.info");
+ const again = addSuite("lcov.info", suite([file("/p/a.rs", 2, 2)]), "/ci/lcov.info");
+ const { suites } = useCoverage.getState();
+ expect(suites.map((s) => s.id)).toEqual([again.id, suites[1]!.id]);
+ expect(suites.some((s) => s.id === first.id)).toBe(false);
+ expect(shownFileCoverage("/p/a.rs")?.linesCovered).toBe(2);
+ const entries = reportEntries(suites, [
+ { path: "/ci/lcov.info", name: "lcov.info", importedAt: 1 },
+ { path: "/ci/jacoco.xml", name: "jacoco.xml", importedAt: 2 },
+ ]);
+ expect(entries.map((e) => [e.name, e.detail, !!e.suite])).toEqual([
+ ["lcov.info", "/ci/lcov.info", true],
+ ["tests", "t", true],
+ ["jacoco.xml", "/ci/jacoco.xml", false],
+ ]);
+ resetCoverage();
+ });
});
diff --git a/src/features/coverage/index.ts b/src/features/coverage/index.ts
index 52a45f81f..f1035d60d 100644
--- a/src/features/coverage/index.ts
+++ b/src/features/coverage/index.ts
@@ -6,10 +6,11 @@
import { registerEditorContribution } from "@/editor/api";
import { executeAction, registerActions } from "@/platform/actions";
import { useProject } from "@/platform/project";
-import { registerRunExecutor, registerToolWindow, toolWindowService } from "@/workbench/contributions";
+import { registerOverlay, registerRunExecutor, registerToolWindow, toolWindowService } from "@/workbench/contributions";
import { CoverageHeaderActions, CoverageTabs, CoverageView } from "./CoverageView";
import { coverageExecutor } from "./executor";
import { coverageGutter } from "./gutter";
+import { ManageReportsOverlay, importReport, openManageReports } from "./reports";
import { resetCoverage, setCoverageVisible, syncCoverageViews, useCoverage } from "./store";
export function activate(): () => void {
@@ -28,6 +29,7 @@ export function activate(): () => void {
}),
registerEditorContribution({ id: "coverage.gutter", order: 65, extensions: coverageGutter }),
syncCoverageViews(),
+ registerOverlay({ id: "coverage.manageReports", component: ManageReportsOverlay }),
registerActions([
{
id: "run.coverage",
@@ -49,6 +51,26 @@ export function activate(): () => void {
keywords: ["coverage"],
run: ({ arg }) => executeAction("run.withExecutor", { executor: "coverage", context: arg ?? true }).then(() => undefined),
},
+ {
+ id: "coverage.importReport",
+ title: "Import a Coverage Report…",
+ description: "Show a report collected elsewhere (CI): lcov, JaCoCo XML or a Go cover profile; argument: the file path",
+ category: "Run",
+ icon: "folder-open",
+ when: "projectOpen",
+ keywords: ["coverage", "lcov", "jacoco", "ci", "import"],
+ run: ({ arg }) => importReport(typeof arg === "string" ? arg : undefined).then(() => undefined),
+ },
+ {
+ id: "coverage.manageReports",
+ title: "Manage Coverage Reports…",
+ description: "Choose the shown coverage suite, delete suites and imported reports",
+ category: "Run",
+ icon: "list",
+ when: "projectOpen",
+ keywords: ["coverage", "suites", "show coverage data"],
+ run: () => openManageReports(),
+ },
{
id: "coverage.hide",
title: "Hide Coverage",
diff --git a/src/features/coverage/reports.tsx b/src/features/coverage/reports.tsx
new file mode 100644
index 000000000..e0dee7503
--- /dev/null
+++ b/src/features/coverage/reports.tsx
@@ -0,0 +1,165 @@
+/**
+ * Coverage reports collected elsewhere: "Import a report collected in CI from
+ * disk" (lcov, JaCoCo XML, Go cover profile) and "Manage Coverage Reports"
+ * (choose the shown suite, delete suites and remembered imports).
+ */
+import { useMemo, useState } from "react";
+import { create } from "zustand";
+import { call, commands, isTauri } from "@/platform/ipc";
+import { basename } from "@/platform/project";
+import { Dialog, Icon, List, T } from "@/ui";
+import { notifications, toolWindowService } from "@/workbench/contributions";
+import { formatPercent } from "./model";
+import {
+ addSuite,
+ closeSuite,
+ forgetImport,
+ importedReports,
+ rememberImport,
+ reportEntries,
+ selectSuite,
+ useCoverage,
+ type ReportEntry,
+ type Suite,
+} from "./store";
+import styles from "./Coverage.module.css";
+
+const errorText = (e: unknown) => (e instanceof Error ? e.message : String(e));
+
+async function pickReport(): Promise<string | null> {
+ const { open } = await import("@tauri-apps/plugin-dialog");
+ const file = await open({
+ multiple: false,
+ directory: false,
+ title: "Import Coverage Report",
+ filters: [
+ {
+ name: "Coverage reports (lcov, JaCoCo XML, Go cover profile)",
+ extensions: ["info", "lcov", "xml", "out", "txt", "cov", "coverprofile"],
+ },
+ { name: "All files", extensions: ["*"] },
+ ],
+ });
+ return typeof file === "string" ? file : null;
+}
+
+/** Imports `path` (asks for a file without one) and shows it like a run's suite. */
+export async function importReport(path?: string): Promise<Suite | null> {
+ if (!isTauri()) {
+ notifications().notify({ group: "run", level: "warning", title: "Importing coverage needs the desktop app" });
+ return null;
+ }
+ const file = path ?? (await pickReport());
+ if (!file) return null;
+ try {
+ const data = await call(commands.coverageImport(file));
+ const suite = addSuite(basename(file), data, file);
+ rememberImport({ path: file, name: suite.name, importedAt: suite.createdAt });
+ try {
+ toolWindowService().show("coverage");
+ } catch {
+ /* no workbench (tests) */
+ }
+ const [covered, total] = data.files.reduce((a, f) => [a[0]! + f.linesCovered, a[1]! + f.linesTotal], [0, 0]);
+ notifications().notify({
+ group: "run",
+ level: "info",
+ key: "coverage-import",
+ title: `Imported coverage '${suite.name}': ${formatPercent(covered!, total!)} lines`,
+ body: data.files.length ? undefined : "The report covers no files of this project.",
+ });
+ return suite;
+ } catch (e) {
+ notifications().notify({
+ group: "run",
+ level: "error",
+ key: "coverage-import",
+ title: `Cannot import ${basename(file)}`,
+ body: errorText(e),
+ });
+ return null;
+ }
+}
+
+const useManageDialog = create<{ open: boolean }>(() => ({ open: false }));
+
+export const openManageReports = () => useManageDialog.setState({ open: true });
+
+export function ManageReportsOverlay() {
+ const open = useManageDialog((s) => s.open);
+ return open ? <ManageReportsDialog onClose={() => useManageDialog.setState({ open: false })} /> : null;
+}
+
+function ManageReportsDialog({ onClose }: { onClose: () => void }) {
+ const suites = useCoverage((s) => s.suites);
+ const activeId = useCoverage((s) => s.activeId);
+ const [imported, setImported] = useState(() => importedReports());
+ const entries = useMemo(() => reportEntries(suites, imported), [suites, imported]);
+ const [active, setActive] = useState(() =>
+ Math.max(
+ 0,
+ entries.findIndex((e) => e.suite?.id === activeId),
+ ),
+ );
+ const current: ReportEntry | undefined = entries[Math.min(active, entries.length - 1)];
+
+ const show = async (entry: ReportEntry | undefined) => {
+ if (!entry) return;
+ if (entry.suite) selectSuite(entry.suite.id);
+ else if (entry.file && !(await importReport(entry.file))) return;
+ onClose();
+ };
+ const remove = (entry: ReportEntry | undefined) => {
+ if (!entry) return;
+ if (entry.suite) closeSuite(entry.suite.id);
+ if (entry.file) {
+ forgetImport(entry.file);
+ setImported(importedReports());
+ }
+ };
+ const importMore = async () => {
+ if (await importReport()) setImported(importedReports());
+ };
+
+ return (
+ <Dialog
+ open
+ title="Coverage Reports"
+ onClose={onClose}
+ width={560}
+ buttons={[
+ { label: "Import…", role: "extra", onClick: () => void importMore() },
+ { label: "Delete", role: "extra", disabled: !current, onClick: () => remove(current) },
+ { label: "Show Selected", role: "default", disabled: !current, onClick: () => void show(current) },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <div className={styles.reports}>
+ <List<ReportEntry>
+ aria-label="Coverage reports"
+ items={entries}
+ getKey={(e) => e.key}
+ activeIndex={active}
+ onActiveChange={setActive}
+ onActivate={(e) => void show(e)}
+ renderItem={(e) => (
+ <span className={styles.reportRow}>
+ <Icon name={e.file ? "folder-open" : "run-coverage"} size={16} className={styles.icon} />
+ <span className={styles.label}>{e.name}</span>
+ <span className={styles.reportDetail}>{e.detail}</span>
+ <span className={styles.reportTime}>
+ {e.suite?.id === activeId ? <T>shown</T> : e.suite ? null : <T>not loaded</T>}{" "}
+ {new Date(e.time).toLocaleString()}
+ </span>
+ </span>
+ )}
+ empty={
+ <div className={styles.reportsEmpty}>
+ <T>No coverage reports. Run with coverage or import a report.</T>
+ </div>
+ }
+ />
+ </div>
+ </Dialog>
+ );
+}
diff --git a/src/features/coverage/store.ts b/src/features/coverage/store.ts
index 0648046d8..d820730f1 100644
--- a/src/features/coverage/store.ts
+++ b/src/features/coverage/store.ts
@@ -14,9 +14,11 @@ export const MAX_SUITES = 5;
export interface Suite {
id: string;
- /** Run configuration name. */
+ /** Run configuration name, or the imported report's file name. */
name: string;
createdAt: number;
+ /** The report file of an imported suite ("Import a report collected in CI"). */
+ file?: string;
data: CoverageSuite;
byPath: Map<string, FileCoverage>;
}
@@ -43,15 +45,21 @@ export function shownFileCoverage(path: string, s: CoverageState = useCoverage.g
return activeSuite(s)?.byPath.get(path) ?? null;
}
-export function addSuite(name: string, data: CoverageSuite): Suite {
+export function addSuite(name: string, data: CoverageSuite, file?: string): Suite {
const suite: Suite = {
id: `suite${++seq}`,
name,
createdAt: Date.now(),
+ file,
data,
byPath: new Map(data.files.map((f) => [f.path, f])),
};
- useCoverage.setState((s) => ({ suites: [suite, ...s.suites].slice(0, MAX_SUITES), activeId: suite.id, visible: true }));
+ useCoverage.setState((s) => ({
+ // A re-imported file replaces its earlier suite.
+ suites: [suite, ...s.suites.filter((x) => !file || x.file !== file)].slice(0, MAX_SUITES),
+ activeId: suite.id,
+ visible: true,
+ }));
return suite;
}
@@ -97,3 +105,75 @@ export function syncCoverageViews(): () => void {
setFileDecorations("coverage", new Map());
};
}
+
+// ---------------------------------------------------------------------------
+// Imported reports, remembered per project so "Manage Coverage Reports" lists
+// them after a restart.
+
+export interface ImportedReport {
+ path: string;
+ name: string;
+ importedAt: number;
+}
+
+const IMPORTED_KEY = "openidea.coverage.imported.v1:";
+const MAX_IMPORTED = 20;
+
+export function importedReports(root: string | null = useProject.getState().project?.root ?? null): ImportedReport[] {
+ if (!root) return [];
+ try {
+ const v: unknown = JSON.parse(globalThis.localStorage?.getItem(IMPORTED_KEY + root) ?? "[]");
+ if (!Array.isArray(v)) return [];
+ return v.filter(
+ (r): r is ImportedReport =>
+ !!r && typeof r.path === "string" && typeof r.name === "string" && typeof r.importedAt === "number",
+ );
+ } catch {
+ return [];
+ }
+}
+
+function saveImported(root: string, reports: ImportedReport[]) {
+ try {
+ globalThis.localStorage?.setItem(IMPORTED_KEY + root, JSON.stringify(reports.slice(0, MAX_IMPORTED)));
+ } catch {
+ /* storage unavailable */
+ }
+}
+
+export function rememberImport(report: ImportedReport) {
+ const root = useProject.getState().project?.root;
+ if (root) saveImported(root, [report, ...importedReports(root).filter((r) => r.path !== report.path)]);
+}
+
+export function forgetImport(path: string) {
+ const root = useProject.getState().project?.root;
+ if (root) saveImported(root, importedReports(root).filter((r) => r.path !== path));
+}
+
+/** A row of "Manage Coverage Reports": a loaded suite, or an imported report not loaded now. */
+export interface ReportEntry {
+ key: string;
+ name: string;
+ /** Tool or file shown beside the name. */
+ detail: string;
+ time: number;
+ suite: Suite | null;
+ file: string | null;
+}
+
+export function reportEntries(suites: readonly Suite[], imported: readonly ImportedReport[]): ReportEntry[] {
+ const out: ReportEntry[] = suites.map((s) => ({
+ key: s.id,
+ name: s.name,
+ detail: s.file ?? s.data.runner,
+ time: s.createdAt,
+ suite: s,
+ file: s.file ?? null,
+ }));
+ for (const r of imported) {
+ if (suites.some((s) => s.file === r.path)) continue;
+ out.push({ key: `file:${r.path}`, name: r.name, detail: r.path, time: r.importedAt, suite: null, file: r.path });
+ }
+ return out;
+}
diff --git a/src/features/database/Database.module.css b/src/features/database/Database.module.css
index dd66251c6..f99baed31 100644
--- a/src/features/database/Database.module.css
+++ b/src/features/database/Database.module.css
@@ -245,6 +245,13 @@
gap: 6px;
min-width: 0;
}
+.tinted {
+ flex: 1;
+ margin: 0 -4px;
+ padding: 0 4px;
+ border-radius: var(--radius-control, 4px);
+ background: color-mix(in srgb, var(--db-tint) var(--tint-strength), transparent);
+}
.nodeLabel {
overflow: hidden;
text-overflow: ellipsis;
@@ -334,6 +341,128 @@
gap: 8px;
align-items: center;
}
+/* Data source dialog. */
+.formSection {
+ grid-column: 1 / -1;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ color: var(--fg-strong);
+}
+.formSection::after {
+ content: "";
+ flex: 1;
+ height: 1px;
+ background: var(--border);
+}
+.formWide {
+ grid-column: 1 / -1;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ min-width: 0;
+}
+.portInput {
+ width: 80px;
+}
+.secondsInput {
+ width: 72px;
+}
+.narrowSelect {
+ min-width: 140px;
+}
+.segmented {
+ display: inline-flex;
+ justify-self: start;
+ border-radius: var(--radius-control, 4px);
+ box-shadow: inset 0 0 0 1px var(--border-button);
+}
+.segmented button {
+ height: var(--h-field, 28px);
+ padding: 0 14px;
+ border: 0;
+ border-radius: inherit;
+ background: transparent;
+ color: var(--fg);
+ font: inherit;
+}
+.segmented button[aria-pressed="true"] {
+ background: var(--bg-tab-selected);
+ box-shadow: inset 0 0 0 1px var(--border-tab-selected);
+ color: var(--fg-strong);
+}
+.segmented button:focus-visible {
+ outline: 2px solid var(--focus-ring);
+ outline-offset: -2px;
+}
+.textArea {
+ width: 100%;
+ min-height: 64px;
+ resize: vertical;
+ padding: 6px 8px;
+ border: 1px solid var(--border-strong);
+ border-radius: var(--radius-control, 4px);
+ background: var(--bg-input);
+ color: var(--fg-editor, var(--fg-strong));
+ font-family: var(--font-mono);
+ font-size: var(--fs-code);
+ line-height: 1.5;
+}
+.textArea:focus {
+ outline: none;
+ border-color: var(--accent);
+}
+.linkButton {
+ justify-self: start;
+ padding: 0;
+ border: 0;
+ background: none;
+ color: var(--link);
+ font: inherit;
+ cursor: pointer;
+}
+.linkButton:hover {
+ text-decoration: underline;
+}
+.colorValue {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+}
+.colorSwatch {
+ width: 12px;
+ height: 12px;
+ border-radius: 3px;
+}
+.namePicker {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+}
+.nameList {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ max-height: 180px;
+ overflow: auto;
+ padding-left: 22px;
+}
+.propertyTable {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+}
+.propertyHead,
+.propertyRow {
+ display: grid;
+ grid-template-columns: 1fr 1fr 24px;
+ align-items: center;
+ gap: 6px;
+}
+.propertyHead {
+ color: var(--fg-secondary);
+ font-size: var(--fs-small);
+}
.testResult {
grid-column: 1 / -1;
font-size: var(--fs-small);
diff --git a/src/features/database/DatabaseView.tsx b/src/features/database/DatabaseView.tsx
index 2523a3ad8..b111a1016 100644
--- a/src/features/database/DatabaseView.tsx
+++ b/src/features/database/DatabaseView.tsx
@@ -4,8 +4,8 @@
* with counts and column types, loaded lazily. Double-click a table to open its data, a data
* source to open its query console.
*/
-import { useEffect, useMemo, useRef } from "react";
-import type { DbTableDetails } from "@/platform/ipc";
+import { useEffect, useMemo, useRef, type CSSProperties } from "react";
+import type { DbDatabases, DbTableDetails } from "@/platform/ipc";
import { setContext } from "@/platform/context";
import { executeAction } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
@@ -21,7 +21,7 @@ import {
type TreeHandle,
T,
} from "@/ui";
-import { databaseKey, driverIcon, splitTarget, targetOf } from "./model";
+import { colorVar, databaseKey, shownNames, sourceIcon, splitTarget, targetOf } from "./model";
import { nodeTarget, type DbNode as Node, type Group } from "./nodes";
import {
connect,
@@ -105,9 +105,20 @@ export function DatabaseView() {
return d?.status === "ok" ? d.value : null;
};
+ const sourceOf = (target: string) => st.sources.find((s) => s.id === splitTarget(target).id);
+ /** The Schemas tab's choice. */
+ const shownSchemas = (target: string, names: string[]) => {
+ const i = sourceOf(target)?.introspection;
+ return shownNames(names, i?.allSchemas, i?.schemas);
+ };
+ const shownDatabases = (id: string, v: DbDatabases) => {
+ const i = sourceOf(id)?.introspection;
+ return shownNames(v.names, i?.allDatabases, i?.databases, v.current);
+ };
+
const schemasOf = (key: string, id: string) =>
status(key, st.schemas[id], (v) =>
- v.map((schema) => ({ kind: "schema", key: `${id}/${schema}`, id, schema }) as Node),
+ shownSchemas(id, v).map((schema) => ({ kind: "schema", key: `${id}/${schema}`, id, schema }) as Node),
);
const children = (n: Node): readonly Node[] | undefined => {
@@ -116,7 +127,7 @@ export function DatabaseView() {
const id = n.source.id ?? "";
if (listsDatabases(n.source))
return status(n.key, st.databases[id], (v) =>
- v.names.map((name) => ({
+ shownDatabases(id, v).map((name) => ({
kind: "database",
key: databaseKey(id, name),
id: targetOf(id, name, v.current),
@@ -226,14 +237,14 @@ export function DatabaseView() {
const id = n.source.id ?? "";
if (listsDatabases(n.source)) {
const d = st.databases[id];
- return d?.status === "ok" ? String(d.value.names.length) : undefined;
+ return d?.status === "ok" ? String(shownDatabases(id, d.value).length) : undefined;
}
const s = st.schemas[id];
- return s?.status === "ok" ? String(s.value.length) : undefined;
+ return s?.status === "ok" ? String(shownSchemas(id, s.value).length) : undefined;
}
case "database": {
const s = st.schemas[n.id];
- return s?.status === "ok" ? String(s.value.length) : undefined;
+ return s?.status === "ok" ? String(shownSchemas(n.id, s.value).length) : undefined;
}
case "folder":
return String(
@@ -259,7 +270,7 @@ export function DatabaseView() {
const icon = (n: Node): string | undefined => {
switch (n.kind) {
case "source":
- return driverIcon(n.source.driver);
+ return sourceIcon(n.source);
case "database":
return "database";
case "schema":
@@ -334,8 +345,15 @@ export function DatabaseView() {
? styles.keyLabel
: styles.nodeLabel;
const live = n.kind === "source" && [...st.connected].some((t) => splitTarget(t).id === n.source.id);
+ const target = nodeTarget(n);
+ // IDEA tints every row of a coloured data source.
+ const tint = colorVar(target ? sourceOf(target)?.color : null);
return (
- <span className={styles.nodeRow}>
+ <span
+ className={tint ? `${styles.nodeRow} ${styles.tinted}` : styles.nodeRow}
+ style={tint ? ({ "--db-tint": tint } as CSSProperties) : undefined}
+ title={n.kind === "source" && n.source.comment ? n.source.comment : undefined}
+ >
{i && (
<span className={styles.nodeIcon}>
<Icon name={i} size={16} />
diff --git a/src/features/database/Dialogs.tsx b/src/features/database/Dialogs.tsx
index b2053ddcb..1bf46bb40 100644
--- a/src/features/database/Dialogs.tsx
+++ b/src/features/database/Dialogs.tsx
@@ -1,404 +1,14 @@
/** Data source (add / edit / test connection) and password dialogs. */
import { Fragment, useState } from "react";
-import {
- call,
- commands,
- IpcError,
- type DataSource,
- type DbDriver,
- type DbSsh,
- type DbSshAuth,
- type DbSslMode,
-} from "@/platform/ipc";
-import { Button, Checkbox, Dialog, Input, Select, Tabs, lazyComponent, T } from "@/ui";
-import { connectRemedy, fileSourceName, newSourceId, sshLabel } from "./model";
-import { closeDialog, saveSource, useDatabase } from "./store";
+import { call, commands, type DataSource } from "@/platform/ipc";
+import { Checkbox, Dialog, Input, lazyComponent, T } from "@/ui";
+import { sshLabel } from "./model";
+import { SourceDialog } from "./SourceDialog";
+import { closeDialog, useDatabase } from "./store";
import styles from "./Database.module.css";
const ObjectDialogs = lazyComponent(() => import("./ObjectDialogs").then((m) => m.ObjectDialogs));
-const DRIVERS: Array<{ value: DbDriver; label: string }> = [
- { value: "postgres", label: "PostgreSQL" },
- { value: "mysql", label: "MySQL / MariaDB" },
- { value: "sqlite", label: "SQLite" },
-];
-
-const SSL: Array<{ value: DbSslMode; label: string }> = [
- { value: "prefer", label: "Prefer" },
- { value: "require", label: "Require" },
- { value: "disable", label: "Disable" },
-];
-
-const SSH_AUTH: Array<{ value: DbSshAuth; label: string }> = [
- { value: "openSsh", label: "OpenSSH config and authentication agent" },
- { value: "password", label: "Password" },
- { value: "keyPair", label: "Key pair" },
-];
-
-const blankSsh = (): DbSsh => ({
- enabled: false,
- host: "",
- port: null,
- user: "",
- auth: "openSsh",
- keyFile: "",
- saveSecret: true,
-});
-
-const parsePort = (v: string) => {
- const n = parseInt(v, 10);
- return Number.isFinite(n) && n > 0 && n < 65536 ? n : null;
-};
-
-function blank(): DataSource {
- return {
- id: newSourceId(),
- name: "",
- driver: "postgres",
- host: "localhost",
- port: null,
- database: "",
- user: "",
- file: null,
- ssl: "prefer",
- savePassword: true,
- readOnly: false,
- };
-}
-
-function SourceDialog({
- initial,
- preset,
- presetPassword,
-}: {
- initial: DataSource | null;
- preset?: Partial<DataSource>;
- presetPassword?: string | null;
-}) {
- const [s, setS] = useState<DataSource>(() => ({ ...blank(), ...preset, ...initial }));
- // `undefined`: unchanged (editing keeps the stored password).
- const [password, setPassword] = useState<string | undefined>(presetPassword ?? undefined);
- // Same convention for the SSH password / passphrase.
- const [sshSecret, setSshSecret] = useState<string | undefined>(undefined);
- const [tab, setTab] = useState<"general" | "ssh">("general");
- const [test, setTest] = useState<{ ok: boolean; text: string; trust?: boolean } | null>(null);
- const [busy, setBusy] = useState(false);
- const set = (patch: Partial<DataSource>) => setS((x) => ({ ...x, ...patch }));
- const ssh: DbSsh = { ...blankSsh(), ...s.ssh };
- const setSsh = (patch: Partial<DbSsh>) => setS((x) => ({ ...x, ssh: { ...blankSsh(), ...x.ssh, ...patch } }));
- const sqlite = s.driver === "sqlite";
- const name = s.name?.trim() || (sqlite ? fileSourceName(s.file ?? "") : `${s.database || s.user || "db"}@${s.host}`);
- const sshOn = !sqlite && !!ssh.enabled;
- const valid = sqlite ? !!s.file?.trim() : !!s.host?.trim() && (!sshOn || !!ssh.host?.trim());
-
- const runTest = async () => {
- setBusy(true);
- setTest(null);
- try {
- const v = await call(commands.dbTest({ ...s, name }, password ?? null, sshOn ? (sshSecret ?? null) : null));
- setTest({ ok: true, text: `Succeeded: ${v}` });
- } catch (e) {
- const text = e instanceof Error ? e.message : String(e);
- const trust = e instanceof IpcError && connectRemedy(e.kind, e.message) === "trustHostKey";
- setTest({ ok: false, text, trust });
- } finally {
- setBusy(false);
- }
- };
-
- const trustAndRetry = async () => {
- await call(commands.dbTrustSshHost(s.id ?? ""));
- await runTest();
- };
-
- const save = async () => {
- setBusy(true);
- try {
- await saveSource(
- { ...s, name },
- sqlite ? undefined : password === undefined ? undefined : password || null,
- !sshOn || sshSecret === undefined || ssh.auth === "openSsh" ? undefined : sshSecret || null,
- );
- closeDialog();
- } catch (e) {
- setTest({ ok: false, text: e instanceof Error ? e.message : String(e) });
- } finally {
- setBusy(false);
- }
- };
-
- const browse = async () => {
- const { open } = await import("@tauri-apps/plugin-dialog");
- const file = await open({ multiple: false, directory: false, title: "SQLite Database File" });
- if (typeof file === "string") set({ file });
- };
-
- const browseKey = async () => {
- const { open } = await import("@tauri-apps/plugin-dialog");
- const file = await open({ multiple: false, directory: false, title: "Private Key File" });
- if (typeof file === "string") setSsh({ keyFile: file });
- };
-
- return (
- <Dialog
- open
- onClose={closeDialog}
- title={initial ? `Data Source: ${initial.name}` : "New Data Source"}
- width={560}
- footerStart={
- <Button onClick={() => void runTest()} disabled={busy || !valid}>
- <T>Test Connection</T>
- </Button>
- }
- buttons={[
- { label: "Cancel", role: "cancel" },
- { label: "OK", role: "default", disabled: busy || !valid, onClick: () => void save() },
- ]}
- >
- {!sqlite && (
- <Tabs
- variant="compact"
- className={styles.dialogTabs}
- activeId={tab}
- onSelect={(id) => setTab(id as "general" | "ssh")}
- aria-label="Data source settings"
- panelIdPrefix="db-source"
- items={[
- { id: "general", label: "General" },
- { id: "ssh", label: "SSH/SSL" },
- ]}
- />
- )}
- <div
- className={styles.form}
- role={sqlite ? undefined : "tabpanel"}
- id={sqlite ? undefined : `db-source-panel-${tab}`}
- >
- {sqlite || tab === "general" ? (
- <>
- <label className={styles.formLabel} htmlFor="db-name">
- <T>Name:</T>
- </label>
- <Input
- id="db-name"
- value={s.name ?? ""}
- placeholder={name}
- onChange={(e) => set({ name: e.target.value })}
- />
- <span className={styles.formLabel}>
- <T>Driver:</T>
- </span>
- <Select
- aria-label="Driver"
- value={s.driver ?? "postgres"}
- options={DRIVERS}
- onChange={(driver) => set({ driver })}
- />
- {sqlite ? (
- <>
- <label className={styles.formLabel} htmlFor="db-file">
- <T>File:</T>
- </label>
- <div className={styles.formRow}>
- <Input
- id="db-file"
- className={styles.fill}
- value={s.file ?? ""}
- placeholder="path/to/database.db (absolute or project-relative)"
- onChange={(e) => set({ file: e.target.value || null })}
- />
- <Button onClick={() => void browse()}>
- <T>Browse…</T>
- </Button>
- </div>
- </>
- ) : (
- <>
- <label className={styles.formLabel} htmlFor="db-host">
- <T>Host:</T>
- </label>
- <div className={styles.formRow}>
- <Input
- id="db-host"
- className={styles.fill}
- value={s.host ?? ""}
- onChange={(e) => set({ host: e.target.value })}
- />
- <label className={styles.formLabel} htmlFor="db-port">
- <T>Port:</T>
- </label>
- <Input
- id="db-port"
- style={{ width: 80 }}
- inputMode="numeric"
- value={s.port ?? ""}
- placeholder={s.driver === "mysql" ? "3306" : "5432"}
- onChange={(e) => set({ port: parsePort(e.target.value) })}
- />
- </div>
- {sshOn && (
- <>
- <span />
- <span className={styles.formHint}>Reached from the SSH host {sshLabel({ ssh })}.</span>
- </>
- )}
- <label className={styles.formLabel} htmlFor="db-user">
- <T>User:</T>
- </label>
- <Input id="db-user" value={s.user ?? ""} onChange={(e) => set({ user: e.target.value })} />
- <label className={styles.formLabel} htmlFor="db-password">
- <T>Password:</T>
- </label>
- <div className={styles.formRow}>
- <Input
- id="db-password"
- className={styles.fill}
- type="password"
- value={password ?? ""}
- placeholder={initial && password === undefined ? "<unchanged>" : ""}
- onChange={(e) => setPassword(e.target.value)}
- />
- <Checkbox
- checked={!!s.savePassword}
- onChange={(savePassword) => set({ savePassword })}
- label="Save password"
- />
- </div>
- <label className={styles.formLabel} htmlFor="db-database">
- <T>Database:</T>
- </label>
- <Input id="db-database" value={s.database ?? ""} onChange={(e) => set({ database: e.target.value })} />
- </>
- )}
- <span />
- <Checkbox checked={!!s.readOnly} onChange={(readOnly) => set({ readOnly })} label="Read-only" />
- </>
- ) : (
- <>
- <span />
- <Checkbox checked={!!ssh.enabled} onChange={(enabled) => setSsh({ enabled })} label="Use SSH tunnel" />
- <label className={styles.formLabel} htmlFor="db-ssh-host">
- <T>Host:</T>
- </label>
- <div className={styles.formRow}>
- <Input
- id="db-ssh-host"
- className={styles.fill}
- disabled={!sshOn}
- value={ssh.host ?? ""}
- placeholder={ssh.auth === "openSsh" ? "host or ~/.ssh/config alias" : "bastion.example.com"}
- onChange={(e) => setSsh({ host: e.target.value })}
- />
- <label className={styles.formLabel} htmlFor="db-ssh-port">
- <T>Port:</T>
- </label>
- <Input
- id="db-ssh-port"
- style={{ width: 80 }}
- inputMode="numeric"
- disabled={!sshOn}
- value={ssh.port ?? ""}
- placeholder="22"
- onChange={(e) => setSsh({ port: parsePort(e.target.value) })}
- />
- </div>
- <label className={styles.formLabel} htmlFor="db-ssh-user">
- <T>User:</T>
- </label>
- <Input
- id="db-ssh-user"
- disabled={!sshOn}
- value={ssh.user ?? ""}
- placeholder={ssh.auth === "openSsh" ? "from ~/.ssh/config" : ""}
- onChange={(e) => setSsh({ user: e.target.value })}
- />
- <span className={styles.formLabel}>
- <T>Authentication:</T>
- </span>
- <Select
- aria-label="SSH authentication type"
- disabled={!sshOn}
- value={ssh.auth ?? "openSsh"}
- options={SSH_AUTH}
- onChange={(auth) => setSsh({ auth })}
- />
- {ssh.auth === "keyPair" && (
- <>
- <label className={styles.formLabel} htmlFor="db-ssh-key">
- <T>Private key:</T>
- </label>
- <div className={styles.formRow}>
- <Input
- id="db-ssh-key"
- className={styles.fill}
- disabled={!sshOn}
- value={ssh.keyFile ?? ""}
- placeholder="~/.ssh/id_ed25519"
- onChange={(e) => setSsh({ keyFile: e.target.value })}
- />
- <Button disabled={!sshOn} onClick={() => void browseKey()}>
- <T>Browse…</T>
- </Button>
- </div>
- </>
- )}
- {ssh.auth === "openSsh" ? (
- <>
- <span />
- <span className={styles.formHint}>
- <T>
- {
- "Uses HostName, User, Port, IdentityFile and ProxyJump from ~/.ssh/config, and keys of the SSH agent."
- }
- </T>
- </span>
- </>
- ) : (
- <>
- <label className={styles.formLabel} htmlFor="db-ssh-secret">
- {ssh.auth === "password" ? "Password:" : "Passphrase:"}
- </label>
- <div className={styles.formRow}>
- <Input
- id="db-ssh-secret"
- className={styles.fill}
- type="password"
- disabled={!sshOn}
- value={sshSecret ?? ""}
- placeholder={initial && sshSecret === undefined ? "<unchanged>" : ""}
- onChange={(e) => setSshSecret(e.target.value)}
- />
- <Checkbox
- checked={!!ssh.saveSecret}
- disabled={!sshOn}
- onChange={(saveSecret) => setSsh({ saveSecret })}
- label="Save password"
- />
- </div>
- </>
- )}
- <span className={styles.formLabel}>
- <T>SSL:</T>
- </span>
- <Select aria-label="SSL mode" value={s.ssl ?? "prefer"} options={SSL} onChange={(ssl) => set({ ssl })} />
- </>
- )}
- <div className={`${styles.testResult} ${test?.ok ? styles.ok : styles.bad}`} role="status">
- {busy && !test ? "Connecting…" : test?.text}
- {test?.trust && (
- <>
- {" "}
- <Button size="small" onClick={() => void trustAndRetry()} disabled={busy}>
- <T>Trust Host and Retry</T>
- </Button>
- </>
- )}
- </div>
- </div>
- </Dialog>
- );
-}
-
function PasswordDialog({ source, resolve }: { source: DataSource; resolve: (ok: boolean) => void }) {
const [password, setPassword] = useState("");
const [save, setSave] = useState(!!source.savePassword);
diff --git a/src/features/database/ObjectDialogs.tsx b/src/features/database/ObjectDialogs.tsx
index 7926e78e9..748b0cd4a 100644
--- a/src/features/database/ObjectDialogs.tsx
+++ b/src/features/database/ObjectDialogs.tsx
@@ -515,8 +515,8 @@ function SourceUrlDialog() {
/>
<span className={styles.formHint}>
{url.trim() && !parsed
- ? "Not a PostgreSQL, MySQL / MariaDB or SQLite URL"
- : "postgresql://, mysql://, mariadb://, jdbc:…, sqlite:path"}
+ ? "Not a URL of PostgreSQL, MySQL, SQLite or a compatible database"
+ : "postgresql://, mysql://, mariadb://, redshift://, tidb://…, jdbc:…, sqlite:path"}
</span>
</div>
</Dialog>
@@ -550,6 +550,7 @@ function QuickDoc({ node, anchor }: { node: DbNode; anchor: { x: number; y: numb
switch (node.kind) {
case "source":
rows.push(["Driver", sourceLabel(node.source).replace(/^.*\((.*)\)$/, "$1")]);
+ if (node.source.comment?.trim()) rows.push(["Comment", node.source.comment.trim()]);
rows.push(
node.source.driver === "sqlite"
? ["File", node.source.file ?? ""]
diff --git a/src/features/database/SourceDialog.tsx b/src/features/database/SourceDialog.tsx
new file mode 100644
index 000000000..74de4a8ed
--- /dev/null
+++ b/src/features/database/SourceDialog.tsx
@@ -0,0 +1,935 @@
+/**
+ * Data source properties (IDEA's Data Sources and Drivers page): name, colour and
+ * comment above General / Options / SSH/SSL / Schemas / Advanced tabs, Test Connection.
+ */
+import { useState, type ReactNode } from "react";
+import {
+ call,
+ commands,
+ IpcError,
+ type DataSource,
+ type DbColor,
+ type DbIntrospection,
+ type DbOptions,
+ type DbProperty,
+ type DbSsh,
+ type DbSshAuth,
+ type DbSslMode,
+ type DbTxMode,
+} from "@/platform/ipc";
+import { useTx, useTxTemplate } from "@/platform/i18n";
+import { Button, Checkbox, Dialog, IconButton, Input, Select, Tabs, T, type SelectOption } from "@/ui";
+import { colorVar, connectRemedy, fileSourceName, newSourceId, parseSourceUrl, sshLabel } from "./model";
+import { closeDialog, loadDatabases, loadSchemas, saveSource, useDatabase } from "./store";
+import { VENDORS, sourceUrl, vendorById, vendorOf } from "./vendors";
+import styles from "./Database.module.css";
+
+type Tab = "general" | "options" | "ssh" | "schemas" | "advanced";
+
+const TYPES: SelectOption[] = VENDORS.map((v) => ({ value: v.id, label: v.label, icon: v.icon }));
+
+const COLORS: Array<SelectOption<DbColor | "none">> = [
+ { value: "none", label: "No color" },
+ { value: "red", label: "Red" },
+ { value: "orange", label: "Orange" },
+ { value: "yellow", label: "Yellow" },
+ { value: "green", label: "Green" },
+ { value: "blue", label: "Blue" },
+ { value: "violet", label: "Violet" },
+];
+
+const SSL: Array<SelectOption<DbSslMode>> = [
+ { value: "disable", label: "Disable" },
+ { value: "prefer", label: "Prefer" },
+ { value: "require", label: "Require" },
+ { value: "verifyCa", label: "Verify CA" },
+ { value: "verifyFull", label: "Verify Full" },
+];
+
+const TX: Array<SelectOption<DbTxMode>> = [
+ { value: "auto", label: "Auto" },
+ { value: "manual", label: "Manual" },
+];
+
+const SSH_AUTH: Array<SelectOption<DbSshAuth>> = [
+ { value: "openSsh", label: "OpenSSH config and authentication agent" },
+ { value: "password", label: "Password" },
+ { value: "keyPair", label: "Key pair" },
+];
+
+/** Driver property names the Advanced tab suggests, and what the backend does with them. */
+const PROPERTIES: Record<string, { names: string[]; hint: string }> = {
+ postgres: {
+ names: ["statement_timeout", "lock_timeout", "idle_in_transaction_session_timeout", "search_path", "work_mem", "application_name", "connect_timeout"],
+ hint: "Sent as run-time parameters when connecting (any server setting, e.g. statement_timeout). application_name names the session; connect_timeout is in seconds.",
+ },
+ mysql: {
+ names: ["sql_mode", "max_execution_time", "wait_timeout", "charset", "collation", "connect_timeout"],
+ hint: "Set as session variables after connecting (SET SESSION name = value). charset and collation pick the connection character set; connect_timeout is in seconds.",
+ },
+ sqlite: {
+ names: ["foreign_keys", "busy_timeout", "cache_size", "journal_mode", "synchronous"],
+ hint: "Applied as pragmas when opening the file (PRAGMA name = value).",
+ },
+};
+
+const blankSsh = (): DbSsh => ({
+ enabled: false,
+ host: "",
+ port: null,
+ user: "",
+ auth: "openSsh",
+ keyFile: "",
+ saveSecret: true,
+});
+
+const blankOptions = (): DbOptions => ({
+ transaction: "auto",
+ defaultSchema: "",
+ timeZone: "",
+ startupScript: "",
+ keepAliveSecs: null,
+ autoDisconnectSecs: null,
+});
+
+const blankIntrospection = (): DbIntrospection => ({
+ allDatabases: true,
+ databases: [],
+ allSchemas: true,
+ schemas: [],
+ showSystem: false,
+});
+
+const parsePort = (v: string) => {
+ const n = parseInt(v, 10);
+ return Number.isFinite(n) && n > 0 && n < 65536 ? n : null;
+};
+
+const parseSecs = (v: string) => {
+ const n = parseInt(v, 10);
+ return Number.isFinite(n) && n > 0 ? n : null;
+};
+
+function blank(): DataSource {
+ return {
+ id: newSourceId(),
+ name: "",
+ driver: "postgres",
+ vendor: "",
+ host: "localhost",
+ port: null,
+ database: "",
+ user: "",
+ file: null,
+ ssl: "prefer",
+ savePassword: true,
+ readOnly: false,
+ color: null,
+ comment: "",
+ urlOnly: false,
+ url: "",
+ sslCaFile: "",
+ sslCertFile: "",
+ sslKeyFile: "",
+ options: blankOptions(),
+ introspection: blankIntrospection(),
+ properties: [],
+ };
+}
+
+async function pickFile(title: string): Promise<string | null> {
+ const { open } = await import("@tauri-apps/plugin-dialog");
+ const file = await open({ multiple: false, directory: false, title });
+ return typeof file === "string" ? file : null;
+}
+
+/** A path field with Browse…. */
+function FileField({
+ id,
+ label,
+ value,
+ placeholder,
+ disabled,
+ title,
+ onChange,
+}: {
+ id: string;
+ label: string;
+ value: string;
+ placeholder?: string;
+ disabled?: boolean;
+ title: string;
+ onChange: (v: string) => void;
+}) {
+ return (
+ <>
+ <label className={styles.formLabel} htmlFor={id}>
+ <T>{label}</T>
+ </label>
+ <div className={styles.formRow}>
+ <Input
+ id={id}
+ className={styles.fill}
+ disabled={disabled}
+ value={value}
+ placeholder={placeholder}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ <Button
+ disabled={disabled}
+ onClick={() =>
+ void pickFile(title).then((f) => {
+ if (f) onChange(f);
+ })
+ }
+ >
+ <T>Browse…</T>
+ </Button>
+ </div>
+ </>
+ );
+}
+
+/** Seconds after a checkbox (Run keep-alive query each N sec.). */
+function SecondsOption({
+ label,
+ value,
+ fallback,
+ onChange,
+}: {
+ label: string;
+ value: number | null | undefined;
+ fallback: number;
+ onChange: (v: number | null) => void;
+}) {
+ const [draft, setDraft] = useState(String(value ?? fallback));
+ const on = value != null;
+ return (
+ <>
+ <span />
+ <div className={styles.formRow}>
+ <Checkbox checked={on} onChange={(c) => onChange(c ? (parseSecs(draft) ?? fallback) : null)} label={label} />
+ <Input
+ className={styles.secondsInput}
+ inputMode="numeric"
+ aria-label={`${label} (seconds)`}
+ disabled={!on}
+ value={draft}
+ onChange={(e) => {
+ setDraft(e.target.value);
+ const n = parseSecs(e.target.value);
+ if (n) onChange(n);
+ }}
+ />
+ <span>
+ <T>sec.</T>
+ </span>
+ </div>
+ </>
+ );
+}
+
+/** Schemas tab: "All …" or a choice of names and `*` / `?` patterns. */
+function NamePicker({
+ title,
+ all,
+ chosen,
+ known,
+ onAll,
+ onChosen,
+}: {
+ title: string;
+ all: boolean;
+ chosen: string[];
+ known: string[];
+ onAll: (all: boolean) => void;
+ onChosen: (chosen: string[]) => void;
+}) {
+ const [pattern, setPattern] = useState("");
+ const names = [...new Set([...known, ...chosen])];
+ const add = () => {
+ const p = pattern.trim();
+ if (p && !chosen.includes(p)) onChosen([...chosen, p]);
+ setPattern("");
+ };
+ return (
+ <div className={styles.namePicker}>
+ <Checkbox checked={all} onChange={onAll} label={`All ${title}`} />
+ {!all && (
+ <div className={styles.nameList}>
+ {names.map((n) => (
+ <Checkbox
+ key={n}
+ checked={chosen.includes(n)}
+ onChange={(c) => onChosen(c ? [...chosen, n] : chosen.filter((x) => x !== n))}
+ label={n}
+ />
+ ))}
+ <div className={styles.formRow}>
+ <Input
+ className={styles.fill}
+ value={pattern}
+ placeholder="Name or pattern, e.g. app_*"
+ aria-label={`Add ${title} pattern`}
+ onChange={(e) => setPattern(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && !e.nativeEvent.isComposing) {
+ e.preventDefault();
+ add();
+ }
+ }}
+ />
+ <Button disabled={!pattern.trim()} onClick={add}>
+ <T>Add Pattern</T>
+ </Button>
+ </div>
+ </div>
+ )}
+ </div>
+ );
+}
+
+function Section({ title }: { title: string }) {
+ return (
+ <div className={styles.formSection}>
+ <T>{title}</T>
+ </div>
+ );
+}
+
+export function SourceDialog({
+ initial,
+ preset,
+ presetPassword,
+}: {
+ initial: DataSource | null;
+ preset?: Partial<DataSource>;
+ presetPassword?: string | null;
+}) {
+ const tx = useTx();
+ const txTemplate = useTxTemplate();
+ const [s, setS] = useState<DataSource>(() => ({ ...blank(), ...preset, ...initial }));
+ // `undefined`: unchanged (editing keeps the stored password).
+ const [password, setPassword] = useState<string | undefined>(presetPassword ?? undefined);
+ // Same convention for the SSH password / passphrase.
+ const [sshSecret, setSshSecret] = useState<string | undefined>(undefined);
+ const [tab, setTab] = useState<Tab>("general");
+ const [test, setTest] = useState<{ ok: boolean; text: string; trust?: boolean } | null>(null);
+ const [busy, setBusy] = useState(false);
+ const [showComment, setShowComment] = useState(!!s.comment);
+ // The URL being typed in default mode (null: show the fields' URL).
+ const [urlDraft, setUrlDraft] = useState<string | null>(null);
+ const loadedDbs = useDatabase((st) => (initial?.id ? st.databases[initial.id] : undefined));
+ const loadedSchemas = useDatabase((st) => (initial?.id ? st.schemas[initial.id] : undefined));
+
+ const set = (patch: Partial<DataSource>) => setS((x) => ({ ...x, ...patch }));
+ const ssh: DbSsh = { ...blankSsh(), ...s.ssh };
+ const setSsh = (patch: Partial<DbSsh>) => setS((x) => ({ ...x, ssh: { ...blankSsh(), ...x.ssh, ...patch } }));
+ const options: DbOptions = { ...blankOptions(), ...s.options };
+ const setOptions = (patch: Partial<DbOptions>) => setS((x) => ({ ...x, options: { ...blankOptions(), ...x.options, ...patch } }));
+ const intro: DbIntrospection = { ...blankIntrospection(), ...s.introspection };
+ const setIntro = (patch: Partial<DbIntrospection>) =>
+ setS((x) => ({ ...x, introspection: { ...blankIntrospection(), ...x.introspection, ...patch } }));
+ const properties = s.properties ?? [];
+ const setProperty = (i: number, patch: Partial<DbProperty>) =>
+ set({ properties: properties.map((p, j) => (j === i ? { ...p, ...patch } : p)) });
+
+ const vendor = vendorOf(s);
+ const sqlite = s.driver === "sqlite";
+ const postgres = s.driver === "postgres";
+ const urlOnly = !sqlite && !!s.urlOnly;
+ const parsedUrl = urlOnly ? parseSourceUrl(s.url ?? "") : null;
+ const urlValid = !!parsedUrl && parsedUrl.source.driver === s.driver;
+ const host = urlOnly ? (parsedUrl?.source.host ?? "") : (s.host ?? "");
+ const database = urlOnly ? (parsedUrl?.source.database ?? "") : (s.database ?? "");
+ const name = s.name?.trim() || (sqlite ? fileSourceName(s.file ?? "") : `${database || s.user || "db"}@${host || "localhost"}`);
+ const sshOn = !sqlite && !!ssh.enabled;
+ const valid = sqlite ? !!s.file?.trim() : (urlOnly ? urlValid : !!s.host?.trim()) && (!sshOn || !!ssh.host?.trim());
+ const sslOn = (s.ssl ?? "prefer") !== "disable";
+
+ /** What is saved / tested: a preset's port when the field was left empty. */
+ const effective = (): DataSource => ({ ...s, name, port: s.port ?? (s.vendor ? vendor.port : null) });
+
+ const setType = (id: string) => {
+ const v = vendorById(id);
+ if (!v) return;
+ setS((x) => {
+ const old = vendorOf(x);
+ const port = x.port == null || x.port === old.port ? v.port : x.port;
+ return { ...x, driver: v.driver, vendor: v.id === v.driver ? "" : v.id, port, ssl: v.ssl ?? x.ssl };
+ });
+ };
+
+ /** Typing a URL in default mode fills the fields it names. */
+ const typeUrl = (text: string) => {
+ setUrlDraft(text);
+ const p = parseSourceUrl(text);
+ if (!p || p.source.driver !== s.driver) return;
+ const { host: h, port, database: db, user, ssl, sslCaFile, sslCertFile, sslKeyFile, vendor: v } = p.source;
+ set({
+ host: h,
+ port,
+ database: db,
+ ...(user ? { user } : {}),
+ ...(ssl ? { ssl } : {}),
+ ...(sslCaFile ? { sslCaFile } : {}),
+ ...(sslCertFile ? { sslCertFile } : {}),
+ ...(sslKeyFile ? { sslKeyFile } : {}),
+ ...(v ? { vendor: v } : {}),
+ });
+ if (p.password) setPassword(p.password);
+ };
+
+ const setUrlOnly = (on: boolean) => set(on && !s.url?.trim() ? { urlOnly: on, url: sourceUrl(s) } : { urlOnly: on });
+
+ const runTest = async () => {
+ setBusy(true);
+ setTest(null);
+ try {
+ const v = await call(commands.dbTest(effective(), password ?? null, sshOn ? (sshSecret ?? null) : null));
+ setTest({ ok: true, text: `Succeeded: ${v}` });
+ } catch (e) {
+ const text = e instanceof Error ? e.message : String(e);
+ const trust = e instanceof IpcError && connectRemedy(e.kind, e.message) === "trustHostKey";
+ setTest({ ok: false, text, trust });
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ const trustAndRetry = async () => {
+ await call(commands.dbTrustSshHost(s.id ?? ""));
+ await runTest();
+ };
+
+ const save = async () => {
+ setBusy(true);
+ try {
+ await saveSource(
+ { ...effective(), properties: properties.filter((p) => p.name?.trim()) },
+ sqlite ? undefined : password === undefined ? undefined : password || null,
+ !sshOn || sshSecret === undefined || ssh.auth === "openSsh" ? undefined : sshSecret || null,
+ );
+ closeDialog();
+ } catch (e) {
+ setTest({ ok: false, text: e instanceof Error ? e.message : String(e) });
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ const loadNames = async () => {
+ const id = initial?.id;
+ if (!id) return;
+ await Promise.all([postgres ? loadDatabases(id) : Promise.resolve(), loadSchemas(id)]);
+ };
+
+ const tabs: Array<{ id: Tab; label: string }> = [
+ { id: "general", label: "General" },
+ { id: "options", label: "Options" },
+ ...(sqlite
+ ? []
+ : [
+ { id: "ssh" as const, label: "SSH/SSL" },
+ { id: "schemas" as const, label: "Schemas" },
+ ]),
+ { id: "advanced", label: "Advanced" },
+ ];
+ const current = tabs.some((t) => t.id === tab) ? tab : "general";
+ const props = PROPERTIES[s.driver ?? "sqlite"]!;
+
+ const general = (
+ <>
+ <span className={styles.formLabel}>
+ <T>Driver:</T>
+ </span>
+ <Select aria-label="Data source type" value={vendor.id} options={TYPES} onChange={setType} />
+ {sqlite ? (
+ <FileField
+ id="db-file"
+ label="File:"
+ value={s.file ?? ""}
+ placeholder="path/to/database.db (absolute or project-relative)"
+ title="SQLite Database File"
+ onChange={(file) => set({ file: file || null })}
+ />
+ ) : (
+ <>
+ <span className={styles.formLabel}>
+ <T>Connection type:</T>
+ </span>
+ <div className={styles.segmented} role="group" aria-label={tx("Connection type")}>
+ <button type="button" aria-pressed={!urlOnly} onClick={() => setUrlOnly(false)}>
+ <T>default</T>
+ </button>
+ <button type="button" aria-pressed={urlOnly} onClick={() => setUrlOnly(true)}>
+ <T>URL only</T>
+ </button>
+ </div>
+ {!urlOnly && (
+ <>
+ <label className={styles.formLabel} htmlFor="db-host">
+ <T>Host:</T>
+ </label>
+ <div className={styles.formRow}>
+ <Input id="db-host" className={styles.fill} value={s.host ?? ""} onChange={(e) => set({ host: e.target.value })} />
+ <label className={styles.formLabel} htmlFor="db-port">
+ <T>Port:</T>
+ </label>
+ <Input
+ id="db-port"
+ className={styles.portInput}
+ inputMode="numeric"
+ value={s.port ?? ""}
+ placeholder={String(vendor.port ?? "")}
+ onChange={(e) => set({ port: parsePort(e.target.value) })}
+ />
+ </div>
+ </>
+ )}
+ {sshOn && (
+ <>
+ <span />
+ <span className={styles.formHint}>Reached from the SSH host {sshLabel({ ssh })}.</span>
+ </>
+ )}
+ <label className={styles.formLabel} htmlFor="db-user">
+ <T>User:</T>
+ </label>
+ <Input
+ id="db-user"
+ value={s.user ?? ""}
+ placeholder={urlOnly ? "from the URL" : ""}
+ onChange={(e) => set({ user: e.target.value })}
+ />
+ <label className={styles.formLabel} htmlFor="db-password">
+ <T>Password:</T>
+ </label>
+ <div className={styles.formRow}>
+ <Input
+ id="db-password"
+ className={styles.fill}
+ type="password"
+ value={password ?? ""}
+ placeholder={initial && password === undefined ? "<unchanged>" : ""}
+ onChange={(e) => setPassword(e.target.value)}
+ />
+ <Checkbox checked={!!s.savePassword} onChange={(savePassword) => set({ savePassword })} label="Save password" />
+ </div>
+ {!urlOnly && (
+ <>
+ <label className={styles.formLabel} htmlFor="db-database">
+ <T>Database:</T>
+ </label>
+ <Input id="db-database" value={s.database ?? ""} onChange={(e) => set({ database: e.target.value })} />
+ </>
+ )}
+ <label className={styles.formLabel} htmlFor="db-url">
+ <T>URL:</T>
+ </label>
+ <Input
+ id="db-url"
+ mono
+ value={urlOnly ? (s.url ?? "") : (urlDraft ?? sourceUrl(s))}
+ invalid={urlOnly ? !urlValid : urlDraft !== null && parseSourceUrl(urlDraft)?.source.driver !== s.driver}
+ placeholder={sourceUrl(s)}
+ onChange={(e) => (urlOnly ? set({ url: e.target.value }) : typeUrl(e.target.value))}
+ onBlur={() => setUrlDraft(null)}
+ />
+ <span />
+ <span className={styles.formHint}>
+ {txTemplate(
+ urlOnly
+ ? urlValid || !s.url?.trim()
+ ? "Connects with the URL alone: host, port, database, SSL and parameters come from it."
+ : `Not a ${vendor.label} URL`
+ : "Editing the URL fills in the settings above.",
+ )}
+ </span>
+ </>
+ )}
+ </>
+ );
+
+ const optionsTab = (
+ <>
+ <Section title="Connection" />
+ <span />
+ <Checkbox checked={!!s.readOnly} onChange={(readOnly) => set({ readOnly })} label="Read-only" />
+ <span className={styles.formLabel}>
+ <T>Transaction control:</T>
+ </span>
+ <Select
+ aria-label="Transaction control"
+ className={styles.narrowSelect}
+ value={options.transaction ?? "auto"}
+ options={TX}
+ onChange={(transaction) => setOptions({ transaction })}
+ />
+ {postgres && (
+ <>
+ <label className={styles.formLabel} htmlFor="db-default-schema">
+ <T>Default schema:</T>
+ </label>
+ <Input
+ id="db-default-schema"
+ value={options.defaultSchema ?? ""}
+ placeholder="public (search_path, e.g. app, public)"
+ onChange={(e) => setOptions({ defaultSchema: e.target.value })}
+ />
+ </>
+ )}
+ {!sqlite && (
+ <>
+ <label className={styles.formLabel} htmlFor="db-time-zone">
+ <T>Time zone:</T>
+ </label>
+ <Input
+ id="db-time-zone"
+ value={options.timeZone ?? ""}
+ placeholder={postgres ? "Server default, e.g. UTC or Europe/Berlin" : "UTC (+00:00), e.g. Europe/Berlin or +08:00"}
+ onChange={(e) => setOptions({ timeZone: e.target.value })}
+ />
+ <SecondsOption
+ label="Run keep-alive query each"
+ value={options.keepAliveSecs}
+ fallback={60}
+ onChange={(keepAliveSecs) => setOptions({ keepAliveSecs })}
+ />
+ </>
+ )}
+ <SecondsOption
+ label="Auto-disconnect after"
+ value={options.autoDisconnectSecs}
+ fallback={300}
+ onChange={(autoDisconnectSecs) => setOptions({ autoDisconnectSecs })}
+ />
+ <label className={styles.formLabel} htmlFor="db-startup">
+ <T>Startup script:</T>
+ </label>
+ <textarea
+ id="db-startup"
+ className={styles.textArea}
+ spellCheck={false}
+ value={options.startupScript ?? ""}
+ placeholder={postgres ? "SET statement_timeout = '30s';" : sqlite ? "PRAGMA foreign_keys = ON;" : "SET SESSION sql_mode = 'ANSI';"}
+ onChange={(e) => setOptions({ startupScript: e.target.value })}
+ />
+ <span />
+ <span className={styles.formHint}>
+ <T>Runs on every new connection, before any other statement.</T>
+ </span>
+ </>
+ );
+
+ const sshTab = (
+ <>
+ <span />
+ <Checkbox checked={!!ssh.enabled} onChange={(enabled) => setSsh({ enabled })} label="Use SSH tunnel" />
+ <label className={styles.formLabel} htmlFor="db-ssh-host">
+ <T>Host:</T>
+ </label>
+ <div className={styles.formRow}>
+ <Input
+ id="db-ssh-host"
+ className={styles.fill}
+ disabled={!sshOn}
+ value={ssh.host ?? ""}
+ placeholder={ssh.auth === "openSsh" ? "host or ~/.ssh/config alias" : "bastion.example.com"}
+ onChange={(e) => setSsh({ host: e.target.value })}
+ />
+ <label className={styles.formLabel} htmlFor="db-ssh-port">
+ <T>Port:</T>
+ </label>
+ <Input
+ id="db-ssh-port"
+ className={styles.portInput}
+ inputMode="numeric"
+ disabled={!sshOn}
+ value={ssh.port ?? ""}
+ placeholder="22"
+ onChange={(e) => setSsh({ port: parsePort(e.target.value) })}
+ />
+ </div>
+ <label className={styles.formLabel} htmlFor="db-ssh-user">
+ <T>User:</T>
+ </label>
+ <Input
+ id="db-ssh-user"
+ disabled={!sshOn}
+ value={ssh.user ?? ""}
+ placeholder={ssh.auth === "openSsh" ? "from ~/.ssh/config" : ""}
+ onChange={(e) => setSsh({ user: e.target.value })}
+ />
+ <span className={styles.formLabel}>
+ <T>Authentication:</T>
+ </span>
+ <Select
+ aria-label="SSH authentication type"
+ disabled={!sshOn}
+ value={ssh.auth ?? "openSsh"}
+ options={SSH_AUTH}
+ onChange={(auth) => setSsh({ auth })}
+ />
+ {ssh.auth === "keyPair" && (
+ <FileField
+ id="db-ssh-key"
+ label="Private key:"
+ value={ssh.keyFile ?? ""}
+ placeholder="~/.ssh/id_ed25519"
+ disabled={!sshOn}
+ title="Private Key File"
+ onChange={(keyFile) => setSsh({ keyFile })}
+ />
+ )}
+ {ssh.auth === "openSsh" ? (
+ <>
+ <span />
+ <span className={styles.formHint}>
+ <T>{"Uses HostName, User, Port, IdentityFile and ProxyJump from ~/.ssh/config, and keys of the SSH agent."}</T>
+ </span>
+ </>
+ ) : (
+ <>
+ <label className={styles.formLabel} htmlFor="db-ssh-secret">
+ {tx(ssh.auth === "password" ? "Password:" : "Passphrase:")}
+ </label>
+ <div className={styles.formRow}>
+ <Input
+ id="db-ssh-secret"
+ className={styles.fill}
+ type="password"
+ disabled={!sshOn}
+ value={sshSecret ?? ""}
+ placeholder={initial && sshSecret === undefined ? "<unchanged>" : ""}
+ onChange={(e) => setSshSecret(e.target.value)}
+ />
+ <Checkbox
+ checked={!!ssh.saveSecret}
+ disabled={!sshOn}
+ onChange={(saveSecret) => setSsh({ saveSecret })}
+ label="Save password"
+ />
+ </div>
+ </>
+ )}
+ <Section title="SSL" />
+ <span className={styles.formLabel}>
+ <T>Mode:</T>
+ </span>
+ <Select
+ aria-label="SSL mode"
+ className={styles.narrowSelect}
+ value={s.ssl ?? "prefer"}
+ options={SSL}
+ onChange={(ssl) => set({ ssl })}
+ />
+ <FileField
+ id="db-ssl-ca"
+ label="CA file:"
+ value={s.sslCaFile ?? ""}
+ placeholder={s.ssl === "verifyCa" || s.ssl === "verifyFull" ? "System roots when empty" : ""}
+ disabled={!sslOn}
+ title="CA Certificate File"
+ onChange={(sslCaFile) => set({ sslCaFile })}
+ />
+ <FileField
+ id="db-ssl-cert"
+ label="Client certificate file:"
+ value={s.sslCertFile ?? ""}
+ disabled={!sslOn}
+ title="Client Certificate File"
+ onChange={(sslCertFile) => set({ sslCertFile })}
+ />
+ <FileField
+ id="db-ssl-key"
+ label="Client key file:"
+ value={s.sslKeyFile ?? ""}
+ disabled={!sslOn}
+ title="Client Key File"
+ onChange={(sslKeyFile) => set({ sslKeyFile })}
+ />
+ </>
+ );
+
+ const knownDbs = loadedDbs?.status === "ok" ? loadedDbs.value.names : [];
+ const knownSchemas = loadedSchemas?.status === "ok" ? loadedSchemas.value : [];
+ const schemasTab = (
+ <>
+ <div className={styles.formWide}>
+ {postgres && (
+ <NamePicker
+ title="databases"
+ all={intro.allDatabases !== false}
+ chosen={intro.databases ?? []}
+ known={knownDbs}
+ onAll={(allDatabases) => setIntro({ allDatabases })}
+ onChosen={(databases) => setIntro({ databases })}
+ />
+ )}
+ <NamePicker
+ title={s.driver === "mysql" ? "schemas (databases)" : "schemas"}
+ all={intro.allSchemas !== false}
+ chosen={intro.schemas ?? []}
+ known={knownSchemas}
+ onAll={(allSchemas) => setIntro({ allSchemas })}
+ onChosen={(schemas) => setIntro({ schemas })}
+ />
+ <Checkbox
+ checked={!!intro.showSystem}
+ onChange={(showSystem) => setIntro({ showSystem })}
+ label={postgres ? "Show system schemas and template databases" : "Show system schemas"}
+ />
+ <div className={styles.formRow}>
+ <Button disabled={!initial?.id || busy} onClick={() => void loadNames()}>
+ <T>Load Names from Server</T>
+ </Button>
+ <span className={styles.formHint}>
+ {initial?.id
+ ? "The Database tree shows only the checked names and patterns (* and ?); the connected database always shows."
+ : "Save the data source to pick from the server's names; patterns (* and ?) work any time."}
+ </span>
+ </div>
+ </div>
+ </>
+ );
+
+ const advancedTab = (
+ <div className={styles.formWide}>
+ <div className={styles.propertyTable} role="table" aria-label={tx("Driver properties")}>
+ <div role="row" className={styles.propertyHead}>
+ <span role="columnheader">
+ <T>Name</T>
+ </span>
+ <span role="columnheader">
+ <T>Value</T>
+ </span>
+ <span />
+ </div>
+ {properties.map((p, i) => (
+ <div role="row" key={i} className={styles.propertyRow}>
+ <Input
+ aria-label="Property name"
+ list="db-property-names"
+ value={p.name ?? ""}
+ placeholder="<user defined>"
+ onChange={(e) => setProperty(i, { name: e.target.value })}
+ />
+ <Input aria-label="Property value" value={p.value ?? ""} placeholder="<value>" onChange={(e) => setProperty(i, { value: e.target.value })} />
+ <IconButton
+ icon="close"
+ size="small"
+ aria-label="Remove property"
+ title="Remove"
+ onClick={() => set({ properties: properties.filter((_, j) => j !== i) })}
+ />
+ </div>
+ ))}
+ </div>
+ <datalist id="db-property-names">
+ {props.names.map((n) => (
+ <option key={n} value={n} />
+ ))}
+ </datalist>
+ <div className={styles.formRow}>
+ <Button icon="plus" onClick={() => set({ properties: [...properties, { name: "", value: "" }] })}>
+ <T>Add Property</T>
+ </Button>
+ </div>
+ <span className={styles.formHint}>
+ <T>{props.hint}</T>
+ </span>
+ </div>
+ );
+
+ const body: Record<Tab, ReactNode> = {
+ general,
+ options: optionsTab,
+ ssh: sshTab,
+ schemas: schemasTab,
+ advanced: advancedTab,
+ };
+
+ return (
+ <Dialog
+ open
+ onClose={closeDialog}
+ title={initial ? `Data Source: ${initial.name}` : "New Data Source"}
+ width={640}
+ footerStart={
+ <Button onClick={() => void runTest()} disabled={busy || !valid}>
+ <T>Test Connection</T>
+ </Button>
+ }
+ buttons={[
+ { label: "Cancel", role: "cancel" },
+ { label: "OK", role: "default", disabled: busy || !valid, onClick: () => void save() },
+ ]}
+ >
+ <div className={styles.form}>
+ <label className={styles.formLabel} htmlFor="db-name">
+ <T>Name:</T>
+ </label>
+ <div className={styles.formRow}>
+ <Input id="db-name" className={styles.fill} value={s.name ?? ""} placeholder={name} onChange={(e) => set({ name: e.target.value })} />
+ <span className={styles.formLabel}>
+ <T>Color:</T>
+ </span>
+ <Select
+ aria-label="Color"
+ className={styles.narrowSelect}
+ value={s.color ?? "none"}
+ options={COLORS}
+ onChange={(c) => set({ color: c === "none" ? null : c })}
+ renderValue={(o) => (
+ <span className={styles.colorValue}>
+ {o && o.value !== "none" && <span className={styles.colorSwatch} style={{ background: colorVar(o.value as DbColor) }} />}
+ <T>{o?.label ?? "No color"}</T>
+ </span>
+ )}
+ />
+ </div>
+ <span />
+ {showComment ? (
+ <textarea
+ className={styles.textArea}
+ aria-label={tx("Comment")}
+ autoFocus={!s.comment}
+ rows={2}
+ value={s.comment ?? ""}
+ placeholder={tx("Comment")}
+ onChange={(e) => set({ comment: e.target.value })}
+ />
+ ) : (
+ <button type="button" className={styles.linkButton} onClick={() => setShowComment(true)}>
+ <T>Add comment</T>
+ </button>
+ )}
+ </div>
+ <Tabs
+ variant="compact"
+ className={styles.dialogTabs}
+ activeId={current}
+ onSelect={(id) => setTab(id as Tab)}
+ aria-label="Data source settings"
+ panelIdPrefix="db-source"
+ items={tabs}
+ />
+ <div className={styles.form} role="tabpanel" id={`db-source-panel-${current}`}>
+ {body[current]}
+ <div className={`${styles.testResult} ${test?.ok ? styles.ok : styles.bad}`} role="status">
+ {busy && !test ? tx("Connecting…") : test?.text}
+ {test?.trust && (
+ <>
+ {" "}
+ <Button size="small" onClick={() => void trustAndRetry()} disabled={busy}>
+ <T>Trust Host and Retry</T>
+ </Button>
+ </>
+ )}
+ </div>
+ </div>
+ </Dialog>
+ );
+}
+
diff --git a/src/features/database/database.test.ts b/src/features/database/database.test.ts
index 39da3b2f9..a906df93d 100644
--- a/src/features/database/database.test.ts
+++ b/src/features/database/database.test.ts
@@ -1,6 +1,23 @@
import { describe, expect, it } from "vitest";
import { exportData, type ExportData } from "./export";
-import { buildRowEdits, connectRemedy, emptyEdits, hasEdits, parseSourceUrl, sourceLabel, splitTarget, sshLabel, targetOf, toCsv, toTsv } from "./model";
+import {
+ buildRowEdits,
+ colorVar,
+ connectRemedy,
+ emptyEdits,
+ hasEdits,
+ idleTargets,
+ matchesPattern,
+ parseSourceUrl,
+ shownNames,
+ sourceLabel,
+ splitTarget,
+ sshLabel,
+ targetOf,
+ toCsv,
+ toTsv,
+} from "./model";
+import { VENDORS, sourceUrl, vendorById, vendorOf, vendorPreset } from "./vendors";
describe("clipboard formats", () => {
it("copies TSV with NULL as empty and whitespace flattened", () => {
@@ -131,3 +148,88 @@ describe("parseSourceUrl", () => {
expect(parseSourceUrl("oracle://x")).toBeNull();
});
});
+
+describe("data source types", () => {
+ it("presets wire-compatible products on the existing drivers", () => {
+ expect(vendorPreset(vendorById("cockroachdb")!)).toEqual({ driver: "postgres", vendor: "cockroachdb", port: 26257 });
+ expect(vendorPreset(vendorById("postgres")!)).toEqual({ driver: "postgres", vendor: "", port: 5432 });
+ expect(vendorPreset(vendorById("supabase")!).ssl).toBe("require");
+ expect(VENDORS.every((v) => ["postgres", "mysql", "sqlite"].includes(v.driver))).toBe(true);
+ const labels = VENDORS.map((v) => v.label);
+ expect(labels).toEqual([...labels].sort((a, b) => a.localeCompare(b)));
+ });
+
+ it("falls back to the driver for unknown or mismatched presets", () => {
+ expect(vendorOf({ driver: "mysql", vendor: "tidb" }).label).toBe("TiDB");
+ expect(vendorOf({ driver: "postgres", vendor: "tidb" }).id).toBe("postgres");
+ expect(vendorOf({ driver: "mysql" }).id).toBe("mysql");
+ expect(sourceLabel({ name: "tidb", driver: "mysql", vendor: "tidb" })).toBe("tidb (TiDB)");
+ });
+
+ it("previews the JDBC URL of the fields", () => {
+ expect(sourceUrl({ driver: "postgres", host: "localhost", port: 5432, database: "postgres" })).toBe(
+ "jdbc:postgresql://localhost:5432/postgres",
+ );
+ expect(sourceUrl({ driver: "postgres", vendor: "redshift", host: "r", port: null, database: "" })).toBe("jdbc:redshift://r:5439");
+ expect(sourceUrl({ driver: "mysql", vendor: "mariadb", host: "::1", port: 3307, database: "a b" })).toBe(
+ "jdbc:mariadb://[::1]:3307/a%20b",
+ );
+ expect(sourceUrl({ driver: "sqlite", file: "app.db" })).toBe("jdbc:sqlite:app.db");
+ });
+
+ it("reads URLs of compatible products, SSL settings and driver properties", () => {
+ const tidb = parseSourceUrl("jdbc:tidb://[email protected]:4000/test?sslmode=verify-full&sslrootcert=/ca.pem&sql_mode=ANSI");
+ expect(tidb?.source).toEqual({
+ driver: "mysql",
+ vendor: "tidb",
+ host: "tidb.local",
+ port: 4000,
+ user: "root",
+ database: "test",
+ ssl: "verifyFull",
+ sslCaFile: "/ca.pem",
+ properties: [{ name: "sql_mode", value: "ANSI" }],
+ });
+ expect(parseSourceUrl("redshift://r.example:5439/dev")?.source.vendor).toBe("redshift");
+ expect(parseSourceUrl("postgresql://h:70000/db")).toBeNull();
+ });
+});
+
+describe("Schemas tab", () => {
+ it("matches names and * / ? patterns", () => {
+ expect(matchesPattern("app_1", "app_*")).toBe(true);
+ expect(matchesPattern("app.1", "app?1")).toBe(true);
+ expect(matchesPattern("apps", "app")).toBe(false);
+ expect(matchesPattern("a.b", "a.b")).toBe(true);
+ });
+
+ it("shows all names, or the chosen ones and the connected database", () => {
+ const names = ["app", "app_test", "billing", "postgres"];
+ expect(shownNames(names, undefined, undefined)).toEqual(names);
+ expect(shownNames(names, true, ["billing"])).toEqual(names);
+ expect(shownNames(names, false, ["app*"], "postgres")).toEqual(["app", "app_test", "postgres"]);
+ expect(shownNames(names, false, [])).toEqual([]);
+ });
+});
+
+describe("Options tab", () => {
+ it("finds connections idle past their auto-disconnect", () => {
+ const sources = [
+ { id: "a", options: { autoDisconnectSecs: 60 } },
+ { id: "b", options: { autoDisconnectSecs: null } },
+ ];
+ const used = new Map([
+ ["a", 0],
+ ["a:other", 50_000],
+ ["b", 0],
+ ]);
+ const idle = (busy: string[]) => idleTargets(["a", "a:other", "b", "c"], sources, used, (t) => busy.includes(t), 60_000);
+ expect(idle([])).toEqual(["a"]);
+ expect(idle(["a"])).toEqual([]);
+ });
+
+ it("names the colour tokens", () => {
+ expect(colorVar("red")).toBe("var(--db-color-red)");
+ expect(colorVar(null)).toBeUndefined();
+ });
+});
diff --git a/src/features/database/index.ts b/src/features/database/index.ts
index fff28de70..9d1a860d0 100644
--- a/src/features/database/index.ts
+++ b/src/features/database/index.ts
@@ -8,7 +8,14 @@ import { lazyComponent } from "@/ui";
import { activeEditor, registerEditorContribution } from "@/editor/api";
import { registerActions } from "@/platform/actions";
import { useProject } from "@/platform/project";
-import { registerEditorKind, registerOverlay, registerServiceView, registerToolWindow, toolWindowService } from "@/workbench/contributions";
+import {
+ registerEditorKind,
+ registerOverlay,
+ registerServiceView,
+ registerToolWindow,
+ setFileDecorations,
+ toolWindowService,
+} from "@/workbench/contributions";
import { SQL_LANGUAGE, consoleExtension, executeInView } from "./console";
import { DatabaseDialogs } from "./Dialogs";
import { TABLE_KIND, tableTitle } from "./tableInput";
@@ -18,10 +25,12 @@ import {
DB_TOOL_WINDOW,
RESULTS_VIEW,
consoleSource,
+ consoleTints,
loadSources,
openConsole,
openSourceDialog,
useDatabase,
+ watchIdleConnections,
} from "./store";
export function activate(): () => void {
@@ -72,6 +81,12 @@ export function activate(): () => void {
newMenuOpen: false,
});
}),
+ // Consoles of coloured data sources get a tinted tab.
+ useDatabase.subscribe((s, prev) => {
+ if (s.consoles !== prev.consoles || s.sources !== prev.sources) setFileDecorations("database", consoleTints(s));
+ }),
+ () => setFileDecorations("database", new Map()),
+ watchIdleConnections(),
registerDatabaseTreeActions(),
registerActions([
{
diff --git a/src/features/database/model.ts b/src/features/database/model.ts
index 8d8284d99..440767131 100644
--- a/src/features/database/model.ts
+++ b/src/features/database/model.ts
@@ -1,5 +1,6 @@
/** Pure helpers of the database tools: clipboard formats, edits, labels. */
-import type { DbCellValue, DbDriver, DbRowEdit, DataSource } from "@/platform/ipc";
+import type { DbCellValue, DbColor, DbProperty, DbRowEdit, DbSslMode, DataSource } from "@/platform/ipc";
+import { vendorOf, vendorOfScheme } from "./vendors";
export type Cell = string | null;
@@ -62,14 +63,55 @@ export function fileSourceName(file: string): string {
return base.replace(/\.[^.]+$/, "") || base;
}
-/** The tree / menu icon of a driver (IDEA shows the vendor's mark). */
-export function driverIcon(driver: DbDriver | null | undefined): string {
- return driver === "postgres" ? "db-postgres" : driver === "mysql" ? "db-mysql" : "db-sqlite";
+/** The tree / menu icon of a data source (IDEA shows the vendor's mark). */
+export function sourceIcon(s: Pick<DataSource, "vendor" | "driver">): string {
+ return vendorOf(s).icon;
}
-export function sourceLabel(s: Pick<DataSource, "name" | "driver">): string {
- const kind = s.driver === "postgres" ? "PostgreSQL" : s.driver === "mysql" ? "MySQL" : "SQLite";
- return `${s.name} (${kind})`;
+export function sourceLabel(s: Pick<DataSource, "name" | "driver" | "vendor">): string {
+ return `${s.name} (${vendorOf(s).label})`;
+}
+
+/** The token of a data source colour (tree rows, console tab). */
+export function colorVar(color: DbColor | null | undefined): string | undefined {
+ return color ? `var(--db-color-${color})` : undefined;
+}
+
+/** `*` / `?` wildcard match of the Schemas tab (case-sensitive, like the server's names). */
+export function matchesPattern(name: string, pattern: string): boolean {
+ if (!/[*?]/.test(pattern)) return name === pattern;
+ const re = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
+ return new RegExp(`^${re}$`).test(name);
+}
+
+/**
+ * The databases / schemas the tree shows (Schemas tab): all of them, or the
+ * ones matching a chosen name or pattern; `keep` (the connected database) always stays.
+ */
+export function shownNames(names: readonly string[], all: boolean | undefined, chosen: readonly string[] | undefined, keep?: string | null): string[] {
+ if (all !== false) return [...names];
+ const picks = (chosen ?? []).map((p) => p.trim()).filter(Boolean);
+ return names.filter((n) => n === keep || picks.some((p) => matchesPattern(n, p)));
+}
+
+/**
+ * Connected targets idle for longer than their data source's Auto-disconnect
+ * (`lastUsed`: ms of the last statement / introspection; `busy`: running or holding a transaction).
+ */
+export function idleTargets(
+ connected: Iterable<string>,
+ sources: readonly DataSource[],
+ lastUsed: ReadonlyMap<string, number>,
+ busy: (target: string) => boolean,
+ now: number,
+): string[] {
+ const out: string[] = [];
+ for (const t of connected) {
+ const secs = sources.find((s) => s.id === splitTarget(t).id)?.options?.autoDisconnectSecs;
+ if (!secs || busy(t)) continue;
+ if (now - (lastUsed.get(t) ?? now) >= secs * 1000) out.push(t);
+ }
+ return out;
}
export function newSourceId(): string {
@@ -120,20 +162,36 @@ export function targetOf(id: string, database: string | null, current: string |
/** Key of the Database tree node of database `name` of data source `id`. */
export const databaseKey = (id: string, name: string) => `${id}/@${name}`;
+const SSL_MODES: Record<string, DbSslMode> = {
+ disable: "disable",
+ disabled: "disable",
+ prefer: "prefer",
+ preferred: "prefer",
+ require: "require",
+ required: "require",
+ "verify-ca": "verifyCa",
+ verify_ca: "verifyCa",
+ "verify-full": "verifyFull",
+ verify_identity: "verifyFull",
+ "verify-identity": "verifyFull",
+};
+
/**
- * Data Source from URL: `postgres://user:pass@host:5432/db`, `mysql://…`,
- * `mariadb://…`, the `jdbc:` forms of those, `jdbc:sqlite:path` / `sqlite:path`.
- * Null when the URL names no supported driver.
+ * Data Source from URL (and the General tab's URL field): `postgres://user:pass@host:5432/db`,
+ * `mysql://…`, `mariadb://…`, wire-compatible products (`redshift://`, `tidb://`…), the
+ * `jdbc:` forms of those, `jdbc:sqlite:path` / `sqlite:path`. SSL parameters fill the
+ * SSL tab, other parameters become driver properties. Null when the URL names no supported driver.
*/
export function parseSourceUrl(raw: string): { source: Partial<DataSource>; password: string | null } | null {
const url = raw.trim().replace(/^jdbc:/i, "");
- const sqlite = /^sqlite:(?:\/\/)?(.+)$/i.exec(url);
+ const sqlite = /^sqlite3?:(?:\/\/)?(.+)$/i.exec(url);
if (sqlite) {
const file = sqlite[1]!.replace(/^\/([A-Za-z]:)/, "$1");
return { source: { driver: "sqlite", file, name: fileSourceName(file) }, password: null };
}
- const m = /^(postgres(?:ql)?|mysql|mariadb):\/\/(?:([^:@/]*)(?::([^@/]*))?@)?([^:/?]+|\[[^\]]+\])(?::(\d+))?(?:\/([^?]*))?(?:\?(.*))?$/i.exec(url);
- if (!m) return null;
+ const m = /^([a-z][a-z0-9]*):\/\/(?:([^:@/]*)(?::([^@/]*))?@)?([^:/?,]+|\[[^\]]+\])(?::(\d+))?(?:,[^/?]*)?(?:\/([^?]*))?(?:\?(.*))?$/i.exec(url);
+ const vendor = m ? vendorOfScheme(m[1]!) : undefined;
+ if (!m || !vendor || vendor.driver === "sqlite") return null;
const dec = (s: string | undefined) => {
try {
return s ? decodeURIComponent(s) : "";
@@ -141,13 +199,45 @@ export function parseSourceUrl(raw: string): { source: Partial<DataSource>; pass
return s ?? "";
}
};
- const driver = m[1]!.toLowerCase().startsWith("postgres") ? "postgres" : "mysql";
- const params = new URLSearchParams(m[7] ?? "");
- const user = dec(m[2]) || params.get("user") || "";
- const password = m[3] !== undefined ? dec(m[3]) : params.get("password");
const port = m[5] ? parseInt(m[5], 10) : null;
- const source: Partial<DataSource> = { driver, host: m[4]!, port, user, database: dec(m[6]) };
- const ssl = params.get("sslmode")?.toLowerCase();
- if (ssl === "disable" || ssl === "require" || ssl === "prefer") source.ssl = ssl;
+ if (port !== null && !(port > 0 && port < 65536)) return null;
+ let user = dec(m[2]);
+ let password = m[3] !== undefined ? dec(m[3]) : null;
+ const host = m[4]!.replace(/^\[(.*)\]$/, "$1");
+ const source: Partial<DataSource> = { driver: vendor.driver, host, port, user, database: dec(m[6]).replace(/\/$/, "") };
+ if (vendor.id !== vendor.driver) source.vendor = vendor.id;
+ const properties: DbProperty[] = [];
+ for (const [k, v] of new URLSearchParams(m[7] ?? "")) {
+ switch (k.toLowerCase()) {
+ case "user":
+ user ||= v;
+ break;
+ case "password":
+ password ??= v;
+ break;
+ case "sslmode":
+ case "ssl-mode": {
+ const mode = SSL_MODES[v.toLowerCase()];
+ if (mode) source.ssl = mode;
+ break;
+ }
+ case "sslrootcert":
+ case "ssl-ca":
+ source.sslCaFile = v;
+ break;
+ case "sslcert":
+ case "ssl-cert":
+ source.sslCertFile = v;
+ break;
+ case "sslkey":
+ case "ssl-key":
+ source.sslKeyFile = v;
+ break;
+ default:
+ properties.push({ name: k, value: v });
+ }
+ }
+ source.user = user;
+ if (properties.length) source.properties = properties;
return { source, password };
}
diff --git a/src/features/database/store.ts b/src/features/database/store.ts
index 98010efc6..f0c96bf07 100644
--- a/src/features/database/store.ts
+++ b/src/features/database/store.ts
@@ -20,9 +20,9 @@ import {
type SqlStatement,
} from "@/platform/ipc";
import { editorsFor } from "@/editor/api";
-import { editorService, notifications, showServiceView, toolWindowService } from "@/workbench/contributions";
+import { editorService, notifications, showServiceView, toolWindowService, type FileDecoration } from "@/workbench/contributions";
import { ask, confirm } from "@/workbench/messages";
-import { connectRemedy, databaseKey, newSourceId, splitTarget } from "./model";
+import { colorVar, connectRemedy, databaseKey, idleTargets, newSourceId, splitTarget } from "./model";
import type { DbNode } from "./nodes";
import type { DbObjectRef } from "./objects";
import { formatted } from "./sql/format";
@@ -321,13 +321,25 @@ export async function resolveConnectError(e: unknown, source: DataSource): Promi
}
}
+/** Target → time of its last use (Options › Auto-disconnect). */
+const lastUsed = new Map<string, number>();
+
+/** Options › Transaction control: a manual data source's consoles start in manual commit. */
+function applyConnectDefaults(id: string) {
+ if (sourceById(id)?.options?.transaction === "manual" && !useDatabase.getState().manualCommit.has(id))
+ void setManualCommit(id, true).catch(() => {});
+}
+
/** Runs `op`, asking for passwords / host key trust and retrying when the connection needs them. */
export async function withConnection<T>(id: string, op: () => Promise<T>): Promise<T> {
for (;;) {
try {
const r = await op();
- if (!useDatabase.getState().connected.has(id))
+ lastUsed.set(id, Date.now());
+ if (!useDatabase.getState().connected.has(id)) {
useDatabase.setState((s) => ({ connected: new Set(s.connected).add(id) }));
+ applyConnectDefaults(id);
+ }
return r;
} catch (e) {
const source = sourceById(id);
@@ -360,6 +372,31 @@ export async function disconnect(id: string): Promise<void> {
});
}
+/** Disconnects targets idle past their data source's Auto-disconnect; returns the stopper. */
+export function watchIdleConnections(everyMs = 5000): () => void {
+ const timer = setInterval(() => {
+ const s = useDatabase.getState();
+ const running = new Set(Object.keys(s.running).map((path) => s.consoles[path]));
+ const busy = (t: string) => running.has(t) || s.pendingTx.has(t);
+ for (const t of idleTargets(s.connected, s.sources, lastUsed, busy, Date.now())) {
+ lastUsed.delete(t);
+ void disconnect(t).then(() => log("info", `${targetLabel(t)}: disconnected after being idle`));
+ }
+ }, everyMs);
+ return () => clearInterval(timer);
+}
+
+/** Console files of coloured data sources, tinted like IDEA's (file decorations). */
+export function consoleTints(s: Pick<DatabaseState, "consoles" | "sources">): Map<string, FileDecoration> {
+ const out = new Map<string, FileDecoration>();
+ for (const [path, target] of Object.entries(s.consoles)) {
+ const id = splitTarget(target).id;
+ const tint = colorVar(s.sources.find((x) => x.id === id)?.color);
+ if (tint) out.set(path, { tint });
+ }
+ return out;
+}
+
/** PostgreSQL data sources show their server's databases (IDEA's data source › database › schema). */
export function listsDatabases(source: DataSource | undefined): boolean {
return source?.driver === "postgres";
diff --git a/src/features/database/treeMenu.ts b/src/features/database/treeMenu.ts
index 6a6200146..8c32a4ef0 100644
--- a/src/features/database/treeMenu.ts
+++ b/src/features/database/treeMenu.ts
@@ -1,7 +1,7 @@
/** Menus of the Database tool window, laid out like IDEA's (New ▸, Copy/Paste ▸, SQL Scripts ▸ …). */
-import type { DbDriver } from "@/platform/ipc";
import type { MenuItem } from "@/ui";
-import { driverIcon, fileSourceName } from "./model";
+import { fileSourceName } from "./model";
+import { VENDORS, vendorPreset } from "./vendors";
import { nodeTarget, objectOf, tableOf, type DbNode } from "./nodes";
import { SCRIPT_LABELS, canDrop, canRename, type ScriptKind } from "./objects";
import { connectedTargets, openDialog, openSourceDialog, sourceById, useDatabase } from "./store";
@@ -21,18 +21,13 @@ async function sqliteFromFile() {
if (typeof file === "string") openSourceDialog(null, { driver: "sqlite", file, name: fileSourceName(file) });
}
-/** New ▸ Data Source ▸ — the drivers the backend speaks. */
+/** New ▸ Data Source ▸ — the drivers the backend speaks and wire-compatible products, A–Z like IDEA's. */
function dataSourceItems(): MenuItem[] {
- const preset = (label: string, driver: DbDriver): MenuItem => ({
- label,
- icon: driverIcon(driver),
- run: () => openSourceDialog(null, { driver }),
- });
return [
{
label: "Data Source",
icon: "database",
- submenu: [preset("MariaDB", "mysql"), preset("MySQL", "mysql"), preset("PostgreSQL", "postgres"), preset("SQLite", "sqlite")],
+ submenu: VENDORS.map((v) => ({ label: v.label, icon: v.icon, run: () => openSourceDialog(null, vendorPreset(v)) })),
},
{ label: "Data Source from File…", icon: "folder", run: () => void sqliteFromFile() },
{ label: "Data Source from URL…", icon: "external-link", run: () => openDialog({ kind: "sourceUrl" }) },
diff --git a/src/features/database/vendors.ts b/src/features/database/vendors.ts
new file mode 100644
index 000000000..67246378d
--- /dev/null
+++ b/src/features/database/vendors.ts
@@ -0,0 +1,86 @@
+/**
+ * Data source types of New ▸ Data Source: the three drivers the backend speaks,
+ * and products that speak their wire protocol (a preset of port, icon and URL scheme).
+ */
+import type { DataSource, DbDriver, DbSslMode } from "@/platform/ipc";
+
+export interface DbVendor {
+ /** Stored in `DataSource.vendor`; a driver's own entry has the driver's id. */
+ id: string;
+ label: string;
+ driver: DbDriver;
+ port: number | null;
+ icon: string;
+ /** JDBC URL scheme (`jdbc:<scheme>://…`). */
+ scheme: string;
+ /** Managed services that only accept encrypted connections. */
+ ssl?: DbSslMode;
+}
+
+export const VENDORS: readonly DbVendor[] = [
+ { id: "aurora-mysql", label: "Amazon Aurora MySQL", driver: "mysql", port: 3306, icon: "db-aurora", scheme: "mysql" },
+ { id: "redshift", label: "Amazon Redshift", driver: "postgres", port: 5439, icon: "db-redshift", scheme: "redshift", ssl: "require" },
+ { id: "cockroachdb", label: "CockroachDB", driver: "postgres", port: 26257, icon: "db-cockroach", scheme: "postgresql" },
+ { id: "greenplum", label: "Greenplum", driver: "postgres", port: 5432, icon: "db-greenplum", scheme: "postgresql" },
+ { id: "mariadb", label: "MariaDB", driver: "mysql", port: 3306, icon: "db-mariadb", scheme: "mariadb" },
+ { id: "mysql", label: "MySQL", driver: "mysql", port: 3306, icon: "db-mysql", scheme: "mysql" },
+ { id: "neon", label: "Neon", driver: "postgres", port: 5432, icon: "db-neon", scheme: "postgresql", ssl: "require" },
+ { id: "oceanbase", label: "OceanBase (MySQL mode)", driver: "mysql", port: 2881, icon: "db-oceanbase", scheme: "oceanbase" },
+ { id: "postgres", label: "PostgreSQL", driver: "postgres", port: 5432, icon: "db-postgres", scheme: "postgresql" },
+ { id: "singlestore", label: "SingleStore", driver: "mysql", port: 3306, icon: "db-singlestore", scheme: "singlestore" },
+ { id: "sqlite", label: "SQLite", driver: "sqlite", port: null, icon: "db-sqlite", scheme: "sqlite" },
+ { id: "supabase", label: "Supabase", driver: "postgres", port: 5432, icon: "db-supabase", scheme: "postgresql", ssl: "require" },
+ { id: "tidb", label: "TiDB", driver: "mysql", port: 4000, icon: "db-tidb", scheme: "mysql" },
+ { id: "timescaledb", label: "TimescaleDB", driver: "postgres", port: 5432, icon: "db-timescale", scheme: "postgresql" },
+ { id: "yugabytedb", label: "YugabyteDB", driver: "postgres", port: 5433, icon: "db-yugabyte", scheme: "postgresql" },
+];
+
+const BY_ID = new Map(VENDORS.map((v) => [v.id, v]));
+
+/** The type of a data source: its preset, else its driver's own entry. */
+export function vendorOf(s: Pick<DataSource, "vendor" | "driver">): DbVendor {
+ const v = s.vendor ? BY_ID.get(s.vendor) : undefined;
+ return v && v.driver === (s.driver ?? "sqlite") ? v : BY_ID.get(s.driver ?? "sqlite")!;
+}
+
+export const vendorById = (id: string): DbVendor | undefined => BY_ID.get(id);
+
+/** The fields a new data source of type `v` starts with. */
+export function vendorPreset(v: DbVendor): Partial<DataSource> {
+ const preset: Partial<DataSource> = { driver: v.driver, vendor: v.id === v.driver ? "" : v.id, port: v.port };
+ if (v.ssl) preset.ssl = v.ssl;
+ return preset;
+}
+
+/** URL schemes (besides the JDBC ones) that name a type. */
+const SCHEMES: Record<string, string> = {
+ postgres: "postgres",
+ postgresql: "postgres",
+ pgsql: "postgres",
+ redshift: "redshift",
+ cockroachdb: "cockroachdb",
+ cockroach: "cockroachdb",
+ yugabytedb: "yugabytedb",
+ timescaledb: "timescaledb",
+ greenplum: "greenplum",
+ mysql: "mysql",
+ mariadb: "mariadb",
+ tidb: "tidb",
+ singlestore: "singlestore",
+ memsql: "singlestore",
+ oceanbase: "oceanbase",
+};
+
+export const vendorOfScheme = (scheme: string): DbVendor | undefined => BY_ID.get(SCHEMES[scheme.toLowerCase()] ?? "");
+
+const bracketed = (host: string) => (host.includes(":") && !host.startsWith("[") ? `[${host}]` : host);
+
+/** The JDBC URL of a data source's fields (the General tab's URL preview). */
+export function sourceUrl(s: DataSource): string {
+ const v = vendorOf(s);
+ if (v.driver === "sqlite") return `jdbc:sqlite:${s.file ?? ""}`;
+ const host = bracketed(s.host?.trim() || "localhost");
+ const port = s.port ?? v.port;
+ const db = s.database ? `/${encodeURIComponent(s.database)}` : "";
+ return `jdbc:${v.scheme}://${host}${port ? `:${port}` : ""}${db}`;
+}
diff --git a/src/features/http-client/index.ts b/src/features/http-client/index.ts
index 334f55339..4910ce323 100644
--- a/src/features/http-client/index.ts
+++ b/src/features/http-client/index.ts
@@ -5,10 +5,16 @@
* (`ide-http`).
*/
import { activeEditor, registerEditorContribution, registerLanguageMode } from "@/editor/api";
-import { registerActions } from "@/platform/actions";
+import { executeAction, getAction, registerActions } from "@/platform/actions";
import { call, commands, emitLocalIdeEvent, IpcError, isTauri } from "@/platform/ipc";
import { useProject } from "@/platform/project";
-import { editorService, notifications, registerServiceView, showServiceView } from "@/workbench/contributions";
+import {
+ editorService,
+ notifications,
+ registerMenuGroup,
+ registerServiceView,
+ showServiceView,
+} from "@/workbench/contributions";
import { HTTP_LANGUAGE, httpEditorExtension, refreshRequests, requestAtCaret } from "./editor";
import { HttpClientHeaderActions, HttpClientView } from "./HttpClientView";
import { httpLanguageDescription } from "./language";
@@ -44,11 +50,31 @@ async function runAtCaret() {
await runRequest(filePath(e.ctx.path, e.ctx.virtual), e.view.state.doc.toString(), r.index);
}
-/** New HTTP Request: a scratch `requests[_n].http` with an example request. */
-async function newRequest() {
+/** New › HTTP Request in `directory`: the name prompt of the file templates (features/templates), with the example body. */
+function newRequestArg(directory: string) {
+ return {
+ directory,
+ template: {
+ id: "http-request",
+ name: "HTTP Request",
+ icon: "file-http",
+ extension: "http",
+ nameStyle: "asis",
+ kinds: [{ id: "request", label: "HTTP Request", body: NEW_REQUEST_TEMPLATE }],
+ },
+ };
+}
+
+function directoryArg(arg: unknown): string | null {
+ const dir = (arg as { directory?: unknown } | undefined)?.directory;
+ return typeof dir === "string" && dir ? dir : null;
+}
+
+/** New HTTP Request: `requests[_n].http` in `directory`, else a scratch, with an example request. */
+async function newRequest(directory?: string) {
try {
const { appDataDir } = await import("@tauri-apps/api/path");
- const dir = `${(await appDataDir()).replace(/\/+$/, "")}/scratches`;
+ const dir = directory ?? `${(await appDataDir()).replace(/\/+$/, "")}/scratches`;
try {
await call(commands.fsCreateDir(dir));
} catch (e) {
@@ -88,6 +114,13 @@ export function activate(): () => void {
component: HttpClientView,
headerActions: HttpClientHeaderActions,
}),
+ registerMenuGroup({
+ id: "http.new",
+ menus: ["new"],
+ order: 20,
+ items: (_menu, { paths: [directory] }) =>
+ directory ? [{ kind: "action", action: "http.newRequest", arg: { directory }, label: "HTTP Request" }] : [],
+ }),
registerActions([
{
id: "http.runRequest",
@@ -115,7 +148,13 @@ export function activate(): () => void {
icon: "file-http",
keywords: ["http client", "rest", "scratch", "curl"],
when: "projectOpen",
- run: () => (isTauri() ? newRequest() : undefined),
+ // `{ directory }` (New › HTTP Request): ask for the name there, like IDEA.
+ run: async ({ arg }) => {
+ const directory = directoryArg(arg);
+ if (directory && getAction("templates.newFromTemplate"))
+ await executeAction("templates.newFromTemplate", newRequestArg(directory));
+ else if (isTauri()) await newRequest(directory ?? undefined);
+ },
},
{
id: "http.showToolWindow",
diff --git a/src/features/index.ts b/src/features/index.ts
index 387fee22f..603dff70b 100644
--- a/src/features/index.ts
+++ b/src/features/index.ts
@@ -12,6 +12,8 @@ import { activate as codeInsight } from "./code-insight";
import { activate as vcs } from "./vcs";
import { activate as terminal } from "./terminal";
import { activate as run } from "./run";
+import { activate as runAnything } from "./run-anything";
+import { activate as macros } from "./macros";
import { activate as debuggerFeature } from "./debugger";
import { activate as coverage } from "./coverage";
import { activate as profiler } from "./profiler";
@@ -25,6 +27,7 @@ import { activate as perf } from "./perf";
import { activate as plugins, activateSettingsPages as pluginsPages } from "./plugins";
import { activate as tools, activateSettingsPages as toolsPages } from "./tools";
import { activate as scratch } from "./scratch";
+import { activate as libraries } from "./libraries";
import { activate as viewers } from "./viewers";
import { activate as web } from "./web";
import { activate as analysis } from "./analysis";
@@ -45,6 +48,8 @@ const features: Array<[string, Activate]> = [
["vcs", vcs],
["terminal", terminal],
["run", run],
+ ["run-anything", runAnything],
+ ["macros", macros],
["debugger", debuggerFeature],
["coverage", coverage],
["profiler", profiler],
@@ -58,6 +63,7 @@ const features: Array<[string, Activate]> = [
["plugins", plugins],
["tools", tools],
["scratch", scratch],
+ ["libraries", libraries],
["viewers", viewers],
["web", web],
["analysis", analysis],
diff --git a/src/features/libraries/index.ts b/src/features/libraries/index.ts
new file mode 100644
index 000000000..5923f7afd
--- /dev/null
+++ b/src/features/libraries/index.ts
@@ -0,0 +1,151 @@
+/**
+ * External Libraries: the project's SDK / library source folders (the Python
+ * interpreter's standard library and site-packages, the JDK, node_modules
+ * packages, Cargo crates and the Rust standard library, GOROOT and Go modules,
+ * Maven / Gradle dependency jars) as a Project view root. Their files open
+ * read-only, like IDEA's library sources. Archives (the JDK's `src.zip`, jars)
+ * are browsed through the backend's `<archive>!/<entry>` paths.
+ */
+import { commands, type LibraryGroup } from "@/bindings";
+import { setLibraryRoots } from "@/editor/api";
+import { call, isTauri, onIdeEvent } from "@/platform/ipc";
+import { useProject } from "@/platform/project";
+import { registerProjectViewRoot, type ProjectViewRootContribution } from "@/workbench/contributions";
+
+export const EXTERNAL_LIBRARIES_LABEL = "External Libraries";
+
+const GROUP_ICONS: Record<string, string> = {
+ python: "file-python",
+ jdk: "file-java",
+ nodeCore: "file-js",
+ nodeModules: "file-npm",
+ rust: "file-rust",
+ cargo: "file-cargo",
+ go: "file-go",
+ goModules: "file-gomod",
+ maven: "maven-project",
+ gradle: "file-gradle",
+};
+
+/** An archive's root (`/jdk/lib/src.zip!`): its entries live below `<archive>!/`. */
+const isArchiveRoot = (path: string) => path.endsWith("!");
+
+/** Files whose change can change the libraries (the backend re-detects only the affected ecosystem). */
+const MANIFESTS = new Set([
+ "pyvenv.cfg",
+ "pom.xml",
+ "build.gradle",
+ "build.gradle.kts",
+ "settings.gradle",
+ "settings.gradle.kts",
+ "package.json",
+ "package-lock.json",
+ "yarn.lock",
+ "pnpm-lock.yaml",
+ "bun.lockb",
+ "Cargo.toml",
+ "Cargo.lock",
+ "rust-toolchain",
+ "rust-toolchain.toml",
+ "go.mod",
+ "go.sum",
+ "go.work",
+]);
+
+/** Whether an `fsChanged` event touches a library manifest. */
+export function touchesManifest(paths: readonly string[]): boolean {
+ return paths.some(
+ (p) =>
+ !/[\\/]node_modules[\\/]/.test(p) && MANIFESTS.has(p.slice(Math.max(p.lastIndexOf("/"), p.lastIndexOf("\\")) + 1)),
+ );
+}
+
+/** The "External Libraries" node for `groups` (`< Python 3.12 (.venv) >` › `python3.12`, `site-packages`). */
+export function librariesRoot(groups: readonly LibraryGroup[]): ProjectViewRootContribution | null {
+ if (!groups.length) return null;
+ return {
+ id: "externalLibraries",
+ label: EXTERNAL_LIBRARIES_LABEL,
+ icon: "library",
+ // After the project, before Scratches and Consoles (IDEA's order).
+ order: 5,
+ readOnly: true,
+ children: groups.map((g) => ({
+ label: `< ${g.name} >`,
+ icon: GROUP_ICONS[g.kind] ?? "library",
+ children: g.roots.map((r) => ({
+ label: r.name,
+ icon: isArchiveRoot(r.path) ? "file-archive" : "folder-library",
+ path: r.path,
+ detail: "library root",
+ })),
+ })),
+ };
+}
+
+/** Settings that change which SDKs the project uses. */
+const sdkKey = (s: ReturnType<typeof useProject.getState>) => {
+ const l = s.settings?.languages;
+ return JSON.stringify([
+ s.project?.root ?? null,
+ l?.python?.interpreter,
+ l?.java?.jdk,
+ l?.node?.interpreter,
+ l?.rust?.toolchain,
+ l?.rust?.stdlib,
+ l?.go?.goroot,
+ l?.go?.gopath,
+ ]);
+};
+
+const MANIFEST_REFRESH_DELAY = 500;
+
+export function activate(): () => void {
+ let disposeRoot = () => {};
+ let disposeReadOnly = () => {};
+ let seq = 0;
+ let shown = "";
+ const clear = () => {
+ disposeRoot();
+ disposeReadOnly();
+ disposeRoot = disposeReadOnly = () => {};
+ shown = "";
+ };
+ const refresh = () => {
+ const id = ++seq;
+ if (!useProject.getState().project || !isTauri()) return clear();
+ call(commands.sdkProjectLibraries())
+ .then((groups) => {
+ if (id !== seq) return;
+ const key = JSON.stringify(groups);
+ if (key === shown) return;
+ clear();
+ shown = key;
+ const root = librariesRoot(groups);
+ if (!root) return;
+ disposeReadOnly = setLibraryRoots(
+ "externalLibraries",
+ groups.flatMap((g) => g.roots.map((r) => r.path)),
+ );
+ disposeRoot = registerProjectViewRoot(root);
+ })
+ .catch((e: unknown) => console.warn("external libraries: cannot list SDK roots", e));
+ };
+ refresh();
+ const unsub = useProject.subscribe((s, prev) => {
+ if (sdkKey(s) !== sdkKey(prev)) refresh();
+ });
+ let timer: ReturnType<typeof setTimeout> | undefined;
+ const unsubFs = onIdeEvent("fsChanged", (e) => {
+ if (!touchesManifest([...e.created, ...e.modified, ...e.removed])) return;
+ clearTimeout(timer);
+ timer = setTimeout(refresh, MANIFEST_REFRESH_DELAY);
+ });
+ return () => {
+ seq++;
+ clearTimeout(timer);
+ unsub();
+ unsubFs();
+ clear();
+ };
+}
diff --git a/src/features/libraries/libraries.test.ts b/src/features/libraries/libraries.test.ts
new file mode 100644
index 000000000..d7596c44f
--- /dev/null
+++ b/src/features/libraries/libraries.test.ts
@@ -0,0 +1,84 @@
+import { afterEach, describe, expect, it } from "vitest";
+import { isLibraryPath, setLibraryRoots } from "@/editor/api";
+import { librariesRoot, touchesManifest } from "./index";
+
+describe("External Libraries", () => {
+ let dispose = () => {};
+ afterEach(() => dispose());
+
+ it("groups each SDK's folders under one read-only root", () => {
+ expect(librariesRoot([])).toBeNull();
+ const root = librariesRoot([
+ {
+ name: "Python 3.12 (.venv)",
+ kind: "python",
+ roots: [
+ { name: "python3.12", path: "/py/lib/python3.12" },
+ { name: "site-packages", path: "/p/.venv/lib/python3.12/site-packages" },
+ ],
+ },
+ ])!;
+ expect(root).toMatchObject({ id: "externalLibraries", label: "External Libraries", readOnly: true });
+ expect(root.children?.[0]).toMatchObject({ label: "< Python 3.12 (.venv) >", icon: "file-python" });
+ expect(root.children?.[0]?.children?.map((c) => [c.label, c.path, c.detail])).toEqual([
+ ["python3.12", "/py/lib/python3.12", "library root"],
+ ["site-packages", "/p/.venv/lib/python3.12/site-packages", "library root"],
+ ]);
+ });
+
+ it("gives each ecosystem's groups their icon", () => {
+ const root = librariesRoot(
+ ["jdk", "nodeCore", "nodeModules", "rust", "cargo", "go", "goModules", "maven", "gradle", "other"].map((kind) => ({
+ name: kind,
+ kind,
+ roots: [{ name: "r", path: `/libs/${kind}` }],
+ })),
+ )!;
+ expect(root.children?.map((g) => g.icon)).toEqual([
+ "file-java",
+ "file-js",
+ "file-npm",
+ "file-rust",
+ "file-cargo",
+ "file-go",
+ "file-gomod",
+ "maven-project",
+ "file-gradle",
+ "library",
+ ]);
+ });
+
+ it("lists archives (src.zip, dependency jars) as browsable roots", () => {
+ const root = librariesRoot([
+ {
+ name: "temurin-21",
+ kind: "jdk",
+ roots: [
+ { name: "temurin-21", path: "/jdk" },
+ { name: "src.zip", path: "/jdk/lib/src.zip!" },
+ ],
+ },
+ { name: "Maven: g:a:1", kind: "maven", roots: [{ name: "a-1-sources.jar", path: "/m2/g/a/1/a-1-sources.jar!" }] },
+ ])!;
+ expect(root.children?.[0]?.children?.map((c) => c.icon)).toEqual(["folder-library", "file-archive"]);
+ expect(root.children?.[1]).toMatchObject({ label: "< Maven: g:a:1 >", icon: "maven-project" });
+ dispose = setLibraryRoots("test", ["/jdk/lib/src.zip!"]);
+ expect(isLibraryPath("/jdk/lib/src.zip!/java.base/java/lang/String.java")).toBe(true);
+ });
+
+ it("refreshes on manifest changes outside node_modules", () => {
+ expect(touchesManifest(["/p/src/main.rs", "/p/Cargo.toml"])).toBe(true);
+ expect(touchesManifest(["C:\\p\\go.mod"])).toBe(true);
+ expect(touchesManifest(["/p/.venv/pyvenv.cfg"])).toBe(true);
+ expect(touchesManifest(["/p/node_modules/react/package.json"])).toBe(false);
+ expect(touchesManifest(["/p/src/package.json.bak", "/p/README.md"])).toBe(false);
+ });
+
+ it("marks files below library roots for read-only editors", () => {
+ dispose = setLibraryRoots("test", ["/py/lib/python3.12"]);
+ expect(isLibraryPath("/py/lib/python3.12/os.py")).toBe(true);
+ expect(isLibraryPath("/py/lib/python3.120/x.py")).toBe(false);
+ dispose();
+ expect(isLibraryPath("/py/lib/python3.12/os.py")).toBe(false);
+ });
+});
diff --git a/src/features/macros/MacrosDialog.tsx b/src/features/macros/MacrosDialog.tsx
new file mode 100644
index 000000000..5cf2eb39f
--- /dev/null
+++ b/src/features/macros/MacrosDialog.tsx
@@ -0,0 +1,111 @@
+/** The "Macro recording" status bar item and the Edit Macros dialog. */
+import { useState } from "react";
+import { create } from "zustand";
+import { executeAction, getAction } from "@/platform/actions";
+import { t } from "@/platform/i18n";
+import { BarButton, Button, Dialog, Icon, List, T } from "@/ui";
+import { confirm } from "@/workbench/messages";
+import { promptInput } from "@/workbench/inputDialogs";
+import { deleteMacro, describeStep, renameMacro, useMacros } from "./model";
+import styles from "./macros.module.css";
+
+const useEditOpen = create<{ open: boolean }>(() => ({ open: false }));
+export const showEditMacros = () => useEditOpen.setState({ open: true });
+
+const actionTitle = (id: string) => getAction(id)?.title ?? id;
+
+/** Shown while recording (IDEA: "Macro recording started" in the status bar); click stops. */
+export function MacroStatus() {
+ const steps = useMacros((s) => s.recording?.length);
+ if (steps === undefined) return null;
+ return (
+ <BarButton
+ className={styles.status}
+ tooltip="Stop Macro Recording"
+ aria-label="Stop Macro Recording"
+ onClick={() => void executeAction("macro.stopRecording")}
+ >
+ <span className={styles.dot} aria-hidden="true" />
+ <T>Recording macro…</T>
+ <Icon name="stop" size={14} />
+ </BarButton>
+ );
+}
+
+export function MacrosDialogHost() {
+ const open = useEditOpen((s) => s.open);
+ return open ? <EditMacrosDialog onClose={() => useEditOpen.setState({ open: false })} /> : null;
+}
+
+function EditMacrosDialog({ onClose }: { onClose: () => void }) {
+ const saved = useMacros((s) => s.saved);
+ const [active, setActive] = useState(0);
+ const macro = saved[Math.min(active, saved.length - 1)];
+
+ const rename = async () => {
+ if (!macro) return;
+ const name = await promptInput({
+ title: "Rename Macro",
+ label: "New name:",
+ initial: macro.name,
+ okLabel: "Rename",
+ validate: (v) =>
+ !v.trim()
+ ? "Enter a macro name"
+ : v.trim() !== macro.name && saved.some((m) => m.name === v.trim())
+ ? "A macro with this name exists"
+ : null,
+ });
+ if (name) renameMacro(macro.name, name);
+ };
+ const remove = async () => {
+ if (!macro) return;
+ if (await confirm({ title: "Delete Macro", message: `Delete the macro '${macro.name}'?`, ok: "Delete", icon: "warning" }))
+ deleteMacro(macro.name);
+ };
+
+ return (
+ <Dialog
+ open
+ title="Edit Macros"
+ onClose={onClose}
+ width={620}
+ buttons={[{ label: t("common.close"), role: "cancel" }]}
+ >
+ <div className={styles.edit}>
+ <div className={styles.column}>
+ <List
+ items={saved}
+ getKey={(m) => m.name}
+ activeIndex={Math.min(active, saved.length - 1)}
+ onActiveChange={setActive}
+ rowHeight={24}
+ className={styles.list}
+ aria-label="Macros"
+ empty={
+ <div className={styles.empty}>
+ <T>No saved macros</T>
+ </div>
+ }
+ renderItem={(m) => <div className={styles.row}>{m.name}</div>}
+ />
+ <div className={styles.buttons}>
+ <Button disabled={!macro} onClick={() => void rename()}>
+ <T>Rename…</T>
+ </Button>
+ <Button disabled={!macro} onClick={() => void remove()}>
+ <T>Delete</T>
+ </Button>
+ </div>
+ </div>
+ <ol className={styles.steps} aria-label="Recorded steps">
+ {macro?.steps.map((step, i) => (
+ <li key={i} className={styles.step}>
+ {describeStep(step, actionTitle)}
+ </li>
+ ))}
+ </ol>
+ </div>
+ </Dialog>
+ );
+}
diff --git a/src/features/macros/editorKeys.ts b/src/features/macros/editorKeys.ts
new file mode 100644
index 000000000..7e1fb2f66
--- /dev/null
+++ b/src/features/macros/editorKeys.ts
@@ -0,0 +1,89 @@
+/**
+ * Editing and caret keys a macro records in the editor (keys the IDE keymap
+ * does not bind run CodeMirror commands directly), and their replay.
+ */
+import {
+ cursorCharLeft,
+ cursorCharRight,
+ cursorDocEnd,
+ cursorDocStart,
+ cursorGroupLeft,
+ cursorGroupRight,
+ cursorLineBoundaryBackward,
+ cursorLineBoundaryForward,
+ cursorLineDown,
+ cursorLineUp,
+ cursorPageDown,
+ cursorPageUp,
+ deleteCharBackward,
+ deleteCharForward,
+ deleteGroupBackward,
+ deleteGroupForward,
+ indentLess,
+ insertNewlineAndIndent,
+ insertTab,
+ selectCharLeft,
+ selectCharRight,
+ selectDocEnd,
+ selectDocStart,
+ selectGroupLeft,
+ selectGroupRight,
+ selectLineBoundaryBackward,
+ selectLineBoundaryForward,
+ selectLineDown,
+ selectLineUp,
+ selectPageDown,
+ selectPageUp,
+} from "@codemirror/commands";
+import type { Command } from "@codemirror/view";
+
+/** Recorded key name (`Shift+ArrowLeft`, `Alt+Backspace`) → command. */
+export const EDITOR_KEY_COMMANDS: Record<string, Command> = {
+ Enter: insertNewlineAndIndent,
+ Backspace: deleteCharBackward,
+ Delete: deleteCharForward,
+ "Alt+Backspace": deleteGroupBackward,
+ "Alt+Delete": deleteGroupForward,
+ Tab: insertTab,
+ "Shift+Tab": indentLess,
+ ArrowLeft: cursorCharLeft,
+ ArrowRight: cursorCharRight,
+ ArrowUp: cursorLineUp,
+ ArrowDown: cursorLineDown,
+ "Shift+ArrowLeft": selectCharLeft,
+ "Shift+ArrowRight": selectCharRight,
+ "Shift+ArrowUp": selectLineUp,
+ "Shift+ArrowDown": selectLineDown,
+ "Alt+ArrowLeft": cursorGroupLeft,
+ "Alt+ArrowRight": cursorGroupRight,
+ "Alt+Shift+ArrowLeft": selectGroupLeft,
+ "Alt+Shift+ArrowRight": selectGroupRight,
+ Home: cursorLineBoundaryBackward,
+ End: cursorLineBoundaryForward,
+ "Shift+Home": selectLineBoundaryBackward,
+ "Shift+End": selectLineBoundaryForward,
+ PageUp: cursorPageUp,
+ PageDown: cursorPageDown,
+ "Shift+PageUp": selectPageUp,
+ "Shift+PageDown": selectPageDown,
+ "Meta+ArrowLeft": cursorLineBoundaryBackward,
+ "Meta+ArrowRight": cursorLineBoundaryForward,
+ "Meta+Shift+ArrowLeft": selectLineBoundaryBackward,
+ "Meta+Shift+ArrowRight": selectLineBoundaryForward,
+ "Meta+ArrowUp": cursorDocStart,
+ "Meta+ArrowDown": cursorDocEnd,
+ "Ctrl+Home": cursorDocStart,
+ "Ctrl+End": cursorDocEnd,
+ "Ctrl+Shift+Home": selectDocStart,
+ "Ctrl+Shift+End": selectDocEnd,
+ "Ctrl+ArrowLeft": cursorGroupLeft,
+ "Ctrl+ArrowRight": cursorGroupRight,
+};
+
+/** The recorded name of a key event, or null when it is not an editor key a macro records. */
+export function editorKeyName(e: Pick<KeyboardEvent, "key" | "altKey" | "ctrlKey" | "metaKey" | "shiftKey">): string | null {
+ const name = [e.metaKey && "Meta", e.ctrlKey && "Ctrl", e.altKey && "Alt", e.shiftKey && "Shift", e.key]
+ .filter(Boolean)
+ .join("+");
+ return name in EDITOR_KEY_COMMANDS ? name : null;
+}
diff --git a/src/features/macros/index.ts b/src/features/macros/index.ts
new file mode 100644
index 000000000..8ec9323d1
--- /dev/null
+++ b/src/features/macros/index.ts
@@ -0,0 +1,200 @@
+/**
+ * Edit › Macros: Start / Stop Macro Recording, Play Back Last Macro, Play
+ * Saved Macros… and Edit Macros…. Every saved macro is also an action
+ * (`macros.play.<name>`), so it can get a shortcut in the keymap.
+ */
+import { EditorView } from "@codemirror/view";
+import { activeEditor, registerEditorContribution } from "@/editor/api";
+import { executeAction, onActionExecuted, registerActions, type Action } from "@/platform/actions";
+import { setContext } from "@/platform/context";
+import { notifications, registerOverlay, registerStatusItem } from "@/workbench/contributions";
+import { chooseItem, promptInput } from "@/workbench/inputDialogs";
+import { EDITOR_KEY_COMMANDS, editorKeyName } from "./editorKeys";
+import { MacroStatus, MacrosDialogHost, showEditMacros } from "./MacrosDialog";
+import {
+ playSteps,
+ recordStep,
+ saveMacro,
+ startRecording,
+ stopRecording,
+ storableArg,
+ useMacros,
+ type MacroStep,
+} from "./model";
+
+/** Records typing and editor keys of every text editor while a macro records. */
+const recorder = [
+ EditorView.inputHandler.of((_view, _from, _to, text) => {
+ if (useMacros.getState().recording && !useMacros.getState().playing) recordStep({ kind: "text", text });
+ return false;
+ }),
+ EditorView.domEventHandlers({
+ keydown(e) {
+ // Keys the IDE keymap ran as actions were recorded as those actions.
+ if (e.defaultPrevented || e.isComposing || !useMacros.getState().recording) return false;
+ const key = editorKeyName(e);
+ if (key) recordStep({ kind: "key", key });
+ return false;
+ },
+ }),
+];
+
+function typeText(text: string): boolean {
+ const view = activeEditor()?.view;
+ if (!view) return false;
+ const { from, to } = view.state.selection.main;
+ const insert = () => view.state.update(view.state.replaceSelection(text), { userEvent: "input.type" });
+ // Input handlers (auto-closing brackets, completion triggers) see it as typed.
+ const handled = view.state.facet(EditorView.inputHandler).some((h) => h(view, from, to, text, insert));
+ if (!handled) view.dispatch(insert());
+ return true;
+}
+
+function pressKey(key: string): boolean {
+ const view = activeEditor()?.view;
+ const command = EDITOR_KEY_COMMANDS[key];
+ if (!view || !command) return false;
+ command(view);
+ return true;
+}
+
+export async function playMacro(steps: readonly MacroStep[], name?: string) {
+ const ok = await playSteps(steps, { action: (id, arg) => executeAction(id, arg), text: typeText, key: pressKey });
+ if (!ok)
+ notifications().notify({
+ level: "warning",
+ title: name ? `Macro '${name}' stopped` : "Macro playback stopped",
+ body: "A recorded step could not run here.",
+ key: "macro.playback",
+ });
+}
+
+async function stop() {
+ const steps = stopRecording();
+ if (!steps.length) {
+ notifications().notify({ level: "info", title: "Nothing was recorded", key: "macro.recording" });
+ return;
+ }
+ const name = await promptInput({
+ title: "Enter Macro Name",
+ label: "Name (leave empty to keep it only as the last macro):",
+ okLabel: "OK",
+ validate: () => null,
+ });
+ if (name) saveMacro(name, steps);
+}
+
+const playActionId = (name: string) => `macros.play.${name}`;
+
+/** One action per saved macro, kept in step with the saved list. */
+function registerSavedMacroActions(): () => void {
+ let dispose = () => {};
+ let names = "";
+ const sync = () => {
+ const saved = useMacros.getState().saved;
+ const key = saved.map((m) => m.name).join("\n");
+ if (key === names) return;
+ names = key;
+ dispose();
+ dispose = registerActions(
+ saved.map(
+ (m): Action => ({
+ id: playActionId(m.name),
+ title: m.name,
+ category: "Macros",
+ keywords: ["macro", "play"],
+ when: "!macroRecording",
+ run: () => {
+ const macro = useMacros.getState().saved.find((x) => x.name === m.name);
+ if (macro) return playMacro(macro.steps, macro.name);
+ },
+ }),
+ ),
+ );
+ };
+ sync();
+ const unsub = useMacros.subscribe(sync);
+ return () => {
+ unsub();
+ dispose();
+ };
+}
+
+export function activate(): () => void {
+ const publish = () => {
+ const s = useMacros.getState();
+ setContext("macroRecording", s.recording !== null);
+ setContext("macroLastAvailable", !!s.last?.length);
+ setContext("macrosSaved", s.saved.length > 0);
+ };
+ publish();
+ const disposers = [
+ useMacros.subscribe(publish),
+ onActionExecuted((id, arg) => {
+ const s = useMacros.getState();
+ if (!s.recording || s.playing || id.startsWith("macro.") || id.startsWith("macros.")) return;
+ const stored = storableArg(arg);
+ // Actions run with an argument that cannot be stored (a menu's context) are left out.
+ if (stored === null) return;
+ recordStep(stored === undefined ? { kind: "action", id } : { kind: "action", id, arg: stored });
+ }),
+ registerEditorContribution({ id: "macros.recorder", order: 0, extensions: () => recorder }),
+ registerOverlay({ id: "macros.dialogs", component: MacrosDialogHost }),
+ registerStatusItem({ id: "macros.recording", align: "left", priority: 4, component: MacroStatus }),
+ registerSavedMacroActions(),
+ registerActions([
+ {
+ id: "macro.startRecording",
+ title: "Start Macro Recording",
+ category: "Edit",
+ keywords: ["macro", "record"],
+ when: "!macroRecording",
+ run: startRecording,
+ },
+ {
+ id: "macro.stopRecording",
+ title: "Stop Macro Recording",
+ category: "Edit",
+ icon: "stop",
+ keywords: ["macro", "record"],
+ when: "macroRecording",
+ run: stop,
+ },
+ {
+ id: "macro.playBack",
+ title: "Play Back Last Macro",
+ category: "Edit",
+ keywords: ["macro", "replay"],
+ when: "!macroRecording && macroLastAvailable",
+ run: () => {
+ const last = useMacros.getState().last;
+ if (last) return playMacro(last);
+ },
+ },
+ {
+ id: "macro.playSaved",
+ title: "Play Saved Macros…",
+ category: "Edit",
+ keywords: ["macro", "replay"],
+ when: "!macroRecording && macrosSaved",
+ run: async () => {
+ const name = await chooseItem({ title: "Play Saved Macro", items: useMacros.getState().saved.map((m) => m.name) });
+ const macro = useMacros.getState().saved.find((m) => m.name === name);
+ if (macro) await playMacro(macro.steps, macro.name);
+ },
+ },
+ {
+ id: "macro.edit",
+ title: "Edit Macros…",
+ category: "Edit",
+ keywords: ["macro", "rename", "delete"],
+ when: "!macroRecording && macrosSaved",
+ run: showEditMacros,
+ },
+ ]),
+ ];
+ return () => {
+ if (useMacros.getState().recording) stopRecording();
+ disposers.reverse().forEach((d) => d());
+ };
+}
diff --git a/src/features/macros/macros.module.css b/src/features/macros/macros.module.css
new file mode 100644
index 000000000..b3e8b30ae
--- /dev/null
+++ b/src/features/macros/macros.module.css
@@ -0,0 +1,58 @@
+.status {
+ gap: 6px;
+}
+.dot {
+ width: 8px;
+ height: 8px;
+ border-radius: 50%;
+ background: var(--danger);
+}
+.edit {
+ display: grid;
+ grid-template-columns: 220px 1fr;
+ gap: 12px;
+ height: 300px;
+ padding: 14px;
+}
+.column {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ min-height: 0;
+}
+.list {
+ flex: 1;
+ min-height: 0;
+ border: 1px solid var(--border);
+ border-radius: var(--radius-control);
+}
+.row {
+ padding: 0 8px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.buttons {
+ display: flex;
+ gap: 6px;
+}
+.empty {
+ padding: 6px 8px;
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+}
+.steps {
+ margin: 0;
+ padding: 6px 8px 6px 32px;
+ overflow: auto;
+ border: 1px solid var(--border);
+ border-radius: var(--radius-control);
+ font-family: var(--font-mono);
+ font-size: var(--fs-code);
+ color: var(--fg);
+}
+.step {
+ line-height: 1.6;
+ white-space: pre-wrap;
+ word-break: break-word;
+}
diff --git a/src/features/macros/model.test.ts b/src/features/macros/model.test.ts
new file mode 100644
index 000000000..556e839d4
--- /dev/null
+++ b/src/features/macros/model.test.ts
@@ -0,0 +1,112 @@
+import { beforeEach, describe, expect, it } from "vitest";
+import { editorKeyName } from "./editorKeys";
+import {
+ _reloadMacros,
+ deleteMacro,
+ describeStep,
+ playSteps,
+ recordStep,
+ renameMacro,
+ saveMacro,
+ startRecording,
+ stopRecording,
+ storableArg,
+ STORAGE_KEY,
+ useMacros,
+} from "./model";
+
+beforeEach(() => {
+ localStorage.clear();
+ _reloadMacros();
+});
+
+describe("macros", () => {
+ it("records actions, merged typing and keys only while recording", () => {
+ recordStep({ kind: "text", text: "ignored" });
+ startRecording();
+ recordStep({ kind: "text", text: "he" });
+ recordStep({ kind: "text", text: "llo" });
+ recordStep({ kind: "key", key: "Enter" });
+ recordStep({ kind: "action", id: "editor.duplicateLine" });
+ const steps = stopRecording();
+ expect(steps).toEqual([
+ { kind: "text", text: "hello" },
+ { kind: "key", key: "Enter" },
+ { kind: "action", id: "editor.duplicateLine" },
+ ]);
+ expect(useMacros.getState().last).toEqual(steps);
+ // An empty recording keeps the last macro.
+ startRecording();
+ stopRecording();
+ expect(useMacros.getState().last).toEqual(steps);
+ });
+
+ it("persists saved macros; renames and deletes them", () => {
+ saveMacro("Dup", [{ kind: "action", id: "editor.duplicateLine" }]);
+ saveMacro("Two", []);
+ expect(renameMacro("Dup", "Two")).toBe(false);
+ expect(renameMacro("Dup", "Duplicate")).toBe(true);
+ _reloadMacros();
+ expect(useMacros.getState().saved.map((m) => m.name)).toEqual(["Duplicate", "Two"]);
+ deleteMacro("Two");
+ _reloadMacros();
+ expect(useMacros.getState().saved.map((m) => m.name)).toEqual(["Duplicate"]);
+ });
+
+ it("drops malformed stored steps", () => {
+ localStorage.setItem(
+ STORAGE_KEY,
+ JSON.stringify({ last: [{ kind: "text", text: "a" }, { kind: "action" }, { kind: "action", id: "x", arg: {} }], saved: [{ name: "" }] }),
+ );
+ _reloadMacros();
+ expect(useMacros.getState().last).toEqual([{ kind: "text", text: "a" }]);
+ expect(useMacros.getState().saved).toEqual([]);
+ });
+
+ it("plays steps in order and stops at the first that cannot run; nothing is recorded meanwhile", async () => {
+ const log: string[] = [];
+ startRecording();
+ const ok = await playSteps(
+ [
+ { kind: "action", id: "a", arg: 1 },
+ { kind: "text", text: "t" },
+ { kind: "key", key: "Tab" },
+ { kind: "action", id: "b" },
+ ],
+ {
+ action: async (id, arg) => {
+ recordStep({ kind: "action", id });
+ log.push(`${id}${arg ?? ""}`);
+ return id !== "b";
+ },
+ text: (t) => (log.push(t), true),
+ key: (k) => (log.push(k), true),
+ },
+ );
+ expect(ok).toBe(false);
+ expect(log).toEqual(["a1", "t", "Tab", "b"]);
+ expect(useMacros.getState().recording).toEqual([]);
+ expect(useMacros.getState().playing).toBe(false);
+ });
+
+ it("stores plain action arguments only and describes steps", () => {
+ expect(storableArg("x")).toBe("x");
+ expect(storableArg(2)).toBe(2);
+ expect(storableArg(undefined)).toBeUndefined();
+ expect(storableArg({ path: "/a" })).toBeNull();
+ expect(storableArg(Number.NaN)).toBeNull();
+ const title = (id: string) => (id === "a" ? "Action A" : id);
+ expect(describeStep({ kind: "action", id: "a", arg: "x" }, title)).toBe("Action A (x)");
+ expect(describeStep({ kind: "text", text: "a\nb" }, title)).toBe('Type "a↵b"');
+ expect(describeStep({ kind: "key", key: "Enter" }, title)).toBe("Press Enter");
+ });
+
+ it("names the editor keys a macro records", () => {
+ const k = (key: string, mods: Partial<Record<"altKey" | "ctrlKey" | "metaKey" | "shiftKey", boolean>> = {}) =>
+ editorKeyName({ key, altKey: false, ctrlKey: false, metaKey: false, shiftKey: false, ...mods });
+ expect(k("Enter")).toBe("Enter");
+ expect(k("ArrowLeft", { shiftKey: true, altKey: true })).toBe("Alt+Shift+ArrowLeft");
+ expect(k("a")).toBeNull();
+ expect(k("s", { metaKey: true })).toBeNull();
+ });
+});
diff --git a/src/features/macros/model.ts b/src/features/macros/model.ts
new file mode 100644
index 000000000..398ffbe83
--- /dev/null
+++ b/src/features/macros/model.ts
@@ -0,0 +1,159 @@
+/**
+ * Edit › Macros (IDEA's ActionMacroManager): a macro is the list of actions
+ * the user ran plus what they typed and the editing / caret keys they pressed
+ * in the editor. The last recording and the named macros persist in
+ * localStorage (per user, like live templates).
+ */
+import { create } from "zustand";
+
+/** An editor key replayed as a CodeMirror command (see `editorKeys.ts`). */
+export type MacroStep =
+ | { kind: "action"; id: string; arg?: string | number | boolean }
+ | { kind: "text"; text: string }
+ | { kind: "key"; key: string };
+
+export interface Macro {
+ name: string;
+ steps: MacroStep[];
+}
+
+interface MacroState {
+ /** Steps recorded so far, while recording. */
+ recording: MacroStep[] | null;
+ /** A macro is being played back. */
+ playing: boolean;
+ /** The last recorded macro (Play Back Last Macro). */
+ last: MacroStep[] | null;
+ saved: Macro[];
+}
+
+export const STORAGE_KEY = "openidea.macros.v1";
+
+function isStep(v: unknown): v is MacroStep {
+ if (!v || typeof v !== "object") return false;
+ const s = v as Record<string, unknown>;
+ if (s.kind === "action") return typeof s.id === "string" && ["undefined", "string", "number", "boolean"].includes(typeof s.arg);
+ if (s.kind === "text") return typeof s.text === "string";
+ return s.kind === "key" && typeof s.key === "string";
+}
+
+const steps = (v: unknown): MacroStep[] | null => (Array.isArray(v) ? v.filter(isStep) : null);
+
+function read(): Pick<MacroState, "last" | "saved"> {
+ try {
+ const raw = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? "null") as { last?: unknown; saved?: unknown } | null;
+ const saved = Array.isArray(raw?.saved)
+ ? raw.saved
+ .filter((m): m is { name: string; steps: unknown } => !!m && typeof m.name === "string" && !!m.name.trim())
+ .map((m) => ({ name: m.name, steps: steps(m.steps) ?? [] }))
+ : [];
+ return { last: steps(raw?.last), saved };
+ } catch {
+ return { last: null, saved: [] };
+ }
+}
+
+export const useMacros = create<MacroState>(() => ({ recording: null, playing: false, ...read() }));
+
+function persist() {
+ const { last, saved } = useMacros.getState();
+ try {
+ localStorage.setItem(STORAGE_KEY, JSON.stringify({ last, saved }));
+ } catch {
+ /* storage unavailable */
+ }
+}
+
+/** Test helper: re-reads storage. */
+export function _reloadMacros() {
+ useMacros.setState({ recording: null, playing: false, ...read() });
+}
+
+/** Appends a step to the recording; consecutive typing is merged into one text step. */
+export function recordStep(step: MacroStep) {
+ const rec = useMacros.getState().recording;
+ if (!rec || useMacros.getState().playing) return;
+ const prev = rec[rec.length - 1];
+ const next =
+ step.kind === "text" && prev?.kind === "text"
+ ? [...rec.slice(0, -1), { kind: "text" as const, text: prev.text + step.text }]
+ : [...rec, step];
+ useMacros.setState({ recording: next });
+}
+
+/** An action's argument when it can be stored (plain values only). */
+export function storableArg(arg: unknown): string | number | boolean | undefined | null {
+ if (arg === undefined) return undefined;
+ if (typeof arg === "string" || typeof arg === "boolean" || (typeof arg === "number" && Number.isFinite(arg))) return arg;
+ return null;
+}
+
+export function startRecording() {
+ useMacros.setState({ recording: [] });
+}
+
+/** Ends the recording; returns its steps (also the new "last macro" when not empty). */
+export function stopRecording(): MacroStep[] {
+ const rec = useMacros.getState().recording ?? [];
+ useMacros.setState({ recording: null, ...(rec.length ? { last: rec } : {}) });
+ persist();
+ return rec;
+}
+
+/** Saves `steps` as `name`, replacing a macro of that name. */
+export function saveMacro(name: string, macroSteps: MacroStep[]) {
+ const n = name.trim();
+ if (!n) return;
+ const saved = useMacros.getState().saved;
+ const i = saved.findIndex((m) => m.name === n);
+ const entry = { name: n, steps: macroSteps };
+ useMacros.setState({ saved: i >= 0 ? saved.map((m, j) => (j === i ? entry : m)) : [...saved, entry] });
+ persist();
+}
+
+export function renameMacro(from: string, to: string): boolean {
+ const n = to.trim();
+ const saved = useMacros.getState().saved;
+ if (!n || (n !== from && saved.some((m) => m.name === n))) return false;
+ useMacros.setState({ saved: saved.map((m) => (m.name === from ? { ...m, name: n } : m)) });
+ persist();
+ return true;
+}
+
+export function deleteMacro(name: string) {
+ useMacros.setState((s) => ({ saved: s.saved.filter((m) => m.name !== name) }));
+ persist();
+}
+
+/** One line per step, for Edit Macros. */
+export function describeStep(step: MacroStep, title: (id: string) => string): string {
+ switch (step.kind) {
+ case "action":
+ return step.arg === undefined ? title(step.id) : `${title(step.id)} (${String(step.arg)})`;
+ case "text":
+ return `Type "${step.text.replace(/\n/g, "↵")}"`;
+ case "key":
+ return `Press ${step.key}`;
+ }
+}
+
+/** Runs `macroSteps` one after another; stops at the first step that cannot run. */
+export async function playSteps(
+ macroSteps: readonly MacroStep[],
+ run: { action(id: string, arg?: unknown): Promise<boolean>; text(text: string): boolean; key(key: string): boolean },
+): Promise<boolean> {
+ if (useMacros.getState().playing) return false;
+ useMacros.setState({ playing: true });
+ try {
+ for (const step of macroSteps) {
+ const ok =
+ step.kind === "action" ? await run.action(step.id, step.arg) : step.kind === "text" ? run.text(step.text) : run.key(step.key);
+ if (!ok) return false;
+ // Let the UI settle (popups open, editors mount) before the next step.
+ await new Promise((r) => setTimeout(r, 0));
+ }
+ return true;
+ } finally {
+ useMacros.setState({ playing: false });
+ }
+}
diff --git a/src/features/project-tree/HeaderActions.tsx b/src/features/project-tree/HeaderActions.tsx
index 27053d318..c629caa8f 100644
--- a/src/features/project-tree/HeaderActions.tsx
+++ b/src/features/project-tree/HeaderActions.tsx
@@ -1,6 +1,15 @@
import { shortcutLabel } from "@/platform/keymap";
import { IconButton, type MenuItem } from "@/ui";
-import { setViewOption, useProjectTree, type ViewOptions } from "./store";
+import { VIEW_MODES, setViewMode, setViewOption, useProjectTree, type ViewOptions } from "./store";
+
+/** The title's "Project ▾" pane switcher (IDEA: Project / Project Files / Open Files / …). */
+export function useProjectTitleMenu(): { label: string; items: MenuItem[] } {
+ const mode = useProjectTree((s) => s.mode);
+ return {
+ label: VIEW_MODES.find(([id]) => id === mode)?.[1] ?? "Project",
+ items: VIEW_MODES.map(([id, label]) => ({ id, label, checked: id === mode, run: () => setViewMode(id) })),
+ };
+}
export const OPTION_LABELS: Array<[keyof ViewOptions, string]> = [
["showHidden", "Show Hidden Files"],
diff --git a/src/features/project-tree/NewPopup.module.css b/src/features/project-tree/NewPopup.module.css
new file mode 100644
index 000000000..a8d9dd419
--- /dev/null
+++ b/src/features/project-tree/NewPopup.module.css
@@ -0,0 +1,69 @@
+/* IDEA's New popup: search field over a list of file kinds. */
+.popup {
+ width: 280px;
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ padding-bottom: 4px;
+}
+.search {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: var(--h-row);
+ padding: 0 10px;
+ border-bottom: 1px solid var(--border-popup);
+ margin-bottom: 4px;
+}
+.searchIcon {
+ flex: none;
+ color: var(--fg-muted);
+}
+.input {
+ flex: 1;
+ min-width: 0;
+}
+.list {
+ max-height: 420px;
+ height: auto;
+}
+.row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-width: 0;
+ flex: 1;
+}
+.icon {
+ width: 16px;
+ flex: none;
+ display: inline-flex;
+ justify-content: center;
+}
+.label {
+ flex: 1;
+ min-width: 0;
+ color: var(--fg-emphasis);
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+.active .label {
+ color: var(--fg-strong);
+}
+.shortcut {
+ flex: none;
+ margin-left: 16px;
+ font-family: var(--font-keys);
+ color: var(--fg-muted);
+}
+.separator {
+ flex: 1;
+ height: 1px;
+ background: var(--border-popup);
+}
+.empty {
+ padding: 6px 10px;
+ color: var(--fg-faint);
+ font-size: var(--fs-small);
+}
diff --git a/src/features/project-tree/NewPopup.test.tsx b/src/features/project-tree/NewPopup.test.tsx
new file mode 100644
index 000000000..7afedecb0
--- /dev/null
+++ b/src/features/project-tree/NewPopup.test.tsx
@@ -0,0 +1,47 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { act, fireEvent, render, screen } from "@testing-library/react";
+import { NewPopupHost } from "./NewPopup";
+import { closeNewPopup, openNewPopup, useNewPopup } from "./newPopupModel";
+
+afterEach(() => act(() => closeNewPopup()));
+
+describe("New popup", () => {
+ it("filters file kinds as you type and runs the selection with Enter", () => {
+ const python = vi.fn();
+ const css = vi.fn();
+ render(<NewPopupHost />);
+ act(() =>
+ openNewPopup({ x: 10, y: 10 }, [
+ { id: "file", label: "File", icon: "file", run: () => undefined },
+ { kind: "separator" },
+ { id: "py", label: "Python File", icon: "file-python", run: python },
+ { id: "css", label: "Stylesheet", icon: "file-css", run: css },
+ ]),
+ );
+ const search = screen.getByRole("textbox", { name: "Search for file type" });
+ expect(search).toHaveAttribute("placeholder", "Search for file type");
+ expect(screen.getAllByRole("option").map((o) => o.textContent)).toEqual(["File", "Python File", "Stylesheet"]);
+
+ fireEvent.change(search, { target: { value: "sty" } });
+ expect(screen.getAllByRole("option").map((o) => o.textContent)).toEqual(["Stylesheet"]);
+ fireEvent.keyDown(search, { key: "Enter" });
+ expect(css).toHaveBeenCalledOnce();
+ expect(useNewPopup.getState().request).toBeNull();
+ });
+
+ it("moves the selection with the arrow keys, skipping separators", () => {
+ const python = vi.fn();
+ render(<NewPopupHost />);
+ act(() =>
+ openNewPopup({ x: 10, y: 10 }, [
+ { id: "file", label: "File", run: () => undefined },
+ { kind: "separator" },
+ { id: "py", label: "Python File", run: python },
+ ]),
+ );
+ const search = screen.getByRole("textbox", { name: "Search for file type" });
+ fireEvent.keyDown(search, { key: "ArrowDown" });
+ fireEvent.keyDown(search, { key: "Enter" });
+ expect(python).toHaveBeenCalledOnce();
+ });
+});
diff --git a/src/features/project-tree/NewPopup.tsx b/src/features/project-tree/NewPopup.tsx
new file mode 100644
index 000000000..38167c9b3
--- /dev/null
+++ b/src/features/project-tree/NewPopup.tsx
@@ -0,0 +1,102 @@
+import { useMemo, useState, type KeyboardEvent } from "react";
+import clsx from "clsx";
+import { HighlightedText, Icon, Input, List, Popup, T, firstSelectable, listNavigate, type MenuItem } from "@/ui";
+import { closeNewPopup, newPopupRows, useNewPopup, type NewPopupRow } from "./newPopupModel";
+import styles from "./NewPopup.module.css";
+
+const isSeparator = (r: NewPopupRow) => !!r.separator;
+
+/** Overlay: IDEA's "New" popup — file kinds with a type-to-filter field. */
+export function NewPopupHost() {
+ const request = useNewPopup((s) => s.request);
+ if (!request) return null;
+ return <NewPopup key={request.seq} at={request.at} items={request.items} />;
+}
+
+function NewPopup({ at, items }: { at: { x: number; y: number }; items: MenuItem[] }) {
+ const [query, setQuery] = useState("");
+ const [active, setActive] = useState(-1);
+ const rows = useMemo(() => newPopupRows(items, query), [items, query]);
+ const current =
+ active >= 0 && active < rows.length && !rows[active]!.separator ? active : firstSelectable(rows, isSeparator);
+
+ const pick = (row: NewPopupRow | undefined) => {
+ if (!row?.run) return;
+ closeNewPopup();
+ row.run();
+ };
+
+ const onKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
+ const next = listNavigate(e.key === "ArrowUp" || e.key === "ArrowDown" ? e.key : "", {
+ items: rows,
+ active: current,
+ isSection: isSeparator,
+ wrap: true,
+ });
+ if (next !== null) {
+ e.preventDefault();
+ setActive(next);
+ } else if (e.key === "Enter") {
+ e.preventDefault();
+ pick(rows[current]);
+ }
+ };
+
+ return (
+ <Popup
+ open
+ anchor={at}
+ placement="bottom-start"
+ onClose={closeNewPopup}
+ role="dialog"
+ aria-label="New"
+ className={styles.popup}
+ >
+ <div className={styles.search}>
+ <Icon name="search" size={14} className={styles.searchIcon} />
+ <Input
+ variant="bare"
+ data-autofocus
+ value={query}
+ placeholder="Search for file type"
+ aria-label="Search for file type"
+ className={styles.input}
+ onChange={(e) => {
+ setQuery(e.target.value);
+ setActive(-1);
+ }}
+ onKeyDown={onKeyDown}
+ />
+ </div>
+ <List
+ items={rows}
+ getKey={(r) => r.key}
+ isSection={isSeparator}
+ renderSection={() => <div className={styles.separator} />}
+ sectionHeight={9}
+ activeIndex={current}
+ onActiveChange={setActive}
+ onActivate={(r) => pick(r)}
+ focusable={false}
+ hoverSelects
+ rowHeight={24}
+ className={styles.list}
+ aria-label="File types"
+ empty={
+ <div className={styles.empty}>
+ <T>Nothing found</T>
+ </div>
+ }
+ renderItem={(r, state) => (
+ <div className={clsx(styles.row, state.active && styles.active)}>
+ <span className={styles.icon}>{r.icon && <Icon name={r.icon} size={16} />}</span>
+ <span className={styles.label}>
+ <HighlightedText text={r.label} indices={r.matches ?? undefined} />
+ </span>
+ {r.shortcut && <span className={styles.shortcut}>{r.shortcut}</span>}
+ </div>
+ )}
+ />
+ </Popup>
+ );
+}
diff --git a/src/features/project-tree/ProjectView.module.css b/src/features/project-tree/ProjectView.module.css
index 5390d288c..6166ed30b 100644
--- a/src/features/project-tree/ProjectView.module.css
+++ b/src/features/project-tree/ProjectView.module.css
@@ -115,3 +115,8 @@
pointer-events: none;
white-space: nowrap;
}
+
+.empty {
+ padding: 8px 12px;
+ color: var(--fg-subtle);
+}
diff --git a/src/features/project-tree/ProjectView.tsx b/src/features/project-tree/ProjectView.tsx
index c2ab0b96c..891232f03 100644
--- a/src/features/project-tree/ProjectView.tsx
+++ b/src/features/project-tree/ProjectView.tsx
@@ -21,6 +21,7 @@ import clsx from "clsx";
import { useEditorRegistry } from "@/editor/api";
import { executeAction } from "@/platform/actions";
import { setContext } from "@/platform/context";
+import { useTxTemplate } from "@/platform/i18n";
import { isTauri } from "@/platform/ipc";
import type { RootFolder } from "@/platform/languageSettings";
import { useEffectiveRoots } from "@/platform/projectRoots";
@@ -39,9 +40,10 @@ import {
type TreeRowState,
} from "@/ui";
import { contextMenuItems, menuGroupContext, newMenuItems } from "./contextMenu";
+import { openNewPopup } from "./newPopupModel";
import { folderKind } from "./folderKind";
import { useHomeDir } from "./home";
-import { nodeKeyFor, visibleInfo, type ProjectNode } from "./model";
+import { keyLike, nodeKeyFor, visibleInfo, type ProjectNode } from "./model";
import { lastFileRefactoring, undoFileRefactoring } from "./fileRefactor";
import {
cancelEditing,
@@ -61,6 +63,8 @@ import {
} from "./operations";
import { isInside, nameOf, parentOf, splitExtension, tildify } from "./paths";
import {
+ VIEW_MODES,
+ autoExpand,
clearRevealRequest,
loadDir,
revealPath,
@@ -89,7 +93,7 @@ export function showNewPopup(): boolean {
const row = lead ? document.querySelector<HTMLElement>(`[data-project-key="${CSS.escape(lead)}"]`) : null;
const rect = (row ?? document.querySelector<HTMLElement>('[role="tree"][aria-label="Project"]'))?.getBoundingClientRect();
if (!rect) return false;
- showContextMenu({ x: rect.left + 24, y: rect.bottom }, newMenuItems(targetFolder()));
+ openNewPopup({ x: rect.left + 24, y: rect.bottom }, newMenuItems(targetFolder()));
return true;
}
@@ -100,7 +104,8 @@ const loadChildren = (n: ProjectNode) => loadDir(n.path);
function iconFor(node: ProjectNode, roots: readonly RootFolder[], root: string | null): string {
if (node.placeholder) return node.placeholder === "dir" ? "folder" : "file";
- if (node.root) return node.icon ?? "module";
+ if (node.icon) return node.icon;
+ if (node.root) return "module";
if (node.dir) return folderIconName(folderKind(node, roots, root));
return fileIconName(node.label);
}
@@ -310,6 +315,7 @@ function folderAt(container: HTMLElement | null, x: number, y: number): { key: s
// ---------------------------------------------------------------------------
export function ProjectView() {
+ const txTemplate = useTxTemplate();
const root = useProjectTree((s) => s.root);
const model = useProjectTree(selectModel);
const expanded = useProjectTree((s) => s.expanded);
@@ -326,6 +332,10 @@ export function ProjectView() {
const revealing = useRef(false);
const info = useMemo(() => visibleInfo(model, expanded), [model, expanded]);
+ const mode = useProjectTree((s) => s.mode);
+
+ // Open Files / All Changed Files: show new files' folders expanded.
+ useEffect(() => autoExpand(model), [model]);
// Load folders that are expanded (restored state, reveal, chains) but not read yet.
useEffect(() => {
@@ -363,7 +373,7 @@ export function ProjectView() {
const onExpandedChange = useCallback((next: Set<string>, node: ProjectNode, open: boolean) => {
// Expanding a compacted chain opens every folder in it, so it stays open if the chain breaks.
- if (open) for (const p of node.chain) next.add(p);
+ if (open) for (const p of node.chain) next.add(keyLike(node.key, p));
setExpanded(next);
}, []);
@@ -389,6 +399,7 @@ export function ProjectView() {
}
const nodes = [...sel].map((k) => m.byKey.get(k)).filter((n): n is ProjectNode => !!n && !n.placeholder);
const target = nodes.length ? nodes : [node];
+ if (target.every((n) => n.group)) return;
// Contributed groups may read the file first (bounded wait).
const at = { x: e.clientX, y: e.clientY };
void prepareMenuGroups("projectView", menuGroupContext(target)).then(() => showContextMenu(at, contextMenuItems(target)));
@@ -407,7 +418,7 @@ export function ProjectView() {
// Pointer-driven drag & drop (HTML5 DnD is unreliable inside the Tauri webview).
const onRowPointerDown = useCallback((node: ProjectNode, e: ReactPointerEvent) => {
- if (e.button !== 0 || node.root || node.placeholder || useProjectTree.getState().editing) return;
+ if (e.button !== 0 || node.root || node.placeholder || node.readOnly || useProjectTree.getState().editing) return;
const before = useProjectTree.getState().selected;
const lead = useProjectTree.getState().lead;
const startX = e.clientX,
@@ -553,7 +564,7 @@ export function ProjectView() {
editing={editing}
cut={cutPaths.has(node.path)}
dropTarget={dropTarget === node.key}
- detail={node.root && !node.icon ? rootDetail : null}
+ detail={node.root && !node.icon ? rootDetail : (node.detail ?? null)}
onEditDone={focusTree}
onClick={onRowClick}
onPointerDown={onRowPointerDown}
@@ -576,6 +587,9 @@ export function ProjectView() {
onFocus={(e) => setContext("projectViewFocus", (e.target as HTMLElement).getAttribute("role") === "tree")}
onBlur={() => setContext("projectViewFocus", false)}
>
+ {!model.roots.length && (
+ <div className={styles.empty}>{txTemplate(`Nothing to show in ${VIEW_MODES.find(([id]) => id === mode)?.[1] ?? "this view"}`)}</div>
+ )}
<Tree<ProjectNode>
aria-label="Project"
handleRef={setTreeHandle}
diff --git a/src/features/project-tree/actions.ts b/src/features/project-tree/actions.ts
index c1ff897de..ed85f9218 100644
--- a/src/features/project-tree/actions.ts
+++ b/src/features/project-tree/actions.ts
@@ -1,10 +1,12 @@
/** Actions of the project view (Find Action, keymap, other features via `executeAction`). */
import { activeEditor } from "@/editor/api";
import { getAction, registerActions, type Action } from "@/platform/actions";
+import { dirname, useProject } from "@/platform/project";
import { showContextMenu, type MenuItem } from "@/ui";
import { maybeEditorService, menuGroupItems, toolWindowService } from "@/workbench/contributions";
import { OPTION_LABELS } from "./HeaderActions";
-import { revealLabel } from "./contextMenu";
+import { newMenuItems, revealLabel } from "./contextMenu";
+import { openNewPopup } from "./newPopupModel";
import type { ProjectNode } from "./model";
import {
beginNew,
@@ -28,7 +30,18 @@ import {
import { nameOf, parentOf } from "./paths";
import { showNewPopup, treeHandle } from "./ProjectView";
import { lastFileRefactoring, undoFileRefactoring } from "./fileRefactor";
-import { collapseAll, currentModel, expandAll, reloadAll, revealPath, setViewOption, useProjectTree } from "./store";
+import {
+ VIEW_MODES,
+ collapseAll,
+ currentModel,
+ expandAll,
+ modeShows,
+ reloadAll,
+ revealPath,
+ setViewMode,
+ setViewOption,
+ useProjectTree,
+} from "./store";
const FOCUS = "projectViewFocus";
const OPEN = "projectOpen";
@@ -75,6 +88,7 @@ function showProjectView(focus: boolean) {
export function selectInProjectView(path?: string | null, focus = true) {
const target = path ?? maybeEditorService()?.activePath() ?? null;
if (!target) return false;
+ if (!modeShows(target)) setViewMode("project");
showProjectView(focus);
return revealPath(target, focus);
}
@@ -99,6 +113,23 @@ export function selectInTargets(path: string): MenuItem[] {
];
}
+/**
+ * The New popup for the active editor's directory, at the caret (centred near
+ * the top without one); `orRoot` falls back to the project root without a file.
+ */
+export function showNewPopupForEditor(orRoot = false): boolean {
+ const editor = activeEditor();
+ const path = editor && !editor.ctx.virtual ? editor.ctx.path : null;
+ const directory = path ? dirname(path) : orRoot ? (useProject.getState().project?.root ?? null) : null;
+ if (!directory) return false;
+ const coords = path ? editor!.view.coordsAtPos(editor!.view.state.selection.main.head) : null;
+ const at = coords
+ ? { x: coords.left, y: coords.bottom + 2 }
+ : { x: window.innerWidth / 2 - 140, y: window.innerHeight / 5 };
+ openNewPopup(at, newMenuItems(directory, { outsideTree: true }));
+ return true;
+}
+
function showSelectIn(path: string) {
// At the caret, like IDEA's popup; centred near the top otherwise.
const view = activeEditor()?.view;
@@ -125,6 +156,18 @@ export function registerProjectActions(): () => void {
run: () => setViewOption(key, !useProjectTree.getState().options[key]),
}));
+ const modes: Action[] = VIEW_MODES.map(([mode, label]) => ({
+ id: `project.viewMode.${mode}`,
+ title: `Project View: Show ${label}`,
+ category: "View",
+ when: OPEN,
+ keywords: ["project", "pane", "scope", "view as"],
+ run: () => {
+ setViewMode(mode);
+ showProjectView(false);
+ },
+ }));
+
return registerActions([
{
// A path argument (links, breadcrumbs, Open In › Project View) selects it in the project view.
@@ -165,13 +208,28 @@ export function registerProjectActions(): () => void {
when: OPEN,
keywords: ["create"],
run: ({ arg, ctx }) => {
- // ⌘N inside the project view opens the New popup (File, Directory, templates).
+ // ⌘N inside the project view opens the New popup (File, Directory, templates);
+ // in an editor (where Generate does not apply) it opens for the file's directory.
if (arg === undefined && ctx[FOCUS] && showNewPopup()) return;
+ if (arg === undefined && ctx.editorFocus && showNewPopupForEditor()) return;
// No focus request: the inline editor takes focus itself.
showProjectView(false);
return beginNew("file", folderFrom(arg));
},
},
+ {
+ // IDEA's NewElementSamePlace: the New popup for the current file's directory, wherever the focus is.
+ id: "project.newInThisDirectory",
+ title: "New in This Directory…",
+ category: "File",
+ icon: "plus",
+ when: OPEN,
+ keywords: ["create", "file", "same place", "current directory"],
+ run: ({ ctx }) => {
+ if (ctx[FOCUS] && showNewPopup()) return;
+ showNewPopupForEditor(true);
+ },
+ },
{
// File › New (native menu, VS Code preset): same as New File at the selection.
id: "file.new",
@@ -380,7 +438,7 @@ export function registerProjectActions(): () => void {
keyWhen: FOCUS,
run: () => {
const lead = leadNode();
- return expandAll(lead?.dir && !lead.root ? lead.path : undefined);
+ return expandAll(lead?.dir && !lead.root ? lead.key : undefined);
},
},
{
@@ -405,5 +463,6 @@ export function registerProjectActions(): () => void {
run: reloadAll,
},
...toggles,
+ ...modes,
]);
}
diff --git a/src/features/project-tree/contextMenu.ts b/src/features/project-tree/contextMenu.ts
index e7def9dbc..ba8961e6d 100644
--- a/src/features/project-tree/contextMenu.ts
+++ b/src/features/project-tree/contextMenu.ts
@@ -1,10 +1,10 @@
/** Context menu and "New" popup of the project view. */
-import { allActions, getAction } from "@/platform/actions";
+import { executeAction, getAction } from "@/platform/actions";
import { formatBinding, hostBinding, isMacHost, shortcutLabel } from "@/platform/keymap";
import { relativePath, useProject } from "@/platform/project";
import { currentDetectedRoots, currentRoots } from "@/platform/projectRoots";
import type { MenuItem } from "@/ui";
-import { menuGroupItems, type MenuGroupContext } from "@/workbench/contributions";
+import { menuGroupItems, toolWindowService, type MenuGroupContext } from "@/workbench/contributions";
import type { FolderRole } from "@/platform/languageSettings";
import { directoryRole, markDirectory } from "./markDirectory";
import type { ProjectNode } from "./model";
@@ -44,16 +44,37 @@ export const LOCAL_KEYS: Record<string, string> = {
export const keyLabel = (id: string) =>
shortcutLabel(id) ?? (LOCAL_KEYS[id] ? formatBinding(hostBinding(LOCAL_KEYS[id])) : undefined);
-export function newMenuItems(parent: string | null): MenuItem[] {
+/**
+ * New › items for `parent`. `outsideTree` (⌘N in the editor): File asks for the
+ * name in a dialog, and the inline Directory / Package editors bring up the project view.
+ */
+export function newMenuItems(parent: string | null, { outsideTree = false } = {}): MenuItem[] {
const root = useProject.getState().project?.root;
const rel = parent && root ? (parent === root ? "" : relativePath(root, parent)) : null;
const pkg = rel === null ? null : packageKindAt(rel, currentRoots(), currentDetectedRoots());
- const dir: MenuItem = { id: "new.dir", label: "Directory", icon: "folder", run: () => void beginNew("dir", parent) };
+ const inline = (start: () => Promise<void>) => () => {
+ if (outsideTree) showProjectView();
+ void start();
+ };
+ const emptyFile = outsideTree && parent && getAction("templates.new.file");
+ const dir: MenuItem = {
+ id: "new.dir",
+ label: "Directory",
+ icon: "folder",
+ run: inline(() => beginNew("dir", parent)),
+ };
return [
- { id: "new.file", label: "File", icon: "file", run: () => void beginNew("file", parent) },
+ emptyFile
+ ? {
+ id: "new.file",
+ label: "File",
+ icon: "file",
+ run: () => void executeAction(emptyFile.id, { directory: parent }),
+ }
+ : { id: "new.file", label: "File", icon: "file", run: inline(() => beginNew("file", parent)) },
// IDEA offers "Package" instead of "Directory" inside a Java / Kotlin source root.
pkg === "jvm"
- ? { id: "new.package", label: "Package", icon: "package", run: () => void beginNewPackage("jvm", parent) }
+ ? { id: "new.package", label: "Package", icon: "package", run: inline(() => beginNewPackage("jvm", parent)) }
: dir,
...(pkg === "python"
? [
@@ -61,22 +82,25 @@ export function newMenuItems(parent: string | null): MenuItem[] {
id: "new.pythonPackage",
label: "Python Package",
icon: "package",
- run: () => void beginNewPackage("python", parent),
+ run: inline(() => beginNewPackage("python", parent)),
},
]
: []),
- ...templateItems(parent),
+ ...contributedNewItems(parent),
];
}
-/** File templates contributed by features/templates (`templates.new.*`). */
-function templateItems(parent: string | null): MenuItem[] {
- const arg = parent ? { directory: parent } : undefined;
- const items: MenuItem[] = allActions()
- .filter((a) => a.id.startsWith("templates.new.") && a.id !== "templates.new.file")
- .map((a) => ({ kind: "action", action: a.id, arg, label: a.title.replace(/^New /, "").replace(/…$/, "") }));
- const more = getAction("templates.newFromTemplate");
- if (more) items.push({ kind: "separator" }, { kind: "action", action: more.id, arg, label: "From Template…" });
+function showProjectView() {
+ try {
+ toolWindowService().show("project", false);
+ } catch {
+ /* tool window service not available (tests) */
+ }
+}
+
+/** File kinds contributed to the `new` menu group (templates, HTTP Request, Scratch File…). */
+function contributedNewItems(parent: string | null): MenuItem[] {
+ const items = menuGroupItems("new", parent ? { paths: [parent], dirs: [true] } : { paths: [] });
return items.length ? [{ kind: "separator" }, ...items] : [];
}
@@ -107,6 +131,7 @@ function submenu(id: string, label: string, entries: Entry[], icon?: string): Me
* clipboard group), so the project root and Scratches get a shorter menu.
*/
export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
+ if (nodes.some((n) => n.readOnly)) return libraryMenuItems(nodes.filter((n) => !n.group));
const lead = nodes[0] ?? null;
const single = nodes.length === 1 ? lead : null;
const nonRoot = nodes.filter((n) => !n.root);
@@ -338,6 +363,30 @@ export function contextMenuItems(nodes: ProjectNode[]): MenuItem[] {
return items;
}
+/** Library sources (External Libraries) are read-only: copy, find and reveal only. */
+function libraryMenuItems(nodes: ProjectNode[]): MenuItem[] {
+ if (!nodes.length) return [];
+ const single = nodes.length === 1 ? nodes[0]! : null;
+ const folder = single?.dir ? single.path : null;
+ const items: Entry[] = [
+ { id: "copy", label: "Copy", icon: "copy", shortcut: keyLabel("project.copy"), run: () => copySelection(false) },
+ {
+ id: "copyPath",
+ label: "Copy Path/Reference…",
+ submenu: [
+ { id: "abs", label: "Absolute Path", shortcut: keyLabel("project.copyAbsolutePath"), run: () => void copyPaths("absolute", nodes) },
+ { id: "name", label: "File Name", run: () => void copyPaths("name", nodes) },
+ ],
+ },
+ { kind: "separator" },
+ !!folder && delegated("find.inPath", { directory: folder }, "Find in Files…", { icon: "search" }),
+ !!folder && { kind: "separator" },
+ submenu("openIn", "Open In", [{ id: "finder", label: revealLabel(), icon: "external-link", run: () => void revealInFinder(nodes) }]),
+ single && !single.dir && delegated("diff.compareWith", single.path, "Compare With…", { icon: "diff", shortcut: keyLabel("project.compareWith") }),
+ ];
+ return items.filter((i): i is MenuItem => !!i);
+}
+
export function revealLabel() {
const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
if (/Win/i.test(ua)) return "Explorer";
diff --git a/src/features/project-tree/index.ts b/src/features/project-tree/index.ts
index 5ad37597d..7d4fe10ea 100644
--- a/src/features/project-tree/index.ts
+++ b/src/features/project-tree/index.ts
@@ -1,16 +1,26 @@
/** Project view: the "project" tool window, its file operations and actions. */
+import { onEditorEvent, openEditorPaths } from "@/editor/api";
import { onIdeEvent } from "@/platform/ipc";
-import type { RootFolder } from "@/platform/languageSettings";
+import { validateProjectStructure, type RootFolder } from "@/platform/languageSettings";
import { useProject } from "@/platform/project";
import { initProjectRoots, useProjectRoots } from "@/platform/projectRoots";
-import { registerOverlay, registerToolWindow, useProjectViewRoots } from "@/workbench/contributions";
+import { folderIconName } from "@/ui";
+import {
+ localChangedPaths,
+ registerOverlay,
+ registerProjectViewRoot,
+ registerToolWindow,
+ useLocalChanges,
+ useProjectViewRoots,
+} from "@/workbench/contributions";
import { registerProjectActions } from "./actions";
import { FileRefactorDialogHost } from "./FileRefactorDialogs";
+import { NewPopupHost } from "./NewPopup";
import { RefactoringPreviewHost } from "./RefactoringPreview";
-import { ProjectHeaderActions, useProjectHeaderMenu } from "./HeaderActions";
+import { ProjectHeaderActions, useProjectHeaderMenu, useProjectTitleMenu } from "./HeaderActions";
import { loadHomeDir } from "./home";
import { ProjectView } from "./ProjectView";
-import { applyFsChange, initProjectTree, reloadAll, useProjectTree } from "./store";
+import { applyFsChange, initProjectTree, reloadAll, setChangedFiles, setOpenFiles, useProjectTree } from "./store";
export function activate(): () => void {
loadHomeDir();
@@ -27,7 +37,12 @@ export function activate(): () => void {
// Excluded folders / exclude globs change which entries are `ignored`.
const unsubExcludes = useProject.subscribe((s, prev) => {
const ex = (x: typeof s.settings) =>
- JSON.stringify([x?.files?.exclude, x?.projectStructure?.excluded, x?.projectStructure?.unmarked]);
+ JSON.stringify([
+ x?.files?.exclude,
+ x?.projectStructure?.excluded,
+ x?.projectStructure?.unmarked,
+ x?.projectStructure?.excludeFiles,
+ ]);
if (s.settings !== prev.settings && prev.settings && ex(s.settings) !== ex(prev.settings)) void reloadAll();
});
// …and so do excluded roots detected from build files (`target`, `node_modules`, …).
@@ -38,15 +53,64 @@ export function activate(): () => void {
if (s.root && s.root === prev.root && detectedExcluded(s) !== detectedExcluded(prev)) void reloadAll();
});
+ // Project Structure content roots besides the project folder, listed after it.
+ let contentRoots: Array<() => void> = [];
+ let shownRoots = "";
+ const syncContentRoots = () => {
+ const { project, settings } = useProject.getState();
+ const paths = project ? validateProjectStructure(settings?.projectStructure).contentRoots : [];
+ const key = JSON.stringify(paths);
+ if (key === shownRoots) return;
+ shownRoots = key;
+ contentRoots.forEach((d) => d());
+ contentRoots = paths.map((path, i) =>
+ registerProjectViewRoot({
+ id: `contentRoot:${path}`,
+ label: path.slice(path.lastIndexOf("/") + 1) || path,
+ detail: path,
+ icon: folderIconName("module"),
+ path,
+ order: -100 + i,
+ }),
+ );
+ };
+ syncContentRoots();
+ const unsubContentRoots = useProject.subscribe((s, prev) => {
+ if (s.settings !== prev.settings || s.project !== prev.project) syncContentRoots();
+ });
+
// Contributed roots (Scratches) are part of the derived model: re-render.
const unsubExtraRoots = useProjectViewRoots.subscribe(() =>
useProjectTree.setState((s) => ({ listings: new Map(s.listings) })),
);
+ // Open Files / All Changed Files panes: editor tabs and VCS changes, via the editor API and decorations.
+ let openTimer: ReturnType<typeof setTimeout> | undefined;
+ const syncOpenFiles = () => {
+ clearTimeout(openTimer);
+ // Tabs update after the document events.
+ openTimer = setTimeout(() => setOpenFiles(openEditorPaths()), 0);
+ };
+ syncOpenFiles();
+ const unsubEditor = onEditorEvent((e) => {
+ if (e.type === "docOpened" || e.type === "docClosed" || e.type === "activeEditorChanged") syncOpenFiles();
+ });
+ // "All Changed Files": change-list files still on disk (IDEA leaves out unversioned, ignored and deleted ones).
+ const syncChanged = () => setChangedFiles(localChangedPaths(useLocalChanges.getState().lists, null, true));
+ syncChanged();
+ const unsubDecorations = useLocalChanges.subscribe((s, prev) => {
+ if (s.lists !== prev.lists) syncChanged();
+ });
+
const disposers = [
+ () => clearTimeout(openTimer),
+ unsubEditor,
+ unsubDecorations,
unsubProject,
unsubExtraRoots,
unsubExcludes,
+ unsubContentRoots,
+ () => contentRoots.forEach((d) => d()),
disposeRoots,
unsubRoots,
registerToolWindow({
@@ -58,9 +122,11 @@ export function activate(): () => void {
component: ProjectView,
headerActions: ProjectHeaderActions,
headerMenu: useProjectHeaderMenu,
+ titleMenu: useProjectTitleMenu,
}),
registerOverlay({ id: "project.fileRefactor", component: FileRefactorDialogHost }),
registerOverlay({ id: "project.refactoringPreview", component: RefactoringPreviewHost }),
+ registerOverlay({ id: "project.newPopup", component: NewPopupHost }),
registerProjectActions(),
onIdeEvent("fsChanged", (e) => void applyFsChange(e)),
];
diff --git a/src/features/project-tree/model.ts b/src/features/project-tree/model.ts
index 198b3727e..f35d38003 100644
--- a/src/features/project-tree/model.ts
+++ b/src/features/project-tree/model.ts
@@ -5,7 +5,7 @@
*/
import type { FileEntry } from "@/bindings";
import { isIgnoredName } from "@/platform/ignoredNames";
-import { isSameOrInside, nameOf, parentOf, relativeTo } from "./paths";
+import { ancestorsWithin, isInside, isSameOrInside, nameOf, parentOf, relativeTo } from "./paths";
export interface TreeOptions {
/** Show ignored names (`files.ignoredNames`: `.git`, `.DS_Store`, …). Dotfiles are always shown. */
@@ -43,6 +43,12 @@ export interface ProjectNode {
placeholder?: "file" | "dir";
/** Root of a contributed folder outside the project ("Scratches"): its icon. */
icon?: string;
+ /** Grey text after the label ("library root"). */
+ detail?: string;
+ /** A node grouping other nodes, without a folder of its own ("External Libraries"). */
+ group?: boolean;
+ /** Library sources: no new / rename / move / delete. */
+ readOnly?: boolean;
}
export interface TreeModel {
@@ -210,13 +216,53 @@ export function buildModel(
return { roots: [rootNode], children, byKey, keyOfPath };
}
+/** A contributed root (scratches, External Libraries) or one of its child entries. */
+export interface ExtraRoot {
+ id?: string;
+ label: string;
+ icon: string;
+ /** Folder listed by the node; omitted for a group node of `children`. */
+ path?: string;
+ children?: readonly ExtraRoot[];
+ detail?: string;
+ readOnly?: boolean;
+}
+
+/** Key prefix of group nodes that show no folder ("External Libraries", an SDK). */
+export const GROUP_PREFIX = "\u0000group:";
+
+export const isGroupKey = (key: string) => key.startsWith(GROUP_PREFIX);
+
/**
- * Adds contributed roots (folders outside the project, e.g. scratches) after
- * the project root. Each lists its folder like the project root does.
+ * Key prefix of nodes in a library folder below a group (`\0lib:<group>\0<path>`):
+ * their own namespace, so a folder inside the project (a `.venv`'s
+ * site-packages, `node_modules/<dep>`) shows both there and under External Libraries.
+ */
+export const LIB_PREFIX = "\u0000lib:";
+const LIB_SEP = "\u0000";
+
+export const isLibKey = (key: string) => key.startsWith(LIB_PREFIX);
+
+export const libKey = (group: string, path: string) => `${LIB_PREFIX}${group}${LIB_SEP}${path}`;
+
+/** The folder / file a node key stands for (keys outside library subtrees are paths). */
+export function pathOfKey(key: string): string {
+ return isLibKey(key) ? key.slice(key.indexOf(LIB_SEP, LIB_PREFIX.length) + 1) : key;
+}
+
+/** The key of `path` in the same subtree as the node keyed `like`. */
+export function keyLike(like: string, path: string): string {
+ return isLibKey(like) ? like.slice(0, like.indexOf(LIB_SEP, LIB_PREFIX.length) + 1) + path : path;
+}
+
+/**
+ * Adds contributed roots (folders outside the project, e.g. scratches, and
+ * groups of them like External Libraries) after the project root. Each folder
+ * lists its contents like the project root does.
*/
export function withExtraRoots(
model: TreeModel,
- extras: ReadonlyArray<{ path: string; label: string; icon: string }>,
+ extras: readonly ExtraRoot[],
listings: Listings,
opts: TreeOptions,
placeholder?: Placeholder | null,
@@ -228,19 +274,151 @@ export function withExtraRoots(
byKey: new Map(model.byKey),
keyOfPath: new Map(model.keyOfPath),
};
+ const add = (extra: ExtraRoot, parentKey: string | null, readOnly: boolean): ProjectNode | null => {
+ const ro = readOnly || !!extra.readOnly;
+ if (extra.path !== undefined && !extra.children) {
+ const path = extra.path;
+ // Library folders of a group are keyed in their own namespace; other
+ // folders (scratches) by path, so ones inside the project stay under it.
+ const ns = ro && parentKey ? parentKey.slice(GROUP_PREFIX.length) : null;
+ const rekey = (k: string) => (ns === null ? k : libKey(ns, k));
+ if (out.byKey.has(rekey(path))) return null;
+ if (ns === null && model.roots.some((r) => !r.group && isSameOrInside(path, r.path))) return null;
+ const sub = buildModel({ path, name: extra.label }, listings, opts, ro ? null : placeholder);
+ const subRoot = sub.roots[0]!;
+ const rootNode: ProjectNode = { ...subRoot, key: rekey(subRoot.key), root: !parentKey, icon: extra.icon, detail: extra.detail };
+ if (ro) rootNode.readOnly = true;
+ const nodes = new Map<string, ProjectNode>();
+ for (const [k, v] of sub.byKey)
+ nodes.set(k, k === subRoot.key ? rootNode : ns !== null || ro ? { ...v, key: rekey(k), readOnly: ro || v.readOnly } : v);
+ for (const n of nodes.values()) out.byKey.set(n.key, n);
+ for (const [k, v] of sub.children) out.children.set(rekey(k), v.map((n) => nodes.get(n.key) ?? n));
+ for (const [p, k] of sub.keyOfPath) if (!out.keyOfPath.has(p)) out.keyOfPath.set(p, rekey(k));
+ return rootNode;
+ }
+ const key = `${parentKey ? `${parentKey}/` : GROUP_PREFIX}${extra.id ?? extra.label}`;
+ if (out.byKey.has(key)) return null;
+ const node: ProjectNode = {
+ key,
+ path: key,
+ chain: [],
+ label: extra.label,
+ dir: true,
+ root: !parentKey,
+ entry: null,
+ ignored: false,
+ excluded: false,
+ symlink: false,
+ icon: extra.icon,
+ detail: extra.detail,
+ group: true,
+ readOnly: true,
+ };
+ out.byKey.set(key, node);
+ const kids = (extra.children ?? []).map((c) => add(c, key, ro)).filter((n): n is ProjectNode => !!n);
+ out.children.set(key, kids);
+ return node;
+ };
for (const extra of extras) {
- if (out.byKey.has(extra.path)) continue;
- const sub = buildModel({ path: extra.path, name: extra.label }, listings, opts, placeholder);
- const rootNode = { ...sub.roots[0]!, icon: extra.icon };
- sub.byKey.set(rootNode.key, rootNode);
- out.roots.push(rootNode);
- for (const [k, v] of sub.children) out.children.set(k, v);
- for (const [k, v] of sub.byKey) out.byKey.set(k, v);
- for (const [k, v] of sub.keyOfPath) out.keyOfPath.set(k, v);
+ const node = add(extra, null, false);
+ if (node) out.roots.push(node);
}
return out;
}
+/**
+ * Marks project nodes inside read-only library `folders` (a `.venv`'s
+ * site-packages listed under External Libraries) read-only too.
+ */
+export function withReadOnlyFolders(model: TreeModel, folders: readonly string[]): TreeModel {
+ if (!folders.length) return model;
+ const byKey = new Map(model.byKey);
+ let changed = false;
+ for (const [k, n] of model.byKey)
+ if (!n.readOnly && !n.group && !isLibKey(k) && !n.root && folders.some((f) => isSameOrInside(n.path, f))) {
+ byKey.set(k, { ...n, readOnly: true });
+ changed = true;
+ }
+ if (!changed) return model;
+ const children = new Map<string, ProjectNode[]>();
+ for (const [k, kids] of model.children) children.set(k, kids.map((n) => byKey.get(n.key) ?? n));
+ return { roots: model.roots.map((n) => byKey.get(n.key) ?? n), children, byKey, keyOfPath: model.keyOfPath };
+}
+
+/** Folder roots of contributed entries (groups flattened), in display order. */
+export function extraFolders(extras: readonly ExtraRoot[], readOnly = false): ExtraRoot[] {
+ return extras.flatMap((e) =>
+ e.path !== undefined && !e.children
+ ? [{ ...e, readOnly: readOnly || !!e.readOnly }]
+ : extraFolders(e.children ?? [], readOnly || !!e.readOnly),
+ );
+}
+
+/**
+ * A tree of just `paths` (IDEA's "Open Files" / "All Changed Files" views):
+ * each file below the innermost of `roots` containing it, through its folders.
+ * Files outside every root are grouped under their folder. Roots without
+ * files are left out.
+ */
+export function buildPathsModel(roots: readonly ExtraRoot[], paths: readonly string[], foldersFirst = true): TreeModel {
+ const children = new Map<string, ProjectNode[]>();
+ const byKey = new Map<string, ProjectNode>();
+ const keyOfPath = new Map<string, string>();
+ const rootNodes: Array<[number, ProjectNode]> = [];
+ const node = (path: string, label: string, dir: boolean, extra: Partial<ProjectNode> = {}): ProjectNode => {
+ const n: ProjectNode = {
+ key: path,
+ path,
+ chain: [path],
+ label,
+ dir,
+ root: false,
+ entry: null,
+ ignored: false,
+ excluded: false,
+ symlink: false,
+ ...extra,
+ };
+ byKey.set(path, n);
+ keyOfPath.set(path, path);
+ if (dir) children.set(path, []);
+ return n;
+ };
+ const ensureRoot = (r: ExtraRoot & { path: string }, rank: number) => {
+ const existing = byKey.get(r.path);
+ if (existing) return existing;
+ const n = node(r.path, r.label, true, { root: true, icon: r.icon || undefined, detail: r.detail, readOnly: r.readOnly });
+ rootNodes.push([rank, n]);
+ return n;
+ };
+ const folders = roots.filter((r): r is ExtraRoot & { path: string } => r.path !== undefined);
+ for (const path of new Set(paths)) {
+ if (byKey.has(path)) continue;
+ let rank = -1;
+ for (let i = 0; i < folders.length; i++)
+ if (isInside(path, folders[i]!.path) && (rank < 0 || folders[i]!.path.length > folders[rank]!.path.length)) rank = i;
+ const root =
+ rank >= 0
+ ? ensureRoot(folders[rank]!, rank)
+ : ensureRoot({ path: parentOf(path), label: parentOf(path), icon: "folder" }, folders.length);
+ let parent = root;
+ for (const dir of ancestorsWithin(root.path, path).slice(1)) {
+ let d = byKey.get(dir);
+ if (!d) {
+ d = node(dir, nameOf(dir), true, { readOnly: root.readOnly });
+ children.get(parent.key)!.push(d);
+ }
+ parent = d;
+ }
+ children.get(parent.key)!.push(node(path, nameOf(path), false, { readOnly: root.readOnly }));
+ }
+ const order = (a: ProjectNode, b: ProjectNode) =>
+ (foldersFirst ? Number(b.dir) - Number(a.dir) : 0) || collator.compare(a.label, b.label);
+ for (const kids of children.values()) kids.sort(order);
+ rootNodes.sort((a, b) => a[0] - b[0] || collator.compare(a[1].label, b[1].label));
+ return { roots: rootNodes.map(([, n]) => n), children, byKey, keyOfPath };
+}
+
export interface VisibleInfo {
/** Node keys currently rendered (ancestors expanded). */
visible: Set<string>;
diff --git a/src/features/project-tree/newPopupModel.test.ts b/src/features/project-tree/newPopupModel.test.ts
new file mode 100644
index 000000000..e6a720f92
--- /dev/null
+++ b/src/features/project-tree/newPopupModel.test.ts
@@ -0,0 +1,107 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { executeAction, registerActions } from "@/platform/actions";
+import { useProject } from "@/platform/project";
+import type { MenuItem } from "@/ui";
+import { registerMenuGroup } from "@/workbench/contributions";
+import { newMenuItems } from "./contextMenu";
+import { closeNewPopup, newPopupRows, openNewPopup, useNewPopup } from "./newPopupModel";
+import { useProjectTree } from "./store";
+
+vi.mock("@/platform/actions", async (importOriginal) => {
+ const mod = await importOriginal<typeof import("@/platform/actions")>();
+ return { ...mod, executeAction: vi.fn(mod.executeAction) };
+});
+
+const ROOT = "/p";
+const labels = (items: MenuItem[], q = "") => newPopupRows(items, q).map((r) => (r.separator ? "-" : r.label));
+
+let disposers: Array<() => void> = [];
+
+beforeEach(() => {
+ useProjectTree.setState({ root: ROOT });
+ useProject.setState({
+ project: { name: "p", root: ROOT, isGit: false, settings: {} } as never,
+ settings: {} as never,
+ });
+ disposers = [
+ registerActions([
+ { id: "templates.new.file", title: "New Empty File…", run: () => undefined },
+ { id: "templates.new.python", title: "New Python File…", run: () => undefined },
+ {
+ id: "templates.new.stylesheet",
+ title: "New Stylesheet…",
+ keywords: ["new", "css", "scss", "less"],
+ run: () => undefined,
+ },
+ { id: "http.newRequest", title: "New HTTP Request", run: () => undefined },
+ ]),
+ registerMenuGroup({
+ id: "test.templates",
+ menus: ["new"],
+ order: 10,
+ items: (_menu, ctx) => [
+ { kind: "action", action: "templates.new.python", arg: { directory: ctx.paths[0] }, label: "Python File" },
+ { kind: "action", action: "templates.new.stylesheet", arg: { directory: ctx.paths[0] }, label: "Stylesheet" },
+ ],
+ }),
+ registerMenuGroup({
+ id: "test.http",
+ menus: ["new"],
+ order: 20,
+ items: (_menu, { paths: [directory] }) =>
+ directory ? [{ kind: "action", action: "http.newRequest", arg: { directory }, label: "HTTP Request" }] : [],
+ }),
+ ];
+});
+
+afterEach(() => {
+ disposers.forEach((d) => d());
+ closeNewPopup();
+ vi.mocked(executeAction).mockClear();
+ useProject.setState({ project: null, settings: null });
+ useProjectTree.setState({ root: null });
+});
+
+describe("New popup", () => {
+ it("lists File, Directory and the contributed file kinds", () => {
+ expect(labels(newMenuItems(`${ROOT}/src`))).toEqual([
+ "File",
+ "Directory",
+ "-",
+ "Python File",
+ "Stylesheet",
+ "-",
+ "HTTP Request",
+ ]);
+ });
+
+ it("passes the target directory to contributed kinds", () => {
+ const http = newMenuItems(`${ROOT}/api`).find((i) => i.kind === "action" && i.action === "http.newRequest");
+ expect(http).toMatchObject({ arg: { directory: `${ROOT}/api` } });
+ });
+
+ it("filters by label, then by keyword, without separators", () => {
+ const items = newMenuItems(ROOT);
+ expect(labels(items, "py")).toEqual(["Python File"]);
+ expect(labels(items, "css")).toEqual(["Stylesheet"]);
+ expect(labels(items, "http")).toEqual(["HTTP Request"]);
+ expect(labels(items, "zzz")).toEqual([]);
+ expect(newPopupRows(items, "py")[0]!.matches).toEqual([0, 1]);
+ });
+
+ it("asks for the file name in a dialog outside the project view", () => {
+ const file = newMenuItems(`${ROOT}/src`, { outsideTree: true })[0] as { label: string; run: () => void };
+ expect(file.label).toBe("File");
+ file.run();
+ expect(executeAction).toHaveBeenCalledWith("templates.new.file", { directory: `${ROOT}/src` });
+ });
+
+ it("opens with a fresh request each time", () => {
+ openNewPopup({ x: 1, y: 2 }, []);
+ const first = useNewPopup.getState().request!.seq;
+ openNewPopup({ x: 1, y: 2 }, []);
+ expect(useNewPopup.getState().request!.seq).toBe(first + 1);
+ closeNewPopup();
+ expect(useNewPopup.getState().request).toBeNull();
+ });
+});
diff --git a/src/features/project-tree/newPopupModel.ts b/src/features/project-tree/newPopupModel.ts
new file mode 100644
index 000000000..23d474c09
--- /dev/null
+++ b/src/features/project-tree/newPopupModel.ts
@@ -0,0 +1,66 @@
+/** IDEA's "New" popup (⌘N): the New › items under a "Search for file type" field. */
+import { create } from "zustand";
+import { getAction } from "@/platform/actions";
+import { fuzzyMatch, resolveMenuItems, type MenuItem } from "@/ui";
+
+export interface NewPopupRow {
+ key: string;
+ separator?: boolean;
+ label: string;
+ icon?: string;
+ shortcut?: string;
+ run?: () => void;
+ /** Matched label indices while filtering. */
+ matches?: number[] | null;
+}
+
+interface NewPopupState {
+ request: { at: { x: number; y: number }; items: MenuItem[]; seq: number } | null;
+}
+
+export const useNewPopup = create<NewPopupState>(() => ({ request: null }));
+let seq = 0;
+
+export function openNewPopup(at: { x: number; y: number }, items: MenuItem[]) {
+ useNewPopup.setState({ request: { at, items, seq: ++seq } });
+}
+
+export const closeNewPopup = () => useNewPopup.setState({ request: null });
+
+/** Generic action keywords that would match every template. */
+const GENERIC = new Set(["new", "create", "template", "file"]);
+
+/**
+ * Enabled entries, filtered by `query`: label matches (highlighted), then
+ * entries whose action has a matching keyword (`css` finds Stylesheet).
+ * Separators are kept only without a query.
+ */
+export function newPopupRows(items: MenuItem[], query: string): NewPopupRow[] {
+ const q = query.trim();
+ const rows: NewPopupRow[] = [];
+ const byKeyword: NewPopupRow[] = [];
+ for (const r of resolveMenuItems(items)) {
+ if (r.kind === "separator") {
+ if (!q && rows.length && !rows[rows.length - 1]!.separator) rows.push({ key: r.key, separator: true, label: "" });
+ continue;
+ }
+ if (r.kind !== "item" || r.disabled || !r.run) continue;
+ const row: NewPopupRow = { key: r.key, label: r.label, icon: r.icon, shortcut: r.shortcut, run: r.run };
+ if (!q) {
+ rows.push(row);
+ continue;
+ }
+ const matches = fuzzyMatch(r.label, q);
+ if (matches) rows.push({ ...row, matches });
+ else if (keywordMatch(r.key, q)) byKeyword.push(row);
+ }
+ while (rows.length && rows[rows.length - 1]!.separator) rows.pop();
+ return [...rows, ...byKeyword];
+}
+
+function keywordMatch(actionId: string, q: string): boolean {
+ const lower = q.toLowerCase().replace(/^\./, "");
+ return !!getAction(actionId)?.keywords?.some(
+ (k) => !GENERIC.has(k) && k.toLowerCase().replace(/^\./, "").startsWith(lower),
+ );
+}
diff --git a/src/features/project-tree/operations.ts b/src/features/project-tree/operations.ts
index c2d2f6cd0..7277429ed 100644
--- a/src/features/project-tree/operations.ts
+++ b/src/features/project-tree/operations.ts
@@ -26,14 +26,20 @@ import {
import {
currentModel,
type Editing,
+ isFilteredMode,
+ isReadOnlyPath,
loadDir,
revealPath,
setClipboard,
setExpanded,
+ setViewMode,
startEditing,
useProjectTree,
} from "./store";
+/** Nodes that may be renamed, moved or deleted (not roots, groups or library sources). */
+const mutable = (n: ProjectNode) => !n.root && !n.placeholder && !n.readOnly;
+
const get = () => useProjectTree.getState();
const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
@@ -122,7 +128,9 @@ export function openSelection() {
// New / rename
export async function beginNew(nodeKind: "file" | "dir", parent = targetFolder(), pkg?: PackageKind) {
- if (!parent) return;
+ if (!parent || isReadOnlyPath(parent)) return;
+ // The inline editor needs the folder's listing: the filtered panes show none.
+ if (isFilteredMode(get().mode)) setViewMode("project");
expandFolder(parent);
await loadDir(parent);
startEditing(pkg ? { kind: "new", parent, nodeKind: "dir", pkg } : { kind: "new", parent, nodeKind });
@@ -140,13 +148,13 @@ function newRelPath(editing: Extract<Editing, { kind: "new" }>, name: string): s
}
export function beginRename(node: ProjectNode | null = leadNode()) {
- if (!node || node.root || node.placeholder) return;
+ if (!node || !mutable(node)) return;
startEditing({ kind: "rename", key: node.key, path: node.path });
}
/** Rename… (⇧F6): IDEA's Rename dialog, updating references. */
export async function openRenameDialog(node: ProjectNode | null = leadNode()) {
- if (!node || node.root || node.placeholder) return;
+ if (!node || !mutable(node)) return;
const parent = parentOf(node.path);
await loadDir(parent);
openFileRefactorDialog({
@@ -160,7 +168,7 @@ export async function openRenameDialog(node: ProjectNode | null = leadNode()) {
/** Move… (F6): IDEA's Move dialog for the selection, defaulting to `target` or the current folder. */
export function openMoveDialog(nodes: ProjectNode[] = selectedNodes(), target?: string) {
- const movable = nodes.filter((n) => !n.root && !n.placeholder);
+ const movable = nodes.filter(mutable);
const paths = topLevelPaths(movable);
openMoveDialogFor(paths, target, paths.length === 1 && movable.some((n) => n.path === paths[0] && n.dir));
}
@@ -394,7 +402,7 @@ export async function reloadFromDisk(nodes: ProjectNode[] = selectedNodes()) {
export async function deleteSelection(nodes: ProjectNode[] = selectedNodes()) {
const { root } = get();
- const paths = topLevelPaths(nodes.filter((n) => !n.root));
+ const paths = topLevelPaths(nodes.filter(mutable));
if (!root || !paths.length) return;
// Invoked from the tree (or its context menu): give the tree its focus back afterwards.
const refocus = typeof document !== "undefined" && !!document.activeElement?.closest('[role="tree"], [role="menu"]');
@@ -446,7 +454,7 @@ export async function deleteSelection(nodes: ProjectNode[] = selectedNodes()) {
// Clipboard / move / copy
export function copySelection(cut: boolean) {
- const paths = topLevelPaths(selectedNodes().filter((n) => !n.root));
+ const paths = topLevelPaths(selectedNodes().filter((n) => (cut ? mutable(n) : !n.root && !n.group)));
if (paths.length) setClipboard({ paths, cut });
}
@@ -457,7 +465,7 @@ export function canPaste(): boolean {
/** Paste: cut items go through the Move dialog, copied ones through the Copy dialog (IDEA). */
export async function paste(target = targetFolder()) {
const { clipboard } = get();
- if (!clipboard || !target) return;
+ if (!clipboard || !target || isReadOnlyPath(target)) return;
const isDir = (p: string) => get().listings.has(p) || currentModel().byKey.get(currentModel().keyOfPath.get(p) ?? p)?.dir === true;
const single = clipboard.paths.length === 1 && isDir(clipboard.paths[0]!);
if (!clipboard.cut) return openCopyDialogFor(clipboard.paths, target, single);
@@ -512,7 +520,7 @@ export async function transfer(
errors.push(`${name}: cannot copy a folder into itself`);
continue;
}
- const srcIsDir = get().listings.has(src) || currentModel().byKey.get(src)?.dir === true;
+ const srcIsDir = get().listings.has(src) || currentModel().byKey.get(currentModel().keyOfPath.get(src) ?? src)?.dir === true;
const finalName = paths.length === 1 && newName ? newName : uniqueName(name, isTaken, srcIsDir);
const to = joinPath(target, finalName);
try {
@@ -562,8 +570,11 @@ async function moveInto(paths: string[], target: string): Promise<boolean> {
/** Drag & drop inside the tree: the Move dialog (or a confirmed copy with ⌥). */
export async function dropPaths(paths: string[], target: string, copy: boolean) {
+ if (isReadOnlyPath(target)) return;
const movable = topLevelPaths(
- paths.map((p) => currentModel().byKey.get(currentModel().keyOfPath.get(p) ?? p)).filter((n): n is ProjectNode => !!n),
+ paths
+ .map((p) => currentModel().byKey.get(currentModel().keyOfPath.get(p) ?? p))
+ .filter((n): n is ProjectNode => !!n && (copy || !n.readOnly)),
).filter((p) => copy || parentOf(p) !== target);
if (!movable.length) return;
// IDEA opens the Move refactoring dialog for drops inside the project.
@@ -578,7 +589,7 @@ export async function dropPaths(paths: string[], target: string, copy: boolean)
/** Files dropped from the OS: copied into `target` (never moved). */
export async function importExternal(paths: string[], target: string) {
const { root } = get();
- if (!root || !paths.length) return;
+ if (!root || !paths.length || isReadOnlyPath(target)) return;
const inside = paths.filter((p) => isSameOrInside(p, root));
const outside = paths.filter((p) => !isSameOrInside(p, root));
if (inside.length) await dropPaths(inside, target, false);
diff --git a/src/features/project-tree/store.ts b/src/features/project-tree/store.ts
index 47806a5b0..d4322905b 100644
--- a/src/features/project-tree/store.ts
+++ b/src/features/project-tree/store.ts
@@ -1,6 +1,6 @@
/**
* Project view state: lazily loaded listings, expansion / selection (keyed by
- * node key = path), view options, inline editing and the internal clipboard.
+ * node key: the path, namespaced below External Libraries), view options, inline editing and the internal clipboard.
* Kept outside React so actions (keyboard, Find Action, context menu) share it.
*/
import { create } from "zustand";
@@ -8,8 +8,16 @@ import type { FileEntry } from "@/bindings";
import { IpcError } from "@/platform/ipc";
import {
DEFAULT_TREE_OPTIONS,
+ GROUP_PREFIX,
buildModel,
+ buildPathsModel,
+ extraFolders,
+ isGroupKey,
+ isLibKey,
+ keyLike,
+ pathOfKey,
withExtraRoots,
+ withReadOnlyFolders,
dropListings,
isDirEntry,
mergeListing,
@@ -43,6 +51,20 @@ export const DEFAULT_VIEW_OPTIONS: ViewOptions = {
previewTab: false,
};
+/** IDEA's Project view panes ("Project ▾" in the tool window header). */
+export type ViewMode = "project" | "projectFiles" | "openFiles" | "changedFiles" | "scratches";
+
+export const VIEW_MODES: ReadonlyArray<[ViewMode, string]> = [
+ ["project", "Project"],
+ ["projectFiles", "Project Files"],
+ ["openFiles", "Open Files"],
+ ["changedFiles", "All Changed Files"],
+ ["scratches", "Scratches and Consoles"],
+];
+
+/** Modes listing just some files (expanded as they appear). */
+export const isFilteredMode = (mode: ViewMode) => mode === "openFiles" || mode === "changedFiles";
+
export type Editing =
| { kind: "new"; parent: string; nodeKind: "file" | "dir"; pkg?: PackageKind }
| { kind: "rename"; key: string; path: string };
@@ -66,9 +88,15 @@ interface ProjectTreeState {
revealRequest: { path: string; focus: boolean; seq: number } | null;
/** Folder key highlighted as drop target. */
dropTarget: string | null;
+ mode: ViewMode;
+ /** Files open in editor tabs (Open Files mode). */
+ openFiles: readonly string[];
+ /** Files with VCS changes (All Changed Files mode). */
+ changedFiles: readonly string[];
}
const OPTIONS_KEY = "openidea.projectTree.options";
+const MODE_KEY = "openidea.projectTree.mode";
const expandedKey = (root: string) => `openidea.projectTree.expanded:${root}`;
const MAX_PERSISTED = 3000;
@@ -101,8 +129,16 @@ export const useProjectTree = create<ProjectTreeState>(() => ({
clipboard: null,
revealRequest: null,
dropTarget: null,
+ mode: readMode(),
+ openFiles: [],
+ changedFiles: [],
}));
+function readMode(): ViewMode {
+ const m = readJson<string>(MODE_KEY);
+ return VIEW_MODES.find(([id]) => id === m)?.[0] ?? "project";
+}
+
const get = () => useProjectTree.getState();
const set = (patch: Partial<ProjectTreeState>) => useProjectTree.setState(patch);
@@ -115,13 +151,19 @@ let memo: {
listings: ProjectTreeState["listings"];
options: ViewOptions;
editing: Editing | null;
+ mode: ViewMode;
+ files: readonly string[] | null;
extras: ReadonlyMap<string, ProjectViewRootContribution>;
model: TreeModel;
} | null = null;
const EMPTY_MODEL: TreeModel = { roots: [], children: new Map(), byKey: new Map(), keyOfPath: new Map() };
+const filesOf = (s: ProjectTreeState) =>
+ s.mode === "openFiles" ? s.openFiles : s.mode === "changedFiles" ? s.changedFiles : null;
+
export function selectModel(s: ProjectTreeState): TreeModel {
+ const files = filesOf(s);
if (
memo &&
memo.root === s.root &&
@@ -129,16 +171,30 @@ export function selectModel(s: ProjectTreeState): TreeModel {
memo.listings === s.listings &&
memo.options === s.options &&
memo.editing === s.editing &&
+ memo.mode === s.mode &&
+ memo.files === files &&
memo.extras === useProjectViewRoots.getState().roots
)
return memo.model;
const placeholder: Placeholder | null =
s.editing?.kind === "new" ? { parent: s.editing.parent, kind: s.editing.nodeKind } : null;
const extras = useProjectViewRoots.getState().roots;
- const model = s.root
- ? withExtraRoots(buildModel({ path: s.root, name: s.name }, s.listings, s.options, placeholder), projectViewRoots(extras), s.listings, s.options, placeholder)
- : EMPTY_MODEL;
- memo = { root: s.root, name: s.name, listings: s.listings, options: s.options, editing: s.editing, extras, model };
+ const contributed = projectViewRoots(extras);
+ const project = () => buildModel({ path: s.root!, name: s.name }, s.listings, s.options, placeholder);
+ let model = EMPTY_MODEL;
+ if (s.root) {
+ if (s.mode === "projectFiles") model = project();
+ else if (s.mode === "scratches")
+ model = withExtraRoots(EMPTY_MODEL, contributed.filter((r) => r.scope === "scratches"), s.listings, s.options, placeholder);
+ else if (files)
+ model = buildPathsModel([{ path: s.root, label: s.name, icon: "" }, ...extraFolders(contributed)], files, s.options.foldersFirst);
+ else model = withExtraRoots(project(), contributed, s.listings, s.options, placeholder);
+ const libraries = extraFolders(contributed).flatMap((r) =>
+ r.readOnly && r.path !== undefined && isSameOrInside(r.path, s.root!) ? [r.path] : [],
+ );
+ model = withReadOnlyFolders(model, libraries);
+ }
+ memo = { root: s.root, name: s.name, listings: s.listings, options: s.options, editing: s.editing, mode: s.mode, files, extras, model };
return model;
}
@@ -156,14 +212,13 @@ export function initProjectTree(root: string | null, name = "") {
generation++;
inflight.clear();
clearTimeout(persistTimer);
- const persisted = root ? (readJson<string[]>(expandedKey(root)) ?? []) : [];
- const expanded = new Set(persisted.filter((p) => root && isSameOrInside(p, root)));
- if (root) expanded.add(root);
+ modeExpanded.clear();
+ autoExpanded.clear();
set({
root,
name,
listings: new Map(),
- expanded,
+ expanded: initialExpanded(root, get().mode),
selected: new Set(),
lead: null,
editing: null,
@@ -173,14 +228,70 @@ export function initProjectTree(root: string | null, name = "") {
});
}
+/** Expansion of the modes not shown (each pane keeps its own, like IDEA's). */
+const modeExpanded = new Map<ViewMode, ReadonlySet<string>>();
+/** Folders of a filtered mode already expanded once (collapsing them sticks). */
+const autoExpanded = new Set<string>();
+
+/** "Project" restores the persisted expansion; other panes start with their roots open. */
+function initialExpanded(root: string | null, mode: ViewMode): Set<string> {
+ if (!root || isFilteredMode(mode)) return new Set();
+ if (mode === "scratches") return new Set(projectViewRoots(useProjectViewRoots.getState().roots).flatMap((r) => (r.scope === "scratches" && r.path ? [r.path] : [])));
+ const persisted = mode === "project" ? (readJson<string[]>(expandedKey(root)) ?? []) : [];
+ const expanded = new Set(persisted.filter((p) => isSameOrInside(p, root)));
+ expanded.add(root);
+ return expanded;
+}
+
function persistExpanded() {
+ if (get().mode !== "project") return;
clearTimeout(persistTimer);
persistTimer = setTimeout(() => {
- const { root, expanded } = get();
- if (root) writeJson(expandedKey(root), [...expanded].slice(0, MAX_PERSISTED));
+ const { root, expanded, mode } = get();
+ if (root && mode === "project") writeJson(expandedKey(root), [...expanded].slice(0, MAX_PERSISTED));
}, 300);
}
+/** Switches the pane ("Project ▾"), remembered across sessions. */
+export function setViewMode(mode: ViewMode) {
+ const s = get();
+ if (s.mode === mode) return;
+ modeExpanded.set(s.mode, s.expanded);
+ autoExpanded.clear();
+ writeJson(MODE_KEY, mode);
+ set({
+ mode,
+ expanded: modeExpanded.get(mode) ?? initialExpanded(s.root, mode),
+ selected: new Set(),
+ lead: null,
+ editing: null,
+ dropTarget: null,
+ });
+}
+
+/** Open Files / All Changed Files: expands folders the first time they appear. */
+export function autoExpand(model: TreeModel) {
+ const s = get();
+ if (!isFilteredMode(s.mode)) return;
+ let next: Set<string> | null = null;
+ for (const [key, node] of model.byKey) {
+ if (!node.dir || autoExpanded.has(key)) continue;
+ autoExpanded.add(key);
+ if (!s.expanded.has(key)) (next ??= new Set(s.expanded)).add(key);
+ }
+ if (next) set({ expanded: next });
+}
+
+export function setOpenFiles(paths: readonly string[]) {
+ const prev = get().openFiles;
+ if (prev.length !== paths.length || prev.some((p, i) => p !== paths[i])) set({ openFiles: [...paths] });
+}
+
+export function setChangedFiles(paths: readonly string[]) {
+ const prev = get().changedFiles;
+ if (prev.length !== paths.length || prev.some((p, i) => p !== paths[i])) set({ changedFiles: [...paths] });
+}
+
export function setExpanded(expanded: ReadonlySet<string>) {
set({ expanded });
persistExpanded();
@@ -209,7 +320,7 @@ function putListing(path: string, entries: readonly FileEntry[]) {
/** Loads (or reloads) one folder. Concurrent calls for the same folder share a request. */
export function loadDir(path: string, force = false): Promise<void> {
const { root, listings } = get();
- if (!root) return Promise.resolve();
+ if (!root || isGroupKey(path)) return Promise.resolve();
if (!force && listings.has(path)) return Promise.resolve();
const running = inflight.get(path);
if (running) return running;
@@ -232,7 +343,7 @@ export function loadDir(path: string, force = false): Promise<void> {
if (e instanceof IpcError && (e.kind === "notFound" || e.kind === "invalidInput")) {
const listings = new Map(s.listings);
dropListings(listings, [path]);
- const expanded = new Set([...s.expanded].filter((k) => !isSameOrInside(k, path) || k === s.root));
+ const expanded = new Set([...s.expanded].filter((k) => !isSameOrInside(pathOfKey(k), path) || k === s.root));
set({ listings, expanded });
if (path === s.root) set({ listings: new Map(listings).set(path, []) });
} else {
@@ -259,7 +370,7 @@ export async function applyFsChange(event: { created: string[]; modified: string
if (plan.drop.length) {
const listings = new Map(s.listings);
dropListings(listings, plan.drop);
- const gone = (k: string) => plan.drop.some((d) => isSameOrInside(k, d));
+ const gone = (k: string) => plan.drop.some((d) => isSameOrInside(pathOfKey(k), d));
const selected = [...s.selected].filter((k) => !gone(k));
set({
listings,
@@ -271,10 +382,11 @@ export async function applyFsChange(event: { created: string[]; modified: string
if (event.removed.length) {
const cur = get();
const removed = new Set(event.removed);
- if ([...cur.selected].some((k) => removed.has(k))) {
+ const isRemoved = (k: string) => removed.has(pathOfKey(k));
+ if ([...cur.selected].some(isRemoved)) {
set({
- selected: new Set([...cur.selected].filter((k) => !removed.has(k))),
- lead: cur.lead && removed.has(cur.lead) ? null : cur.lead,
+ selected: new Set([...cur.selected].filter((k) => !isRemoved(k))),
+ lead: cur.lead && isRemoved(cur.lead) ? null : cur.lead,
});
}
}
@@ -298,7 +410,11 @@ export function revealPath(path: string, focus = false) {
const project = get().root;
const root = project && isSameOrInside(path, project) ? project : project ? extraRootOf(path) : null;
if (!root) return false;
- const ancestors = ancestorsWithin(root, path);
+ // Library folders sit below group nodes (External Libraries › SDK), keyed in their own namespace.
+ const model = currentModel();
+ const rootKey = root === project ? root : (model.keyOfPath.get(root) ?? root);
+ const folders = ancestorsWithin(root, path);
+ const ancestors = [...groupAncestors(model, rootKey), ...folders.map((a) => keyLike(rootKey, a))];
const next = new Set(expanded);
let changed = false;
for (const a of ancestors)
@@ -308,26 +424,72 @@ export function revealPath(path: string, focus = false) {
}
if (changed) setExpanded(next);
set({ revealRequest: { path, focus, seq: ++revealSeq } });
- for (const a of ancestors) void loadDir(a);
+ for (const a of folders) void loadDir(a);
return true;
}
-/** The contributed root (scratches…) containing `path`, if any. */
+/** The contributed folder (scratches, a library root…) containing `path`, if any. */
export function extraRootOf(path: string): string | null {
- for (const r of useProjectViewRoots.getState().roots.values()) if (isSameOrInside(path, r.path)) return r.path;
+ for (const r of extraFolders(projectViewRoots(useProjectViewRoots.getState().roots)))
+ if (r.path !== undefined && isSameOrInside(path, r.path)) return r.path;
return null;
}
+/** Whether the current pane can show `path` (Select In switches to "Project" otherwise). */
+export function modeShows(path: string): boolean {
+ const { mode, root } = get();
+ if (!root) return false;
+ switch (mode) {
+ case "project":
+ return true;
+ case "projectFiles":
+ return isSameOrInside(path, root);
+ case "scratches":
+ return projectViewRoots(useProjectViewRoots.getState().roots).some(
+ (r) => r.scope === "scratches" && r.path !== undefined && isSameOrInside(path, r.path),
+ );
+ default:
+ return currentModel().keyOfPath.has(path);
+ }
+}
+
+/** Whether `path` lies in read-only library sources. */
+export function isReadOnlyPath(path: string): boolean {
+ if (isGroupKey(path) || isLibKey(path)) return true;
+ return extraFolders(projectViewRoots(useProjectViewRoots.getState().roots)).some(
+ (r) => r.readOnly && r.path !== undefined && isSameOrInside(path, r.path),
+ );
+}
+
+/** Group node keys above the node `key`, outermost first. */
+function groupAncestors(model: TreeModel, key: string): string[] {
+ const out: string[] = [];
+ for (let child = key; ; ) {
+ let parent: string | null = null;
+ for (const [k, kids] of model.children)
+ if (k.startsWith(GROUP_PREFIX) && kids.some((n) => n.key === child)) {
+ parent = k;
+ break;
+ }
+ if (!parent) return out;
+ out.unshift(parent);
+ child = parent;
+ }
+}
+
export function clearRevealRequest(seq: number) {
if (get().revealRequest?.seq === seq) set({ revealRequest: null });
}
-/** Expands every folder below `from` (skipping excluded ones), loading as needed; capped. */
+/** Expands every folder below the node keyed `from` (skipping excluded ones), loading as needed; capped. */
export async function expandAll(from?: string, limit = 400) {
- const { root } = get();
+ const { root, mode } = get();
if (!root) return;
- const start = from ?? root;
- const queue = [start];
+ const model = currentModel();
+ // Filtered panes hold every folder already.
+ if (isFilteredMode(mode))
+ return setExpanded(new Set([...model.byKey.values()].filter((n) => n.dir).map((n) => n.key)));
+ const queue = [from ?? model.roots[0]?.key ?? root];
const toExpand = new Set(get().expanded);
let count = 0;
const gen = generation;
@@ -335,18 +497,23 @@ export async function expandAll(from?: string, limit = 400) {
const dir = queue.shift()!;
toExpand.add(dir);
count++;
- await loadDir(dir);
+ if (isGroupKey(dir)) {
+ for (const n of model.children.get(dir) ?? []) queue.push(n.key);
+ continue;
+ }
+ const path = pathOfKey(dir);
+ await loadDir(path);
if (gen !== generation) return;
const s = get();
- for (const e of visibleEntries(s.listings.get(dir) ?? [], s.options))
- if (isDirEntry(e) && !e.ignored && e.kind !== "symlink") queue.push(e.path);
+ for (const e of visibleEntries(s.listings.get(path) ?? [], s.options))
+ if (isDirEntry(e) && !e.ignored && e.kind !== "symlink") queue.push(keyLike(dir, e.path));
}
setExpanded(toExpand);
}
export function collapseAll() {
- const { root } = get();
- if (root) setExpanded(new Set([root]));
+ const { root, mode } = get();
+ if (root) setExpanded(new Set(mode === "project" || mode === "projectFiles" ? [root] : []));
}
// ---------------------------------------------------------------------------
diff --git a/src/features/project-tree/viewModes.test.ts b/src/features/project-tree/viewModes.test.ts
new file mode 100644
index 000000000..a0f040a77
--- /dev/null
+++ b/src/features/project-tree/viewModes.test.ts
@@ -0,0 +1,272 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { localChangedPaths, registerProjectViewRoot } from "@/workbench/contributions";
+
+vi.mock("@/workbench/messages", () => ({
+ confirm: async () => true,
+ confirmChecked: async () => ({ checked: false }),
+ ask: async () => ({ button: "cancel", checked: false }),
+}));
+
+const { MemoryFs, setProjectFsForTests } = await import("./fs");
+const { DEFAULT_TREE_OPTIONS, buildModel, buildPathsModel, libKey, pathOfKey, withExtraRoots } =
+ await import("./model");
+const store = await import("./store");
+const {
+ autoExpand,
+ currentModel,
+ initProjectTree,
+ isReadOnlyPath,
+ loadDir,
+ modeShows,
+ revealPath,
+ setOpenFiles,
+ setChangedFiles,
+ setViewMode,
+ useProjectTree,
+} = store;
+const { beginRename, deleteSelection } = await import("./operations");
+const { contextMenuItems } = await import("./contextMenu");
+
+const LIBS = {
+ id: "externalLibraries",
+ label: "External Libraries",
+ icon: "library",
+ order: 5,
+ readOnly: true,
+ children: [
+ {
+ label: "< Python 3.12 >",
+ icon: "file-python",
+ children: [
+ { label: "python3.12", icon: "folder-library", path: "/py/lib/python3.12", detail: "library root" },
+ { label: "site-packages", icon: "folder-library", path: "/p/.venv/lib/site-packages" },
+ ],
+ },
+ ],
+};
+
+/** Key of a library folder / file below the Python SDK group of `LIBS`. */
+const pyKey = (path: string) => libKey("externalLibraries/< Python 3.12 >", path);
+
+describe("withExtraRoots groups", () => {
+ it("nests group nodes and marks library folders read-only", () => {
+ const listings = new Map([
+ ["/p", []],
+ [
+ "/py/lib/python3.12",
+ [
+ {
+ name: "os.py",
+ path: "/py/lib/python3.12/os.py",
+ kind: "file" as const,
+ size: 1,
+ mtimeMs: 1,
+ ignored: false,
+ excluded: false,
+ hidden: false,
+ },
+ ],
+ ],
+ ]);
+ const base = buildModel({ path: "/p", name: "proj" }, listings, DEFAULT_TREE_OPTIONS);
+ const m = withExtraRoots(base, [LIBS], listings, DEFAULT_TREE_OPTIONS);
+ expect(m.roots.map((r) => [r.label, r.group ?? false])).toEqual([
+ ["proj", false],
+ ["External Libraries", true],
+ ]);
+ const group = m.children.get(m.roots[1]!.key)!;
+ expect(group.map((n) => n.label)).toEqual(["< Python 3.12 >"]);
+ // Library keys have their own namespace: site-packages inside the project is listed too.
+ const folders = m.children.get(group[0]!.key)!;
+ expect(folders.map((n) => [n.label, n.detail, n.readOnly, n.root, n.key, n.path])).toEqual([
+ ["python3.12", "library root", true, false, pyKey("/py/lib/python3.12"), "/py/lib/python3.12"],
+ ["site-packages", undefined, true, false, pyKey("/p/.venv/lib/site-packages"), "/p/.venv/lib/site-packages"],
+ ]);
+ const os = m.byKey.get(pyKey("/py/lib/python3.12/os.py"))!;
+ expect([os.readOnly, os.path, pathOfKey(os.key)]).toEqual([true, "/py/lib/python3.12/os.py", "/py/lib/python3.12/os.py"]);
+ expect(m.children.get(pyKey("/py/lib/python3.12"))![0]).toBe(os);
+ expect(m.keyOfPath.get("/py/lib/python3.12/os.py")).toBe(os.key);
+ });
+});
+
+describe("buildPathsModel", () => {
+ it("builds the folders down to each file below its innermost root", () => {
+ const m = buildPathsModel(
+ [
+ { path: "/p", label: "proj", icon: "" },
+ { path: "/data/scratches", label: "Scratches", icon: "scratches" },
+ ],
+ ["/p/src/b.ts", "/p/src/a/x.ts", "/p/README.md", "/data/scratches/s.py", "/tmp/out.log"],
+ );
+ expect(m.roots.map((r) => [r.label, r.root, r.icon])).toEqual([
+ ["proj", true, undefined],
+ ["Scratches", true, "scratches"],
+ ["/tmp", true, "folder"],
+ ]);
+ expect(m.children.get("/p")!.map((n) => n.label)).toEqual(["src", "README.md"]);
+ expect(m.children.get("/p/src")!.map((n) => n.label)).toEqual(["a", "b.ts"]);
+ expect(m.children.get("/p/src/a")!.map((n) => n.path)).toEqual(["/p/src/a/x.ts"]);
+ expect(m.keyOfPath.get("/data/scratches/s.py")).toBe("/data/scratches/s.py");
+ });
+
+ it("leaves out roots without files", () => {
+ expect(buildPathsModel([{ path: "/p", label: "proj", icon: "" }], []).roots).toEqual([]);
+ });
+});
+
+describe("localChangedPaths", () => {
+ it("lists change-list files, all lists or one, optionally without deleted ones", () => {
+ const lists = [
+ { id: "default", name: "Changes", active: true, files: [{ path: "/p/b.ts" }, { path: "/p/gone.ts", deleted: true }] },
+ { id: "ui", name: "UI", active: false, files: [{ path: "/p/a.ts" }] },
+ ];
+ expect(localChangedPaths(lists, null, true)).toEqual(["/p/a.ts", "/p/b.ts"]);
+ expect(localChangedPaths(lists)).toEqual(["/p/a.ts", "/p/b.ts", "/p/gone.ts"]);
+ expect(localChangedPaths(lists, "ui")).toEqual(["/p/a.ts"]);
+ expect(localChangedPaths([])).toEqual([]);
+ });
+});
+
+describe("project view modes", () => {
+ let disposers: Array<() => void> = [];
+ beforeEach(() => {
+ localStorage.clear();
+ const fs = new MemoryFs(
+ {
+ "/p/src/App.kt": "x",
+ "/p/README.md": "x",
+ "/data/scratches/s.py": "x",
+ "/py/lib/python3.12/os.py": "x",
+ "/p/.venv/pyvenv.cfg": "x",
+ "/p/.venv/lib/site-packages/req/api.py": "x",
+ },
+ "/p",
+ );
+ setProjectFsForTests(fs, "/p");
+ initProjectTree("/p", "proj");
+ disposers = [
+ registerProjectViewRoot({
+ id: "scratches",
+ label: "Scratches",
+ icon: "scratches",
+ path: "/data/scratches",
+ order: 10,
+ scope: "scratches",
+ }),
+ registerProjectViewRoot(LIBS),
+ ];
+ });
+ afterEach(() => {
+ setViewMode("project");
+ setOpenFiles([]);
+ setChangedFiles([]);
+ disposers.forEach((d) => d());
+ setProjectFsForTests(null);
+ initProjectTree(null);
+ });
+
+ const labels = () => currentModel().roots.map((r) => r.label);
+
+ it("switches panes and remembers the choice", () => {
+ expect(labels()).toEqual(["proj", "External Libraries", "Scratches"]);
+ setViewMode("projectFiles");
+ expect(labels()).toEqual(["proj"]);
+ setViewMode("scratches");
+ expect(labels()).toEqual(["Scratches"]);
+ expect(useProjectTree.getState().expanded.has("/data/scratches")).toBe(true);
+ expect(localStorage.getItem("openidea.projectTree.mode")).toBe(JSON.stringify("scratches"));
+ });
+
+ it("keeps each pane's expansion", () => {
+ store.setExpanded(new Set(["/p", "/p/src"]));
+ setViewMode("projectFiles");
+ expect(useProjectTree.getState().expanded).toEqual(new Set(["/p"]));
+ setViewMode("project");
+ expect(useProjectTree.getState().expanded).toEqual(new Set(["/p", "/p/src"]));
+ });
+
+ it("lists open and changed files, expanded once", () => {
+ setOpenFiles(["/p/src/App.kt", "/data/scratches/s.py"]);
+ setChangedFiles(["/p/README.md"]);
+ setViewMode("openFiles");
+ expect(labels()).toEqual(["proj", "Scratches"]);
+ autoExpand(currentModel());
+ expect([...useProjectTree.getState().expanded].sort()).toEqual(["/data/scratches", "/p", "/p/src"]);
+ // A collapsed folder stays collapsed.
+ store.setExpanded(new Set(["/p"]));
+ autoExpand(currentModel());
+ expect(useProjectTree.getState().expanded.has("/p/src")).toBe(false);
+ expect(modeShows("/p/src/App.kt")).toBe(true);
+ expect(modeShows("/p/README.md")).toBe(false);
+
+ setViewMode("changedFiles");
+ expect(
+ currentModel()
+ .children.get("/p")!
+ .map((n) => n.label),
+ ).toEqual(["README.md"]);
+ });
+
+ it("reveals library files through their group nodes", async () => {
+ await loadDir("/py/lib/python3.12");
+ expect(revealPath("/py/lib/python3.12/os.py")).toBe(true);
+ const expanded = useProjectTree.getState().expanded;
+ expect(expanded.has("\u0000group:externalLibraries")).toBe(true);
+ expect(expanded.has("\u0000group:externalLibraries/< Python 3.12 >")).toBe(true);
+ expect(expanded.has(pyKey("/py/lib/python3.12"))).toBe(true);
+ expect(useProjectTree.getState().revealRequest?.path).toBe("/py/lib/python3.12/os.py");
+ });
+
+ it("keeps library sources read-only", async () => {
+ await loadDir("/py/lib/python3.12");
+ const file = currentModel().byKey.get(pyKey("/py/lib/python3.12/os.py"))!;
+ expect(isReadOnlyPath(file.path)).toBe(true);
+ expect(isReadOnlyPath("/p/src")).toBe(false);
+ beginRename(file);
+ expect(useProjectTree.getState().editing).toBeNull();
+ await deleteSelection([file]);
+ await expect((await import("./fs")).projectFs("/p").readDir("/py/lib/python3.12")).resolves.toHaveLength(1);
+ const ids = contextMenuItems([file]).map((i) => ("id" in i ? i.id : i.kind));
+ expect(ids).not.toContain("delete");
+ expect(ids).not.toContain("new");
+ expect(ids).toContain("copyPath");
+ });
+
+ it("shows library folders inside the project in both places, read-only", async () => {
+ const site = "/p/.venv/lib/site-packages";
+ for (const dir of ["/p", "/p/.venv", "/p/.venv/lib", site, `${site}/req`]) await loadDir(dir);
+ const m = currentModel();
+ // Under the project: path keys, read-only from the library root down.
+ const venvKids = m.children.get("/p/.venv")!;
+ expect(venvKids.map((n) => [n.label, n.key, n.readOnly ?? false])).toEqual([
+ ["lib/site-packages/req", "/p/.venv/lib", true],
+ ["pyvenv.cfg", "/p/.venv/pyvenv.cfg", false],
+ ]);
+ expect(m.byKey.get("/p/.venv")?.readOnly).toBeUndefined();
+ const projectFile = m.byKey.get(`${site}/req/api.py`)!;
+ expect(projectFile.readOnly).toBe(true);
+ // Under External Libraries: the same folders in the library namespace.
+ const libFile = m.byKey.get(pyKey(`${site}/req/api.py`))!;
+ expect([libFile.path, libFile.readOnly]).toEqual([`${site}/req/api.py`, true]);
+ expect(m.children.get(pyKey(site))!.map((n) => n.key)).toEqual([pyKey(`${site}/req`)]);
+ // Paths resolve to the project node (Select In, autoscroll from source).
+ expect(m.keyOfPath.get(`${site}/req/api.py`)).toBe(`${site}/req/api.py`);
+ expect(isReadOnlyPath(site)).toBe(true);
+
+ beginRename(projectFile);
+ expect(useProjectTree.getState().editing).toBeNull();
+ await deleteSelection([projectFile, libFile]);
+ await expect((await import("./fs")).projectFs("/p").readDir(`${site}/req`)).resolves.toHaveLength(1);
+ const ids = contextMenuItems([projectFile]).map((i) => ("id" in i ? i.id : i.kind));
+ expect(ids).not.toContain("delete");
+ expect(ids).not.toContain("rename");
+ expect(contextMenuItems([m.byKey.get("/p/.venv/pyvenv.cfg")!]).map((i) => ("id" in i ? i.id : i.kind))).toContain("delete");
+ });
+
+ it("expands library folders in their own namespace", async () => {
+ await store.expandAll(pyKey("/p/.venv/lib/site-packages"));
+ const expanded = useProjectTree.getState().expanded;
+ expect(expanded.has(pyKey("/p/.venv/lib/site-packages/req"))).toBe(true);
+ expect(expanded.has("/p/.venv/lib/site-packages/req")).toBe(false);
+ });
+});
diff --git a/src/features/run-anything/RunAnything.module.css b/src/features/run-anything/RunAnything.module.css
new file mode 100644
index 000000000..426d29660
--- /dev/null
+++ b/src/features/run-anything/RunAnything.module.css
@@ -0,0 +1,98 @@
+.popup {
+ width: 620px;
+ max-width: calc(100vw - 32px);
+ overflow: hidden;
+}
+.body {
+ display: flex;
+ flex-direction: column;
+}
+.header {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ height: var(--h-row);
+ padding: 4px 10px 0;
+ font-size: var(--fs-small);
+ color: var(--fg-subtle);
+}
+.title {
+ flex: 1;
+ font-weight: 600;
+ color: var(--fg-strong);
+}
+.link {
+ padding: 0;
+ border: 0;
+ background: none;
+ color: var(--link);
+ font: inherit;
+ cursor: pointer;
+}
+.link:hover {
+ color: var(--link-hover);
+}
+.inputRow {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ padding: 6px 10px;
+ border-bottom: 1px solid var(--border-popup);
+}
+.inputIcon {
+ flex: none;
+ color: var(--fg-subtle);
+}
+.input {
+ flex: 1;
+ font-family: var(--font-mono);
+}
+.rows {
+ max-height: 360px;
+ height: auto;
+}
+.section {
+ padding: 4px 10px 0;
+ font-size: var(--fs-small);
+ color: var(--fg-subtle);
+}
+.row {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-width: 0;
+ flex: 1;
+}
+.rowIcon {
+ flex: none;
+ color: var(--fg-muted);
+}
+.label {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: pre;
+ font-family: var(--font-mono);
+ font-size: var(--fs-code);
+ color: var(--fg-emphasis);
+}
+.activeRow .label {
+ color: var(--fg-strong);
+}
+.detail {
+ margin-left: auto;
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+ white-space: nowrap;
+}
+.empty {
+ padding: 6px 10px;
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+}
+.footer {
+ padding: 6px 10px;
+ border-top: 1px solid var(--border-popup);
+ font-size: var(--fs-small);
+ color: var(--fg-subtle);
+}
diff --git a/src/features/run-anything/RunAnything.tsx b/src/features/run-anything/RunAnything.tsx
new file mode 100644
index 000000000..aeec1dae7
--- /dev/null
+++ b/src/features/run-anything/RunAnything.tsx
@@ -0,0 +1,176 @@
+/**
+ * The Run Anything popup: a command line with the recent commands and the
+ * providers' entries (run configurations, `mvn` / `gradle` goals…). Enter runs
+ * the selected entry, or the line itself: a provider that claims it, else the
+ * shell in the project directory, its output in the Run tool window.
+ */
+import { useMemo, useState, type KeyboardEvent } from "react";
+import clsx from "clsx";
+import { create } from "zustand";
+import { executeAction } from "@/platform/actions";
+import { usePlatform } from "@/platform/platformInfo";
+import { useProject } from "@/platform/project";
+import { Icon, Input, List, Popup, T, listNavigate } from "@/ui";
+import { runAnythingProviderList } from "@/workbench/contributions";
+import { buildRows, clearHistory, pushHistory, readHistory, shellRunConfig, type Row } from "./model";
+import styles from "./RunAnything.module.css";
+
+export const useRunAnything = create<{ open: boolean }>(() => ({ open: false }));
+
+export const showRunAnything = () => useRunAnything.setState({ open: true });
+const close = () => useRunAnything.setState({ open: false });
+
+/** Runs a command line: a provider that claims it, else the platform shell. */
+export async function runCommandLine(line: string): Promise<void> {
+ const text = line.trim();
+ const root = useProject.getState().project?.root;
+ if (!text || !root) return;
+ pushHistory(root, text);
+ for (const p of runAnythingProviderList()) {
+ try {
+ if (p.execute && (await p.execute(text))) return;
+ } catch (e) {
+ console.error(`run anything provider ${p.id} failed`, e);
+ }
+ }
+ await executeAction("run.runConfig", shellRunConfig(text, root, usePlatform.getState().os === "windows"));
+}
+
+export function RunAnythingHost() {
+ const open = useRunAnything((s) => s.open);
+ const root = useProject((s) => s.project?.root);
+ if (!open || !root) return null;
+ return <RunAnythingPopup root={root} />;
+}
+
+const isSection = (r: Row) => r.kind === "section";
+
+function RunAnythingPopup({ root }: { root: string }) {
+ const [line, setLine] = useState("");
+ const [active, setActive] = useState(-1);
+ const [history, setHistory] = useState(() => readHistory(root));
+ const rows = useMemo(
+ () =>
+ buildRows(line.trim(), history, runAnythingProviderList(), (h) => {
+ close();
+ void runCommandLine(h);
+ }),
+ [line, history],
+ );
+
+ const run = (row: Row | undefined) => {
+ if (!row || row.kind !== "item") return;
+ close();
+ if (row.group !== "recent") pushHistory(root, row.item.completion ?? row.item.label);
+ void row.item.run();
+ };
+ const runLine = () => {
+ if (!line.trim()) return;
+ close();
+ void runCommandLine(line);
+ };
+ const complete = (row: Row | undefined) => {
+ if (!row || row.kind !== "item") return;
+ setLine(row.item.completion ?? row.item.label);
+ setActive(-1);
+ };
+
+ const onKeyDown = (e: KeyboardEvent) => {
+ if (["ArrowDown", "ArrowUp", "PageDown", "PageUp"].includes(e.key)) {
+ const next = listNavigate(e.key, { items: rows, active: Math.max(active, 0), wrap: true, isSection });
+ if (next !== null) {
+ e.preventDefault();
+ setActive(active < 0 && e.key === "ArrowDown" ? rows.findIndex((r) => !isSection(r)) : next);
+ }
+ return;
+ }
+ if (e.key === "Tab") {
+ e.preventDefault();
+ complete(rows[active >= 0 ? active : rows.findIndex((r) => !isSection(r))]);
+ } else if (e.key === "Enter") {
+ e.preventDefault();
+ if (active >= 0) run(rows[active]);
+ else runLine();
+ }
+ };
+
+ return (
+ <Popup
+ open
+ anchor={{ x: window.innerWidth / 2, y: 72 }}
+ placement="bottom"
+ onClose={close}
+ role="dialog"
+ aria-label="Run Anything"
+ className={styles.popup}
+ trapFocus
+ >
+ <div className={styles.body}>
+ <div className={styles.header}>
+ <span className={styles.title}>
+ <T>Run Anything</T>
+ </span>
+ {history.length > 0 && (
+ <button
+ type="button"
+ className={styles.link}
+ onClick={() => {
+ clearHistory(root);
+ setHistory([]);
+ }}
+ >
+ <T>Clear History</T>
+ </button>
+ )}
+ </div>
+ <div className={styles.inputRow}>
+ <Icon name="run-anything" size={16} className={styles.inputIcon} />
+ <Input
+ data-autofocus
+ variant="bare"
+ className={styles.input}
+ value={line}
+ placeholder="Run a command, configuration or goal"
+ aria-label="Command line"
+ onChange={(e) => {
+ setLine(e.target.value);
+ setActive(-1);
+ }}
+ onKeyDown={onKeyDown}
+ />
+ </div>
+ <List
+ items={rows}
+ getKey={(r) => r.key}
+ isSection={isSection}
+ renderSection={(r) => <div className={styles.section}>{r.kind === "section" && <T>{r.label}</T>}</div>}
+ activeIndex={active}
+ onActiveChange={setActive}
+ onActivate={(r) => run(r)}
+ focusable={false}
+ hoverSelects={false}
+ rowHeight={24}
+ className={styles.rows}
+ aria-label="Run Anything entries"
+ empty={
+ <div className={styles.empty}>
+ {line.trim() ? <T>Press Enter to run the command in the project directory</T> : <T>Type a command</T>}
+ </div>
+ }
+ renderItem={(r, state) =>
+ r.kind === "item" ? (
+ <div className={clsx(styles.row, state.active && styles.activeRow)}>
+ <Icon name={r.item.icon ?? "run"} size={16} className={styles.rowIcon} />
+ <span className={styles.label}>{r.item.label}</span>
+ {r.item.detail && <span className={styles.detail}>{r.item.detail}</span>}
+ </div>
+ ) : null
+ }
+ />
+ <div className={styles.footer}>
+ <T>Enter to run, Tab to complete. Other commands run in the project directory.</T>
+ </div>
+ </div>
+ </Popup>
+ );
+}
diff --git a/src/features/run-anything/index.ts b/src/features/run-anything/index.ts
new file mode 100644
index 000000000..9459213b4
--- /dev/null
+++ b/src/features/run-anything/index.ts
@@ -0,0 +1,26 @@
+/**
+ * Run Anything (⌃⌃, IDEA's RunAnything): one popup to run a shell command in
+ * the project directory, a run configuration or a build tool goal. Features
+ * add entries with `registerRunAnythingProvider`.
+ */
+import { registerActions } from "@/platform/actions";
+import { registerOverlay } from "@/workbench/contributions";
+import { RunAnythingHost, showRunAnything } from "./RunAnything";
+
+export function activate(): () => void {
+ const disposers = [
+ registerOverlay({ id: "runAnything.popup", component: RunAnythingHost }),
+ registerActions([
+ {
+ id: "runAnything.show",
+ title: "Run Anything…",
+ category: "Run",
+ icon: "run-anything",
+ keywords: ["command", "shell", "execute", "npm", "mvn", "gradle"],
+ when: "projectOpen",
+ run: showRunAnything,
+ },
+ ]),
+ ];
+ return () => disposers.reverse().forEach((d) => d());
+}
diff --git a/src/features/run-anything/model.test.ts b/src/features/run-anything/model.test.ts
new file mode 100644
index 000000000..d6ed5ab45
--- /dev/null
+++ b/src/features/run-anything/model.test.ts
@@ -0,0 +1,63 @@
+import { beforeEach, describe, expect, it } from "vitest";
+import type { RunAnythingProvider } from "@/workbench/contributions";
+import { buildRows, clearHistory, MAX_HISTORY, matches, pushHistory, readHistory, shellCommand, shellRunConfig } from "./model";
+
+beforeEach(() => localStorage.clear());
+
+describe("run anything", () => {
+ it("keeps a per-project history, newest first and without duplicates", () => {
+ pushHistory("/a", "ls");
+ pushHistory("/a", "make test");
+ pushHistory("/a", " ls ");
+ pushHistory("/b", "npm run dev");
+ expect(readHistory("/a")).toEqual(["ls", "make test"]);
+ expect(readHistory("/b")).toEqual(["npm run dev"]);
+ for (let i = 0; i < MAX_HISTORY + 5; i++) pushHistory("/a", `cmd ${i}`);
+ expect(readHistory("/a")).toHaveLength(MAX_HISTORY);
+ clearHistory("/a");
+ expect(readHistory("/a")).toEqual([]);
+ });
+
+ it("matches every word of the query", () => {
+ expect(matches("mvn clean install", "inst mvn")).toBe(true);
+ expect(matches("mvn clean install", "gradle")).toBe(false);
+ expect(matches("anything", "")).toBe(true);
+ });
+
+ it("lists recent commands, then each provider's group; a failing provider is skipped", () => {
+ const ran: string[] = [];
+ const providers: RunAnythingProvider[] = [
+ {
+ id: "npm",
+ group: "npm scripts",
+ items: (q) => [{ key: "dev", label: "npm run dev", icon: "run", run: () => {} }].filter((i) => matches(i.label, q)),
+ },
+ {
+ id: "broken",
+ group: "Broken",
+ items: () => {
+ throw new Error("nope");
+ },
+ },
+ ];
+ const rows = buildRows("run", ["npm run dev", "ls"], providers, (l) => ran.push(l));
+ expect(rows.map((r) => (r.kind === "section" ? `# ${r.label}` : r.item.label))).toEqual([
+ "# Recent",
+ "npm run dev",
+ "# npm scripts",
+ "npm run dev",
+ ]);
+ const recent = rows[1]!;
+ if (recent.kind === "item") recent.item.run();
+ expect(ran).toEqual(["npm run dev"]);
+ });
+
+ it("runs a plain line through the platform shell in the project directory", () => {
+ expect(shellCommand("echo hi", false)).toEqual({ command: "/bin/sh", args: ["-c", "echo hi"] });
+ expect(shellCommand("dir", true)).toEqual({ command: "cmd.exe", args: ["/d", "/s", "/c", "dir"] });
+ const cfg = shellRunConfig("x".repeat(80), "/work", false);
+ expect(cfg.kind).toBe("external");
+ expect(cfg.cwd).toBe("/work");
+ expect(cfg.name).toHaveLength(58);
+ });
+});
diff --git a/src/features/run-anything/model.ts b/src/features/run-anything/model.ts
new file mode 100644
index 000000000..6a5f5389e
--- /dev/null
+++ b/src/features/run-anything/model.ts
@@ -0,0 +1,109 @@
+/**
+ * Run Anything (⌃⌃): command-line history, the rows offered for the typed
+ * text (recent commands, then each provider's group) and the shell command
+ * a plain line runs as.
+ */
+import type { RunConfig } from "@/platform/ipc";
+import type { RunAnythingItem, RunAnythingProvider } from "@/workbench/contributions";
+
+const HISTORY_PREFIX = "openidea.runAnything.history.v1:";
+export const MAX_HISTORY = 30;
+/** Rows per provider group. */
+const GROUP_LIMIT = 8;
+
+export function readHistory(scope: string): string[] {
+ try {
+ const v: unknown = JSON.parse(localStorage.getItem(HISTORY_PREFIX + scope) ?? "[]");
+ return Array.isArray(v) ? v.filter((x): x is string => typeof x === "string" && !!x.trim()).slice(0, MAX_HISTORY) : [];
+ } catch {
+ return [];
+ }
+}
+
+/** Puts `line` first (once) in the history of `scope`. */
+export function pushHistory(scope: string, line: string): string[] {
+ const text = line.trim();
+ if (!text) return readHistory(scope);
+ const next = [text, ...readHistory(scope).filter((h) => h !== text)].slice(0, MAX_HISTORY);
+ try {
+ localStorage.setItem(HISTORY_PREFIX + scope, JSON.stringify(next));
+ } catch {
+ /* storage unavailable */
+ }
+ return next;
+}
+
+export function clearHistory(scope: string) {
+ try {
+ localStorage.removeItem(HISTORY_PREFIX + scope);
+ } catch {
+ /* storage unavailable */
+ }
+}
+
+export type Row = { kind: "section"; key: string; label: string } | { kind: "item"; key: string; item: RunAnythingItem; group: string };
+
+/** Case-insensitive: every word of `query` occurs in `text`. */
+export function matches(text: string, query: string): boolean {
+ const t = text.toLowerCase();
+ return query
+ .toLowerCase()
+ .split(/\s+/)
+ .filter(Boolean)
+ .every((w) => t.includes(w));
+}
+
+/** Rows for `query`: matching recent commands, then each provider's items under its group. */
+export function buildRows(
+ query: string,
+ history: readonly string[],
+ providers: readonly RunAnythingProvider[],
+ runLine: (line: string) => void,
+): Row[] {
+ const rows: Row[] = [];
+ const section = (key: string, label: string, items: RunAnythingItem[]) => {
+ if (!items.length) return;
+ rows.push({ kind: "section", key: `s:${key}`, label });
+ for (const item of items) rows.push({ kind: "item", key: `${key}:${item.key}`, item, group: key });
+ };
+ section(
+ "recent",
+ "Recent",
+ history
+ .filter((h) => matches(h, query))
+ .slice(0, GROUP_LIMIT)
+ .map((h) => ({ key: h, label: h, icon: "history", completion: h, run: () => runLine(h) })),
+ );
+ for (const p of providers) {
+ let items: RunAnythingItem[] = [];
+ try {
+ items = p.items(query).slice(0, GROUP_LIMIT);
+ } catch (e) {
+ console.error(`run anything provider ${p.id} failed`, e);
+ }
+ section(p.id, p.group, items);
+ }
+ return rows;
+}
+
+/** The program and arguments that run `line` through the platform shell. */
+export function shellCommand(line: string, windows: boolean): { command: string; args: string[] } {
+ return windows ? { command: "cmd.exe", args: ["/d", "/s", "/c", line] } : { command: "/bin/sh", args: ["-c", line] };
+}
+
+/** A temporary run configuration for a shell command line (shown in the Run tool window). */
+export function shellRunConfig(line: string, cwd: string, windows: boolean): RunConfig {
+ const { command, args } = shellCommand(line, windows);
+ return {
+ id: `runAnything:${line}`,
+ name: line.length > 60 ? `${line.slice(0, 57)}…` : line,
+ kind: "external",
+ command,
+ args,
+ cwd,
+ env: {},
+ detected: false,
+ isTest: false,
+ debugAdapter: null,
+ };
+}
diff --git a/src/features/run/AddConfigPopup.tsx b/src/features/run/AddConfigPopup.tsx
new file mode 100644
index 000000000..d26da2316
--- /dev/null
+++ b/src/features/run/AddConfigPopup.tsx
@@ -0,0 +1,151 @@
+import { useMemo, useState, type KeyboardEvent } from "react";
+import clsx from "clsx";
+import { HighlightedText, Icon, List, Popup, SearchField, fuzzyMatch, listNavigate, T, type PopupAnchor } from "@/ui";
+import { useRunConfigTypes, runConfigTypes, type RunConfigTypeContribution } from "@/workbench/contributions";
+import styles from "./Run.module.css";
+
+export type TypeRow =
+ | { kind: "group"; key: string; label: string }
+ | { kind: "type"; key: string; type: RunConfigTypeContribution; indices: number[] | null; nested: boolean };
+
+const ROW = 24;
+
+/** "Add New Configuration" rows: types by label, grouped ones under their group; filtered by `query`. */
+export function typeRows(types: readonly RunConfigTypeContribution[], query: string): TypeRow[] {
+ const q = query.trim();
+ const match = (t: RunConfigTypeContribution) =>
+ q ? (fuzzyMatch(t.label, q) ?? (t.group && fuzzyMatch(t.group, q) ? [] : null)) : null;
+ const rows: TypeRow[] = [];
+ const groups = new Map<string, RunConfigTypeContribution[]>();
+ const entries: Array<{ label: string; group?: string; type?: RunConfigTypeContribution }> = [];
+ for (const t of types) {
+ if (!t.group) {
+ entries.push({ label: t.label, type: t });
+ continue;
+ }
+ let g = groups.get(t.group);
+ if (!g) {
+ groups.set(t.group, (g = []));
+ entries.push({ label: t.group, group: t.group });
+ }
+ g.push(t);
+ }
+ entries.sort((a, b) => a.label.localeCompare(b.label));
+ for (const e of entries) {
+ if (e.type) {
+ const indices = match(e.type);
+ if (!q || indices) rows.push({ kind: "type", key: e.type.id, type: e.type, indices, nested: false });
+ continue;
+ }
+ const members = groups
+ .get(e.group!)!
+ .map((t) => ({ t, indices: match(t) }))
+ .filter((x) => !q || x.indices);
+ if (!members.length) continue;
+ rows.push({ kind: "group", key: `group:${e.group}`, label: e.group! });
+ for (const { t, indices } of members) rows.push({ kind: "type", key: t.id, type: t, indices, nested: true });
+ }
+ return rows;
+}
+
+/** IDEA's "Add New Configuration" popup: a searchable list of configuration types. */
+export function AddConfigPopup({
+ anchor,
+ onPick,
+ onClose,
+}: {
+ anchor: PopupAnchor;
+ onPick: (type: RunConfigTypeContribution) => void;
+ onClose: () => void;
+}) {
+ const types = useRunConfigTypes((s) => s.types);
+ const [query, setQuery] = useState("");
+ const rows = useMemo(() => typeRows(runConfigTypes(types), query), [types, query]);
+ const isSection = (r: TypeRow) => r.kind === "group";
+ const first = Math.max(
+ 0,
+ rows.findIndex((r) => r.kind === "type"),
+ );
+ const [active, setActive] = useState(first);
+ const clamped = Math.min(active, rows.length - 1);
+
+ const pick = (row: TypeRow | undefined) => {
+ if (row?.kind !== "type") return;
+ onClose();
+ onPick(row.type);
+ };
+
+ const onKeyDown = (e: KeyboardEvent) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ pick(rows[clamped]);
+ return;
+ }
+ const next = listNavigate(e.key, { items: rows, active: clamped, isSection, wrap: true });
+ if (next !== null) {
+ e.preventDefault();
+ setActive(next);
+ }
+ };
+
+ return (
+ <Popup
+ open
+ anchor={anchor}
+ onClose={onClose}
+ placement="bottom-start"
+ aria-label="Add New Configuration"
+ className={styles.chooser}
+ trapFocus
+ >
+ <div className={styles.chooserCaption}>
+ <T>Add New Configuration</T>
+ </div>
+ <div className={styles.chooserSearch}>
+ <SearchField
+ value={query}
+ onChange={(v) => {
+ setQuery(v);
+ setActive(0);
+ }}
+ placeholder="Search types"
+ aria-label="Search configuration types"
+ data-autofocus=""
+ onKeyDown={onKeyDown}
+ variant="bare"
+ />
+ </div>
+ <div style={{ height: Math.max(ROW, Math.min(rows.length * ROW, 14 * ROW)) }}>
+ <List<TypeRow>
+ aria-label="Configuration types"
+ className={styles.chooserList}
+ items={rows}
+ getKey={(r) => r.key}
+ isSection={isSection}
+ renderSection={(r) => (r.kind === "group" ? r.label : null)}
+ activeIndex={rows[clamped]?.kind === "type" ? clamped : first}
+ onActiveChange={setActive}
+ focusable={false}
+ hoverSelects
+ rowHeight={ROW}
+ onActivate={(r) => pick(r)}
+ empty={
+ <span className={styles.chooserMuted}>
+ <T>Nothing found</T>
+ </span>
+ }
+ renderItem={(r) =>
+ r.kind === "type" ? (
+ <span className={clsx(styles.chooserRow, r.nested && styles.typeNested)} title={r.type.description}>
+ <Icon name={r.type.icon} size={13} className={styles.chooserIcon} />
+ <span className={styles.chooserName}>
+ {r.indices?.length ? <HighlightedText text={r.type.label} indices={r.indices} /> : r.type.label}
+ </span>
+ </span>
+ ) : null
+ }
+ />
+ </div>
+ </Popup>
+ );
+}
diff --git a/src/features/run/ConfigChooser.tsx b/src/features/run/ConfigChooser.tsx
index 2e7c20660..ce074f0ab 100644
--- a/src/features/run/ConfigChooser.tsx
+++ b/src/features/run/ConfigChooser.tsx
@@ -5,16 +5,18 @@ import { shortcutLabel } from "@/platform/keymap";
import { HighlightedText, Icon, IconButton, List, Popup, SearchField, fuzzyMatch, listNavigate, T } from "@/ui";
import type { RunConfig } from "@/platform/ipc";
import { commandLine, configIcon, groupConfigs } from "./configs";
-import { canDeleteConfig, deleteConfig, saveTemporary, selectConfig, startRun, useRun } from "./store";
+import { canDeleteConfig, CURRENT_FILE, deleteConfig, saveTemporary, selectConfig, startRun, useRun } from "./store";
import styles from "./Run.module.css";
type Row =
| { type: "section"; key: string; label: string }
| { type: "config"; key: string; config: RunConfig; indices: number[] | null }
| { type: "edit"; key: string }
+ | { type: "current"; key: string; indices: number[] | null }
| { type: "save"; key: string; config: RunConfig };
const ROW = 24;
+const CURRENT_FILE_LABEL = "Current File";
export function buildRows(
configs: readonly RunConfig[],
@@ -25,6 +27,9 @@ export function buildRows(
const rows: Row[] = [];
// IDEA: "Save '<name>' Configuration" first while a temporary configuration is selected.
if (!query && selected && temporary.includes(selected.id)) rows.push({ type: "save", key: "save", config: selected });
+ // IDEA: the permanent "Current File" entry runs the active file's context.
+ const currentIndices = query ? fuzzyMatch(CURRENT_FILE_LABEL, query) : null;
+ if (!query || currentIndices) rows.push({ type: "current", key: "current", indices: currentIndices });
for (const group of groupConfigs(configs)) {
const matched = group.configs
.map((c) => ({ c, indices: query ? fuzzyMatch(c.name, query) : null }))
@@ -84,7 +89,9 @@ function ConfigChooser() {
const isSection = (r: Row) => r.type === "section";
const initial = Math.max(
0,
- rows.findIndex((r) => r.type === "config" && r.config.id === selectedId),
+ rows.findIndex(
+ (r) => (r.type === "config" && r.config.id === selectedId) || (r.type === "current" && selectedId === CURRENT_FILE),
+ ),
);
const [active, setActive] = useState(initial);
const [anchor] = useState(anchorElement);
@@ -124,6 +131,12 @@ function ConfigChooser() {
void saveTemporary(row.config.id);
return;
}
+ if (row.type === "current") {
+ selectConfig(CURRENT_FILE);
+ if (how === "run" || how === "debug")
+ void executeAction(how === "run" ? "run.runContext" : "run.debugContext").then(() => selectConfig(CURRENT_FILE));
+ return;
+ }
if (row.type !== "config") return;
selectConfig(row.config.id);
if (how === "edit") void executeAction("run.editConfigs", row.config.id);
@@ -225,6 +238,16 @@ function ConfigChooser() {
</span>
);
}
+ if (r.type === "current") {
+ return (
+ <span className={styles.chooserRow}>
+ <Icon name="file" size={13} className={styles.chooserIcon} />
+ <span className={clsx(styles.chooserName, selectedId === CURRENT_FILE && styles.chooserSelected)}>
+ {r.indices ? <HighlightedText text={CURRENT_FILE_LABEL} indices={r.indices} /> : <T>{CURRENT_FILE_LABEL}</T>}
+ </span>
+ </span>
+ );
+ }
if (r.type === "edit") {
return (
<span className={clsx(styles.chooserRow, styles.chooserEdit)}>
diff --git a/src/features/run/ConfigForm.tsx b/src/features/run/ConfigForm.tsx
new file mode 100644
index 000000000..e24b20666
--- /dev/null
+++ b/src/features/run/ConfigForm.tsx
@@ -0,0 +1,716 @@
+/**
+ * The right side of Run/Debug Configurations: the type's own fields, the
+ * common ones, the options added through "Modify options" (⌥M) and the
+ * Before launch list.
+ */
+import { useRef, useState, type ReactNode } from "react";
+import clsx from "clsx";
+import type { BeforeLaunchTask, RunConfig } from "@/platform/ipc";
+import { useWorkflowSettings } from "@/platform/workflowSettings";
+import { useTx, useTxTemplate } from "@/platform/i18n";
+import { Button, Checkbox, Icon, IconButton, Input, Menu, Select, T, type MenuItem, type SelectOption } from "@/ui";
+import { useContributions, type RunConfigTypeContribution } from "@/workbench/contributions";
+import { TASK_LABELS, taskLabel, type BeforeLaunchKind } from "./beforeLaunch";
+import {
+ commandLine,
+ compoundCycle,
+ configIcon,
+ formatArgs,
+ formatEnv,
+ kindLabel,
+ parseArgs,
+ parseEnv,
+ type ConfigErrors,
+} from "./configs";
+import { EnvDialog } from "./EnvDialog";
+import { COMPOUND, formParams, terminalApplies, withParams } from "./types";
+import styles from "./Run.module.css";
+
+/**
+ * Debug adapters with a real launch template (`debugger/launch.ts`, `debugger/java.ts`),
+ * verified against small programs. Others (netcoredbg, dart, php-debug, …) only got
+ * generic launch arguments and are left out until they have one; a configuration that
+ * already names one keeps it.
+ */
+const ADAPTERS: ReadonlyArray<{ id: string; label: string }> = [
+ { id: "java-debug", label: "java-debug (Java)" },
+ { id: "debugpy", label: "debugpy (Python)" },
+ { id: "js-debug", label: "js-debug (Node.js / TypeScript)" },
+ { id: "delve", label: "Delve (Go)" },
+ { id: "codelldb", label: "CodeLLDB (Rust, C, C++)" },
+ { id: "lldb-dap", label: "lldb-dap (C, C++, Swift)" },
+];
+
+/** Options "Modify options" adds to the form: value fields (shown once added) and flags (chips). */
+export type OptionId =
+ | "allowParallel"
+ | "stdinFile"
+ | "envFiles"
+ | "outputFile"
+ | "showOnStdout"
+ | "showOnStderr"
+ | "beforeLaunch"
+ | "openToolWindow"
+ | "focusToolWindow"
+ | "isTest"
+ | "emulateTerminal";
+
+const VALUE_OPTIONS: ReadonlySet<OptionId> = new Set(["stdinFile", "envFiles", "outputFile", "beforeLaunch"]);
+
+const OPTION_LABELS: Record<OptionId, string> = {
+ allowParallel: "Allow multiple instances",
+ stdinFile: "Redirect input",
+ envFiles: 'Paths to ".env" files',
+ outputFile: "Save console output to file",
+ showOnStdout: "Show console when a message is printed to stdout",
+ showOnStderr: "Show console when a message is printed to stderr",
+ beforeLaunch: "Add before launch task",
+ openToolWindow: "Open run/debug tool window when started",
+ focusToolWindow: "Focus run/debug tool window when started",
+ isTest: "Show results in the test runner",
+ emulateTerminal: "Emulate terminal in output console",
+};
+
+const OPTION_GROUPS: ReadonlyArray<{ label: string; options: OptionId[]; process: boolean }> = [
+ { label: "Operating System", options: ["allowParallel", "stdinFile", "envFiles", "emulateTerminal"], process: true },
+ { label: "Logs", options: ["outputFile", "showOnStdout", "showOnStderr"], process: true },
+ { label: "Test", options: ["isTest"], process: true },
+ { label: "Before Launch", options: ["beforeLaunch", "openToolWindow", "focusToolWindow"], process: false },
+];
+
+/** Whether the option currently has a (non-default) value. */
+export function optionSet(config: RunConfig, id: OptionId, openByDefault: boolean): boolean {
+ switch (id) {
+ case "allowParallel":
+ return !!config.allowParallel;
+ case "stdinFile":
+ return !!config.stdinFile;
+ case "envFiles":
+ return !!config.envFiles?.length;
+ case "outputFile":
+ return !!config.outputFile;
+ case "showOnStdout":
+ return !!config.showOnStdout;
+ case "showOnStderr":
+ return !!config.showOnStderr;
+ case "beforeLaunch":
+ return !!config.beforeLaunch?.length;
+ case "openToolWindow":
+ return config.openToolWindow ?? openByDefault;
+ case "focusToolWindow":
+ return !!config.focusToolWindow;
+ case "isTest":
+ return config.isTest;
+ case "emulateTerminal":
+ return !!config.emulateTerminal;
+ }
+}
+
+/** The patch that turns option `id` on or off. */
+export function optionPatch(id: OptionId, on: boolean): Partial<RunConfig> {
+ switch (id) {
+ case "allowParallel":
+ return { allowParallel: on };
+ case "stdinFile":
+ return { stdinFile: null };
+ case "envFiles":
+ return { envFiles: [] };
+ case "outputFile":
+ return { outputFile: null };
+ case "beforeLaunch":
+ return { beforeLaunch: [] };
+ case "showOnStdout":
+ return { showOnStdout: on };
+ case "showOnStderr":
+ return { showOnStderr: on };
+ case "openToolWindow":
+ return { openToolWindow: on };
+ case "focusToolWindow":
+ return { focusToolWindow: on };
+ case "isTest":
+ return on ? { isTest: true, emulateTerminal: false } : { isTest: false };
+ case "emulateTerminal":
+ return { emulateTerminal: on };
+ }
+}
+
+export interface ConfigFormProps {
+ config: RunConfig;
+ /** Every configuration of the dialog (compound members, before launch targets, name checks). */
+ all: readonly RunConfig[];
+ type: RunConfigTypeContribution | undefined;
+ errors: ConfigErrors;
+ /** Editing a configuration template (no name, storage or compound members). */
+ template?: boolean;
+ onChange: (next: RunConfig) => void;
+ /** Bumped by ⌥M to open the Modify options menu. */
+ modifyRequest: number;
+}
+
+export function ConfigForm({ config, all, type, errors, template, onChange, modifyRequest }: ConfigFormProps) {
+ const openByDefault = useWorkflowSettings((s) => s.run.showOnStart);
+ const externalTools = useWorkflowSettings((s) => s.externalTools);
+ const toolWindows = useContributions((s) => s.toolWindows);
+ const tx = useTx();
+ const txTemplate = useTxTemplate();
+ const [shown, setShown] = useState<ReadonlySet<OptionId>>(() => new Set());
+ const [argsText, setArgsText] = useState<string | null>(null);
+ const [envText, setEnvText] = useState<string | null>(null);
+ const [envFilesText, setEnvFilesText] = useState<string | null>(null);
+ const [envOpen, setEnvOpen] = useState(false);
+ const [modifyOpen, setModifyOpen] = useState(false);
+ const [lastRequest, setLastRequest] = useState(modifyRequest);
+ const [taskMenu, setTaskMenu] = useState(false);
+ const modifyRef = useRef<HTMLButtonElement>(null);
+ const taskRef = useRef<HTMLButtonElement>(null);
+
+ if (modifyRequest !== lastRequest) {
+ setLastRequest(modifyRequest);
+ setModifyOpen(true);
+ }
+
+ const compound = config.kind === COMPOUND;
+ const params = compound ? {} : formParams(config, type);
+ const update = (patch: Partial<RunConfig>) => onChange({ ...config, ...patch });
+ const setParam = (key: string, value: string) => {
+ const next = { ...(params ?? {}) };
+ if (value) next[key] = value;
+ else delete next[key];
+ onChange(withParams(config, next, type));
+ };
+ const isShown = (id: OptionId) => shown.has(id) || optionSet(config, id, openByDefault);
+
+ const toggleOption = (id: OptionId) => {
+ const on = !isShown(id);
+ if (VALUE_OPTIONS.has(id)) {
+ setShown((s) => {
+ const next = new Set(s);
+ if (on) next.add(id);
+ else next.delete(id);
+ return next;
+ });
+ if (!on) update(optionPatch(id, false));
+ return;
+ }
+ update(optionPatch(id, on));
+ };
+
+ const terminal = terminalApplies(config, type);
+ // A terminal has no separate input file: the two options exclude each other.
+ const blocked = (id: OptionId) =>
+ (id === "emulateTerminal" && isShown("stdinFile")) || (id === "stdinFile" && !!config.emulateTerminal);
+ const menuItems: MenuItem[] = OPTION_GROUPS.filter((g) => !compound || !g.process).flatMap((g): MenuItem[] => [
+ { kind: "header", label: g.label },
+ ...g.options
+ .filter(
+ (id) =>
+ (!compound || id === "beforeLaunch") && (id !== "emulateTerminal" || terminal || !!config.emulateTerminal),
+ )
+ .map((id): MenuItem => ({
+ label: OPTION_LABELS[id],
+ checked: isShown(id),
+ disabled: !isShown(id) && blocked(id),
+ run: () => toggleOption(id),
+ })),
+ ]);
+
+ const tasks = config.beforeLaunch ?? [];
+ const setTasks = (next: BeforeLaunchTask[]) => update({ beforeLaunch: next });
+ const addTask = (kind: BeforeLaunchKind, target = "") => setTasks([...tasks, { kind, target }]);
+ const runnable = all.filter((c) => c.id !== config.id && c.kind !== COMPOUND);
+ const taskItems: MenuItem[] = [
+ {
+ label: TASK_LABELS.run,
+ disabled: !runnable.length,
+ submenu: runnable.map((c) => ({
+ label: c.name,
+ verbatim: true,
+ icon: configIcon(c),
+ run: () => addTask("run", c.id),
+ })),
+ },
+ { label: TASK_LABELS.build, icon: "build-project", run: () => addTask("build") },
+ {
+ label: TASK_LABELS.tool,
+ disabled: !externalTools.length,
+ submenu: externalTools.map((t) => ({ label: t.name, verbatim: true, run: () => addTask("tool", t.id) })),
+ },
+ { label: TASK_LABELS.command, icon: "terminal", run: () => addTask("command") },
+ {
+ label: TASK_LABELS.toolWindow,
+ submenu: [...toolWindows.values()]
+ .sort((a, b) => a.title.localeCompare(b.title))
+ .map((w) => ({ label: w.title, icon: w.icon, run: () => addTask("toolWindow", w.id) })),
+ },
+ ];
+ const moveTask = (i: number, d: -1 | 1) => {
+ const j = i + d;
+ if (j < 0 || j >= tasks.length) return;
+ const next = [...tasks];
+ [next[i], next[j]] = [next[j]!, next[i]!];
+ setTasks(next);
+ };
+
+ const adapterOptions: SelectOption[] = [
+ { value: "", label: "None" },
+ ...ADAPTERS.map((a) => ({ value: a.id, label: a.label })),
+ ];
+ if (config.debugAdapter && !ADAPTERS.some((a) => a.id === config.debugAdapter))
+ adapterOptions.push({ value: config.debugAdapter, label: txTemplate(`${config.debugAdapter} (no launch template)`) });
+
+ const chips = (
+ [
+ "allowParallel",
+ "emulateTerminal",
+ "showOnStdout",
+ "showOnStderr",
+ "openToolWindow",
+ "focusToolWindow",
+ "isTest",
+ ] as const
+ ).filter(
+ (id) => (!compound || id === "openToolWindow" || id === "focusToolWindow") && optionSet(config, id, openByDefault),
+ );
+
+ return (
+ <>
+ {config.detected && !template && (
+ <div className={styles.notice}>
+ <T>Detected from the project. Changes are saved as a user configuration that overrides it.</T>
+ </div>
+ )}
+ {!template && (
+ <div className={styles.formHeader}>
+ <Field label="Name" error={errors.name}>
+ <Input
+ value={config.name}
+ invalid={!!errors.name}
+ aria-label="Name"
+ onChange={(e) => update({ name: e.target.value })}
+ />
+ </Field>
+ <Checkbox
+ checked={!config.local}
+ onChange={(shared) => update({ local: !shared })}
+ label="Store as project file"
+ aria-label="Store as project file (.openidea/run.toml); otherwise in the workspace (.openidea/run.local.toml)"
+ />
+ </div>
+ )}
+ <div className={styles.formSection}>
+ <span className={styles.formSectionTitle}>{tx(type?.label ?? kindLabel(config.kind))}</span>
+ <button
+ ref={modifyRef}
+ type="button"
+ className={styles.noticeLink}
+ aria-haspopup="menu"
+ aria-expanded={modifyOpen}
+ onClick={() => setModifyOpen((v) => !v)}
+ >
+ <T>Modify options</T> <Icon name="chevron-down" size={12} />
+ </button>
+ <span className={styles.chooserMuted}>⌥M</span>
+ <Menu
+ open={modifyOpen}
+ anchor={modifyRef}
+ items={menuItems}
+ placement="bottom-end"
+ onClose={() => setModifyOpen(false)}
+ />
+ </div>
+
+ {compound ? (
+ template ? null : (
+ <CompoundMembers
+ config={config}
+ all={all}
+ error={errors.compound}
+ onChange={(compound) => update({ compound })}
+ />
+ )
+ ) : params && type ? (
+ type.fields
+ .filter((f) => f.visible?.(params) ?? true)
+ .map((f) => (
+ <Field key={f.key} label={f.label} error={errors[f.key]} top={f.control === "textarea"}>
+ <TypeField
+ field={f}
+ value={params[f.key] ?? ""}
+ params={params}
+ all={all}
+ invalid={!!errors[f.key]}
+ onChange={(v) => setParam(f.key, v)}
+ />
+ </Field>
+ ))
+ ) : (
+ <>
+ {type && (
+ <div className={styles.notice}>
+ <T>This command line doesn't fit the type's form; it is edited as a command.</T>
+ </div>
+ )}
+ <Field label="Command" error={errors.command}>
+ <Input
+ mono
+ value={config.command}
+ invalid={!!errors.command}
+ aria-label="Command"
+ placeholder="e.g. ./gradlew or cargo"
+ onChange={(e) => update({ command: e.target.value, params: {} })}
+ />
+ </Field>
+ <Field label="Arguments">
+ <Input
+ mono
+ aria-label="Arguments"
+ value={argsText ?? formatArgs(config.args)}
+ placeholder="Space separated; quote with ' or &quot;"
+ onChange={(e) => {
+ setArgsText(e.target.value);
+ update({ args: parseArgs(e.target.value), params: {} });
+ }}
+ />
+ </Field>
+ </>
+ )}
+
+ {!compound && (
+ <>
+ {!type?.ownsWorkingDirectory && (
+ <Field label="Working directory" error={errors.cwd}>
+ <Input
+ mono
+ aria-label="Working directory"
+ value={config.cwd ?? ""}
+ placeholder="Project root"
+ onChange={(e) => update({ cwd: e.target.value.trim() ? e.target.value : null })}
+ />
+ </Field>
+ )}
+ <Field
+ label="Environment variables"
+ error={errors.env}
+ hint="Separate variables with semicolon: VAR=value; VAR1=value1"
+ >
+ <div className={styles.inputWithButton}>
+ <Input
+ mono
+ aria-label="Environment variables"
+ value={envText ?? formatEnv(config.env)}
+ invalid={!!errors.env}
+ onChange={(e) => {
+ setEnvText(e.target.value);
+ update({ env: Object.fromEntries(parseEnv(e.target.value).map((r) => [r.key, r.value])) });
+ }}
+ onBlur={() => setEnvText(null)}
+ />
+ <IconButton
+ icon="list"
+ size="small"
+ iconSize={14}
+ title="Edit Environment Variables"
+ onClick={() => setEnvOpen(true)}
+ />
+ </div>
+ {config.includeSystemEnv === false && (
+ <span className={styles.chooserMuted}>
+ <T>System environment variables are not passed</T>
+ </span>
+ )}
+ </Field>
+ {isShown("envFiles") && (
+ <Field label='Paths to ".env" files' hint="Relative to the project root; separate with semicolon">
+ <Input
+ mono
+ aria-label='Paths to ".env" files'
+ value={envFilesText ?? (config.envFiles ?? []).join(";")}
+ placeholder=".env"
+ onChange={(e) => {
+ setEnvFilesText(e.target.value);
+ update({
+ envFiles: e.target.value
+ .split(";")
+ .map((p) => p.trim())
+ .filter(Boolean),
+ });
+ }}
+ onBlur={() => setEnvFilesText(null)}
+ />
+ </Field>
+ )}
+ {isShown("stdinFile") && (
+ <Field label="Redirect input from">
+ <Input
+ mono
+ aria-label="Redirect input from"
+ value={config.stdinFile ?? ""}
+ placeholder="File relative to the project root"
+ onChange={(e) => update({ stdinFile: e.target.value || null })}
+ />
+ </Field>
+ )}
+ {isShown("outputFile") && (
+ <Field label="Save console output to file">
+ <Input
+ mono
+ aria-label="Save console output to file"
+ value={config.outputFile ?? ""}
+ placeholder="File relative to the project root"
+ onChange={(e) => update({ outputFile: e.target.value || null })}
+ />
+ </Field>
+ )}
+ <Field label="Debug adapter">
+ <Select
+ value={config.debugAdapter ?? ""}
+ options={adapterOptions}
+ onChange={(v) => update({ debugAdapter: v || null })}
+ aria-label="Debug adapter"
+ />
+ </Field>
+ </>
+ )}
+
+ {isShown("beforeLaunch") && (
+ <Field label="Before launch" error={errors.beforeLaunch} top>
+ <div className={styles.taskList} role="list" aria-label={tx("Before launch tasks")}>
+ {tasks.map((t, i) => (
+ <div key={i} role="listitem" className={styles.taskRow}>
+ {t.kind === "command" ? (
+ <Input
+ mono
+ aria-label={txTemplate(`Before launch command ${i + 1}`)}
+ value={t.target ?? ""}
+ placeholder="Shell command, e.g. make generate"
+ onChange={(e) => setTasks(tasks.map((x, j) => (j === i ? { ...x, target: e.target.value } : x)))}
+ />
+ ) : (
+ <span className={styles.taskLabel}>{txTemplate(taskLabel(t, all))}</span>
+ )}
+ <IconButton
+ icon="arrow-up"
+ size="small"
+ iconSize={12}
+ title="Move Up"
+ disabled={i === 0}
+ onClick={() => moveTask(i, -1)}
+ />
+ <IconButton
+ icon="arrow-down"
+ size="small"
+ iconSize={12}
+ title="Move Down"
+ disabled={i === tasks.length - 1}
+ onClick={() => moveTask(i, 1)}
+ />
+ <IconButton
+ icon="minus"
+ size="small"
+ iconSize={12}
+ title="Remove Task"
+ onClick={() => setTasks(tasks.filter((_, j) => j !== i))}
+ />
+ </div>
+ ))}
+ <Button
+ ref={taskRef}
+ size="small"
+ variant="ghost"
+ icon="plus"
+ aria-haspopup="menu"
+ onClick={() => setTaskMenu(true)}
+ >
+ <T>Add task</T>
+ </Button>
+ <Menu open={taskMenu} anchor={taskRef} items={taskItems} onClose={() => setTaskMenu(false)} />
+ </div>
+ </Field>
+ )}
+
+ {chips.length > 0 && (
+ <div className={styles.chips}>
+ {chips.map((id) => (
+ <span key={id} className={styles.chip}>
+ <T>{OPTION_LABELS[id]}</T>
+ <IconButton
+ icon="close"
+ size="small"
+ iconSize={10}
+ title={`Remove '${OPTION_LABELS[id]}'`}
+ onClick={() => update(optionPatch(id, false))}
+ />
+ </span>
+ ))}
+ </div>
+ )}
+
+ {!compound && !template && (
+ <div className={styles.editPreview}>
+ <span className={styles.chooserMuted}>
+ <T>Command line</T>
+ </span>
+ <code>{commandLine(config) || "—"}</code>
+ </div>
+ )}
+
+ {envOpen && (
+ <EnvDialog
+ env={config.env}
+ includeSystemEnv={config.includeSystemEnv !== false}
+ onClose={() => setEnvOpen(false)}
+ onOk={(env, includeSystemEnv) => {
+ setEnvText(null);
+ update({ env, includeSystemEnv });
+ }}
+ />
+ )}
+ </>
+ );
+}
+
+function TypeField({
+ field,
+ value,
+ params,
+ all,
+ invalid,
+ onChange,
+}: {
+ field: RunConfigTypeContribution["fields"][number];
+ value: string;
+ params: Readonly<Record<string, string>>;
+ all: readonly RunConfig[];
+ invalid: boolean;
+ onChange: (value: string) => void;
+}) {
+ const tx = useTx();
+ const listId = `run-field-${field.key}`;
+ if (field.control === "select") {
+ const options = [...(field.options ?? [])];
+ if (value && !options.some((o) => o.value === value)) options.push({ value, label: value });
+ return (
+ <Select
+ value={value || (options[0]?.value ?? "")}
+ options={options}
+ onChange={onChange}
+ aria-label={field.label}
+ />
+ );
+ }
+ if (field.control === "checkbox")
+ return <Checkbox checked={value === "true"} onChange={(on) => onChange(on ? "true" : "")} label={field.label} />;
+ if (field.control === "textarea")
+ return (
+ <textarea
+ className={clsx(styles.textarea, invalid && styles.textareaInvalid)}
+ aria-label={tx(field.label)}
+ spellCheck={false}
+ value={value}
+ placeholder={tx(field.placeholder)}
+ rows={4}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ );
+ const suggestions = field.suggestions?.(all, params) ?? [];
+ return (
+ <>
+ <Input
+ mono={field.mono}
+ aria-label={field.label}
+ value={value}
+ invalid={invalid}
+ placeholder={field.placeholder}
+ list={suggestions.length ? listId : undefined}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ {suggestions.length > 0 && (
+ <datalist id={listId}>
+ {suggestions.map((s) => (
+ <option key={s} value={s} />
+ ))}
+ </datalist>
+ )}
+ </>
+ );
+}
+
+function CompoundMembers({
+ config,
+ all,
+ error,
+ onChange,
+}: {
+ config: RunConfig;
+ all: readonly RunConfig[];
+ error?: string;
+ onChange: (ids: string[]) => void;
+}) {
+ const tx = useTx();
+ const members = config.compound ?? [];
+ const candidates = all.filter(
+ (c) =>
+ c.id !== config.id && !members.includes(c.id) && !compoundCycle({ ...config, compound: [...members, c.id] }, all),
+ );
+ return (
+ <Field label="Configurations" error={error} top>
+ <div className={styles.taskList} role="list" aria-label={tx("Configurations of the compound")}>
+ {members.map((id) => {
+ const c = all.find((x) => x.id === id);
+ return (
+ <div key={id} role="listitem" className={styles.taskRow}>
+ <Icon name={c ? configIcon(c) : "warning"} size={13} className={styles.chooserIcon} />
+ <span className={styles.taskLabel}>{c?.name ?? id}</span>
+ <IconButton
+ icon="minus"
+ size="small"
+ iconSize={12}
+ title="Remove"
+ onClick={() => onChange(members.filter((m) => m !== id))}
+ />
+ </div>
+ );
+ })}
+ <Select
+ value={null}
+ placeholder="Add configuration…"
+ options={candidates.map((c) => ({ value: c.id, label: c.name }))}
+ onChange={(id) => onChange([...members, id])}
+ disabled={!candidates.length}
+ aria-label="Add configuration"
+ />
+ </div>
+ </Field>
+ );
+}
+
+export function Field({
+ label,
+ error,
+ hint,
+ top,
+ children,
+}: {
+ label: string;
+ error?: string;
+ hint?: string;
+ top?: boolean;
+ children: ReactNode;
+}) {
+ const txTemplate = useTxTemplate();
+ return (
+ <div className={clsx(styles.field, top && styles.fieldTop)}>
+ <span className={styles.fieldLabel}>{txTemplate(label)}</span>
+ <div className={styles.fieldControl}>
+ {children}
+ {error ? (
+ <span className={styles.fieldError} role="alert">
+ {txTemplate(error)}
+ </span>
+ ) : (
+ hint && <span className={styles.chooserMuted}>{txTemplate(hint)}</span>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/src/features/run/EditConfigsDialog.tsx b/src/features/run/EditConfigsDialog.tsx
index 6b38d5621..331e84c1d 100644
--- a/src/features/run/EditConfigsDialog.tsx
+++ b/src/features/run/EditConfigsDialog.tsx
@@ -1,18 +1,23 @@
-import { useMemo, useState, type ReactNode } from "react";
+import { useEffect, useMemo, useRef, useState, type DragEvent, type KeyboardEvent } from "react";
import clsx from "clsx";
-import type { RunConfig } from "@/platform/ipc";
-import { Button, Checkbox, Dialog, Icon, IconButton, Input, Select, type SelectOption, T } from "@/ui";
-import { notifications } from "@/workbench/contributions";
+import { executeAction } from "@/platform/actions";
+import { call, commands, isTauri, type RunConfig } from "@/platform/ipc";
+import { Button, Dialog, Icon, IconButton, Input, T } from "@/ui";
+import {
+ notifications,
+ useRunConfigTypes,
+ runConfigTypes,
+ type RunConfigTypeContribution,
+} from "@/workbench/contributions";
+import { AddConfigPopup } from "./AddConfigPopup";
+import { ConfigForm, Field } from "./ConfigForm";
import {
- KIND_OPTIONS,
commandLine,
configIcon,
duplicateConfig,
- formatArgs,
groupConfigs,
hasErrors,
- newConfig,
- parseArgs,
+ kindLabel,
removeConfig,
upsertConfig,
userConfigs,
@@ -20,124 +25,247 @@ import {
type ConfigErrors,
} from "./configs";
import { saveUserConfigs, selectConfig, useRun } from "./store";
+import { blankTemplate, COMPOUND, missingParams, newConfigOfType, templateId, typeFor } from "./types";
import styles from "./Run.module.css";
-/**
- * Debug adapters with a real launch template (`debugger/launch.ts`, `debugger/java.ts`),
- * verified against small programs. Others (netcoredbg, dart, php-debug, …) only got
- * generic launch arguments and are left out until they have one; a configuration that
- * already names one keeps it.
- */
-const ADAPTERS: ReadonlyArray<{ id: string; label: string }> = [
- { id: "java-debug", label: "java-debug (Java)" },
- { id: "debugpy", label: "debugpy (Python)" },
- { id: "js-debug", label: "js-debug (Node.js / TypeScript)" },
- { id: "delve", label: "Delve (Go)" },
- { id: "codelldb", label: "CodeLLDB (Rust, C, C++)" },
- { id: "lldb-dap", label: "lldb-dap (C, C++, Swift)" },
-];
+export { envFromRows } from "./EnvDialog";
-interface EnvRow {
- key: string;
- value: string;
+export function EditConfigsOverlay() {
+ const open = useRun((s) => s.editorOpen);
+ if (!open) return null;
+ return <EditConfigsDialog />;
}
-const envRows = (env: RunConfig["env"]): EnvRow[] => Object.entries(env).map(([key, value]) => ({ key, value }));
+type Selection =
+ { type: "config"; id: string } | { type: "folder"; kind: string; name: string } | { type: "template"; kind: string };
-/** Env map from table rows; blank rows are ignored. */
-export function envFromRows(rows: readonly EnvRow[]): { env: RunConfig["env"]; error?: string } {
- const env: RunConfig["env"] = {};
- for (const r of rows) {
- const key = r.key.trim();
- if (!key && !r.value) continue;
- if (!key) return { env, error: "Environment variable names can't be empty" };
- if (key in env) return { env, error: `Duplicate environment variable: ${key}` };
- env[key] = r.value;
+export type TreeRow =
+ | { type: "group"; key: string; kind: string; label: string; icon: string }
+ | { type: "folder"; key: string; kind: string; name: string }
+ | { type: "config"; key: string; config: RunConfig; depth: 1 | 2 };
+
+/** Sidebar rows: type groups, their folders (first), then loose configurations; collapsed nodes hide their children. */
+export function treeRows(
+ configs: readonly RunConfig[],
+ extraFolders: ReadonlyArray<{ kind: string; name: string }> = [],
+ collapsed: ReadonlySet<string> = new Set(),
+): TreeRow[] {
+ const rows: TreeRow[] = [];
+ const groups = groupConfigs(configs);
+ for (const f of extraFolders)
+ if (!groups.some((g) => g.kind === f.kind)) groups.push({ kind: f.kind, label: kindLabel(f.kind), configs: [] });
+ for (const g of groups) {
+ const groupKey = `g:${g.kind}`;
+ rows.push({
+ type: "group",
+ key: groupKey,
+ kind: g.kind,
+ label: g.label,
+ icon: configIcon({ kind: g.kind, isTest: false }),
+ });
+ if (collapsed.has(groupKey)) continue;
+ const folders: string[] = [];
+ for (const c of g.configs) if (c.folder && !folders.includes(c.folder)) folders.push(c.folder);
+ for (const f of extraFolders) if (f.kind === g.kind && !folders.includes(f.name)) folders.push(f.name);
+ for (const name of folders) {
+ const folderKey = `f:${g.kind}:${name}`;
+ rows.push({ type: "folder", key: folderKey, kind: g.kind, name });
+ if (collapsed.has(folderKey)) continue;
+ for (const c of g.configs)
+ if (c.folder === name) rows.push({ type: "config", key: `c:${c.id}`, config: c, depth: 2 });
+ }
+ for (const c of g.configs) if (!c.folder) rows.push({ type: "config", key: `c:${c.id}`, config: c, depth: 1 });
}
- return { env };
+ return rows;
}
-export function EditConfigsOverlay() {
- const open = useRun((s) => s.editorOpen);
- if (!open) return null;
- return <EditConfigsDialog />;
+/** Moves `id` before / after its neighbour among the configurations of the same type and folder. */
+export function moveConfig(configs: readonly RunConfig[], id: string, delta: -1 | 1): RunConfig[] {
+ const current = configs.find((c) => c.id === id);
+ if (!current) return [...configs];
+ const siblings = configs.filter((c) => c.kind === current.kind && (c.folder ?? "") === (current.folder ?? ""));
+ const at = siblings.indexOf(current);
+ const other = siblings[at + delta];
+ if (!other) return [...configs];
+ const out = [...configs];
+ const i = out.indexOf(current);
+ const j = out.indexOf(other);
+ [out[i], out[j]] = [out[j]!, out[i]!];
+ return out;
+}
+
+function uniqueFolder(
+ kind: string,
+ configs: readonly RunConfig[],
+ extra: ReadonlyArray<{ kind: string; name: string }>,
+): string {
+ const taken = new Set([
+ ...configs.filter((c) => c.kind === kind).map((c) => c.folder),
+ ...extra.filter((f) => f.kind === kind).map((f) => f.name),
+ ]);
+ if (!taken.has("New Folder")) return "New Folder";
+ for (let i = 2; ; i++) if (!taken.has(`New Folder (${i})`)) return `New Folder (${i})`;
}
+const isMac = () => typeof navigator !== "undefined" && /mac/i.test(navigator.platform);
+
function EditConfigsDialog() {
const initialConfigs = useRun((s) => s.configs);
+ const temporary = useRun((s) => s.temporary);
const target = useRun((s) => s.editTarget ?? s.selectedId);
- const [draft, setDraft] = useState<RunConfig[]>(() => initialConfigs.map((c) => ({ ...c })));
- const [selected, setSelected] = useState<string | null>(() =>
- initialConfigs.some((c) => c.id === target) ? target : (initialConfigs[0]?.id ?? null),
- );
- const [argsText, setArgsText] = useState<Record<string, string>>({});
- const [envText, setEnvText] = useState<Record<string, EnvRow[]>>({});
+ const types = useRunConfigTypes((s) => s.types);
+ const [draft, setDraft] = useState<RunConfig[]>(() => initialConfigs.map((c) => structuredClone(c)));
+ const [selection, setSelection] = useState<Selection | null>(() => {
+ const id = initialConfigs.some((c) => c.id === target) ? target : initialConfigs[0]?.id;
+ return id ? { type: "config", id } : null;
+ });
+ const [mode, setMode] = useState<"configs" | "templates">("configs");
+ const [templates, setTemplates] = useState<RunConfig[] | null>(() => (isTauri() ? null : []));
+ const [templatesDirty, setTemplatesDirty] = useState(false);
+ const [extraFolders, setExtraFolders] = useState<Array<{ kind: string; name: string }>>([]);
+ const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(() => new Set());
// "Modify Run Configuration…": the would-be configuration is saved on OK even when unedited.
const [dirty, setDirty] = useState(() => useRun.getState().editDirty);
const [saving, setSaving] = useState(false);
+ const [adding, setAdding] = useState<{ x: number; y: number } | null>(null);
+ const [modifyRequest, setModifyRequest] = useState(0);
+ const addRef = useRef<HTMLButtonElement>(null);
+ const dragged = useRef<string | null>(null);
+
+ useEffect(() => {
+ if (!isTauri()) return;
+ let live = true;
+ call(commands.runTemplates())
+ .then((t) => live && setTemplates(t))
+ .catch(() => live && setTemplates([]));
+ return () => {
+ live = false;
+ };
+ }, []);
const close = () => useRun.setState({ editorOpen: false, editTarget: null });
- const current = draft.find((c) => c.id === selected) ?? null;
+ const current = selection?.type === "config" ? (draft.find((c) => c.id === selection.id) ?? null) : null;
+ const templateFor = (kind: string): RunConfig | null => {
+ const t = typeFor(kind);
+ return templates?.find((x) => x.kind === kind) ?? (t ? blankTemplate(t) : null);
+ };
+ const currentTemplate = selection?.type === "template" ? templateFor(selection.kind) : null;
const errorsById = useMemo(() => {
const out: Record<string, ConfigErrors> = {};
for (const c of draft) {
if (c.detected) continue;
- const e = validateConfig(c, draft);
- const rows = envText[c.id];
- const envError = rows ? envFromRows(rows).error : undefined;
- if (envError) e.env = envError;
+ const e: ConfigErrors = { ...validateConfig(c, draft), ...missingParams(c) };
+ if (Object.keys(missingParams(c)).length) delete e.command;
if (hasErrors(e)) out[c.id] = e;
}
return out;
- }, [draft, envText]);
+ }, [draft]);
const invalid = Object.keys(errorsById).length > 0;
const errors = (current && errorsById[current.id]) ?? {};
- const update = (patch: Partial<RunConfig>) => {
- if (!current) return;
- setDraft((d) => upsertConfig(d, { ...current, ...patch }));
+ const replace = (next: RunConfig) => {
+ setDraft((d) => upsertConfig(d, next));
setDirty(true);
};
- const add = () => {
- const c = newConfig(draft);
+ const add = (type: RunConfigTypeContribution) => {
+ const folder = selection?.type === "folder" && selection.kind === type.id ? selection.name : null;
+ const c = newConfigOfType(type, draft, templateFor(type.id), folder);
setDraft((d) => [...d, c]);
- setSelected(c.id);
+ setSelection({ type: "config", id: c.id });
+ setMode("configs");
setDirty(true);
};
+ const openAdd = (anchor?: HTMLElement | null) => {
+ const r = (anchor ?? addRef.current)?.getBoundingClientRect();
+ setAdding(r ? { x: r.left, y: r.bottom + 2 } : { x: window.innerWidth / 2 - 120, y: 120 });
+ };
+
const duplicate = () => {
if (!current) return;
const c = duplicateConfig(current, draft);
setDraft((d) => [...d, c]);
- setSelected(c.id);
+ setSelection({ type: "config", id: c.id });
setDirty(true);
};
const remove = () => {
+ if (selection?.type === "folder") {
+ // Removing a folder keeps its configurations (they move up a level), as in IDEA.
+ setDraft((d) =>
+ d.map((c) =>
+ c.kind === selection.kind && c.folder === selection.name ? { ...c, folder: null, detected: false } : c,
+ ),
+ );
+ setExtraFolders((f) => f.filter((x) => !(x.kind === selection.kind && x.name === selection.name)));
+ setSelection(null);
+ setDirty(true);
+ return;
+ }
if (!current || current.detected) return;
const index = draft.findIndex((c) => c.id === current.id);
const next = removeConfig(draft, current.id);
setDraft(next);
- setSelected(next[Math.min(index, next.length - 1)]?.id ?? null);
+ const neighbour = next[Math.min(index, next.length - 1)];
+ setSelection(neighbour ? { type: "config", id: neighbour.id } : null);
+ setDirty(true);
+ };
+
+ const newFolder = () => {
+ const kind = current?.kind ?? (selection?.type === "folder" ? selection.kind : null);
+ if (!kind) return;
+ const name = uniqueFolder(kind, draft, extraFolders);
+ setExtraFolders((f) => [...f, { kind, name }]);
+ // IDEA moves the selected configuration into the new folder.
+ if (current) replace({ ...current, folder: name });
+ setSelection({ type: "folder", kind, name });
+ };
+
+ const renameFolder = (kind: string, from: string, to: string) => {
+ setDraft((d) =>
+ d.map((c) => (c.kind === kind && c.folder === from ? { ...c, folder: to || null, detected: false } : c)),
+ );
+ setExtraFolders((f) => f.map((x) => (x.kind === kind && x.name === from ? { kind, name: to } : x)));
+ setSelection({ type: "folder", kind, name: to });
+ setDirty(true);
+ };
+
+ const move = (delta: -1 | 1) => {
+ if (!current) return;
+ setDraft((d) => moveConfig(d, current.id, delta));
setDirty(true);
};
- const save = async (andClose: boolean) => {
+ const updateTemplate = (next: RunConfig) => {
+ setTemplates((list) => [
+ ...(list ?? []).filter((t) => t.kind !== next.kind),
+ { ...next, id: templateId(next.kind), detected: false },
+ ]);
+ setTemplatesDirty(true);
+ };
+
+ const save = async (andClose: boolean): Promise<boolean> => {
if (invalid) {
const firstBad = Object.keys(errorsById)[0];
- if (firstBad) setSelected(firstBad);
- return;
+ if (firstBad) {
+ setMode("configs");
+ setSelection({ type: "config", id: firstBad });
+ }
+ return false;
}
setSaving(true);
try {
if (dirty) await saveUserConfigs(userConfigs(draft));
+ if (templatesDirty && templates) await call(commands.runSaveTemplates(templates));
setDirty(false);
+ setTemplatesDirty(false);
if (andClose) {
- if (selected) selectConfig(selected);
+ if (current) selectConfig(current.id);
close();
}
+ return true;
} catch (e) {
notifications().notify({
group: "run",
@@ -145,249 +273,354 @@ function EditConfigsDialog() {
title: "Cannot save run configurations",
body: e instanceof Error ? e.message : String(e),
});
+ return false;
} finally {
setSaving(false);
}
};
- const groups = groupConfigs(draft);
- const isOverride = current && !current.detected && !current.id.startsWith("user:");
+ /** The dialog's Run / Debug: apply, close and launch the selected configuration. */
+ const launch = async (debug: boolean) => {
+ if (!current || !(await save(true))) return;
+ void executeAction(debug ? "run.debugConfig" : "run.runConfig", current.id);
+ };
- const kindOptions: SelectOption[] = KIND_OPTIONS.map((o) => ({ value: o.value, label: o.label }));
- if (current && !kindOptions.some((o) => o.value === current.kind))
- kindOptions.push({ value: current.kind, label: current.kind });
+ const rows = treeRows(draft, extraFolders, collapsed);
+ const toggle = (key: string) =>
+ setCollapsed((s) => {
+ const next = new Set(s);
+ if (next.has(key)) next.delete(key);
+ else next.add(key);
+ return next;
+ });
- const adapterOptions: SelectOption[] = [
- { value: "", label: "None" },
- ...ADAPTERS.map((a) => ({ value: a.id, label: a.label })),
- ];
- if (current?.debugAdapter && !ADAPTERS.some((a) => a.id === current.debugAdapter))
- adapterOptions.push({ value: current.debugAdapter, label: `${current.debugAdapter} (no launch template)` });
+ const onDrop = (e: DragEvent, kind: string, folder: string | null) => {
+ const id = dragged.current;
+ dragged.current = null;
+ const c = draft.find((x) => x.id === id);
+ if (!c || c.kind !== kind) return;
+ e.preventDefault();
+ replace({ ...c, folder });
+ };
- const rows = current ? (envText[current.id] ?? envRows(current.env)) : [];
- const setRows = (next: EnvRow[]) => {
- if (!current) return;
- setEnvText((m) => ({ ...m, [current.id]: next }));
- const { env, error } = envFromRows(next);
- if (!error) update({ env });
- else setDirty(true);
+ // IDEA: ⌘N / Alt+Insert adds a configuration, ⌥M opens "Modify options".
+ const onKeyDown = (e: KeyboardEvent) => {
+ const add =
+ (e.code === "KeyN" && (isMac() ? e.metaKey || e.ctrlKey : e.ctrlKey)) || (e.altKey && e.key === "Insert");
+ if (add && mode === "configs") {
+ e.preventDefault();
+ openAdd();
+ return;
+ }
+ if (e.altKey && !e.metaKey && !e.ctrlKey && e.code === "KeyM" && (current || currentTemplate)) {
+ e.preventDefault();
+ setModifyRequest((n) => n + 1);
+ }
};
+ const templateTypes = runConfigTypes(types).filter((t) => t.id !== COMPOUND);
+ const canRemove = selection?.type === "folder" || (!!current && !current.detected);
+
return (
<Dialog
open
onClose={close}
title="Run/Debug Configurations"
- width={820}
+ width={860}
className={styles.editDialog}
footerStart={
- invalid && (
- <span className={styles.footerError}>
- <Icon name="error" size={13} /> <T>Fix the highlighted fields</T>
- </span>
- )
+ <span className={styles.footerRun}>
+ <Button
+ icon="run"
+ disabled={!current || saving || invalid || mode !== "configs"}
+ onClick={() => void launch(false)}
+ >
+ <T>Run</T>
+ </Button>
+ <Button
+ icon="debug"
+ disabled={!current || saving || invalid || mode !== "configs"}
+ onClick={() => void launch(true)}
+ >
+ <T>Debug</T>
+ </Button>
+ {invalid && (
+ <span className={styles.footerError}>
+ <Icon name="error" size={13} /> <T>Fix the highlighted fields</T>
+ </span>
+ )}
+ </span>
}
buttons={[
{ label: "OK", role: "default", disabled: saving || invalid, onClick: () => void save(true) },
{ label: "Cancel", role: "cancel" },
- { label: "Apply", disabled: !dirty || saving || invalid, onClick: () => void save(false) },
+ { label: "Apply", disabled: !(dirty || templatesDirty) || saving || invalid, onClick: () => void save(false) },
]}
>
- <div className={styles.editBody}>
+ <div className={styles.editBody} onKeyDown={onKeyDown}>
<div className={styles.editSidebar}>
- <div className={styles.editToolbar} role="toolbar" aria-label="Configurations">
- <IconButton icon="plus" size="small" iconSize={14} title="Add New Configuration" onClick={add} />
- <IconButton
- icon="minus"
- size="small"
- iconSize={14}
- title={isOverride ? "Remove Override (restore detected)" : "Remove Configuration"}
- disabled={!current || current.detected}
- onClick={remove}
- />
- <IconButton
- icon="copy"
- size="small"
- iconSize={13}
- title="Copy Configuration"
- disabled={!current}
- onClick={duplicate}
- />
- </div>
- <div className={styles.editList} role="listbox" aria-label="Run configurations">
- {groups.map((g) => (
- <div key={g.kind} role="group" aria-label={g.label}>
- <div className={styles.editGroup}>{g.label}</div>
- {g.configs.map((c) => (
- <button
- key={c.id}
- type="button"
- role="option"
- aria-selected={c.id === selected}
- className={clsx(styles.editItem, c.id === selected && styles.editItemSelected)}
- onClick={() => setSelected(c.id)}
- title={commandLine(c)}
- >
- <Icon name={configIcon(c)} size={13} className={styles.chooserIcon} />
- <span className={styles.chooserName}>{c.name || "Unnamed"}</span>
- {errorsById[c.id] && <Icon name="error" size={12} className={styles.failed} label="Invalid" />}
- {!c.detected && <span className={styles.chooserMuted}>user</span>}
- </button>
- ))}
- </div>
- ))}
- {draft.length === 0 && (
- <div className={styles.testEmpty}>
- <T>No configurations. Click + to add one.</T>
- </div>
- )}
- </div>
- </div>
- <div className={styles.editForm}>
- {current ? (
+ {mode === "configs" ? (
<>
- {current.detected && (
- <div className={styles.notice}>
- <T>Detected from the project. Changes are saved as a user configuration that overrides it.</T>
- </div>
- )}
- <Field label="Name" error={errors.name}>
- <Input
- value={current.name}
- invalid={!!errors.name}
- aria-label="Name"
- onChange={(e) => update({ name: e.target.value })}
- />
- </Field>
- <Field label="Kind">
- <Select
- value={current.kind}
- options={kindOptions}
- onChange={(kind) => update({ kind })}
- aria-label="Kind"
+ <div className={styles.editToolbar} role="toolbar" aria-label="Configurations">
+ <IconButton
+ ref={addRef}
+ icon="plus"
+ size="small"
+ iconSize={14}
+ title="Add New Configuration"
+ onClick={() => openAdd()}
/>
- </Field>
- <Field label="Command" error={errors.command}>
- <Input
- mono
- value={current.command}
- invalid={!!errors.command}
- aria-label="Command"
- placeholder="e.g. ./gradlew or cargo"
- onChange={(e) => update({ command: e.target.value })}
+ <IconButton
+ icon="minus"
+ size="small"
+ iconSize={14}
+ title={
+ selection?.type === "folder"
+ ? "Remove Folder"
+ : current && !current.detected && !current.id.startsWith("user:")
+ ? "Remove Override (restore detected)"
+ : "Remove Configuration"
+ }
+ disabled={!canRemove}
+ onClick={remove}
/>
- </Field>
- <Field label="Arguments">
- <Input
- mono
- aria-label="Arguments"
- value={argsText[current.id] ?? formatArgs(current.args)}
- placeholder="Space separated; quote with ' or &quot;"
- onChange={(e) => {
- const text = e.target.value;
- setArgsText((m) => ({ ...m, [current.id]: text }));
- update({ args: parseArgs(text) });
- }}
+ <IconButton
+ icon="copy"
+ size="small"
+ iconSize={13}
+ title="Copy Configuration"
+ disabled={!current}
+ onClick={duplicate}
/>
- </Field>
- <Field label="Working directory" error={errors.cwd}>
- <Input
- mono
- aria-label="Working directory"
- value={current.cwd ?? ""}
- placeholder="Project root"
- onChange={(e) => update({ cwd: e.target.value.trim() ? e.target.value : null })}
+ <IconButton
+ icon="folder"
+ size="small"
+ iconSize={13}
+ title="Create New Folder"
+ disabled={!current && selection?.type !== "folder"}
+ onClick={newFolder}
/>
- </Field>
- <Field label="Environment" error={errors.env} top>
- <div className={styles.envTable} role="table" aria-label="Environment variables">
- {rows.map((r, i) => (
- <div key={i} className={styles.envRow} role="row">
- <Input
- mono
- aria-label={`Variable ${i + 1} name`}
- value={r.key}
- placeholder="NAME"
- onChange={(e) => setRows(rows.map((x, j) => (j === i ? { ...x, key: e.target.value } : x)))}
- />
- <Input
- mono
- aria-label={`Variable ${i + 1} value`}
- value={r.value}
- placeholder="value"
- onChange={(e) => setRows(rows.map((x, j) => (j === i ? { ...x, value: e.target.value } : x)))}
- />
- <IconButton
- icon="minus"
- size="small"
- iconSize={12}
- title="Remove variable"
- onClick={() => setRows(rows.filter((_, j) => j !== i))}
- />
- </div>
- ))}
- <Button
- size="small"
- variant="ghost"
- icon="plus"
- onClick={() => setRows([...rows, { key: "", value: "" }])}
- >
- <T>Add variable</T>
- </Button>
- </div>
- </Field>
- <Field label="">
- <Checkbox
- checked={current.isTest}
- onChange={(isTest) => update({ isTest })}
- label="Show results in the test runner"
+ <IconButton
+ icon="arrow-up"
+ size="small"
+ iconSize={13}
+ title="Move Up"
+ disabled={!current}
+ onClick={() => move(-1)}
/>
- </Field>
- <Field label="">
- <Checkbox
- checked={!!current.allowParallel}
- onChange={(allowParallel) => update({ allowParallel })}
- label="Allow multiple instances"
+ <IconButton
+ icon="arrow-down"
+ size="small"
+ iconSize={13}
+ title="Move Down"
+ disabled={!current}
+ onClick={() => move(1)}
/>
- </Field>
- <Field label="Debug adapter">
- <Select
- value={current.debugAdapter ?? ""}
- options={adapterOptions}
- onChange={(v) => update({ debugAdapter: v || null })}
- aria-label="Debug adapter"
- />
- </Field>
- <div className={styles.editPreview}>
- <span className={styles.chooserMuted}>
- <T>Command line</T>
+ </div>
+ <div className={styles.editList} role="tree" aria-label="Run configurations">
+ {rows.map((r) => {
+ if (r.type === "group")
+ return (
+ <button
+ key={r.key}
+ type="button"
+ role="treeitem"
+ aria-expanded={!collapsed.has(r.key)}
+ className={styles.editItem}
+ style={{ paddingLeft: 6 }}
+ onClick={() => toggle(r.key)}
+ onDragOver={(e) => e.preventDefault()}
+ onDrop={(e) => onDrop(e, r.kind, null)}
+ >
+ <Icon name={collapsed.has(r.key) ? "chevron-right" : "chevron-down"} size={12} />
+ <Icon name={r.icon} size={13} className={styles.chooserIcon} />
+ <span className={clsx(styles.chooserName, styles.editGroupName)}>{r.label}</span>
+ </button>
+ );
+ if (r.type === "folder") {
+ const sel = selection?.type === "folder" && selection.kind === r.kind && selection.name === r.name;
+ return (
+ <button
+ key={r.key}
+ type="button"
+ role="treeitem"
+ aria-selected={sel}
+ aria-expanded={!collapsed.has(r.key)}
+ className={clsx(styles.editItem, sel && styles.editItemSelected)}
+ style={{ paddingLeft: 22 }}
+ onClick={() => setSelection({ type: "folder", kind: r.kind, name: r.name })}
+ onDoubleClick={() => toggle(r.key)}
+ onDragOver={(e) => e.preventDefault()}
+ onDrop={(e) => onDrop(e, r.kind, r.name)}
+ >
+ <Icon name={collapsed.has(r.key) ? "chevron-right" : "chevron-down"} size={12} />
+ <Icon name="folder" size={13} className={styles.chooserIcon} />
+ <span className={styles.chooserName}>{r.name}</span>
+ </button>
+ );
+ }
+ const c = r.config;
+ return (
+ <button
+ key={r.key}
+ type="button"
+ role="treeitem"
+ aria-selected={current?.id === c.id}
+ className={clsx(styles.editItem, current?.id === c.id && styles.editItemSelected)}
+ style={{ paddingLeft: r.depth === 2 ? 50 : 34 }}
+ onClick={() => setSelection({ type: "config", id: c.id })}
+ title={commandLine(c)}
+ draggable
+ onDragStart={(e) => {
+ dragged.current = c.id;
+ e.dataTransfer.effectAllowed = "move";
+ }}
+ >
+ <Icon
+ name={configIcon(c)}
+ size={13}
+ className={clsx(styles.chooserIcon, temporary.includes(c.id) && styles.chooserTemporary)}
+ />
+ <span className={styles.chooserName}>{c.name || <T>Unnamed</T>}</span>
+ {errorsById[c.id] && <Icon name="error" size={12} className={styles.failed} label="Invalid" />}
+ {!c.detected && <span className={styles.chooserMuted}>{c.local ? "local" : "user"}</span>}
+ </button>
+ );
+ })}
+ {draft.length === 0 && (
+ <div className={styles.editEmpty}>
+ <T>No run configurations added.</T>
+ <span>
+ <button type="button" className={styles.noticeLink} onClick={(e) => openAdd(e.currentTarget)}>
+ <T>Add new…</T>
+ </button>{" "}
+ <span className={styles.chooserMuted}>{isMac() ? "⌘N" : "Alt+Insert"}</span>
+ </span>
+ </div>
+ )}
+ </div>
+ <button
+ type="button"
+ className={clsx(styles.noticeLink, styles.editFooterLink)}
+ onClick={() => {
+ setMode("templates");
+ const first = templateTypes[0];
+ setSelection(first ? { type: "template", kind: first.id } : null);
+ }}
+ >
+ <T>Edit configuration templates…</T>
+ </button>
+ </>
+ ) : (
+ <>
+ <div className={styles.editToolbar}>
+ <span className={styles.formSectionTitle}>
+ <T>Templates</T>
</span>
- <code>{commandLine(current) || "—"}</code>
</div>
+ <div className={styles.editList} role="listbox" aria-label="Configuration templates">
+ {templateTypes.map((t) => {
+ const sel = selection?.type === "template" && selection.kind === t.id;
+ return (
+ <button
+ key={t.id}
+ type="button"
+ role="option"
+ aria-selected={sel}
+ className={clsx(styles.editItem, sel && styles.editItemSelected)}
+ onClick={() => setSelection({ type: "template", kind: t.id })}
+ >
+ <Icon name={t.icon} size={13} className={styles.chooserIcon} />
+ <span className={styles.chooserName}>{t.label}</span>
+ </button>
+ );
+ })}
+ </div>
+ <button
+ type="button"
+ className={clsx(styles.noticeLink, styles.editFooterLink)}
+ onClick={() => {
+ setMode("configs");
+ setSelection(draft[0] ? { type: "config", id: draft[0].id } : null);
+ }}
+ >
+ <T>Back to configurations</T>
+ </button>
</>
+ )}
+ </div>
+ <div className={styles.editForm}>
+ {mode === "templates" ? (
+ currentTemplate ? (
+ <>
+ <div className={styles.notice}>
+ <T>New configurations of this type start with these values.</T>
+ </div>
+ <ConfigForm
+ key={`template:${currentTemplate.kind}`}
+ config={currentTemplate}
+ all={draft}
+ type={typeFor(currentTemplate.kind)}
+ errors={{}}
+ template
+ modifyRequest={modifyRequest}
+ onChange={updateTemplate}
+ />
+ </>
+ ) : (
+ <div className={styles.editEmpty}>
+ <T>Select a configuration type</T>
+ </div>
+ )
+ ) : current ? (
+ <ConfigForm
+ key={current.id}
+ config={current}
+ all={draft}
+ type={typeFor(current.kind)}
+ errors={errors}
+ modifyRequest={modifyRequest}
+ onChange={replace}
+ />
+ ) : selection?.type === "folder" ? (
+ <FolderName
+ key={`${selection.kind}:${selection.name}`}
+ name={selection.name}
+ onRename={(to) => renameFolder(selection.kind, selection.name, to)}
+ />
) : (
- <div className={styles.testEmpty}>
- <T>Select a configuration</T>
+ <div className={styles.editEmpty}>
+ <button type="button" className={styles.noticeLink} onClick={(e) => openAdd(e.currentTarget)}>
+ <T>Add new run configuration…</T>
+ </button>
+ <T>or select run configuration to edit</T>
</div>
)}
</div>
</div>
+ {adding && <AddConfigPopup anchor={adding} onPick={add} onClose={() => setAdding(null)} />}
</Dialog>
);
}
-function Field({ label, error, top, children }: { label: string; error?: string; top?: boolean; children: ReactNode }) {
+/** Renames on every edit that leaves a name (an emptied field keeps the old one). */
+function FolderName({ name, onRename }: { name: string; onRename: (to: string) => void }) {
+ const [text, setText] = useState(name);
return (
- <div className={clsx(styles.field, top && styles.fieldTop)}>
- <span className={styles.fieldLabel}>{label}</span>
- <div className={styles.fieldControl}>
- {children}
- {error && (
- <span className={styles.fieldError} role="alert">
- {error}
- </span>
- )}
- </div>
- </div>
+ <Field label="Folder name" error={text.trim() ? undefined : "Name is required"}>
+ <Input
+ aria-label="Folder name"
+ value={text}
+ autoFocus
+ onChange={(e) => setText(e.target.value)}
+ onBlur={() => text.trim() && text.trim() !== name && onRename(text.trim())}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && text.trim() && text.trim() !== name) {
+ e.preventDefault();
+ onRename(text.trim());
+ }
+ }}
+ />
+ </Field>
);
}
diff --git a/src/features/run/EnvDialog.tsx b/src/features/run/EnvDialog.tsx
new file mode 100644
index 000000000..a389c3651
--- /dev/null
+++ b/src/features/run/EnvDialog.tsx
@@ -0,0 +1,227 @@
+import { useEffect, useState } from "react";
+import clsx from "clsx";
+import { commands, isTauri, type RunConfig } from "@/platform/ipc";
+import { useTx, useTxTemplate } from "@/platform/i18n";
+import { Checkbox, Dialog, IconButton, Input, T } from "@/ui";
+import { parseEnv } from "./configs";
+import styles from "./Run.module.css";
+
+export interface EnvRow {
+ key: string;
+ value: string;
+}
+
+export const envRows = (env: RunConfig["env"]): EnvRow[] => Object.entries(env).map(([key, value]) => ({ key, value }));
+
+/** Env map from table rows; blank rows are ignored. */
+export function envFromRows(rows: readonly EnvRow[]): { env: RunConfig["env"]; error?: string } {
+ const env: RunConfig["env"] = {};
+ for (const r of rows) {
+ const key = r.key.trim();
+ if (!key && !r.value) continue;
+ if (!key) return { env, error: "Environment variable names can't be empty" };
+ if (key in env) return { env, error: `Duplicate environment variable: ${key}` };
+ env[key] = r.value;
+ }
+ return { env };
+}
+
+/** Rows as `NAME=value` lines (what Copy puts on the clipboard). */
+export const rowsText = (rows: readonly EnvRow[]) => rows.map((r) => `${r.key}=${r.value}`).join("\n");
+
+/** Pasted variables replace rows with the same name and are appended otherwise. */
+export function pasteRows(rows: readonly EnvRow[], text: string): EnvRow[] {
+ const out = rows.filter((r) => r.key || r.value).map((r) => ({ ...r }));
+ for (const p of parseEnv(text)) {
+ const existing = out.find((r) => r.key === p.key);
+ if (existing) existing.value = p.value;
+ else out.push(p);
+ }
+ return out;
+}
+
+async function writeClipboard(text: string) {
+ try {
+ await navigator.clipboard.writeText(text);
+ } catch {
+ /* clipboard unavailable */
+ }
+}
+
+/** IDEA's Environment Variables dialog: user variables, and the inherited system ones (read-only). */
+export function EnvDialog({
+ env,
+ includeSystemEnv,
+ onOk,
+ onClose,
+}: {
+ env: RunConfig["env"];
+ includeSystemEnv: boolean;
+ onOk: (env: RunConfig["env"], includeSystemEnv: boolean) => void;
+ onClose: () => void;
+}) {
+ const [rows, setRows] = useState<EnvRow[]>(() => envRows(env));
+ const [selected, setSelected] = useState<number | null>(null);
+ const [include, setInclude] = useState(includeSystemEnv);
+ const [system, setSystem] = useState<Array<[string, string]> | null>(() => (isTauri() ? null : []));
+ const { error } = envFromRows(rows);
+ const tx = useTx();
+ const txTemplate = useTxTemplate();
+
+ useEffect(() => {
+ if (!isTauri()) return;
+ let live = true;
+ commands
+ .runSystemEnv()
+ .then((vars) => live && setSystem(Object.entries(vars).sort(([a], [b]) => a.localeCompare(b))))
+ .catch(() => live && setSystem([]));
+ return () => {
+ live = false;
+ };
+ }, []);
+
+ const set = (i: number, patch: Partial<EnvRow>) =>
+ setRows((r) => r.map((x, j) => (j === i ? { ...x, ...patch } : x)));
+ const add = () => {
+ setRows((r) => [...r, { key: "", value: "" }]);
+ setSelected(rows.length);
+ };
+ const remove = () => {
+ if (selected === null) return;
+ setRows((r) => r.filter((_, j) => j !== selected));
+ setSelected(null);
+ };
+ const paste = async () => {
+ try {
+ const text = await navigator.clipboard.readText();
+ setRows((r) => pasteRows(r, text));
+ } catch {
+ /* clipboard unavailable */
+ }
+ };
+ const overridden = new Set(rows.map((r) => r.key));
+
+ return (
+ <Dialog
+ open
+ title="Environment Variables"
+ onClose={onClose}
+ width={560}
+ footerStart={error && <span className={styles.footerError}>{txTemplate(error)}</span>}
+ buttons={[
+ {
+ label: "OK",
+ role: "default",
+ disabled: !!error,
+ onClick: () => {
+ onOk(envFromRows(rows).env, include);
+ onClose();
+ },
+ },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <div className={styles.envDialog}>
+ <span className={styles.fieldLabel}>
+ <T>User environment variables:</T>
+ </span>
+ <div className={styles.envPanel}>
+ <div className={styles.editToolbar} role="toolbar" aria-label={tx("User environment variables")}>
+ <IconButton icon="plus" size="small" iconSize={14} title="Add" onClick={add} />
+ <IconButton
+ icon="minus"
+ size="small"
+ iconSize={14}
+ title="Remove"
+ disabled={selected === null}
+ onClick={remove}
+ />
+ <IconButton
+ icon="copy"
+ size="small"
+ iconSize={13}
+ title="Copy"
+ disabled={!rows.length}
+ onClick={() =>
+ void writeClipboard(rowsText(selected === null ? rows : rows.slice(selected, selected + 1)))
+ }
+ />
+ <IconButton icon="paste" size="small" iconSize={13} title="Paste" onClick={() => void paste()} />
+ </div>
+ <div className={styles.envGrid} role="table" aria-label={tx("User environment variables")}>
+ <div className={styles.envHeader} role="row">
+ <span role="columnheader">
+ <T>Name</T>
+ </span>
+ <span role="columnheader">
+ <T>Value</T>
+ </span>
+ </div>
+ {rows.map((r, i) => (
+ <div
+ key={i}
+ role="row"
+ className={clsx(styles.envGridRow, selected === i && styles.editItemSelected)}
+ onFocus={() => setSelected(i)}
+ >
+ <Input
+ mono
+ variant="bare"
+ aria-label={txTemplate(`Variable ${i + 1} name`)}
+ value={r.key}
+ onChange={(e) => set(i, { key: e.target.value })}
+ />
+ <Input
+ mono
+ variant="bare"
+ aria-label={txTemplate(`Variable ${i + 1} value`)}
+ value={r.value}
+ onChange={(e) => set(i, { value: e.target.value })}
+ />
+ </div>
+ ))}
+ </div>
+ </div>
+ <Checkbox checked={include} onChange={setInclude} label="Include system environment variables" />
+ <div className={clsx(styles.envPanel, !include && styles.envDisabled)}>
+ <div className={styles.editToolbar} role="toolbar" aria-label={tx("System environment variables")}>
+ <IconButton
+ icon="copy"
+ size="small"
+ iconSize={13}
+ title="Copy"
+ disabled={!system?.length}
+ onClick={() => void writeClipboard((system ?? []).map(([k, v]) => `${k}=${v}`).join("\n"))}
+ />
+ </div>
+ <div className={styles.envGrid} role="table" aria-label={tx("System environment variables")}>
+ <div className={styles.envHeader} role="row">
+ <span role="columnheader">
+ <T>Name</T>
+ </span>
+ <span role="columnheader">
+ <T>Value</T>
+ </span>
+ </div>
+ {system === null && (
+ <div className={styles.chooserMuted}>
+ <T>Loading…</T>
+ </div>
+ )}
+ {system?.map(([k, v]) => (
+ <div
+ key={k}
+ role="row"
+ className={clsx(styles.envGridRow, styles.envSystemRow, overridden.has(k) && styles.envOverridden)}
+ title={`${k}=${v}`}
+ >
+ <span className={styles.envCell}>{k}</span>
+ <span className={styles.envCell}>{v}</span>
+ </div>
+ ))}
+ </div>
+ </div>
+ </div>
+ </Dialog>
+ );
+}
diff --git a/src/features/run/Run.module.css b/src/features/run/Run.module.css
index e70bf6b85..106a0953b 100644
--- a/src/features/run/Run.module.css
+++ b/src/features/run/Run.module.css
@@ -493,18 +493,182 @@
color: var(--danger);
font-size: var(--fs-small);
}
-.envTable {
+.editGroupName {
+ color: var(--fg-strong);
+}
+.editEmpty {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ padding: 24px 12px;
+ color: var(--fg-subtle);
+ text-align: center;
+}
+.editFooterLink {
+ flex: none;
+ align-self: flex-start;
+ margin: 8px 12px;
+}
+.footerRun {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+}
+.formHeader {
+ display: grid;
+ grid-template-columns: 1fr auto;
+ align-items: center;
+ gap: 16px;
+ padding-bottom: 10px;
+ border-bottom: 1px solid var(--border-popup);
+}
+.formSection {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+.formSectionTitle {
+ flex: 1;
+ font-weight: 600;
+ color: var(--fg-strong);
+}
+.formSection .noticeLink {
+ display: inline-flex;
+ align-items: center;
+ gap: 2px;
+}
+.inputWithButton {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+}
+.inputWithButton > :first-child {
+ flex: 1;
+}
+.textarea {
+ min-height: 72px;
+ padding: 6px 8px;
+ resize: vertical;
+ border: 0;
+ border-radius: var(--radius-control, 4px);
+ background: var(--bg-field, var(--bg-button));
+ box-shadow: inset 0 0 0 1px var(--border-button);
+ color: var(--fg-strong);
+ font-family: var(--font-mono);
+ font-size: var(--fs-ui);
+ outline: none;
+}
+.textarea:focus {
+ box-shadow: inset 0 0 0 1px var(--focus-ring);
+}
+.textareaInvalid {
+ box-shadow: inset 0 0 0 1px var(--danger);
+}
+.taskList {
display: flex;
flex-direction: column;
+ align-items: stretch;
+ gap: 4px;
+}
+.taskList > button:last-of-type {
+ align-self: flex-start;
+}
+.taskRow {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+ min-height: var(--h-row);
+}
+.taskRow > :first-child {
+ flex: 1;
+ min-width: 0;
+}
+.taskLabel {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.chips {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+}
+.chip {
+ display: inline-flex;
+ align-items: center;
gap: 4px;
- align-items: flex-start;
+ padding: 2px 4px 2px 10px;
+ border-radius: 999px;
+ background: var(--bg-elev);
+ color: var(--fg);
+ font-size: var(--fs-small);
+}
+.typeNested {
+ padding-left: 16px;
+}
+.emptyHints {
+ text-align: left;
+ color: var(--fg-subtle);
+}
+.emptyHints ul {
+ margin: 4px 0 0;
+ padding: 0;
+ list-style: none;
+}
+.emptyHints li::before {
+ content: "— ";
+}
+.envDialog {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 12px 16px;
+}
+.envPanel {
+ display: flex;
+ flex-direction: column;
+ border: 1px solid var(--border-popup);
+ border-radius: var(--radius-small);
+}
+.envDisabled {
+ opacity: 0.55;
+}
+.envGrid {
+ height: 140px;
+ overflow: auto;
}
-.envRow {
+.envHeader,
+.envGridRow {
display: grid;
- grid-template-columns: 2fr 3fr auto;
+ grid-template-columns: 2fr 3fr;
gap: 4px;
- width: 100%;
align-items: center;
+ padding: 0 8px;
+ min-height: var(--h-row);
+}
+.envHeader {
+ position: sticky;
+ top: 0;
+ background: var(--bg-popup, var(--bg));
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+ border-bottom: 1px solid var(--border-popup);
+}
+.envSystemRow {
+ color: var(--fg-subtle);
+}
+.envOverridden {
+ text-decoration: line-through;
+}
+.envCell {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ font-family: var(--font-mono);
+ font-size: var(--fs-small);
}
.editPreview {
display: flex;
@@ -610,3 +774,12 @@
background: transparent;
}
}
+
+/* "Emulate terminal in output console": the terminal widget fills the console. */
+.terminalConsole {
+ flex: 1;
+ min-width: 0;
+ min-height: 0;
+ padding: 4px 0 0 8px;
+ background: var(--bg-island);
+}
diff --git a/src/features/run/RunServices.module.css b/src/features/run/RunServices.module.css
new file mode 100644
index 000000000..b75407269
--- /dev/null
+++ b/src/features/run/RunServices.module.css
@@ -0,0 +1,31 @@
+/* Run configurations in the Services tool window */
+.detail {
+ height: 100%;
+ overflow: auto;
+}
+.facts {
+ display: grid;
+ grid-template-columns: max-content 1fr;
+ gap: 4px 12px;
+ padding: 12px;
+ margin: 0;
+}
+.facts dt {
+ color: var(--fg-secondary);
+}
+.facts dd {
+ margin: 0;
+ min-width: 0;
+ overflow-wrap: anywhere;
+ -webkit-user-select: text;
+ user-select: text;
+}
+.mono {
+ font-family: var(--font-mono);
+ font-size: var(--fs-code);
+}
+.actions {
+ display: flex;
+ gap: 6px;
+ padding: 0 12px 12px;
+}
diff --git a/src/features/run/RunView.tsx b/src/features/run/RunView.tsx
index ed0a1d508..c4187ed67 100644
--- a/src/features/run/RunView.tsx
+++ b/src/features/run/RunView.tsx
@@ -5,6 +5,7 @@ import { executeAction } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
import { ConsoleModel } from "./console";
import { ConsoleView } from "./ConsoleView";
+import { TerminalConsole } from "./TerminalConsole";
import { runDirectory } from "./navigate";
import {
acceptsInput,
@@ -14,12 +15,14 @@ import {
failedTests,
rerunFailed,
rerunSession,
+ resizeTerminal,
runSelectedTests,
runtime,
sendStdin,
setPendingInput,
stopSession,
useRun,
+ writeTerminal,
type RunSession,
} from "./store";
import { TestTreeView, formatDuration } from "./TestTreeView";
@@ -72,26 +75,36 @@ function SessionPanel({ session }: { session: RunSession }) {
</button>
</div>
)}
- <ConsoleView
- model={testModel ?? rt.console}
- version={version}
- softWrap={softWrap}
- follow={testModel ? false : follow}
- onFollowChange={setFollow}
- cwd={cwd}
- onClear={() => clearConsole(session.id)}
- input={
- !testModel && acceptsInput(session)
- ? {
- pending: rt.input,
- onChange: (text) => setPendingInput(session.id, text),
- onSubmit: (line) => void sendStdin(session.id, line),
- onEof: () => void closeStdin(session.id),
- }
- : undefined
- }
- aria-label={`${session.config.name} output`}
- />
+ {rt.terminal && !testModel ? (
+ <TerminalConsole
+ output={rt.terminal}
+ cwd={cwd}
+ onData={(data) => writeTerminal(session.id, data)}
+ onResize={(cols, rows) => resizeTerminal(session.id, cols, rows)}
+ aria-label={`${session.config.name} terminal`}
+ />
+ ) : (
+ <ConsoleView
+ model={testModel ?? rt.console}
+ version={version}
+ softWrap={softWrap}
+ follow={testModel ? false : follow}
+ onFollowChange={setFollow}
+ cwd={cwd}
+ onClear={() => clearConsole(session.id)}
+ input={
+ !testModel && acceptsInput(session)
+ ? {
+ pending: rt.input,
+ onChange: (text) => setPendingInput(session.id, text),
+ onSubmit: (line) => void sendStdin(session.id, line),
+ onEof: () => void closeStdin(session.id),
+ }
+ : undefined
+ }
+ aria-label={`${session.config.name} output`}
+ />
+ )}
</div>
);
@@ -125,14 +138,18 @@ function SessionPanel({ session }: { session: RunSession }) {
onClick={() => void stopSession(session.id)}
/>
<div className={styles.toolbarSep} />
- <IconButton
- icon="arrow-down"
- iconSize={14}
- title="Scroll to End"
- pressed={follow}
- onClick={() => setFollow((v) => !v)}
- />
- <IconButton icon="soft-wrap" iconSize={14} title="Soft-Wrap" pressed={softWrap} onClick={toggleWrap} />
+ {!rt.terminal && (
+ <>
+ <IconButton
+ icon="arrow-down"
+ iconSize={14}
+ title="Scroll to End"
+ pressed={follow}
+ onClick={() => setFollow((v) => !v)}
+ />
+ <IconButton icon="soft-wrap" iconSize={14} title="Soft-Wrap" pressed={softWrap} onClick={toggleWrap} />
+ </>
+ )}
<IconButton icon="trash" iconSize={14} title="Clear All" onClick={() => clearConsole(session.id)} />
<div className={styles.toolbarSep} />
<IconButton
@@ -230,9 +247,28 @@ export function RunView() {
const current = currentTab(sessions, traces, active);
if (!current) {
+ // IDEA's empty Run tool window: the three ways to run something.
+ const chooser = shortcutLabel("run.chooseConfig");
return (
- <EmptyState icon="run" title="Nothing is running">
- <T>Run a configuration with</T> <kbd className={styles.kbd}>⌃R</kbd> <T>or pick one in the toolbar.</T>
+ <EmptyState>
+ <div className={styles.emptyHints}>
+ <T>To run your code, do one of the following:</T>
+ <ul>
+ <li>
+ <T>Click the Run icon in the editor gutter</T>
+ </li>
+ <li>
+ <T>{'Select "Run…" in the editor context menu'}</T>
+ </li>
+ <li>
+ <T>Launch a</T>{" "}
+ <button type="button" className={styles.noticeLink} onClick={() => void executeAction("run.editConfigs")}>
+ <T>run configuration</T>
+ </button>
+ {chooser && <span className={styles.chooserMuted}> ({chooser})</span>}
+ </li>
+ </ul>
+ </div>
</EmptyState>
);
}
diff --git a/src/features/run/RunWidget.tsx b/src/features/run/RunWidget.tsx
index 76f06b74b..b06bc69d7 100644
--- a/src/features/run/RunWidget.tsx
+++ b/src/features/run/RunWidget.tsx
@@ -7,7 +7,7 @@ import { useTx } from "@/platform/i18n";
import { shortcutLabel } from "@/platform/keymap";
import { runExecutors, useRunExecutors } from "@/workbench/contributions";
import { configIcon } from "./configs";
-import { rerunSession, stopSession, useRun } from "./store";
+import { CURRENT_FILE, rerunSession, sessionsOf, startRun, stopSession, useRun } from "./store";
import styles from "./Run.module.css";
/** Title bar: configuration chooser, Run / Debug, and Rerun / Stop while running. */
@@ -18,8 +18,11 @@ export function RunWidget() {
const sessions = useRun((s) => s.sessions);
const chooserOpen = useRun((s) => s.chooserOpen);
const selected = configs.find((c) => c.id === selectedId);
+ const currentFile = selectedId === CURRENT_FILE;
const running = sessions.filter((s) => s.status === "running" || s.status === "starting");
- const runningSelected = running.find((s) => s.config.id === selectedId) ?? null;
+ // A compound is running while any of its configurations is; Stop stops them all.
+ const compoundRunning = selected?.kind === "compound" ? sessionsOf(selected, running) : [];
+ const runningSelected = compoundRunning[0] ?? running.find((s) => s.config.id === selectedId) ?? null;
const target = runningSelected ?? running[running.length - 1] ?? null;
// Debug sessions belong to the debugger feature; like IDEA the widget offers their Rerun / Stop.
const debugging = useContextKeys((c) => !!c.debugSessionActive);
@@ -55,11 +58,7 @@ export function RunWidget() {
aria-haspopup="listbox"
aria-expanded={chooserOpen}
data-run-chooser=""
- onClick={() =>
- void (selected || configs.length
- ? executeAction("run.chooseConfig", "select")
- : executeAction("run.editConfigs"))
- }
+ onClick={() => void executeAction("run.chooseConfig", "select")}
>
{selected && (
// IDEA: the configuration's type icon, with a status dot on its top-right corner while active.
@@ -71,7 +70,7 @@ export function RunWidget() {
</span>
)}
<span className={styles.widgetName}>
- {selected?.name ?? tx(configs.length ? "Select Configuration" : "Add Configuration…")}
+ {selected?.name ?? tx(currentFile ? "Current File" : "Select Configuration")}
</span>
<Icon name="chevron-down" size={14} className={styles.widgetChevron} />
</BarButton>
@@ -83,18 +82,30 @@ export function RunWidget() {
size="large"
iconSize={16}
className={clsx(styles.widgetButton, styles.widgetFilled, styles.widgetFilledRun)}
- title={`Rerun '${target.config.name}'`}
+ title={`Rerun '${compoundRunning.length && selected ? selected.name : target.config.name}'`}
shortcut={shortcutLabel("run.run")}
- onClick={() => rerunSession(target.id)}
+ onClick={() => (compoundRunning.length && selected ? void startRun(selected) : rerunSession(target.id))}
/>
<IconButton
icon="stop-filled"
size="large"
iconSize={16}
className={clsx(styles.widgetButton, styles.widgetFilled, styles.widgetFilledStop)}
- title={running.length > 1 ? `Stop (${running.length} running)` : `Stop '${target.config.name}'`}
+ title={
+ compoundRunning.length && selected
+ ? `Stop '${selected.name}'`
+ : running.length > 1
+ ? `Stop (${running.length} running)`
+ : `Stop '${target.config.name}'`
+ }
shortcut={shortcutLabel("run.stop")}
- onClick={() => (running.length > 1 ? void executeAction("run.stop") : void stopSession(target.id))}
+ onClick={() =>
+ compoundRunning.length
+ ? compoundRunning.forEach((s) => void stopSession(s.id))
+ : running.length > 1
+ ? void executeAction("run.stop")
+ : void stopSession(target.id)
+ }
/>
</>
) : debugging ? (
@@ -138,9 +149,9 @@ export function RunWidget() {
size="large"
iconSize={18}
className={clsx(styles.widgetButton, styles.widgetRun)}
- title={selected ? `Run '${selected.name}'` : "Run"}
+ title={selected ? `Run '${selected.name}'` : currentFile ? "Run Current File" : "Run"}
shortcut={shortcutLabel("run.run")}
- disabled={!selected}
+ disabled={!selected && !currentFile}
onClick={() => void executeAction("run.run")}
/>
<IconButton
@@ -148,9 +159,9 @@ export function RunWidget() {
size="large"
iconSize={18}
className={styles.widgetButton}
- title={selected ? `Debug '${selected.name}'` : "Debug"}
+ title={selected ? `Debug '${selected.name}'` : currentFile ? "Debug Current File" : "Debug"}
shortcut={shortcutLabel("run.debug")}
- disabled={!selected}
+ disabled={!selected && !currentFile}
onClick={() => void executeAction("run.debug")}
/>
</>
diff --git a/src/features/run/TerminalConsole.tsx b/src/features/run/TerminalConsole.tsx
new file mode 100644
index 000000000..356ab87a2
--- /dev/null
+++ b/src/features/run/TerminalConsole.tsx
@@ -0,0 +1,66 @@
+/**
+ * The Run console of a configuration with "Emulate terminal in output console":
+ * the terminal widget (provided by the terminal feature) shows the raw output
+ * and sends keystrokes and its size to the process.
+ */
+import { useEffect, useRef } from "react";
+import { T } from "@/ui";
+import { embeddedTerminal } from "@/workbench/contributions";
+import type { TerminalOutput } from "./terminalOutput";
+import styles from "./Run.module.css";
+
+export function TerminalConsole({
+ output,
+ cwd,
+ onData,
+ onResize,
+ "aria-label": ariaLabel,
+}: {
+ output: TerminalOutput;
+ cwd: string;
+ onData: (data: string) => void;
+ onResize: (cols: number, rows: number) => void;
+ "aria-label": string;
+}) {
+ const host = useRef<HTMLDivElement>(null);
+ const handlers = useRef({ onData, onResize });
+ useEffect(() => {
+ handlers.current = { onData, onResize };
+ });
+ const factory = embeddedTerminal();
+
+ useEffect(() => {
+ const el = host.current;
+ if (!el || !factory) return;
+ let disposed = false;
+ let cleanup = () => {};
+ void factory(el, {
+ cwd,
+ "aria-label": ariaLabel,
+ onData: (d) => handlers.current.onData(d),
+ onResize: (c, r) => handlers.current.onResize(c, r),
+ }).then((term) => {
+ if (disposed) return term.dispose();
+ const detach = output.attach(
+ (d) => term.write(d),
+ () => term.clear(),
+ );
+ cleanup = () => {
+ detach();
+ term.dispose();
+ };
+ });
+ return () => {
+ disposed = true;
+ cleanup();
+ };
+ }, [factory, output, cwd, ariaLabel]);
+
+ if (!factory)
+ return (
+ <div className={styles.notice}>
+ <T>The terminal is not available; turn off "Emulate terminal in output console" to see the output.</T>
+ </div>
+ );
+ return <div ref={host} className={styles.terminalConsole} />;
+}
diff --git a/src/features/run/beforeLaunch.ts b/src/features/run/beforeLaunch.ts
new file mode 100644
index 000000000..648111e5f
--- /dev/null
+++ b/src/features/run/beforeLaunch.ts
@@ -0,0 +1,126 @@
+/**
+ * Before launch tasks (IDEA's "Before launch" list): run in order before a
+ * configuration starts; the first failure aborts the launch.
+ */
+import { executeAction, getAction } from "@/platform/actions";
+import { getContext } from "@/platform/context";
+import { tx, txTemplate } from "@/platform/i18n";
+import type { BeforeLaunchTask, RunConfig } from "@/platform/ipc";
+import { workflowSettings } from "@/platform/workflowSettings";
+import { notifications, toolWindowService, useContributions } from "@/workbench/contributions";
+import { externalToolConfig } from "./externalTools";
+import { startRun, useRun } from "./store";
+
+export const BUILD_ACTION = "build.buildProject";
+const BUILD_STATUS = "build.lastStatus";
+
+export type BeforeLaunchKind = "run" | "build" | "tool" | "command" | "toolWindow";
+
+export const TASK_LABELS: Record<BeforeLaunchKind, string> = {
+ run: "Run Another Configuration",
+ build: "Build Project",
+ tool: "Run External Tool",
+ command: "Run Shell Command",
+ toolWindow: "Activate Tool Window",
+};
+
+/** One line for the task list, e.g. `Run 'migrate'`. */
+export function taskLabel(task: BeforeLaunchTask, configs: readonly RunConfig[] = useRun.getState().configs): string {
+ const target = task.target ?? "";
+ switch (task.kind) {
+ case "run":
+ return `Run '${configs.find((c) => c.id === target)?.name ?? target}'`;
+ case "build":
+ return "Build Project";
+ case "tool":
+ return `External tool '${workflowSettings().externalTools.find((t) => t.id === target)?.name ?? target}'`;
+ case "command":
+ return target ? `Run '${target}'` : "Run shell command";
+ case "toolWindow":
+ return `Activate '${useContributions.getState().toolWindows.get(target)?.title ?? target}' tool window`;
+ default:
+ return task.kind;
+ }
+}
+
+/** Runs `config` to completion: true when it exited with code 0. */
+async function runToEnd(config: RunConfig, chain: readonly string[]): Promise<boolean> {
+ let done!: (ok: boolean) => void;
+ const exited = new Promise<boolean>((resolve) => (done = resolve));
+ const session = await startRun(config, undefined, undefined, {
+ chain,
+ onExit: (code, stopped) => done(code === 0 && !stopped),
+ });
+ if (!session || session.status === "failed") return false;
+ return exited;
+}
+
+async function runTask(task: BeforeLaunchTask, config: RunConfig, chain: readonly string[]): Promise<string | null> {
+ const target = task.target ?? "";
+ switch (task.kind) {
+ case "build": {
+ if (!getAction(BUILD_ACTION)) return "Building is not available";
+ if (!(await executeAction(BUILD_ACTION))) return "A build is already running";
+ return getContext()[BUILD_STATUS] === "success" ? null : "Build failed";
+ }
+ case "run": {
+ if (chain.includes(target)) return "The before launch tasks run in a cycle";
+ const other = useRun.getState().configs.find((c) => c.id === target);
+ if (!other) return `Configuration '${target}' no longer exists`;
+ return (await runToEnd(other, chain)) ? null : `'${other.name}' failed`;
+ }
+ case "tool": {
+ const tool = workflowSettings().externalTools.find((t) => t.id === target);
+ if (!tool) return `External tool '${target}' no longer exists`;
+ const run = await externalToolConfig(tool);
+ if (!run) return `'${tool.name}' was not run`;
+ return (await runToEnd({ ...run, id: `${run.id}:before:${config.id}` }, chain)) ? null : `'${tool.name}' failed`;
+ }
+ case "command": {
+ if (!target.trim()) return "No command";
+ const run: RunConfig = {
+ id: `before-launch:${config.id}:${target}`,
+ name: target,
+ kind: "shell",
+ command: target,
+ args: [],
+ cwd: config.cwd,
+ env: {},
+ detected: true,
+ isTest: false,
+ debugAdapter: null,
+ };
+ return (await runToEnd(run, chain)) ? null : `'${target}' failed`;
+ }
+ case "toolWindow": {
+ if (!useContributions.getState().toolWindows.has(target)) return `Tool window '${target}' is not available`;
+ toolWindowService().show(target, true);
+ return null;
+ }
+ default:
+ return `Unknown before launch task '${task.kind}'`;
+ }
+}
+
+/** The installed runner: every task in order; a failure is reported and aborts. */
+export async function runBeforeLaunch(config: RunConfig, chain: readonly string[]): Promise<boolean> {
+ for (const task of config.beforeLaunch ?? []) {
+ let error: string | null;
+ try {
+ error = await runTask(task, config, chain);
+ } catch (e) {
+ error = e instanceof Error ? e.message : String(e);
+ }
+ if (error) {
+ notifications().notify({
+ group: "run",
+ level: "error",
+ title: `'${config.name}' was not started`,
+ body: `${tx("Before launch")}: ${txTemplate(taskLabel(task))}: ${txTemplate(error)}`,
+ key: `run-before-launch-${config.id}`,
+ });
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/src/features/run/configs.test.ts b/src/features/run/configs.test.ts
index 931251188..5f8c1694e 100644
--- a/src/features/run/configs.test.ts
+++ b/src/features/run/configs.test.ts
@@ -14,7 +14,7 @@ import {
validateConfig,
} from "./configs";
import { contextConfig, fileRole } from "./context";
-import { envFromRows } from "./EditConfigsDialog";
+import { envFromRows } from "./EnvDialog";
import { defaultSelection } from "./store";
const cfg = (over: Partial<RunConfig> & { id: string }): RunConfig => ({
diff --git a/src/features/run/configs.ts b/src/features/run/configs.ts
index f7f508fbe..2f5c77367 100644
--- a/src/features/run/configs.ts
+++ b/src/features/run/configs.ts
@@ -1,5 +1,6 @@
/** Run configuration helpers: grouping, overriding, validation and argument parsing. */
import type { RunConfig } from "@/platform/ipc";
+import { useRunConfigTypes } from "@/workbench/contributions";
const KIND_LABELS: Record<string, string> = {
npm: "npm",
@@ -14,6 +15,8 @@ const KIND_LABELS: Record<string, string> = {
make: "Make",
just: "Just",
shell: "Shell Script",
+ program: "Program",
+ compound: "Compound",
application: "Application",
"spring-boot": "Spring Boot",
node: "Node.js",
@@ -37,12 +40,20 @@ const KIND_LABELS: Record<string, string> = {
export const KIND_OPTIONS = Object.entries(KIND_LABELS).map(([value, label]) => ({ value, label }));
export function kindLabel(kind: string): string {
- return KIND_LABELS[kind] ?? (kind ? kind[0]!.toUpperCase() + kind.slice(1) : "Other");
+ return (
+ useRunConfigTypes.getState().types.get(kind)?.label ??
+ KIND_LABELS[kind] ??
+ (kind ? kind[0]!.toUpperCase() + kind.slice(1) : "Other")
+ );
}
export function configIcon(config: Pick<RunConfig, "kind" | "isTest">): string {
if (config.isTest) return "check";
switch (config.kind) {
+ case "compound":
+ return "gutter-run-all";
+ case "program":
+ return "file-binary";
case "spring-boot":
return "spring-boot";
case "npm":
@@ -98,7 +109,7 @@ export function configIcon(config: Pick<RunConfig, "kind" | "isTest">): string {
case "pytest":
return "file-python";
default:
- return "terminal";
+ return useRunConfigTypes.getState().types.get(config.kind)?.icon ?? "terminal";
}
}
@@ -168,7 +179,7 @@ function sortedEnv(env: RunConfig["env"]) {
}
let counter = 0;
-function uid(): string {
+export function uid(): string {
const rnd =
typeof crypto !== "undefined" && "randomUUID" in crypto
? crypto.randomUUID().slice(0, 8)
@@ -202,23 +213,34 @@ export function newConfig(configs: readonly RunConfig[]): RunConfig {
export function duplicateConfig(config: RunConfig, configs: readonly RunConfig[]): RunConfig {
return {
- ...config,
- env: { ...config.env },
- args: [...config.args],
+ ...structuredClone(config),
id: uid(),
name: uniqueName(`${config.name} (copy)`, configs),
detected: false,
};
}
-export type ConfigErrors = Partial<Record<"name" | "command" | "env" | "cwd", string>>;
+/** Field errors: `name`, `command`, `env`, `cwd`, `compound`, `beforeLaunch` or a type param key. */
+export type ConfigErrors = Partial<Record<string, string>>;
export function validateConfig(config: RunConfig, all: readonly RunConfig[] = []): ConfigErrors {
const errors: ConfigErrors = {};
if (!config.name.trim()) errors.name = "Name is required";
else if (all.some((c) => c.id !== config.id && c.name.trim() === config.name.trim()))
errors.name = "Another configuration has this name";
- if (!config.command.trim()) errors.command = "Command is required";
+ if (config.kind === "compound") {
+ const children = config.compound ?? [];
+ if (!children.length) errors.compound = "Add at least one configuration";
+ else if (compoundCycle(config, all)) errors.compound = "A compound configuration can't include itself";
+ else if (children.some((id) => !all.some((c) => c.id === id)))
+ errors.compound = "Some configurations no longer exist";
+ } else if (!config.command.trim()) errors.command = "Command is required";
+ for (const t of config.beforeLaunch ?? []) {
+ if (t.kind === "run" && (t.target === config.id || !all.some((c) => c.id === t.target)))
+ errors.beforeLaunch = "A before launch task runs a missing configuration or this one";
+ else if (t.kind !== "build" && t.kind !== "run" && !(t.target ?? "").trim())
+ errors.beforeLaunch = "A before launch task is incomplete";
+ }
for (const key of Object.keys(config.env)) {
if (!key.trim()) {
errors.env = "Environment variable names can't be empty";
@@ -276,3 +298,80 @@ export function formatArgs(args: readonly string[]): string {
export function commandLine(config: Pick<RunConfig, "command" | "args">): string {
return [config.command, formatArgs(config.args)].filter(Boolean).join(" ");
}
+
+/** Whether compound `config` reaches itself through its children. */
+export function compoundCycle(config: RunConfig, all: readonly RunConfig[]): boolean {
+ const byId = new Map(all.map((c) => [c.id, c]));
+ byId.set(config.id, config);
+ const seen = new Set<string>();
+ const visit = (id: string): boolean => {
+ if (seen.has(id)) return false;
+ seen.add(id);
+ return (byId.get(id)?.compound ?? []).some((child) => child === config.id || visit(child));
+ };
+ return visit(config.id);
+}
+
+/** The configurations a compound starts (nested compounds flattened, each once). */
+export function compoundChildren(config: RunConfig, all: readonly RunConfig[]): RunConfig[] {
+ const out: RunConfig[] = [];
+ const seen = new Set<string>([config.id]);
+ const walk = (ids: readonly string[]) => {
+ for (const id of ids) {
+ if (seen.has(id)) continue;
+ seen.add(id);
+ const c = all.find((x) => x.id === id);
+ if (!c) continue;
+ if (c.kind === "compound") walk(c.compound ?? []);
+ else out.push(c);
+ }
+ };
+ walk(config.compound ?? []);
+ return out;
+}
+
+/** IDEA's one-line environment field: `A=1;B=2` (`;` and `\` in values escaped). */
+export function formatEnv(env: RunConfig["env"]): string {
+ return Object.entries(env)
+ .map(([k, v]) => `${k}=${v.replace(/[\\;]/g, (c) => `\\${c}`)}`)
+ .join(";");
+}
+
+/**
+ * Parses `A=1;B=2`, or one `NAME=value` per line as pasted from a shell or a
+ * `.env` file (`export` prefixes, comments and surrounding quotes dropped).
+ */
+export function parseEnv(text: string): Array<{ key: string; value: string }> {
+ const multiline = /\r?\n/.test(text.trim());
+ const entries: string[] = [];
+ if (multiline) entries.push(...text.split(/\r?\n/));
+ else {
+ let cur = "";
+ for (let i = 0; i < text.length; i++) {
+ const ch = text[i]!;
+ if (ch === "\\" && (text[i + 1] === ";" || text[i + 1] === "\\")) cur += text[++i];
+ else if (ch === ";") {
+ entries.push(cur);
+ cur = "";
+ } else cur += ch;
+ }
+ entries.push(cur);
+ }
+ const out: Array<{ key: string; value: string }> = [];
+ for (const raw of entries) {
+ let line = multiline ? raw.trim() : raw.trimStart();
+ if (!line || (multiline && line.startsWith("#"))) continue;
+ if (multiline) line = line.replace(/^export\s+/, "");
+ const eq = line.indexOf("=");
+ if (eq <= 0) continue;
+ const key = line.slice(0, eq).trim();
+ let value = line.slice(eq + 1);
+ if (multiline) {
+ value = value.trim();
+ const q = value[0];
+ if ((q === '"' || q === "'") && value.length > 1 && value.endsWith(q)) value = value.slice(1, -1);
+ }
+ out.push({ key, value });
+ }
+ return out;
+}
diff --git a/src/features/run/executors.ts b/src/features/run/executors.ts
index 181585d60..9d8f5caff 100644
--- a/src/features/run/executors.ts
+++ b/src/features/run/executors.ts
@@ -5,11 +5,12 @@
*/
import type { RunConfig } from "@/platform/ipc";
import { notifications, useRunExecutors, type ExecutorLaunch } from "@/workbench/contributions";
-import { startRun } from "./store";
+import { prepareLaunch, startRun } from "./store";
export async function runWithExecutor(config: RunConfig, executorId: string): Promise<void> {
const executor = useRunExecutors.getState().executors.get(executorId);
if (!executor) return;
+ if (!(await prepareLaunch(config))) return;
let plan: ExecutorLaunch | null;
try {
plan = await executor.prepare(config);
diff --git a/src/features/run/externalTools.ts b/src/features/run/externalTools.ts
index dcccccd18..9bd997388 100644
--- a/src/features/run/externalTools.ts
+++ b/src/features/run/externalTools.ts
@@ -109,25 +109,32 @@ export function toolRunConfig(tool: ExternalToolValid, ctx: MacroContext, prompt
};
}
-export async function runExternalTool(tool: ExternalToolValid) {
+/** The configuration running `tool` now (macros expanded, `$Prompt$` asked); null when cancelled or not possible. */
+export async function externalToolConfig(tool: ExternalToolValid): Promise<RunConfig | null> {
const ctx = currentContext();
- if (!ctx) return;
+ if (!ctx) return null;
if (!tool.program.trim()) {
notifications().notify({ level: "warning", title: `External tool '${tool.name}' has no program` });
- return;
+ return null;
}
const uses = (m: string) => [tool.program, tool.arguments, tool.workingDirectory].some((t) => t.includes(m));
let prompt = "";
if (uses("$Prompt$")) {
const value = await promptValue(tool.name);
- if (value === null) return;
+ if (value === null) return null;
prompt = value;
}
if (!ctx.filePath && ["$FilePath$", "$FileDir$", "$FileName$", "$FileRelativePath$"].some(uses)) {
notifications().notify({ level: "warning", title: `'${tool.name}' needs an open file` });
- return;
+ return null;
}
- const session = await startRun(toolRunConfig(tool, ctx, prompt), undefined, undefined, { show: tool.openConsole });
+ return toolRunConfig(tool, ctx, prompt);
+}
+
+export async function runExternalTool(tool: ExternalToolValid) {
+ const config = await externalToolConfig(tool);
+ if (!config) return;
+ const session = await startRun(config, undefined, undefined, { show: tool.openConsole });
if (!session || !tool.synchronizeAfter) return;
// "Synchronize files after execution": reload the project from disk once the tool exits.
let done = false;
diff --git a/src/features/run/index.ts b/src/features/run/index.ts
index 8624da4ec..d2910c255 100644
--- a/src/features/run/index.ts
+++ b/src/features/run/index.ts
@@ -14,6 +14,8 @@ import {
notifications,
registerMenuGroup,
registerOverlay,
+ registerRunAnythingProvider,
+ registerServiceProvider,
registerTitleItem,
registerToolWindow,
} from "@/workbench/contributions";
@@ -33,12 +35,22 @@ import { RunDialogsOverlay } from "./dialogs";
import { registerExternalTools } from "./externalTools";
import { EditConfigsOverlay } from "./EditConfigsDialog";
import { RunWidget } from "./RunWidget";
+import { runConfigsRunAnything } from "./runAnything";
+import { runServiceProvider } from "./services";
+import { runBeforeLaunch } from "./beforeLaunch";
+import { compoundChildren } from "./configs";
+import { registerBuiltinTypes } from "./types";
import { runGutter } from "./runGutter";
import { activateStackTrace, useStackTraces } from "./stackTrace";
import { clearRuntimeCache } from "./runtimes";
import {
adoptTemporary,
applyConsoleSettings,
+ CURRENT_FILE,
+ currentFileSelected,
+ prepareLaunch,
+ sessionsOf,
+ setBeforeLaunchRunner,
loadConfigs,
failedTests,
onRunExited,
@@ -64,6 +76,7 @@ async function ensureConfigs() {
async function runSelected() {
await ensureConfigs();
+ if (currentFileSelected()) return runCurrentFile(false);
const config = selectedConfig();
if (!config) {
useRun.setState({ chooserOpen: true, chooserMode: "run" });
@@ -72,7 +85,14 @@ async function runSelected() {
await startRun(config);
}
-async function debugConfig(config: RunConfig) {
+async function debugConfig(config: RunConfig, chain: readonly string[] = []) {
+ if (config.kind === "compound") {
+ if (!(await prepareLaunch(config, chain))) return;
+ const children = compoundChildren(config, useRun.getState().configs);
+ await Promise.all(children.map((c) => debugConfig(c, [...chain, config.id])));
+ return;
+ }
+ if (!(await prepareLaunch(config, chain))) return;
// A single compiled file (rustc / clang): build with debug info, then debug the binary.
const compiled = await compiledDebugPlan(config);
if (compiled?.debug) {
@@ -95,11 +115,12 @@ async function debugConfig(config: RunConfig) {
body: `Running '${config.name}' without the debugger.`,
key: "run-no-debugger",
});
- await startRun(config);
+ await startRun(config, undefined, undefined, { prepared: true });
}
async function debugSelected() {
await ensureConfigs();
+ if (currentFileSelected()) return runCurrentFile(true);
const config = selectedConfig();
if (!config) {
useRun.setState({ chooserOpen: true, chooserMode: "debug" });
@@ -112,6 +133,12 @@ async function runContext(debug: boolean, arg?: unknown) {
if (!(await runContextAction(debug, arg))) nothingToRun();
}
+/** "Current File" stays selected after running the file's context (which adopts a temporary configuration). */
+async function runCurrentFile(debug: boolean) {
+ await runContext(debug);
+ selectConfig(CURRENT_FILE);
+}
+
function nothingToRun() {
notifications().notify({
group: "run",
@@ -156,6 +183,15 @@ function stopAction() {
return;
}
}
+ // A selected compound stops all of its configurations.
+ const selected = selectedConfig();
+ if (selected?.kind === "compound") {
+ const own = sessionsOf(selected, running);
+ if (own.length) {
+ own.forEach((s) => void stopSession(s.id));
+ return;
+ }
+ }
const items = [
...running.map((s): MenuItem => ({ label: s.config.name, verbatim: true, icon: "run", run: () => void stopSession(s.id) })),
...menuGroupItems("stopProcess", { paths: [] }),
@@ -208,10 +244,13 @@ export function activate(): () => void {
headerContent: lazyComponent(() => import("./RunView").then((m) => m.RunTabs)),
useBadge: useRunningCount,
}),
- registerTitleItem({ id: "run.widget", align: "right", priority: 0, component: RunWidget }),
+ registerTitleItem({ id: "run.widget", title: "Run Widget", align: "right", priority: 0, component: RunWidget }),
+ registerRunAnythingProvider(runConfigsRunAnything),
+ registerBuiltinTypes(),
registerOverlay({ id: "run.chooser", component: ConfigChooserOverlay }),
registerOverlay({ id: "run.editConfigs", component: EditConfigsOverlay }),
registerOverlay({ id: "run.dialogs", component: RunDialogsOverlay }),
+ registerServiceProvider(runServiceProvider),
onWorkflowSettingsChange((w) => w.console, applyConsoleSettings),
registerExternalTools(),
activateStackTrace(),
@@ -380,6 +419,10 @@ export function activate(): () => void {
return;
}
await ensureConfigs();
+ if (config === undefined && currentFileSelected()) {
+ if (!(await executeContext(executor, undefined))) nothingToRun();
+ return;
+ }
const target = config !== undefined ? configFromArg(config) : selectedConfig();
if (!target) {
useRun.setState({ chooserOpen: true, chooserMode: "run" });
@@ -418,6 +461,8 @@ export function activate(): () => void {
}),
];
+ setBeforeLaunchRunner(runBeforeLaunch);
+ disposers.push(() => setBeforeLaunchRunner(null));
if (hasProject()) void loadConfigs();
// Reload when run.toml or build files change on disk (cheap; detection is fast).
diff --git a/src/features/run/runAnything.ts b/src/features/run/runAnything.ts
new file mode 100644
index 000000000..c1607b5ab
--- /dev/null
+++ b/src/features/run/runAnything.ts
@@ -0,0 +1,39 @@
+/** Run Anything entries for run configurations (npm scripts, cargo targets, user configurations…). */
+import { executeAction } from "@/platform/actions";
+import type { RunConfig } from "@/platform/ipc";
+import type { RunAnythingItem, RunAnythingProvider } from "@/workbench/contributions";
+import { useRun } from "./store";
+
+const KIND_ICON: Record<string, string> = { npm: "file-npm", maven: "file-maven", gradle: "file-gradle" };
+
+function item(c: RunConfig): RunAnythingItem {
+ return {
+ key: c.id,
+ label: c.name,
+ detail: c.kind,
+ icon: KIND_ICON[c.kind] ?? "run",
+ run: () => void executeAction("run.runConfig", c.id),
+ };
+}
+
+/** Configurations whose name contains every word of `query`, best (prefix) matches first. */
+export function matchingConfigs(configs: readonly RunConfig[], query: string): RunConfig[] {
+ const words = query.toLowerCase().split(/\s+/).filter(Boolean);
+ const q = query.trim().toLowerCase();
+ return configs
+ .filter((c) => words.every((w) => c.name.toLowerCase().includes(w)))
+ .sort((a, b) => Number(b.name.toLowerCase().startsWith(q)) - Number(a.name.toLowerCase().startsWith(q)));
+}
+
+export const runConfigsRunAnything: RunAnythingProvider = {
+ id: "run.configs",
+ group: "Run Configurations",
+ order: 10,
+ items: (query) => matchingConfigs(useRun.getState().configs, query).map(item),
+ execute(line) {
+ const config = useRun.getState().configs.find((c) => c.name === line.trim());
+ if (!config) return false;
+ void executeAction("run.runConfig", config.id);
+ return true;
+ },
+};
diff --git a/src/features/run/runConfigTypes.test.tsx b/src/features/run/runConfigTypes.test.tsx
new file mode 100644
index 000000000..c59de6771
--- /dev/null
+++ b/src/features/run/runConfigTypes.test.tsx
@@ -0,0 +1,304 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { fireEvent, render, screen } from "@testing-library/react";
+import { registerActions } from "@/platform/actions";
+import { setContext } from "@/platform/context";
+import type { RunConfig } from "@/platform/ipc";
+import {
+ provideNotificationService,
+ provideToolWindowService,
+ registerToolWindow,
+ runConfigTypes,
+ type ToolWindowService,
+} from "@/workbench/contributions";
+import { typeRows } from "./AddConfigPopup";
+import { runBeforeLaunch } from "./beforeLaunch";
+import { buildRows } from "./ConfigChooser";
+import { compoundChildren, compoundCycle, formatEnv, parseEnv, validateConfig } from "./configs";
+import { EditConfigsOverlay, moveConfig, treeRows } from "./EditConfigsDialog";
+import { pasteRows } from "./EnvDialog";
+import { CURRENT_FILE, resetRuns, selectConfig, sessionsOf, startCompound, useRun } from "./store";
+import {
+ BUILTIN_TYPES,
+ formParams,
+ missingParams,
+ newConfigOfType,
+ registerBuiltinTypes,
+ typeFor,
+ withParams,
+} from "./types";
+
+vi.mock("./dialogs", () => ({
+ confirmRerun: vi.fn(async () => true),
+ confirmTerminate: vi.fn(),
+ promptValue: vi.fn(),
+ RunDialogsOverlay: () => null,
+}));
+
+const cfg = (id: string, extra: Partial<RunConfig> = {}): RunConfig => ({
+ id,
+ name: id,
+ kind: "shell",
+ command: "x",
+ args: [],
+ cwd: null,
+ env: {},
+ detected: false,
+ isTest: false,
+ debugAdapter: null,
+ ...extra,
+});
+
+let disposeTypes: () => void;
+const notify = vi.fn();
+const show = vi.fn();
+
+beforeEach(() => {
+ resetRuns();
+ disposeTypes = registerBuiltinTypes();
+ notify.mockClear();
+ show.mockClear();
+ provideToolWindowService({ show, isVisible: () => true } as unknown as ToolWindowService);
+ provideNotificationService({ notify });
+});
+
+afterEach(() => disposeTypes());
+
+describe("configuration types", () => {
+ it("are contributed through the registry", () => {
+ expect(runConfigTypes().map((t) => t.id)).toEqual(expect.arrayContaining(BUILTIN_TYPES.map((t) => t.id)));
+ });
+
+ it("old run.toml entries edit as a Shell Script command line", () => {
+ const old = cfg("user:server", { command: "cargo", args: ["run", "--bin", "my app"] });
+ const params = formParams(old)!;
+ expect(params).toEqual({ mode: "command", command: "cargo", args: "run --bin 'my app'" });
+ expect(withParams(old, params)).toMatchObject({ command: "cargo", args: ["run", "--bin", "my app"] });
+ });
+
+ it("shell script files and text derive the command line", () => {
+ const c = cfg("s");
+ expect(
+ withParams(c, {
+ mode: "file",
+ path: "scripts/build.sh",
+ options: "--fast",
+ interpreter: "/bin/bash",
+ interpreterOptions: "-e",
+ }),
+ ).toMatchObject({
+ command: "/bin/bash",
+ args: ["-e", "scripts/build.sh", "--fast"],
+ });
+ expect(withParams(c, { mode: "file", path: "./run.sh" })).toMatchObject({ command: "./run.sh", args: [] });
+ expect(withParams(c, { mode: "text", script: "echo a && echo b" })).toMatchObject({
+ command: "echo a && echo b",
+ args: [],
+ });
+ });
+
+ it("detected npm / Gradle configurations open in their forms when they fit", () => {
+ const npm = cfg("npm:dev", {
+ kind: "npm",
+ command: "pnpm",
+ args: ["run", "dev", "--port", "3000"],
+ cwd: "web",
+ detected: true,
+ });
+ expect(formParams(npm)).toEqual({
+ packageManager: "pnpm",
+ command: "run",
+ script: "dev",
+ arguments: "--port 3000",
+ packageDir: "web",
+ });
+ const gradle = cfg("gradle:test", { kind: "gradle", command: "./gradlew", args: ["test"], detected: true });
+ expect(formParams(gradle)).toMatchObject({ tasks: "test", wrapper: "true" });
+ // A toolchain-specific command line the form can't reproduce stays a plain command.
+ expect(formParams(cfg("m", { kind: "maven", command: "/opt/maven/bin/mvn", args: ["package"] }))).toBeNull();
+ expect(withParams(npm, { packageManager: "npm", command: "test", packageDir: "" })).toMatchObject({
+ command: "npm",
+ args: ["test"],
+ cwd: null,
+ });
+ });
+
+ it("new configurations get the type's defaults, then the template", () => {
+ const template = cfg("template:npm", {
+ kind: "npm",
+ env: { NODE_ENV: "development" },
+ params: { packageManager: "pnpm", command: "run", script: "dev" },
+ beforeLaunch: [{ kind: "build", target: "" }],
+ allowParallel: true,
+ });
+ const c = newConfigOfType(typeFor("npm")!, [], template, "Web");
+ expect(c).toMatchObject({
+ kind: "npm",
+ name: "Unnamed",
+ command: "pnpm",
+ args: ["run", "dev"],
+ env: { NODE_ENV: "development" },
+ allowParallel: true,
+ folder: "Web",
+ local: true,
+ beforeLaunch: [{ kind: "build", target: "" }],
+ });
+ expect(c.id.startsWith("user:")).toBe(true);
+ expect(missingParams(newConfigOfType(typeFor("program")!, []))).toEqual({ program: "Executable is required" });
+ });
+
+ it("Add New Configuration lists, groups and filters types", () => {
+ const types = [
+ ...runConfigTypes(),
+ { ...BUILTIN_TYPES[0]!, id: "docker-image", label: "Docker Image", group: "Docker" },
+ ];
+ const rows = typeRows(types, "");
+ expect(rows.find((r) => r.kind === "group")).toMatchObject({ label: "Docker" });
+ expect(rows.filter((r) => r.kind === "type").map((r) => (r.kind === "type" ? r.type.label : ""))).toContain(
+ "Compound",
+ );
+ expect(typeRows(types, "grad").map((r) => r.key)).toEqual(["gradle"]);
+ expect(typeRows(types, "dock").map((r) => r.key)).toEqual(["group:Docker", "docker-image"]);
+ });
+});
+
+describe("compound configurations", () => {
+ const a = cfg("a");
+ const b = cfg("b");
+ const inner = cfg("inner", { kind: "compound", command: "", compound: ["b", "a"] });
+ const outer = cfg("outer", { kind: "compound", command: "", compound: ["a", "inner"] });
+
+ it("flatten their members and reject cycles", () => {
+ expect(compoundChildren(outer, [a, b, inner, outer]).map((c) => c.id)).toEqual(["a", "b"]);
+ const loop = { ...inner, compound: ["outer"] };
+ expect(compoundCycle(loop, [a, b, loop, outer])).toBe(true);
+ expect(validateConfig(loop, [a, b, loop, outer]).compound).toMatch(/itself/);
+ expect(validateConfig(cfg("empty", { kind: "compound", command: "" })).compound).toMatch(/at least one/);
+ expect(validateConfig(outer, [a, b, inner, outer])).toEqual({});
+ });
+
+ it("run all members; the compound's sessions are theirs", async () => {
+ useRun.setState({ configs: [a, b, inner, outer] });
+ const sessions = await startCompound(outer);
+ expect(sessions.map((s) => s.config.id).sort()).toEqual(["a", "b"]);
+ expect(
+ sessionsOf(outer)
+ .map((s) => s.config.id)
+ .sort(),
+ ).toEqual(["a", "b"]);
+ });
+});
+
+describe("before launch tasks", () => {
+ it("run in order and a failure aborts", async () => {
+ const dispose = registerToolWindow({
+ id: "todo",
+ title: "TODO",
+ icon: "todo",
+ anchor: "bottom",
+ component: () => null,
+ });
+ const build = vi.fn(async () => setContext("build.lastStatus", "success"));
+ const disposeBuild = registerActions([{ id: "build.buildProject", title: "Build Project", run: build }]);
+ const app = cfg("app", {
+ beforeLaunch: [
+ { kind: "build", target: "" },
+ { kind: "toolWindow", target: "todo" },
+ ],
+ });
+ expect(await runBeforeLaunch(app, [app.id])).toBe(true);
+ expect(build).toHaveBeenCalledOnce();
+ expect(show).toHaveBeenCalledWith("todo", true);
+
+ build.mockImplementation(async () => setContext("build.lastStatus", "failed"));
+ show.mockClear();
+ expect(await runBeforeLaunch(app, [app.id])).toBe(false);
+ expect(show).not.toHaveBeenCalled();
+ expect(notify).toHaveBeenCalledWith(expect.objectContaining({ title: "'app' was not started" }));
+
+ // Another configuration that can't run (no desktop app in tests) fails the launch; cycles are refused.
+ const other = cfg("other");
+ useRun.setState({ configs: [app, other] });
+ expect(await runBeforeLaunch(cfg("x", { beforeLaunch: [{ kind: "run", target: "other" }] }), ["x"])).toBe(false);
+ expect(await runBeforeLaunch(cfg("x", { beforeLaunch: [{ kind: "run", target: "x" }] }), ["x"])).toBe(false);
+ dispose();
+ disposeBuild();
+ });
+});
+
+describe("environment variables", () => {
+ it("format and parse the one-line field and pasted lines", () => {
+ const env = { A: "1", B: "x;y\\z" };
+ expect(formatEnv(env)).toBe("A=1;B=x\\;y\\\\z");
+ expect(parseEnv(formatEnv(env))).toEqual([
+ { key: "A", value: "1" },
+ { key: "B", value: "x;y\\z" },
+ ]);
+ expect(parseEnv('# comment\nexport A=1\nB = "two words"\n\nbad\n')).toEqual([
+ { key: "A", value: "1" },
+ { key: "B", value: "two words" },
+ ]);
+ expect(pasteRows([{ key: "A", value: "0" }], "A=1;C=3")).toEqual([
+ { key: "A", value: "1" },
+ { key: "C", value: "3" },
+ ]);
+ });
+});
+
+describe("Run/Debug Configurations tree", () => {
+ const configs = [
+ cfg("a", { kind: "npm", folder: "Web" }),
+ cfg("b", { kind: "npm" }),
+ cfg("c", { kind: "npm", folder: "Web" }),
+ cfg("d", { kind: "shell" }),
+ ];
+
+ it("groups by type with folders first", () => {
+ expect(treeRows(configs, [{ kind: "shell", name: "Empty" }]).map((r) => r.key)).toEqual([
+ "g:npm",
+ "f:npm:Web",
+ "c:a",
+ "c:c",
+ "c:b",
+ "g:shell",
+ "f:shell:Empty",
+ "c:d",
+ ]);
+ expect(treeRows(configs, [], new Set(["f:npm:Web"])).map((r) => r.key)).toEqual([
+ "g:npm",
+ "f:npm:Web",
+ "c:b",
+ "g:shell",
+ "c:d",
+ ]);
+ });
+
+ it("moves within the same type and folder", () => {
+ expect(moveConfig(configs, "c", -1).map((c) => c.id)).toEqual(["c", "b", "a", "d"]);
+ expect(moveConfig(configs, "b", -1).map((c) => c.id)).toEqual(["a", "b", "c", "d"]);
+ });
+
+ it("adds a configuration of the picked type and edits it", async () => {
+ useRun.setState({ configs: [], loaded: true, editorOpen: true });
+ render(<EditConfigsOverlay />);
+ expect(screen.getByText("No run configurations added.")).toBeTruthy();
+ fireEvent.click(screen.getByRole("button", { name: "Add New Configuration" }));
+ fireEvent.click(await screen.findByText("Program"));
+ expect((screen.getByLabelText("Name") as HTMLInputElement).value).toBe("Unnamed");
+ fireEvent.change(screen.getByLabelText("Executable"), { target: { value: "./server" } });
+ fireEvent.change(screen.getByLabelText("Program arguments"), { target: { value: "--port 1" } });
+ expect(screen.getByText("./server --port 1")).toBeTruthy();
+ // Modify options adds "Redirect input".
+ fireEvent.click(screen.getByRole("button", { name: /Modify options/ }));
+ fireEvent.click(await screen.findByText("Redirect input"));
+ expect(screen.getByLabelText("Redirect input from")).toBeTruthy();
+ });
+});
+
+describe("Current File", () => {
+ it("is always offered in the chooser", () => {
+ expect(buildRows([], "")[0]).toMatchObject({ type: "current" });
+ expect(buildRows([cfg("a")], "cur").map((r) => r.type)).toEqual(["current", "edit"]);
+ selectConfig(CURRENT_FILE);
+ expect(useRun.getState().selectedId).toBe(CURRENT_FILE);
+ });
+});
diff --git a/src/features/run/services.test.ts b/src/features/run/services.test.ts
new file mode 100644
index 000000000..3390e5735
--- /dev/null
+++ b/src/features/run/services.test.ts
@@ -0,0 +1,76 @@
+import { describe, expect, it } from "vitest";
+import type { RunConfig } from "@/platform/ipc";
+import { runServiceItems, sessionStatus } from "./services";
+import type { RunSession } from "./store";
+
+const config = (id: string, kind: string): RunConfig => ({
+ id,
+ name: id,
+ kind,
+ command: kind,
+ args: [],
+ cwd: null,
+ env: {},
+ detected: true,
+ isTest: false,
+ debugAdapter: null,
+});
+
+const session = (
+ id: string,
+ c: RunConfig,
+ status: RunSession["status"],
+ startedAt: number,
+ extra: Partial<RunSession> = {},
+): RunSession => ({
+ id,
+ config: c,
+ runId: null,
+ status,
+ exitCode: null,
+ startedAt,
+ endedAt: null,
+ stdinClosed: false,
+ ...extra,
+});
+
+describe("run configurations in Services", () => {
+ const build = config("build", "cargo");
+ const test = config("test", "cargo");
+ const dev = config("dev", "npm");
+ const scratch = config("context:file", "python");
+
+ it("lists added types fully and other types only with their runs", () => {
+ const sessions = [
+ session("s1", dev, "finished", 1),
+ session("s2", dev, "running", 2),
+ session("s3", scratch, "failed", 3, { exitCode: 2 }),
+ ];
+ const items = runServiceItems([build, test, dev], sessions, ["cargo"]);
+ expect(items.map((i) => [i.key, i.label, i.detail])).toEqual([
+ ["run:type:cargo", "Cargo", undefined],
+ ["run:type:npm", "npm", "1 running"],
+ ["run:type:python", "Python", undefined],
+ ]);
+ expect(items[0]!.children!.map((c) => [c.key, c.detail, c.dim])).toEqual([
+ ["run:config:build", undefined, true],
+ ["run:config:test", undefined, true],
+ ]);
+ // The newest session of a configuration decides its state.
+ expect(items[1]!.children!.map((c) => [c.label, c.detail, c.dim, c.icon])).toEqual([
+ ["dev", "Running", false, "run"],
+ ]);
+ expect(items[2]!.children!.map((c) => [c.key, c.detail])).toEqual([["run:config:context:file", "Failed (exit 2)"]]);
+ });
+
+ it("has no groups without added types or sessions", () => {
+ expect(runServiceItems([build], [], [])).toEqual([]);
+ });
+
+ it("describes session states", () => {
+ expect(sessionStatus(undefined)).toBeUndefined();
+ expect(sessionStatus(session("a", build, "starting", 0))).toBe("Starting");
+ expect(sessionStatus(session("a", build, "failed", 0, { stopped: true }))).toBe("Stopped");
+ expect(sessionStatus(session("a", build, "finished", 0))).toBe("Finished");
+ });
+});
diff --git a/src/features/run/services.tsx b/src/features/run/services.tsx
new file mode 100644
index 000000000..597453d8d
--- /dev/null
+++ b/src/features/run/services.tsx
@@ -0,0 +1,318 @@
+/**
+ * Run configurations in the Services tool window (IDEA's Run Dashboard): the
+ * configuration types added there ("Add Service › Run Configuration Type") and
+ * the types of this window's run sessions, one group each, with run / stop /
+ * rerun / show output per configuration.
+ */
+import { useEffect, useMemo } from "react";
+import { create } from "zustand";
+import { executeAction } from "@/platform/actions";
+import type { RunConfig } from "@/platform/ipc";
+import { useProject } from "@/platform/project";
+import { useT, useTxTemplate } from "@/platform/i18n";
+import { Button, EmptyState, T } from "@/ui";
+import type { MenuItem } from "@/ui";
+import {
+ toolWindowService,
+ type ServiceItemAction,
+ type ServiceProviderContribution,
+ type ServiceTreeItem,
+} from "@/workbench/contributions";
+import { commandLine, configIcon, KIND_OPTIONS, kindLabel } from "./configs";
+import { rerunSession, stopSession, useRun, type RunSession } from "./store";
+import styles from "./RunServices.module.css";
+
+export const RUN_PROVIDER = "runConfigurations";
+const TYPE_PREFIX = "run:type:";
+const CONFIG_PREFIX = "run:config:";
+const STORAGE_KEY = "openidea.services.runTypes:";
+
+// ---------------------------------------------------------------------------
+// Types added to Services, per project
+
+const useAddedTypes = create<{ root: string | null; types: string[] }>(() => ({ root: null, types: [] }));
+
+function readTypes(root: string): string[] {
+ try {
+ const v: unknown = JSON.parse(localStorage.getItem(STORAGE_KEY + root) ?? "[]");
+ return Array.isArray(v) ? v.filter((x): x is string => typeof x === "string") : [];
+ } catch {
+ return [];
+ }
+}
+
+function addedTypes(root: string | null): string[] {
+ const s = useAddedTypes.getState();
+ return s.root === root ? s.types : root ? readTypes(root) : [];
+}
+
+function setAddedTypes(types: string[]) {
+ const root = useProject.getState().project?.root ?? null;
+ useAddedTypes.setState({ root, types });
+ if (!root) return;
+ try {
+ localStorage.setItem(STORAGE_KEY + root, JSON.stringify(types));
+ } catch {
+ /* storage unavailable */
+ }
+}
+
+export function addType(kind: string) {
+ const types = addedTypes(useProject.getState().project?.root ?? null);
+ if (!types.includes(kind)) setAddedTypes([...types, kind]);
+}
+
+export function removeType(kind: string) {
+ setAddedTypes(addedTypes(useProject.getState().project?.root ?? null).filter((t) => t !== kind));
+}
+
+// ---------------------------------------------------------------------------
+// Tree
+
+const busy = (s: RunSession) => s.status === "running" || s.status === "starting";
+
+/** The newest session of each configuration id. */
+function latestSessions(sessions: readonly RunSession[]): Map<string, RunSession> {
+ const out = new Map<string, RunSession>();
+ for (const s of sessions) {
+ const prev = out.get(s.config.id);
+ if (!prev || s.startedAt >= prev.startedAt) out.set(s.config.id, s);
+ }
+ return out;
+}
+
+export function sessionStatus(s: RunSession | undefined): string | undefined {
+ if (!s) return undefined;
+ if (busy(s)) return s.status === "starting" ? "Starting" : "Running";
+ if (s.stopped) return "Stopped";
+ if (s.status === "failed") return s.exitCode === null ? "Failed" : `Failed (exit ${s.exitCode})`;
+ return "Finished";
+}
+
+/** Groups by configuration type: added types list all their configurations, other types only those that ran. */
+export function runServiceItems(
+ configs: readonly RunConfig[],
+ sessions: readonly RunSession[],
+ added: readonly string[],
+): ServiceTreeItem[] {
+ const latest = latestSessions(sessions);
+ const kinds = [...added];
+ for (const s of sessions) if (!kinds.includes(s.config.kind)) kinds.push(s.config.kind);
+ return kinds.map((kind) => {
+ const entries: RunConfig[] = added.includes(kind) ? configs.filter((c) => c.kind === kind) : [];
+ for (const s of latest.values())
+ if (s.config.kind === kind && !entries.some((c) => c.id === s.config.id)) entries.push(s.config);
+ const children = entries.map((c): ServiceTreeItem => {
+ const s = latest.get(c.id);
+ return {
+ key: CONFIG_PREFIX + c.id,
+ label: c.name,
+ icon: s && busy(s) ? "run" : configIcon(c),
+ detail: sessionStatus(s),
+ dim: !s || !busy(s),
+ };
+ });
+ const running = entries.filter((c) => {
+ const s = latest.get(c.id);
+ return !!s && busy(s);
+ }).length;
+ return {
+ key: TYPE_PREFIX + kind,
+ label: kindLabel(kind),
+ icon: configIcon({ kind, isTest: false }),
+ detail: running ? `${running} running` : undefined,
+ children,
+ };
+ });
+}
+
+function useRoots(): ServiceTreeItem[] {
+ const root = useProject((s) => s.project?.root ?? null);
+ const configs = useRun((s) => s.configs);
+ const sessions = useRun((s) => s.sessions);
+ const types = useAddedTypes((s) => s.types);
+ const typesRoot = useAddedTypes((s) => s.root);
+ useEffect(() => {
+ if (typesRoot !== root) useAddedTypes.setState({ root, types: root ? readTypes(root) : [] });
+ }, [root, typesRoot]);
+ return useMemo(
+ () => runServiceItems(configs, sessions, typesRoot === root ? types : []),
+ [configs, sessions, types, typesRoot, root],
+ );
+}
+
+interface Resolved {
+ kind: string | null;
+ config: RunConfig | null;
+ session: RunSession | undefined;
+ /** Sessions of a group's configurations. */
+ sessions: RunSession[];
+}
+
+function resolve(item: ServiceTreeItem): Resolved {
+ const { configs, sessions } = useRun.getState();
+ const latest = latestSessions(sessions);
+ if (item.key.startsWith(TYPE_PREFIX)) {
+ const kind = item.key.slice(TYPE_PREFIX.length);
+ return { kind, config: null, session: undefined, sessions: sessions.filter((s) => s.config.kind === kind) };
+ }
+ const id = item.key.slice(CONFIG_PREFIX.length);
+ const session = latest.get(id);
+ const config = configs.find((c) => c.id === id) ?? session?.config ?? null;
+ return { kind: config?.kind ?? null, config, session, sessions: session ? [session] : [] };
+}
+
+function showOutput(s: RunSession) {
+ useRun.setState({ activeSession: s.id });
+ toolWindowService().show("run", true);
+}
+
+function run(r: Resolved) {
+ if (r.session && r.session.config.id === r.config?.id) rerunSession(r.session.id);
+ else if (r.config) void executeAction("run.runConfig", r.config);
+}
+
+function actions(item: ServiceTreeItem): ServiceItemAction[] {
+ const r = resolve(item);
+ const running = r.sessions.filter(busy);
+ const stop = {
+ id: "stop",
+ title: "Stop",
+ icon: "stop",
+ disabled: !running.length,
+ run: () => running.forEach((s) => void stopSession(s.id)),
+ };
+ if (!r.config) return [stop];
+ const live = !!r.session && busy(r.session);
+ return [
+ { id: "run", title: live ? "Rerun" : "Run", icon: live ? "rerun" : "run", run: () => run(r) },
+ stop,
+ {
+ id: "output",
+ title: "Show Output",
+ icon: "toolwindow-run",
+ disabled: !r.session,
+ run: () => r.session && showOutput(r.session),
+ },
+ ];
+}
+
+function menu(item: ServiceTreeItem): MenuItem[] {
+ const items: MenuItem[] = actions(item).map((a) => ({
+ label: a.title,
+ icon: a.icon,
+ disabled: a.disabled,
+ run: a.run,
+ }));
+ const r = resolve(item);
+ if (!r.config && r.kind && addedTypes(useProject.getState().project?.root ?? null).includes(r.kind)) {
+ const kind = r.kind;
+ items.push({ kind: "separator" }, { label: "Remove from Services", icon: "close", run: () => removeType(kind) });
+ }
+ if (r.config) {
+ const config = r.config;
+ items.push(
+ { kind: "separator" },
+ { label: "Edit Configuration…", icon: "edit", run: () => void executeAction("run.editConfigs", config.id) },
+ );
+ }
+ return items;
+}
+
+function RunDetail({ item }: { item: ServiceTreeItem }) {
+ // Re-render on session changes.
+ useRun((s) => s.sessions);
+ const t = useT();
+ const txTemplate = useTxTemplate();
+ const r = resolve(item);
+ if (!r.config)
+ return (
+ <EmptyState title={kindLabel(r.kind ?? "")}>
+ <div>
+ {item.children?.length
+ ? t("run.services.configurationCount", { count: item.children.length })
+ : txTemplate("No configurations of this type")}
+ </div>
+ </EmptyState>
+ );
+ const s = r.session;
+ const live = !!s && busy(s);
+ return (
+ <div className={styles.detail}>
+ <dl className={styles.facts}>
+ <dt>
+ <T>Configuration</T>
+ </dt>
+ <dd>{r.config.name}</dd>
+ <dt>
+ <T>Type</T>
+ </dt>
+ <dd>
+ <T>{kindLabel(r.config.kind)}</T>
+ </dd>
+ <dt>
+ <T>Command</T>
+ </dt>
+ <dd className={styles.mono}>{commandLine(r.config)}</dd>
+ <dt>
+ <T>Status</T>
+ </dt>
+ <dd>{txTemplate(sessionStatus(s) ?? "Not started")}</dd>
+ {s && (
+ <>
+ <dt>
+ <T>Started</T>
+ </dt>
+ <dd>{new Date(s.startedAt).toLocaleTimeString()}</dd>
+ </>
+ )}
+ </dl>
+ <div className={styles.actions}>
+ <Button icon={live ? "rerun" : "run"} onClick={() => run(r)}>
+ {live ? "Rerun" : "Run"}
+ </Button>
+ <Button icon="stop" disabled={!live} onClick={() => s && void stopSession(s.id)}>
+ Stop
+ </Button>
+ <Button icon="toolwindow-run" disabled={!s} onClick={() => s && showOutput(s)}>
+ Show Output
+ </Button>
+ </div>
+ </div>
+ );
+}
+
+/** "Add Service › Run Configuration Type": the project's types first, then the rest. */
+function addMenu(): MenuItem[] {
+ const added = addedTypes(useProject.getState().project?.root ?? null);
+ const used = [...new Set(useRun.getState().configs.map((c) => c.kind))];
+ const kinds = [...used, ...KIND_OPTIONS.map((o) => o.value).filter((k) => !used.includes(k))].filter(
+ (k) => !added.includes(k),
+ );
+ const item = (kind: string): MenuItem => ({
+ label: kindLabel(kind),
+ icon: configIcon({ kind, isTest: false }),
+ run: () => addType(kind),
+ });
+ const submenu: MenuItem[] = [
+ ...kinds.filter((k) => used.includes(k)).map(item),
+ ...(used.some((k) => kinds.includes(k)) ? [{ kind: "separator" } as MenuItem] : []),
+ ...kinds.filter((k) => !used.includes(k)).map(item),
+ ];
+ return [{ label: "Run Configuration Type", icon: "toolwindow-run", disabled: !submenu.length, submenu }];
+}
+
+export const runServiceProvider: ServiceProviderContribution = {
+ id: RUN_PROVIDER,
+ order: 0,
+ useRoots,
+ actions,
+ menu,
+ activate: (item) => {
+ const r = resolve(item);
+ if (r.session) showOutput(r.session);
+ else if (r.config) run(r);
+ },
+ detail: RunDetail,
+ addMenu,
+};
diff --git a/src/features/run/store.ts b/src/features/run/store.ts
index 62b468ffe..dc01e7a73 100644
--- a/src/features/run/store.ts
+++ b/src/features/run/store.ts
@@ -17,6 +17,12 @@ import { confirmRerun, confirmTerminate } from "./dialogs";
import { createTestParser, frameworkFor, TestResults, withTestReporting, type TestEvent, type TestOutputParser } from "./testing";
import { recordTestStates } from "./testing/states";
import { failedTestPaths, leafTestPaths, rerunFailedConfig, testsConfig } from "./testing/rerun";
+import { compoundChildren } from "./configs";
+import { TerminalOutput } from "./terminalOutput";
+import { typeFor } from "./types";
+
+/** The permanent "Current File" pseudo-configuration of the chooser (runs the active file's context). */
+export const CURRENT_FILE = "current-file";
export type SessionStatus = "starting" | "running" | "finished" | "failed";
@@ -33,6 +39,8 @@ export interface RunSession {
stopped?: boolean;
/** The unfiltered configuration when this run was started by "Rerun Failed Tests". */
baseConfig?: RunConfig;
+ /** "Emulate terminal in output console": the output is a terminal. */
+ terminal?: boolean;
}
interface SessionRuntime {
@@ -49,6 +57,10 @@ interface SessionRuntime {
onExit?: (exitCode: number | null, stopped: boolean) => void;
/** User input typed into the console, not yet sent (IDEA: Enter sends the line). */
input: string;
+ /** Output of a run that emulates a terminal (instead of `console`). */
+ terminal: TerminalOutput | null;
+ /** Last size the terminal console reported (sent once the process has an id). */
+ terminalSize: { cols: number; rows: number } | null;
}
interface RunState {
@@ -137,7 +149,10 @@ export async function loadConfigs(): Promise<void> {
const temps = readTemporary(root).filter((t) => !saved.some((c) => c.id === t.id));
const configs = [...saved, ...temps];
const stored = useRun.getState().selectedId ?? readSelected(root);
- const selectedId = configs.some((c) => c.id === stored) ? stored : (defaultSelection(saved)?.id ?? null);
+ const selectedId =
+ stored === CURRENT_FILE || configs.some((c) => c.id === stored)
+ ? stored
+ : (defaultSelection(saved)?.id ?? CURRENT_FILE);
useRun.setState({ configs, temporary: temps.map((t) => t.id), loaded: true, loadError: null, selectedId });
} catch (e) {
useRun.setState({ loaded: true, loadError: e instanceof Error ? e.message : String(e) });
@@ -162,6 +177,11 @@ export function selectConfig(id: string | null) {
if (root) writeSelected(root, id);
}
+/** Whether the chooser's "Current File" is selected. */
+export function currentFileSelected(): boolean {
+ return useRun.getState().selectedId === CURRENT_FILE;
+}
+
export function selectedConfig(): RunConfig | undefined {
const { configs, selectedId } = useRun.getState();
return configs.find((c) => c.id === selectedId);
@@ -298,6 +318,10 @@ function flush(sessionId: string) {
function enqueue(sessionId: string, chunk: OutputChunk) {
const rt = runtimes.get(sessionId);
if (!rt) return;
+ if (rt.terminal) {
+ rt.terminal.append(chunk);
+ return;
+ }
rt.queue.push(chunk);
if (rt.flushHandle === null) rt.flushHandle = requestAnimationFrame(() => flush(sessionId));
}
@@ -335,10 +359,41 @@ function newRuntime(config: RunConfig): SessionRuntime {
generation: 0,
lineListeners: [],
input: "",
+ terminal: null,
+ terminalSize: null,
};
return runtime;
}
+/** Runs a configuration's before launch tasks; false aborts the launch. Installed by the feature. */
+export type BeforeLaunchRunner = (config: RunConfig, chain: readonly string[]) => Promise<boolean>;
+let beforeLaunch: BeforeLaunchRunner | null = null;
+
+export function setBeforeLaunchRunner(runner: BeforeLaunchRunner | null) {
+ beforeLaunch = runner;
+}
+
+/** Runs `config`'s before launch tasks (none: true). `chain` holds the configurations already launching. */
+export async function prepareLaunch(config: RunConfig, chain: readonly string[] = []): Promise<boolean> {
+ if (!config.beforeLaunch?.length || !beforeLaunch) return true;
+ return beforeLaunch(config, [...chain, config.id]);
+}
+
+/** Starts every configuration of a compound (after the compound's own before launch tasks). */
+export async function startCompound(config: RunConfig, chain: readonly string[] = []): Promise<RunSession[]> {
+ if (!(await prepareLaunch(config, chain))) return [];
+ const children = compoundChildren(config, useRun.getState().configs);
+ const sessions = await Promise.all(children.map((c) => startRun(c, undefined, undefined, { chain: [...chain, config.id] })));
+ return sessions.filter((s): s is RunSession => !!s);
+}
+
+/** Sessions of `config`: its own, or for a compound those of its configurations. */
+export function sessionsOf(config: RunConfig, sessions = useRun.getState().sessions): RunSession[] {
+ if (config.kind !== "compound") return sessions.filter((s) => s.config.id === config.id);
+ const ids = new Set(compoundChildren(config, useRun.getState().configs).map((c) => c.id));
+ return sessions.filter((s) => ids.has(s.config.id));
+}
+
/** Starts `config`, reusing the tab of a finished (or the given) session for the same config. */
export async function startRun(
config: RunConfig,
@@ -346,14 +401,23 @@ export async function startRun(
baseConfig?: RunConfig,
options: {
show?: boolean;
- /** Launch this instead of `config` (e.g. with a debug agent); the tab still shows `config`. */
+ /** Launch this instead of `config` (e.g. with a debug agent); the tab still shows `config`. Skips before launch tasks. */
launch?: RunConfig;
/** Every output line of this run. */
onLine?: (text: string) => void;
/** The process exited. */
onExit?: (exitCode: number | null, stopped: boolean) => void;
+ /** Before launch tasks already ran (or must not run). */
+ prepared?: boolean;
+ /** Configurations whose launch led to this one (before launch tasks, compounds): breaks cycles. */
+ chain?: readonly string[];
} = {},
): Promise<RunSession | null> {
+ if (config.kind === "compound") {
+ await startCompound(config, options.chain);
+ return null;
+ }
+ if (!options.launch && !options.prepared && !(await prepareLaunch(config, options.chain))) return null;
const state = useRun.getState();
const busy = (s: RunSession) => s.status === "running" || s.status === "starting";
let session = reuse ? state.sessions.find((s) => s.id === reuse) : undefined;
@@ -419,7 +483,8 @@ export async function startRun(
if (options.onLine) rt.lineListeners.push(options.onLine);
rt.onExit = options.onExit;
try {
- if (options.show ?? workflowSettings().run.showOnStart) toolWindowService().show("run");
+ if (config.focusToolWindow) toolWindowService().show("run", true);
+ else if (options.show ?? config.openToolWindow ?? workflowSettings().run.showOnStart) toolWindowService().show("run");
} catch {
/* no workbench (tests) */
}
@@ -433,7 +498,10 @@ export async function startRun(
const channel = new Channel<OutputChunk>();
channel.onmessage = (chunk) => {
- if (runtimes.get(sessionId)?.generation === generation) enqueue(sessionId, chunk);
+ if (runtimes.get(sessionId)?.generation !== generation) return;
+ enqueue(sessionId, chunk);
+ if ((chunk.kind === "stdout" && config.showOnStdout) || (chunk.kind === "stderr" && config.showOnStderr))
+ revealSession(sessionId);
};
try {
let launch = options.launch ?? config;
@@ -446,11 +514,22 @@ export async function startRun(
}
launch = resolved;
}
+ const prepare = typeFor(launch.kind)?.prepareLaunch;
+ if (prepare) {
+ launch = await prepare(launch);
+ if (runtimes.get(sessionId)?.generation !== generation) return getSession(sessionId) ?? null;
+ }
+ // Debug launches read the agent's output lines: never through a terminal.
+ if ((options.launch || launch.isTest) && launch.emulateTerminal) launch = { ...launch, emulateTerminal: false };
+ if (launch.emulateTerminal) rt.terminal = new TerminalOutput();
+ patchSession(sessionId, { terminal: !!launch.emulateTerminal });
const info = await call(commands.runStart(launch.isTest ? withTestReporting(launch) : launch, channel));
if (runtimes.get(sessionId)?.generation !== generation) return getSession(sessionId) ?? null;
+ if (info.pty && rt.terminalSize) void commands.runResize(info.id, rt.terminalSize.cols, rt.terminalSize.rows);
// The process may already have exited (fast commands) before we got its id.
const exited = pendingExits.get(info.id);
- patchSession(sessionId, { runId: info.id, status: "running" });
+ // "Redirect input from": stdin is the file, the console takes no input.
+ patchSession(sessionId, { runId: info.id, status: "running", stdinClosed: !!launch.stdinFile });
if (exited !== undefined) {
pendingExits.delete(info.id);
finishSession(sessionId, exited);
@@ -465,6 +544,16 @@ export async function startRun(
return getSession(sessionId) ?? null;
}
+/** "Show console when a message is printed to stdout / stderr". */
+function revealSession(sessionId: string) {
+ try {
+ if (useRun.getState().activeSession !== sessionId) useRun.setState({ activeSession: sessionId });
+ if (!toolWindowService().isVisible("run")) toolWindowService().show("run");
+ } catch {
+ /* no workbench (tests) */
+ }
+}
+
const pathSeparator = () => (typeof navigator !== "undefined" && /win/i.test(navigator.platform) ? ";" : ":");
/**
@@ -684,6 +773,23 @@ export async function sendStdin(sessionId: string, text: string): Promise<void>
}
}
+/** Keystrokes typed into a console that emulates a terminal, sent as they are. */
+export function writeTerminal(sessionId: string, data: string) {
+ const session = getSession(sessionId);
+ if (!session || session.runId === null || session.status !== "running") return;
+ void call(commands.runStdin(session.runId, data)).catch(() => undefined);
+}
+
+/** The terminal console's size in cells; the process's terminal follows it. */
+export function resizeTerminal(sessionId: string, cols: number, rows: number) {
+ const rt = runtimes.get(sessionId);
+ if (!rt || cols < 1 || rows < 1) return;
+ rt.terminalSize = { cols, rows };
+ const session = getSession(sessionId);
+ if (session?.runId != null && session.status === "running" && isTauri())
+ void call(commands.runResize(session.runId, cols, rows)).catch(() => undefined);
+}
+
export async function closeStdin(sessionId: string): Promise<void> {
const session = getSession(sessionId);
if (!session || session.runId === null || session.status !== "running") return;
@@ -697,6 +803,7 @@ export async function closeStdin(sessionId: string): Promise<void> {
export function clearConsole(sessionId: string) {
runtimes.get(sessionId)?.console.clear();
+ runtimes.get(sessionId)?.terminal?.clear();
bump(sessionId);
}
diff --git a/src/features/run/terminal.test.tsx b/src/features/run/terminal.test.tsx
new file mode 100644
index 000000000..1c2f203c0
--- /dev/null
+++ b/src/features/run/terminal.test.tsx
@@ -0,0 +1,149 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { render } from "@testing-library/react";
+
+const ipc = vi.hoisted(() => ({
+ runStart: vi.fn((_config: unknown, _channel: unknown) =>
+ Promise.resolve({
+ status: "ok" as const,
+ data: { id: 9, configId: "c", name: "c", pid: 1, running: true, pty: true },
+ }),
+ ),
+ runStdin: vi.fn((_id: unknown, _data: unknown) => Promise.resolve({ status: "ok" as const, data: null })),
+ runResize: vi.fn((_id: unknown, _c: unknown, _r: unknown) => Promise.resolve({ status: "ok" as const, data: null })),
+}));
+
+vi.mock("@/platform/ipc", async (importOriginal) => {
+ const real = await importOriginal<typeof import("@/platform/ipc")>();
+ return { ...real, isTauri: () => true, commands: { ...real.commands, ...ipc } };
+});
+vi.mock("@tauri-apps/api/core", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@tauri-apps/api/core")>()),
+ Channel: class {
+ onmessage: ((m: unknown) => void) | null = null;
+ },
+}));
+
+import type { OutputChunk, RunConfig } from "@/platform/ipc";
+import {
+ provideEmbeddedTerminal,
+ provideNotificationService,
+ provideToolWindowService,
+ registerRunConfigType,
+ type EmbeddedTerminalOptions,
+ type ToolWindowService,
+} from "@/workbench/contributions";
+import { optionPatch } from "./ConfigForm";
+import { resetRuns, resizeTerminal, runtime, startRun, useRun, writeTerminal } from "./store";
+import { TerminalConsole } from "./TerminalConsole";
+import { TerminalOutput, terminalText } from "./terminalOutput";
+import { terminalApplies, withParams } from "./types";
+
+const config = (extra: Partial<RunConfig> = {}): RunConfig => ({
+ id: "app",
+ name: "app",
+ kind: "shell",
+ command: "top",
+ args: [],
+ cwd: null,
+ env: {},
+ detected: false,
+ isTest: false,
+ debugAdapter: null,
+ ...extra,
+});
+
+const lastChannel = () => ipc.runStart.mock.calls.at(-1)![1] as { onmessage: (m: OutputChunk) => void };
+
+beforeEach(() => {
+ resetRuns();
+ for (const f of Object.values(ipc)) f.mockClear();
+ provideToolWindowService({ show: vi.fn(), isVisible: () => true } as unknown as ToolWindowService);
+ provideNotificationService({ notify: () => undefined });
+});
+afterEach(() => provideEmbeddedTerminal(undefined));
+
+describe("Emulate terminal in output console", () => {
+ it("routes the output to the terminal and sends keystrokes and size as they are", async () => {
+ const session = (await startRun(config({ emulateTerminal: true })))!;
+ expect(session.terminal).toBe(true);
+ const rt = runtime(session.id)!;
+ lastChannel().onmessage({ kind: "stdout", text: "\x1b[1mhi\x1b[0m" });
+ expect(rt.terminal!.text).toBe("\x1b[1mhi\x1b[0m");
+ expect(rt.console.lines.length).toBe(0);
+
+ writeTerminal(session.id, "q");
+ expect(ipc.runStdin).toHaveBeenCalledWith(9, "q");
+ resizeTerminal(session.id, 100, 40);
+ expect(ipc.runResize).toHaveBeenCalledWith(9, 100, 40);
+ });
+
+ it("is never used for debug launches, and plain runs keep the console", async () => {
+ const debug = (await startRun(config({ emulateTerminal: true }), undefined, undefined, {
+ launch: config({ emulateTerminal: true }),
+ }))!;
+ expect(ipc.runStart.mock.calls[0]![0]).toMatchObject({ emulateTerminal: false });
+ expect(debug.terminal).toBe(false);
+ resetRuns();
+ const plain = (await startRun(config({ id: "plain" })))!;
+ expect(plain.terminal).toBe(false);
+ expect(runtime(plain.id)!.terminal).toBeNull();
+ });
+
+ it("applies the type's launch preparation", async () => {
+ const dispose = registerRunConfigType({
+ id: "prepared",
+ label: "Prepared",
+ icon: "run",
+ fields: [],
+ commandLine: () => ({ command: "x", args: [] }),
+ prepareLaunch: async (c) => ({ ...c, env: { ...c.env, DOCKER_HOST: "tcp://box:2375" } }),
+ });
+ await startRun(config({ kind: "prepared" }));
+ expect(ipc.runStart.mock.calls[0]![0]).toMatchObject({ env: { DOCKER_HOST: "tcp://box:2375" } });
+ dispose();
+ });
+
+ it("applies to process types only, not tests or compounds", () => {
+ expect(terminalApplies(config())).toBe(true);
+ expect(terminalApplies(config({ isTest: true }))).toBe(false);
+ expect(terminalApplies(config({ kind: "compound" }))).toBe(false);
+ expect(optionPatch("isTest", true)).toEqual({ isTest: true, emulateTerminal: false });
+ });
+
+ it("keeps the type's stop command with the command line", () => {
+ const type = {
+ id: "t",
+ label: "T",
+ icon: "run",
+ fields: [],
+ commandLine: (p: Readonly<Record<string, string>>) => ({ command: "run", args: [], stop: p.stop || null }),
+ };
+ const stopped = withParams(config(), { stop: "docker stop app" }, type);
+ expect(stopped.stopCommand).toBe("docker stop app");
+ expect("stopCommand" in withParams(stopped, {}, type)).toBe(false);
+ });
+
+ it("replays the output into a terminal console and forwards its input", async () => {
+ const written: string[] = [];
+ let opts: EmbeddedTerminalOptions | null = null;
+ provideEmbeddedTerminal(async (_host, o) => {
+ opts = o;
+ return { write: (d) => written.push(d), clear: vi.fn(), focus: vi.fn(), fit: vi.fn(), dispose: vi.fn() };
+ });
+ const output = new TerminalOutput();
+ output.append({ kind: "system", text: "top\n" });
+ const onData = vi.fn();
+ render(<TerminalConsole output={output} cwd="/p" onData={onData} onResize={vi.fn()} aria-label="app terminal" />);
+ await vi.waitFor(() => expect(written).toEqual(["\x1b[2mtop\r\n\x1b[0m"]));
+ output.append({ kind: "stdout", text: "x" });
+ expect(written.at(-1)).toBe("x");
+ opts!.onData("\r");
+ expect(onData).toHaveBeenCalledWith("\r");
+ expect(useRun.getState().sessions).toEqual([]);
+ });
+
+ it("dims IDE messages and colours errors", () => {
+ expect(terminalText({ kind: "stderr", text: "bad\n" })).toBe("\x1b[31mbad\r\n\x1b[0m");
+ expect(terminalText({ kind: "stdout", text: "raw\r\n" })).toBe("raw\r\n");
+ });
+});
diff --git a/src/features/run/terminalOutput.ts b/src/features/run/terminalOutput.ts
new file mode 100644
index 000000000..37f819ec7
--- /dev/null
+++ b/src/features/run/terminalOutput.ts
@@ -0,0 +1,58 @@
+/**
+ * Output of a run that emulates a terminal: raw terminal data kept (bounded) so
+ * a console re-mounted later replays it, and forwarded to the mounted terminal.
+ */
+import type { OutputChunk } from "@/platform/ipc";
+
+/** Replay buffer bound, in characters (the terminal keeps its own scrollback). */
+const MAX_CHARS = 2_000_000;
+
+const DIM = "\x1b[2m";
+const RED = "\x1b[31m";
+const RESET = "\x1b[0m";
+
+/** What the terminal shows for a chunk: IDE messages dimmed, on their own lines. */
+export function terminalText(chunk: OutputChunk): string {
+ if (chunk.kind === "stdout") return chunk.text;
+ const text = chunk.text.replace(/\r?\n/g, "\r\n");
+ return chunk.kind === "system" ? `${DIM}${text}${RESET}` : `${RED}${text}${RESET}`;
+}
+
+export class TerminalOutput {
+ private chunks: string[] = [];
+ private size = 0;
+ private sink: ((data: string) => void) | null = null;
+ private onClear: (() => void) | null = null;
+
+ append(chunk: OutputChunk) {
+ const data = terminalText(chunk);
+ if (!data) return;
+ this.chunks.push(data);
+ this.size += data.length;
+ while (this.size > MAX_CHARS && this.chunks.length > 1) this.size -= this.chunks.shift()!.length;
+ this.sink?.(data);
+ }
+
+ /** Attaches a terminal: it gets the output so far, then everything new. Returns the detach function. */
+ attach(write: (data: string) => void, clear: () => void): () => void {
+ for (const c of this.chunks) write(c);
+ this.sink = write;
+ this.onClear = clear;
+ return () => {
+ if (this.sink === write) {
+ this.sink = null;
+ this.onClear = null;
+ }
+ };
+ }
+
+ clear() {
+ this.chunks = [];
+ this.size = 0;
+ this.onClear?.();
+ }
+
+ get text(): string {
+ return this.chunks.join("");
+ }
+}
diff --git a/src/features/run/types.ts b/src/features/run/types.ts
new file mode 100644
index 000000000..307b8bbac
--- /dev/null
+++ b/src/features/run/types.ts
@@ -0,0 +1,367 @@
+/**
+ * Built-in run configuration types (Shell Script, Program, npm, Gradle, Maven,
+ * Compound) and the helpers that turn a type's params into the launched
+ * command line. Other features contribute types with `registerRunConfigType`.
+ */
+import type { RunConfig } from "@/platform/ipc";
+import {
+ registerRunConfigType,
+ runConfigTypes,
+ useRunConfigTypes,
+ type RunConfigTypeContribution,
+} from "@/workbench/contributions";
+import { formatArgs, parseArgs, uid, uniqueName } from "./configs";
+
+export const COMPOUND = "compound";
+
+const isWindows = () => typeof navigator !== "undefined" && /win/i.test(navigator.platform);
+const on = (v: string | undefined) => v === "true";
+const baseName = (p: string) => p.replace(/\\/g, "/").split("/").pop() ?? p;
+const dirOf = (cwd: string | null | undefined) => cwd ?? "";
+
+/** Values of `args[index]` across detected configurations of `kind`. */
+function argsOf(configs: readonly RunConfig[], kind: string, index: number): string[] {
+ const out = new Set<string>();
+ for (const c of configs) if (c.kind === kind && c.args[index]) out.add(c.args[index]);
+ return [...out];
+}
+
+const shell: RunConfigTypeContribution = {
+ id: "shell",
+ label: "Shell Script",
+ icon: "file-shell",
+ description: "Run a script file, script text or command line",
+ defaults: { mode: "file" },
+ fields: [
+ {
+ key: "mode",
+ label: "Execute",
+ control: "select",
+ options: [
+ { value: "file", label: "Script file" },
+ { value: "text", label: "Script text" },
+ { value: "command", label: "Command line" },
+ ],
+ },
+ { key: "path", label: "Script path", mono: true, required: true, visible: (p) => p.mode === "file" },
+ { key: "options", label: "Script options", mono: true, visible: (p) => p.mode === "file" },
+ {
+ key: "interpreter",
+ label: "Interpreter path",
+ mono: true,
+ placeholder: "Run the script directly",
+ visible: (p) => p.mode === "file",
+ },
+ {
+ key: "interpreterOptions",
+ label: "Interpreter options",
+ mono: true,
+ visible: (p) => p.mode === "file" && !!p.interpreter,
+ },
+ {
+ key: "script",
+ label: "Script text",
+ control: "textarea",
+ mono: true,
+ required: true,
+ visible: (p) => p.mode === "text",
+ },
+ {
+ key: "command",
+ label: "Command",
+ mono: true,
+ required: true,
+ placeholder: "e.g. ./gradlew or cargo",
+ visible: (p) => p.mode === "command",
+ },
+ {
+ key: "args",
+ label: "Arguments",
+ mono: true,
+ placeholder: "Space separated; quote with ' or \"",
+ visible: (p) => p.mode === "command",
+ },
+ ],
+ commandLine(p) {
+ if (p.mode === "text") return { command: p.script ?? "", args: [] };
+ if (p.mode === "file") {
+ const path = p.path ?? "";
+ if (!p.interpreter?.trim()) return { command: path, args: parseArgs(p.options ?? "") };
+ return {
+ command: p.interpreter.trim(),
+ args: [...parseArgs(p.interpreterOptions ?? ""), path, ...parseArgs(p.options ?? "")],
+ };
+ }
+ return { command: p.command ?? "", args: parseArgs(p.args ?? "") };
+ },
+ paramsFrom: (c) => ({ mode: "command", command: c.command, args: formatArgs(c.args) }),
+};
+
+const program: RunConfigTypeContribution = {
+ id: "program",
+ label: "Program",
+ icon: "file-binary",
+ description: "Run an executable with arguments",
+ fields: [
+ { key: "program", label: "Executable", mono: true, required: true, placeholder: "Path or command on PATH" },
+ { key: "arguments", label: "Program arguments", mono: true },
+ ],
+ commandLine: (p) => ({ command: p.program ?? "", args: parseArgs(p.arguments ?? "") }),
+ paramsFrom: (c) =>
+ c.args.length || !/\s/.test(c.command) ? { program: c.command, arguments: formatArgs(c.args) } : null,
+};
+
+const PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
+const NPM_COMMANDS = ["run", "test", "start", "install", "ci", "publish", "pack"];
+
+const npm: RunConfigTypeContribution = {
+ id: "npm",
+ label: "npm",
+ icon: "file-npm",
+ description: "Run a package.json script",
+ defaults: { packageManager: "npm", command: "run" },
+ ownsWorkingDirectory: true,
+ fields: [
+ { key: "packageDir", label: "package.json directory", mono: true, placeholder: "Project root" },
+ { key: "command", label: "Command", control: "select", options: NPM_COMMANDS.map((v) => ({ value: v, label: v })) },
+ {
+ key: "script",
+ label: "Script",
+ mono: true,
+ required: true,
+ visible: (p) => p.command === "run",
+ suggestions: (configs) => argsOf(configs, "npm", 1),
+ },
+ { key: "arguments", label: "Arguments", mono: true },
+ {
+ key: "packageManager",
+ label: "Package manager",
+ control: "select",
+ options: PACKAGE_MANAGERS.map((v) => ({ value: v, label: v })),
+ },
+ ],
+ commandLine(p) {
+ const command = p.command || "run";
+ const args = [command, ...(command === "run" ? [p.script ?? ""] : []), ...parseArgs(p.arguments ?? "")];
+ return { command: p.packageManager || "npm", args, cwd: p.packageDir?.trim() || null };
+ },
+ paramsFrom(c) {
+ const [command, ...rest] = c.args;
+ if (!PACKAGE_MANAGERS.includes(c.command) || !command || !NPM_COMMANDS.includes(command)) return null;
+ const script = command === "run" ? (rest.shift() ?? "") : "";
+ return { packageManager: c.command, command, script, arguments: formatArgs(rest), packageDir: dirOf(c.cwd) };
+ },
+};
+
+function wrapperCommand(unix: string, windows: string, plain: string, wrapper: boolean): string {
+ if (!wrapper) return plain;
+ return isWindows() ? windows : `./${unix}`;
+}
+
+function buildToolType(
+ id: string,
+ label: string,
+ icon: string,
+ tasksLabel: string,
+ wrapper: { unix: string; windows: string; plain: string; label: string; byDefault: boolean },
+): RunConfigTypeContribution {
+ return {
+ id,
+ label,
+ icon,
+ description: `Run ${label} ${tasksLabel.toLowerCase()}`,
+ defaults: wrapper.byDefault ? { wrapper: "true" } : {},
+ ownsWorkingDirectory: true,
+ fields: [
+ { key: "projectDir", label: `${label} project`, mono: true, placeholder: "Project root" },
+ {
+ key: "tasks",
+ label: tasksLabel,
+ mono: true,
+ required: true,
+ suggestions: (configs) => argsOf(configs, id, 0),
+ },
+ { key: "arguments", label: "Arguments", mono: true },
+ { key: "wrapper", label: wrapper.label, control: "checkbox" },
+ ],
+ commandLine: (p) => ({
+ command: wrapperCommand(wrapper.unix, wrapper.windows, wrapper.plain, on(p.wrapper)),
+ args: [...parseArgs(p.tasks ?? ""), ...parseArgs(p.arguments ?? "")],
+ cwd: p.projectDir?.trim() || null,
+ }),
+ paramsFrom(c) {
+ const name = baseName(c.command);
+ const usesWrapper = name === wrapper.unix || name === wrapper.windows;
+ if (!usesWrapper && name !== wrapper.plain) return null;
+ return {
+ projectDir: dirOf(c.cwd),
+ tasks: formatArgs(c.args),
+ arguments: "",
+ ...(usesWrapper ? { wrapper: "true" } : {}),
+ };
+ },
+ };
+}
+
+const gradle = buildToolType("gradle", "Gradle", "file-gradle", "Tasks", {
+ unix: "gradlew",
+ windows: "gradlew.bat",
+ plain: "gradle",
+ label: "Use the Gradle wrapper",
+ byDefault: true,
+});
+
+const maven = buildToolType("maven", "Maven", "file-maven", "Goals", {
+ unix: "mvnw",
+ windows: "mvnw.cmd",
+ plain: "mvn",
+ label: "Use the Maven wrapper",
+ byDefault: false,
+});
+
+const compound: RunConfigTypeContribution = {
+ id: COMPOUND,
+ label: "Compound",
+ icon: "gutter-run-all",
+ description: "Run or debug several configurations together",
+ fields: [],
+ commandLine: () => null,
+};
+
+export const BUILTIN_TYPES: readonly RunConfigTypeContribution[] = [shell, program, npm, gradle, maven, compound];
+
+export function registerBuiltinTypes(): () => void {
+ const disposers = BUILTIN_TYPES.map(registerRunConfigType);
+ return () => disposers.forEach((d) => d());
+}
+
+export function typeFor(kind: string): RunConfigTypeContribution | undefined {
+ return useRunConfigTypes.getState().types.get(kind);
+}
+
+export { runConfigTypes };
+
+export const isCompound = (c: Pick<RunConfig, "kind">) => c.kind === COMPOUND;
+
+/**
+ * The params the type form edits for `config`: its own, else derived from its command
+ * line; null when the type can't reproduce that command line (edited as a plain command).
+ */
+export function formParams(config: RunConfig, type = typeFor(config.kind)): Record<string, string> | null {
+ if (!type) return null;
+ if (config.params && Object.keys(config.params).length) return { ...config.params };
+ if (type.id === COMPOUND) return {};
+ const derived = type.paramsFrom?.(config);
+ if (!derived) return null;
+ // Only when the form reproduces exactly what runs today.
+ const line = type.commandLine(derived);
+ if (!line) return null;
+ const sameCwd = !type.ownsWorkingDirectory || (line.cwd ?? null) === (config.cwd ?? null);
+ return line.command === config.command && formatArgs(line.args) === formatArgs(config.args) && sameCwd
+ ? derived
+ : null;
+}
+
+/** `config` with `params` and the command line (and stop command) they produce. */
+export function withParams(config: RunConfig, params: Record<string, string>, type = typeFor(config.kind)): RunConfig {
+ const line = type?.commandLine(params);
+ const { stopCommand: _previous, ...rest } = config;
+ if (!line) return { ...rest, params, command: "", args: [] };
+ return {
+ ...rest,
+ params,
+ command: line.command,
+ args: line.args,
+ ...(type?.ownsWorkingDirectory ? { cwd: line.cwd ?? null } : {}),
+ ...(line.stop ? { stopCommand: line.stop } : {}),
+ };
+}
+
+/** Whether "Emulate terminal in output console" applies to `config`. */
+export function terminalApplies(config: RunConfig, type = typeFor(config.kind)): boolean {
+ return config.kind !== COMPOUND && !config.isTest && type?.terminal !== false;
+}
+
+/** Required params that are empty, by key. */
+export function missingParams(config: RunConfig, type = typeFor(config.kind)): Record<string, string> {
+ const out: Record<string, string> = {};
+ const params = formParams(config, type);
+ if (!type || !params) return out;
+ for (const f of type.fields) {
+ if (f.required && (f.visible?.(params) ?? true) && !params[f.key]?.trim()) out[f.key] = `${f.label} is required`;
+ }
+ return out;
+}
+
+/** Template keys copied onto a new configuration ("Edit configuration templates…"). */
+const TEMPLATE_KEYS = [
+ "env",
+ "cwd",
+ "isTest",
+ "debugAdapter",
+ "allowParallel",
+ "includeSystemEnv",
+ "envFiles",
+ "stdinFile",
+ "outputFile",
+ "beforeLaunch",
+ "showOnStdout",
+ "showOnStderr",
+ "openToolWindow",
+ "focusToolWindow",
+ "emulateTerminal",
+] as const satisfies ReadonlyArray<keyof RunConfig>;
+
+export const templateId = (kind: string) => `template:${kind}`;
+
+/** An empty template for `type` (what a new configuration gets without one). */
+export function blankTemplate(type: RunConfigTypeContribution): RunConfig {
+ return withParams(
+ {
+ id: templateId(type.id),
+ name: type.label,
+ kind: type.id,
+ command: "",
+ args: [],
+ cwd: null,
+ env: {},
+ detected: false,
+ isTest: false,
+ debugAdapter: null,
+ },
+ { ...type.defaults },
+ type,
+ );
+}
+
+/** A new configuration of `type`, with the type's defaults and then its template applied. */
+export function newConfigOfType(
+ type: RunConfigTypeContribution,
+ configs: readonly RunConfig[],
+ template?: RunConfig | null,
+ folder?: string | null,
+): RunConfig {
+ const base: RunConfig = {
+ id: uid(),
+ name: uniqueName("Unnamed", configs),
+ kind: type.id,
+ command: "",
+ args: [],
+ cwd: null,
+ env: {},
+ detected: false,
+ isTest: false,
+ debugAdapter: null,
+ local: true,
+ ...(folder ? { folder } : {}),
+ };
+ const copied: Partial<RunConfig> = {};
+ if (template) {
+ for (const key of TEMPLATE_KEYS) {
+ const v = template[key];
+ if (v !== undefined) (copied as Record<string, unknown>)[key] = structuredClone(v);
+ }
+ }
+ const params = { ...type.defaults, ...(template?.params ?? {}) };
+ return withParams({ ...base, ...copied }, params, type);
+}
diff --git a/src/features/scratch/index.ts b/src/features/scratch/index.ts
index 97d0da112..04475dfe2 100644
--- a/src/features/scratch/index.ts
+++ b/src/features/scratch/index.ts
@@ -5,7 +5,7 @@
import { registerActions } from "@/platform/actions";
import { onFileOperation } from "@/platform/fileOps";
import { emitLocalIdeEvent } from "@/platform/ipc";
-import { registerOverlay, registerProjectViewRoot } from "@/workbench/contributions";
+import { registerMenuGroup, registerOverlay, registerProjectViewRoot } from "@/workbench/contributions";
import { ScratchChooserHost } from "./ScratchChooser";
import { openChooser } from "./store";
import { scratchBackend, scratchesAvailable, scratchesDir } from "./scratches";
@@ -25,7 +25,7 @@ export function activate(): () => void {
.then((path) => {
if (disposed) return;
dir = path;
- unregisterRoot = registerProjectViewRoot({ id: "scratches", label: SCRATCHES_ROOT_LABEL, icon: "scratches", path, order: 10 });
+ unregisterRoot = registerProjectViewRoot({ id: "scratches", label: SCRATCHES_ROOT_LABEL, icon: "scratches", path, order: 10, scope: "scratches" });
})
.catch((e: unknown) => console.warn("scratch files: no scratches folder", e));
const disposers = [
@@ -35,6 +35,13 @@ export function activate(): () => void {
if (removed.length) emitLocalIdeEvent({ type: "fsChanged", created: [], modified: [], removed });
}),
registerOverlay({ id: "scratch.chooser", component: ScratchChooserHost }),
+ // IDEA lists it near the top of the New popup.
+ registerMenuGroup({
+ id: "scratch.new",
+ menus: ["new"],
+ order: 0,
+ items: () => [{ kind: "action", action: "file.newScratchFile", label: "Scratch File" }],
+ }),
registerActions([
{
id: "file.newScratchFile",
diff --git a/src/features/search/__tests__/bookmarkLists.test.ts b/src/features/search/__tests__/bookmarkLists.test.ts
new file mode 100644
index 000000000..e0183e11a
--- /dev/null
+++ b/src/features/search/__tests__/bookmarkLists.test.ts
@@ -0,0 +1,148 @@
+import { beforeEach, describe, expect, it } from "vitest";
+import { buildBookmarkTree } from "../bookmarks/BookmarksView";
+import {
+ DEFAULT_LIST_ID,
+ createList,
+ deleteList,
+ loadBookmarks,
+ moveBookmarks,
+ renameList,
+ renamePathBookmarks,
+ setDefaultList,
+ toggleBookmark,
+ togglePathBookmarks,
+ updateBookmarkData,
+ updateBookmarks,
+ useBookmarks,
+ validateListName,
+ type BookmarkData,
+} from "../bookmarks/store";
+
+const data = (): BookmarkData => ({
+ items: [{ path: "/p/a.ts", line: 1, text: "a", created: 1, list: DEFAULT_LIST_ID }],
+ paths: [],
+ lists: [{ id: DEFAULT_LIST_ID, name: "p" }],
+ defaultList: DEFAULT_LIST_ID,
+});
+
+describe("bookmark lists", () => {
+ it("creates, renames and validates lists", () => {
+ const { data: d, id } = createList(data(), " Review ");
+ expect(d.lists).toEqual([
+ { id: DEFAULT_LIST_ID, name: "p" },
+ { id, name: "Review" },
+ ]);
+ expect(validateListName(d.lists, "Review")).toMatch(/already exists/);
+ expect(validateListName(d.lists, "Review", id)).toBeNull();
+ expect(validateListName(d.lists, " ")).toMatch(/empty/);
+ expect(renameList(d, id, "Later").lists[1]!.name).toBe("Later");
+ });
+
+ it("moves bookmarks between lists and changes the default", () => {
+ const { data: d0, id } = createList(data(), "Two");
+ let d = togglePathBookmarks(d0, [{ path: "/p/src", dir: true }], 5);
+ d = moveBookmarks(d, [{ path: "/p/a.ts", line: 1 }, { path: "/p/src" }], id);
+ expect(d.items[0]!.list).toBe(id);
+ expect(d.paths[0]!.list).toBe(id);
+ // Unknown target lists are ignored.
+ expect(moveBookmarks(d, [{ path: "/p/src" }], "nope")).toBe(d);
+ d = setDefaultList(d, id);
+ expect(d.defaultList).toBe(id);
+ d = togglePathBookmarks(d, [{ path: "/p/b.ts", dir: false }], 6);
+ expect(d.paths.find((p) => p.path === "/p/b.ts")!.list).toBe(id);
+ });
+
+ it("deletes a list with its bookmarks, keeping a default", () => {
+ const { data: d0, id } = createList(data(), "Two");
+ const d = deleteList(setDefaultList(moveBookmarks(d0, [{ path: "/p/a.ts", line: 1 }], id), id), id, "p");
+ expect(d.items).toEqual([]);
+ expect(d.lists.map((l) => l.id)).toEqual([DEFAULT_LIST_ID]);
+ expect(d.defaultList).toBe(DEFAULT_LIST_ID);
+ const last = deleteList(d, DEFAULT_LIST_ID, "fresh");
+ expect(last.lists).toEqual([{ id: DEFAULT_LIST_ID, name: "fresh" }]);
+ });
+
+ it("toggles file / folder bookmarks together and follows removals", () => {
+ let d = togglePathBookmarks(data(), [{ path: "/p/x.ts", dir: false }], 1);
+ d = togglePathBookmarks(
+ d,
+ [
+ { path: "/p/x.ts", dir: false },
+ { path: "/p/dir", dir: true },
+ ],
+ 2,
+ );
+ expect(d.paths.map((p) => p.path)).toEqual(["/p/dir", "/p/x.ts"]);
+ d = togglePathBookmarks(d, [
+ { path: "/p/x.ts", dir: false },
+ { path: "/p/dir", dir: true },
+ ]);
+ expect(d.paths).toEqual([]);
+ const paths = togglePathBookmarks(data(), [{ path: "/p/dir/f.ts", dir: false }]).paths;
+ expect(renamePathBookmarks(paths, "/p/dir", "/p/new").map((p) => p.path)).toEqual(["/p/new/f.ts"]);
+ expect(renamePathBookmarks(paths, "/p/dir", null)).toEqual([]);
+ });
+
+ it("groups a list's folders, bookmarked files and line bookmarks", () => {
+ const d = togglePathBookmarks(
+ data(),
+ [
+ { path: "/p/a.ts", dir: false },
+ { path: "/p/lib", dir: true },
+ ],
+ 1,
+ );
+ const [list] = buildBookmarkTree(d);
+ expect(list).toMatchObject({ kind: "list", isDefault: true, count: 3 });
+ const children = list!.kind === "list" ? list!.children : [];
+ expect(children.map((n) => n.kind)).toEqual(["folder", "file"]);
+ expect(children[1]).toMatchObject({ kind: "file", bookmarked: true });
+ });
+});
+
+describe("bookmark list persistence", () => {
+ beforeEach(() => localStorage.clear());
+
+ it("reads bookmarks saved before lists into the default list", () => {
+ localStorage.setItem(
+ "openidea.bookmarks.v1:/proj",
+ JSON.stringify([{ path: "/proj/a", line: 2, text: "", created: 1 }]),
+ );
+ loadBookmarks("/proj");
+ const s = useBookmarks.getState();
+ expect(s.lists).toEqual([{ id: DEFAULT_LIST_ID, name: "proj" }]);
+ expect(s.items[0]!.list).toBe(DEFAULT_LIST_ID);
+ });
+
+ it("persists lists, the default and file bookmarks; new line bookmarks join the default list", () => {
+ loadBookmarks("/q");
+ let id = "";
+ updateBookmarkData((d) => {
+ const made = createList(d, "Two");
+ id = made.id;
+ return togglePathBookmarks(setDefaultList(made.data, made.id), [{ path: "/q/f", dir: false }]);
+ });
+ updateBookmarks((l) => toggleBookmark(l, "/q/a", 0, "x"));
+ loadBookmarks("/other");
+ loadBookmarks("/q");
+ const s = useBookmarks.getState();
+ expect(s.lists.map((l) => l.name)).toEqual(["q", "Two"]);
+ expect(s.defaultList).toBe(id);
+ expect(s.paths).toMatchObject([{ path: "/q/f", list: id }]);
+ expect(s.items).toMatchObject([{ path: "/q/a", list: id }]);
+ // Line bookmarks stay readable by older versions (same key, plain array).
+ expect(JSON.parse(localStorage.getItem("openidea.bookmarks.v1:/q")!)).toHaveLength(1);
+ });
+
+ it("ignores corrupt list storage", () => {
+ localStorage.setItem(
+ "openidea.bookmarkLists.v1:/c",
+ JSON.stringify({ lists: [{ id: 3 }], defaultList: "x", paths: [1] }),
+ );
+ loadBookmarks("/c");
+ const s = useBookmarks.getState();
+ expect(s.lists).toEqual([{ id: DEFAULT_LIST_ID, name: "c" }]);
+ expect(s.defaultList).toBe(DEFAULT_LIST_ID);
+ expect(s.paths).toEqual([]);
+ });
+});
diff --git a/src/features/search/__tests__/bookmarkPopups.test.tsx b/src/features/search/__tests__/bookmarkPopups.test.tsx
index 7ba362864..c3c1d1e2c 100644
--- a/src/features/search/__tests__/bookmarkPopups.test.tsx
+++ b/src/features/search/__tests__/bookmarkPopups.test.tsx
@@ -4,7 +4,14 @@ import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { BookmarkPopupsOverlay, bookmarkRows } from "../bookmarks/BookmarkPopups";
import { bookmarkGutter } from "../bookmarks/gutter";
-import { loadBookmarks, updateBookmarks, useBookmarkPopups, useBookmarks, type Bookmark } from "../bookmarks/store";
+import {
+ loadBookmarks,
+ updateBookmarkData,
+ updateBookmarks,
+ useBookmarkPopups,
+ useBookmarks,
+ type Bookmark,
+} from "../bookmarks/store";
beforeEach(() => {
localStorage.clear();
@@ -41,6 +48,8 @@ describe("Bookmarks popup", () => {
{ path: "/p/b", line: 0, text: "zero", created: 3 },
]);
expect(bookmarkRows(useBookmarks.getState().items).map((r) => r.kind)).toEqual(["file", "mark", "mark", "file", "mark"]);
+ const { items, lists } = useBookmarks.getState();
+ expect(bookmarkRows(items, [], lists).map((r) => r.kind)).toEqual(["list", "file", "mark", "mark", "file", "mark"]);
render(<BookmarkPopupsOverlay />);
act(() => useBookmarkPopups.setState({ list: true }));
const list = screen.getByRole("listbox", { name: "Bookmarks" });
@@ -56,6 +65,49 @@ describe("Bookmarks popup", () => {
});
});
+describe("Bookmarks popup with file and folder bookmarks", () => {
+ it("groups by list: folders, then files with their line bookmarks; folders select in the project view", async () => {
+ const actions = await import("@/platform/actions");
+ const run = vi.spyOn(actions, "executeAction").mockResolvedValue(undefined as never);
+ act(() =>
+ updateBookmarkData((d) => ({
+ ...d,
+ lists: [...d.lists, { id: "list2", name: "Review" }],
+ items: [
+ { path: "/p/a.ts", line: 3, text: "three", created: 1, list: "default" },
+ { path: "/p/c.ts", line: 0, text: "zero", created: 1, list: "list2" },
+ ],
+ paths: [
+ { path: "/p/src", dir: true, list: "default", created: 1 },
+ { path: "/p/a.ts", dir: false, list: "default", created: 1 },
+ { path: "/p/b.ts", dir: false, list: "list2", created: 1 },
+ ],
+ })),
+ );
+ const { items, paths, lists } = useBookmarks.getState();
+ expect(bookmarkRows(items, paths, lists).map((r) => r.key)).toEqual([
+ "l:default",
+ "d:default:/p/src",
+ "p:default:/p/a.ts",
+ "b:/p/a.ts:3",
+ "l:list2",
+ "p:list2:/p/b.ts",
+ "f:list2:/p/c.ts",
+ "b:/p/c.ts:0",
+ ]);
+ render(<BookmarkPopupsOverlay />);
+ act(() => useBookmarkPopups.setState({ list: true }));
+ expect(screen.getByText("Review")).toBeInTheDocument();
+ // The folder is the first selectable row: Enter selects it in the project view.
+ vi.useFakeTimers();
+ fireEvent.keyDown(screen.getByRole("listbox", { name: "Bookmarks" }), { key: "Enter" });
+ vi.runAllTimers();
+ vi.useRealTimers();
+ expect(run).toHaveBeenCalledWith("navigate.selectInProjectView", "/p/src");
+ run.mockRestore();
+ });
+});
+
describe("bookmark gutter", () => {
it("⌘/Ctrl-click in the gutter toggles a bookmark before other gutter handlers see it", () => {
const toggle = vi.fn();
diff --git a/src/features/search/__tests__/dialogs.test.tsx b/src/features/search/__tests__/dialogs.test.tsx
index 2ede39e59..27a2f8160 100644
--- a/src/features/search/__tests__/dialogs.test.tsx
+++ b/src/features/search/__tests__/dialogs.test.tsx
@@ -4,7 +4,8 @@ import { registerAction } from "@/platform/actions";
import type { SeDeps } from "../everywhere/controller";
const fakeDeps = (): SeDeps => ({
- findFiles: async (q) => (q ? [{ path: "/p/src/OrderController.kt", relPath: "src/OrderController.kt", score: 1, indices: [4, 5, 6] }] : []),
+ findFiles: async (q) =>
+ q ? [{ path: "/p/src/OrderController.kt", relPath: "src/OrderController.kt", score: 1, indices: [4, 5, 6] }] : [],
findSymbols: async () => [],
searchText: async () => {},
cancel: () => {},
@@ -17,7 +18,13 @@ const fakeDeps = (): SeDeps => ({
now: () => 0,
});
-vi.mock("../everywhere/deps", () => ({ ipcDeps: () => fakeDeps() }));
+vi.mock("../everywhere/deps", () => ({
+ ipcDeps: () => fakeDeps(),
+ loadLanguages: async () => [
+ { id: "kotlin", name: "Kotlin", extensions: ["kt"] },
+ { id: "markdown", name: "Markdown", extensions: ["md"] },
+ ],
+}));
vi.mock("../find/windowStore", async (orig) => ({
...(await orig<typeof import("../find/windowStore")>()),
ipcFindDeps: () => ({
@@ -142,6 +149,45 @@ describe("Search Everywhere dialog", () => {
expect(useSearchEverywhere.getState().includeNonProject).toBe(true);
});
+ it("labels the Actions tab's checkbox and assigns a shortcut with ⌥↵", async () => {
+ const assign = vi.fn();
+ const disposers = [
+ registerAction({ id: "test.pizza", title: "Order Pizza", category: "Test", run: () => {} }),
+ registerAction({ id: "settings.assignShortcut", title: "Assign", hidden: true, run: ({ arg }) => assign(arg) }),
+ ];
+ render(<SearchEverywhereOverlay />);
+ act(() => showSearchEverywhere("actions", { query: "order pizza" }));
+ await tick();
+ expect(screen.getByLabelText("Include disabled actions")).toBeInTheDocument();
+ expect(screen.queryByLabelText("Include non-project items")).toBeNull();
+ fireEvent.keyDown(screen.getByLabelText("Search query"), { key: "Enter", altKey: true });
+ await tick();
+ expect(assign).toHaveBeenCalledWith("test.pizza");
+ expect(useSearchEverywhere.getState().open).toBe(false);
+ disposers.forEach((d) => d());
+ });
+
+ it("filters Files by file type from the funnel, remembering the choice", async () => {
+ render(<SearchEverywhereOverlay />);
+ act(() => showSearchEverywhere("files", { query: "order" }));
+ await tick();
+ expect(document.getElementById("se-results")!.textContent).toContain("OrderController");
+ fireEvent.click(screen.getByRole("button", { name: "Filter" }));
+ await tick();
+ fireEvent.click(screen.getByLabelText("Kotlin"));
+ await tick();
+ expect(useSearchEverywhere.getState().filters.files.languages).toEqual(["kotlin"]);
+ expect(JSON.parse(localStorage.getItem("openidea.search.everywhereFilters.v1")!).files.languages).toEqual([
+ "kotlin",
+ ]);
+ expect(document.getElementById("se-results")!.textContent).not.toContain("OrderController");
+ act(() =>
+ useSearchEverywhere.setState({
+ filters: { ...useSearchEverywhere.getState().filters, files: { languages: [] } },
+ }),
+ );
+ });
+
it("searches everywhere when nothing is found in the project", async () => {
render(<SearchEverywhereOverlay />);
act(() => showSearchEverywhere("symbols", { query: "zzz" }));
@@ -160,7 +206,7 @@ describe("Find in Files dialog", () => {
await act(() => new Promise((r) => setTimeout(r, 250)));
expect(screen.getByText("1 match in 1 file")).toBeInTheDocument();
fireEvent.change(screen.getByLabelText("Replace with"), { target: { value: "item" } });
- expect(screen.getByText("item")).toBeInTheDocument();
+ expect(screen.getByText("item", { ignore: "script, style, textarea" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Replace All" })).toBeEnabled();
});
});
diff --git a/src/features/search/__tests__/everywhereFilters.test.ts b/src/features/search/__tests__/everywhereFilters.test.ts
new file mode 100644
index 000000000..be11d3a90
--- /dev/null
+++ b/src/features/search/__tests__/everywhereFilters.test.ts
@@ -0,0 +1,196 @@
+import { describe, expect, it, vi } from "vitest";
+import type { SearchQuery, SymbolMatch } from "@/platform/ipc";
+import { SeController, type SeDeps, type SeSnapshot } from "../everywhere/controller";
+import {
+ DEFAULT_FILTERS,
+ extensionIndex,
+ filterActive,
+ languageOf,
+ passesFilter,
+ resolveFilter,
+ sanitizeFilters,
+} from "../everywhere/filters";
+import { matchActions, matchSettings, mergeActionResults } from "../everywhere/model";
+
+const flush = () => new Promise((r) => setTimeout(r, 0));
+
+function setup(overrides: Partial<SeDeps> = {}) {
+ let id = 0;
+ const deps: SeDeps = {
+ findFiles: vi.fn(async () => []),
+ findSymbols: vi.fn(async () => []),
+ searchText: vi.fn(async () => {}),
+ cancel: vi.fn(),
+ nextRequestId: () => ++id,
+ actions: () => [],
+ isEnabled: () => true,
+ recentFiles: async () => [],
+ recentActions: () => [],
+ root: () => "/p",
+ now: () => 0,
+ ...overrides,
+ };
+ const snaps: SeSnapshot[] = [];
+ const c = new SeController(deps, (s) => snaps.push(s));
+ return { c, deps, last: () => snaps[snaps.length - 1]! };
+}
+
+const byExt = extensionIndex([
+ { id: "typescript", extensions: ["ts", "d.ts"] },
+ { id: "rust", extensions: ["rs"] },
+]);
+const lang = (p: string) => languageOf(p, byExt);
+
+const fm = (rel: string) => ({ path: `/p/${rel}`, relPath: rel, score: 1, indices: [] });
+const sym = (name: string, kind: SymbolMatch["kind"], rel: string): SymbolMatch => ({
+ name,
+ kind,
+ container: null,
+ path: `/p/${rel}`,
+ relPath: rel,
+ range: { start: { line: 0, col: 0 }, end: { line: 0, col: 1 } },
+ score: 1,
+ indices: [],
+});
+
+describe("Search Everywhere filters", () => {
+ it("sanitizes stored filters and reports which tabs are filtered", () => {
+ expect(sanitizeFilters(null)).toEqual(DEFAULT_FILTERS);
+ const f = sanitizeFilters({ files: { languages: ["rust", 3, "rust"] }, text: { mask: "*.ts" }, extra: 1 });
+ expect(f.files.languages).toEqual(["rust"]);
+ expect(f.symbols).toEqual({ languages: [], kinds: [] });
+ expect(filterActive(f, "files")).toBe(true);
+ expect(filterActive(f, "text")).toBe(true);
+ expect(filterActive(f, "classes")).toBe(false);
+ expect(filterActive(f, "all")).toBe(false);
+ });
+
+ it("maps paths to languages by their longest known extension", () => {
+ expect(lang("/p/a/main.RS")).toBe("rust");
+ expect(lang("/p/types.d.ts")).toBe("typescript");
+ expect(lang("/p/README")).toBeNull();
+ });
+
+ it("keeps unknown file types and buckets unlisted kinds", () => {
+ const f = { languageOf: lang, excludedLanguages: ["rust"], excludedKinds: ["module"] };
+ expect(passesFilter(f, "/p/a.rs")).toBe(false);
+ expect(passesFilter(f, "/p/a.txt")).toBe(true);
+ expect(passesFilter(f, "/p/a.ts", "package")).toBe(false);
+ expect(passesFilter(f, "/p/a.ts", "function")).toBe(true);
+ });
+
+ it("filters Files by file type", async () => {
+ const { c, last } = setup({ findFiles: async () => [fm("a.rs"), fm("b.ts"), fm("c.md")] });
+ const filters = { ...DEFAULT_FILTERS, files: { languages: ["rust"] } };
+ c.run({
+ query: "a",
+ tab: "files",
+ includeNonProject: false,
+ filter: resolveFilter(filters, "files", lang),
+ extra: {},
+ });
+ await flush();
+ expect(
+ last()
+ .sections.get("files")!
+ .items.map((i) => i.key),
+ ).toEqual(["f:/p/b.ts", "f:/p/c.md"]);
+ });
+
+ it("filters Symbols by kind and language", async () => {
+ const findSymbols = vi.fn(async () => [
+ sym("run", "function", "a.rs"),
+ sym("Run", "class", "b.ts"),
+ sym("runner", "variable", "c.ts"),
+ ]);
+ const { c, last } = setup({ findSymbols });
+ const filters = { ...DEFAULT_FILTERS, symbols: { languages: ["rust"], kinds: ["variable"] } };
+ c.run({
+ query: "run",
+ tab: "symbols",
+ includeNonProject: false,
+ filter: resolveFilter(filters, "symbols", lang),
+ extra: {},
+ });
+ await flush();
+ expect(
+ last()
+ .sections.get("symbols")!
+ .items.map((i) => (i.kind === "symbol" ? i.name : "")),
+ ).toEqual(["Run"]);
+ expect(findSymbols).toHaveBeenLastCalledWith("run", "all", 4 * 50 + 1);
+ });
+
+ it("passes the Text tab's file mask to the search", async () => {
+ const searchText = vi.fn(async (_r: number, _q: SearchQuery) => {});
+ const { c } = setup({ searchText });
+ const filters = { ...DEFAULT_FILTERS, text: { mask: " *.ts, !*.test.* " } };
+ c.run({
+ query: "needle",
+ tab: "text",
+ includeNonProject: false,
+ filter: resolveFilter(filters, "text", undefined),
+ extra: {},
+ });
+ await flush();
+ expect(searchText.mock.calls.at(-1)![1].include).toEqual(["*.ts, !*.test.*"]);
+ });
+
+ it("hides disabled actions unless included", async () => {
+ const actions = [
+ { id: "a.on", title: "Reformat Code", run: () => {} },
+ { id: "a.off", title: "Reformat File", run: () => {} },
+ ];
+ const { c, last } = setup({ actions: () => actions, isEnabled: (a) => a.id === "a.on" });
+ c.run({ query: "reformat", tab: "actions", includeNonProject: false, includeDisabled: false, extra: {} });
+ await flush();
+ expect(
+ last()
+ .sections.get("actions")!
+ .items.map((i) => i.key),
+ ).toEqual(["a:a.on"]);
+ c.run({ query: "reformat", tab: "actions", includeNonProject: true, includeDisabled: true, extra: {} });
+ await flush();
+ expect(
+ last()
+ .sections.get("actions")!
+ .items.map((i) => i.key),
+ ).toEqual(["a:a.on", "a:a.off"]);
+ });
+});
+
+describe("Settings in Search Everywhere", () => {
+ const entries = [
+ { pageId: "editor.general", title: "General", path: ["Editor"] },
+ { pageId: "editor.general", title: "Show line numbers", path: ["Editor", "General"] },
+ { pageId: "appearance", title: "Appearance", path: [], keywords: ["theme"] },
+ ];
+
+ it("matches option labels, page titles and keywords", () => {
+ expect(matchSettings(entries, "line num").map((s) => s.title)).toEqual(["Show line numbers"]);
+ expect(matchSettings(entries, "theme").map((s) => s.pageId)).toEqual(["appearance"]);
+ expect(matchSettings(entries, "")).toEqual([]);
+ });
+
+ it("ranks settings below equally good actions", () => {
+ const actions = matchActions([{ id: "x", title: "Show Line Numbers", run: () => {} }], "show line", {
+ isEnabled: () => true,
+ recent: [],
+ });
+ const merged = mergeActionResults(actions, matchSettings(entries, "show line"));
+ expect(merged.map((i) => i.kind)).toEqual(["action", "setting"]);
+ });
+
+ it("lists settings with actions once the index answers", async () => {
+ const { c, last } = setup({
+ actions: () => [{ id: "x", title: "Toggle Line Numbers", run: () => {} }],
+ settings: async () => entries,
+ });
+ c.run({ query: "line numbers", tab: "actions", includeNonProject: false, extra: {} });
+ await flush();
+ await flush();
+ const items = last().sections.get("actions")!.items;
+ expect(items.map((i) => i.kind)).toEqual(["action", "setting"]);
+ expect(last().sections.get("actions")!.loading).toBe(false);
+ });
+});
diff --git a/src/features/search/__tests__/fileStructure.test.tsx b/src/features/search/__tests__/fileStructure.test.tsx
index c5cd6892b..a7659953c 100644
--- a/src/features/search/__tests__/fileStructure.test.tsx
+++ b/src/features/search/__tests__/fileStructure.test.tsx
@@ -66,4 +66,19 @@ describe("File Structure popup", () => {
fireEvent.keyDown(input, { key: "Escape" });
expect(useFileStructurePopup.getState().open).toBe(false);
});
+
+ it("offers Show inherited members only when the server knows type hierarchies", () => {
+ open();
+ expect(screen.queryByLabelText("Show inherited members")).toBeNull();
+ const inherited = [{ item: item("toString", "method", 40), path: "/lib/Object.kt", owner: "Any" }];
+ act(() => useOutline.setState({ inheritedSupported: true, inherited: new Map([["0:4", inherited]]) }));
+ expect(rows()).toEqual(["OrderController", "list", "create", "helper"]);
+ fireEvent.click(screen.getByLabelText("Show inherited members"));
+ expect(useStructureOptions.getState().showInherited).toBe(true);
+ expect(rows()).toEqual(["OrderController", "list", "create", "toString↑Any", "helper"]);
+ act(() => {
+ useStructureOptions.setState({ showInherited: false });
+ useOutline.setState({ inheritedSupported: false, inherited: null });
+ });
+ });
});
diff --git a/src/features/search/__tests__/findScopes.test.ts b/src/features/search/__tests__/findScopes.test.ts
index 9abf9ce0b..a4ae9f8f4 100644
--- a/src/features/search/__tests__/findScopes.test.ts
+++ b/src/features/search/__tests__/findScopes.test.ts
@@ -1,5 +1,17 @@
import { describe, expect, it } from "vitest";
-import { FILE_SET_SCOPES, buildQuery, describeQuery, findHistory, rememberFindString, useFindPopup } from "../find/store";
+import { useCustomScopes } from "@/platform/search";
+import {
+ FILE_SET_SCOPES,
+ buildQuery,
+ customScopeValue,
+ describeQuery,
+ findHistory,
+ rememberFindString,
+ resolveFindScope,
+ useFindPopup,
+ type NamedScope,
+} from "../find/store";
+import { scopesProblem } from "../find/ScopesDialog";
import { selectRow, selectedRows, type RowSelection } from "../find/rowSelection";
describe("Find in Files named scopes", () => {
@@ -15,6 +27,43 @@ describe("Find in Files named scopes", () => {
});
});
+describe("Find in Files module and custom scopes", () => {
+ const inputs = { root: "/p", openPaths: () => ["/p/a.ts"], recentPaths: null };
+ const base = useFindPopup.getState();
+
+ it("a module searches its folder, the root module the project", () => {
+ expect(resolveFindScope({ ...base, scopeTab: "module", module: "web" }, inputs)).toEqual({
+ kind: "directory",
+ path: "/p/web",
+ });
+ expect(resolveFindScope({ ...base, scopeTab: "module", module: "" }, inputs)).toEqual({ kind: "project" });
+ });
+
+ it("named scopes resolve to file sets, files and custom patterns", () => {
+ useCustomScopes.setState({ root: null, scopes: [{ name: "No tests", pattern: "!file:*test*" }] });
+ const scope = (namedScope: NamedScope) => resolveFindScope({ ...base, scopeTab: "scope", namedScope }, inputs);
+ expect(scope("productionFiles")).toEqual({ kind: "fileSet", set: "production" });
+ expect(scope("openFiles")).toEqual({ kind: "files", paths: ["/p/a.ts"] });
+ expect(scope(customScopeValue("No tests"))).toEqual({ kind: "pattern", pattern: "!file:*test*" });
+ expect(scope(customScopeValue("gone"))).toEqual({ kind: "project" });
+ const q = buildQuery({ ...base, pattern: "x" }, scope(customScopeValue("No tests")), 0);
+ expect(describeQuery(q, "/p")).toBe("'x' in Scope 'No tests'");
+ useCustomScopes.setState({ root: null, scopes: [] });
+ });
+
+ it("the scope editor needs unique names and a pattern", () => {
+ expect(scopesProblem([{ name: "a", pattern: "*.ts" }])).toBeNull();
+ expect(scopesProblem([{ name: " ", pattern: "*.ts" }])).toBe("Every scope needs a name");
+ expect(
+ scopesProblem([
+ { name: "a", pattern: "*.ts" },
+ { name: "a ", pattern: "*.rs" },
+ ]),
+ ).toBe("Duplicate scope name 'a'");
+ expect(scopesProblem([{ name: "a", pattern: "" }])).toBe("Scope 'a' has no pattern");
+ });
+});
+
describe("Find in Files search context and history", () => {
it("sends the context filter only when it narrows the search", () => {
const base = useFindPopup.getState();
diff --git a/src/features/search/__tests__/inherited.test.ts b/src/features/search/__tests__/inherited.test.ts
new file mode 100644
index 000000000..3add4e7ac
--- /dev/null
+++ b/src/features/search/__tests__/inherited.test.ts
@@ -0,0 +1,73 @@
+import { describe, expect, it } from "vitest";
+import type { HierarchyItem, OutlineItem, Pos } from "@/platform/ipc";
+import { inheritedMembers, typeKey, typesIn } from "../structure/inherited";
+import { keyOutline, symbolPathAt, withInherited } from "../structure/outline";
+
+const item = (name: string, kind: OutlineItem["kind"], line: number, children: OutlineItem[] = []): OutlineItem => ({
+ name,
+ detail: null,
+ kind,
+ range: { start: { line, col: 0 }, end: { line: line + 5, col: 1 } },
+ selection_range: { start: { line, col: 6 }, end: { line, col: 6 + name.length } },
+ children,
+});
+
+const hier = (name: string, path: string, line: number): HierarchyItem => ({
+ name,
+ kind: "class",
+ detail: null,
+ path,
+ range: { start: { line, col: 0 }, end: { line: line + 5, col: 1 } },
+ selectionRange: { start: { line, col: 6 }, end: { line, col: 6 + name.length } },
+ fromRanges: [],
+});
+
+const dog = item("Dog", "class", 0, [item("bark", "method", 1), item("eat()", "method", 2)]);
+const outlines: Record<string, OutlineItem[]> = {
+ "/p/Dog.java": [dog],
+ "/p/Animal.java": [
+ item("Animal", "class", 0, [
+ item("Animal", "constructor", 1),
+ item("eat(String)", "method", 2),
+ item("sleep()", "method", 3),
+ item("sleep(int)", "method", 4),
+ ]),
+ ],
+ "/p/Living.java": [item("Living", "interface", 0, [item("sleep()", "method", 1), item("age", "field", 2)])],
+};
+const supers: Record<string, HierarchyItem[]> = {
+ "/p/Dog.java:0": [hier("Animal", "/p/Animal.java", 0)],
+ "/p/Animal.java:0": [hier("Living", "/p/Living.java", 0)],
+};
+const deps = {
+ supertypes: async (path: string, pos: Pos) => supers[`${path}:${pos.line}`] ?? [],
+ outline: async (path: string) => outlines[path] ?? [],
+};
+
+describe("Show Inherited", () => {
+ it("collects supertype members level by level, without overridden ones or constructors", async () => {
+ const members = await inheritedMembers("/p/Dog.java", dog, deps);
+ expect(members.map((m) => `${m.owner}.${m.item.name}`)).toEqual(["Animal.sleep()", "Animal.sleep(int)", "Living.age"]);
+ expect(members[0]!.path).toBe("/p/Animal.java");
+ });
+
+ it("finds nested types and appends inherited members after a type's own ones", async () => {
+ const outline = [item("Outer", "class", 0, [item("Inner", "class", 1)])];
+ expect(typesIn(outline).map((t) => t.name)).toEqual(["Outer", "Inner"]);
+
+ const members = await inheritedMembers("/p/Dog.java", dog, deps);
+ const nodes = withInherited(keyOutline([dog]), new Map([[typeKey(dog), members]]));
+ expect(nodes[0]!.children.map((c) => [c.item.name, c.inherited?.owner ?? null])).toEqual([
+ ["bark", null],
+ ["eat()", null],
+ ["sleep()", "Animal"],
+ ["sleep(int)", "Animal"],
+ ["age", "Living"],
+ ]);
+ // Inherited members live in other files: the caret never selects them.
+ const empty = item("Puppy", "class", 0);
+ const bare = withInherited(keyOutline([empty]), new Map([[typeKey(empty), members]]));
+ expect(bare[0]!.children).toHaveLength(3);
+ expect(symbolPathAt(bare, { line: 3, col: 0 })).toEqual([bare[0]!.key]);
+ });
+});
diff --git a/src/features/search/__tests__/outline.test.ts b/src/features/search/__tests__/outline.test.ts
index 0b75bfe6f..083100c41 100644
--- a/src/features/search/__tests__/outline.test.ts
+++ b/src/features/search/__tests__/outline.test.ts
@@ -1,6 +1,18 @@
import { describe, expect, it } from "vitest";
import type { OutlineItem } from "@/platform/ipc";
-import { allKeys, filterOutline, keyOutline, parentKeys, sortOutline, symbolPathAt, visibleCount } from "../structure/outline";
+import {
+ allKeys,
+ applyViewFilter,
+ filterOutline,
+ hasFields,
+ hasVisibility,
+ keyOutline,
+ outlinePathAt,
+ parentKeys,
+ sortOutline,
+ symbolPathAt,
+ visibleCount,
+} from "../structure/outline";
const item = (name: string, kind: OutlineItem["kind"], from: number, to: number, children: OutlineItem[] = []): OutlineItem => ({
name,
@@ -16,6 +28,44 @@ const outline = [
item("helper", "function", 22, 25),
];
+describe("structure view options", () => {
+ const vis = (i: OutlineItem, visibility: OutlineItem["visibility"]): OutlineItem => ({ ...i, visibility });
+ const cls = item("Repo", "class", 0, 30, [
+ vis(item("cache", "field", 1, 1), "private"),
+ vis(item("find", "method", 2, 5), "public"),
+ vis(item("load", "method", 6, 9), "private"),
+ vis(item("check", "method", 10, 12), "protected"),
+ item("size", "property", 13, 13),
+ item("all", "method", 14, 16),
+ ]);
+ const names = (nodes: ReturnType<typeof keyOutline>) => nodes[0]!.children.map((n) => n.item.name);
+
+ it("hides fields and non-public symbols", () => {
+ const nodes = keyOutline([cls]);
+ expect(names(applyViewFilter(nodes, { fields: false, nonPublic: true }))).toEqual(["find", "load", "check", "all"]);
+ expect(names(applyViewFilter(nodes, { fields: true, nonPublic: false }))).toEqual(["find", "size", "all"]);
+ expect(applyViewFilter(nodes, { fields: true, nonPublic: true })).toBe(nodes);
+ });
+
+ it("sorts by visibility, then by name when alphabetical", () => {
+ const nodes = keyOutline([cls]);
+ expect(names(sortOutline(nodes, false, true))).toEqual(["find", "size", "all", "check", "cache", "load"]);
+ expect(names(sortOutline(nodes, true, true))).toEqual(["all", "find", "size", "check", "cache", "load"]);
+ });
+
+ it("offers options only when the outline has the data", () => {
+ expect(hasVisibility([cls])).toBe(true);
+ expect(hasVisibility(outline)).toBe(false);
+ expect(hasFields([cls])).toBe(true);
+ expect(hasFields(outline)).toBe(false);
+ });
+
+ it("finds the symbols around a position", () => {
+ expect(outlinePathAt(outline, { line: 9, col: 0 }).map((i) => i.name)).toEqual(["OrderController", "create"]);
+ expect(outlinePathAt(outline, { line: 40, col: 0 })).toEqual([]);
+ });
+});
+
describe("outline helpers", () => {
const nodes = keyOutline(outline);
diff --git a/src/features/search/__tests__/recent.test.ts b/src/features/search/__tests__/recent.test.ts
index 70ae491aa..df24458fb 100644
--- a/src/features/search/__tests__/recent.test.ts
+++ b/src/features/search/__tests__/recent.test.ts
@@ -11,11 +11,58 @@ import {
filterLocations,
filterRecentFiles,
initialFileIndex,
+ lineSegments,
+ locationBreadcrumb,
+ locationTime,
switcherPaths,
switcherSelection,
switcherToolWindows,
} from "../recent/model";
+describe("recent location details", () => {
+ const now = 1_000_000_000_000;
+ it("formats times like IDEA", () => {
+ const pretty = () => "Yesterday 22:52";
+ expect(locationTime(0, now, pretty)).toBe("");
+ expect(locationTime(now - 20_000, now, pretty)).toBe("Just now");
+ expect(locationTime(now - 60_000, now, pretty)).toBe("1 minute ago");
+ expect(locationTime(now - 14 * 60_000, now, pretty)).toBe("14 minutes ago");
+ expect(locationTime(now - 26 * 3_600_000, now, pretty)).toBe("Yesterday 22:52");
+ });
+
+ it("builds the symbol breadcrumb", () => {
+ expect(
+ locationBreadcrumb([
+ { name: "Foo", kind: "class" },
+ { name: "bar", kind: "method" },
+ ]),
+ ).toBe("Foo > bar()");
+ expect(locationBreadcrumb([])).toBe("");
+ });
+
+ it("splits highlight tokens per line, also across line breaks", () => {
+ const lines = ["let a = 1;", "/* x", "y */ b"];
+ const tokens = [
+ { from: 0, to: 3, cls: "tok-keyword" },
+ { from: 8, to: 9, cls: "tok-number" },
+ { from: 11, to: 20, cls: "tok-comment" },
+ ];
+ const segs = lineSegments(lines, tokens);
+ expect(segs[0]).toEqual([
+ { text: "let", cls: "tok-keyword" },
+ { text: " a = ", cls: "" },
+ { text: "1", cls: "tok-number" },
+ { text: ";", cls: "" },
+ ]);
+ expect(segs[1]).toEqual([{ text: "/* x", cls: "tok-comment" }]);
+ expect(segs[2]).toEqual([
+ { text: "y */", cls: "tok-comment" },
+ { text: " b", cls: "" },
+ ]);
+ expect(lineSegments(["", "x"], [])).toEqual([[], [{ text: "x", cls: "" }]]);
+ });
+});
+
const loc = (path: string, line: number, extra: Partial<RecentLocation> = {}): RecentLocation => ({
path,
line,
diff --git a/src/features/search/__tests__/replaceFlow.test.ts b/src/features/search/__tests__/replaceFlow.test.ts
index 7ae0ac2b4..b494a4869 100644
--- a/src/features/search/__tests__/replaceFlow.test.ts
+++ b/src/features/search/__tests__/replaceFlow.test.ts
@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import type { FileMatches, ReplaceEvent, SearchQuery } from "@/platform/ipc";
-import { matchRows, preserveCase, previewReplacement } from "../find/session";
+import { preserveCase } from "@/platform/search";
+import { matchRows, previewReplacement } from "../find/session";
import {
NO_MARKS,
confirmText,
diff --git a/src/features/search/bookmarks/BookmarkPopups.module.css b/src/features/search/bookmarks/BookmarkPopups.module.css
index 9dde0190a..a693ea4dc 100644
--- a/src/features/search/bookmarks/BookmarkPopups.module.css
+++ b/src/features/search/bookmarks/BookmarkPopups.module.css
@@ -105,6 +105,10 @@
.fileName {
color: var(--fg-strong);
}
+.listRow {
+ color: var(--fg-muted);
+ font-weight: 600;
+}
.markText {
min-width: 0;
overflow: hidden;
diff --git a/src/features/search/bookmarks/BookmarkPopups.tsx b/src/features/search/bookmarks/BookmarkPopups.tsx
index 54edb1dda..c02e97b02 100644
--- a/src/features/search/bookmarks/BookmarkPopups.tsx
+++ b/src/features/search/bookmarks/BookmarkPopups.tsx
@@ -1,10 +1,11 @@
/**
* Bookmark popups: the mnemonic chooser (⌥F3 / Ctrl+F11), the Bookmarks
- * popup (⌘F3: list + preview, Enter jumps) and the Edit Description dialog
- * (F2 / Rename).
+ * popup (⌘F3: line, file and folder bookmarks by list + preview; Enter jumps), the Edit Description dialog
+ * (F2 / Rename) and the bookmark list name dialog (New List / Rename List).
*/
import { useMemo, useState, type KeyboardEvent, type MouseEvent } from "react";
import clsx from "clsx";
+import { executeAction } from "@/platform/actions";
import { useProject } from "@/platform/project";
import { Dialog, Icon, Input, List, Popup, T, fileIconName, type DialogButton } from "@/ui";
import { CodePreview } from "../find/parts";
@@ -14,12 +15,18 @@ import {
assignMnemonic,
bookmarkAt,
bookmarkLabel,
+ createList,
describeBookmark,
+ renameList,
+ updateBookmarkData,
+ validateListName,
removeBookmarks,
updateBookmarks,
useBookmarkPopups,
useBookmarks,
type Bookmark,
+ type BookmarkList,
+ type PathBookmark,
} from "./store";
import styles from "./BookmarkPopups.module.css";
@@ -27,11 +34,13 @@ export function BookmarkPopupsOverlay() {
const chooser = useBookmarkPopups((s) => s.chooser);
const list = useBookmarkPopups((s) => s.list);
const editing = useBookmarkPopups((s) => s.editing);
+ const naming = useBookmarkPopups((s) => s.naming);
return (
<>
{chooser && <MnemonicChooser key={`${chooser.path}:${chooser.line}`} />}
{list && <BookmarksPopup />}
{editing && <EditDescriptionDialog key={`${editing.path}:${editing.line}`} />}
+ {naming && <ListNameDialog key={naming.listId ?? "new"} />}
</>
);
}
@@ -129,39 +138,78 @@ function MnemonicChooser() {
// --- Bookmarks popup ------------------------------------------------------------
-type Row = { kind: "file"; key: string; path: string } | { kind: "mark"; key: string; bookmark: Bookmark };
+type Row =
+ | { kind: "list"; key: string; name: string }
+ /** A file with line bookmarks only (a section header). */
+ | { kind: "file"; key: string; path: string }
+ /** A bookmarked file or folder. */
+ | { kind: "path"; key: string; path: string; dir: boolean }
+ | { kind: "mark"; key: string; bookmark: Bookmark };
-export function bookmarkRows(items: readonly Bookmark[]): Row[] {
+/**
+ * Rows of the popup: each list (a header when there are lists) with its folders,
+ * then its files by path, each file followed by its line bookmarks.
+ */
+export function bookmarkRows(
+ items: readonly Bookmark[],
+ paths: readonly PathBookmark[] = [],
+ lists: readonly BookmarkList[] = [],
+): Row[] {
const rows: Row[] = [];
- let path: string | null = null;
- for (const b of items) {
- if (b.path !== path) {
- path = b.path;
- rows.push({ kind: "file", key: `f:${b.path}`, path: b.path });
+ const group = (list: string | null, marks: readonly Bookmark[], marked: readonly PathBookmark[]) => {
+ const files = new Map<string, { bookmarked: boolean; marks: Bookmark[] }>();
+ const file = (path: string) => files.get(path) ?? files.set(path, { bookmarked: false, marks: [] }).get(path)!;
+ for (const p of marked) if (!p.dir) file(p.path).bookmarked = true;
+ for (const b of marks) file(b.path).marks.push(b);
+ const k = list ?? "";
+ for (const p of marked.filter((p) => p.dir).sort((a, b) => a.path.localeCompare(b.path)))
+ rows.push({ kind: "path", key: `d:${k}:${p.path}`, path: p.path, dir: true });
+ for (const [path, f] of [...files].sort(([a], [b]) => a.localeCompare(b))) {
+ rows.push(f.bookmarked ? { kind: "path", key: `p:${k}:${path}`, path, dir: false } : { kind: "file", key: `f:${k}:${path}`, path });
+ for (const b of f.marks) rows.push({ kind: "mark", key: `b:${b.path}:${b.line}`, bookmark: b });
}
- rows.push({ kind: "mark", key: `b:${b.path}:${b.line}`, bookmark: b });
+ };
+ if (!lists.length) group(null, items, paths);
+ for (const l of lists) {
+ const marks = items.filter((b) => b.list === l.id);
+ const marked = paths.filter((p) => p.list === l.id);
+ if (!marks.length && !marked.length) continue;
+ rows.push({ kind: "list", key: `l:${l.id}`, name: l.name });
+ group(l.id, marks, marked);
}
return rows;
}
-const isFileRow = (r: Row) => r.kind === "file";
+const isSectionRow = (r: Row) => r.kind === "file" || r.kind === "list";
function BookmarksPopup() {
const items = useBookmarks((s) => s.items);
+ const paths = useBookmarks((s) => s.paths);
+ const lists = useBookmarks((s) => s.lists);
const root = useProject((s) => s.project?.root ?? null);
- const rows = useMemo(() => bookmarkRows(items), [items]);
- const [index, setIndex] = useState(() => rows.findIndex((r) => r.kind === "mark"));
+ const rows = useMemo(() => bookmarkRows(items, paths, lists), [items, paths, lists]);
+ const [index, setIndex] = useState(() => rows.findIndex((r) => !isSectionRow(r)));
const active = Math.min(index, rows.length - 1);
const row = rows[active];
const selected = row?.kind === "mark" ? row.bookmark : null;
+ const selectedPath = row?.kind === "path" ? row : null;
const close = () => useBookmarkPopups.setState({ list: false });
- const jump = (b: Bookmark | null) => {
- if (!b) return;
+ const jump = (r: Row | undefined) => {
+ if (r?.kind !== "mark" && r?.kind !== "path") return;
close();
- setTimeout(() => void openLocation(b.path, { line: b.line, col: 0 }), 0);
+ setTimeout(() => {
+ if (r.kind === "mark") void openLocation(r.bookmark.path, { line: r.bookmark.line, col: 0 });
+ else if (r.dir) void executeAction("navigate.selectInProjectView", r.path);
+ else void openLocation(r.path);
+ }, 0);
};
const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
+ if (selectedPath && (e.key === "Delete" || e.key === "Backspace")) {
+ e.preventDefault();
+ updateBookmarkData((d) => ({ ...d, paths: d.paths.filter((p) => p.path !== selectedPath.path) }));
+ return;
+ }
if (!selected) return;
if (e.key === "Delete" || e.key === "Backspace") {
e.preventDefault();
@@ -172,6 +220,15 @@ function BookmarksPopup() {
}
};
+ const fileLabel = (path: string, dir: boolean) => (
+ <span className={styles.fileRow}>
+ <Icon name={dir ? "folder" : fileIconName(basename(path))} size={14} />
+ <span className={styles.fileName}>{basename(path)}</span>
+ <span className={styles.dim}>{root ? relPath(path) : path}</span>
+ </span>
+ );
+ const previewPath = selected?.path ?? (selectedPath && !selectedPath.dir ? selectedPath.path : null);
+
return (
<Dialog open onClose={close} width={820} title="Bookmarks" position="top" className={styles.listDialog}>
<div className={styles.listBody} onKeyDown={onKeyDown}>
@@ -179,35 +236,35 @@ function BookmarksPopup() {
<List<Row>
items={rows}
getKey={(r) => r.key}
- isSection={isFileRow}
+ isSection={isSectionRow}
activeIndex={active}
onActiveChange={setIndex}
onActivate={(r, _i, e) => {
if (e.type === "click" && (e as MouseEvent).detail < 2) return;
- if (r.kind === "mark") jump(r.bookmark);
+ jump(r);
}}
aria-label="Bookmarks"
rowHeight={22}
sectionHeight={24}
- empty={<span>{items.length ? null : <T>No bookmarks</T>}</span>}
+ empty={<span>{items.length || paths.length ? null : <T>No bookmarks</T>}</span>}
renderSection={(r) =>
r.kind === "file" ? (
- <span className={styles.fileRow}>
- <Icon name={fileIconName(basename(r.path))} size={14} />
- <span className={styles.fileName}>{basename(r.path)}</span>
- <span className={styles.dim}>{root ? relPath(r.path) : r.path}</span>
- </span>
+ fileLabel(r.path, false)
+ ) : r.kind === "list" ? (
+ <span className={styles.listRow}>{r.name}</span>
) : null
}
renderItem={(r) =>
- r.kind === "mark" ? (
+ r.kind === "path" ? (
+ fileLabel(r.path, r.dir)
+ ) : r.kind === "mark" ? (
<span className={styles.markRow}>
{r.bookmark.mnemonic ? (
<span className={styles.mnemonic}>{r.bookmark.mnemonic}</span>
) : (
<Icon name="bookmark" size={14} />
)}
- <span className={styles.markText}>{bookmarkLabel(r.bookmark) || "(empty line)"}</span>
+ <span className={styles.markText}>{bookmarkLabel(r.bookmark) || <T>(empty line)</T>}</span>
<span className={styles.dim}>{r.bookmark.line + 1}</span>
</span>
) : null
@@ -215,7 +272,7 @@ function BookmarksPopup() {
/>
</div>
<div className={styles.previewPane}>
- <CodePreview path={selected?.path ?? null} line={selected?.line ?? 0} highlights={[]} />
+ <CodePreview path={previewPath} line={selected?.line ?? 0} highlights={[]} />
</div>
</div>
</Dialog>
@@ -249,3 +306,55 @@ function EditDescriptionDialog() {
</Dialog>
);
}
+
+// --- Bookmark list name ------------------------------------------------------------
+
+function ListNameDialog() {
+ const naming = useBookmarkPopups((s) => s.naming)!;
+ const lists = useBookmarks((s) => s.lists);
+ const current = naming.listId ? lists.find((l) => l.id === naming.listId) : undefined;
+ const [name, setName] = useState(current?.name ?? "");
+ const error = validateListName(lists, name, current?.id);
+ const close = () => useBookmarkPopups.setState({ naming: null });
+ const save = () => {
+ if (error) return;
+ close();
+ if (current) return updateBookmarkData((d) => renameList(d, current.id, name));
+ let id = "";
+ updateBookmarkData((d) => {
+ const made = createList(d, name);
+ id = made.id;
+ return made.data;
+ });
+ naming.then?.(id);
+ };
+ const buttons: DialogButton[] = [
+ { label: "Cancel", role: "cancel" },
+ { label: "OK", role: "default", disabled: !!error, onClick: save },
+ ];
+ return (
+ <Dialog
+ open
+ onClose={close}
+ title={current ? "Rename Bookmark List" : "New Bookmark List"}
+ width={380}
+ buttons={buttons}
+ >
+ <Input
+ data-autofocus
+ value={name}
+ aria-label="List name"
+ invalid={!!error && name.trim() !== ""}
+ onChange={(e) => setName(e.target.value)}
+ onFocus={(e) => e.currentTarget.select()}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ save();
+ }
+ }}
+ />
+ {error && name.trim() !== "" && <div className={styles.dim}>{error}</div>}
+ </Dialog>
+ );
+}
diff --git a/src/features/search/bookmarks/BookmarksView.module.css b/src/features/search/bookmarks/BookmarksView.module.css
index be5ed9d99..b7430900f 100644
--- a/src/features/search/bookmarks/BookmarksView.module.css
+++ b/src/features/search/bookmarks/BookmarksView.module.css
@@ -21,6 +21,9 @@
text-overflow: ellipsis;
white-space: nowrap;
}
+.defaultList {
+ font-weight: 600;
+}
.meta {
min-width: 0;
overflow: hidden;
diff --git a/src/features/search/bookmarks/BookmarksView.tsx b/src/features/search/bookmarks/BookmarksView.tsx
index 7ff78eea0..247ce263a 100644
--- a/src/features/search/bookmarks/BookmarksView.tsx
+++ b/src/features/search/bookmarks/BookmarksView.tsx
@@ -1,69 +1,186 @@
import { useMemo, useRef, useState, type KeyboardEvent } from "react";
+import clsx from "clsx";
+import { executeAction } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
-import { useProject } from "@/platform/project";
-import { EmptyState, Icon, IconButton, Tree, fileIconName, showContextMenu } from "@/ui";
+import { confirm } from "@/workbench/messages";
+import { useT, useTx } from "@/platform/i18n";
+import { EmptyState, Icon, IconButton, Tree, fileIconName, showContextMenu, type MenuItem } from "@/ui";
import { basename, openLocation, relPath } from "../common/open";
-import { bookmarkLabel, removeBookmarks, updateBookmarks, useBookmarkPopups, useBookmarks, type Bookmark } from "./store";
+import {
+ bookmarkLabel,
+ deleteList,
+ moveBookmarks,
+ setDefaultList,
+ updateBookmarkData,
+ useBookmarkPopups,
+ useBookmarks,
+ type Bookmark,
+ type BookmarkData,
+ type BookmarkList,
+ type BookmarkRef,
+ type PathBookmark,
+} from "./store";
import styles from "./BookmarksView.module.css";
type Node =
- | { kind: "list"; key: string; name: string; children: Node[] }
- | { kind: "file"; key: string; path: string; name: string; dir: string; children: Node[] }
+ | { kind: "list"; key: string; list: BookmarkList; isDefault: boolean; count: number; children: Node[] }
+ | {
+ kind: "file";
+ key: string;
+ list: string;
+ path: string;
+ name: string;
+ dir: string;
+ /** The file itself is bookmarked (not only lines in it). */
+ bookmarked: boolean;
+ children: Node[];
+ }
+ | { kind: "folder"; key: string; list: string; path: string; name: string; dir: string }
| { kind: "mark"; key: string; bookmark: Bookmark };
-const LIST_KEY = "\u0000list";
-
const markKey = (b: Bookmark) => `b:${b.path}:${b.line}`;
-export function groupBookmarks(items: readonly Bookmark[]): Node[] {
+function location(path: string): { name: string; dir: string } {
+ const rel = relPath(path);
+ const name = basename(rel);
+ return { name, dir: rel.slice(0, Math.max(0, rel.length - name.length - 1)) };
+}
+
+/** One list's nodes: folders, then files (bookmarked files and files with line bookmarks), by path. */
+export function groupBookmarks(
+ items: readonly Bookmark[],
+ paths: readonly PathBookmark[] = [],
+ listId?: string,
+): Node[] {
+ const list = listId ?? "";
const files = new Map<string, Node & { kind: "file" }>();
- for (const b of items) {
- let f = files.get(b.path);
+ const folders: Array<Node & { kind: "folder" }> = [];
+ const file = (path: string) => {
+ let f = files.get(path);
if (!f) {
- const rel = relPath(b.path);
- const name = basename(rel);
- f = { kind: "file", key: `f:${b.path}`, path: b.path, name, dir: rel.slice(0, Math.max(0, rel.length - name.length - 1)), children: [] };
- files.set(b.path, f);
+ f = { kind: "file", key: `f:${list}:${path}`, list, path, ...location(path), bookmarked: false, children: [] };
+ files.set(path, f);
}
- f.children.push({ kind: "mark", key: markKey(b), bookmark: b });
+ return f;
+ };
+ for (const p of paths) {
+ if (p.dir) folders.push({ kind: "folder", key: `d:${list}:${p.path}`, list, path: p.path, ...location(p.path) });
+ else file(p.path).bookmarked = true;
}
- return [...files.values()];
+ for (const b of items) file(b.path).children.push({ kind: "mark", key: markKey(b), bookmark: b });
+ const byPath = (a: { path: string }, b: { path: string }) => a.path.localeCompare(b.path);
+ return [...folders.sort(byPath), ...[...files.values()].sort(byPath)];
}
-function removeNodes(nodes: Node[]) {
- const marks = new Set<string>();
- const paths = new Set<string>();
- for (const n of nodes) {
- if (n.kind === "list") return updateBookmarks(() => []);
- if (n.kind === "file") paths.add(n.path);
- else marks.add(markKey(n.bookmark));
+export function buildBookmarkTree(data: BookmarkData): Node[] {
+ return data.lists.map((list) => {
+ const items = data.items.filter((b) => b.list === list.id);
+ const paths = data.paths.filter((b) => b.list === list.id);
+ return {
+ kind: "list",
+ key: `l:${list.id}`,
+ list,
+ isDefault: list.id === data.defaultList,
+ count: items.length + paths.length,
+ children: groupBookmarks(items, paths, list.id),
+ };
+ });
+}
+
+const refsOf = (n: Node): BookmarkRef[] => {
+ switch (n.kind) {
+ case "list":
+ return [];
+ case "mark":
+ return [{ path: n.bookmark.path, line: n.bookmark.line }];
+ case "folder":
+ return [{ path: n.path }];
+ case "file":
+ return [
+ ...(n.bookmarked ? [{ path: n.path }] : []),
+ ...n.children.flatMap((c) => (c.kind === "mark" ? [{ path: c.bookmark.path, line: c.bookmark.line }] : [])),
+ ];
}
- updateBookmarks((list) => removeBookmarks(list, (b) => paths.has(b.path) || marks.has(markKey(b))));
+};
+
+function removeRefs(data: BookmarkData, refs: readonly BookmarkRef[]): BookmarkData {
+ const lines = new Set(refs.filter((r) => r.line !== undefined).map((r) => `${r.path}:${r.line}`));
+ const paths = new Set(refs.filter((r) => r.line === undefined).map((r) => r.path));
+ return {
+ ...data,
+ items: data.items.filter((b) => !lines.has(`${b.path}:${b.line}`)),
+ paths: data.paths.filter((b) => !paths.has(b.path)),
+ };
+}
+
+async function removeList(list: BookmarkList, count: number) {
+ if (
+ count &&
+ !(await confirm({
+ title: "Delete Bookmark List",
+ message: `Delete the list '${list.name}' with its ${count} bookmark${count === 1 ? "" : "s"}?`,
+ ok: "Delete",
+ }))
+ )
+ return;
+ const scope = useBookmarks.getState().scope;
+ updateBookmarkData((d) => deleteList(d, list.id, scope ? basename(scope) : "Bookmarks"));
+}
+
+function removeNodes(nodes: Node[]) {
+ const list = nodes.find((n) => n.kind === "list");
+ if (list?.kind === "list") return void removeList(list.list, list.count);
+ updateBookmarkData((d) => removeRefs(d, nodes.flatMap(refsOf)));
+}
+
+const newList = (then?: (id: string) => void) => useBookmarkPopups.setState({ naming: { then } });
+
+function moveMenu(targets: Node[], lists: readonly BookmarkList[]): MenuItem[] {
+ const refs = targets.flatMap(refsOf);
+ const from = new Set(targets.map((n) => (n.kind === "mark" ? n.bookmark.list : n.kind === "list" ? "" : n.list)));
+ const move = (to: string) => updateBookmarkData((d) => moveBookmarks(d, refs, to));
+ return [
+ ...lists.map((l) => ({
+ label: l.name,
+ verbatim: true,
+ disabled: from.size === 1 && from.has(l.id),
+ run: () => move(l.id),
+ })),
+ { kind: "separator" as const },
+ { label: "New List…", run: () => newList(move) },
+ ];
}
export function BookmarksView() {
+ const t = useT();
+ const tx = useTx();
const items = useBookmarks((s) => s.items);
- const projectRoot = useProject((s) => s.project?.root ?? null);
- const files = useMemo(() => groupBookmarks(items), [items]);
- const roots = useMemo<Node[]>(
- () => [{ kind: "list", key: LIST_KEY, name: projectRoot ? basename(projectRoot) : "Bookmarks", children: files }],
- [files, projectRoot],
+ const paths = useBookmarks((s) => s.paths);
+ const lists = useBookmarks((s) => s.lists);
+ const defaultList = useBookmarks((s) => s.defaultList);
+ const roots = useMemo(
+ () => buildBookmarkTree({ items, paths, lists, defaultList }),
+ [items, paths, lists, defaultList],
);
const byKey = useMemo(() => {
const m = new Map<string, Node>();
- for (const r of files) {
- m.set(r.key, r);
- if (r.kind === "file") r.children.forEach((c) => m.set(c.key, c));
- }
- m.set(LIST_KEY, roots[0]!);
+ const walk = (ns: readonly Node[]) =>
+ ns.forEach((n) => {
+ m.set(n.key, n);
+ if (n.kind === "list" || n.kind === "file") walk(n.children);
+ });
+ walk(roots);
return m;
- }, [files, roots]);
- const allKeys = useMemo(() => [LIST_KEY, ...files.map((r) => r.key)], [files]);
+ }, [roots]);
+ const allKeys = useMemo(
+ () => [...byKey.values()].filter((n) => n.kind === "list" || n.kind === "file").map((n) => n.key),
+ [byKey],
+ );
const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(new Set());
const expanded = useMemo(() => new Set(allKeys.filter((k) => !collapsed.has(k))), [allKeys, collapsed]);
const selection = useRef<Set<string>>(new Set());
- if (!items.length) {
+ if (!items.length && !paths.length && lists.length === 1) {
return (
<EmptyState>
No bookmarks yet. Toggle a line bookmark with {shortcutLabel("navigate.toggleBookmark") ?? "F3"}
@@ -74,18 +191,21 @@ export function BookmarksView() {
const open = (n: Node) => {
if (n.kind === "mark") void openLocation(n.bookmark.path, { line: n.bookmark.line, col: 0 });
else if (n.kind === "file") void openLocation(n.path);
+ else if (n.kind === "folder") void executeAction("navigate.selectInProjectView", n.path);
};
const rename = (b: Bookmark) => useBookmarkPopups.setState({ editing: { path: b.path, line: b.line } });
+ const renameList = (l: BookmarkList) => useBookmarkPopups.setState({ naming: { listId: l.id } });
const onKeyDown = (e: KeyboardEvent) => {
const nodes = [...selection.current].map((k) => byKey.get(k)).filter((n): n is Node => !!n);
if (e.key === "F2" && !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey) {
- const mark = nodes.length === 1 && nodes[0]!.kind === "mark" ? nodes[0]!.bookmark : null;
- if (!mark) return;
+ const only = nodes.length === 1 ? nodes[0]! : null;
+ if (only?.kind === "mark") rename(only.bookmark);
+ else if (only?.kind === "list") renameList(only.list);
+ else return;
e.preventDefault();
e.stopPropagation();
- rename(mark);
return;
}
if (e.key !== "Delete" && e.key !== "Backspace") return;
@@ -95,6 +215,18 @@ export function BookmarksView() {
removeNodes(nodes);
};
+ const listMenu = (n: Node & { kind: "list" }): MenuItem[] => [
+ { label: "New List…", icon: "plus", run: () => newList() },
+ { label: "Rename List…", shortcut: "F2", run: () => renameList(n.list) },
+ {
+ label: "Make Default",
+ disabled: n.isDefault,
+ run: () => updateBookmarkData((d) => setDefaultList(d, n.list.id)),
+ },
+ { kind: "separator" },
+ { label: "Delete List", danger: true, run: () => void removeList(n.list, n.count) },
+ ];
+
return (
<div className={styles.root} onKeyDownCapture={onKeyDown}>
<Tree<Node>
@@ -102,9 +234,9 @@ export function BookmarksView() {
aria-label="Bookmarks"
roots={roots}
getKey={(n) => n.key}
- getLabel={(n) => (n.kind === "mark" ? bookmarkLabel(n.bookmark) : n.name)}
- getChildren={(n) => (n.kind === "mark" ? undefined : n.children)}
- isExpandable={(n) => n.kind !== "mark"}
+ getLabel={(n) => (n.kind === "mark" ? bookmarkLabel(n.bookmark) : n.kind === "list" ? n.list.name : n.name)}
+ getChildren={(n) => (n.kind === "list" || n.kind === "file" ? n.children : undefined)}
+ isExpandable={(n) => n.kind === "list" || (n.kind === "file" && n.children.length > 0)}
expanded={expanded}
onExpandedChange={(next) => setCollapsed(new Set(allKeys.filter((k) => !next.has(k))))}
onSelectionChange={(next) => {
@@ -112,67 +244,108 @@ export function BookmarksView() {
}}
onActivate={open}
onContextMenu={(node, sel, e) => {
- const targets = sel.size ? [...sel].map((k) => byKey.get(k)).filter((n): n is Node => !!n) : node ? [node] : [];
- if (!targets.length) return;
+ const targets = sel.size
+ ? [...sel].map((k) => byKey.get(k)).filter((n): n is Node => !!n)
+ : node
+ ? [node]
+ : [];
+ if (!targets.length || !node) return;
e.preventDefault();
+ if (node.kind === "list" && targets.length === 1) return showContextMenu(e, listMenu(node));
+ const bookmarks = targets.filter((t) => t.kind !== "list");
showContextMenu(e, [
- ...(node && node.kind !== "list" ? [{ label: "Jump to Source", run: () => open(node) }] : []),
- ...(node?.kind === "mark" && targets.length === 1
+ ...(node.kind !== "list" && node.kind !== "folder"
+ ? [{ label: "Jump to Source", run: () => open(node) }]
+ : []),
+ ...(node.kind === "mark" && targets.length === 1
? [{ label: "Rename…", shortcut: "F2", run: () => rename(node.bookmark) }]
: []),
+ ...(bookmarks.length ? [{ label: "Move to Another List", submenu: moveMenu(bookmarks, lists) }] : []),
{ kind: "separator" as const },
- { label: targets.length > 1 ? `Delete ${targets.length} Bookmarks` : "Delete Bookmark", danger: true, run: () => removeNodes(targets) },
+ {
+ label: targets.length > 1 ? `Delete ${targets.length} Bookmarks` : "Delete Bookmark",
+ danger: true,
+ run: () => removeNodes(targets),
+ },
]);
}}
- renderNode={(n) =>
- n.kind === "list" ? (
- <span className={styles.node}>
- <Icon name="toolwindow-bookmarks" size={16} className={styles.icon} />
- <span className={styles.label}>{n.name}</span>
- <span className={styles.meta}>
- {items.length} bookmark{items.length === 1 ? "" : "s"}
- </span>
- </span>
- ) : n.kind === "file" ? (
- <span className={styles.node}>
- <Icon name={fileIconName(n.name)} size={16} className={styles.icon} />
- <span className={styles.label}>{n.name}</span>
- <span className={styles.meta}>{n.dir}</span>
- </span>
- ) : (
- <span className={styles.node}>
- {n.bookmark.mnemonic ? (
- <span className={styles.mnemonic} aria-label={`Mnemonic ${n.bookmark.mnemonic}`}>
- {n.bookmark.mnemonic}
- </span>
- ) : (
- <Icon name="bookmark" size={16} className={styles.icon} />
- )}
- {n.bookmark.description ? (
- <>
- <span className={styles.label}>{n.bookmark.description}</span>
+ renderNode={(n) => {
+ switch (n.kind) {
+ case "list":
+ return (
+ <span className={styles.node}>
+ <Icon name="toolwindow-bookmarks" size={16} className={styles.icon} />
+ <span className={clsx(styles.label, n.isDefault && styles.defaultList)}>{n.list.name}</span>
<span className={styles.meta}>
- {basename(n.bookmark.path)}:{n.bookmark.line + 1}
- </span>
- </>
- ) : (
- <>
- <span className={styles.label}>
- {basename(n.bookmark.path)}:{n.bookmark.line + 1}
+ {t("search.bookmarks.count", { count: n.count })}
+ {n.isDefault ? tx(" · default") : ""}
</span>
- <span className={styles.code}>{n.bookmark.text.trim() || "(empty line)"}</span>
- </>
- )}
- </span>
- )
- }
+ </span>
+ );
+ case "folder":
+ return (
+ <span className={styles.node}>
+ <Icon name="folder" size={16} className={styles.icon} />
+ <span className={styles.label}>{n.name}</span>
+ <span className={styles.meta}>{n.dir}</span>
+ </span>
+ );
+ case "file":
+ return (
+ <span className={styles.node}>
+ <Icon name={fileIconName(n.name)} size={16} className={styles.icon} />
+ <span className={styles.label}>{n.name}</span>
+ {n.bookmarked && <Icon name="bookmark" size={12} className={styles.icon} label="Bookmarked file" />}
+ <span className={styles.meta}>{n.dir}</span>
+ </span>
+ );
+ case "mark":
+ return (
+ <span className={styles.node}>
+ {n.bookmark.mnemonic ? (
+ <span className={styles.mnemonic} aria-label={`Mnemonic ${n.bookmark.mnemonic}`}>
+ {n.bookmark.mnemonic}
+ </span>
+ ) : (
+ <Icon name="bookmark" size={16} className={styles.icon} />
+ )}
+ {n.bookmark.description ? (
+ <>
+ <span className={styles.label}>{n.bookmark.description}</span>
+ <span className={styles.meta}>
+ {basename(n.bookmark.path)}:{n.bookmark.line + 1}
+ </span>
+ </>
+ ) : (
+ <>
+ <span className={styles.label}>
+ {basename(n.bookmark.path)}:{n.bookmark.line + 1}
+ </span>
+ <span className={styles.code}>{n.bookmark.text.trim() || tx("(empty line)")}</span>
+ </>
+ )}
+ </span>
+ );
+ }
+ }}
/>
</div>
);
}
export function BookmarksActions() {
- const count = useBookmarks((s) => s.items.length);
- if (!count) return null;
- return <IconButton icon="trash" title="Remove All Bookmarks" size="small" onClick={() => updateBookmarks(() => [])} />;
+ const count = useBookmarks((s) => s.items.length + s.paths.length);
+ return (
+ <>
+ <IconButton icon="plus" title="New Bookmark List…" size="small" onClick={() => newList()} />
+ {count > 0 && (
+ <IconButton
+ icon="trash"
+ title="Remove All Bookmarks"
+ size="small"
+ onClick={() => updateBookmarkData((d) => ({ ...d, items: [], paths: [] }))}
+ />
+ )}
+ </>
+ );
}
diff --git a/src/features/search/bookmarks/store.ts b/src/features/search/bookmarks/store.ts
index fb9c99af1..f62371549 100644
--- a/src/features/search/bookmarks/store.ts
+++ b/src/features/search/bookmarks/store.ts
@@ -1,6 +1,8 @@
/**
- * Line bookmarks (F3), persisted per project in localStorage. A bookmark may
- * carry a mnemonic (0-9 / A-Z, unique: ⌥F3, ⌃⇧digit) and a description.
+ * Bookmarks, persisted per project in localStorage: line bookmarks (F3) and
+ * file / folder bookmarks, kept in named bookmark lists (one is the default
+ * that new bookmarks go to). A line bookmark may carry a mnemonic (0-9 / A-Z,
+ * unique: ⌥F3, ⌃⇧digit) and a description.
*/
import { create } from "zustand";
import { loadJson, saveJson } from "../common/open";
@@ -16,6 +18,21 @@ export interface Bookmark {
mnemonic?: string;
/** User text shown instead of the line (F3 on a selection, Rename). */
description?: string;
+ /** Id of its bookmark list; unset until stored (then the default list). */
+ list?: string;
+}
+
+/** A bookmarked file or folder (project view / editor tab). */
+export interface PathBookmark {
+ path: string;
+ dir: boolean;
+ list: string;
+ created: number;
+}
+
+export interface BookmarkList {
+ id: string;
+ name: string;
}
export const MNEMONICS = [..."1234567890", ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ"];
@@ -25,6 +42,9 @@ export function isMnemonic(c: unknown): c is string {
}
const KEY_PREFIX = "openidea.bookmarks.v1:";
+/** Lists and file / folder bookmarks; line bookmarks stay under `KEY_PREFIX` (readable by older versions). */
+const LISTS_PREFIX = "openidea.bookmarkLists.v1:";
+export const DEFAULT_LIST_ID = "default";
// --- pure helpers -----------------------------------------------------------
@@ -133,6 +153,7 @@ export function setFileLines(
seen.add(l.line);
const prev = old[i];
const b: Bookmark = { path, line: l.line, text: clip(l.text), created: prev?.created ?? Date.now() };
+ if (prev?.list) b.list = prev.list;
if (prev?.mnemonic) b.mnemonic = prev.mnemonic;
if (prev?.description) b.description = prev.description;
moved.push(b);
@@ -172,30 +193,183 @@ function sanitize(raw: unknown): Bookmark[] {
const out: Bookmark = { path: b.path, line: Math.max(0, b.line), text: String(b.text ?? ""), created: Number(b.created) || 0 };
if (isMnemonic(b.mnemonic)) out.mnemonic = b.mnemonic;
if (typeof b.description === "string" && b.description.trim()) out.description = b.description;
+ if (typeof b.list === "string" && b.list) out.list = b.list;
return out;
}),
);
}
+// --- lists -------------------------------------------------------------------
+
+/** Everything persisted for a project. */
+export interface BookmarkData {
+ items: Bookmark[];
+ paths: PathBookmark[];
+ lists: BookmarkList[];
+ defaultList: string;
+}
+
+export function pathBookmarkAt(paths: readonly PathBookmark[], path: string): PathBookmark | undefined {
+ return paths.find((b) => b.path === path);
+}
+
+/** Adds `targets` to the default list, or removes them all when every one is bookmarked already. */
+export function togglePathBookmarks(
+ data: BookmarkData,
+ targets: ReadonlyArray<{ path: string; dir: boolean }>,
+ now = Date.now(),
+): BookmarkData {
+ if (!targets.length) return data;
+ const all = targets.every((t) => pathBookmarkAt(data.paths, t.path));
+ const set = new Set(targets.map((t) => t.path));
+ if (all) return { ...data, paths: data.paths.filter((b) => !set.has(b.path)) };
+ const added = targets
+ .filter((t) => !pathBookmarkAt(data.paths, t.path))
+ .map((t) => ({ path: t.path, dir: t.dir, list: data.defaultList, created: now }));
+ return { ...data, paths: sortPaths([...data.paths, ...added]) };
+}
+
+function sortPaths(list: readonly PathBookmark[]): PathBookmark[] {
+ return [...list].sort((a, b) => a.path.localeCompare(b.path));
+}
+
+function newListId(lists: readonly BookmarkList[]): string {
+ for (let i = lists.length + 1; ; i++) if (!lists.some((l) => l.id === `list${i}`)) return `list${i}`;
+}
+
+/** Error text for a proposed list name, or null when valid. */
+export function validateListName(lists: readonly BookmarkList[], name: string, ownId?: string): string | null {
+ const n = name.trim();
+ if (!n) return "Name cannot be empty";
+ return lists.some((l) => l.id !== ownId && l.name === n) ? `A list named '${n}' already exists` : null;
+}
+
+export function createList(data: BookmarkData, name: string): { data: BookmarkData; id: string } {
+ const id = newListId(data.lists);
+ return { id, data: { ...data, lists: [...data.lists, { id, name: name.trim() }] } };
+}
+
+export function renameList(data: BookmarkData, id: string, name: string): BookmarkData {
+ return { ...data, lists: data.lists.map((l) => (l.id === id ? { ...l, name: name.trim() } : l)) };
+}
+
+export function setDefaultList(data: BookmarkData, id: string): BookmarkData {
+ return data.lists.some((l) => l.id === id) ? { ...data, defaultList: id } : data;
+}
+
+/** Deletes a list with its bookmarks; the default moves to the first remaining list (a fresh one when none). */
+export function deleteList(data: BookmarkData, id: string, fallbackName: string): BookmarkData {
+ const lists = data.lists.filter((l) => l.id !== id);
+ const next: BookmarkData = {
+ items: data.items.filter((b) => b.list !== id),
+ paths: data.paths.filter((b) => b.list !== id),
+ lists: lists.length ? lists : [{ id: DEFAULT_LIST_ID, name: fallbackName }],
+ defaultList: data.defaultList,
+ };
+ if (!next.lists.some((l) => l.id === next.defaultList)) next.defaultList = next.lists[0]!.id;
+ return next;
+}
+
+/** Identifies a bookmark for moving: a line (`path` + `line`) or a file / folder (`path`). */
+export type BookmarkRef = { path: string; line?: number };
+
+export function moveBookmarks(data: BookmarkData, refs: readonly BookmarkRef[], to: string): BookmarkData {
+ if (!data.lists.some((l) => l.id === to)) return data;
+ const lines = new Set(refs.filter((r) => r.line !== undefined).map((r) => `${r.path}\u0000${r.line}`));
+ const paths = new Set(refs.filter((r) => r.line === undefined).map((r) => r.path));
+ return {
+ ...data,
+ items: data.items.map((b) => (lines.has(`${b.path}\u0000${b.line}`) ? { ...b, list: to } : b)),
+ paths: data.paths.map((b) => (paths.has(b.path) ? { ...b, list: to } : b)),
+ };
+}
+
+export function renamePathBookmarks(list: readonly PathBookmark[], from: string, to: string | null): PathBookmark[] {
+ const out: PathBookmark[] = [];
+ for (const b of list) {
+ if (b.path === from || b.path.startsWith(from + "/")) {
+ if (to !== null) out.push({ ...b, path: to + b.path.slice(from.length) });
+ } else out.push(b);
+ }
+ return sortPaths(out);
+}
+
+function sanitizeData(raw: unknown, items: Bookmark[], projectName: string): BookmarkData {
+ const o = (raw && typeof raw === "object" ? raw : {}) as Record<string, unknown>;
+ const lists: BookmarkList[] = [];
+ for (const l of Array.isArray(o.lists) ? o.lists : []) {
+ const id = (l as BookmarkList | null)?.id;
+ const name = (l as BookmarkList | null)?.name;
+ if (typeof id === "string" && id && typeof name === "string" && !lists.some((x) => x.id === id))
+ lists.push({ id, name: name.trim() || id });
+ }
+ if (!lists.length) lists.push({ id: DEFAULT_LIST_ID, name: projectName });
+ const ids = new Set(lists.map((l) => l.id));
+ const defaultList = typeof o.defaultList === "string" && ids.has(o.defaultList) ? o.defaultList : lists[0]!.id;
+ const paths = (Array.isArray(o.paths) ? o.paths : [])
+ .filter((b): b is PathBookmark => !!b && typeof b === "object" && typeof (b as PathBookmark).path === "string")
+ .map((b) => ({
+ path: b.path,
+ dir: b.dir === true,
+ list: typeof b.list === "string" && ids.has(b.list) ? b.list : defaultList,
+ created: Number(b.created) || 0,
+ }));
+ return {
+ // Bookmarks saved before lists existed belong to the default list.
+ items: items.map((b) => (b.list && ids.has(b.list) ? b : { ...b, list: defaultList })),
+ paths: sortPaths(paths),
+ lists,
+ defaultList,
+ };
+}
+
// --- store ------------------------------------------------------------------
-interface BookmarksState {
+interface BookmarksState extends BookmarkData {
scope: string | null;
- items: Bookmark[];
}
-export const useBookmarks = create<BookmarksState>(() => ({ scope: null, items: [] }));
+const projectName = (scope: string) => scope.slice(scope.lastIndexOf("/") + 1) || scope;
+
+const EMPTY: BookmarkData = {
+ items: [],
+ paths: [],
+ lists: [{ id: DEFAULT_LIST_ID, name: "Bookmarks" }],
+ defaultList: DEFAULT_LIST_ID,
+};
+
+export const useBookmarks = create<BookmarksState>(() => ({ scope: null, ...EMPTY }));
export function loadBookmarks(scope: string | null) {
- useBookmarks.setState({ scope, items: scope ? sanitize(loadJson<unknown>(KEY_PREFIX + scope, [])) : [] });
+ if (!scope) return useBookmarks.setState({ scope, ...EMPTY });
+ const items = sanitize(loadJson<unknown>(KEY_PREFIX + scope, []));
+ useBookmarks.setState({
+ scope,
+ ...sanitizeData(loadJson<unknown>(LISTS_PREFIX + scope, null), items, projectName(scope)),
+ });
+}
+
+/** Changes lists / file bookmarks (and line bookmarks); new line bookmarks go to the default list. */
+export function updateBookmarkData(fn: (data: BookmarkData) => BookmarkData) {
+ const { scope, items, paths, lists, defaultList } = useBookmarks.getState();
+ const prev: BookmarkData = { items, paths, lists, defaultList };
+ const next = fn(prev);
+ if (next === prev) return;
+ const filled = next.items.some((b) => !b.list)
+ ? next.items.map((b) => (b.list ? b : { ...b, list: next.defaultList }))
+ : next.items;
+ useBookmarks.setState({ ...next, items: filled });
+ if (!scope) return;
+ if (filled !== items) saveJson(KEY_PREFIX + scope, filled);
+ if (next.paths !== paths || next.lists !== lists || next.defaultList !== defaultList)
+ saveJson(LISTS_PREFIX + scope, { lists: next.lists, defaultList: next.defaultList, paths: next.paths });
}
export function updateBookmarks(fn: (list: readonly Bookmark[]) => Bookmark[]) {
- const { scope, items } = useBookmarks.getState();
- const next = fn(items);
- if (next === items) return;
- useBookmarks.setState({ items: next });
- if (scope) saveJson(KEY_PREFIX + scope, next);
+ updateBookmarkData((data) => {
+ const items = fn(data.items);
+ return items === data.items ? data : { ...data, items };
+ });
}
// --- popups -----------------------------------------------------------------
@@ -216,6 +390,13 @@ interface BookmarkPopupsState {
list: boolean;
/** Edit Description dialog (F2 in the Bookmarks view / popup). */
editing: { path: string; line: number } | null;
+ /** New / rename bookmark list dialog; `then` receives the new list's id. */
+ naming: { listId?: string; then?: (id: string) => void } | null;
}
-export const useBookmarkPopups = create<BookmarkPopupsState>(() => ({ chooser: null, list: false, editing: null }));
+export const useBookmarkPopups = create<BookmarkPopupsState>(() => ({
+ chooser: null,
+ list: false,
+ editing: null,
+ naming: null,
+}));
diff --git a/src/features/search/everywhere/FilterPopup.tsx b/src/features/search/everywhere/FilterPopup.tsx
new file mode 100644
index 000000000..41ccfef8a
--- /dev/null
+++ b/src/features/search/everywhere/FilterPopup.tsx
@@ -0,0 +1,192 @@
+/**
+ * The funnel popup of a Search Everywhere tab: checklists of file types /
+ * languages / symbol kinds (with "All") or the Text tab's file mask.
+ * Changes apply immediately and are remembered per tab.
+ */
+import { useEffect, useMemo, useState } from "react";
+import { Button, Checkbox, Input, Popup, T, type PopupAnchor } from "@/ui";
+import { recentMasks } from "../find/store";
+import { KIND_LABELS, kindsFor, type FilterTab, type SeFilters } from "./filters";
+import { loadLanguages } from "./deps";
+import { setSearchEverywhereFilter } from "./store";
+import styles from "./SearchEverywhere.module.css";
+
+interface Option {
+ id: string;
+ label: string;
+ /** A UI string (kinds), translated; language names are shown as is. */
+ translate?: boolean;
+}
+
+function Checklist({
+ title,
+ options,
+ excluded,
+ onChange,
+}: {
+ title: string;
+ options: readonly Option[];
+ excluded: readonly string[];
+ onChange: (excluded: string[]) => void;
+}) {
+ const off = new Set(excluded);
+ const shown = options.filter((o) => !off.has(o.id)).length;
+ return (
+ <div className={styles.filterGroup} role="group" aria-label={title}>
+ <div className={styles.filterTitle}>
+ <T>{title}</T>
+ </div>
+ <Checkbox
+ className={styles.filterAll}
+ checked={shown === options.length}
+ indeterminate={shown > 0 && shown < options.length}
+ label="All"
+ onChange={(v) => onChange(v ? [] : options.map((o) => o.id))}
+ />
+ <div className={styles.filterItems}>
+ {options.map((o) => (
+ <Checkbox
+ key={o.id}
+ checked={!off.has(o.id)}
+ label={o.translate ? o.label : <span>{o.label}</span>}
+ aria-label={o.label}
+ onChange={(v) => onChange(v ? excluded.filter((x) => x !== o.id) : [...excluded, o.id])}
+ />
+ ))}
+ </div>
+ </div>
+ );
+}
+
+export function FilterPopup({
+ tab,
+ filters,
+ anchor,
+ onClose,
+}: {
+ tab: FilterTab;
+ filters: SeFilters;
+ anchor: PopupAnchor;
+ onClose: () => void;
+}) {
+ const [languages, setLanguages] = useState<Option[]>([]);
+ useEffect(() => {
+ if (tab === "text") return;
+ let alive = true;
+ void loadLanguages().then((list) => {
+ if (!alive) return;
+ setLanguages(
+ list
+ .filter((l) => l.extensions.length > 0)
+ .map((l) => ({ id: l.id, label: l.name }))
+ .sort((a, b) => a.label.localeCompare(b.label)),
+ );
+ });
+ return () => {
+ alive = false;
+ };
+ }, [tab]);
+ const kinds = useMemo<Option[]>(
+ () =>
+ tab === "classes" || tab === "symbols"
+ ? kindsFor(tab).map((k) => ({ id: k, label: KIND_LABELS[k] ?? k, translate: true }))
+ : [],
+ [tab],
+ );
+
+ return (
+ <Popup
+ open
+ anchor={anchor}
+ placement="bottom-end"
+ onClose={onClose}
+ className={styles.filterPopup}
+ aria-label="Filter"
+ trapFocus
+ >
+ {tab === "text" ? (
+ <MaskFilter mask={filters.text.mask} onClose={onClose} />
+ ) : tab === "files" ? (
+ <Checklist
+ title="File Types"
+ options={languages}
+ excluded={filters.files.languages}
+ onChange={(languages) => setSearchEverywhereFilter("files", { languages })}
+ />
+ ) : (
+ <>
+ <Checklist
+ title={tab === "classes" ? "Kinds" : "Symbol Kinds"}
+ options={kinds}
+ excluded={filters[tab].kinds}
+ onChange={(k) => setSearchEverywhereFilter(tab, { ...filters[tab], kinds: k })}
+ />
+ <Checklist
+ title="Languages"
+ options={languages}
+ excluded={filters[tab].languages}
+ onChange={(l) => setSearchEverywhereFilter(tab, { ...filters[tab], languages: l })}
+ />
+ </>
+ )}
+ </Popup>
+ );
+}
+
+function MaskFilter({ mask, onClose }: { mask: string; onClose: () => void }) {
+ const [value, setValue] = useState(mask);
+ const apply = (m: string) => setSearchEverywhereFilter("text", { mask: m.trim() });
+ return (
+ <div className={styles.filterGroup}>
+ <label className={styles.filterTitle} htmlFor="se-file-mask">
+ <T>File mask</T>
+ </label>
+ <Input
+ id="se-file-mask"
+ data-autofocus
+ value={value}
+ placeholder="*.ts, !*.test.*"
+ spellCheck={false}
+ onChange={(e) => {
+ setValue(e.target.value);
+ apply(e.target.value);
+ }}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ onClose();
+ }
+ }}
+ />
+ <div className={styles.filterMasks}>
+ {recentMasks()
+ .slice(0, 8)
+ .map((m) => (
+ <button
+ key={m}
+ type="button"
+ className={styles.filterMask}
+ onClick={() => {
+ setValue(m);
+ apply(m);
+ }}
+ >
+ {m}
+ </button>
+ ))}
+ </div>
+ {mask && (
+ <Button
+ variant="ghost"
+ size="small"
+ onClick={() => {
+ setValue("");
+ apply("");
+ }}
+ >
+ Clear
+ </Button>
+ )}
+ </div>
+ );
+}
diff --git a/src/features/search/everywhere/SearchEverywhere.module.css b/src/features/search/everywhere/SearchEverywhere.module.css
index eda492a8a..4e5739797 100644
--- a/src/features/search/everywhere/SearchEverywhere.module.css
+++ b/src/features/search/everywhere/SearchEverywhere.module.css
@@ -295,3 +295,49 @@
display: flex;
align-items: center;
}
+.filterPopup {
+ min-width: 220px;
+ max-height: 60vh;
+ overflow: auto;
+ padding: 6px 0;
+}
+.filterGroup {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ padding: 4px 12px 8px;
+}
+.filterGroup + .filterGroup {
+ border-top: 1px solid var(--border-popup);
+ padding-top: 8px;
+}
+.filterTitle {
+ color: var(--fg-secondary);
+ font-size: var(--fs-small);
+}
+.filterAll {
+ font-weight: 600;
+}
+.filterItems {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ padding-left: 4px;
+}
+.filterMasks {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 4px;
+}
+.filterMask {
+ padding: 1px 6px;
+ border: 1px solid var(--border-strong);
+ border-radius: var(--radius-small);
+ background: none;
+ color: var(--fg);
+ font: inherit;
+ font-family: var(--font-mono);
+}
+.filterMask:hover {
+ background: var(--bg-hover);
+}
diff --git a/src/features/search/everywhere/SearchEverywhere.tsx b/src/features/search/everywhere/SearchEverywhere.tsx
index f8d6a76ba..ab32e53db 100644
--- a/src/features/search/everywhere/SearchEverywhere.tsx
+++ b/src/features/search/everywhere/SearchEverywhere.tsx
@@ -2,7 +2,7 @@ import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type MouseEve
import clsx from "clsx";
import { actionToggled, executeAction, getAction } from "@/platform/actions";
import type { ProjectFileSet } from "@/platform/ipc";
-import { useTx } from "@/platform/i18n";
+import { tx as translate, useTx } from "@/platform/i18n";
import { hasPrimaryModifier, shortcutLabel } from "@/platform/keymap";
import {
Checkbox,
@@ -27,7 +27,9 @@ import { badgeKind, basename, openLocation, relDir } from "../common/open";
import { parseLocationQuery } from "../common/query";
import { CodePreview, type PreviewHighlight } from "../find/parts";
import { SeController, type SeSnapshot } from "./controller";
-import { ipcDeps } from "./deps";
+import { ipcDeps, loadLanguages } from "./deps";
+import { extensionIndex, filterActive, isFilterTab, languageOf, resolveFilter } from "./filters";
+import { FilterPopup } from "./FilterPopup";
import {
MORE_STEP_ALL,
MORE_STEP_TAB,
@@ -88,6 +90,7 @@ function SearchEverywhereDialog() {
const session = useSearchEverywhere((s) => s.session);
const ctx = useSearchEverywhere((s) => s.ctx);
const preview = useSearchEverywhere((s) => s.preview);
+ const filters = useSearchEverywhere((s) => s.filters);
const inputRef = useRef<HTMLInputElement>(null);
const listRef = useRef<HTMLDivElement>(null);
@@ -103,6 +106,21 @@ function SearchEverywhereDialog() {
} | null>(null);
/** Position in the tab's history while ⌥↑/⌥↓ browse it (-1 = the typed draft). */
const history = useRef({ pos: -1, draft: "" });
+ const [filterAnchor, setFilterAnchor] = useState<HTMLElement | null>(null);
+ const [byExt, setByExt] = useState<ReadonlyMap<string, string> | null>(null);
+ const needsLanguages = (tab === "files" || tab === "classes" || tab === "symbols") && filterActive(filters, tab);
+ useEffect(() => {
+ if (!needsLanguages || byExt) return;
+ let alive = true;
+ void loadLanguages().then((l) => alive && setByExt(extensionIndex(l)));
+ return () => {
+ alive = false;
+ };
+ }, [needsLanguages, byExt]);
+ const filter = useMemo(
+ () => resolveFilter(filters, tab, byExt ? (path) => languageOf(path, byExt) : undefined),
+ [filters, tab, byExt],
+ );
const [toggleTick, setToggleTick] = useState(0);
const bumpToggles = () => setToggleTick((t) => t + 1);
@@ -130,8 +148,19 @@ function SearchEverywhereDialog() {
const searchQuery = parseCommand(debounced)?.kind === "list" ? "" : debounced;
useEffect(() => {
- controller.run({ query: searchQuery, tab, includeNonProject, fileSet: tab === "all" ? null : fileSet, extra });
- }, [controller, searchQuery, tab, includeNonProject, fileSet, extra]);
+ // A language filter waits for the language list (nothing would be filtered yet).
+ if (filter?.excludedLanguages?.length && !filter.languageOf) return;
+ controller.run({
+ query: searchQuery,
+ tab,
+ includeNonProject,
+ fileSet: tab === "all" ? null : fileSet,
+ filter,
+ // IDEA: the Actions tab's "everywhere" checkbox is "Include disabled actions".
+ includeDisabled: tab === "actions" ? includeNonProject : undefined,
+ extra,
+ });
+ }, [controller, searchQuery, tab, includeNonProject, fileSet, filter, extra]);
useEffect(() => {
inputRef.current?.select();
@@ -241,6 +270,8 @@ function SearchEverywhereDialog() {
return;
}
return closeThen(() => void executeAction(row.id));
+ case "setting":
+ return closeThen(() => void executeAction("file.settings", row.pageId));
}
};
@@ -251,19 +282,19 @@ function SearchEverywhereDialog() {
activate(activeRow, pending.side);
});
+ /** IDEA's ⌥↵ on an action: record a shortcut for it (written to the active keymap). */
+ const assignShortcut = (id: string) => closeThen(() => void executeAction("settings.assignShortcut", id));
+
const openIntentions = () => {
const row = activeRow;
if (!row || row.kind === "section" || row.kind === "more" || row.kind === "command") return;
+ if (row.kind === "action") return assignShortcut(row.id);
const anchor = listRef.current?.querySelector('[aria-selected="true"]') ?? inputRef.current;
if (!anchor) return;
const copy = (text: string) => void navigator.clipboard?.writeText(text).catch(() => {});
const items: MenuItem[] =
- row.kind === "action"
- ? [
- { label: "Execute", disabled: !row.enabled, run: () => activate(row) },
- { kind: "separator" },
- { label: "Copy Action ID", run: () => copy(row.id) },
- ]
+ row.kind === "setting"
+ ? [{ label: "Open Settings Page", run: () => activate(row) }]
: [
{ label: "Open", run: () => activate(row) },
{ label: "Open to the Side", shortcut: "⇧↵", run: () => activate(row, true) },
@@ -374,7 +405,7 @@ function SearchEverywhereDialog() {
setIncludeNonProject(v);
inputRef.current?.focus();
}}
- label="Include non-project items"
+ label={tab === "actions" ? "Include disabled actions" : "Include non-project items"}
/>
) : (
// IDEA's scope chooser of the Classes / Files / Symbols / Text tabs.
@@ -400,6 +431,19 @@ function SearchEverywhereDialog() {
onMouseDown={(e) => e.preventDefault()}
onClick={() => setSearchEverywherePreview(!preview)}
/>
+ {isFilterTab(tab) && (
+ <IconButton
+ icon="filter"
+ size="small"
+ className={styles.headerButton}
+ title={tx("Filter")}
+ pressed={filterActive(filters, tab)}
+ aria-haspopup="dialog"
+ aria-expanded={!!filterAnchor}
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={(e) => setFilterAnchor(filterAnchor ? null : e.currentTarget)}
+ />
+ )}
<IconButton
icon="open-in-tool-window"
size="small"
@@ -511,6 +555,17 @@ function SearchEverywhereDialog() {
)}
</footer>
)}
+ {filterAnchor && isFilterTab(tab) && (
+ <FilterPopup
+ tab={tab}
+ filters={filters}
+ anchor={filterAnchor}
+ onClose={() => {
+ setFilterAnchor(null);
+ inputRef.current?.focus();
+ }}
+ />
+ )}
<Menu
open={!!menu}
anchor={menu?.anchor ?? null}
@@ -534,8 +589,11 @@ function describe(row: SeRow | undefined): string {
return "";
case "action": {
const a = getAction(row.id);
- return a?.description ?? (row.category ? `${row.category} | ${row.title}` : row.title);
+ const text = a?.description ?? (row.category ? `${row.category} | ${row.title}` : row.title);
+ return `${text} · ${translate("⌥↵ to assign a shortcut")}`;
}
+ case "setting":
+ return [...row.path, row.title].map((p) => translate(p)).join(" | ");
case "file":
return row.rel;
case "symbol":
@@ -669,6 +727,21 @@ function ResultRow({
</span>
);
}
+ case "setting":
+ return (
+ <>
+ <span className={styles.icon}>
+ <Icon name="settings" size={16} />
+ </span>
+ <span className={styles.main}>
+ <HighlightedText className={styles.name} text={row.title} indices={row.indices} tone={tone} />
+ </span>
+ <span className={styles.right}>
+ {tx("Settings")}
+ {row.path.length ? `: ${row.path.map((p) => tx(p)).join(" | ")}` : ""}
+ </span>
+ </>
+ );
case "text":
return (
<>
diff --git a/src/features/search/everywhere/controller.ts b/src/features/search/everywhere/controller.ts
index ed9a08b6b..a0d9076f9 100644
--- a/src/features/search/everywhere/controller.ts
+++ b/src/features/search/everywhere/controller.ts
@@ -16,7 +16,9 @@ import type {
SymbolMatch,
WorkspaceSymbol,
} from "@/platform/ipc";
+import type { SettingsSearchEntry } from "@/workbench/contributions";
import { parseLocationQuery } from "../common/query";
+import { passesFilter, type ResolvedFilter } from "./filters";
import {
ALL_TAB_LIMIT,
RECENT_LIMIT,
@@ -24,6 +26,8 @@ import {
actionItem,
fileItem,
matchActions,
+ matchSettings,
+ mergeActionResults,
mergeSymbols,
sectionsFor,
textItems,
@@ -46,6 +50,8 @@ export interface SeDeps {
isEnabled(a: Action): boolean;
recentFiles(): Promise<string[]>;
recentActions(): readonly string[];
+ /** Settings pages / options listed with actions ("Settings: …"). */
+ settings?(): Promise<SettingsSearchEntry[]>;
root(): string | null;
now(): number;
/** Whether `path` is in a root-based named scope ("Project Test Files" …). */
@@ -58,6 +64,10 @@ export interface SeRequest {
includeNonProject: boolean;
/** "Project Production Files" / "Project Test Files"; unset or `all` = every project file. */
fileSet?: ProjectFileSet | null;
+ /** The tab's funnel filter (file types, languages, kinds, file mask). */
+ filter?: ResolvedFilter | null;
+ /** Actions: list disabled ones too (unset = include them). */
+ includeDisabled?: boolean;
/** Per-section extra rows requested via "Show more". */
extra: Partial<Record<SectionId, number>>;
}
@@ -117,7 +127,15 @@ export class SeController {
}
for (const id of wanted) {
const limit = sectionLimit(req.tab, id, req.extra[id] ?? 0);
- const sig = JSON.stringify([req.query, req.tab, req.includeNonProject, req.fileSet ?? "all", limit]);
+ const sig = JSON.stringify([
+ req.query,
+ req.tab,
+ req.includeNonProject,
+ req.fileSet ?? "all",
+ req.filter ?? null,
+ req.includeDisabled ?? null,
+ limit,
+ ]);
if (this.signatures.get(id) === sig && this.sections.has(id)) continue;
this.signatures.set(id, sig);
this.cancelSection(id);
@@ -213,7 +231,12 @@ export class SeController {
break;
}
case "files": {
- const keep = this.scopeFilter(req);
+ const scope = this.scopeFilter(req);
+ const filter = req.filter;
+ const keep =
+ scope || filter
+ ? (path: string) => (!scope || scope(path)) && (!filter || passesFilter(filter, path))
+ : null;
// Over-fetch so a narrowed scope still fills the section.
const fetched = await this.deps.findFiles(text, keep ? limit * 4 + 1 : limit + 1);
const matches = keep ? fetched.filter((m) => keep(m.path)) : fetched;
@@ -234,8 +257,17 @@ export class SeController {
const hits = matchActions(this.deps.actions(), text, {
isEnabled: (a) => this.deps.isEnabled(a),
recent: this.deps.recentActions(),
+ includeDisabled: req.includeDisabled,
});
- this.set(id, gen, hits.slice(0, limit), hits.length > limit, false);
+ if (!this.deps.settings || !text) {
+ this.set(id, gen, hits.slice(0, limit), hits.length > limit, false);
+ break;
+ }
+ // Actions answer at once; settings follow when their index has loaded.
+ this.set(id, gen, hits.slice(0, limit), hits.length > limit, true);
+ const settings = matchSettings(await this.deps.settings().catch(() => []), text);
+ const all = mergeActionResults(hits, settings);
+ this.set(id, gen, all.slice(0, limit), all.length > limit, false);
break;
}
case "text":
@@ -257,17 +289,27 @@ export class SeController {
excludeTypes: !typesOnly && req.tab === "all",
limit,
};
- // Over-fetch in the All tab: types are filtered out of Symbols there.
- const fetch = opts.excludeTypes ? limit * 2 + 1 : limit + 1;
+ const filter = req.filter;
+ // Over-fetch in the All tab (types are filtered out of Symbols there) and under a filter.
+ const fetch = filter ? limit * 4 + 1 : opts.excludeTypes ? limit * 2 + 1 : limit + 1;
let index: SymbolMatch[] = [];
let lsp: WorkspaceSymbol[] = [];
let indexDone = false;
let lspDone = !this.deps.workspaceSymbols;
const keep = this.scopeFilter(req);
const publish = () => {
- const merged = mergeSymbols(index, lsp, text, opts);
- const items = keep ? merged.items.filter((i) => keep(i.path)) : merged.items;
- this.set(id, gen, items, merged.hasMore || index.length >= fetch, !(indexDone && lspDone));
+ const merged = mergeSymbols(index, lsp, text, { ...opts, limit: filter ? fetch : limit });
+ const passed = merged.items.filter(
+ (i) => (!keep || keep(i.path)) && (!filter || passesFilter(filter, i.path, i.symbolKind)),
+ );
+ const items = filter ? passed.slice(0, limit) : passed;
+ this.set(
+ id,
+ gen,
+ items,
+ merged.hasMore || index.length >= fetch || passed.length > items.length,
+ !(indexDone && lspDone),
+ );
};
const lspPromise = this.deps.workspaceSymbols
? this.deps
@@ -314,7 +356,7 @@ export class SeController {
isRegex: false,
caseSensitive: false,
wholeWord: false,
- include: [],
+ include: req?.filter?.mask ? [req.filter.mask] : [],
exclude: [],
scope: req?.fileSet && req.fileSet !== "all" ? { kind: "fileSet", set: req.fileSet } : { kind: "project" },
maxMatches: limit + 1,
diff --git a/src/features/search/everywhere/deps.ts b/src/features/search/everywhere/deps.ts
index 36259dbce..73bff101c 100644
--- a/src/features/search/everywhere/deps.ts
+++ b/src/features/search/everywhere/deps.ts
@@ -1,7 +1,8 @@
import { allActions, type Action } from "@/platform/actions";
import { evaluateWhen, type ContextKeys } from "@/platform/context";
-import { call, commands, nextRequestId } from "@/platform/ipc";
+import { call, commands, nextRequestId, type LanguageInfo } from "@/platform/ipc";
import { inFileSet } from "@/platform/projectRoots";
+import { searchableSettings } from "@/workbench/contributions";
import { projectRoot } from "../common/open";
import { cancelRequest, streamSearch } from "../common/textSearch";
import type { SeDeps } from "./controller";
@@ -28,8 +29,19 @@ export function ipcDeps(ctx: ContextKeys): SeDeps {
},
recentFiles: async () => (await call(commands.recentFiles())).map(String),
recentActions,
+ settings: searchableSettings,
root: projectRoot,
now: () => performance.now(),
inFileSet: (set, path) => inFileSet(set, path),
};
}
+
+let languages: Promise<LanguageInfo[]> | null = null;
+
+/** The backend's language list (file types of the Files / Symbols filters), loaded once. */
+export function loadLanguages(): Promise<LanguageInfo[]> {
+ return (languages ??= commands.languages().catch(() => {
+ languages = null;
+ return [];
+ }));
+}
diff --git a/src/features/search/everywhere/filters.ts b/src/features/search/everywhere/filters.ts
new file mode 100644
index 000000000..eca742bd7
--- /dev/null
+++ b/src/features/search/everywhere/filters.ts
@@ -0,0 +1,154 @@
+/**
+ * Per-tab result filters of Search Everywhere (IDEA's funnel): file types on
+ * Files, languages + symbol kinds on Classes / Symbols, a file mask on Text.
+ * Stored as exclusions so newly known languages / kinds show by default.
+ */
+import type { LanguageInfo } from "@/platform/ipc";
+import type { SeTab } from "./model";
+
+export interface SeFilters {
+ /** Excluded language ids (Files). */
+ files: { languages: string[] };
+ /** Excluded language ids and symbol kinds. */
+ classes: { languages: string[]; kinds: string[] };
+ symbols: { languages: string[]; kinds: string[] };
+ /** Comma-separated globs (`*.ts, !*.test.*`); empty = every file. */
+ text: { mask: string };
+}
+
+export type FilterTab = keyof SeFilters;
+
+export const FILTER_TABS: readonly FilterTab[] = ["files", "classes", "symbols", "text"];
+
+export const isFilterTab = (tab: SeTab): tab is FilterTab => (FILTER_TABS as readonly string[]).includes(tab);
+
+export const DEFAULT_FILTERS: SeFilters = {
+ files: { languages: [] },
+ classes: { languages: [], kinds: [] },
+ symbols: { languages: [], kinds: [] },
+ text: { mask: "" },
+};
+
+const strings = (v: unknown): string[] =>
+ Array.isArray(v) ? [...new Set(v.filter((x): x is string => typeof x === "string"))] : [];
+
+/** Tolerates missing / malformed stored values (older or newer versions). */
+export function sanitizeFilters(raw: unknown): SeFilters {
+ const o = (raw && typeof raw === "object" ? raw : {}) as Record<string, Record<string, unknown> | undefined>;
+ return {
+ files: { languages: strings(o.files?.languages) },
+ classes: { languages: strings(o.classes?.languages), kinds: strings(o.classes?.kinds) },
+ symbols: { languages: strings(o.symbols?.languages), kinds: strings(o.symbols?.kinds) },
+ text: { mask: typeof o.text?.mask === "string" ? o.text.mask : "" },
+ };
+}
+
+export function filterActive(filters: SeFilters, tab: SeTab): boolean {
+ switch (tab) {
+ case "files":
+ return filters.files.languages.length > 0;
+ case "classes":
+ case "symbols":
+ return filters[tab].languages.length > 0 || filters[tab].kinds.length > 0;
+ case "text":
+ return !!filters.text.mask.trim();
+ default:
+ return false;
+ }
+}
+
+/** Symbol kinds offered per tab, in IDEA's order. */
+export const CLASS_KINDS = ["class", "interface", "struct", "enum", "trait", "typeAlias"] as const;
+export const SYMBOL_KINDS = [
+ ...CLASS_KINDS,
+ "function",
+ "method",
+ "constructor",
+ "field",
+ "property",
+ "variable",
+ "constant",
+ "enumMember",
+ "module",
+ "namespace",
+ "macro",
+] as const;
+
+export const KIND_LABELS: Record<string, string> = {
+ class: "Classes",
+ interface: "Interfaces",
+ struct: "Structs",
+ enum: "Enums",
+ trait: "Traits",
+ typeAlias: "Type Aliases",
+ function: "Functions",
+ method: "Methods",
+ constructor: "Constructors",
+ field: "Fields",
+ property: "Properties",
+ variable: "Variables",
+ constant: "Constants",
+ enumMember: "Enum Members",
+ module: "Modules",
+ namespace: "Namespaces",
+ macro: "Macros",
+};
+
+export function kindsFor(tab: "classes" | "symbols"): readonly string[] {
+ return tab === "classes" ? CLASS_KINDS : SYMBOL_KINDS;
+}
+
+/** Kinds the menu doesn't list fall under the closest listed one. */
+function kindBucket(kind: string): string {
+ if (kind === "package") return "module";
+ if (kind === "typeParameter") return "typeAlias";
+ return kind;
+}
+
+/** Extension (lower-case, without dot) → language id. */
+export function extensionIndex(languages: readonly Pick<LanguageInfo, "id" | "extensions">[]): Map<string, string> {
+ const m = new Map<string, string>();
+ for (const l of languages) for (const e of l.extensions) if (!m.has(e.toLowerCase())) m.set(e.toLowerCase(), l.id);
+ return m;
+}
+
+export function languageOf(path: string, byExt: ReadonlyMap<string, string>): string | null {
+ const name = path.slice(path.lastIndexOf("/") + 1).toLowerCase();
+ // Longest suffix first: `d.ts` before `ts`.
+ for (let i = name.indexOf("."); i >= 0; i = name.indexOf(".", i + 1)) {
+ const id = byExt.get(name.slice(i + 1));
+ if (id) return id;
+ }
+ return null;
+}
+
+/** What the controller needs to apply a tab's filter. */
+export interface ResolvedFilter {
+ /** Language id of a path (null when unknown: never filtered out). */
+ languageOf?: (path: string) => string | null;
+ excludedLanguages?: readonly string[];
+ excludedKinds?: readonly string[];
+ /** Text tab: include globs. */
+ mask?: string;
+}
+
+export function resolveFilter(
+ filters: SeFilters,
+ tab: SeTab,
+ languageOfPath: ((path: string) => string | null) | undefined,
+): ResolvedFilter | null {
+ if (!isFilterTab(tab) || !filterActive(filters, tab)) return null;
+ if (tab === "text") return { mask: filters.text.mask.trim() };
+ if (tab === "files") return { languageOf: languageOfPath, excludedLanguages: filters.files.languages };
+ return { languageOf: languageOfPath, excludedLanguages: filters[tab].languages, excludedKinds: filters[tab].kinds };
+}
+
+/** Whether a result passes the filter (`kind` for symbols). */
+export function passesFilter(f: ResolvedFilter, path: string, kind?: string): boolean {
+ if (kind !== undefined && f.excludedKinds?.length && f.excludedKinds.includes(kindBucket(kind))) return false;
+ if (f.excludedLanguages?.length && f.languageOf) {
+ const lang = f.languageOf(path);
+ if (lang && f.excludedLanguages.includes(lang)) return false;
+ }
+ return true;
+}
diff --git a/src/features/search/everywhere/model.ts b/src/features/search/everywhere/model.ts
index 84a5f79c5..bbe92888b 100644
--- a/src/features/search/everywhere/model.ts
+++ b/src/features/search/everywhere/model.ts
@@ -4,6 +4,7 @@
*/
import type { Action } from "@/platform/actions";
import type { FileMatch, LineMatch, SymbolMatch, WorkspaceSymbol } from "@/platform/ipc";
+import type { SettingsSearchEntry } from "@/workbench/contributions";
import { tx } from "@/platform/i18n";
import { basename, isTypeKind, relDir, symbolDisplayName } from "../common/open";
import { byScore, matchText } from "../common/rank";
@@ -116,7 +117,18 @@ export interface TextItem {
indices: number[];
}
-export type SeItem = FileItem | SymbolItem | ActionItem | TextItem;
+/** A settings page or option, listed among actions ("Settings: Editor | General"). */
+export interface SettingItem {
+ kind: "setting";
+ key: string;
+ pageId: string;
+ title: string;
+ path: string[];
+ indices: number[];
+ score: number;
+}
+
+export type SeItem = FileItem | SymbolItem | ActionItem | TextItem | SettingItem;
export type SeRow =
| { kind: "section"; key: string; section: SectionId; title: string }
@@ -281,6 +293,44 @@ export function matchActions(
return byScore(out);
}
+/** Settings below equally good actions, as IDEA's option matches. */
+const SETTING_PENALTY = 120;
+
+export function matchSettings(entries: readonly SettingsSearchEntry[], query: string): SettingItem[] {
+ const q = query.trim();
+ if (!q) return [];
+ const out: SettingItem[] = [];
+ const seen = new Set<string>();
+ for (const e of entries) {
+ const title = tx(e.title);
+ const hit = matchText(title, q, { wordAligned: true });
+ const english = hit || title === e.title ? null : matchText(e.title, q, { wordAligned: true });
+ let score: number;
+ let indices: number[] = [];
+ if (hit) {
+ score = hit.score;
+ indices = hit.indices;
+ } else if (english) {
+ score = english.score;
+ } else {
+ const extra = [...e.path.map((p) => tx(p)), ...(e.keywords ?? [])];
+ const best = Math.max(-Infinity, ...extra.map((t) => matchText(t, q, { wordAligned: true })?.score ?? -Infinity));
+ if (!Number.isFinite(best)) continue;
+ score = best - 400;
+ }
+ const key = `set:${e.pageId}:${e.title}`;
+ if (seen.has(key)) continue;
+ seen.add(key);
+ out.push({ kind: "setting", key, pageId: e.pageId, title, path: e.path, indices, score: score - SETTING_PENALTY });
+ }
+ return byScore(out);
+}
+
+/** Actions and settings in one relevance order (ties keep actions first). */
+export function mergeActionResults(actions: readonly ActionItem[], settings: readonly SettingItem[]): SeItem[] {
+ return byScore<ActionItem | SettingItem>([...actions, ...settings]);
+}
+
export function actionItem(a: Action, enabled: boolean): ActionItem {
return {
kind: "action",
@@ -343,6 +393,7 @@ export function itemWeight(item: SeItem, query: string): number {
case "symbol":
return name(item.name) ?? (item.container ? name(`${item.container}.${item.name}`) : undefined) ?? 0;
case "action":
+ case "setting":
return item.score;
case "text":
return TEXT_WEIGHT;
diff --git a/src/features/search/everywhere/store.ts b/src/features/search/everywhere/store.ts
index 5c3c48b02..65be305b2 100644
--- a/src/features/search/everywhere/store.ts
+++ b/src/features/search/everywhere/store.ts
@@ -3,6 +3,7 @@ import { getContext, type ContextKeys } from "@/platform/context";
import { loadJson, saveJson } from "../common/open";
import type { ProjectFileSet } from "@/platform/ipc";
import type { SeTab } from "./model";
+import { DEFAULT_FILTERS, sanitizeFilters, type FilterTab, type SeFilters } from "./filters";
interface SeState {
open: boolean;
@@ -23,9 +24,12 @@ interface SeState {
*/
autoEverywhere: boolean;
notFound: string | null;
+ /** The funnel's per-tab filters (remembered). */
+ filters: SeFilters;
}
const PREVIEW_KEY = "openidea.search.everywherePreview.v1";
+const FILTERS_KEY = "openidea.search.everywhereFilters.v1";
export const useSearchEverywhere = create<SeState>(() => ({
open: false,
@@ -38,6 +42,7 @@ export const useSearchEverywhere = create<SeState>(() => ({
preview: loadJson<unknown>(PREVIEW_KEY, false) === true,
autoEverywhere: true,
notFound: null,
+ filters: sanitizeFilters(loadJson<unknown>(FILTERS_KEY, DEFAULT_FILTERS)),
}));
export function setSearchEverywherePreview(preview: boolean) {
@@ -45,6 +50,12 @@ export function setSearchEverywherePreview(preview: boolean) {
saveJson(PREVIEW_KEY, preview);
}
+export function setSearchEverywhereFilter<T extends FilterTab>(tab: T, value: SeFilters[T]) {
+ const filters = { ...useSearchEverywhere.getState().filters, [tab]: value };
+ useSearchEverywhere.setState({ filters });
+ saveJson(FILTERS_KEY, filters);
+}
+
/**
* Opens the dialog, or while it is open switches to `tab` (the query is kept);
* re-invoking the shown tab toggles "include non-project items", like IDEA.
diff --git a/src/features/search/find/FindInFiles.module.css b/src/features/search/find/FindInFiles.module.css
index a8c1bcd7a..ac1be6d53 100644
--- a/src/features/search/find/FindInFiles.module.css
+++ b/src/features/search/find/FindInFiles.module.css
@@ -81,7 +81,9 @@
flex: 1;
min-width: 0;
display: flex;
+ align-items: center;
justify-content: flex-end;
+ gap: 4px;
}
.dirInput {
width: 100%;
diff --git a/src/features/search/find/FindInFiles.tsx b/src/features/search/find/FindInFiles.tsx
index d7590546f..d1767ec72 100644
--- a/src/features/search/find/FindInFiles.tsx
+++ b/src/features/search/find/FindInFiles.tsx
@@ -1,10 +1,13 @@
import { useEffect, useLayoutEffect, useMemo, useRef, useState, type KeyboardEvent, type MouseEvent } from "react";
import clsx from "clsx";
import { openEditorPaths, useEditorRegistry } from "@/editor/api";
+import { executeAction } from "@/platform/actions";
import { setContext } from "@/platform/context";
import { useTxTemplate } from "@/platform/i18n";
import { call, commands, type SearchScope } from "@/platform/ipc";
import { useProject } from "@/platform/project";
+import { useProjectModules } from "@/platform/projectRoots";
+import { EDIT_SCOPES_ACTION, useCustomScopeList } from "@/platform/search";
import {
Button,
Checkbox,
@@ -47,19 +50,22 @@ import {
import { SINGLE_FIRST, isRowSelected, selectRow, selectedRows, type RowSelection } from "./rowSelection";
import { FindSession, IDLE, matchRows, type FindState, type MatchRow } from "./session";
import {
- FILE_SET_SCOPES,
SEARCH_CONTEXTS,
buildQuery,
+ customScopeName,
+ customScopeValue,
describeQuery,
findHistory,
hideFindPopup,
recentMasks,
rememberFindString,
rememberMask,
+ resolveFindScope,
setFindPopupCommandHandler,
setFindPopupPinned,
useFindPopup,
type FindOptions,
+ type BuiltinScope,
type FindPopupCommand,
type NamedScope,
type ScopeTab,
@@ -78,11 +84,12 @@ export function FindInFilesOverlay() {
const SCOPE_TABS: Array<{ id: ScopeTab; label: string }> = [
{ id: "project", label: "In Project" },
+ { id: "module", label: "Module" },
{ id: "directory", label: "Directory" },
{ id: "scope", label: "Scope" },
];
-const NAMED_SCOPES: Array<{ value: NamedScope; label: string }> = [
+const NAMED_SCOPES: Array<{ value: BuiltinScope; label: string }> = [
{ value: "projectFiles", label: "Project Files" },
{ value: "productionFiles", label: "Project Production Files" },
{ value: "testFiles", label: "Project Test Files" },
@@ -90,12 +97,6 @@ const NAMED_SCOPES: Array<{ value: NamedScope; label: string }> = [
{ value: "recentFiles", label: "Recently Viewed Files" },
];
-function resolveDirectory(dir: string, root: string | null): string {
- const d = dir.trim().replace(/\/+$/, "");
- if (!d || d.startsWith("/") || /^[a-zA-Z]:[\\/]/.test(d)) return d;
- return root ? `${root}/${d}` : d;
-}
-
function displayDirectory(dir: string, root: string | null): string {
if (root && dir === root) return "";
return root && dir.startsWith(root + "/") ? dir.slice(root.length + 1) : dir;
@@ -106,6 +107,8 @@ function FindInFilesDialog() {
const txt = useTxTemplate();
const root = useProject((p) => p.project?.root ?? null);
const editors = useEditorRegistry((r) => r.editors);
+ const modules = useProjectModules();
+ const customScopes = useCustomScopeList();
const [state, setState] = useState<FindState>(IDLE);
const [session] = useState(() => new FindSession(ipcFindDeps(), setState));
const [sel, setSel] = useState<RowSelection>(SINGLE_FIRST);
@@ -149,21 +152,18 @@ function FindInFilesDialog() {
);
}, [s.scopeTab, s.namedScope, recentPaths]);
- const scope: SearchScope = useMemo(() => {
- if (s.scopeTab === "directory" && s.directory.trim())
- return { kind: "directory", path: resolveDirectory(s.directory, root) };
- const fileSet = FILE_SET_SCOPES[s.namedScope];
- if (s.scopeTab === "scope" && fileSet) return { kind: "fileSet", set: fileSet };
- if (s.scopeTab === "scope") {
- const paths =
- s.namedScope === "openFiles"
- ? // Every open tab, not just the visible editors; `editors` only re-triggers this memo.
- [...new Set([...openEditorPaths(), ...[...editors].map((e) => e.ctx.path)])]
- : (recentPaths ?? []);
- return { kind: "files", paths };
- }
- return { kind: "project" };
- }, [s.scopeTab, s.directory, s.namedScope, root, editors, recentPaths]);
+ const scope: SearchScope = useMemo(
+ () =>
+ resolveFindScope(s, {
+ root,
+ // Every open tab, not just the visible editors; `editors` only re-triggers this memo.
+ openPaths: () => [...new Set([...openEditorPaths(), ...[...editors].map((e) => e.ctx.path)])],
+ recentPaths,
+ }),
+ // `customScopes`: an edited scope pattern re-runs the search.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ [s.scopeTab, s.module, s.directory, s.namedScope, root, editors, recentPaths, customScopes],
+ );
const options: FindOptions = {
pattern: s.pattern,
@@ -175,6 +175,7 @@ function FindInFilesDialog() {
maskEnabled: s.maskEnabled,
mask: s.mask,
scopeTab: s.scopeTab,
+ module: s.module,
directory: s.directory,
namedScope: s.namedScope,
context: s.context,
@@ -385,7 +386,8 @@ function FindInFilesDialog() {
const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
const target = e.target as HTMLElement;
- const inField = target.tagName === "INPUT" && target.closest("[data-find-field]");
+ const inField =
+ (target.tagName === "INPUT" || target.tagName === "TEXTAREA") && target.closest("[data-find-field]");
if (e.key === "Enter" && e.altKey && e.shiftKey && !e.metaKey && !e.ctrlKey) {
// ⇧⌥↵: Replace All.
e.preventDefault();
@@ -406,6 +408,8 @@ function FindInFilesDialog() {
return;
}
if (!["ArrowDown", "ArrowUp", "PageDown", "PageUp"].includes(e.key) || e.altKey) return;
+ // Inside a multi-line query the arrows move the caret between its lines.
+ if ((e.key === "ArrowDown" || e.key === "ArrowUp") && (target as HTMLTextAreaElement).value?.includes("\n")) return;
const next = listNavigate(e.key, { items: rows, active, pageSize: 9 });
if (next === null) return;
e.preventDefault();
@@ -524,6 +528,8 @@ function FindInFilesDialog() {
aria-label="Text to find"
invalid={state.status === "invalid"}
className={styles.field}
+ multiline
+ onHistory={() => setHistoryMenu("find")}
toggles={[
{
id: "case",
@@ -562,6 +568,8 @@ function FindInFilesDialog() {
placeholder="Replace with"
aria-label="Replace with"
className={styles.field}
+ multiline
+ onHistory={() => setHistoryMenu("replace")}
toggles={[
{
id: "preserveCase",
@@ -603,14 +611,54 @@ function FindInFilesDialog() {
onChange={(e) => set({ directory: e.target.value })}
/>
)}
- {s.scopeTab === "scope" && (
- <Select<NamedScope>
- value={s.namedScope}
- options={NAMED_SCOPES}
- onChange={(v) => set({ namedScope: v })}
- aria-label="Named scope"
+ {s.scopeTab === "module" && (
+ <Select<string>
+ value={s.module}
+ options={modules.map((m) => ({
+ value: m.path,
+ label: m.name || m.path || "Project",
+ icon: "module",
+ detail: m.path || undefined,
+ }))}
+ onChange={(v) => set({ module: v })}
+ aria-label="Module"
/>
)}
+ {s.scopeTab === "scope" && (
+ <>
+ <Select<NamedScope>
+ value={
+ customScopeName(s.namedScope) !== null &&
+ !customScopes.some((c) => customScopeValue(c.name) === s.namedScope)
+ ? "projectFiles"
+ : s.namedScope
+ }
+ options={[
+ ...NAMED_SCOPES,
+ ...(customScopes.length
+ ? [
+ { value: "custom:" as NamedScope, label: "Custom Scopes", disabled: true },
+ ...customScopes.map((c) => ({
+ value: customScopeValue(c.name),
+ label: c.name,
+ detail: c.pattern,
+ })),
+ ]
+ : []),
+ ]}
+ onChange={(v) => set({ namedScope: v })}
+ aria-label="Named scope"
+ />
+ <IconButton
+ icon="more-horizontal"
+ title="Edit Scopes…"
+ onClick={() => {
+ const name = customScopeName(s.namedScope);
+ void executeAction(EDIT_SCOPES_ACTION, name ? { select: name } : undefined);
+ }}
+ />
+ </>
+ )}
</div>
</div>
<div className={styles.results}>
diff --git a/src/features/search/find/ScopesDialog.module.css b/src/features/search/find/ScopesDialog.module.css
new file mode 100644
index 000000000..f485a36a4
--- /dev/null
+++ b/src/features/search/find/ScopesDialog.module.css
@@ -0,0 +1,79 @@
+.body {
+ display: grid;
+ grid-template-columns: 200px 1fr;
+ min-height: 300px;
+ border: 1px solid var(--border);
+ border-radius: var(--radius-small);
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ min-width: 0;
+ border-right: 1px solid var(--border);
+}
+.toolbar {
+ display: flex;
+ gap: 2px;
+ padding: 4px;
+ border-bottom: 1px solid var(--border);
+}
+.list {
+ flex: 1;
+ margin: 0;
+ padding: 4px;
+ list-style: none;
+ overflow: auto;
+}
+.item {
+ display: flex;
+ align-items: center;
+ width: 100%;
+ height: var(--h-list-row);
+ padding: 0 8px;
+ border: 0;
+ border-radius: var(--radius-row);
+ background: none;
+ color: var(--fg);
+ font-size: var(--fs-ui);
+ text-align: left;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.item:hover {
+ background: var(--bg-hover);
+}
+.itemOn {
+ background: var(--bg-list-selected);
+}
+.empty {
+ padding: 8px;
+ color: var(--fg-muted);
+ font-size: var(--fs-ui);
+}
+.form {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ padding: 10px 14px;
+ min-width: 0;
+}
+.label {
+ color: var(--fg-muted);
+ font-size: var(--fs-ui);
+}
+.error {
+ color: var(--danger);
+ font-size: var(--fs-small);
+}
+.help {
+ margin: 6px 0 0;
+ padding-left: 16px;
+ color: var(--fg-muted);
+ font-size: var(--fs-small);
+ line-height: 1.6;
+}
+.help code {
+ font-family: var(--font-mono);
+ color: var(--fg);
+}
diff --git a/src/features/search/find/ScopesDialog.tsx b/src/features/search/find/ScopesDialog.tsx
new file mode 100644
index 000000000..4733a3f82
--- /dev/null
+++ b/src/features/search/find/ScopesDialog.tsx
@@ -0,0 +1,195 @@
+/**
+ * IDEA's Scopes editor (Find in Files › Scope › …): named scopes defined by a
+ * file pattern, saved per project (`@/platform/search`) and offered wherever
+ * named scopes are (Find in Files, the analyses' Specify Scope).
+ */
+import { useEffect, useId, useState } from "react";
+import clsx from "clsx";
+import { create } from "zustand";
+import { tx, txTemplate, useTx, useTxTemplate } from "@/platform/i18n";
+import { call, commands, isTauri } from "@/platform/ipc";
+import { customScopes, saveCustomScopes, type CustomScope } from "@/platform/search";
+import { Dialog, IconButton, Input, T } from "@/ui";
+import styles from "./ScopesDialog.module.css";
+
+export const useScopesDialog = create<{ open: boolean; select: string | null }>(() => ({ open: false, select: null }));
+
+export function showScopesDialog(arg: unknown) {
+ const select =
+ arg && typeof arg === "object" && typeof (arg as { select?: unknown }).select === "string"
+ ? (arg as { select: string }).select
+ : null;
+ useScopesDialog.setState({ open: true, select });
+}
+
+export function ScopesDialogOverlay() {
+ const open = useScopesDialog((s) => s.open);
+ return open ? <ScopesDialog /> : null;
+}
+
+/** Problems that keep the list from being saved, or null. */
+export function scopesProblem(scopes: readonly CustomScope[]): string | null {
+ const names = new Set<string>();
+ for (const s of scopes) {
+ const name = s.name.trim();
+ if (!name) return "Every scope needs a name";
+ if (names.has(name)) return `Duplicate scope name '${name}'`;
+ names.add(name);
+ if (!s.pattern.trim()) return `Scope '${name}' has no pattern`;
+ }
+ return null;
+}
+
+function newName(scopes: readonly CustomScope[]): string {
+ for (let i = 1; ; i++) {
+ const name = i === 1 ? tx("Unnamed") : txTemplate(`Unnamed (${i})`);
+ if (!scopes.some((s) => s.name === name)) return name;
+ }
+}
+
+/** The backend's complaint about a pattern (debounced), or null. */
+function usePatternError(pattern: string): string | null {
+ const [checked, setChecked] = useState<{ pattern: string; error: string | null } | null>(null);
+ useEffect(() => {
+ if (!pattern.trim() || !isTauri()) return;
+ let alive = true;
+ const setError = (error: string | null) => alive && setChecked({ pattern, error });
+ const t = setTimeout(() => {
+ call(
+ commands.searchValidate({
+ pattern: "",
+ isRegex: false,
+ caseSensitive: false,
+ wholeWord: false,
+ include: [],
+ exclude: [],
+ scope: { kind: "pattern", pattern },
+ maxMatches: 0,
+ }),
+ ).then(
+ () => setError(null),
+ (e: unknown) => setError(String((e as Error)?.message ?? e)),
+ );
+ }, 200);
+ return () => {
+ alive = false;
+ clearTimeout(t);
+ };
+ }, [pattern]);
+ return checked?.pattern === pattern && pattern.trim() ? checked.error : null;
+}
+
+function ScopesDialog() {
+ const tr = useTx();
+ const trTemplate = useTxTemplate();
+ const ids = { name: useId(), pattern: useId() };
+ const [scopes, setScopes] = useState<CustomScope[]>(() => customScopes().map((s) => ({ ...s })));
+ const [index, setIndex] = useState(() => {
+ const select = useScopesDialog.getState().select;
+ return Math.max(0, select ? scopes.findIndex((s) => s.name === select) : 0);
+ });
+ const current = scopes[index] ?? null;
+ const patternError = usePatternError(current?.pattern ?? "");
+ const problem = scopesProblem(scopes);
+ const close = () => useScopesDialog.setState({ open: false, select: null });
+
+ const update = (patch: Partial<CustomScope>) =>
+ setScopes((list) => list.map((s, i) => (i === index ? { ...s, ...patch } : s)));
+ const add = () => {
+ setScopes((list) => [...list, { name: newName(list), pattern: "" }]);
+ setIndex(scopes.length);
+ };
+ const remove = () => {
+ if (!current) return;
+ setScopes((list) => list.filter((_, i) => i !== index));
+ setIndex((i) => Math.max(0, Math.min(i, scopes.length - 2)));
+ };
+ const ok = () => {
+ saveCustomScopes(scopes);
+ close();
+ };
+
+ return (
+ <Dialog
+ open
+ onClose={close}
+ title="Scopes"
+ width={640}
+ aria-label="Scopes"
+ footerStart={problem && <span className={styles.error}>{trTemplate(problem)}</span>}
+ buttons={[
+ { label: "OK", role: "default", disabled: !!problem, onClick: ok },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <div className={styles.body}>
+ <div className={styles.side}>
+ <div className={styles.toolbar}>
+ <IconButton icon="plus" title="Add Scope" size="small" onClick={add} />
+ <IconButton icon="minus" title="Remove Scope" size="small" disabled={!current} onClick={remove} />
+ </div>
+ {scopes.length ? (
+ <ul className={styles.list} aria-label={tr("Scopes")}>
+ {scopes.map((s, i) => (
+ <li key={i}>
+ <button
+ type="button"
+ className={clsx(styles.item, i === index && styles.itemOn)}
+ aria-current={i === index || undefined}
+ onClick={() => setIndex(i)}
+ >
+ {s.name || tr("Unnamed")}
+ </button>
+ </li>
+ ))}
+ </ul>
+ ) : (
+ <div className={styles.empty}>
+ <T>No custom scopes</T>
+ </div>
+ )}
+ </div>
+ <div className={styles.form}>
+ {current ? (
+ <>
+ <label className={styles.label} htmlFor={ids.name}>
+ <T>Name:</T>
+ </label>
+ <Input id={ids.name} value={current.name} onChange={(e) => update({ name: e.target.value })} />
+ <label className={styles.label} htmlFor={ids.pattern}>
+ <T>Pattern:</T>
+ </label>
+ <Input
+ id={ids.pattern}
+ mono
+ data-autofocus
+ value={current.pattern}
+ invalid={!!patternError}
+ placeholder="file:src//*&&!file:*test*"
+ onChange={(e) => update({ pattern: e.target.value })}
+ />
+ {patternError && <div className={styles.error}>{patternError}</div>}
+ <ul className={styles.help}>
+ <li>
+ <code>file:*.ts</code> <T>files by name, anywhere</T>
+ </li>
+ <li>
+ <code>file:src/*</code> <T>files directly in a folder</T>, <code>file:src//*</code>{" "}
+ <T>at any depth</T>
+ </li>
+ <li>
+ <code>!</code> <T>not</T>, <code>&&</code> <T>and</T>, <code>||</code> <T>or</T>, <code>( )</code>{" "}
+ <T>grouping</T>
+ </li>
+ </ul>
+ </>
+ ) : (
+ <div className={styles.empty}>
+ <T>Add a scope to define it by a file pattern.</T>
+ </div>
+ )}
+ </div>
+ </div>
+ </Dialog>
+ );
+}
diff --git a/src/features/search/find/session.ts b/src/features/search/find/session.ts
index 57d172e3b..794fd7489 100644
--- a/src/features/search/find/session.ts
+++ b/src/features/search/find/session.ts
@@ -10,6 +10,7 @@
* per file and are published at most once per microtask.
*/
import type { FileMatches, RequestId, SearchQuery, SearchSummary } from "@/platform/ipc";
+import { preserveCase } from "@/platform/search";
export type FindStatus = "idle" | "validating" | "invalid" | "searching" | "done" | "error";
@@ -205,17 +206,6 @@ export function previewReplacement(
return preserve ? preserveCase(matched, out) : out;
}
-/** IDEA's "Preserve case" (same rules as the backend's `preserve_case`). */
-export function preserveCase(found: string, replacement: string): string {
- const letters = [...found].filter((c) => c.toLowerCase() !== c.toUpperCase());
- const first = letters[0];
- if (!first || !replacement) return replacement;
- const isUpper = (c: string) => c === c.toUpperCase() && c !== c.toLowerCase();
- if (letters.length > 1 && letters.every(isUpper)) return replacement.toUpperCase();
- const [head = "", ...rest] = [...replacement];
- return (isUpper(first) ? head.toUpperCase() : head.toLowerCase()) + rest.join("");
-}
-
/** Ranges → highlight indices (for `HighlightedText`). */
export function rangesToIndices(ranges: ReadonlyArray<readonly [number, number]>): number[] {
const out: number[] = [];
diff --git a/src/features/search/find/store.ts b/src/features/search/find/store.ts
index e174c206c..5d01c9f8e 100644
--- a/src/features/search/find/store.ts
+++ b/src/features/search/find/store.ts
@@ -1,12 +1,20 @@
import { create } from "zustand";
import type { ProjectFileSet, SearchContext, SearchQuery, SearchScope } from "@/platform/ipc";
+import { SEARCH_CONTEXTS, customScopes, findCustomScope, rememberSearch, searchHistory } from "@/platform/search";
import { loadJson, saveJson } from "../common/open";
-export type ScopeTab = "project" | "directory" | "scope";
-export type NamedScope = "projectFiles" | "productionFiles" | "testFiles" | "openFiles" | "recentFiles";
+export { SEARCH_CONTEXTS };
+
+export type ScopeTab = "project" | "module" | "directory" | "scope";
+export type BuiltinScope = "projectFiles" | "productionFiles" | "testFiles" | "openFiles" | "recentFiles";
+/** A built-in named scope or a user-defined one (`custom:<name>`, see `@/platform/search`). */
+export type NamedScope = BuiltinScope | `custom:${string}`;
+
+export const customScopeValue = (name: string): NamedScope => `custom:${name}`;
+export const customScopeName = (v: NamedScope): string | null => (v.startsWith("custom:") ? v.slice(7) : null);
/** IDEA's root-based named scopes, searched by the backend over the project's source / test roots. */
-export const FILE_SET_SCOPES: Partial<Record<NamedScope, ProjectFileSet>> = {
+export const FILE_SET_SCOPES: Partial<Record<BuiltinScope, ProjectFileSet>> = {
projectFiles: "all",
productionFiles: "production",
testFiles: "test",
@@ -29,6 +37,8 @@ export interface FindOptions {
maskEnabled: boolean;
mask: string;
scopeTab: ScopeTab;
+ /** Module tab: project-relative folder of the module (`""`: the project's root module). */
+ module: string;
directory: string;
namedScope: NamedScope;
/** IDEA's search context filter (funnel menu): anywhere, only / except comments and string literals. */
@@ -58,6 +68,7 @@ export const useFindPopup = create<FindPopupState>(() => ({
maskEnabled: false,
mask: "",
scopeTab: "project",
+ module: "",
directory: "",
namedScope: "projectFiles",
context: "any",
@@ -69,15 +80,6 @@ export function setFindPopupPinned(pinned: boolean) {
saveJson(PINNED_KEY, pinned);
}
-export const SEARCH_CONTEXTS: ReadonlyArray<{ value: SearchContext; label: string }> = [
- { value: "any", label: "Anywhere" },
- { value: "inComments", label: "In Comments" },
- { value: "inStringLiterals", label: "In String Literals" },
- { value: "exceptComments", label: "Except Comments" },
- { value: "exceptStringLiterals", label: "Except String Literals" },
- { value: "exceptCommentsAndStringLiterals", label: "Except Comments and String Literals" },
-];
-
/**
* Keys the popup handles that are also global shortcuts (⌘G / ⇧⌘G, F4 / ⌘↓, ⌥↓):
* hidden actions bound later in the keymap win while the popup is open and
@@ -145,19 +147,9 @@ export function rememberMask(mask: string) {
saveJson(MASKS_KEY, [m, ...recent.filter((x) => x !== m)].slice(0, 10));
}
-const HISTORY_KEYS = { find: "openidea.search.findHistory.v1", replace: "openidea.search.replaceHistory.v1" };
-const MAX_HISTORY = 20;
-
-/** Recent search (or replace) strings of the Find in Files popup, newest first (⌥↓). */
-export function findHistory(kind: "find" | "replace"): string[] {
- const v = loadJson<unknown>(HISTORY_KEYS[kind], []);
- return Array.isArray(v) ? v.filter((x): x is string => typeof x === "string") : [];
-}
-
-export function rememberFindString(kind: "find" | "replace", text: string) {
- if (!text.trim()) return;
- saveJson(HISTORY_KEYS[kind], [text, ...findHistory(kind).filter((x) => x !== text)].slice(0, MAX_HISTORY));
-}
+/** Recent search (or replace) strings, newest first (⌥↓); shared with the editor's find bar. */
+export const findHistory = searchHistory;
+export const rememberFindString = rememberSearch;
export function buildQuery(o: FindOptions, scope: SearchScope, maxMatches: number): SearchQuery {
const q: SearchQuery = {
@@ -174,15 +166,57 @@ export function buildQuery(o: FindOptions, scope: SearchScope, maxMatches: numbe
return q;
}
+export interface ScopeInputs {
+ root: string | null;
+ /** Files of the open editors (Open Files). */
+ openPaths: () => string[];
+ /** Recently viewed files, once loaded. */
+ recentPaths: string[] | null;
+}
+
+export function resolveDirectory(dir: string, root: string | null): string {
+ const d = dir.trim().replace(/\/+$/, "");
+ if (!d || d.startsWith("/") || /^[a-zA-Z]:[\\/]/.test(d)) return d;
+ return root ? `${root}/${d}` : d;
+}
+
+/** The backend scope of the popup's scope tabs. */
+export function resolveFindScope(o: FindOptions, inputs: ScopeInputs): SearchScope {
+ const { root } = inputs;
+ if (o.scopeTab === "directory" && o.directory.trim())
+ return { kind: "directory", path: resolveDirectory(o.directory, root) };
+ if (o.scopeTab === "module")
+ return o.module && root ? { kind: "directory", path: `${root}/${o.module}` } : { kind: "project" };
+ if (o.scopeTab !== "scope") return { kind: "project" };
+ const custom = customScopeName(o.namedScope);
+ if (custom !== null) {
+ const scope = findCustomScope(custom);
+ return scope ? { kind: "pattern", pattern: scope.pattern } : { kind: "project" };
+ }
+ const fileSet = FILE_SET_SCOPES[o.namedScope as BuiltinScope];
+ if (fileSet) return { kind: "fileSet", set: fileSet };
+ return { kind: "files", paths: o.namedScope === "openFiles" ? inputs.openPaths() : (inputs.recentPaths ?? []) };
+}
+
export function describeQuery(q: SearchQuery, root: string | null): string {
- const where =
- q.scope.kind === "project"
- ? "Project"
- : q.scope.kind === "directory"
- ? `Directory ${root && q.scope.path.startsWith(root + "/") ? q.scope.path.slice(root.length + 1) : q.scope.path}`
- : q.scope.kind === "fileSet"
- ? FILE_SET_LABELS[q.scope.set]
- : `${q.scope.paths.length} files`;
+ const rel = (p: string) => (root && p.startsWith(root + "/") ? p.slice(root.length + 1) : p);
+ const where = (() => {
+ switch (q.scope.kind) {
+ case "project":
+ return "Project";
+ case "directory":
+ return `Directory ${rel(q.scope.path)}`;
+ case "fileSet":
+ return FILE_SET_LABELS[q.scope.set];
+ case "files":
+ return `${q.scope.paths.length} files`;
+ case "pattern": {
+ const pattern = q.scope.pattern;
+ const named = customScopes().find((s) => s.pattern === pattern);
+ return named ? `Scope '${named.name}'` : `Scope ${pattern}`;
+ }
+ }
+ })();
const context = q.context && q.context !== "any" ? SEARCH_CONTEXTS.find((c) => c.value === q.context)?.label : null;
return `'${q.pattern}' in ${where}${q.include.length ? ` (${q.include.join(", ")})` : ""}${context ? `, ${context.toLowerCase()}` : ""}`;
}
diff --git a/src/features/search/index.ts b/src/features/search/index.ts
index 51ebe5250..c61173f46 100644
--- a/src/features/search/index.ts
+++ b/src/features/search/index.ts
@@ -9,6 +9,8 @@ import { executeAction, registerActions } from "@/platform/actions";
import { shortcutLabel } from "@/platform/keymap";
import { onIdeEvent } from "@/platform/ipc";
import { useProject } from "@/platform/project";
+import { EDIT_SCOPES_ACTION } from "@/platform/search";
+import { isVirtualUri } from "@/platform/virtualDocs";
import { registerMenuGroup, registerOverlay, registerToolWindow } from "@/workbench/contributions";
import { BookmarkPopupsOverlay } from "./bookmarks/BookmarkPopups";
import { bookmarkGutter } from "./bookmarks/gutter";
@@ -16,9 +18,13 @@ import {
bookmarkByMnemonic,
hasBookmark,
loadBookmarks,
+ pathBookmarkAt,
renameBookmarks,
+ renamePathBookmarks,
toggleBookmark,
+ togglePathBookmarks,
toggleMnemonic,
+ updateBookmarkData,
updateBookmarks,
useBookmarkPopups,
useBookmarks,
@@ -30,11 +36,13 @@ import { installTracking, resetTracking } from "./common/tracking";
import { SearchEverywhereOverlay } from "./everywhere/SearchEverywhere";
import { hideSearchEverywhere, showSearchEverywhere } from "./everywhere/store";
import { FindInFilesOverlay } from "./find/FindInFiles";
+import { ScopesDialogOverlay, showScopesDialog } from "./find/ScopesDialog";
import { hideFindPopup, parseFindArg, runFindPopupCommand, showFindPopup, useFindPopup } from "./find/store";
import { disposeFindWindow, rerunActiveFindTab, useFindHeaderMenu } from "./find/windowStore";
import { RecentPopupsOverlay } from "./recent/RecentPopups";
import { cycleSwitcher, hideRecentPopup, showRecentPopup } from "./recent/store";
import { FileStructureOverlay, useFileStructurePopup } from "./structure/StructureView";
+import { useOutline, useStructureOptions } from "./structure/store";
/** Single-line editor selection, used to prefill search fields. */
function editorSelectionText(): string | null {
@@ -115,6 +123,7 @@ export function activate(): void | (() => void) {
registerOverlay({ id: "search.everywhere", component: SearchEverywhereOverlay }),
registerOverlay({ id: "search.recent", component: RecentPopupsOverlay }),
registerOverlay({ id: "search.findInFiles", component: FindInFilesOverlay }),
+ registerOverlay({ id: "search.scopes", component: ScopesDialogOverlay }),
registerOverlay({ id: "search.fileStructure", component: FileStructureOverlay }),
registerOverlay({ id: "search.bookmarks", component: BookmarkPopupsOverlay }),
@@ -191,6 +200,27 @@ export function activate(): void | (() => void) {
},
}),
+ registerMenuGroup({
+ // File / folder bookmarks (IDEA's Bookmarks › Toggle Bookmark on the project view and editor tabs).
+ id: "search.bookmarks.files",
+ menus: ["projectView", "editorTab"],
+ order: 60,
+ items: (_menu, { paths, dirs }) => {
+ const targets = paths
+ .map((path, i) => ({ path, dir: dirs?.[i] ?? false }))
+ .filter((t) => !isVirtualUri(t.path));
+ if (!targets.length) return [];
+ const on = targets.every((t) => pathBookmarkAt(useBookmarks.getState().paths, t.path));
+ return [
+ {
+ label: on ? "Remove Bookmark" : "Add Bookmark",
+ icon: "bookmark",
+ run: () => void executeAction("bookmarks.toggleFileBookmark", { targets }),
+ },
+ ];
+ },
+ }),
+
registerActions([
{
id: "navigate.searchEverywhere",
@@ -306,6 +336,14 @@ export function activate(): void | (() => void) {
when: "projectOpen && activeToolWindow == 'find'",
run: rerunActiveFindTab,
},
+ {
+ id: EDIT_SCOPES_ACTION,
+ title: "Edit Scopes…",
+ category: "Find",
+ keywords: ["custom scope", "file pattern"],
+ when: "projectOpen",
+ run: ({ arg }) => showScopesDialog(arg),
+ },
{
id: "find.replaceInPath",
title: "Replace in Files…",
@@ -340,8 +378,12 @@ export function activate(): void | (() => void) {
icon: "structure",
keywords: ["outline", "members"],
run: () => {
- // Pressed again IDEA toggles "Show inherited members"; outlines have none, so the popup stays.
- if (useFileStructurePopup.getState().open) return;
+ // Pressed again, IDEA toggles "Show inherited members" (when the server knows supertypes).
+ if (useFileStructurePopup.getState().open) {
+ if (useOutline.getState().inheritedSupported)
+ useStructureOptions.setState((s) => ({ showInherited: !s.showInherited }));
+ return;
+ }
closeAllPopups("fileStructure");
useFileStructurePopup.setState({ open: true });
},
@@ -365,6 +407,36 @@ export function activate(): void | (() => void) {
updateBookmarks((list) => toggleBookmark(list, at.path, at.line, at.text, Date.now(), description));
},
},
+ {
+ id: "bookmarks.toggleFileBookmark",
+ title: "Toggle File Bookmark",
+ category: "Bookmarks",
+ icon: "bookmark",
+ when: "projectOpen",
+ run: ({ arg }) => {
+ const given = (arg as { targets?: unknown } | undefined)?.targets;
+ const targets = Array.isArray(given)
+ ? given.filter((t): t is { path: string; dir: boolean } => typeof t?.path === "string")
+ : activeEditor()
+ ? [{ path: activeEditor()!.ctx.path, dir: false }]
+ : [];
+ updateBookmarkData((d) =>
+ togglePathBookmarks(
+ d,
+ targets.map((t) => ({ path: t.path, dir: !!t.dir })),
+ ),
+ );
+ },
+ },
+ {
+ id: "bookmarks.newList",
+ title: "New Bookmark List…",
+ category: "Bookmarks",
+ when: "projectOpen",
+ run: () => {
+ useBookmarkPopups.setState({ naming: {} });
+ },
+ },
{
id: "navigate.toggleBookmarkWithMnemonic",
title: "Toggle Bookmark with Mnemonic",
@@ -446,6 +518,10 @@ export function activate(): void | (() => void) {
onIdeEvent("fsChanged", (e) => {
if (!e.removed.length) return;
updateBookmarks((list) => e.removed.reduce<Bookmark[]>((acc, p) => renameBookmarks(acc, p, null), [...list]));
+ updateBookmarkData((d) => {
+ const paths = e.removed.reduce((acc, p) => renamePathBookmarks(acc, p, null), d.paths);
+ return paths.length === d.paths.length ? d : { ...d, paths };
+ });
}),
);
diff --git a/src/features/search/recent/RecentPopups.module.css b/src/features/search/recent/RecentPopups.module.css
index 516d326fd..2d8a63d76 100644
--- a/src/features/search/recent/RecentPopups.module.css
+++ b/src/features/search/recent/RecentPopups.module.css
@@ -218,3 +218,53 @@
direction: rtl;
text-align: left;
}
+.time {
+ flex: none;
+ margin-left: auto;
+ padding-right: 8px;
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+}
+.changed ~ .time {
+ margin-left: 0;
+}
+.code {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+/* Lezer classHighlighter tokens (same colours as Search Everywhere's text hits). */
+.code :global(.tok-keyword),
+.code :global(.tok-modifier),
+.code :global(.tok-controlKeyword),
+.code :global(.tok-operatorKeyword) {
+ color: var(--syn-keyword);
+}
+.code :global(.tok-string),
+.code :global(.tok-string2) {
+ color: var(--syn-string);
+}
+.code :global(.tok-number),
+.code :global(.tok-bool),
+.code :global(.tok-atom) {
+ color: var(--syn-number);
+}
+.code :global(.tok-typeName),
+.code :global(.tok-className),
+.code :global(.tok-namespace) {
+ color: var(--syn-type);
+}
+.code :global(.tok-comment) {
+ color: var(--syn-comment);
+ font-style: italic;
+}
+.code :global(.tok-meta),
+.code :global(.tok-macroName) {
+ color: var(--syn-annotation);
+}
+.code :global(.tok-propertyName) {
+ color: var(--syn-property);
+}
+.code :global(.tok-variableName.tok-definition) {
+ color: var(--syn-function);
+}
diff --git a/src/features/search/recent/RecentPopups.tsx b/src/features/search/recent/RecentPopups.tsx
index 1b6ecf702..a71d6c6f2 100644
--- a/src/features/search/recent/RecentPopups.tsx
+++ b/src/features/search/recent/RecentPopups.tsx
@@ -1,7 +1,7 @@
import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type MouseEvent as ReactMouseEvent } from "react";
import clsx from "clsx";
import { editorsFor, getNavigationHistory } from "@/editor/api";
-import { call, commands } from "@/platform/ipc";
+import { call, commands, type OutlineItem } from "@/platform/ipc";
import { shortcutLabel } from "@/platform/keymap";
import { useProject } from "@/platform/project";
import { Checkbox, Dialog, HighlightedText, Icon, List, fileIconName, listNavigate, T } from "@/ui";
@@ -12,13 +12,18 @@ import {
useFileDecoration,
type ToolWindowContribution,
} from "@/workbench/contributions";
+import { highlightTokens, languageForPath, type CodeToken } from "@/editor/lsp/markdown";
import { basename, openLocation } from "../common/open";
+import { outlinePathAt } from "../structure/outline";
import { fromNavigationHistory, isDismissed, mergeLocations, type RecentLocation } from "../common/locations";
import { dismissLocation, useTracking } from "../common/tracking";
import {
filterLocations,
filterRecentFiles,
initialFileIndex,
+ lineSegments,
+ locationBreadcrumb,
+ locationTime,
switcherPaths,
switcherSelection,
switcherToolWindows,
@@ -360,6 +365,10 @@ function withSnippets(list: RecentLocation[], recorded: readonly RecentLocation[
const LOCATION_ROW = 78;
+function breadcrumbOf(outline: readonly OutlineItem[] | undefined, l: RecentLocation): string {
+ return outline ? locationBreadcrumb(outlinePathAt(outline, { line: l.line, col: l.col })) : "";
+}
+
/** Strips the common indentation so snippets line up at the left edge. */
function dedent(lines: readonly string[]): string[] {
const indents = lines.filter((l) => l.trim()).map((l) => l.length - l.trimStart().length);
@@ -367,6 +376,70 @@ function dedent(lines: readonly string[]): string[] {
return lines.map((l) => l.slice(Math.min(min, l.length - l.trimStart().length)));
}
+/** Outlines of the open documents among `paths` (breadcrumbs); closed files get none. */
+function useOpenOutlines(paths: readonly string[]): ReadonlyMap<string, OutlineItem[]> {
+ const [outlines, setOutlines] = useState<ReadonlyMap<string, OutlineItem[]>>(() => new Map());
+ const requested = useRef(new Set<string>());
+ useEffect(() => {
+ for (const path of new Set(paths)) {
+ if (requested.current.has(path)) continue;
+ const doc = editorsFor(path)[0]?.ctx.doc;
+ if (doc === undefined) continue;
+ requested.current.add(path);
+ call(commands.docOutline(doc))
+ .then((items) => setOutlines((m) => new Map(m).set(path, items)))
+ .catch(() => {});
+ }
+ }, [paths]);
+ return outlines;
+}
+
+const tokenCache = new Map<string, CodeToken[]>();
+
+/** A snippet's lines coloured by the file's language (parsed together, so multi-line constructs colour right). */
+function SnippetCode({ path, lines, first, caret }: { path: string; lines: readonly string[]; first: number; caret: number }) {
+ const language = useMemo(() => languageForPath(path), [path]);
+ const text = lines.join("\n");
+ const key = `${language}\u0000${text}`;
+ const [loaded, setLoaded] = useState<{ key: string; tokens: CodeToken[] } | null>(null);
+ const tokens = tokenCache.get(key) ?? (loaded?.key === key ? loaded.tokens : null);
+ useEffect(() => {
+ if (tokens || !language) return;
+ let alive = true;
+ void highlightTokens(text, language).then((t) => {
+ tokenCache.set(key, t);
+ if (tokenCache.size > 200) tokenCache.delete(tokenCache.keys().next().value!);
+ if (alive) setLoaded({ key, tokens: t });
+ });
+ return () => {
+ alive = false;
+ };
+ }, [key, language, text, tokens]);
+ const segments = useMemo(() => lineSegments(lines, tokens ?? []), [lines, tokens]);
+ return (
+ <pre className={styles.snippet}>
+ {segments.map((segs, i) => (
+ <div key={i} className={clsx(styles.snippetLine, first + i === caret && styles.caretLine)}>
+ <span className={styles.lineNo}>{first + i + 1}</span>
+ <span className={styles.code}>
+ {segs.length
+ ? segs.map((seg, j) =>
+ seg.cls ? (
+ <span key={j} className={seg.cls}>
+ {seg.text}
+ </span>
+ ) : (
+ seg.text
+ ),
+ )
+ : " "}
+ </span>
+ </div>
+ ))}
+ </pre>
+ );
+}
+
function RecentLocationsDialog() {
const changedOnly = useRecentPopup((s) => s.changedOnly);
const recorded = useTracking((s) => s.locations);
@@ -385,6 +458,10 @@ function RecentLocationsDialog() {
[source, query, changedOnly, root],
);
const active = items.length ? Math.min(index, items.length - 1) : -1;
+ const paths = useMemo(() => items.map((l) => l.path), [items]);
+ const outlines = useOpenOutlines(paths);
+ // Relative times as of opening the popup.
+ const [now] = useState(() => Date.now());
const open = (l: RecentLocation | undefined, side = false) => {
if (l) afterClose(() => void openLocation(l.path, { line: l.line, col: l.col }, { side }));
@@ -468,20 +545,11 @@ function RecentLocationsDialog() {
indices={l.nameIndices}
tone="strong"
/>
- <span className={styles.dir}>{l.rel}</span>
+ <span className={styles.dir}>{breadcrumbOf(outlines.get(l.path), l) || l.rel}</span>
{l.changed && <span className={styles.changed}>changed</span>}
+ <span className={styles.time}>{locationTime(l.time, now)}</span>
</div>
- <pre className={styles.snippet}>
- {dedent(l.snippet).map((text, i) => {
- const n = l.snippetStart + i;
- return (
- <div key={i} className={clsx(styles.snippetLine, n === l.line && styles.caretLine)}>
- <span className={styles.lineNo}>{n + 1}</span>
- <span>{text || " "}</span>
- </div>
- );
- })}
- </pre>
+ <SnippetCode path={l.path} lines={dedent(l.snippet)} first={l.snippetStart} caret={l.line} />
</div>
)}
/>
diff --git a/src/features/search/recent/model.ts b/src/features/search/recent/model.ts
index ba333139d..7fe5ffa4b 100644
--- a/src/features/search/recent/model.ts
+++ b/src/features/search/recent/model.ts
@@ -1,5 +1,8 @@
import type { ToolWindowContribution } from "@/workbench/contributions";
-import { basename, relDir } from "../common/open";
+import type { OutlineItem } from "@/platform/ipc";
+import { formatTimestamp } from "@/platform/dateFormat";
+import type { CodeToken } from "@/editor/lsp/markdown";
+import { basename, relDir, symbolDisplayName } from "../common/open";
import type { RecentLocation } from "../common/locations";
import { matchText } from "../common/rank";
import { isVirtualUri, virtualContainer } from "@/platform/virtualDocs";
@@ -112,3 +115,47 @@ export function filterLocations(
}
return out;
}
+
+/** IDEA's Recent Locations time: "Just now", "14 minutes ago", then the pretty timestamp ("Yesterday 22:52"). */
+export function locationTime(ms: number, now = Date.now(), format: (ms: number, now: number) => string = formatTimestamp): string {
+ if (!ms) return "";
+ const minutes = Math.floor((now - ms) / 60_000);
+ if (minutes >= 0 && minutes < 1) return "Just now";
+ if (minutes >= 1 && minutes < 60) return `${minutes} minute${minutes === 1 ? "" : "s"} ago`;
+ return format(ms, now);
+}
+
+/** Breadcrumb of the symbols around a location ("OrderController > list()"). */
+export function locationBreadcrumb(path: readonly Pick<OutlineItem, "name" | "kind">[]): string {
+ return path.map((s) => symbolDisplayName(s.name, s.kind)).join(" > ");
+}
+
+export interface CodeSegment {
+ text: string;
+ /** Lezer `classHighlighter` classes, "" for plain text. */
+ cls: string;
+}
+
+/** Splits highlight tokens of `lines.join("\n")` into per-line segments. */
+export function lineSegments(lines: readonly string[], tokens: readonly CodeToken[]): CodeSegment[][] {
+ const out: CodeSegment[][] = [];
+ let start = 0;
+ let t = 0;
+ for (const line of lines) {
+ const end = start + line.length;
+ const segs: CodeSegment[] = [];
+ let pos = start;
+ while (t < tokens.length && tokens[t]!.to <= start) t++;
+ for (let i = t; i < tokens.length && tokens[i]!.from < end; i++) {
+ const from = Math.max(tokens[i]!.from, start);
+ const to = Math.min(tokens[i]!.to, end);
+ if (from > pos) segs.push({ text: line.slice(pos - start, from - start), cls: "" });
+ if (to > from) segs.push({ text: line.slice(from - start, to - start), cls: tokens[i]!.cls });
+ pos = Math.max(pos, to);
+ }
+ if (pos < end) segs.push({ text: line.slice(pos - start), cls: "" });
+ out.push(segs);
+ start = end + 1;
+ }
+ return out;
+}
diff --git a/src/features/search/structure/StructureView.module.css b/src/features/search/structure/StructureView.module.css
index dc09c61e3..c282cd164 100644
--- a/src/features/search/structure/StructureView.module.css
+++ b/src/features/search/structure/StructureView.module.css
@@ -113,3 +113,7 @@
padding: 4px 12px;
color: var(--fg-faint);
}
+/* Show Inherited: supertype members, greyed. */
+.inherited .name {
+ color: var(--fg-muted);
+}
diff --git a/src/features/search/structure/StructureView.tsx b/src/features/search/structure/StructureView.tsx
index 38b4d47ae..9c444448d 100644
--- a/src/features/search/structure/StructureView.tsx
+++ b/src/features/search/structure/StructureView.tsx
@@ -9,37 +9,100 @@ import {
HighlightedText,
Icon,
IconButton,
+ Menu,
SymbolBadge,
Tree,
fileIconName,
+ type MenuItem,
type TreeHandle,
T,
} from "@/ui";
+import type { OutlineItem } from "@/platform/ipc";
import { badgeKind, basename, openLocation } from "../common/open";
import { useTracking } from "../common/tracking";
import {
allKeys,
+ applyViewFilter,
filterOutline,
+ hasFields,
+ hasVisibility,
keyOutline,
parentKeys,
sortOutline,
symbolPathAt,
visibleCount,
+ withInherited,
type OutlineNode,
} from "./outline";
import { useLiveOutline, useOutline, useStructureOptions } from "./store";
import styles from "./StructureView.module.css";
-function useOutlineNodes(alphabetical: boolean) {
+function useOutlineNodes() {
const items = useOutline((s) => s.items);
- return useMemo(() => sortOutline(keyOutline(items ?? []), alphabetical), [items, alphabetical]);
+ const alphabetical = useStructureOptions((s) => s.alphabetical);
+ const byVisibility = useStructureOptions((s) => s.sortByVisibility);
+ const fields = useStructureOptions((s) => s.showFields);
+ const nonPublic = useStructureOptions((s) => s.showNonPublic);
+ const showInherited = useStructureOptions((s) => s.showInherited);
+ const supported = useOutline((s) => s.inheritedSupported);
+ const inherited = useOutline((s) => s.inherited);
+ const extra = showInherited && supported ? inherited : null;
+ return useMemo(
+ () => sortOutline(applyViewFilter(withInherited(keyOutline(items ?? []), extra), { fields, nonPublic }), alphabetical, byVisibility),
+ [items, extra, alphabetical, byVisibility, fields, nonPublic],
+ );
+}
+
+/** IDEA's view options: Show Fields, Show Non-Public and Sort by Visibility (only when the outline knows visibility). */
+function viewOptionItems(items: readonly OutlineItem[]): MenuItem[] {
+ const o = useStructureOptions.getState();
+ const out: MenuItem[] = [];
+ if (hasFields(items) || !o.showFields)
+ out.push({
+ label: "Show Fields",
+ checked: o.showFields,
+ run: () => useStructureOptions.setState({ showFields: !o.showFields }),
+ });
+ if (hasVisibility(items)) {
+ out.push(
+ {
+ label: "Show Non-Public",
+ checked: o.showNonPublic,
+ run: () => useStructureOptions.setState({ showNonPublic: !o.showNonPublic }),
+ },
+ { kind: "separator" },
+ {
+ label: "Sort by Visibility",
+ checked: o.sortByVisibility,
+ run: () => useStructureOptions.setState({ sortByVisibility: !o.sortByVisibility }),
+ },
+ );
+ }
+ return out;
}
const navigate = (path: string, node: OutlineNode, focus: boolean) => {
const p = node.item.selection_range.start;
- void openLocation(path, { line: p.line, col: p.col }, { focus });
+ void openLocation(node.inherited?.path ?? path, { line: p.line, col: p.col }, { focus });
};
+/** A symbol row; inherited members are greyed and name their supertype. */
+function SymbolRow({ node, indices, selected, dim }: { node: OutlineNode; indices?: readonly number[] | null; selected: boolean; dim?: boolean }) {
+ return (
+ <span className={clsx(styles.node, dim && styles.ancestor, node.inherited && styles.inherited)}>
+ <SymbolBadge kind={badgeKind(node.item.kind)} className={styles.badge} />
+ <HighlightedText
+ className={styles.name}
+ text={node.item.name}
+ indices={indices}
+ tone={selected ? "accent" : "strong"}
+ />
+ {node.item.detail && <span className={styles.detail}>{node.item.detail}</span>}
+ {node.inherited && <span className={styles.detail}>{`↑${node.inherited.owner}`}</span>}
+ </span>
+ );
+}
+
const useCollapsed = create<{ keys: ReadonlySet<string> }>(() => ({ keys: new Set() }));
/** The file itself, shown as the tree root like IDEA. */
@@ -62,11 +125,10 @@ export function StructureView() {
const items = useOutline((s) => s.items);
const loading = useOutline((s) => s.loading);
const error = useOutline((s) => s.error);
- const alphabetical = useStructureOptions((s) => s.alphabetical);
const autoscroll = useStructureOptions((s) => s.autoscrollFromSource);
const caret = useTracking((s) => s.caret);
const collapsed = useCollapsed((s) => s.keys);
- const nodes = useOutlineNodes(alphabetical);
+ const nodes = useOutlineNodes();
const tree = useRef<TreeHandle>(null);
const revealing = useRef(false);
@@ -145,16 +207,7 @@ export function StructureView() {
)}
</span>
) : (
- <span className={styles.node}>
- <SymbolBadge kind={badgeKind(n.item.kind)} className={styles.badge} />
- <HighlightedText
- className={styles.name}
- text={n.item.name}
- indices={s.matches}
- tone={s.selected ? "accent" : "strong"}
- />
- {n.item.detail && <span className={styles.detail}>{n.item.detail}</span>}
- </span>
+ <SymbolRow node={n} indices={s.matches} selected={s.selected} />
)
}
/>
@@ -166,7 +219,14 @@ function StructureToolbar() {
const alphabetical = useStructureOptions((s) => s.alphabetical);
const autoscroll = useStructureOptions((s) => s.autoscrollFromSource);
const autoscrollToSource = useStructureOptions((s) => s.autoscrollToSource);
+ const showInherited = useStructureOptions((s) => s.showInherited);
+ const inheritedSupported = useOutline((s) => s.inheritedSupported);
const items = useOutline((s) => s.items);
+ const filterRef = useRef<HTMLButtonElement>(null);
+ const [menu, setMenu] = useState<MenuItem[] | null>(null);
+ // Subscribed so the menu's availability and pressed state follow the options.
+ const narrowed = useStructureOptions((s) => !s.showFields || !s.showNonPublic || s.sortByVisibility);
+ const hasOptions = viewOptionItems(items ?? []).length > 0;
return (
<div className={styles.toolbar} role="toolbar" aria-label="Structure actions">
<IconButton
@@ -177,6 +237,28 @@ function StructureToolbar() {
pressed={alphabetical}
onClick={() => useStructureOptions.setState({ alphabetical: !alphabetical })}
/>
+ {hasOptions && (
+ <IconButton
+ ref={filterRef}
+ icon="filter"
+ title="View Options"
+ size="small"
+ iconSize={16}
+ pressed={narrowed}
+ onClick={() => setMenu(viewOptionItems(useOutline.getState().items ?? []))}
+ />
+ )}
+ {inheritedSupported && (
+ <IconButton
+ icon="hierarchy"
+ title="Show Inherited"
+ size="small"
+ iconSize={16}
+ pressed={showInherited}
+ onClick={() => useStructureOptions.setState({ showInherited: !showInherited })}
+ />
+ )}
+ <Menu open={!!menu} anchor={filterRef} items={menu ?? []} onClose={() => setMenu(null)} />
<span className={styles.sep} />
<IconButton
icon="autoscroll-to-source"
@@ -232,7 +314,11 @@ function FileStructureDialog() {
const loading = useOutline((s) => s.loading);
const alphabetical = useStructureOptions((s) => s.alphabetical);
const narrowDown = useStructureOptions((s) => s.narrowDown);
- const nodes = useOutlineNodes(alphabetical);
+ const showFields = useStructureOptions((s) => s.showFields);
+ const showNonPublic = useStructureOptions((s) => s.showNonPublic);
+ const showInherited = useStructureOptions((s) => s.showInherited);
+ const inheritedSupported = useOutline((s) => s.inheritedSupported);
+ const nodes = useOutlineNodes();
const [query, setQuery] = useState("");
// IDEA opens the popup fully expanded.
const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(() => new Set());
@@ -365,6 +451,27 @@ function FileStructureDialog() {
checked={narrowDown}
onChange={(v) => useStructureOptions.setState({ narrowDown: v })}
/>
+ {(hasFields(items ?? []) || !showFields) && (
+ <Checkbox
+ label="Show fields"
+ checked={showFields}
+ onChange={(v) => useStructureOptions.setState({ showFields: v })}
+ />
+ )}
+ {hasVisibility(items ?? []) && (
+ <Checkbox
+ label="Show non-public"
+ checked={showNonPublic}
+ onChange={(v) => useStructureOptions.setState({ showNonPublic: v })}
+ />
+ )}
+ {inheritedSupported && (
+ <Checkbox
+ label="Show inherited members"
+ checked={showInherited}
+ onChange={(v) => useStructureOptions.setState({ showInherited: v })}
+ />
+ )}
</div>
<div className={styles.popupList} style={{ height }}>
<Tree<OutlineNode>
@@ -386,18 +493,7 @@ function FileStructureDialog() {
empty={<span className={styles.popupEmpty}>{!path ? "Open a file first" : loading && !items ? "Loading…" : "No symbols"}</span>}
renderNode={(n, s) => {
const matched = filter.matches.get(n.key);
- return (
- <span className={clsx(styles.node, query.trim() && !matched && styles.ancestor)}>
- <SymbolBadge kind={badgeKind(n.item.kind)} className={styles.badge} />
- <HighlightedText
- className={styles.name}
- text={n.item.name}
- indices={matched}
- tone={s.selected ? "accent" : "strong"}
- />
- {n.item.detail && <span className={styles.detail}>{n.item.detail}</span>}
- </span>
- );
+ return <SymbolRow node={n} indices={matched} selected={s.selected} dim={!!query.trim() && !matched} />;
}}
/>
</div>
diff --git a/src/features/search/structure/inherited.ts b/src/features/search/structure/inherited.ts
new file mode 100644
index 000000000..d58667c68
--- /dev/null
+++ b/src/features/search/structure/inherited.ts
@@ -0,0 +1,86 @@
+/**
+ * Structure › Show Inherited: members of each type's supertypes (LSP type
+ * hierarchy + the supertypes' document symbols), minus the ones the type
+ * itself or a nearer supertype declares.
+ */
+import type { HierarchyItem, OutlineItem, Pos } from "@/platform/ipc";
+import { isTypeKind } from "../common/open";
+
+export interface InheritedMember {
+ item: OutlineItem;
+ /** File (or virtual document URI) declaring the member. */
+ path: string;
+ /** Name of the supertype declaring it. */
+ owner: string;
+}
+
+export interface InheritedDeps {
+ supertypes: (path: string, pos: Pos) => Promise<HierarchyItem[]>;
+ outline: (path: string) => Promise<OutlineItem[]>;
+}
+
+/** `beta(int)` (jdtls) and `beta` name the same member. */
+const baseName = (name: string) => name.replace(/\s*[(<].*$/, "");
+const SKIPPED = new Set(["constructor"]);
+
+/** Key of a type in the current file: its identifier's position. */
+export const typeKey = (item: OutlineItem) => `${item.selection_range.start.line}:${item.selection_range.start.col}`;
+
+/** Every type declared in `items`, nested ones included. */
+export function typesIn(items: readonly OutlineItem[], out: OutlineItem[] = []): OutlineItem[] {
+ for (const i of items) {
+ if (isTypeKind(i.kind)) out.push(i);
+ typesIn(i.children ?? [], out);
+ }
+ return out;
+}
+
+/** The type declared at `at` in `outline` (matched by its identifier's line). */
+function typeAt(outline: readonly OutlineItem[], at: Pos): OutlineItem | null {
+ for (const i of outline) {
+ if (isTypeKind(i.kind) && i.selection_range.start.line === at.line) return i;
+ if (i.range.start.line <= at.line && at.line <= i.range.end.line) {
+ const deeper = typeAt(i.children ?? [], at);
+ if (deeper) return deeper;
+ }
+ }
+ return null;
+}
+
+/** Inherited members of `type` (declared in `path`), nearest supertypes first, up to `depth` levels. */
+export async function inheritedMembers(path: string, type: OutlineItem, deps: InheritedDeps, depth = 6): Promise<InheritedMember[]> {
+ const own = new Set(type.children.map((c) => baseName(c.name)));
+ const out: InheritedMember[] = [];
+ const seen = new Set<string>();
+ const outlines = new Map<string, Promise<OutlineItem[]>>();
+ const outlineOf = (p: string) => {
+ let o = outlines.get(p);
+ if (!o) outlines.set(p, (o = deps.outline(p).catch(() => [] as OutlineItem[])));
+ return o;
+ };
+ let level: Array<{ path: string; pos: Pos }> = [{ path, pos: type.selection_range.start }];
+ for (let d = 0; d < depth && level.length; d++) {
+ const next: Array<{ path: string; pos: Pos }> = [];
+ for (const t of level) {
+ const supers = await deps.supertypes(t.path, t.pos).catch(() => [] as HierarchyItem[]);
+ for (const s of supers) {
+ const key = `${s.path}:${s.selectionRange.start.line}`;
+ if (seen.has(key)) continue;
+ seen.add(key);
+ next.push({ path: s.path, pos: s.selectionRange.start });
+ const decl = typeAt(await outlineOf(s.path), s.selectionRange.start);
+ // Overloads within one supertype all show; a nearer declaration hides farther ones.
+ const declared: string[] = [];
+ for (const m of decl?.children ?? []) {
+ const name = baseName(m.name);
+ if (SKIPPED.has(m.kind) || isTypeKind(m.kind) || own.has(name)) continue;
+ declared.push(name);
+ out.push({ item: m, path: s.path, owner: baseName(s.name) });
+ }
+ declared.forEach((n) => own.add(n));
+ }
+ }
+ level = next;
+ }
+ return out;
+}
diff --git a/src/features/search/structure/outline.ts b/src/features/search/structure/outline.ts
index 6219a1ed8..a6011e2ad 100644
--- a/src/features/search/structure/outline.ts
+++ b/src/features/search/structure/outline.ts
@@ -1,10 +1,13 @@
-import type { OutlineItem, Pos } from "@/platform/ipc";
+import type { OutlineItem, Pos, Visibility } from "@/platform/ipc";
import { matchText } from "../common/rank";
+import { typeKey, type InheritedMember } from "./inherited";
export interface OutlineNode {
key: string;
item: OutlineItem;
children: OutlineNode[];
+ /** Show Inherited: a supertype's member, declared in `path` by `owner`. */
+ inherited?: { path: string; owner: string };
}
/** Stable keys: parent key + name + occurrence index among same-named siblings. */
@@ -18,11 +21,73 @@ export function keyOutline(items: readonly OutlineItem[], parent = ""): OutlineN
});
}
-export function sortOutline(nodes: readonly OutlineNode[], alphabetical: boolean): OutlineNode[] {
- if (!alphabetical) return nodes as OutlineNode[];
+/** Appends each type's inherited members (keyed by `typeKey`) after its own ones. */
+export function withInherited(nodes: readonly OutlineNode[], inherited: ReadonlyMap<string, readonly InheritedMember[]> | null): OutlineNode[] {
+ if (!inherited?.size) return nodes as OutlineNode[];
+ return nodes.map((n) => {
+ const children = withInherited(n.children, inherited);
+ const extra = n.inherited ? undefined : inherited.get(typeKey(n.item));
+ if (!extra?.length) return children === n.children ? n : { ...n, children };
+ const seen = new Map<string, number>();
+ const added = extra.map((m): OutlineNode => {
+ const id = `${m.owner}:${m.item.kind}:${m.item.name}`;
+ const k = seen.get(id) ?? 0;
+ seen.set(id, k + 1);
+ return { key: `${n.key}/inherited:${id}${k ? `#${k}` : ""}`, item: m.item, children: [], inherited: { path: m.path, owner: m.owner } };
+ });
+ return { ...n, children: [...children, ...added] };
+ });
+}
+
+const VISIBILITY_RANK: Record<Visibility, number> = { public: 0, protected: 1, package: 2, private: 3 };
+
+/** Rank for "Sort by Visibility": unknown counts as public. */
+export const visibilityRank = (item: OutlineItem) => (item.visibility ? VISIBILITY_RANK[item.visibility] : 0);
+
+export function sortOutline(
+ nodes: readonly OutlineNode[],
+ alphabetical: boolean,
+ byVisibility = false,
+): OutlineNode[] {
+ if (!alphabetical && !byVisibility) return nodes as OutlineNode[];
return [...nodes]
- .sort((a, b) => a.item.name.localeCompare(b.item.name, undefined, { sensitivity: "base" }))
- .map((n) => ({ ...n, children: sortOutline(n.children, true) }));
+ .sort(
+ (a, b) =>
+ (byVisibility ? visibilityRank(a.item) - visibilityRank(b.item) : 0) ||
+ (alphabetical ? a.item.name.localeCompare(b.item.name, undefined, { sensitivity: "base" }) : 0),
+ )
+ .map((n) => ({ ...n, children: sortOutline(n.children, alphabetical, byVisibility) }));
+}
+
+const FIELD_KINDS = new Set(["field", "property"]);
+
+export interface OutlineViewFilter {
+ /** IDEA's "Show Fields": fields and properties. */
+ fields: boolean;
+ /** IDEA's "Show Non-Public": private / protected / package symbols. */
+ nonPublic: boolean;
+}
+
+/** Hides filtered-out symbols together with their members. */
+export function applyViewFilter(nodes: readonly OutlineNode[], f: OutlineViewFilter): OutlineNode[] {
+ if (f.fields && f.nonPublic) return nodes as OutlineNode[];
+ const out: OutlineNode[] = [];
+ for (const n of nodes) {
+ if (!f.fields && FIELD_KINDS.has(n.item.kind)) continue;
+ if (!f.nonPublic && n.item.visibility && n.item.visibility !== "public") continue;
+ out.push({ ...n, children: applyViewFilter(n.children, f) });
+ }
+ return out;
+}
+
+/** Whether any symbol carries visibility (else the visibility options would do nothing). */
+export function hasVisibility(items: readonly OutlineItem[]): boolean {
+ return items.some((i) => !!i.visibility || hasVisibility(i.children ?? []));
+}
+
+/** Whether any symbol is a field or property. */
+export function hasFields(items: readonly OutlineItem[]): boolean {
+ return items.some((i) => FIELD_KINDS.has(i.kind) || hasFields(i.children ?? []));
}
const cmp = (a: Pos, b: Pos) => a.line - b.line || a.col - b.col;
@@ -34,7 +99,15 @@ function contains(item: OutlineItem, pos: Pos): boolean {
/** Keys from the root to the innermost symbol containing `pos` (empty if none). */
export function symbolPathAt(nodes: readonly OutlineNode[], pos: Pos): string[] {
for (const n of nodes) {
- if (contains(n.item, pos)) return [n.key, ...symbolPathAt(n.children, pos)];
+ if (!n.inherited && contains(n.item, pos)) return [n.key, ...symbolPathAt(n.children, pos)];
+ }
+ return [];
+}
+
+/** Symbols from the outermost to the innermost one containing `pos` (breadcrumbs). */
+export function outlinePathAt(items: readonly OutlineItem[], pos: Pos): OutlineItem[] {
+ for (const item of items) {
+ if (contains(item, pos)) return [item, ...outlinePathAt(item.children ?? [], pos)];
}
return [];
}
diff --git a/src/features/search/structure/store.ts b/src/features/search/structure/store.ts
index 350b0540c..dc3b27fb9 100644
--- a/src/features/search/structure/store.ts
+++ b/src/features/search/structure/store.ts
@@ -5,10 +5,12 @@
*/
import { useEffect } from "react";
import { create } from "zustand";
-import { useEditorRegistry } from "@/editor/api";
-import { call, commands, type OutlineItem } from "@/platform/ipc";
+import { editorsFor, useEditorRegistry } from "@/editor/api";
+import { call, commands, IpcError, type OutlineItem, type Pos } from "@/platform/ipc";
+import { isVirtualUri } from "@/platform/virtualDocs";
import { loadJson, saveJson } from "../common/open";
import { useTracking } from "../common/tracking";
+import { inheritedMembers, typeKey, typesIn, type InheritedDeps, type InheritedMember } from "./inherited";
interface OutlineState {
path: string | null;
@@ -16,21 +18,83 @@ interface OutlineState {
items: OutlineItem[] | null;
loading: boolean;
error: string | null;
+ /** Whether the file's language server answers type hierarchy requests (Show Inherited is offered). */
+ inheritedSupported: boolean;
+ /** Show Inherited: members of each type's supertypes, by `typeKey`. */
+ inherited: ReadonlyMap<string, readonly InheritedMember[]> | null;
}
-export const useOutline = create<OutlineState>(() => ({ path: null, doc: null, items: null, loading: false, error: null }));
+export const useOutline = create<OutlineState>(() => ({
+ path: null,
+ doc: null,
+ items: null,
+ loading: false,
+ error: null,
+ inheritedSupported: false,
+ inherited: null,
+}));
const IDLE_MS = 500;
let consumers = 0;
let stop: (() => void) | null = null;
let seq = 0;
+/** A backend document id for `path` while `fn` runs (open editors are reused). */
+async function withDoc<T>(path: string, fn: (doc: number) => Promise<T>): Promise<T> {
+ const open = editorsFor(path)[0];
+ if (open) return fn(open.ctx.doc);
+ const info = await call(isVirtualUri(path) ? commands.docOpenVirtual(path) : commands.docOpen(path));
+ try {
+ return await fn(info.id);
+ } finally {
+ void commands.docClose(info.id);
+ }
+}
+
+const supertypesOf = (doc: number, pos: Pos) => call(commands.lspTypeHierarchy(doc, pos, "incoming"));
+
+export const inheritedDeps = (path: string, doc: number): InheritedDeps => ({
+ supertypes: (p, pos) => (p === path ? supertypesOf(doc, pos) : withDoc(p, (d) => supertypesOf(d, pos))),
+ outline: (p) => (p === path ? call(commands.docOutline(doc)) : withDoc(p, (d) => call(commands.docOutline(d)))),
+});
+
+/** Whether a type hierarchy request for the first type reaches a server (none supporting it answers `unavailable`). */
+async function probeHierarchy(doc: number, types: readonly OutlineItem[]): Promise<boolean> {
+ const first = types[0];
+ if (!first) return false;
+ try {
+ await supertypesOf(doc, first.selection_range.start);
+ return true;
+ } catch (e) {
+ return !(e instanceof IpcError && (e.kind === "unavailable" || e.kind === "cancelled"));
+ }
+}
+
+async function loadInherited(doc: number, path: string, items: readonly OutlineItem[], my: number) {
+ const types = typesIn(items);
+ // Probed once per file; a reload after edits keeps the answer.
+ const known = useOutline.getState();
+ const supported = known.path === path && known.inheritedSupported ? true : await probeHierarchy(doc, types);
+ if (my !== seq) return;
+ if (!supported || !useStructureOptions.getState().showInherited) {
+ useOutline.setState({ inheritedSupported: supported, inherited: null });
+ return;
+ }
+ const deps = inheritedDeps(path, doc);
+ const entries = await Promise.all(types.map(async (t) => [typeKey(t), await inheritedMembers(path, t, deps).catch(() => [])] as const));
+ if (my === seq) useOutline.setState({ inheritedSupported: true, inherited: new Map(entries.filter(([, m]) => m.length)) });
+}
+
async function load(doc: number, path: string) {
const my = ++seq;
- useOutline.setState((s) => (s.path === path ? { loading: true } : { path, doc, items: null, loading: true, error: null }));
+ useOutline.setState((s) =>
+ s.path === path ? { loading: true } : { path, doc, items: null, loading: true, error: null, inheritedSupported: false, inherited: null },
+ );
try {
const items = await call(commands.docOutline(doc));
- if (my === seq) useOutline.setState({ path, doc, items, loading: false, error: null });
+ if (my !== seq) return;
+ useOutline.setState({ path, doc, items, loading: false, error: null });
+ void loadInherited(doc, path, items, my);
} catch (e) {
if (my === seq) useOutline.setState({ path, doc, loading: false, error: String((e as Error)?.message ?? e) });
}
@@ -44,7 +108,7 @@ function start(): () => void {
const ctx = current();
if (!ctx) {
seq++;
- useOutline.setState({ path: null, doc: null, items: null, loading: false, error: null });
+ useOutline.setState({ path: null, doc: null, items: null, loading: false, error: null, inheritedSupported: false, inherited: null });
return;
}
void load(ctx.doc, ctx.path);
@@ -53,6 +117,9 @@ function start(): () => void {
const unsubActive = useEditorRegistry.subscribe((s, prev) => {
if (s.active?.ctx.doc !== prev.active?.ctx.doc || s.active?.ctx.path !== prev.active?.ctx.path) reloadNow();
});
+ const unsubInherited = useStructureOptions.subscribe((s, prev) => {
+ if (s.showInherited !== prev.showInherited) reloadNow();
+ });
const unsubEdits = useTracking.subscribe((s, prev) => {
const ctx = current();
if (!ctx || s.editVersions.get(ctx.path) === prev.editVersions.get(ctx.path)) return;
@@ -62,6 +129,7 @@ function start(): () => void {
return () => {
clearTimeout(timer);
unsubActive();
+ unsubInherited();
unsubEdits();
};
}
@@ -92,6 +160,11 @@ interface StructureOptions {
autoscrollToSource: boolean;
/** File Structure popup: typing hides non-matching symbols (else only highlights them). */
narrowDown: boolean;
+ showFields: boolean;
+ showNonPublic: boolean;
+ sortByVisibility: boolean;
+ /** Members inherited from supertypes, greyed (IDEA: off). */
+ showInherited: boolean;
}
export const useStructureOptions = create<StructureOptions>(() => ({
@@ -99,6 +172,10 @@ export const useStructureOptions = create<StructureOptions>(() => ({
autoscrollFromSource: false,
autoscrollToSource: true,
narrowDown: true,
+ showFields: true,
+ showNonPublic: true,
+ sortByVisibility: false,
+ showInherited: false,
...loadJson<Partial<StructureOptions>>(OPTIONS_KEY, {}),
}));
@@ -108,5 +185,9 @@ useStructureOptions.subscribe((s) =>
autoscrollFromSource: s.autoscrollFromSource,
autoscrollToSource: s.autoscrollToSource,
narrowDown: s.narrowDown,
+ showFields: s.showFields,
+ showNonPublic: s.showNonPublic,
+ sortByVisibility: s.sortByVisibility,
+ showInherited: s.showInherited,
}),
);
diff --git a/src/features/services/Services.module.css b/src/features/services/Services.module.css
index a425f2f7a..9b13feb9d 100644
--- a/src/features/services/Services.module.css
+++ b/src/features/services/Services.module.css
@@ -174,6 +174,68 @@
background: var(--bg-hover);
}
+.fieldRow {
+ display: flex;
+ gap: 6px;
+}
+.fieldRow > :first-child {
+ flex: 1;
+ min-width: 0;
+}
+.okText {
+ color: var(--success);
+}
+
+/* Services tree host */
+.empty {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 6px;
+ color: var(--fg-muted);
+}
+.link {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ padding: 0;
+ border: 0;
+ background: none;
+ color: var(--link);
+ font: inherit;
+ cursor: pointer;
+}
+.link:hover {
+ color: var(--link-hover);
+}
+.shortcut {
+ color: var(--fg-subtle);
+}
+.facts {
+ display: grid;
+ grid-template-columns: max-content 1fr;
+ gap: 4px 12px;
+ padding: 12px;
+ margin: 0;
+}
+.facts dt {
+ color: var(--fg-secondary);
+}
+.facts dd {
+ margin: 0;
+ min-width: 0;
+ overflow-wrap: anywhere;
+ -webkit-user-select: text;
+ user-select: text;
+}
+.detailActions {
+ display: flex;
+ gap: 6px;
+ padding: 0 12px 12px;
+}
+
.hostTabs {
min-width: 0;
border: 0;
diff --git a/src/features/services/ServicesTree.tsx b/src/features/services/ServicesTree.tsx
new file mode 100644
index 000000000..0765a23cc
--- /dev/null
+++ b/src/features/services/ServicesTree.tsx
@@ -0,0 +1,200 @@
+/**
+ * The Services tree (IDEA's Services view): the nodes every service provider
+ * contributes (Docker connections, run configurations…) on the left, the
+ * selected node's detail on the right, "Add Service" (+, ⌘N) on the toolbar.
+ */
+import { useEffect, useMemo, useRef } from "react";
+import clsx from "clsx";
+import { setContext } from "@/platform/context";
+import { useTxTemplate } from "@/platform/i18n";
+import { shortcutLabel } from "@/platform/keymap";
+import {
+ EmptyState,
+ Icon,
+ IconButton,
+ SplitGroup,
+ SplitHandle,
+ SplitPanel,
+ Tree,
+ showContextMenu,
+ T,
+ type TreeRowState,
+} from "@/ui";
+import {
+ useServiceProviders,
+ serviceProviders,
+ type ServiceProviderContribution,
+ type ServiceTreeItem,
+} from "@/workbench/contributions";
+import {
+ addServiceMenu,
+ clearProviderRoots,
+ expandableKeys,
+ indexTree,
+ orderedRoots,
+ setProviderRoots,
+ useServicesTree,
+} from "./tree";
+import styles from "./Services.module.css";
+
+export const SERVICES_VIEW_FOCUS = "servicesViewFocus";
+
+/** Reports one provider's roots into the tree store (hooks can't run in a loop over providers). */
+function ProviderRoots({ provider }: { provider: ServiceProviderContribution }) {
+ const roots = provider.useRoots();
+ useEffect(() => setProviderRoots(provider.id, roots), [provider.id, roots]);
+ useEffect(() => () => clearProviderRoots(provider.id), [provider.id]);
+ useEffect(() => provider.watch?.(), [provider]);
+ return null;
+}
+
+function useProviders(): ServiceProviderContribution[] {
+ const map = useServiceProviders((s) => s.providers);
+ return useMemo(() => serviceProviders(map), [map]);
+}
+
+/** Opens the "Add Service" menu below `anchor` (or at the selected row / top left). */
+export function showAddServiceMenu(anchor?: Element | null) {
+ const el = anchor ?? document.querySelector("[data-services-add]");
+ const r = el?.getBoundingClientRect();
+ showContextMenu({ x: r?.left ?? 100, y: (r?.bottom ?? 100) + 2 }, addServiceMenu());
+}
+
+function Row({ item, state }: { item: ServiceTreeItem; state: TreeRowState }) {
+ const txTemplate = useTxTemplate();
+ return (
+ <span className={styles.row}>
+ <Icon name={item.icon} size={16} className={styles.icon} />
+ <span className={clsx(styles.label, state.selected && styles.selectedLabel, item.dim && styles.dim)}>
+ {item.label}
+ </span>
+ {item.detail && <span className={styles.detail}>{txTemplate(item.detail)}</span>}
+ </span>
+ );
+}
+
+export function ServicesTreeView() {
+ const providers = useProviders();
+ const rootsByProvider = useServicesTree((s) => s.roots);
+ const selectedKey = useServicesTree((s) => s.selectedKey);
+ const expanded = useServicesTree((s) => s.expanded);
+ const addRef = useRef<HTMLButtonElement>(null);
+
+ const roots = useMemo(() => orderedRoots(rootsByProvider, providers), [rootsByProvider, providers]);
+ const index = useMemo(() => indexTree(rootsByProvider), [rootsByProvider]);
+ const selected = selectedKey ? (index.get(selectedKey) ?? null) : null;
+ const owner = selected ? providers.find((p) => p.id === selected.provider) : undefined;
+ const actions = selected && owner?.actions ? owner.actions(selected.item) : [];
+ const Detail = owner?.detail;
+ const add = shortcutLabel("services.addService");
+
+ return (
+ <div className={styles.view}>
+ {providers.map((p) => (
+ <ProviderRoots key={p.id} provider={p} />
+ ))}
+ <div className={styles.toolbar} role="toolbar" aria-label="Services actions">
+ <IconButton
+ ref={addRef}
+ data-services-add
+ icon="plus"
+ size="small"
+ iconSize={16}
+ action="services.addService"
+ onClick={() => showAddServiceMenu(addRef.current)}
+ />
+ <span className={styles.sep} />
+ <IconButton
+ icon="expand-all"
+ size="small"
+ iconSize={16}
+ title="Expand All"
+ disabled={!roots.length}
+ onClick={() => useServicesTree.setState({ expanded: new Set(expandableKeys(roots)) })}
+ />
+ <IconButton
+ icon="collapse-all"
+ size="small"
+ iconSize={16}
+ title="Collapse All"
+ disabled={!roots.length}
+ onClick={() => useServicesTree.setState({ expanded: new Set() })}
+ />
+ {actions.length > 0 && <span className={styles.sep} />}
+ {actions.map((a) => (
+ <IconButton
+ key={a.id}
+ icon={a.icon}
+ size="small"
+ iconSize={16}
+ title={a.title}
+ disabled={a.disabled}
+ onClick={a.run}
+ />
+ ))}
+ </div>
+ {providers.map((p) => p.banner && <p.banner key={p.id} />)}
+ {!roots.length ? (
+ <div className={styles.empty}>
+ <T>No services configured.</T>
+ <button type="button" className={styles.link} onClick={(e) => showAddServiceMenu(e.currentTarget)}>
+ <Icon name="plus" size={14} />
+ <T>Add service</T>
+ {add && <span className={styles.shortcut}>{add}</span>}
+ </button>
+ </div>
+ ) : (
+ <SplitGroup orientation="horizontal" className={styles.split}>
+ <SplitPanel defaultSize="40%" minSize="160px">
+ <div
+ className={styles.tree}
+ onFocus={(e) =>
+ setContext(SERVICES_VIEW_FOCUS, (e.target as HTMLElement).getAttribute("role") === "tree")
+ }
+ onBlur={() => setContext(SERVICES_VIEW_FOCUS, false)}
+ >
+ <Tree<ServiceTreeItem>
+ roots={roots}
+ getKey={(n) => n.key}
+ getLabel={(n) => n.label}
+ getChildren={(n) => n.children}
+ isExpandable={(n) => !!n.children?.length}
+ expanded={expanded}
+ onExpandedChange={(next) => useServicesTree.setState({ expanded: next })}
+ selected={selectedKey ? new Set([selectedKey]) : new Set()}
+ onSelectionChange={(_keys, lead) => useServicesTree.setState({ selectedKey: lead?.key ?? null })}
+ renderNode={(n, state) => <Row item={n} state={state} />}
+ onActivate={(n) => {
+ const p = index.get(n.key);
+ providers.find((x) => x.id === p?.provider)?.activate?.(n);
+ }}
+ onContextMenu={(n, _sel, e) => {
+ e.preventDefault();
+ if (!n) {
+ showContextMenu({ x: e.clientX, y: e.clientY }, addServiceMenu(providers));
+ return;
+ }
+ useServicesTree.setState({ selectedKey: n.key });
+ const p = providers.find((x) => x.id === index.get(n.key)?.provider);
+ const items = p?.menu?.(n) ?? [];
+ if (items.length) showContextMenu({ x: e.clientX, y: e.clientY }, items);
+ }}
+ speedSearch
+ aria-label="Services"
+ className={styles.tree}
+ />
+ </div>
+ </SplitPanel>
+ <SplitHandle />
+ <SplitPanel minSize="200px">
+ {selected && Detail ? (
+ <Detail key={selected.item.key} item={selected.item} />
+ ) : (
+ <EmptyState title="Select service to view details" />
+ )}
+ </SplitPanel>
+ </SplitGroup>
+ )}
+ </div>
+ );
+}
diff --git a/src/features/services/ServicesView.tsx b/src/features/services/ServicesView.tsx
deleted file mode 100644
index 8da42458e..000000000
--- a/src/features/services/ServicesView.tsx
+++ /dev/null
@@ -1,397 +0,0 @@
-/** The Services tool window (⌘8): Docker tree on the left, log / inspect of the selection on the right. */
-import { useEffect, useMemo, useRef, useState } from "react";
-import clsx from "clsx";
-import { Channel } from "@tauri-apps/api/core";
-import type { DockerAvailability, DockerLogLine, DockerObject } from "@/platform/ipc";
-import { call, commands, isCancelled, nextRequestId } from "@/platform/ipc";
-import {
- EmptyState,
- Icon,
- IconButton,
- SplitGroup,
- SplitHandle,
- SplitPanel,
- Spinner,
- Tabs,
- Toggle,
- Tree,
- showContextMenu,
- type TreeRowState,
- T,
-} from "@/ui";
-import { childrenOf, findNode, nodeDetail, nodeIcon, nodeLabel, rootNodes, isRunning, type ServiceNode } from "./model";
-import {
- canRemove,
- canStart,
- canStop,
- execShell,
- nodeMenu,
- pullPrompt,
- pruneMenu,
- remove,
- restart,
- start,
- stop,
-} from "./ops";
-import { cancelTask, errorMessage, refresh, useServices, watch } from "./store";
-import styles from "./Services.module.css";
-
-/** Status banner instead of the tree when docker cannot be used. */
-function Unavailable({ availability }: { availability: DockerAvailability }) {
- if (availability.kind === "notInstalled")
- return (
- <EmptyState title="Docker is not installed">
- <T>Install Docker Desktop, OrbStack, Colima or the Docker Engine and make sure</T> <code>docker</code>{" "}
- <T>is on PATH.</T>
- </EmptyState>
- );
- if (availability.kind === "daemonDown")
- return (
- <EmptyState
- title="Docker is not running"
- actions={<IconButton icon="refresh" title="Retry" onClick={() => void refresh()} />}
- >
- <div>{availability.message}</div>
- <div className={styles.hint}>
- Start Docker{availability.context ? ` (context '${availability.context}')` : ""}; this view connects
- automatically.
- </div>
- </EmptyState>
- );
- return null;
-}
-
-function Row({ node, state }: { node: ServiceNode; state: TreeRowState }) {
- const detail = nodeDetail(node);
- const dim = node.kind === "container" && !isRunning(node.container);
- return (
- <span className={styles.row}>
- <Icon name={nodeIcon(node)} size={16} className={styles.icon} />
- <span className={clsx(styles.label, state.selected && styles.selectedLabel, dim && styles.dim)}>
- {nodeLabel(node)}
- </span>
- {detail && <span className={styles.detail}>{detail}</span>}
- </span>
- );
-}
-
-function Toolbar({ node }: { node: ServiceNode | null }) {
- const loading = useServices((s) => s.loading);
- const container = node?.kind === "container" ? node.container : null;
- return (
- <div className={styles.toolbar} role="toolbar" aria-label="Services actions">
- {loading ? (
- <Spinner size={14} />
- ) : (
- <IconButton icon="refresh" size="small" iconSize={16} action="docker.refresh" />
- )}
- <span className={styles.sep} />
- <IconButton
- icon="run"
- size="small"
- iconSize={16}
- title="Start"
- disabled={!canStart(node)}
- onClick={() => void start(node)}
- />
- <IconButton
- icon="stop"
- size="small"
- iconSize={16}
- title="Stop"
- disabled={!canStop(node)}
- onClick={() => void stop(node)}
- />
- <IconButton
- icon="rerun"
- size="small"
- iconSize={16}
- title="Restart"
- disabled={!node || !(node.kind === "container" || node.kind === "compose")}
- onClick={() => void restart(node)}
- />
- <IconButton
- icon="trash"
- size="small"
- iconSize={16}
- title="Delete"
- disabled={!canRemove(node)}
- onClick={() => void remove(node)}
- />
- <span className={styles.sep} />
- <IconButton
- icon="terminal"
- size="small"
- iconSize={16}
- title="Create Terminal"
- disabled={!container || !isRunning(container)}
- onClick={() => execShell(node)}
- />
- <IconButton icon="git-pull" size="small" iconSize={16} title="Pull Image…" onClick={() => void pullPrompt()} />
- <IconButton
- icon="trash"
- size="small"
- iconSize={16}
- title="Prune…"
- onClick={(e) => {
- const r = e.currentTarget.getBoundingClientRect();
- showContextMenu({ x: r.left, y: r.bottom + 2 }, pruneMenu());
- }}
- />
- </div>
- );
-}
-
-function TaskBanner() {
- const task = useServices((s) => s.task);
- if (!task) return null;
- return (
- <div className={styles.banner} role="status">
- <Spinner size={12} />
- <span className={styles.bannerTitle}>{task.title}</span>
- <span className={styles.bannerText}>{task.line}</span>
- <IconButton icon="close" size="small" title="Cancel" onClick={cancelTask} />
- </div>
- );
-}
-
-const ANSI = /\x1b\[[0-9;?]*[A-Za-z]/g; // eslint-disable-line no-control-regex
-const MAX_LINES = 5000;
-
-/** Follows a container's log while shown. */
-function LogView({ id, running }: { id: string; running: boolean }) {
- const [timestamps, setTimestamps] = useState(false);
- const [wrap, setWrap] = useState(true);
- // A new stream (and buffer) per option set.
- return (
- <LogStream
- key={`${running}:${timestamps}`}
- id={id}
- running={running}
- timestamps={timestamps}
- setTimestamps={setTimestamps}
- wrap={wrap}
- setWrap={setWrap}
- />
- );
-}
-
-function LogStream(props: {
- id: string;
- running: boolean;
- timestamps: boolean;
- setTimestamps: (v: boolean) => void;
- wrap: boolean;
- setWrap: (v: boolean) => void;
-}) {
- const { id, running, timestamps, setTimestamps, wrap, setWrap } = props;
- const [lines, setLines] = useState<DockerLogLine[]>([]);
- const [error, setError] = useState<string | null>(null);
- const scroller = useRef<HTMLDivElement>(null);
- const stick = useRef(true);
-
- useEffect(() => {
- const request = nextRequestId();
- const channel = new Channel<DockerLogLine>();
- let buffer: DockerLogLine[] = [];
- let frame = 0;
- const flush = () => {
- frame = 0;
- const add = buffer;
- buffer = [];
- setLines((prev) => {
- const next = prev.concat(add);
- return next.length > MAX_LINES ? next.slice(next.length - MAX_LINES) : next;
- });
- };
- channel.onmessage = (line) => {
- buffer.push({ stderr: line.stderr, text: line.text.replace(ANSI, "") });
- frame ||= requestAnimationFrame(flush);
- };
- call(commands.dockerLogs(request, id, 1000, running, timestamps, channel)).catch((e) => {
- if (!isCancelled(e)) setError(errorMessage(e));
- });
- return () => {
- cancelAnimationFrame(frame);
- void commands.cancelRequest(request);
- };
- }, [id, running, timestamps]);
-
- useEffect(() => {
- const el = scroller.current;
- if (el && stick.current) el.scrollTop = el.scrollHeight;
- }, [lines]);
-
- return (
- <div className={styles.detailBody}>
- <div className={styles.subToolbar}>
- <Toggle checked={timestamps} onChange={setTimestamps} label="Timestamps" />
- <Toggle checked={wrap} onChange={setWrap} label="Soft-wrap" />
- <span className={styles.flex} />
- <IconButton icon="trash" size="small" title="Clear" onClick={() => setLines([])} />
- </div>
- <div
- ref={scroller}
- className={clsx(styles.log, wrap && styles.wrap)}
- role="log"
- aria-label="Container log"
- onScroll={(e) => {
- const el = e.currentTarget;
- stick.current = el.scrollHeight - el.scrollTop - el.clientHeight < 24;
- }}
- >
- {lines.map((l, i) => (
- <div key={i} className={clsx(l.stderr && styles.stderr)}>
- {l.text || " "}
- </div>
- ))}
- {error && <div className={styles.stderr}>{error}</div>}
- {!lines.length && !error && <div className={styles.dim}>{running ? "Waiting for output…" : "No output"}</div>}
- </div>
- </div>
- );
-}
-
-function InspectView({ object, id }: { object: DockerObject; id: string }) {
- const [text, setText] = useState<string | null>(null);
- const [error, setError] = useState<string | null>(null);
- useEffect(() => {
- let alive = true;
- call(commands.dockerInspect(object, id))
- .then((t) => alive && setText(t))
- .catch((e) => alive && setError(errorMessage(e)));
- return () => {
- alive = false;
- };
- }, [object, id]);
- return (
- <div className={styles.detailBody}>
- <pre className={clsx(styles.log, styles.json)} aria-label="Inspect">
- {error ?? text ?? "Loading…"}
- </pre>
- </div>
- );
-}
-
-function Detail({ node }: { node: ServiceNode | null }) {
- const tab = useServices((s) => s.detailTab);
- const snapshot = useServices((s) => s.snapshot);
- if (!node || node.kind === "docker" || node.kind === "group" || node.kind === "compose") {
- const a = snapshot?.availability;
- return (
- <EmptyState title={node?.kind === "compose" ? `Compose project '${node.project}'` : "Docker"}>
- {a?.kind === "ready" && (
- <div>
- Engine {a.serverVersion} · CLI {a.clientVersion}
- {a.context ? ` · context ${a.context}` : ""}
- </div>
- )}
- <div className={styles.hint}>
- <T>Select a container, image, volume or network.</T>
- </div>
- </EmptyState>
- );
- }
- const object: DockerObject = node.kind;
- const id =
- node.kind === "container"
- ? node.container.id
- : node.kind === "image"
- ? node.image.id
- : node.kind === "volume"
- ? node.volume.name
- : node.network.id;
- const showLog = node.kind === "container" && tab === "log";
- return (
- <div className={styles.detailPane}>
- <Tabs
- variant="compact"
- activeId={showLog ? "log" : "inspect"}
- onSelect={(t) => useServices.setState({ detailTab: t as "log" | "inspect" })}
- aria-label="Details"
- items={[
- ...(node.kind === "container" ? [{ id: "log", label: "Log" }] : []),
- { id: "inspect", label: "Inspect" },
- ]}
- />
- {showLog ? (
- <LogView key={id} id={id} running={isRunning(node.container)} />
- ) : (
- <InspectView key={id} object={object} id={id} />
- )}
- </div>
- );
-}
-
-export function ServicesView() {
- const snapshot = useServices((s) => s.snapshot);
- const error = useServices((s) => s.error);
- const selectedKey = useServices((s) => s.selectedKey);
- const expanded = useServices((s) => s.expanded);
- useEffect(() => watch(), []);
-
- const getChildren = useMemo(() => childrenOf(snapshot), [snapshot]);
- const roots = useMemo(() => rootNodes(), []);
- const node = useMemo(() => findNode(snapshot, selectedKey), [snapshot, selectedKey]);
-
- if (!snapshot)
- return (
- <div className={styles.loading}>
- {error ?? (
- <>
- <Spinner size={14} /> <T>Connecting to Docker…</T>
- </>
- )}
- </div>
- );
-
- const ready = snapshot.availability.kind === "ready";
- return (
- <div className={styles.view}>
- <Toolbar node={ready ? node : null} />
- <TaskBanner />
- {snapshot.errors.length > 0 && (
- <div className={clsx(styles.banner, styles.warning)}>
- <Icon name="warning" size={14} />
- <span className={styles.bannerText}>{snapshot.errors.join("; ")}</span>
- </div>
- )}
- {!ready ? (
- <Unavailable availability={snapshot.availability} />
- ) : (
- <SplitGroup orientation="horizontal" className={styles.split}>
- <SplitPanel defaultSize="40%" minSize="160px">
- <Tree<ServiceNode>
- roots={roots}
- getKey={(n) => n.key}
- getLabel={nodeLabel}
- getChildren={getChildren}
- isExpandable={(n) => !!getChildren(n)?.length}
- expanded={expanded}
- onExpandedChange={(next) => useServices.setState({ expanded: next })}
- selected={selectedKey ? new Set([selectedKey]) : new Set()}
- onSelectionChange={(_keys, lead) => useServices.setState({ selectedKey: lead?.key ?? null })}
- renderNode={(n, state) => <Row node={n} state={state} />}
- onActivate={(n) => {
- if (n.kind === "container") useServices.setState({ detailTab: "log" });
- }}
- onContextMenu={(n, _sel, e) => {
- if (!n) return;
- e.preventDefault();
- useServices.setState({ selectedKey: n.key });
- showContextMenu({ x: e.clientX, y: e.clientY }, nodeMenu(n));
- }}
- speedSearch
- aria-label="Services"
- className={styles.tree}
- />
- </SplitPanel>
- <SplitHandle />
- <SplitPanel minSize="200px">
- <Detail node={node} />
- </SplitPanel>
- </SplitGroup>
- )}
- </div>
- );
-}
diff --git a/src/features/services/compose.ts b/src/features/services/compose.ts
index 724bd53a7..7db483e75 100644
--- a/src/features/services/compose.ts
+++ b/src/features/services/compose.ts
@@ -1,10 +1,8 @@
/**
* Run targets of Dockerfiles (`FROM` lines → build image) and Compose files
* (`services:` → up all, each service → up that service), detected per line like
- * the run gutter does, and the run configurations they start.
+ * the run gutter does (the configurations they start are in `runTypes.ts`).
*/
-import type { RunConfig } from "@/platform/ipc";
-
export type DockerTarget =
| { kind: "build"; line: number; stage: string | null; last: boolean }
| { kind: "composeAll"; line: number }
@@ -71,59 +69,13 @@ export function imageTag(path: string): string {
return `${folder || "image"}:latest`;
}
-function rel(path: string, root: string | null): string {
- return root && path.startsWith(`${root}/`) ? path.slice(root.length + 1) : base(path);
-}
-
export function targetTitle(t: DockerTarget, path: string): string {
switch (t.kind) {
case "build":
- return t.stage && !t.last ? `Build Stage '${t.stage}'` : `Build Image '${imageTag(path)}'`;
+ return t.stage && !t.last ? `Build Stage '${t.stage}'` : `Run '${base(path)}'`;
case "composeAll":
return "Compose Up (All Services)";
case "composeService":
return `Compose Up '${t.service}'`;
}
}
-
-/** The run configuration a target starts, run with `docker` (the resolved executable when known). */
-export function targetConfig(t: DockerTarget, path: string, root: string | null, docker = "docker"): RunConfig {
- const cwd = dir(path);
- const file = rel(path, root);
- const common = { command: docker, cwd, env: {}, detected: false, isTest: false, debugAdapter: null, kind: "docker" };
- switch (t.kind) {
- case "build": {
- const args = ["build", "--file", path, "--tag", imageTag(path)];
- const stage = t.stage && !t.last ? t.stage : null;
- if (stage) args.push("--target", stage);
- args.push(cwd);
- return { ...common, id: `docker:build:${file}${stage ? `:${stage}` : ""}`, name: stage ? `${file} [${stage}]` : file, args };
- }
- case "composeAll":
- return { ...common, id: `docker:compose:${file}`, name: `Compose: ${file}`, args: ["compose", "--file", path, "up"] };
- case "composeService":
- return {
- ...common,
- id: `docker:compose:${file}:${t.service}`,
- name: `Compose: ${t.service}`,
- args: ["compose", "--file", path, "up", t.service],
- };
- }
-}
-
-/** `docker compose down` for a compose file (gutter menu of `services:`). */
-export function composeDownConfig(path: string, root: string | null, docker = "docker"): RunConfig {
- const file = rel(path, root);
- return {
- id: `docker:compose-down:${file}`,
- name: `Compose Down: ${file}`,
- kind: "docker",
- command: docker,
- args: ["compose", "--file", path, "down"],
- cwd: dir(path),
- env: {},
- detected: false,
- isTest: false,
- debugAdapter: null,
- };
-}
diff --git a/src/features/services/dialogs.tsx b/src/features/services/dialogs.tsx
index 8401fbcf8..11a223724 100644
--- a/src/features/services/dialogs.tsx
+++ b/src/features/services/dialogs.tsx
@@ -1,7 +1,9 @@
/** Imperative prompt dialogs of the Services view, rendered by one overlay. */
import { Fragment, useState, type ReactNode } from "react";
import { create } from "zustand";
-import { Dialog, Input } from "@/ui";
+import type { DockerConnection, DockerEndpoint, DockerRegistry } from "@/platform/ipc";
+import { Button, Dialog, Input, Select, T } from "@/ui";
+import { errorMessage, newId, saveConnection, saveRegistry, testRegistryLogin } from "./store";
import styles from "./Services.module.css";
interface Entry {
@@ -71,7 +73,9 @@ function PromptDialog(props: {
if (ok) props.onDone(value.trim());
}}
>
- <label className={styles.fieldLabel}>{props.label}</label>
+ <label className={styles.fieldLabel}>
+ <T>{props.label}</T>
+ </label>
<Input
data-autofocus
mono
@@ -84,3 +88,229 @@ function PromptDialog(props: {
</Dialog>
);
}
+
+async function pickDirectory(title: string): Promise<string | null> {
+ const { open: openDialog } = await import("@tauri-apps/plugin-dialog");
+ const dir = await openDialog({ multiple: false, directory: true, title });
+ return typeof dir === "string" ? dir : null;
+}
+
+type EndpointKind = DockerEndpoint["kind"];
+
+const ENDPOINT_KINDS: Array<{ value: EndpointKind; label: string }> = [
+ { value: "default", label: "Docker CLI default (DOCKER_HOST / current context)" },
+ { value: "socket", label: "Unix socket" },
+ { value: "tcp", label: "TCP / SSH host" },
+ { value: "context", label: "Docker context" },
+];
+
+/** The endpoint described by the dialog's fields, or null while incomplete. */
+export function endpointFrom(
+ kind: EndpointKind,
+ fields: { path: string; host: string; tls: string; context: string },
+): DockerEndpoint | null {
+ switch (kind) {
+ case "default":
+ return { kind };
+ case "socket":
+ return fields.path.trim() ? { kind, path: fields.path.trim() } : null;
+ case "tcp":
+ return fields.host.trim() ? { kind, host: fields.host.trim(), tlsCertDir: fields.tls.trim() || null } : null;
+ case "context": {
+ const name = fields.context.trim();
+ return name && !name.startsWith("-") ? { kind, name } : null;
+ }
+ }
+}
+
+/** "Add Service › Docker Connection…" (or edit `existing`). */
+export function openConnectionDialog(existing?: DockerConnection) {
+ open((close) => <ConnectionDialog existing={existing} onDone={close} />);
+}
+
+function ConnectionDialog({ existing, onDone }: { existing?: DockerConnection; onDone: () => void }) {
+ const ep = existing?.endpoint;
+ const [name, setName] = useState(existing?.name ?? "Docker");
+ const [kind, setKind] = useState<EndpointKind>(ep?.kind ?? "socket");
+ const [path, setPath] = useState(ep?.kind === "socket" ? ep.path : "/var/run/docker.sock");
+ const [host, setHost] = useState(ep?.kind === "tcp" ? ep.host : "");
+ const [tls, setTls] = useState(ep?.kind === "tcp" ? (ep.tlsCertDir ?? "") : "");
+ const [context, setContext] = useState(ep?.kind === "context" ? ep.name : "");
+ const endpoint = endpointFrom(kind, { path, host, tls, context });
+ const ok = !!endpoint && name.trim().length > 0;
+ const submit = async () => {
+ if (!endpoint || !ok) return;
+ if (await saveConnection({ id: existing?.id ?? newId("c"), name: name.trim(), endpoint })) onDone();
+ };
+ return (
+ <Dialog
+ open
+ title={existing ? "Edit Docker Connection" : "New Docker Connection"}
+ onClose={onDone}
+ width={480}
+ buttons={[
+ { label: "OK", role: "default", disabled: !ok, onClick: () => void submit() },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <form
+ className={styles.form}
+ onSubmit={(e) => {
+ e.preventDefault();
+ void submit();
+ }}
+ >
+ <label className={styles.fieldLabel} htmlFor="docker-conn-name">
+ <T>Name:</T>
+ </label>
+ <Input id="docker-conn-name" data-autofocus value={name} onChange={(e) => setName(e.target.value)} />
+ <span className={styles.fieldLabel}>
+ <T>Connect to Docker daemon with:</T>
+ </span>
+ <Select<EndpointKind> aria-label="Connection type" value={kind} options={ENDPOINT_KINDS} onChange={setKind} />
+ {kind === "socket" && (
+ <>
+ <label className={styles.fieldLabel} htmlFor="docker-conn-socket">
+ <T>Socket path or Engine API URL:</T>
+ </label>
+ <Input
+ id="docker-conn-socket"
+ mono
+ value={path}
+ placeholder="/var/run/docker.sock"
+ onChange={(e) => setPath(e.target.value)}
+ />
+ </>
+ )}
+ {kind === "tcp" && (
+ <>
+ <label className={styles.fieldLabel} htmlFor="docker-conn-host">
+ <T>Engine API URL:</T>
+ </label>
+ <Input
+ id="docker-conn-host"
+ mono
+ value={host}
+ placeholder="tcp://build-host:2376 or ssh://me@build-host"
+ onChange={(e) => setHost(e.target.value)}
+ />
+ <label className={styles.fieldLabel} htmlFor="docker-conn-tls">
+ <T>Certificates folder (TLS, optional):</T>
+ </label>
+ <div className={styles.fieldRow}>
+ <Input
+ id="docker-conn-tls"
+ mono
+ value={tls}
+ placeholder="contains ca.pem, cert.pem and key.pem"
+ onChange={(e) => setTls(e.target.value)}
+ />
+ <Button onClick={() => void pickDirectory("Certificates Folder").then((d) => d && setTls(d))}>Browse…</Button>
+ </div>
+ </>
+ )}
+ {kind === "context" && (
+ <>
+ <label className={styles.fieldLabel} htmlFor="docker-conn-context">
+ <T>Context name:</T>
+ </label>
+ <Input
+ id="docker-conn-context"
+ mono
+ value={context}
+ placeholder="e.g. desktop-linux, orbstack, colima"
+ onChange={(e) => setContext(e.target.value)}
+ />
+ </>
+ )}
+ </form>
+ </Dialog>
+ );
+}
+
+/** "Add Service › Docker Registry…" (or edit `existing`). */
+export function openRegistryDialog(existing?: DockerRegistry) {
+ open((close) => <RegistryDialog existing={existing} onDone={close} />);
+}
+
+function RegistryDialog({ existing, onDone }: { existing?: DockerRegistry; onDone: () => void }) {
+ const [name, setName] = useState(existing?.name ?? "Docker Registry");
+ const [address, setAddress] = useState(existing?.address ?? "docker.io");
+ const [username, setUsername] = useState(existing?.username ?? "");
+ // Left empty when editing: the saved password stays.
+ const [password, setPassword] = useState("");
+ const [status, setStatus] = useState<{ ok: boolean; text: string } | null>(null);
+ const [testing, setTesting] = useState(false);
+ const [id] = useState(() => existing?.id ?? newId("r"));
+ const ok = name.trim().length > 0 && address.trim().length > 0;
+ const registry = (): DockerRegistry => ({ id, name: name.trim(), address: address.trim(), username: username.trim() });
+ const submit = async () => {
+ if (!ok) return;
+ if (await saveRegistry(registry(), password ? password : existing ? undefined : null)) onDone();
+ };
+ const test = async () => {
+ setTesting(true);
+ setStatus(null);
+ try {
+ setStatus({ ok: true, text: await testRegistryLogin(registry(), password || null) });
+ } catch (e) {
+ setStatus({ ok: false, text: errorMessage(e) });
+ } finally {
+ setTesting(false);
+ }
+ };
+ return (
+ <Dialog
+ open
+ title={existing ? "Edit Docker Registry" : "New Docker Registry"}
+ onClose={onDone}
+ width={480}
+ footerStart={status && <span className={status.ok ? styles.okText : styles.stderr}>{status.text}</span>}
+ buttons={[
+ { label: "Test Connection", role: "extra", disabled: !ok || !username.trim() || testing, onClick: () => void test() },
+ { label: "OK", role: "default", disabled: !ok, onClick: () => void submit() },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <form
+ className={styles.form}
+ onSubmit={(e) => {
+ e.preventDefault();
+ void submit();
+ }}
+ >
+ <label className={styles.fieldLabel} htmlFor="docker-reg-name">
+ <T>Name:</T>
+ </label>
+ <Input id="docker-reg-name" data-autofocus value={name} onChange={(e) => setName(e.target.value)} />
+ <label className={styles.fieldLabel} htmlFor="docker-reg-address">
+ <T>Address:</T>
+ </label>
+ <Input
+ id="docker-reg-address"
+ mono
+ value={address}
+ placeholder="docker.io, ghcr.io, registry.example.com:5000"
+ onChange={(e) => setAddress(e.target.value)}
+ />
+ <label className={styles.fieldLabel} htmlFor="docker-reg-user">
+ <T>Username:</T>
+ </label>
+ <Input id="docker-reg-user" value={username} onChange={(e) => setUsername(e.target.value)} />
+ <label className={styles.fieldLabel} htmlFor="docker-reg-password">
+ <T>Password:</T>
+ </label>
+ <Input
+ id="docker-reg-password"
+ type="password"
+ value={password}
+ placeholder={existing ? "Unchanged" : "Password or access token"}
+ onChange={(e) => setPassword(e.target.value)}
+ />
+ <span className={styles.hint}>
+ <T>Images from this registry are pulled with these credentials.</T>
+ </span>
+ </form>
+ </Dialog>
+ );
+}
diff --git a/src/features/services/docker.tsx b/src/features/services/docker.tsx
new file mode 100644
index 000000000..52442d216
--- /dev/null
+++ b/src/features/services/docker.tsx
@@ -0,0 +1,528 @@
+/**
+ * Docker as a Services tree provider: one root per connection (containers
+ * grouped by Compose project, images, volumes, networks) and one per registry;
+ * log / inspect of the selection in the detail pane.
+ */
+import { useEffect, useMemo, useRef, useState } from "react";
+import clsx from "clsx";
+import { Channel } from "@tauri-apps/api/core";
+import type {
+ DockerAvailability,
+ DockerConnection,
+ DockerEndpoint,
+ DockerLogLine,
+ DockerObject,
+ DockerRegistry,
+} from "@/platform/ipc";
+import { useTx, useTxTemplate } from "@/platform/i18n";
+import { call, commands, isCancelled, nextRequestId } from "@/platform/ipc";
+import { Button, EmptyState, IconButton, Spinner, Tabs, Toggle, T } from "@/ui";
+import type { MenuItem } from "@/ui";
+import {
+ notifications,
+ type ServiceItemAction,
+ type ServiceProviderContribution,
+ type ServiceTreeItem,
+} from "@/workbench/contributions";
+import { confirm } from "@/workbench/messages";
+import { openConnectionDialog, openRegistryDialog } from "./dialogs";
+import {
+ DOCKER_KEY,
+ childrenOf,
+ connectionKey,
+ findNode,
+ isRunning,
+ nodeDetail,
+ nodeIcon,
+ nodeLabel,
+ parseTreeKey,
+ registryKey,
+ rootNodes,
+ treeKey,
+ type DockerTarget,
+ type ServiceNode,
+} from "./model";
+import {
+ canRemove,
+ canRestart,
+ canStart,
+ canStop,
+ execShell,
+ nodeMenu,
+ pullPrompt,
+ remove,
+ restart,
+ start,
+ stop,
+} from "./ops";
+import {
+ cancelTask,
+ connectionState,
+ endpointOf,
+ errorMessage,
+ refresh,
+ removeConnection,
+ removeRegistry,
+ testRegistryLogin,
+ useServices,
+ watch,
+ type ConnectionState,
+} from "./store";
+import { useServicesTree } from "./tree";
+import styles from "./Services.module.css";
+
+export const DOCKER_PROVIDER = "docker";
+const REGISTRY_PREFIX = "docker-registry:";
+
+function endpointText(ep: DockerEndpoint): string {
+ switch (ep.kind) {
+ case "default":
+ return "Docker CLI default";
+ case "socket":
+ return ep.path;
+ case "tcp":
+ return ep.tlsCertDir ? `${ep.host} (TLS)` : ep.host;
+ case "context":
+ return `context ${ep.name}`;
+ }
+}
+
+function connectionDetail(state: ConnectionState): string | undefined {
+ const a = state.snapshot?.availability;
+ if (!a) return state.error ?? (state.loading ? "connecting…" : undefined);
+ if (a.kind === "notInstalled") return "docker not installed";
+ if (a.kind === "daemonDown") return "not running";
+ return a.context ?? undefined;
+}
+
+/** The Docker part of the Services tree. */
+export function dockerItems(
+ connections: readonly DockerConnection[],
+ registries: readonly DockerRegistry[],
+ conns: Record<string, ConnectionState>,
+): ServiceTreeItem[] {
+ const items: ServiceTreeItem[] = connections.map((c) => {
+ const state = conns[c.id] ?? { snapshot: null, loading: false, error: null };
+ const snap = state.snapshot;
+ const children = childrenOf(snap);
+ const convert = (n: ServiceNode): ServiceTreeItem => {
+ const kids = children(n);
+ return {
+ key: treeKey(c.id, n),
+ label: nodeLabel(n),
+ icon: nodeIcon(n),
+ detail: nodeDetail(n),
+ dim: n.kind === "container" && !isRunning(n.container),
+ children: kids?.map(convert),
+ };
+ };
+ const root = rootNodes()[0]!;
+ return {
+ key: connectionKey(c.id),
+ label: c.name,
+ icon: "file-docker",
+ detail: connectionDetail(state),
+ dim: snap?.availability.kind !== "ready",
+ children: children(root)?.map(convert) ?? [],
+ };
+ });
+ for (const r of registries) items.push({ key: registryKey(r.id), label: r.name, icon: "package", detail: r.address });
+ return items;
+}
+
+/** The connection node a tree key stands for. */
+export function resolveTarget(key: string | null): DockerTarget | null {
+ const parsed = key ? parseTreeKey(key) : null;
+ if (!parsed) return null;
+ if (parsed.local === DOCKER_KEY) return { conn: parsed.conn, node: rootNodes()[0]! };
+ const node = findNode(connectionState(parsed.conn).snapshot, parsed.local);
+ return node ? { conn: parsed.conn, node } : null;
+}
+
+const registryOf = (key: string | null) =>
+ key?.startsWith(REGISTRY_PREFIX)
+ ? (useServices.getState().settings?.registries.find((r) => registryKey(r.id) === key) ?? null)
+ : null;
+
+const connectionOf = (id: string) => useServices.getState().settings?.connections.find((c) => c.id === id) ?? null;
+
+/** The selected Docker node (for the `docker.*` actions). */
+export const selectedTarget = () => resolveTarget(useServicesTree.getState().selectedKey);
+
+async function testLogin(r: DockerRegistry) {
+ try {
+ const answer = await testRegistryLogin(r, null);
+ notifications().notify({ group: "run", level: "info", title: `${r.name}: ${answer}`, key: "docker-login" });
+ } catch (e) {
+ notifications().notify({
+ group: "run",
+ level: "error",
+ title: `Cannot log in to ${r.name}`,
+ body: errorMessage(e),
+ key: "docker-login",
+ });
+ }
+}
+
+async function removeConnectionPrompt(c: DockerConnection) {
+ if (
+ await confirm({
+ title: "Remove Docker Connection",
+ message: `Remove the connection '${c.name}' from Services?`,
+ ok: "Remove",
+ })
+ )
+ await removeConnection(c.id);
+}
+
+async function removeRegistryPrompt(r: DockerRegistry) {
+ if (
+ await confirm({
+ title: "Remove Docker Registry",
+ message: `Remove the registry '${r.name}' and its saved password?`,
+ ok: "Remove",
+ })
+ )
+ await removeRegistry(r.id);
+}
+
+function actions(item: ServiceTreeItem): ServiceItemAction[] {
+ if (item.key.startsWith(REGISTRY_PREFIX)) return [];
+ const t = resolveTarget(item.key);
+ if (!t) return [];
+ const container = t.node.kind === "container" ? t.node.container : null;
+ return [
+ { id: "refresh", title: "Refresh", icon: "refresh", run: () => void refresh(t.conn) },
+ { id: "start", title: "Start", icon: "run", disabled: !canStart(t), run: () => void start(t) },
+ { id: "stop", title: "Stop", icon: "stop", disabled: !canStop(t), run: () => void stop(t) },
+ { id: "restart", title: "Restart", icon: "rerun", disabled: !canRestart(t), run: () => void restart(t) },
+ { id: "delete", title: "Delete", icon: "trash", disabled: !canRemove(t), run: () => void remove(t) },
+ {
+ id: "terminal",
+ title: "Create Terminal",
+ icon: "terminal",
+ disabled: !container || !isRunning(container),
+ run: () => execShell(t),
+ },
+ { id: "pull", title: "Pull Image…", icon: "git-pull", run: () => void pullPrompt(t.conn) },
+ ];
+}
+
+function menu(item: ServiceTreeItem): MenuItem[] {
+ const r = registryOf(item.key);
+ if (r)
+ return [
+ { label: "Edit Registry…", icon: "edit", run: () => openRegistryDialog(r) },
+ { label: "Test Login", run: () => void testLogin(r) },
+ { kind: "separator" },
+ { label: "Remove Registry", icon: "trash", danger: true, run: () => void removeRegistryPrompt(r) },
+ ];
+ const t = resolveTarget(item.key);
+ if (!t) return [];
+ const items = nodeMenu(t);
+ const c = t.node.kind === "docker" ? connectionOf(t.conn) : null;
+ if (c)
+ items.push(
+ { kind: "separator" },
+ { label: "Edit Connection…", icon: "edit", run: () => openConnectionDialog(c) },
+ { label: "Remove Connection", icon: "trash", danger: true, run: () => void removeConnectionPrompt(c) },
+ );
+ return items;
+}
+
+// ---------------------------------------------------------------------------
+// Detail pane
+
+/** Status instead of the tree when docker cannot be used. */
+function Unavailable({ availability, conn }: { availability: DockerAvailability; conn: string }) {
+ if (availability.kind === "notInstalled")
+ return (
+ <EmptyState title="Docker is not installed">
+ <T>Install Docker Desktop, OrbStack, Colima or the Docker Engine and make sure</T> <code>docker</code>{" "}
+ <T>is on PATH.</T>
+ </EmptyState>
+ );
+ if (availability.kind === "daemonDown")
+ return (
+ <EmptyState
+ title="Docker is not running"
+ actions={<IconButton icon="refresh" title="Retry" onClick={() => void refresh(conn)} />}
+ >
+ <div>{availability.message}</div>
+ <div className={styles.hint}>
+ Start Docker{availability.context ? ` (context '${availability.context}')` : ""}; this view connects
+ automatically.
+ </div>
+ </EmptyState>
+ );
+ return null;
+}
+
+export function DockerTaskBanner() {
+ const task = useServices((s) => s.task);
+ const txTemplate = useTxTemplate();
+ if (!task) return null;
+ return (
+ <div className={styles.banner} role="status">
+ <Spinner size={12} />
+ <span className={styles.bannerTitle}>{txTemplate(task.title)}</span>
+ <span className={styles.bannerText}>{task.line}</span>
+ <IconButton icon="close" size="small" title="Cancel" onClick={cancelTask} />
+ </div>
+ );
+}
+
+const ANSI = /\x1b\[[0-9;?]*[A-Za-z]/g; // eslint-disable-line no-control-regex
+const MAX_LINES = 5000;
+
+/** Follows a container's log while shown. */
+function LogView({ conn, id, running }: { conn: string; id: string; running: boolean }) {
+ const [timestamps, setTimestamps] = useState(false);
+ const [wrap, setWrap] = useState(true);
+ // A new stream (and buffer) per option set.
+ return (
+ <LogStream
+ key={`${running}:${timestamps}`}
+ endpoint={endpointOf(conn)}
+ id={id}
+ running={running}
+ timestamps={timestamps}
+ setTimestamps={setTimestamps}
+ wrap={wrap}
+ setWrap={setWrap}
+ />
+ );
+}
+
+function LogStream(props: {
+ endpoint: DockerEndpoint;
+ id: string;
+ running: boolean;
+ timestamps: boolean;
+ setTimestamps: (v: boolean) => void;
+ wrap: boolean;
+ setWrap: (v: boolean) => void;
+}) {
+ const tx = useTx();
+ const { endpoint, id, running, timestamps, setTimestamps, wrap, setWrap } = props;
+ const [lines, setLines] = useState<DockerLogLine[]>([]);
+ const [error, setError] = useState<string | null>(null);
+ const scroller = useRef<HTMLDivElement>(null);
+ const stick = useRef(true);
+ const ep = useRef(endpoint);
+
+ useEffect(() => {
+ const request = nextRequestId();
+ const channel = new Channel<DockerLogLine>();
+ let buffer: DockerLogLine[] = [];
+ let frame = 0;
+ const flush = () => {
+ frame = 0;
+ const add = buffer;
+ buffer = [];
+ setLines((prev) => {
+ const next = prev.concat(add);
+ return next.length > MAX_LINES ? next.slice(next.length - MAX_LINES) : next;
+ });
+ };
+ channel.onmessage = (line) => {
+ buffer.push({ stderr: line.stderr, text: line.text.replace(ANSI, "") });
+ frame ||= requestAnimationFrame(flush);
+ };
+ call(commands.dockerLogs(request, ep.current, id, 1000, running, timestamps, channel)).catch((e) => {
+ if (!isCancelled(e)) setError(errorMessage(e));
+ });
+ return () => {
+ cancelAnimationFrame(frame);
+ void commands.cancelRequest(request);
+ };
+ }, [id, running, timestamps]);
+
+ useEffect(() => {
+ const el = scroller.current;
+ if (el && stick.current) el.scrollTop = el.scrollHeight;
+ }, [lines]);
+
+ return (
+ <div className={styles.detailBody}>
+ <div className={styles.subToolbar}>
+ <Toggle checked={timestamps} onChange={setTimestamps} label="Timestamps" />
+ <Toggle checked={wrap} onChange={setWrap} label="Soft-wrap" />
+ <span className={styles.flex} />
+ <IconButton icon="trash" size="small" title="Clear" onClick={() => setLines([])} />
+ </div>
+ <div
+ ref={scroller}
+ className={clsx(styles.log, wrap && styles.wrap)}
+ role="log"
+ aria-label={tx("Container log")}
+ onScroll={(e) => {
+ const el = e.currentTarget;
+ stick.current = el.scrollHeight - el.scrollTop - el.clientHeight < 24;
+ }}
+ >
+ {lines.map((l, i) => (
+ <div key={i} className={clsx(l.stderr && styles.stderr)}>
+ {l.text || " "}
+ </div>
+ ))}
+ {error && <div className={styles.stderr}>{error}</div>}
+ {!lines.length && !error && <div className={styles.dim}>{tx(running ? "Waiting for output…" : "No output")}</div>}
+ </div>
+ </div>
+ );
+}
+
+function InspectView({ conn, object, id }: { conn: string; object: DockerObject; id: string }) {
+ const tx = useTx();
+ const [text, setText] = useState<string | null>(null);
+ const [error, setError] = useState<string | null>(null);
+ useEffect(() => {
+ let alive = true;
+ call(commands.dockerInspect(endpointOf(conn), object, id))
+ .then((t) => alive && setText(t))
+ .catch((e) => alive && setError(errorMessage(e)));
+ return () => {
+ alive = false;
+ };
+ }, [conn, object, id]);
+ return (
+ <div className={styles.detailBody}>
+ <pre className={clsx(styles.log, styles.json)} aria-label={tx("Inspect")}>
+ {error ?? text ?? tx("Loading…")}
+ </pre>
+ </div>
+ );
+}
+
+function RegistryDetail({ registry }: { registry: DockerRegistry }) {
+ return (
+ <div className={styles.detailPane}>
+ <dl className={styles.facts}>
+ <dt>
+ <T>Name</T>
+ </dt>
+ <dd>{registry.name}</dd>
+ <dt>
+ <T>Address</T>
+ </dt>
+ <dd>{registry.address}</dd>
+ <dt>
+ <T>Username</T>
+ </dt>
+ <dd>{registry.username || "—"}</dd>
+ </dl>
+ <div className={styles.detailActions}>
+ <Button onClick={() => openRegistryDialog(registry)}>Edit…</Button>
+ <Button disabled={!registry.username} onClick={() => void testLogin(registry)}>
+ Test Login
+ </Button>
+ </div>
+ </div>
+ );
+}
+
+function DockerDetail({ item }: { item: ServiceTreeItem }) {
+ const txTemplate = useTxTemplate();
+ const tab = useServices((s) => s.detailTab);
+ const settings = useServices((s) => s.settings);
+ const parsed = parseTreeKey(item.key);
+ const state = useServices((s) => (parsed ? connectionState(parsed.conn, s) : null));
+ const target = resolveTarget(item.key);
+ const registry = settings?.registries.find((r) => registryKey(r.id) === item.key);
+ if (registry) return <RegistryDetail registry={registry} />;
+ if (!target || !parsed || !state) return <EmptyState title="Select service to view details" />;
+ const conn = connectionOf(parsed.conn);
+ const node = target.node;
+ const snapshot = state.snapshot;
+ if (!snapshot)
+ return (
+ <div className={styles.loading}>
+ {state.error ?? (
+ <>
+ <Spinner size={14} /> <T>Connecting to Docker…</T>
+ </>
+ )}
+ </div>
+ );
+ if (snapshot.availability.kind !== "ready")
+ return <Unavailable availability={snapshot.availability} conn={parsed.conn} />;
+ if (node.kind === "docker" || node.kind === "group" || node.kind === "compose") {
+ const a = snapshot.availability;
+ return (
+ <div className={styles.detailPane}>
+ {snapshot.errors.length > 0 && (
+ <div className={clsx(styles.banner, styles.warning)}>
+ <span className={styles.bannerText}>{snapshot.errors.join("; ")}</span>
+ </div>
+ )}
+ <EmptyState title={node.kind === "compose" ? txTemplate(`Compose project '${node.project}'`) : (conn?.name ?? "Docker")}>
+ <div>
+ {txTemplate(`Engine ${a.serverVersion} · CLI ${a.clientVersion}`)}
+ {a.context ? txTemplate(` · context ${a.context}`) : ""}
+ </div>
+ {conn && <div className={styles.hint}>{endpointText(conn.endpoint)}</div>}
+ <div className={styles.hint}>
+ <T>Select a container, image, volume or network.</T>
+ </div>
+ </EmptyState>
+ </div>
+ );
+ }
+ const object: DockerObject = node.kind;
+ const id =
+ node.kind === "container"
+ ? node.container.id
+ : node.kind === "image"
+ ? node.image.id
+ : node.kind === "volume"
+ ? node.volume.name
+ : node.network.id;
+ const showLog = node.kind === "container" && tab === "log";
+ return (
+ <div className={styles.detailPane}>
+ <Tabs
+ variant="compact"
+ activeId={showLog ? "log" : "inspect"}
+ onSelect={(t) => useServices.setState({ detailTab: t as "log" | "inspect" })}
+ aria-label="Details"
+ items={[
+ ...(node.kind === "container" ? [{ id: "log", label: "Log" }] : []),
+ { id: "inspect", label: "Inspect" },
+ ]}
+ />
+ {showLog ? (
+ <LogView key={id} conn={parsed.conn} id={id} running={isRunning(node.container)} />
+ ) : (
+ <InspectView key={id} conn={parsed.conn} object={object} id={id} />
+ )}
+ </div>
+ );
+}
+
+function useRoots(): ServiceTreeItem[] {
+ const settings = useServices((s) => s.settings);
+ const conns = useServices((s) => s.conns);
+ return useMemo(() => dockerItems(settings?.connections ?? [], settings?.registries ?? [], conns), [settings, conns]);
+}
+
+export const dockerProvider: ServiceProviderContribution = {
+ id: DOCKER_PROVIDER,
+ order: 10,
+ useRoots,
+ watch,
+ actions,
+ menu,
+ activate: (item) => {
+ const t = resolveTarget(item.key);
+ if (t?.node.kind === "container") useServices.setState({ detailTab: "log" });
+ const r = registryOf(item.key);
+ if (r) openRegistryDialog(r);
+ },
+ detail: DockerDetail,
+ banner: DockerTaskBanner,
+ addMenu: () => [
+ { label: "Docker Registry…", icon: "package", run: () => openRegistryDialog() },
+ { label: "Docker Connection…", icon: "file-docker", run: () => openConnectionDialog() },
+ ],
+};
diff --git a/src/features/services/dockerGutter.ts b/src/features/services/dockerGutter.ts
index 6b1a60ea6..b95161df4 100644
--- a/src/features/services/dockerGutter.ts
+++ b/src/features/services/dockerGutter.ts
@@ -1,7 +1,7 @@
/**
- * Gutter ▶ icons in Dockerfiles (`FROM` → build image) and Compose files
- * (`services:` → up all / down, each service → up it). They start temporary run
- * configurations through `run.runConfig`, so output lands in the Run tool window.
+ * Gutter ▶ icons in Dockerfiles (`FROM` → run / build the image) and Compose
+ * files (`services:` → up all, each service → up it). As in IDEA they start
+ * temporary Dockerfile / Docker Compose run configurations through `run.runConfig`.
*/
import { RangeSet, StateEffect, StateField, type EditorState, type Extension } from "@codemirror/state";
import { EditorView, GutterMarker, ViewPlugin, gutter, type ViewUpdate } from "@codemirror/view";
@@ -9,8 +9,8 @@ import type { EditorDocContext } from "@/editor/api";
import { executeAction } from "@/platform/actions";
import { useProject } from "@/platform/project";
import { iconMarkup, showContextMenu, type MenuItem } from "@/ui";
-import { composeDownConfig, fileTargets, isComposeFile, isDockerfile, targetConfig, targetTitle, type DockerTarget } from "./compose";
-import { useServices } from "./store";
+import { fileTargets, isComposeFile, isDockerfile, targetTitle, type DockerTarget } from "./compose";
+import { gutterActions } from "./runTypes";
import styles from "./Services.module.css";
interface Placed {
@@ -35,16 +35,13 @@ function place(state: EditorState, path: string): Placed[] {
.map((target) => ({ target, pos: state.doc.line(target.line + 1).from }));
}
-function run(config: ReturnType<typeof targetConfig>) {
- void executeAction("run.runConfig", { config, temporary: true });
-}
-
function menu(target: DockerTarget, path: string): MenuItem[] {
const root = useProject.getState().project?.root ?? null;
- const docker = useServices.getState().snapshot?.executable ?? "docker";
- const items: MenuItem[] = [{ label: targetTitle(target, path), icon: "run", run: () => run(targetConfig(target, path, root, docker)) }];
- if (target.kind === "composeAll") items.push({ label: "Compose Down", icon: "stop", run: () => run(composeDownConfig(path, root, docker)) });
- return items;
+ return gutterActions(target, path, root).map(({ title, config }, i) => ({
+ label: title,
+ icon: i === 0 ? "run" : "build-project",
+ run: () => void executeAction("run.runConfig", { config, temporary: true }),
+ }));
}
class Marker extends GutterMarker {
diff --git a/src/features/services/index.ts b/src/features/services/index.ts
index cf1057c8a..5c4bf7f0c 100644
--- a/src/features/services/index.ts
+++ b/src/features/services/index.ts
@@ -1,29 +1,40 @@
/**
- * Services tool window (⌘8) with Docker: containers grouped by Compose project,
- * images, volumes and networks, kept live by `docker events`; lifecycle, logs,
- * inspect, a shell in a terminal tab, pull and prune. Dockerfiles and Compose
- * files get gutter run icons that start run configurations.
+ * Services tool window (⌘8): a tree of the services providers contribute
+ * (IDEA's Services view), with "Add Service" (+, ⌘N). Docker is one provider:
+ * connections (local socket, TCP / SSH host with TLS, a docker context) with
+ * containers grouped by Compose project, images, volumes and networks, kept live
+ * by `docker events`; lifecycle, logs, inspect, a shell in a terminal tab, pull
+ * (logging in to saved registries) and prune. Dockerfile, Docker Image and Docker
+ * Compose run configuration types; Dockerfiles and Compose files get gutter run
+ * icons that start them.
*/
import { registerActions } from "@/platform/actions";
import { registerEditorContribution } from "@/editor/api";
import {
SERVICES_WINDOW,
registerOverlay,
+ registerServiceProvider,
registerServiceView,
registerToolWindow,
showServiceView,
} from "@/workbench/contributions";
import { dockerGutter } from "./dockerGutter";
+import { registerDockerRunTypes } from "./runTypes";
import { ServicesDialogHost } from "./dialogs";
-import { canRemove, canStart, canStop, execShell, pullPrompt, prunePrompt, remove, restart, selected, showDetail, start, stop, DOCKER_VIEW } from "./ops";
-import { ServicesView } from "./ServicesView";
+import { dockerProvider, selectedTarget } from "./docker";
+import { canRemove, canStart, canStop, execShell, pullPrompt, prunePrompt, remove, restart, showDetail, start, stop } from "./ops";
+import { SERVICES_VIEW_FOCUS, ServicesTreeView, showAddServiceMenu } from "./ServicesTree";
import { ServicesHeaderActions, ServicesHost, ServicesTabs } from "./ServicesHost";
-import { refresh } from "./store";
+import { connections, refresh } from "./store";
+import { SERVICES_TREE_VIEW } from "./tree";
import { isRunning } from "./model";
import type { PruneTarget } from "@/platform/ipc";
const PROJECT = "projectOpen";
+/** The connection of the selection, else the first one. */
+const currentConnection = () => selectedTarget()?.conn ?? connections()[0]?.id ?? null;
+
export function activate(): () => void {
const disposers = [
registerToolWindow({
@@ -37,9 +48,11 @@ export function activate(): () => void {
headerContent: ServicesTabs,
headerActions: ServicesHeaderActions,
}),
- registerServiceView({ id: DOCKER_VIEW, title: "Docker", icon: "file-docker", order: 0, component: ServicesView }),
+ registerServiceView({ id: SERVICES_TREE_VIEW, title: "Services", icon: "toolwindow-services", order: 0, component: ServicesTreeView }),
+ registerServiceProvider(dockerProvider),
registerOverlay({ id: "services.dialogs", component: ServicesDialogHost }),
registerEditorContribution({ id: "services.dockerGutter", order: 56, extensions: dockerGutter }),
+ registerDockerRunTypes(),
registerActions([
{
id: "services.show",
@@ -48,7 +61,21 @@ export function activate(): () => void {
icon: "toolwindow-services",
when: PROJECT,
hidden: true,
- run: () => showServiceView(DOCKER_VIEW, true),
+ run: () => showServiceView(SERVICES_TREE_VIEW, true),
+ },
+ {
+ id: "services.addService",
+ title: "Add Service",
+ description: "Add a run configuration type, Docker connection or registry to the Services tool window",
+ category: "Services",
+ icon: "plus",
+ when: PROJECT,
+ keyWhen: SERVICES_VIEW_FOCUS,
+ keywords: ["docker connection", "docker registry", "run configuration type"],
+ run: () => {
+ showServiceView(SERVICES_TREE_VIEW, true);
+ requestAnimationFrame(() => showAddServiceMenu());
+ },
},
{ id: "docker.refresh", title: "Refresh Docker", category: "Docker", icon: "refresh", when: PROJECT, run: () => refresh() },
{
@@ -57,7 +84,7 @@ export function activate(): () => void {
category: "Docker",
icon: "run",
when: PROJECT,
- run: () => (canStart(selected()) ? start(selected()) : undefined),
+ run: () => (canStart(selectedTarget()) ? start(selectedTarget()) : undefined),
},
{
id: "docker.stop",
@@ -65,25 +92,38 @@ export function activate(): () => void {
category: "Docker",
icon: "stop",
when: PROJECT,
- run: () => (canStop(selected()) ? stop(selected()) : undefined),
+ run: () => (canStop(selectedTarget()) ? stop(selectedTarget()) : undefined),
},
- { id: "docker.restart", title: "Restart Container", category: "Docker", icon: "rerun", when: PROJECT, run: () => restart(selected()) },
+ { id: "docker.restart", title: "Restart Container", category: "Docker", icon: "rerun", when: PROJECT, run: () => restart(selectedTarget()) },
{
id: "docker.remove",
title: "Delete Docker Object…",
category: "Docker",
icon: "trash",
when: PROJECT,
- run: () => (canRemove(selected()) ? remove(selected()) : undefined),
+ run: () => (canRemove(selectedTarget()) ? remove(selectedTarget()) : undefined),
},
{
id: "docker.showLog",
title: "Show Container Log",
category: "Docker",
when: PROJECT,
- run: () => showDetail("log"),
+ run: () => {
+ showDetail("log");
+ showServiceView(SERVICES_TREE_VIEW, true);
+ },
+ },
+ {
+ id: "docker.inspect",
+ title: "Inspect Docker Object",
+ category: "Docker",
+ icon: "info",
+ when: PROJECT,
+ run: () => {
+ showDetail("inspect");
+ showServiceView(SERVICES_TREE_VIEW, true);
+ },
},
- { id: "docker.inspect", title: "Inspect Docker Object", category: "Docker", icon: "info", when: PROJECT, run: () => showDetail("inspect") },
{
id: "docker.execShell",
title: "Create Terminal in Container",
@@ -92,11 +132,21 @@ export function activate(): () => void {
keywords: ["exec", "shell", "attach"],
when: PROJECT,
run: () => {
- const n = selected();
- if (n?.kind === "container" && isRunning(n.container)) execShell(n);
+ const t = selectedTarget();
+ if (t?.node.kind === "container" && isRunning(t.node.container)) execShell(t);
+ },
+ },
+ {
+ id: "docker.pullImage",
+ title: "Pull Docker Image…",
+ category: "Docker",
+ icon: "git-pull",
+ when: PROJECT,
+ run: () => {
+ const conn = currentConnection();
+ return conn ? pullPrompt(conn) : undefined;
},
},
- { id: "docker.pullImage", title: "Pull Docker Image…", category: "Docker", icon: "git-pull", when: PROJECT, run: () => pullPrompt() },
{
id: "docker.prune",
title: "Prune Docker…",
@@ -105,7 +155,10 @@ export function activate(): () => void {
icon: "trash",
keywords: ["clean", "system prune"],
when: PROJECT,
- run: ({ arg }) => prunePrompt(typeof arg === "string" ? (arg as PruneTarget) : "system"),
+ run: ({ arg }) => {
+ const conn = currentConnection();
+ return conn ? prunePrompt(conn, typeof arg === "string" ? (arg as PruneTarget) : "system") : undefined;
+ },
},
]),
];
diff --git a/src/features/services/model.ts b/src/features/services/model.ts
index 3e31680ec..9d527b384 100644
--- a/src/features/services/model.ts
+++ b/src/features/services/model.ts
@@ -170,3 +170,28 @@ export function findNode(snap: DockerSnapshot | null, key: string | null): Servi
};
return walk(rootNodes());
}
+
+// ---------------------------------------------------------------------------
+// Keys in the Services tree: every connection has its own subtree.
+
+/** A node of one connection's subtree. */
+export interface DockerTarget {
+ conn: string;
+ node: ServiceNode;
+}
+
+export const connectionKey = (conn: string) => `docker:${conn}`;
+export const registryKey = (id: string) => `docker-registry:${id}`;
+
+/** The tree key of `node` (whose key is local to its snapshot) under connection `conn`. */
+export function treeKey(conn: string, node: ServiceNode): string {
+ return node.kind === "docker" ? connectionKey(conn) : `${connectionKey(conn)}:${node.key}`;
+}
+
+/** Splits a tree key into connection id and local node key. */
+export function parseTreeKey(key: string): { conn: string; local: string } | null {
+ if (!key.startsWith("docker:")) return null;
+ const rest = key.slice("docker:".length);
+ const i = rest.indexOf(":");
+ return i < 0 ? { conn: rest, local: DOCKER_KEY } : { conn: rest.slice(0, i), local: rest.slice(i + 1) };
+}
diff --git a/src/features/services/ops.ts b/src/features/services/ops.ts
index 46aa3ec16..4f358b416 100644
--- a/src/features/services/ops.ts
+++ b/src/features/services/ops.ts
@@ -1,53 +1,55 @@
-/** What the Services toolbar, context menu and `docker.*` actions do with a node. */
+/** What the Services toolbar, context menu and `docker.*` actions do with a node of a connection. */
+import { txTemplate } from "@/platform/i18n";
import type { PruneTarget } from "@/platform/ipc";
import { executeAction } from "@/platform/actions";
-import { showServiceView } from "@/workbench/contributions";
import type { MenuItem } from "@/ui";
import { confirm, confirmChecked } from "@/workbench/messages";
import { promptText } from "./dialogs";
-import { isRunning, nodeContainers, nodeLabel, shortId, type ServiceNode } from "./model";
-import { composeOp, containerOp, prune, pullImage, refresh, removeObjects, selectedNode, useServices } from "./store";
+import { isRunning, nodeContainers, nodeLabel, shortId, type DockerTarget, type ServiceNode } from "./model";
+import { composeOp, connectionState, containerOp, prune, pullImage, refresh, removeObjects, useServices } from "./store";
-export const DOCKER_VIEW = "docker";
-
-export function canStart(n: ServiceNode | null): boolean {
- return !!n && nodeContainers(n).some((c) => !isRunning(c));
+export function canStart(t: DockerTarget | null): boolean {
+ return !!t && nodeContainers(t.node).some((c) => !isRunning(c));
+}
+export function canStop(t: DockerTarget | null): boolean {
+ return !!t && nodeContainers(t.node).some(isRunning);
}
-export function canStop(n: ServiceNode | null): boolean {
- return !!n && nodeContainers(n).some(isRunning);
+export function canRestart(t: DockerTarget | null): boolean {
+ return !!t && (t.node.kind === "container" || t.node.kind === "compose");
}
-export function canRemove(n: ServiceNode | null): boolean {
- return !!n && ["container", "compose", "image", "volume", "network"].includes(n.kind);
+export function canRemove(t: DockerTarget | null): boolean {
+ return !!t && ["container", "compose", "image", "volume", "network"].includes(t.node.kind);
}
-export async function start(n: ServiceNode | null) {
- if (!n) return;
- if (n.kind === "compose") return composeAction(n, "start");
- const ids = nodeContainers(n).filter((c) => !isRunning(c)).map((c) => c.id);
- if (ids.length) await containerOp(ids, "start");
+export async function start(t: DockerTarget | null) {
+ if (!t) return;
+ if (t.node.kind === "compose") return composeAction(t.conn, t.node, "start");
+ const ids = nodeContainers(t.node).filter((c) => !isRunning(c)).map((c) => c.id);
+ if (ids.length) await containerOp(t.conn, ids, "start");
}
-export async function stop(n: ServiceNode | null) {
- if (!n) return;
- if (n.kind === "compose") return composeAction(n, "stop");
- const ids = nodeContainers(n).filter(isRunning).map((c) => c.id);
- if (ids.length) await containerOp(ids, "stop");
+export async function stop(t: DockerTarget | null) {
+ if (!t) return;
+ if (t.node.kind === "compose") return composeAction(t.conn, t.node, "stop");
+ const ids = nodeContainers(t.node).filter(isRunning).map((c) => c.id);
+ if (ids.length) await containerOp(t.conn, ids, "stop");
}
-export async function restart(n: ServiceNode | null) {
- if (!n) return;
- if (n.kind === "compose") return composeAction(n, "restart");
- const ids = nodeContainers(n).map((c) => c.id);
- if (ids.length) await containerOp(ids, "restart");
+export async function restart(t: DockerTarget | null) {
+ if (!t) return;
+ if (t.node.kind === "compose") return composeAction(t.conn, t.node, "restart");
+ const ids = nodeContainers(t.node).map((c) => c.id);
+ if (ids.length) await containerOp(t.conn, ids, "restart");
}
-function composeAction(n: Extract<ServiceNode, { kind: "compose" }>, op: "start" | "stop" | "restart" | "down") {
+function composeAction(conn: string, n: Extract<ServiceNode, { kind: "compose" }>, op: "start" | "stop" | "restart" | "down") {
const first = n.containers[0];
- return composeOp(n.project, first?.composeFiles ?? [], first?.composeWorkingDir ?? null, op).then(() => undefined);
+ return composeOp(conn, n.project, first?.composeFiles ?? [], first?.composeWorkingDir ?? null, op).then(() => undefined);
}
-export async function remove(n: ServiceNode | null) {
- if (!n || !canRemove(n)) return;
+export async function remove(t: DockerTarget | null) {
+ if (!t || !canRemove(t)) return;
+ const n = t.node;
const label = nodeLabel(n);
if (n.kind === "compose") {
const ok = await confirm({
@@ -55,7 +57,7 @@ export async function remove(n: ServiceNode | null) {
message: `Stop and remove the containers and networks of '${label}'?`,
ok: "Down",
});
- if (ok) await composeAction(n, "down");
+ if (ok) await composeAction(t.conn, n, "down");
return;
}
if (n.kind !== "container" && n.kind !== "image" && n.kind !== "volume" && n.kind !== "network") return;
@@ -69,29 +71,24 @@ export async function remove(n: ServiceNode | null) {
});
if (!answer) return;
const id = n.kind === "container" ? n.container.id : n.kind === "image" ? n.image.id : n.kind === "volume" ? n.volume.name : n.network.id;
- await removeObjects(what, [id], running || answer.checked);
+ await removeObjects(t.conn, what, [id], running || answer.checked);
}
/** Opens a terminal tab with a shell in the container (bash when present, else sh). */
-export function execShell(n: ServiceNode | null) {
- const c = n?.kind === "container" ? n.container : null;
- if (!c || !isRunning(c)) return;
- const docker = useServices.getState().snapshot?.executable ?? "docker";
+export function execShell(t: DockerTarget | null) {
+ const c = t?.node.kind === "container" ? t.node.container : null;
+ if (!t || !c || !isRunning(c)) return;
+ const snap = connectionState(t.conn).snapshot;
void executeAction("terminal.runCommand", {
- program: docker,
- args: ["exec", "-it", c.id, "sh", "-c", "command -v bash >/dev/null 2>&1 && exec bash || exec sh"],
+ program: snap?.executable ?? "docker",
+ args: [...(snap?.globalArgs ?? []), "exec", "-it", c.id, "sh", "-c", "command -v bash >/dev/null 2>&1 && exec bash || exec sh"],
name: c.name,
});
}
-export function showDetail(tab: "log" | "inspect") {
- useServices.setState({ detailTab: tab });
- showServiceView(DOCKER_VIEW, true);
-}
-
-export async function pullPrompt() {
+export async function pullPrompt(conn: string) {
const ref = await promptText("Pull Image", "Image to pull:", "e.g. postgres:16 or ghcr.io/org/app:latest");
- if (ref) await pullImage(ref);
+ if (ref) await pullImage(conn, ref);
}
const PRUNE: Array<[PruneTarget, string, string]> = [
@@ -103,39 +100,44 @@ const PRUNE: Array<[PruneTarget, string, string]> = [
["system", "Everything Unused (System Prune)", "Remove stopped containers, unused networks, dangling images and the build cache?"],
];
-export async function prunePrompt(target: PruneTarget) {
+export async function prunePrompt(conn: string, target: PruneTarget) {
const entry = PRUNE.find(([t]) => t === target);
if (!entry) return;
- const ok = await confirm({ title: `Prune ${entry[1]}`, message: entry[2], ok: "Prune" });
- if (ok) await prune(target);
+ const ok = await confirm({ title: txTemplate(`Prune ${entry[1]}`), message: entry[2], ok: "Prune" });
+ if (ok) await prune(conn, target);
}
-export function pruneMenu(): MenuItem[] {
- return PRUNE.map(([target, label]) => ({ label, run: () => void prunePrompt(target) }));
+export function pruneMenu(conn: string): MenuItem[] {
+ return PRUNE.map(([target, label]) => ({ label, run: () => void prunePrompt(conn, target) }));
}
const copy = (text: string) => void navigator.clipboard?.writeText(text);
-/** Context menu of a tree node. */
-export function nodeMenu(n: ServiceNode): MenuItem[] {
+export function showDetail(tab: "log" | "inspect") {
+ useServices.setState({ detailTab: tab });
+}
+
+/** Context menu of a node of a connection's subtree. */
+export function nodeMenu(t: DockerTarget): MenuItem[] {
+ const { conn, node: n } = t;
const items: MenuItem[] = [];
if (n.kind === "container" || n.kind === "compose") {
items.push(
- { label: "Start", icon: "run", disabled: !canStart(n), run: () => void start(n) },
- { label: "Stop", icon: "stop", disabled: !canStop(n), run: () => void stop(n) },
- { label: "Restart", icon: "rerun", run: () => void restart(n) },
+ { label: "Start", icon: "run", disabled: !canStart(t), run: () => void start(t) },
+ { label: "Stop", icon: "stop", disabled: !canStop(t), run: () => void stop(t) },
+ { label: "Restart", icon: "rerun", run: () => void restart(t) },
);
}
if (n.kind === "container") {
const running = isRunning(n.container);
items.push(
n.container.state === "paused"
- ? { label: "Unpause", icon: "resume", run: () => void containerOp([n.container.id], "unpause") }
- : { label: "Pause", icon: "pause", disabled: !running, run: () => void containerOp([n.container.id], "pause") },
+ ? { label: "Unpause", icon: "resume", run: () => void containerOp(conn, [n.container.id], "unpause") }
+ : { label: "Pause", icon: "pause", disabled: !running, run: () => void containerOp(conn, [n.container.id], "pause") },
{ kind: "separator" },
{ label: "Show Log", icon: "file-log", run: () => showDetail("log") },
{ label: "Inspect", icon: "info", run: () => showDetail("inspect") },
- { label: "Create Terminal", icon: "terminal", disabled: !running, run: () => execShell(n) },
+ { label: "Create Terminal", icon: "terminal", disabled: !running, run: () => execShell(t) },
{ kind: "separator" },
{ label: "Copy Container ID", icon: "copy", run: () => copy(n.container.id) },
{ label: "Copy Image Name", run: () => copy(n.container.image) },
@@ -145,20 +147,26 @@ export function nodeMenu(n: ServiceNode): MenuItem[] {
items.push({ label: "Inspect", icon: "info", run: () => showDetail("inspect") });
if (n.kind === "image")
items.push(
- { label: "Pull Again", icon: "git-pull", disabled: n.image.repository === "<none>", run: () => void pullImage(nodeLabel(n)) },
+ { label: "Pull Again", icon: "git-pull", disabled: n.image.repository === "<none>", run: () => void pullImage(conn, nodeLabel(n)) },
{ label: "Copy Image ID", icon: "copy", run: () => copy(shortId(n.image.id)) },
);
}
- if (n.kind === "group" && n.group === "images") items.push({ label: "Pull Image…", icon: "git-pull", run: () => void pullPrompt() });
+ if (n.kind === "group" && n.group === "images") items.push({ label: "Pull Image…", icon: "git-pull", run: () => void pullPrompt(conn) });
if (n.kind === "group") {
const target: PruneTarget = n.group === "containers" ? "containers" : n.group === "images" ? "images" : n.group === "volumes" ? "volumes" : "networks";
- items.push({ label: `Prune ${n.group === "images" ? "Dangling Images" : `Unused ${n.group[0]!.toUpperCase()}${n.group.slice(1)}`}…`, run: () => void prunePrompt(target) });
+ items.push({
+ label: txTemplate(`Prune ${n.group === "images" ? "Dangling Images" : `Unused ${n.group[0]!.toUpperCase()}${n.group.slice(1)}`}…`),
+ run: () => void prunePrompt(conn, target),
+ });
}
- if (n.kind === "docker") items.push({ label: "Refresh", icon: "refresh", run: () => void refresh() }, { label: "Prune", submenu: pruneMenu() });
- if (canRemove(n)) {
- items.push({ kind: "separator" }, { label: n.kind === "compose" ? "Compose Down" : "Delete…", icon: "trash", danger: true, run: () => void remove(n) });
+ if (n.kind === "docker")
+ items.push(
+ { label: "Refresh", icon: "refresh", run: () => void refresh(conn) },
+ { label: "Pull Image…", icon: "git-pull", run: () => void pullPrompt(conn) },
+ { label: "Prune", submenu: pruneMenu(conn) },
+ );
+ if (canRemove(t)) {
+ items.push({ kind: "separator" }, { label: n.kind === "compose" ? "Compose Down" : "Delete…", icon: "trash", danger: true, run: () => void remove(t) });
}
return items;
}
-
-export const selected = selectedNode;
diff --git a/src/features/services/runTypes.ts b/src/features/services/runTypes.ts
new file mode 100644
index 000000000..4f2ca0518
--- /dev/null
+++ b/src/features/services/runTypes.ts
@@ -0,0 +1,314 @@
+/**
+ * Docker run configuration types (Add New Configuration › Docker), as in IDEA:
+ * Dockerfile (build the image, then run a container from it), Docker Image (run
+ * a container from an image) and Docker Compose (`up` the selected services).
+ * They launch docker command lines in the Run tool window against the Docker
+ * connection chosen from the Services tool window's connections; Stop stops the
+ * container (`docker stop`) or takes the Compose project down.
+ */
+import { splitCommandLine } from "@/platform/commandLine";
+import { call, commands, type RunConfig } from "@/platform/ipc";
+import { registerRunConfigType, type RunConfigTypeContribution } from "@/workbench/contributions";
+import { imageTag, targetTitle, type DockerTarget } from "./compose";
+import { connections, endpointOf, loadSettings, useServices } from "./store";
+
+export const DOCKERFILE = "docker-dockerfile";
+export const DOCKER_IMAGE = "docker-image";
+export const DOCKER_COMPOSE = "docker-compose";
+
+const GROUP = "Docker";
+const on = (v: string | undefined) => v === "true";
+const isWindows = () => typeof navigator !== "undefined" && /win/i.test(navigator.platform);
+
+/** One word for the platform shell the run executes the line with (`/bin/sh -c` or `cmd /C`). */
+export function shellQuote(word: string, windows = isWindows()): string {
+ if (word && /^[\w@%+=:,./-]+$/.test(word)) return word;
+ if (windows) return `"${word.replace(/"/g, '""')}"`;
+ return `'${word.replace(/'/g, "'\\''")}'`;
+}
+
+const line = (words: readonly string[], windows?: boolean) => words.map((w) => shellQuote(w, windows)).join(" ");
+
+/** `a, b c` / `a; b` lists. */
+const list = (text: string | undefined, separators = /[\s,;]+/) =>
+ (text ?? "")
+ .split(separators)
+ .map((s) => s.trim())
+ .filter(Boolean);
+
+/** Container options shared by Dockerfile and Docker Image: name, ports, volumes, environment, extra options. */
+function containerArgs(p: Readonly<Record<string, string>>): string[] {
+ const args: string[] = [];
+ for (const port of list(p.ports)) args.push("-p", port);
+ for (const volume of list(p.volumes, /[;\n]+/)) args.push("-v", volume);
+ for (const env of list(p.containerEnv, /[;\n]+/)) args.push("-e", env);
+ args.push(...splitCommandLine(p.runOptions ?? ""));
+ return args;
+}
+
+/** The container name: the given one, else one derived from the image (`my-app:latest` → `my-app`). */
+export function containerName(p: Readonly<Record<string, string>>, image: string): string {
+ const given = p.containerName?.trim();
+ if (given) return given;
+ const base =
+ image
+ .replace(/@.*$/, "")
+ .replace(/:[^/:]*$/, "")
+ .split("/")
+ .pop() ?? "";
+ return base.replace(/[^a-zA-Z0-9_.-]+/g, "-").replace(/^[-_.]+/, "") || "container";
+}
+
+/**
+ * Removes a previous container of the same name (IDEA redeploys over it), then runs
+ * the new one attached, so its output is the run's output.
+ */
+function runContainer(name: string, image: string, p: Readonly<Record<string, string>>, windows: boolean): string {
+ const remove = `${line(["docker", "rm", "-f", name], windows)} ${windows ? ">nul 2>&1 &" : ">/dev/null 2>&1;"}`;
+ const run = [
+ "docker",
+ "run",
+ "--name",
+ name,
+ ...(on(p.pull) ? ["--pull", "always"] : []),
+ ...containerArgs(p),
+ image,
+ ];
+ return `${remove} ${line([...run], windows)}${p.command?.trim() ? ` ${p.command.trim()}` : ""}`;
+}
+
+const connectionField = {
+ key: "connection",
+ label: "Server",
+ control: "select" as const,
+ // Read when the form renders: the Services tool window's Docker connections.
+ get options() {
+ if (!useServices.getState().settings) void loadSettings();
+ const conns = connections();
+ return conns.length ? conns.map((c) => ({ value: c.id, label: c.name })) : [{ value: "default", label: "Docker" }];
+ },
+};
+
+const containerFields: RunConfigTypeContribution["fields"] = [
+ { key: "containerName", label: "Container name", mono: true, placeholder: "Derived from the image" },
+ { key: "ports", label: "Bind ports", mono: true, placeholder: "8080:80, 5005:5005" },
+ { key: "volumes", label: "Bind mounts", mono: true, placeholder: "./data:/data; cache:/root/.cache" },
+ { key: "containerEnv", label: "Container environment", mono: true, placeholder: "KEY=value; OTHER=value" },
+ { key: "runOptions", label: "Run options", mono: true, placeholder: "e.g. --rm --network host" },
+];
+
+/** The connection's environment (daemon selection, docker on `PATH`) for the launched command line. */
+async function withConnection(config: RunConfig): Promise<RunConfig> {
+ await loadSettings();
+ const env = await call(commands.dockerRunEnv(endpointOf(config.params?.connection || "default")));
+ return { ...config, env: { ...env, ...config.env } };
+}
+
+export const dockerfileType: RunConfigTypeContribution = {
+ id: DOCKERFILE,
+ label: "Dockerfile",
+ group: GROUP,
+ icon: "file-docker",
+ description: "Build an image from a Dockerfile and run a container from it",
+ defaults: { connection: "default", dockerfile: "Dockerfile", runImage: "true" },
+ ownsWorkingDirectory: true,
+ fields: [
+ connectionField,
+ { key: "dockerfile", label: "Dockerfile", mono: true, required: true, placeholder: "Relative to the project root" },
+ { key: "context", label: "Context folder", mono: true, placeholder: "The Dockerfile's folder" },
+ { key: "tag", label: "Image tag", mono: true, placeholder: "Derived from the context folder" },
+ { key: "target", label: "Build stage", mono: true, placeholder: "The last stage" },
+ { key: "buildArgs", label: "Build args", mono: true, placeholder: "KEY=value; OTHER=value" },
+ { key: "buildOptions", label: "Build options", mono: true, placeholder: "e.g. --no-cache --platform linux/amd64" },
+ { key: "runImage", label: "Run built image", control: "checkbox" },
+ ...containerFields.map((f) => ({ ...f, visible: (p: Readonly<Record<string, string>>) => on(p.runImage) })),
+ {
+ key: "command",
+ label: "Command",
+ mono: true,
+ placeholder: "The image's default",
+ visible: (p) => on(p.runImage),
+ },
+ ],
+ commandLine(p) {
+ const windows = isWindows();
+ const file = p.dockerfile?.trim() || "Dockerfile";
+ const slash = file.replace(/\\/g, "/").lastIndexOf("/");
+ const context = p.context?.trim() || (slash > 0 ? file.slice(0, slash) : ".");
+ const tag = p.tag?.trim() || imageTag(`${context === "." ? "" : context}/Dockerfile`);
+ const build = ["docker", "build", "-f", file, "-t", tag];
+ if (p.target?.trim()) build.push("--target", p.target.trim());
+ for (const arg of list(p.buildArgs, /[;\n]+/)) build.push("--build-arg", arg);
+ build.push(...splitCommandLine(p.buildOptions ?? ""), context);
+ if (!on(p.runImage)) return { command: line(build, windows), args: [], cwd: null };
+ const name = containerName(p, tag);
+ return {
+ command: `${line(build, windows)} && (${runContainer(name, tag, p, windows)})`,
+ args: [],
+ cwd: null,
+ stop: line(["docker", "stop", name], windows),
+ };
+ },
+ prepareLaunch: withConnection,
+};
+
+export const dockerImageType: RunConfigTypeContribution = {
+ id: DOCKER_IMAGE,
+ label: "Docker Image",
+ group: GROUP,
+ icon: "file-docker",
+ description: "Run a container from an image",
+ defaults: { connection: "default" },
+ ownsWorkingDirectory: true,
+ fields: [
+ connectionField,
+ { key: "image", label: "Image ID or name", mono: true, required: true, placeholder: "e.g. postgres:16" },
+ { key: "pull", label: "Pull the image before running", control: "checkbox" },
+ ...containerFields,
+ { key: "command", label: "Command", mono: true, placeholder: "The image's default" },
+ ],
+ commandLine(p) {
+ const windows = isWindows();
+ const image = p.image?.trim() ?? "";
+ const name = containerName(p, image);
+ return {
+ command: `(${runContainer(name, image, p, windows)})`,
+ args: [],
+ cwd: null,
+ stop: line(["docker", "stop", name], windows),
+ };
+ },
+ prepareLaunch: withConnection,
+};
+
+export const dockerComposeType: RunConfigTypeContribution = {
+ id: DOCKER_COMPOSE,
+ label: "Docker Compose",
+ group: GROUP,
+ icon: "file-docker",
+ description: "Start the services of Compose files",
+ defaults: { connection: "default", files: "docker-compose.yml" },
+ ownsWorkingDirectory: true,
+ fields: [
+ connectionField,
+ {
+ key: "files",
+ label: "Compose files",
+ mono: true,
+ required: true,
+ placeholder: "docker-compose.yml; docker-compose.override.yml",
+ },
+ { key: "services", label: "Services", mono: true, placeholder: "All services" },
+ { key: "project", label: "Project name", mono: true, placeholder: "The folder name" },
+ { key: "detach", label: "Run in the background (-d)", control: "checkbox" },
+ { key: "build", label: "Build images before starting (--build)", control: "checkbox" },
+ { key: "upOptions", label: "Up options", mono: true, placeholder: "e.g. --force-recreate --remove-orphans" },
+ ],
+ commandLine(p) {
+ const windows = isWindows();
+ const base = ["docker", "compose"];
+ for (const f of list(p.files, /[;\n]+/)) base.push("-f", f);
+ if (p.project?.trim()) base.push("-p", p.project.trim());
+ const up = [...base, "up"];
+ if (on(p.detach)) up.push("-d");
+ if (on(p.build)) up.push("--build");
+ up.push(...splitCommandLine(p.upOptions ?? ""), ...list(p.services));
+ // Attached: Stop takes the project down. Detached, `up` returns once the services started.
+ return {
+ command: line(up, windows),
+ args: [],
+ cwd: null,
+ stop: on(p.detach) ? null : line([...base, "down"], windows),
+ };
+ },
+ prepareLaunch: withConnection,
+};
+
+export const DOCKER_RUN_TYPES = [dockerfileType, dockerImageType, dockerComposeType];
+
+/** A configuration of `type` with `params` and the command line they produce. */
+export function typedConfig(
+ type: RunConfigTypeContribution,
+ id: string,
+ name: string,
+ params: Record<string, string>,
+): RunConfig {
+ const cmd = type.commandLine(params);
+ return {
+ id,
+ name,
+ kind: type.id,
+ command: cmd?.command ?? "",
+ args: cmd?.args ?? [],
+ cwd: cmd?.cwd ?? null,
+ env: {},
+ detected: false,
+ isTest: false,
+ debugAdapter: null,
+ params,
+ ...(cmd?.stop ? { stopCommand: cmd.stop } : {}),
+ };
+}
+
+/** `path` for a configuration that runs in the project root: relative when inside it. */
+const projectPath = (path: string, root: string | null) =>
+ root && path.startsWith(`${root}/`) ? path.slice(root.length + 1) : path;
+
+/** The configurations a gutter icon offers, as IDEA's Dockerfile / Compose gutter menus. */
+export function gutterActions(
+ t: DockerTarget,
+ path: string,
+ root: string | null,
+): Array<{ title: string; config: RunConfig }> {
+ const file = projectPath(path, root);
+ const folder = file.includes("/") ? file.slice(0, file.lastIndexOf("/")) : ".";
+ const connection = connections()[0]?.id ?? "default";
+ switch (t.kind) {
+ case "build": {
+ const params = { connection, dockerfile: file, context: folder, tag: imageTag(path) };
+ if (t.stage && !t.last) {
+ const config = typedConfig(dockerfileType, `docker:build:${file}:${t.stage}`, `${file} [${t.stage}]`, {
+ ...params,
+ target: t.stage,
+ });
+ return [{ title: targetTitle(t, path), config }];
+ }
+ return [
+ {
+ title: targetTitle(t, path),
+ config: typedConfig(dockerfileType, `docker:dockerfile:${file}`, file, { ...params, runImage: "true" }),
+ },
+ {
+ title: `Build Image '${params.tag}'`,
+ config: typedConfig(dockerfileType, `docker:build:${file}`, `Build ${file}`, params),
+ },
+ ];
+ }
+ case "composeAll":
+ return [
+ {
+ title: targetTitle(t, path),
+ config: typedConfig(dockerComposeType, `docker:compose:${file}`, `${file}: Compose Deployment`, {
+ connection,
+ files: file,
+ }),
+ },
+ ];
+ case "composeService":
+ return [
+ {
+ title: targetTitle(t, path),
+ config: typedConfig(dockerComposeType, `docker:compose:${file}:${t.service}`, `${file}: ${t.service}`, {
+ connection,
+ files: file,
+ services: t.service,
+ }),
+ },
+ ];
+ }
+}
+
+export function registerDockerRunTypes(): () => void {
+ const disposers = DOCKER_RUN_TYPES.map(registerRunConfigType);
+ return () => disposers.forEach((d) => d());
+}
diff --git a/src/features/services/services.test.ts b/src/features/services/services.test.ts
index 6f7223a57..094ab9f0f 100644
--- a/src/features/services/services.test.ts
+++ b/src/features/services/services.test.ts
@@ -1,7 +1,11 @@
import { describe, expect, it } from "vitest";
import type { DockerContainer, DockerSnapshot } from "@/platform/ipc";
-import { composeTargets, dockerfileTargets, fileTargets, imageTag, isComposeFile, isDockerfile, targetConfig } from "./compose";
-import { childrenOf, findNode, nodeDetail, nodeLabel, rootNodes, type ServiceNode } from "./model";
+import { composeTargets, dockerfileTargets, fileTargets, imageTag, isComposeFile, isDockerfile } from "./compose";
+import { DOCKERFILE, DOCKER_COMPOSE, containerName, dockerComposeType, dockerImageType, gutterActions, shellQuote } from "./runTypes";
+import { childrenOf, findNode, nodeDetail, nodeLabel, parseTreeKey, rootNodes, treeKey, type ServiceNode } from "./model";
+import { endpointFrom } from "./dialogs";
+import { dockerItems } from "./docker";
+import { addServiceMenu, expandableKeys, indexTree } from "./tree";
const container = (name: string, state: string, project?: string, service?: string): DockerContainer => ({
id: `${name}-id`,
@@ -54,6 +58,63 @@ describe("services tree", () => {
});
});
+describe("services tree host", () => {
+ const conns = [{ id: "default", name: "Docker", endpoint: { kind: "default" as const } }, { id: "c2", name: "Build box", endpoint: { kind: "tcp" as const, host: "build:2376", tlsCertDir: null } }];
+ const state = { default: { snapshot, loading: false, error: null } };
+
+ it("puts every connection and registry at the root, with connection-scoped keys", () => {
+ const items = dockerItems(conns, [{ id: "r1", name: "GHCR", address: "ghcr.io", username: "me" }], state);
+ expect(items.map((i) => [i.key, i.label, i.detail])).toEqual([
+ ["docker:default", "Docker", undefined],
+ ["docker:c2", "Build box", undefined],
+ ["docker-registry:r1", "GHCR", "ghcr.io"],
+ ]);
+ expect(items[1]!.dim).toBe(true);
+ expect(items[1]!.children).toEqual([]);
+ const containers = items[0]!.children![0]!;
+ expect(containers.key).toBe("docker:default:group:containers");
+ expect(containers.children!.map((c) => c.key)).toEqual(["docker:default:compose:shop", "docker:default:container:web-id"]);
+ expect(containers.children![1]!.dim).toBe(true);
+ const index = indexTree({ docker: items });
+ expect(index.get("docker:default:container:shop-db-1-id")?.item.label).toBe("db");
+ expect(expandableKeys(items)).toContain("docker:default:compose:shop");
+ });
+
+ it("round-trips tree keys", () => {
+ const node = findNode(snapshot, "container:web-id")!;
+ expect(treeKey("c2", node)).toBe("docker:c2:container:web-id");
+ expect(parseTreeKey("docker:c2:container:web-id")).toEqual({ conn: "c2", local: "container:web-id" });
+ expect(parseTreeKey("docker:c2")).toEqual({ conn: "c2", local: "docker" });
+ expect(treeKey("c2", rootNodes()[0]!)).toBe("docker:c2");
+ expect(parseTreeKey("run:type:cargo")).toBeNull();
+ });
+
+ it("joins the providers' Add Service entries", () => {
+ const providers = [
+ { id: "a", useRoots: () => [], addMenu: () => [{ label: "Run Configuration Type" }] },
+ { id: "b", useRoots: () => [] },
+ { id: "c", useRoots: () => [], addMenu: () => [{ label: "Docker Registry…" }, { label: "Docker Connection…" }] },
+ ];
+ expect(addServiceMenu(providers).map((m) => ("label" in m ? m.label : m.kind))).toEqual([
+ "Run Configuration Type",
+ "separator",
+ "Docker Registry…",
+ "Docker Connection…",
+ ]);
+ });
+
+ it("builds connection endpoints from the dialog fields", () => {
+ const f = { path: " /var/run/docker.sock ", host: "", tls: "", context: "" };
+ expect(endpointFrom("socket", f)).toEqual({ kind: "socket", path: "/var/run/docker.sock" });
+ expect(endpointFrom("tcp", f)).toBeNull();
+ expect(endpointFrom("tcp", { ...f, host: "tcp://h:2376", tls: "/certs" })).toEqual({ kind: "tcp", host: "tcp://h:2376", tlsCertDir: "/certs" });
+ expect(endpointFrom("tcp", { ...f, host: "h:2375", tls: " " })).toEqual({ kind: "tcp", host: "h:2375", tlsCertDir: null });
+ expect(endpointFrom("context", { ...f, context: "--evil" })).toBeNull();
+ expect(endpointFrom("context", { ...f, context: "orbstack" })).toEqual({ kind: "context", name: "orbstack" });
+ expect(endpointFrom("default", f)).toEqual({ kind: "default" });
+ });
+});
+
describe("docker run targets", () => {
it("recognises file names", () => {
expect(isDockerfile("/p/Dockerfile")).toBe(true);
@@ -98,12 +159,50 @@ describe("docker run targets", () => {
expect(fileTargets("/p/README.md", text)).toEqual([]);
});
- it("creates run configurations", () => {
+ it("creates Dockerfile and Docker Compose run configurations", () => {
expect(imageTag("/work/My App/Dockerfile")).toBe("my-app:latest");
- const build = targetConfig({ kind: "build", line: 0, stage: "build", last: false }, "/work/app/Dockerfile", "/work/app");
- expect(build.args).toEqual(["build", "--file", "/work/app/Dockerfile", "--tag", "app:latest", "--target", "build", "/work/app"]);
- expect(build.cwd).toBe("/work/app");
- const up = targetConfig({ kind: "composeService", line: 3, service: "db" }, "/work/app/compose.yaml", "/work/app", "/bin/docker");
- expect(up).toMatchObject({ command: "/bin/docker", args: ["compose", "--file", "/work/app/compose.yaml", "up", "db"], id: "docker:compose:compose.yaml:db" });
+ const [stage] = gutterActions({ kind: "build", line: 0, stage: "build", last: false }, "/work/app/docker/Dockerfile", "/work/app");
+ expect(stage!.title).toBe("Build Stage 'build'");
+ expect(stage!.config).toMatchObject({ kind: DOCKERFILE, cwd: null, params: { dockerfile: "docker/Dockerfile", target: "build" } });
+ expect(stage!.config.command).toBe("docker build -f docker/Dockerfile -t docker:latest --target build docker");
+ expect(stage!.config.stopCommand).toBeUndefined();
+
+ const [run, buildOnly] = gutterActions({ kind: "build", line: 4, stage: null, last: true }, "/work/app/Dockerfile", "/work/app");
+ expect(run!.title).toBe("Run 'Dockerfile'");
+ expect(run!.config.command).toBe(
+ "docker build -f Dockerfile -t app:latest . && (docker rm -f app >/dev/null 2>&1; docker run --name app app:latest)",
+ );
+ expect(run!.config.stopCommand).toBe("docker stop app");
+ expect(buildOnly!.title).toBe("Build Image 'app:latest'");
+
+ const [up] = gutterActions({ kind: "composeService", line: 3, service: "db" }, "/work/app/compose.yaml", "/work/app");
+ expect(up!.config).toMatchObject({
+ id: "docker:compose:compose.yaml:db",
+ kind: DOCKER_COMPOSE,
+ command: "docker compose -f compose.yaml up db",
+ stopCommand: "docker compose -f compose.yaml down",
+ });
+ });
+
+ it("builds container command lines from the form", () => {
+ const image = dockerImageType.commandLine({
+ image: "postgres:16",
+ pull: "true",
+ ports: "5432:5432, 9187:9187",
+ volumes: "pg data:/var/lib/postgresql/data",
+ containerEnv: "POSTGRES_PASSWORD=it's; A=b",
+ runOptions: "--network host",
+ command: "postgres -c fsync=off",
+ })!;
+ expect(image.command).toBe(
+ "(docker rm -f postgres >/dev/null 2>&1; docker run --name postgres --pull always -p 5432:5432 -p 9187:9187 " +
+ "-v 'pg data:/var/lib/postgresql/data' -e 'POSTGRES_PASSWORD=it'\\''s' -e A=b --network host postgres:16 postgres -c fsync=off)",
+ );
+ expect(image.stop).toBe("docker stop postgres");
+ expect(containerName({ containerName: " web " }, "x")).toBe("web");
+ expect(containerName({}, "ghcr.io/org/my-app@sha256:abc")).toBe("my-app");
+ const detached = dockerComposeType.commandLine({ files: "a.yml; b.yml", project: "demo", detach: "true", build: "true" })!;
+ expect(detached).toMatchObject({ command: "docker compose -f a.yml -f b.yml -p demo up -d --build", stop: null });
+ expect(shellQuote('a "b"', true)).toBe('"a ""b"""');
});
});
diff --git a/src/features/services/store.ts b/src/features/services/store.ts
index 0e2a45a8b..812fa81cd 100644
--- a/src/features/services/store.ts
+++ b/src/features/services/store.ts
@@ -1,116 +1,249 @@
/**
- * Docker state for the Services tool window: the last snapshot, the selection,
- * and the refresh loop (a `docker events` stream while docker is up, a slow poll
- * while it is not, so the view recovers when the daemon starts).
+ * Docker state for the Services tool window: the configured connections and
+ * registries, per connection the last snapshot and its refresh loop (a `docker
+ * events` stream while the daemon is up, a slow poll while it is not, so the
+ * view recovers when the daemon starts).
*/
import { create } from "zustand";
import { Channel } from "@tauri-apps/api/core";
-import type { ComposeOp, ContainerOp, DockerEvent, DockerObject, DockerSnapshot, PruneTarget, RequestId } from "@/platform/ipc";
+import type {
+ ComposeOp,
+ ContainerOp,
+ DockerConnection,
+ DockerEndpoint,
+ DockerEvent,
+ DockerObject,
+ DockerRegistry,
+ DockerSettings,
+ DockerSnapshot,
+ PruneTarget,
+ RequestId,
+} from "@/platform/ipc";
import { call, commands, isCancelled, isTauri, nextRequestId } from "@/platform/ipc";
import { notifications } from "@/workbench/contributions";
-import { findNode, type ServiceNode } from "./model";
export type DetailTab = "log" | "inspect";
-interface ServicesState {
+/** `DockerSettings` with its defaults filled in. */
+export interface Settings {
+ connections: DockerConnection[];
+ registries: DockerRegistry[];
+}
+
+export interface ConnectionState {
snapshot: DockerSnapshot | null;
loading: boolean;
error: string | null;
- selectedKey: string | null;
- expanded: Set<string>;
+}
+
+interface DockerState {
+ /** Null until loaded. */
+ settings: Settings | null;
+ /** By connection id. */
+ conns: Record<string, ConnectionState>;
detailTab: DetailTab;
/** Long operation in progress (pull, prune, compose…): its title and last output line. */
task: { title: string; line: string; request: RequestId } | null;
}
-export const useServices = create<ServicesState>(() => ({
- snapshot: null,
- loading: false,
- error: null,
- selectedKey: null,
- expanded: new Set(["docker", "group:containers"]),
+export const useServices = create<DockerState>(() => ({
+ settings: null,
+ conns: {},
detailTab: "log",
task: null,
}));
export const errorMessage = (e: unknown) => (e instanceof Error ? e.message : String(e));
-let inflight: Promise<void> | null = null;
-let again = false;
+const IDLE: ConnectionState = { snapshot: null, loading: false, error: null };
+
+export function connectionState(id: string, s = useServices.getState()): ConnectionState {
+ return s.conns[id] ?? IDLE;
+}
+
+export function connections(s = useServices.getState()): DockerConnection[] {
+ return s.settings?.connections ?? [];
+}
+
+export function endpointOf(connId: string): DockerEndpoint {
+ return connections().find((c) => c.id === connId)?.endpoint ?? { kind: "default" };
+}
+
+/** The docker executable (for run configurations and terminals), from any snapshot. */
+export function dockerExecutable(): string {
+ for (const c of Object.values(useServices.getState().conns)) if (c.snapshot?.executable) return c.snapshot.executable;
+ return "docker";
+}
+
+function patchConn(id: string, patch: Partial<ConnectionState>) {
+ useServices.setState((s) => ({ conns: { ...s.conns, [id]: { ...connectionState(id, s), ...patch } } }));
+}
+
+// ---------------------------------------------------------------------------
+// Settings
+
+let settingsLoad: Promise<void> | null = null;
+
+export function loadSettings(): Promise<void> {
+ if (!isTauri()) {
+ useServices.setState({ settings: { connections: [], registries: [] } });
+ return Promise.resolve();
+ }
+ settingsLoad ??= call(commands.dockerSettings())
+ .then((s: DockerSettings) => useServices.setState({ settings: { connections: s.connections ?? [], registries: s.registries ?? [] } }))
+ .catch((e) => {
+ settingsLoad = null;
+ notifications().notify({ group: "run", level: "error", title: "Cannot read Docker settings", body: errorMessage(e) });
+ });
+ return settingsLoad;
+}
+
+async function saveSettings(settings: Settings): Promise<boolean> {
+ try {
+ if (isTauri()) await call(commands.dockerSaveSettings(settings));
+ useServices.setState({ settings });
+ return true;
+ } catch (e) {
+ notifications().notify({ group: "run", level: "error", title: "Cannot save Docker settings", body: errorMessage(e) });
+ return false;
+ }
+}
+
+export const newId = (prefix: string) => `${prefix}${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`;
+
+/** Adds or replaces (same id) a connection; the tree picks it up right away. */
+export async function saveConnection(c: DockerConnection): Promise<boolean> {
+ await loadSettings();
+ const s = useServices.getState().settings ?? { connections: [], registries: [] };
+ const exists = s.connections.some((x) => x.id === c.id);
+ const ok = await saveSettings({ ...s, connections: exists ? s.connections.map((x) => (x.id === c.id ? c : x)) : [...s.connections, c] });
+ if (ok) {
+ stopEvents(c.id);
+ if (watchers > 0) void refresh(c.id);
+ }
+ return ok;
+}
+
+export async function removeConnection(id: string): Promise<void> {
+ const s = useServices.getState().settings;
+ if (!s) return;
+ stopEvents(id);
+ if (await saveSettings({ ...s, connections: s.connections.filter((c) => c.id !== id) })) {
+ useServices.setState((st) => {
+ const conns = { ...st.conns };
+ delete conns[id];
+ return { conns };
+ });
+ }
+}
+
+/** Adds or replaces a registry; `password` undefined keeps the saved one, null forgets it. */
+export async function saveRegistry(r: DockerRegistry, password: string | null | undefined): Promise<boolean> {
+ await loadSettings();
+ const s = useServices.getState().settings ?? { connections: [], registries: [] };
+ const exists = s.registries.some((x) => x.id === r.id);
+ const ok = await saveSettings({ ...s, registries: exists ? s.registries.map((x) => (x.id === r.id ? r : x)) : [...s.registries, r] });
+ if (ok && password !== undefined && isTauri()) {
+ try {
+ await call(commands.dockerSetRegistryPassword(r.id, password));
+ } catch (e) {
+ notifications().notify({ group: "run", level: "error", title: "Cannot save the registry password", body: errorMessage(e) });
+ }
+ }
+ return ok;
+}
+
+export async function removeRegistry(id: string): Promise<void> {
+ const s = useServices.getState().settings;
+ if (s) await saveSettings({ ...s, registries: s.registries.filter((r) => r.id !== id) });
+}
+
+/** Test login; resolves to docker's answer, rejects with its error. */
+export function testRegistryLogin(r: DockerRegistry, password: string | null): Promise<string> {
+ const endpoint = connections()[0]?.endpoint ?? { kind: "default" };
+ return call(commands.dockerRegistryLogin(endpoint, r, password));
+}
+
+// ---------------------------------------------------------------------------
+// Snapshots
+
+const inflight = new Map<string, Promise<void>>();
+const again = new Set<string>();
-/** Re-reads everything; concurrent calls coalesce into one follow-up refresh. */
-export function refresh(): Promise<void> {
+/** Re-reads one connection (all without `id`); concurrent calls coalesce into one follow-up refresh. */
+export function refresh(id?: string): Promise<void> {
if (!isTauri()) return Promise.resolve();
- if (inflight) {
- again = true;
- return inflight;
+ if (id === undefined) return Promise.all(connections().map((c) => refresh(c.id))).then(() => undefined);
+ const running = inflight.get(id);
+ if (running) {
+ again.add(id);
+ return running;
}
- useServices.setState({ loading: true });
- inflight = call(commands.dockerSnapshot())
+ patchConn(id, { loading: true });
+ const p = call(commands.dockerSnapshot(endpointOf(id)))
.then((snapshot) => {
- const wasReady = useServices.getState().snapshot?.availability.kind === "ready";
- useServices.setState({ snapshot, error: null });
- if (snapshot.availability.kind === "ready" && !wasReady) startEvents();
+ if (!connections().some((c) => c.id === id)) return;
+ const wasReady = connectionState(id).snapshot?.availability.kind === "ready";
+ patchConn(id, { snapshot, error: null });
+ if (snapshot.availability.kind === "ready" && !wasReady) startEvents(id);
})
- .catch((e) => useServices.setState({ error: errorMessage(e) }))
+ .catch((e) => patchConn(id, { error: errorMessage(e) }))
.finally(() => {
- inflight = null;
- useServices.setState({ loading: false });
- if (again) {
- again = false;
- void refresh();
- }
+ inflight.delete(id);
+ if (connections().some((c) => c.id === id)) patchConn(id, { loading: false });
+ if (again.delete(id)) void refresh(id);
});
- return inflight;
+ inflight.set(id, p);
+ return p;
}
-let debounce: ReturnType<typeof setTimeout> | undefined;
-function refreshSoon() {
- clearTimeout(debounce);
- debounce = setTimeout(() => void refresh(), 250);
+const debounces = new Map<string, ReturnType<typeof setTimeout>>();
+function refreshSoon(id: string) {
+ clearTimeout(debounces.get(id));
+ debounces.set(id, setTimeout(() => void refresh(id), 250));
}
-let eventsRequest: RequestId | null = null;
+const events = new Map<string, RequestId>();
let pollTimer: ReturnType<typeof setInterval> | undefined;
let watchers = 0;
-function startEvents() {
- if (eventsRequest !== null || watchers === 0) return;
+function startEvents(id: string) {
+ if (events.has(id) || watchers === 0) return;
const request = nextRequestId();
- eventsRequest = request;
+ events.set(id, request);
const channel = new Channel<DockerEvent>();
- channel.onmessage = () => refreshSoon();
- void call(commands.dockerEvents(request, channel))
+ channel.onmessage = () => refreshSoon(id);
+ void call(commands.dockerEvents(request, endpointOf(id), channel))
.catch(() => undefined)
.finally(() => {
- if (eventsRequest !== request) return;
- eventsRequest = null;
+ if (events.get(id) !== request) return;
+ events.delete(id);
// The stream ended on its own (daemon stopped): re-check the state.
- if (watchers > 0) refreshSoon();
+ if (watchers > 0) refreshSoon(id);
});
}
-function stopEvents() {
- if (eventsRequest !== null) {
- const r = eventsRequest;
- eventsRequest = null;
+function stopEvents(id?: string) {
+ for (const [conn, r] of [...events]) {
+ if (id !== undefined && conn !== id) continue;
+ events.delete(conn);
void commands.cancelRequest(r);
}
}
/**
- * Keeps the snapshot live while the view is shown: events while docker runs,
- * a poll every 10 s while it does not (or the events stream is down).
+ * Keeps the snapshots live while the tree is shown: events while a daemon runs,
+ * a poll every 10 s while it does not (or its events stream is down).
*/
export function watch(): () => void {
watchers++;
- void refresh().then(() => {
- if (useServices.getState().snapshot?.availability.kind === "ready") startEvents();
- });
+ void loadSettings().then(() => refresh());
if (watchers === 1) {
pollTimer = setInterval(() => {
- const ready = useServices.getState().snapshot?.availability.kind === "ready";
- if (!ready || eventsRequest === null) void refresh();
+ for (const c of connections()) {
+ const ready = connectionState(c.id).snapshot?.availability.kind === "ready";
+ if (!ready || !events.has(c.id)) void refresh(c.id);
+ }
}, 10_000);
}
return () => {
@@ -122,12 +255,10 @@ export function watch(): () => void {
};
}
-export function selectedNode(): ServiceNode | null {
- const { snapshot, selectedKey } = useServices.getState();
- return findNode(snapshot, selectedKey);
-}
+// ---------------------------------------------------------------------------
+// Operations
-async function guarded(title: string, run: () => Promise<unknown>): Promise<boolean> {
+async function guarded(connId: string, title: string, run: () => Promise<unknown>): Promise<boolean> {
try {
await run();
return true;
@@ -136,21 +267,25 @@ async function guarded(title: string, run: () => Promise<unknown>): Promise<bool
notifications().notify({ group: "run", level: "error", title, body: errorMessage(e), key: "docker-op" });
return false;
} finally {
- refreshSoon();
+ refreshSoon(connId);
}
}
-export function containerOp(ids: string[], op: ContainerOp): Promise<boolean> {
+export function containerOp(connId: string, ids: string[], op: ContainerOp): Promise<boolean> {
const verb = { start: "start", stop: "stop", restart: "restart", pause: "pause", unpause: "unpause", kill: "kill" }[op];
- return guarded(`Could not ${verb} container`, () => call(commands.dockerContainerOp(ids, op)));
+ return guarded(connId, `Could not ${verb} container`, () => call(commands.dockerContainerOp(endpointOf(connId), ids, op)));
}
-export function removeObjects(object: DockerObject, ids: string[], force: boolean): Promise<boolean> {
- return guarded(`Could not remove ${object}`, () => call(commands.dockerRemove(object, ids, force)));
+export function removeObjects(connId: string, object: DockerObject, ids: string[], force: boolean): Promise<boolean> {
+ return guarded(connId, `Could not remove ${object}`, () => call(commands.dockerRemove(endpointOf(connId), object, ids, force)));
}
/** Runs a streaming operation, showing its latest output line in the view's banner. */
-async function task(title: string, run: (request: RequestId, out: Channel<string>) => Promise<unknown>): Promise<boolean> {
+async function task(
+ connId: string,
+ title: string,
+ run: (request: RequestId, out: Channel<string>) => Promise<unknown>,
+): Promise<boolean> {
if (useServices.getState().task) {
notifications().notify({ group: "run", level: "info", title: "Another Docker operation is still running", key: "docker-op" });
return false;
@@ -164,7 +299,7 @@ async function task(title: string, run: (request: RequestId, out: Channel<string
};
useServices.setState({ task: { title, line: "", request } });
try {
- return await guarded(title.replace(/…$/, "") + " failed", () => run(request, out));
+ return await guarded(connId, title.replace(/…$/, "") + " failed", () => run(request, out));
} finally {
useServices.setState({ task: null });
if (last) notifications().notify({ group: "run", level: "info", title: title.replace(/…$/, ""), body: last, key: "docker-task" });
@@ -176,12 +311,16 @@ export function cancelTask() {
if (t) void commands.cancelRequest(t.request);
}
-export const pullImage = (reference: string) =>
- task(`Pulling ${reference}…`, (r, out) => call(commands.dockerPull(r, reference, out)));
+export const pullImage = (connId: string, reference: string) =>
+ task(connId, `Pulling ${reference}…`, (r, out) => call(commands.dockerPull(r, endpointOf(connId), reference, out)));
-export const prune = (target: PruneTarget) =>
- task(`Pruning ${target === "allImages" ? "unused images" : target}…`, (r, out) => call(commands.dockerPrune(r, target, out)));
+export const prune = (connId: string, target: PruneTarget) =>
+ task(connId, `Pruning ${target === "allImages" ? "unused images" : target}…`, (r, out) =>
+ call(commands.dockerPrune(r, endpointOf(connId), target, out)),
+ );
-export function composeOp(project: string, files: string[], workingDir: string | null, op: ComposeOp) {
- return task(`Compose ${op} ${project}…`, (r, out) => call(commands.dockerComposeOp(r, project, files, workingDir, op, out)));
+export function composeOp(connId: string, project: string, files: string[], workingDir: string | null, op: ComposeOp) {
+ return task(connId, `Compose ${op} ${project}…`, (r, out) =>
+ call(commands.dockerComposeOp(r, endpointOf(connId), project, files, workingDir, op, out)),
+ );
}
diff --git a/src/features/services/tree.ts b/src/features/services/tree.ts
new file mode 100644
index 000000000..9d3d947b4
--- /dev/null
+++ b/src/features/services/tree.ts
@@ -0,0 +1,88 @@
+/**
+ * The Services tree host: the root nodes service providers contribute, the
+ * selection and expansion, and which provider owns a node.
+ */
+import { create } from "zustand";
+import type { MenuItem } from "@/ui";
+import { serviceProviders, type ServiceProviderContribution, type ServiceTreeItem } from "@/workbench/contributions";
+
+/** The service view (Services tool window tab) hosting the tree. */
+export const SERVICES_TREE_VIEW = "services";
+
+interface TreeState {
+ /** Root nodes per provider id (reported by each provider's `useRoots`). */
+ roots: Record<string, ServiceTreeItem[]>;
+ selectedKey: string | null;
+ expanded: Set<string>;
+}
+
+export const useServicesTree = create<TreeState>(() => ({
+ roots: {},
+ selectedKey: null,
+ expanded: new Set(["docker:default", "docker:default:group:containers"]),
+}));
+
+export function setProviderRoots(provider: string, items: ServiceTreeItem[]) {
+ useServicesTree.setState((s) => (s.roots[provider] === items ? s : { roots: { ...s.roots, [provider]: items } }));
+}
+
+export function clearProviderRoots(provider: string) {
+ useServicesTree.setState((s) => {
+ if (!(provider in s.roots)) return s;
+ const roots = { ...s.roots };
+ delete roots[provider];
+ return { roots };
+ });
+}
+
+export interface Located {
+ item: ServiceTreeItem;
+ provider: string;
+}
+
+/** Every node by key, with the provider owning it. */
+export function indexTree(roots: Record<string, readonly ServiceTreeItem[]>): Map<string, Located> {
+ const out = new Map<string, Located>();
+ const visit = (provider: string, item: ServiceTreeItem) => {
+ out.set(item.key, { item, provider });
+ item.children?.forEach((c) => visit(provider, c));
+ };
+ for (const [provider, items] of Object.entries(roots)) items.forEach((i) => visit(provider, i));
+ return out;
+}
+
+/** Roots of all providers, in provider order. */
+export function orderedRoots(
+ roots: Record<string, readonly ServiceTreeItem[]>,
+ providers: readonly ServiceProviderContribution[],
+): ServiceTreeItem[] {
+ return providers.flatMap((p) => roots[p.id] ?? []);
+}
+
+/** Keys of every expandable node (Expand All). */
+export function expandableKeys(items: readonly ServiceTreeItem[]): string[] {
+ const out: string[] = [];
+ const visit = (i: ServiceTreeItem) => {
+ if (i.children?.length) {
+ out.push(i.key);
+ i.children.forEach(visit);
+ }
+ };
+ items.forEach(visit);
+ return out;
+}
+
+/** The "Add Service" menu: every provider's entries, separated per provider. */
+export function addServiceMenu(providers = serviceProviders()): MenuItem[] {
+ const groups = providers.map((p) => p.addMenu?.() ?? []).filter((g) => g.length > 0);
+ return groups.flatMap((g, i) => (i === 0 ? g : [{ kind: "separator" } as MenuItem, ...g]));
+}
+
+/** The selected node and its provider. */
+export function selectedService(): (Located & { contribution: ServiceProviderContribution | undefined }) | null {
+ const { roots, selectedKey } = useServicesTree.getState();
+ if (!selectedKey) return null;
+ const found = indexTree(roots).get(selectedKey);
+ if (!found) return null;
+ return { ...found, contribution: serviceProviders().find((p) => p.id === found.provider) };
+}
diff --git a/src/features/settings/__tests__/assignShortcut.test.ts b/src/features/settings/__tests__/assignShortcut.test.ts
new file mode 100644
index 000000000..d929b1a12
--- /dev/null
+++ b/src/features/settings/__tests__/assignShortcut.test.ts
@@ -0,0 +1,43 @@
+import { describe, expect, it } from "vitest";
+import { assignedSetting } from "../keymap/AssignShortcut";
+import { findConflicts } from "../keymap/model";
+
+const actions = [
+ { id: "file.save", title: "Save All" },
+ { id: "my.action", title: "My Action" },
+];
+
+describe("Assign Shortcut (Search Everywhere ⌥↵)", () => {
+ it("adds the binding as an override of a bundled keymap", () => {
+ const s = { keymap: "intellij-macos", keymapOverrides: {}, customKeymaps: {} };
+ expect(assignedSetting(s, "my.action", "Alt+Meta+J", [], false)).toEqual({
+ key: "keymapOverrides",
+ value: { "my.action": ["Alt+Meta+J"] },
+ });
+ });
+
+ it("removes conflicting assignments when asked, like the Keymap page", () => {
+ const s = { keymap: "intellij-macos", keymapOverrides: {}, customKeymaps: {} };
+ const draft = { preset: "intellij-macos", overrides: {} };
+ const conflicts = findConflicts(draft, "Meta+S", "my.action", actions);
+ expect(conflicts.map((c) => c.actionId)).toEqual(["file.save"]);
+ const removed = assignedSetting(s, "my.action", "Meta+S", conflicts, true).value as Record<string, string[]>;
+ expect(removed["my.action"]).toEqual(["Meta+S"]);
+ expect(removed["file.save"]).toEqual([]);
+ const kept = assignedSetting(s, "my.action", "Meta+S", conflicts, false).value as Record<string, string[]>;
+ expect(kept["file.save"]).toBeUndefined();
+ });
+
+ it("writes into the selected user keymap", () => {
+ const s = {
+ keymap: "custom.mine",
+ keymapOverrides: {},
+ customKeymaps: { "custom.mine": { name: "Mine", parent: "intellij-macos", overrides: {} } },
+ };
+ const out = assignedSetting(s, "my.action", "Alt+Meta+J", [], false);
+ expect(out.key).toBe("customKeymaps");
+ expect(out.value).toEqual({
+ "custom.mine": { name: "Mine", parent: "intellij-macos", overrides: { "my.action": ["Alt+Meta+J"] } },
+ });
+ });
+});
diff --git a/src/features/settings/__tests__/fileTypes.test.ts b/src/features/settings/__tests__/fileTypes.test.ts
new file mode 100644
index 000000000..35c6c3261
--- /dev/null
+++ b/src/features/settings/__tests__/fileTypes.test.ts
@@ -0,0 +1,97 @@
+import { beforeEach, describe, expect, it } from "vitest";
+import type { LanguageInfo_Serialize as LanguageInfo, Settings } from "@/platform/ipc";
+import { useProject } from "@/platform/project";
+import { effectivePatterns, removePattern, userFileType, validateFileTypes, wildcardMatch } from "@/platform/fileTypes";
+import { DEFAULT_SETTINGS, validateSettings } from "../model/schema";
+import { openSettings, stage, stagedValue, useSettingsDialog } from "../model/staging";
+import { applyPatternEdit } from "../pages/FileTypes";
+import { CODE_STYLE_KEYS, copyScheme } from "../pages/editor/codeStyleScheme";
+import { overrideKey } from "../fileTypesRuntime";
+
+const lang = (id: string, extensions: string[], filenames: string[] = []): LanguageInfo => ({
+ id,
+ name: id,
+ extensions,
+ filenames,
+ uiMode: null,
+ lineComment: null,
+ blockComment: null,
+ indent: null,
+});
+
+const python = lang("python", ["py", "pyi"], ["SConstruct"]);
+const groovy = lang("groovy", ["groovy"], ["Jenkinsfile"]);
+const shell = lang("shellscript", ["sh"]);
+const langs = [python, groovy, shell];
+
+describe("file type associations", () => {
+ it("adds, removes and restores patterns of a language", () => {
+ let a = applyPatternEdit({}, langs, python, ["*.py", "*.pyi", "SConstruct", "*.foo"]);
+ expect(a).toEqual({ python: { patterns: ["*.foo"], removedPatterns: [], hashbangs: [] } });
+ a = applyPatternEdit(a, langs, python, ["*.py", "*.foo"]);
+ expect(a.python).toEqual({ patterns: ["*.foo"], removedPatterns: ["*.pyi", "SConstruct"], hashbangs: [] });
+ expect(effectivePatterns(python, a).map((p) => p.pattern)).toEqual(["*.py", "*.foo"]);
+ // Re-adding a built-in pattern restores it; removing the last change drops the entry.
+ a = applyPatternEdit(a, langs, python, ["*.py", "*.pyi", "SConstruct"]);
+ expect(a).toEqual({});
+ });
+
+ it("moves a pattern from the language that had it", () => {
+ const a = applyPatternEdit({}, langs, shell, ["*.sh", "Jenkinsfile"]);
+ expect(a.shellscript?.patterns).toEqual(["Jenkinsfile"]);
+ expect(a.groovy?.removedPatterns).toEqual(["Jenkinsfile"]);
+ expect(effectivePatterns(groovy, a).map((p) => p.pattern)).toEqual(["*.groovy"]);
+ expect(removePattern(a, shell, "Jenkinsfile").shellscript).toBeUndefined();
+ });
+
+ it("matches user patterns for icons", () => {
+ const a = {
+ python: { patterns: ["*.foo", "build_*.cfg"], removedPatterns: [], hashbangs: [] },
+ shellscript: { patterns: ["Jenkinsfile"], removedPatterns: [], hashbangs: [] },
+ };
+ expect(userFileType(a, "x.FOO")).toBe("python");
+ expect(userFileType(a, "build_dev.cfg")).toBe("python");
+ expect(userFileType(a, "Jenkinsfile")).toBe("shellscript");
+ expect(userFileType(a, "x.py")).toBeNull();
+ expect(wildcardMatch("file?.txt", "file1.txt")).toBe(true);
+ expect(wildcardMatch("file?.txt", "file.txt")).toBe(false);
+ });
+
+ it("validates stored associations and keeps them in the settings", () => {
+ expect(validateFileTypes({ python: { patterns: [" *.foo ", 3, "*.foo"] }, "": {}, x: 1 })).toEqual({
+ python: { patterns: ["*.foo"], removedPatterns: [], hashbangs: [] },
+ });
+ const s = validateSettings({
+ files: { fileTypes: { go: { hashbangs: ["gorun"] } }, fileTypeOverrides: { "a/b.txt": "markdown", bad: 1 } },
+ projectStructure: { contentRoots: ["/data/shared", "/data/shared"], excludeFiles: "*.log;tmp*" },
+ });
+ expect(s.files.fileTypes.go?.hashbangs).toEqual(["gorun"]);
+ expect(s.files.fileTypeOverrides).toEqual({ "a/b.txt": "markdown" });
+ expect(s.projectStructure.contentRoots).toEqual(["/data/shared"]);
+ expect(s.projectStructure.excludeFiles).toBe("*.log;tmp*");
+ });
+
+ it("keys overrides by project-relative path inside the project", () => {
+ expect(overrideKey("/p/src/a.txt", "/p")).toBe("src/a.txt");
+ expect(overrideKey("/elsewhere/a.txt", "/p")).toBe("/elsewhere/a.txt");
+ expect(overrideKey("/p2/a.txt", "/p")).toBe("/p2/a.txt");
+ });
+});
+
+describe("code style scheme", () => {
+ beforeEach(() => {
+ useProject.setState({ settings: structuredClone(DEFAULT_SETTINGS) as Settings, project: null });
+ openSettings("editor.codeStyle");
+ });
+
+ it("copies every Code Style value to the other scheme", () => {
+ stage("editor.codeStyle", "global", "editor.codeStyle.hardWrapAt", 100);
+ stage("editor.codeStyle", "global", "editor.codeStyle.formatterTagsEnabled", true);
+ copyScheme("editor.codeStyle", "global", "project");
+ const s = useSettingsDialog.getState();
+ expect(stagedValue(s, "project", "editor.codeStyle.hardWrapAt")).toBe(100);
+ expect(stagedValue(s, "project", "editor.codeStyle.formatterTagsEnabled")).toBe(true);
+ expect(stagedValue(s, "project", "editor.codeStyle.formatterOffTag")).toBe("@formatter:off");
+ for (const key of CODE_STYLE_KEYS) expect(stagedValue(s, "project", key)).toEqual(stagedValue(s, "global", key));
+ });
+});
diff --git a/src/features/settings/__tests__/inspections.test.ts b/src/features/settings/__tests__/inspections.test.ts
new file mode 100644
index 000000000..50b3cf0d0
--- /dev/null
+++ b/src/features/settings/__tests__/inspections.test.ts
@@ -0,0 +1,125 @@
+import { describe, expect, it } from "vitest";
+import {
+ buildInspectionTree,
+ checkState,
+ filterInspectionTree,
+ inspectionIds,
+ setEnabled,
+ copyProfile,
+ deleteProfile,
+ renameProfile,
+ setLevel,
+ withProfileOverrides,
+ type InspectionNode,
+} from "../pages/editor/inspectionsModel";
+import { validateInspections } from "@/platform/inspections";
+import { NATURAL_LANGUAGES_PAGE, SPELLING_PAGE } from "../pages/editor/spelling";
+import { INSPECTIONS_PAGE } from "../pages/editor/inspections";
+import { EDITOR_PAGES } from "../pages/editor";
+
+const languages = [
+ { name: "Python", servers: ["basedpyright", "ruff"] },
+ { name: "Markdown", servers: [] },
+ { name: "TypeScript", servers: ["typescript-language-server"] },
+ { name: "JavaScript", servers: ["typescript-language-server"] },
+];
+const seen = [
+ { producer: "ruff", code: "F401", source: "Ruff", sample: "`os` imported but unused" },
+ { producer: "custom-ls", code: "X1", source: "custom", sample: "" },
+];
+
+const find = (nodes: readonly InspectionNode[], key: string): InspectionNode | undefined => {
+ for (const n of nodes) {
+ if (n.key === key) return n;
+ const hit = find(n.children, key);
+ if (hit) return hit;
+ }
+ return undefined;
+};
+
+describe("inspections tree", () => {
+ const tree = buildInspectionTree(languages, seen, [{ "lsp:ruff:E501": { severity: "typo" } }]);
+
+ it("groups servers by language with seen and configured codes, built-ins by category", () => {
+ expect(tree.map((g) => g.name)).toEqual(["General", "JavaScript", "Other", "Proofreading", "Python", "SQL", "TypeScript"]);
+ const python = find(tree, "group:Python")!;
+ expect(python.children.map((n) => n.id)).toEqual(["lsp:basedpyright", "lsp:ruff"]);
+ expect(python.children[1]!.children.map((n) => n.id)).toEqual(["lsp:ruff:E501", "lsp:ruff:F401"]);
+ expect(find(tree, "Python/lsp:ruff:F401")!.description).toContain("imported but unused");
+ expect(find(tree, "group:Other")!.children.map((n) => n.id)).toEqual(["lsp:custom-ls"]);
+ expect(find(tree, "group:General")!.children.map((n) => n.id)).toContain("builtin:file-references");
+ // A server of several languages appears under each, as the same inspection.
+ expect(find(tree, "JavaScript/lsp:typescript-language-server")!.description).toContain("TypeScript, JavaScript");
+ });
+
+ it("filters by name, code and group, keeping ancestors", () => {
+ const out = filterInspectionTree(tree, "f401");
+ expect(out.map((g) => g.name)).toEqual(["Python"]);
+ expect(inspectionIds(out[0]!)).toEqual(["lsp:ruff", "lsp:ruff:F401"]);
+ expect(filterInspectionTree(tree, "python ruff")[0]!.children.map((n) => n.id)).toEqual(["lsp:ruff"]);
+ expect(filterInspectionTree(tree, "")).toHaveLength(tree.length);
+ });
+
+ it("derives tri-state checkboxes and toggles whole subtrees", () => {
+ const python = find(tree, "group:Python")!;
+ const ruff = find(tree, "Python/lsp:ruff")!;
+ let o = setEnabled({}, find(tree, "Python/lsp:ruff:F401")!, false);
+ expect(o).toEqual({ "lsp:ruff:F401": { enabled: false } });
+ expect(checkState(o, ruff)).toBe("mixed");
+ expect(checkState(o, python)).toBe("mixed");
+ o = setEnabled(o, ruff, false);
+ expect(checkState(o, ruff)).toBe("off");
+ o = setEnabled(o, python, true);
+ expect(o).toEqual({});
+ expect(checkState(o, python)).toBe("on");
+ });
+
+ it("keeps severity and enabled overrides independent", () => {
+ let o = setLevel({}, "lsp:ruff", "error");
+ o = setEnabled(o, find(tree, "Python/lsp:ruff")!, false);
+ expect(o["lsp:ruff"]).toEqual({ severity: "error", enabled: false });
+ o = setLevel(o, "lsp:ruff", undefined);
+ expect(o["lsp:ruff"]).toEqual({ enabled: false });
+ });
+
+ it("registers as Editor › Inspections", () => {
+ expect(EDITOR_PAGES).toContain(INSPECTIONS_PAGE);
+ expect(INSPECTIONS_PAGE.keywords).toContain("Weak Warning");
+ });
+});
+
+describe("inspection profile management", () => {
+ const base = validateInspections({ default: { a: { enabled: false } }, project: { b: { severity: "error" } } });
+
+ it("copies at either level and selects the copy", () => {
+ const s1 = copyProfile(base, "default", "Strict", "ide");
+ expect(s1.profile).toBe("ide:strict");
+ expect(s1.ideProfiles.strict).toEqual({ name: "Strict", overrides: { a: { enabled: false } } });
+ expect(s1.default).toBe(base.default);
+ const s2 = copyProfile(s1, "project", "Team", "project");
+ expect(s2.profile).toBe("project:team");
+ expect(s2.projectProfiles.team!.overrides).toEqual({ b: { severity: "error" } });
+ // Copies are independent of their source.
+ const s3 = withProfileOverrides(s2, "project:team", {});
+ expect(s3.projectProfiles.team!.overrides).toEqual({});
+ expect(s3.project).toEqual({ b: { severity: "error" } });
+ });
+
+ it("renames and deletes copies only", () => {
+ const s1 = copyProfile(base, "default", "Strict", "ide");
+ expect(renameProfile(s1, "ide:strict", " Lenient ").ideProfiles.strict!.name).toBe("Lenient");
+ expect(renameProfile(s1, "default", "X")).toBe(s1);
+ const s2 = deleteProfile(s1, "ide:strict");
+ expect(s2.ideProfiles).toEqual({});
+ expect(s2.profile).toBe("default");
+ expect(deleteProfile(s1, "project")).toBe(s1);
+ const s3 = deleteProfile(copyProfile(s1, "default", "Team", "project"), "project:team");
+ expect(s3.profile).toBe("project");
+ });
+
+ it("registers Natural Languages › Spelling under Editor", () => {
+ expect(EDITOR_PAGES).toContain(SPELLING_PAGE);
+ expect(SPELLING_PAGE.id.startsWith(`${NATURAL_LANGUAGES_PAGE.id}.`)).toBe(true);
+ expect(SPELLING_PAGE.keywords).toContain("accepted words");
+ });
+});
diff --git a/src/features/settings/appearanceRuntime.ts b/src/features/settings/appearanceRuntime.ts
index d2ea64277..2e79663fe 100644
--- a/src/features/settings/appearanceRuntime.ts
+++ b/src/features/settings/appearanceRuntime.ts
@@ -107,6 +107,19 @@ export function zoomActions(): Action[] {
keywords: ["zoom", "scale", "100%", "accessibility"],
run: () => setZoom(100),
},
+ {
+ // View › Appearance › Compact Mode (Settings › Appearance › "Compact mode").
+ id: "view.toggleCompactMode",
+ title: "Compact Mode",
+ category: "View",
+ keywords: ["appearance", "density", "smaller"],
+ toggled: () => validateSettings(useProject.getState().settings).appearance.compactMode,
+ run: async () => {
+ if (!isTauri()) return;
+ const next = !validateSettings(useProject.getState().settings).appearance.compactMode;
+ useProject.setState({ settings: await call(commands.settingsSet("global", "appearance.compactMode", JSON.stringify(next))) });
+ },
+ },
];
}
diff --git a/src/features/settings/components/Form.tsx b/src/features/settings/components/Form.tsx
index 920ee58c9..d5fa308dc 100644
--- a/src/features/settings/components/Form.tsx
+++ b/src/features/settings/components/Form.tsx
@@ -262,10 +262,21 @@ export interface GlobListEditorProps {
onChange: (value: string[]) => void;
placeholder?: string;
"aria-label"?: string;
+ /** Shown for an empty list. */
+ emptyText?: string;
+ /** Accessible name of the inline editor. */
+ itemLabel?: string;
}
-/** Editable list of glob patterns (+ / − / edit toolbar, inline editing). */
-export function GlobListEditor({ value, onChange, placeholder = "**/pattern", ...aria }: GlobListEditorProps) {
+/** Editable list of glob patterns (+ / − / edit toolbar, inline editing); also plain string lists. */
+export function GlobListEditor({
+ value,
+ onChange,
+ placeholder = "**/pattern",
+ emptyText = "No patterns",
+ itemLabel = "Pattern",
+ ...aria
+}: GlobListEditorProps) {
const [selected, setSelected] = useState<number | null>(null);
const [editing, setEditing] = useState<{ index: number; text: string } | null>(null);
const listId = useId();
@@ -359,7 +370,7 @@ export function GlobListEditor({ value, onChange, placeholder = "**/pattern", ..
>
{rows.length === 0 && (
<li className={styles.globEmpty}>
- <T>No patterns</T>
+ <T>{emptyText}</T>
</li>
)}
{rows.map((glob, i) => (
@@ -380,7 +391,7 @@ export function GlobListEditor({ value, onChange, placeholder = "**/pattern", ..
className={styles.globInput}
value={editing.text}
placeholder={placeholder}
- aria-label="Pattern"
+ aria-label={itemLabel}
onChange={(e) => setEditing({ index: i, text: e.target.value })}
onKeyDown={onEditKey}
onBlur={commit}
diff --git a/src/features/settings/dialog/SettingsDialog.tsx b/src/features/settings/dialog/SettingsDialog.tsx
index cfab080ef..9b562d546 100644
--- a/src/features/settings/dialog/SettingsDialog.tsx
+++ b/src/features/settings/dialog/SettingsDialog.tsx
@@ -66,7 +66,7 @@ function ScopeSwitch({ pageId, scope }: { pageId: string; scope: Scope }) {
["project", "This project"],
];
return (
- <div className={styles.scope} role="radiogroup" aria-label="Settings scope">
+ <div className={styles.scope} role="radiogroup" aria-label={tx("Settings scope")}>
{options.map(([value, label]) => (
<button
key={value}
@@ -103,7 +103,8 @@ function PageHost({
const newProjects = useSettingsDialog((s) => s.newProjects);
const spec = page ? builtinSpec(page.id) : undefined;
const projectScope = !!spec?.projectScope && hasProject && !newProjects;
- const chosen = useSettingsDialog((s) => s.scopes[pageId]) ?? spec?.defaultScope;
+ const scopeKey = spec?.scopeGroup ?? pageId;
+ const chosen = useSettingsDialog((s) => s.scopes[scopeKey]) ?? spec?.defaultScope;
const scope: Scope = projectScope && chosen === "project" ? "project" : "global";
// Where a project value is the norm, say what the global one is for.
const globalNote = newProjects || (projectScope && scope === "global" && spec?.defaultScope === "project");
@@ -113,7 +114,7 @@ function PageHost({
return (
<PageContext.Provider value={ctx}>
<div className={styles.pageHeader}>
- <div className={styles.crumbs} aria-label="Breadcrumb">
+ <div className={styles.crumbs} aria-label={tx("Breadcrumb")}>
{crumbs.map((c, i) => (
<span key={i} className={styles.crumb}>
{i > 0 && <Icon name="chevron-right" size={12} className={styles.crumbSep} />}
@@ -128,7 +129,7 @@ function PageHost({
<T>Reset</T>
</button>
)}
- {projectScope && <ScopeSwitch pageId={pageId} scope={scope} />}
+ {projectScope && !spec?.ownScopeSwitch && <ScopeSwitch pageId={scopeKey} scope={scope} />}
<span className={styles.history}>
<IconButton icon="arrow-left" title="Back" size="small" disabled={!history.back} onClick={history.back} />
<IconButton
diff --git a/src/features/settings/fileTypesRuntime.ts b/src/features/settings/fileTypesRuntime.ts
new file mode 100644
index 000000000..1a307b6fc
--- /dev/null
+++ b/src/features/settings/fileTypesRuntime.ts
@@ -0,0 +1,136 @@
+/**
+ * File Types at runtime: Override File Type / Revert File Type Override in the
+ * Project view and editor tab menus (`files.fileTypeOverrides`, project scope,
+ * as IDEA keeps them per project) and file icons for the user's patterns.
+ */
+import { executeAction, registerActions } from "@/platform/actions";
+import { call, commands, isTauri, type LanguageInfo_Serialize as LanguageInfo } from "@/platform/ipc";
+import {
+ sampleFileName,
+ userFileType,
+ validateFileTypeOverrides,
+ validateFileTypes,
+ type FileTypeAssociations,
+} from "@/platform/fileTypes";
+import { loadSettings, useProject } from "@/platform/project";
+import { fileIconName, setFileIconOverride, type IconName, type MenuItem } from "@/ui";
+import { registerMenuGroup } from "@/workbench/contributions";
+
+let languages: LanguageInfo[] | null = null;
+let loading: Promise<LanguageInfo[]> | null = null;
+
+function loadLanguages(): Promise<LanguageInfo[]> {
+ if (!isTauri()) return Promise.resolve([]);
+ return (loading ??= commands
+ .languages()
+ .then((list) => (languages = [...list].sort((a, b) => a.name.localeCompare(b.name))))
+ .catch(() => {
+ loading = null;
+ return [];
+ }));
+}
+
+/** Settings key of a file: project-relative inside the project, else absolute. */
+export function overrideKey(path: string, root: string | null): string {
+ return root && path.startsWith(root + "/") ? path.slice(root.length + 1) : path;
+}
+
+function currentOverrides(): Record<string, string> {
+ return validateFileTypeOverrides(
+ (useProject.getState().settings?.files as { fileTypeOverrides?: unknown } | undefined)?.fileTypeOverrides,
+ );
+}
+
+async function writeOverride(path: string, language: string | null) {
+ const root = useProject.getState().project?.root ?? null;
+ const next = { ...currentOverrides() };
+ const key = overrideKey(path, root);
+ if (language) next[key] = language;
+ else delete next[key];
+ await call(commands.settingsSet(root ? "project" : "global", "files.fileTypeOverrides", JSON.stringify(next)));
+ await loadSettings();
+}
+
+function overrideMenu(path: string): MenuItem[] {
+ const langs = languages ?? [];
+ if (!langs.length) return [];
+ const current = currentOverrides()[overrideKey(path, useProject.getState().project?.root ?? null)];
+ const items: MenuItem[] = [
+ {
+ label: "Override File Type",
+ submenu: langs.map((l) => ({
+ label: l.name,
+ verbatim: true,
+ checked: l.id === current,
+ run: () => void executeAction("file.overrideFileType", { path, language: l.id }),
+ })),
+ },
+ ];
+ if (current)
+ items.push({
+ kind: "action",
+ action: "file.revertFileTypeOverride",
+ arg: { path },
+ label: "Revert File Type Override",
+ });
+ return items;
+}
+
+function iconResolver(assoc: FileTypeAssociations): ((name: string) => IconName | null) | null {
+ if (!Object.keys(assoc).length || !languages) return null;
+ const byId = new Map(languages.map((l) => [l.id, l]));
+ return (name) => {
+ const id = userFileType(assoc, name);
+ const lang = id ? byId.get(id) : undefined;
+ const sample = lang && sampleFileName(lang);
+ return sample ? fileIconName(sample) : null;
+ };
+}
+
+export function activateFileTypes(): () => void {
+ const syncIcons = () => {
+ const files = useProject.getState().settings?.files as { fileTypes?: unknown } | undefined;
+ setFileIconOverride(iconResolver(validateFileTypes(files?.fileTypes)));
+ };
+ void loadLanguages().then(syncIcons);
+ const unsub = useProject.subscribe((s, prev) => {
+ if (s.settings !== prev.settings) syncIcons();
+ });
+ const disposers = [
+ unsub,
+ () => setFileIconOverride(null),
+ registerActions([
+ {
+ id: "file.overrideFileType",
+ title: "Override File Type",
+ category: "File",
+ hidden: true,
+ run: ({ arg }) => {
+ const { path, language } = (arg ?? {}) as { path?: string; language?: string };
+ if (path && language) void writeOverride(path, language);
+ },
+ },
+ {
+ id: "file.revertFileTypeOverride",
+ title: "Revert File Type Override",
+ category: "File",
+ hidden: true,
+ run: ({ arg }) => {
+ const path = (arg as { path?: string } | undefined)?.path;
+ if (path) void writeOverride(path, null);
+ },
+ },
+ ]),
+ registerMenuGroup({
+ id: "settings.fileType",
+ menus: ["projectView", "editorTab"],
+ order: 90,
+ prepare: async () => void (await loadLanguages()),
+ items: (_menu, { paths, dirs }) => {
+ const path = paths.length === 1 && !dirs?.[0] ? paths[0]! : null;
+ return path && !path.includes("://") ? overrideMenu(path) : [];
+ },
+ }),
+ ];
+ return () => disposers.reverse().forEach((d) => d());
+}
diff --git a/src/features/settings/index.ts b/src/features/settings/index.ts
index d7f440d17..f7f7cdc04 100644
--- a/src/features/settings/index.ts
+++ b/src/features/settings/index.ts
@@ -16,7 +16,7 @@ import { registerActions, type Action } from "@/platform/actions";
import { call, commands, isTauri } from "@/platform/ipc";
import { isPopupOpen, lazyComponent } from "@/ui";
import { loadSettings, useProject } from "@/platform/project";
-import { registerOverlay } from "@/workbench/contributions";
+import { provideSettingsSearchIndex, registerOverlay } from "@/workbench/contributions";
import { LazySettingsDialog, loadBuiltinPages, unloadBuiltinPages } from "./dialog/LazySettingsDialog";
import {
closeSettings,
@@ -28,8 +28,11 @@ import {
useSettingsDialog,
} from "./model/staging";
import { zoomActions } from "./appearanceRuntime";
+import { activateFileTypes } from "./fileTypesRuntime";
import { trackRuntimeSettings } from "./runtime";
import { installActionProxies, installSettingsHost } from "./window/bridge";
+import { AssignShortcutOverlay, showAssignShortcut } from "./keymap/AssignShortcut";
+import { settingsSearchEntries } from "./searchIndex";
export { settingsWindowParent } from "./window/bridge";
export const SettingsWindow = lazyComponent(() => import("./window/SettingsWindow").then((m) => m.SettingsWindow));
@@ -99,6 +102,21 @@ export function activate(): () => void {
registerOverlay({ id: "settings.dialog", component: LazySettingsDialog }),
registerActions(zoomActions()),
registerActions(settingsActions((page, newProjects) => void showSettings(page, newProjects))),
+ activateFileTypes(),
+ registerOverlay({ id: "settings.assignShortcut", component: AssignShortcutOverlay }),
+ registerActions([
+ {
+ // Search Everywhere's ⌥↵ on an action (arg: the action id).
+ id: "settings.assignShortcut",
+ title: "Assign Shortcut…",
+ category: "Settings",
+ hidden: true,
+ run: ({ arg }) => {
+ if (typeof arg === "string") showAssignShortcut(arg);
+ },
+ },
+ ]),
+ provideSettingsSearchIndex(settingsSearchEntries),
isTauri() ? installSettingsHost() : () => {},
];
return () => disposers.reverse().forEach((d) => d());
diff --git a/src/features/settings/keymap/AssignShortcut.tsx b/src/features/settings/keymap/AssignShortcut.tsx
new file mode 100644
index 000000000..2610ad434
--- /dev/null
+++ b/src/features/settings/keymap/AssignShortcut.tsx
@@ -0,0 +1,89 @@
+/**
+ * IDEA's "Assign Shortcut" from Search Everywhere (⌥↵ on an action): the
+ * Keymap page's keystroke dialog for one action, saved straight to the
+ * active keymap (overrides of a bundled keymap, or the user keymap itself).
+ */
+import { useMemo } from "react";
+import { create } from "zustand";
+import { useActions } from "@/platform/actions";
+import { call, commands, isTauri } from "@/platform/ipc";
+import type { Keymap } from "@/platform/keymap";
+import { PRESETS } from "@/platform/keymap";
+import { useProject } from "@/platform/project";
+import { validateSettings } from "../model/schema";
+import {
+ activeDraft,
+ addBinding,
+ removeConflicts,
+ withCustomOverrides,
+ type Conflict,
+ type KeymapDraft,
+} from "./model";
+import { RecordShortcutDialog } from "./RecordShortcutDialog";
+
+export const useAssignShortcut = create<{ actionId: string | null }>(() => ({ actionId: null }));
+
+export function showAssignShortcut(actionId: string) {
+ useAssignShortcut.setState({ actionId });
+}
+
+interface KeymapSettings {
+ keymap: string;
+ keymapOverrides: Keymap;
+ customKeymaps: ReturnType<typeof validateSettings>["customKeymaps"];
+}
+
+export function draftOf(s: KeymapSettings): KeymapDraft {
+ return activeDraft(s.keymap, s.keymapOverrides, s.customKeymaps);
+}
+
+/** The settings key and value that add `binding` to `actionId` in the active keymap. */
+export function assignedSetting(
+ s: KeymapSettings,
+ actionId: string,
+ binding: string,
+ conflicts: readonly Conflict[],
+ removeOthers: boolean,
+): { key: "keymapOverrides" | "customKeymaps"; value: unknown } {
+ const draft = draftOf(s);
+ const base = removeOthers ? { ...draft, overrides: removeConflicts(draft, conflicts) } : draft;
+ const overrides = addBinding(base, actionId, binding);
+ const custom = !PRESETS[s.keymap] && !!s.customKeymaps[s.keymap];
+ return custom
+ ? { key: "customKeymaps", value: withCustomOverrides(s.customKeymaps, s.keymap, overrides) }
+ : { key: "keymapOverrides", value: overrides };
+}
+
+async function save(key: string, value: unknown) {
+ if (!isTauri()) {
+ const settings = useProject.getState().settings;
+ useProject.setState({ settings: { ...(settings ?? {}), [key]: value } as typeof settings });
+ return;
+ }
+ const settings = await call(commands.settingsSet("global", key, JSON.stringify(value)));
+ useProject.setState({ settings });
+}
+
+export function AssignShortcutOverlay() {
+ const actionId = useAssignShortcut((s) => s.actionId);
+ const actionMap = useActions((s) => s.actions);
+ const raw = useProject((s) => s.settings);
+ const settings = useMemo(() => validateSettings(raw), [raw]);
+ const actions = useMemo(() => [...actionMap.values()], [actionMap]);
+ const action = actionId ? actionMap.get(actionId) : undefined;
+ if (!action) return null;
+ const close = () => useAssignShortcut.setState({ actionId: null });
+ return (
+ <RecordShortcutDialog
+ action={action}
+ actions={actions}
+ draft={draftOf(settings)}
+ onCancel={close}
+ onSubmit={(binding, conflicts, remove) => {
+ const { key, value } = assignedSetting(settings, action.id, binding, conflicts, remove);
+ close();
+ void save(key, value).catch((e) => console.error("cannot save the shortcut", e));
+ }}
+ />
+ );
+}
diff --git a/src/features/settings/languages/ProjectStructurePage.tsx b/src/features/settings/languages/ProjectStructurePage.tsx
index cb9f47619..dfdebf81f 100644
--- a/src/features/settings/languages/ProjectStructurePage.tsx
+++ b/src/features/settings/languages/ProjectStructurePage.tsx
@@ -6,11 +6,14 @@
* unmarks the folder (`projectStructure.*`, project scope). Roots drive the
* project tree icons, package inference for new classes, the "Project
* Production / Test Files" scopes, and Excluded folders are skipped by the
- * tree, Find in Files and indexing.
+ * tree, Find in Files and indexing. Content roots besides the project folder
+ * (`projectStructure.contentRoots`) are listed in the Project view and searched
+ * by Find in Files; "Exclude files" name patterns (`projectStructure.excludeFiles`)
+ * are hidden from the tree and skipped by search and indexing.
*/
-import { useCallback, useEffect, useMemo, useState } from "react";
+import { useCallback, useEffect, useId, useMemo, useState } from "react";
import clsx from "clsx";
-import { Icon, IconButton, Tree, folderIconName, type FolderKind, T } from "@/ui";
+import { Button, Icon, IconButton, Input, Tree, folderIconName, type FolderKind, T } from "@/ui";
import { call, commands, isTauri, type FileEntry } from "@/platform/ipc";
import { relativePath, useProject } from "@/platform/project";
import {
@@ -20,19 +23,26 @@ import {
restoreDetected,
rootRole,
unmarkedRoots,
+ type FolderListKey,
type FolderRole,
type ProjectStructureValid,
} from "@/platform/languageSettings";
import { initProjectRoots, useDetectedRoots } from "@/platform/projectRoots";
+import { choosePath } from "./api";
import { useProjectSetting } from "./components";
import styles from "./Sdk.module.css";
interface DirNode {
path: string;
name: string;
- rel: string;
+ /** Project-relative; null outside the project (another content root). */
+ rel: string | null;
+ /** A content root besides the project folder. */
+ contentRoot?: boolean;
}
+const inside = (root: string, path: string) => path === root || path.startsWith(root + "/");
+
const ROLES: Array<{ role: FolderRole; label: string; title: string; kind: FolderKind; cls: string }> = [
{ role: "source", label: "Sources", title: "Source Folders", kind: "source", cls: styles.sourceTitle! },
{ role: "test", label: "Tests", title: "Test Source Folders", kind: "test", cls: styles.testTitle! },
@@ -53,7 +63,7 @@ async function readDirs(root: string, path: string): Promise<DirNode[]> {
return entries
.filter((e) => e.kind === "dir" || (e.kind === "symlink" && e.targetKind === "dir"))
.filter((e) => e.name !== ".git")
- .map((e) => ({ path: e.path, name: e.name, rel: relativePath(root, e.path) }));
+ .map((e) => ({ path: e.path, name: e.name, rel: inside(root, e.path) ? relativePath(root, e.path) : null }));
}
function useStructure(): [ProjectStructureValid, (next: ProjectStructureValid) => void] {
@@ -65,6 +75,8 @@ function useStructure(): [ProjectStructureValid, (next: ProjectStructureValid) =
);
const [excluded, setExcluded] = useProjectSetting<string[] | undefined>("projectStructure.excluded");
const [unmarked, setUnmarked] = useProjectSetting<string[] | undefined>("projectStructure.unmarked");
+ const [contentRoots] = useProjectSetting<string[] | undefined>("projectStructure.contentRoots");
+ const [excludeFiles] = useProjectSetting<string | undefined>("projectStructure.excludeFiles");
const ps = useMemo<ProjectStructureValid>(
() => ({
sourceRoots: sourceRoots ?? [],
@@ -73,12 +85,14 @@ function useStructure(): [ProjectStructureValid, (next: ProjectStructureValid) =
testResourceRoots: testResourceRoots ?? [],
excluded: excluded ?? [],
unmarked: unmarked ?? [],
+ contentRoots: contentRoots ?? [],
+ excludeFiles: excludeFiles ?? "",
}),
- [sourceRoots, testRoots, resourceRoots, testResourceRoots, excluded, unmarked],
+ [sourceRoots, testRoots, resourceRoots, testResourceRoots, excluded, unmarked, contentRoots, excludeFiles],
);
const set = useCallback(
(next: ProjectStructureValid) => {
- const setters: Record<keyof ProjectStructureValid, (v: string[]) => void> = {
+ const setters: Record<FolderListKey, (v: string[]) => void> = {
sourceRoots: setSource,
testRoots: setTest,
resourceRoots: setResources,
@@ -94,6 +108,65 @@ function useStructure(): [ProjectStructureValid, (next: ProjectStructureValid) =
return [ps, set];
}
+/** "+ Add Content Root" and the content roots, the project folder first (IDEA's module Sources tab). */
+function ContentRoots({ root }: { root: string }) {
+ const [roots, setRoots] = useProjectSetting<string[] | undefined>("projectStructure.contentRoots");
+ const list = roots ?? [];
+ const add = async () => {
+ const picked = await choosePath({ directory: true, title: "Add Content Root", defaultPath: root });
+ if (!picked || inside(root, picked) || list.includes(picked)) return;
+ setRoots([...list, picked]);
+ };
+ return (
+ <div className={styles.rootGroup}>
+ <Button size="small" variant="ghost" icon="plus" onClick={() => void add()}>
+ <T>Add Content Root</T>
+ </Button>
+ <div className={clsx(styles.rootItem, styles.contentRoot)}>
+ <span className={styles.rootPath} title={root}>
+ {root}
+ </span>
+ </div>
+ {list.map((r) => (
+ <div key={r} className={clsx(styles.rootItem, styles.contentRoot)}>
+ <span className={styles.rootPath} title={r}>
+ {r}
+ </span>
+ <IconButton
+ icon="close"
+ size="small"
+ iconSize={12}
+ title={`Remove content root ${r}`}
+ onClick={() => setRoots(list.filter((x) => x !== r))}
+ />
+ </div>
+ ))}
+ </div>
+ );
+}
+
+function ExcludeFiles() {
+ const [value, setValue] = useProjectSetting<string | undefined>("projectStructure.excludeFiles");
+ const id = useId();
+ return (
+ <div className={styles.excludeFiles}>
+ <label htmlFor={id}>
+ <T>Exclude files:</T>
+ </label>
+ <Input
+ id={id}
+ className={styles.excludeInput}
+ value={value ?? ""}
+ placeholder="*.log;tmp*"
+ onChange={(e) => setValue(e.target.value)}
+ />
+ <div className={styles.excludeHint}>
+ <T>Use ; to separate name patterns, * for any number of symbols, ? for one.</T>
+ </div>
+ </div>
+ );
+}
+
export function ProjectStructurePage() {
const root = useProject((s) => s.project?.root ?? null);
const name = useProject((s) => s.project?.name ?? "");
@@ -115,14 +188,32 @@ export function ProjectStructurePage() {
);
const rootNode = useMemo<DirNode | null>(() => (root ? { path: root, name, rel: "" } : null), [root, name]);
+ const treeRoots = useMemo<DirNode[]>(
+ () =>
+ rootNode
+ ? [
+ rootNode,
+ ...ps.contentRoots.map((p) => ({
+ path: p,
+ name: p.slice(p.lastIndexOf("/") + 1) || p,
+ rel: null,
+ contentRoot: true,
+ })),
+ ]
+ : [],
+ [rootNode, ps.contentRoots],
+ );
useEffect(() => {
if (!root) return;
let live = true;
- void readDirs(root, root).then((dirs) => live && setChildren((m) => new Map(m).set(root, dirs)));
+ for (const dir of [root, ...ps.contentRoots])
+ void readDirs(root, dir)
+ .then((dirs) => live && setChildren((m) => new Map(m).set(dir, dirs)))
+ .catch(() => {});
return () => {
live = false;
};
- }, [root]);
+ }, [root, ps.contentRoots]);
if (!rootNode)
return (
@@ -131,10 +222,11 @@ export function ProjectStructurePage() {
</div>
);
- const role = selected ? rootRole(roots, selected.rel) : null;
+ const markable = selected?.rel ?? null;
+ const role = markable !== null ? rootRole(roots, markable) : null;
const mark = (r: FolderRole) => {
- if (!selected) return;
- setPs(markFolder(ps, selected.rel, role === r ? null : r, detected));
+ if (markable === null) return;
+ setPs(markFolder(ps, markable, role === r ? null : r, detected));
};
const unmarkedDetected = unmarkedRoots(detected, ps);
const restore = () => setPs(restoreDetected(ps, detected));
@@ -153,7 +245,7 @@ export function ProjectStructurePage() {
type="button"
className={styles.markButton}
aria-pressed={role === r.role}
- disabled={!selected || (!selected.rel && r.role === "excluded")}
+ disabled={markable === null || (!markable && r.role === "excluded")}
onClick={() => mark(r.role)}
>
<Icon name={folderIconName(r.kind)} size={14} />
@@ -164,7 +256,7 @@ export function ProjectStructurePage() {
<div className={styles.treeScroll}>
<Tree<DirNode>
aria-label="Content root"
- roots={[rootNode]}
+ roots={treeRoots}
getKey={(n) => n.path}
getLabel={(n) => n.name}
getChildren={(n) => children.get(n.path)}
@@ -176,15 +268,18 @@ export function ProjectStructurePage() {
selected={selected ? new Set([selected.path]) : new Set()}
onSelectionChange={(_s, lead) => setSelected(lead)}
getIcon={(n) => {
+ if (n.rel === null) return n.contentRoot ? "module" : folderIconName("plain");
const r = rootRole(roots, n.rel);
if (!n.rel && !r) return "module";
return folderIconName(r ? ROLES.find((x) => x.role === r)!.kind : "plain");
}}
- getDetail={(n) => (n.rel ? undefined : (root ?? undefined))}
+ getDetail={(n) => (n.rel === "" ? (root ?? undefined) : n.contentRoot ? n.path : undefined)}
/>
</div>
+ <ExcludeFiles />
</div>
<div className={styles.roots} aria-label="Marked folders">
+ <ContentRoots root={rootNode.path} />
{ROLES.map((r) => {
const list = roots.filter((x) => x.kind === r.role);
return (
diff --git a/src/features/settings/languages/Sdk.module.css b/src/features/settings/languages/Sdk.module.css
index 8812ac57d..aa43406aa 100644
--- a/src/features/settings/languages/Sdk.module.css
+++ b/src/features/settings/languages/Sdk.module.css
@@ -334,3 +334,26 @@
.search {
width: 180px;
}
+
+/* Project Structure: content roots and "Exclude files". */
+.contentRoot {
+ padding-left: 4px;
+ font-weight: 600;
+}
+.excludeFiles {
+ display: grid;
+ grid-template-columns: auto minmax(0, 1fr);
+ align-items: center;
+ column-gap: 8px;
+ row-gap: 2px;
+ padding: 6px 8px;
+ border-top: 1px solid var(--border);
+}
+.excludeInput {
+ width: 100%;
+}
+.excludeHint {
+ grid-column: 2;
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+}
diff --git a/src/features/settings/model/schema.ts b/src/features/settings/model/schema.ts
index a538f8db2..5551d80e1 100644
--- a/src/features/settings/model/schema.ts
+++ b/src/features/settings/model/schema.ts
@@ -5,6 +5,11 @@
* back to the default (mirrors `ide-core::settings` defaults).
*/
import { DEFAULT_IGNORED_NAMES } from "@/platform/ignoredNames";
+import {
+ validateFileTypeOverrides,
+ validateFileTypes,
+ type FileTypeAssociations,
+} from "@/platform/fileTypes";
import type { Settings } from "@/platform/ipc";
import {
DEFAULT_LANGUAGES,
@@ -16,6 +21,7 @@ import {
} from "@/platform/languageSettings";
import { EDITOR_EXTRA_DEFAULTS, validateEditorExtras, type EditorExtras } from "@/platform/editorSettings";
import { DEFAULT_WORKFLOW, validateWorkflow, type WorkflowSettings } from "@/platform/workflowSettings";
+import { DEFAULT_INSPECTIONS, validateInspections, type InspectionSettingsValid } from "@/platform/inspections";
import {
DEFAULT_APPEARANCE_EXTRAS,
DEFAULT_GENERAL_EXTRAS,
@@ -66,12 +72,37 @@ export interface ValidSettings extends WorkflowSettings {
localHistoryDays: number;
/** Local History size bound per project, MB. */
localHistoryMaxMb: number;
+ /** File Types: the user's patterns per language id. */
+ fileTypes: FileTypeAssociations;
+ /** Override File Type: file → language id (project scope). */
+ fileTypeOverrides: Record<string, string>;
};
keymapOverrides: Record<string, string[]>;
customKeymaps: Record<string, CustomKeymapSettings>;
notifications: NotificationsValid;
languages: LanguagesValid;
projectStructure: ProjectStructureValid;
+ inspections: InspectionSettingsValid;
+ /** Editor › Natural Languages › Spelling. */
+ spelling: SpellingValid;
+}
+
+export interface SpellingValid {
+ ideWords: string[];
+ projectWords: string[];
+ customDictionaries: string[];
+}
+
+const stringList = (v: unknown): string[] =>
+ Array.isArray(v) ? v.filter((x): x is string => typeof x === "string" && !!x.trim()) : [];
+
+function validateSpelling(raw: unknown): SpellingValid {
+ const r = obj(raw);
+ return {
+ ideWords: stringList(r.ideWords),
+ projectWords: stringList(r.projectWords),
+ customDictionaries: stringList(r.customDictionaries),
+ };
}
export { ACCENT_PRESETS } from "@/workbench/theme";
@@ -102,12 +133,16 @@ export const DEFAULT_SETTINGS: ValidSettings = {
ensureFinalNewline: true,
localHistoryDays: 5,
localHistoryMaxMb: 512,
+ fileTypes: {},
+ fileTypeOverrides: {},
},
keymapOverrides: {},
customKeymaps: {},
notifications: DEFAULT_NOTIFICATIONS,
languages: DEFAULT_LANGUAGES,
projectStructure: DEFAULT_PROJECT_STRUCTURE,
+ inspections: DEFAULT_INSPECTIONS,
+ spelling: { ideWords: [], projectWords: [], customDictionaries: [] },
...DEFAULT_WORKFLOW,
};
@@ -198,12 +233,16 @@ export function validateSettings(raw: Settings | unknown): ValidSettings {
ensureFinalNewline: bool(f.ensureFinalNewline, d.files.ensureFinalNewline),
localHistoryDays: num(f.localHistoryDays, d.files.localHistoryDays, LIMITS.localHistoryDays, true),
localHistoryMaxMb: num(f.localHistoryMaxMb, d.files.localHistoryMaxMb, LIMITS.localHistoryMaxMb, true),
+ fileTypes: validateFileTypes(f.fileTypes),
+ fileTypeOverrides: validateFileTypeOverrides(f.fileTypeOverrides),
},
keymapOverrides: overrides,
customKeymaps,
notifications: validateNotifications(root.notifications),
languages: validateLanguages(root.languages),
projectStructure: validateProjectStructure(root.projectStructure),
+ inspections: validateInspections(root.inspections),
+ spelling: validateSpelling(root.spelling),
...validateWorkflow(root),
};
}
diff --git a/src/features/settings/pages/FileTypes.module.css b/src/features/settings/pages/FileTypes.module.css
new file mode 100644
index 000000000..58a5d9417
--- /dev/null
+++ b/src/features/settings/pages/FileTypes.module.css
@@ -0,0 +1,83 @@
+.fileTypes {
+ display: grid;
+ grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
+ gap: 12px;
+ min-width: 0;
+}
+
+.types {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ min-width: 0;
+}
+
+.filter {
+ width: 100%;
+}
+
+.typeList {
+ display: flex;
+ flex-direction: column;
+ max-height: 420px;
+ overflow: auto;
+ padding: 2px 0;
+ border-radius: var(--radius-small);
+ box-shadow: inset 0 0 0 1px var(--border);
+}
+
+.type {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: var(--h-row);
+ padding: 0 8px;
+ border: none;
+ background: none;
+ color: var(--fg);
+ font: inherit;
+ text-align: left;
+ cursor: default;
+}
+.type:hover {
+ background: var(--bg-hover);
+}
+.typeSelected,
+.typeSelected:hover {
+ background: var(--bg-selected);
+}
+
+.typeName {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.modified {
+ color: var(--fg-muted);
+ font-size: var(--fs-small);
+}
+
+.patterns {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ min-width: 0;
+}
+
+.note {
+ color: var(--fg-muted);
+ font-size: var(--fs-small);
+}
+
+.code {
+ font-family: var(--font-mono);
+}
+
+@media (max-width: 640px) {
+ .fileTypes {
+ grid-template-columns: minmax(0, 1fr);
+ }
+}
diff --git a/src/features/settings/pages/FileTypes.tsx b/src/features/settings/pages/FileTypes.tsx
new file mode 100644
index 000000000..531659cfa
--- /dev/null
+++ b/src/features/settings/pages/FileTypes.tsx
@@ -0,0 +1,135 @@
+/**
+ * Editor › File Types › Recognized File Types: languages from
+ * `languages/*.toml` with their file name patterns (the definition's plus the
+ * user's) and hashbang patterns, stored in `files.fileTypes`. The backend
+ * detects languages with them; open editors re-detect when they change.
+ */
+import { useEffect, useMemo, useState } from "react";
+import clsx from "clsx";
+import { Icon, Input, T, fileIconName } from "@/ui";
+import { commands, isTauri, type LanguageInfo_Serialize as LanguageInfo } from "@/platform/ipc";
+import {
+ addPattern,
+ effectivePatterns,
+ removePattern,
+ sampleFileName,
+ setHashbangs,
+ type FileTypeAssociations,
+} from "@/platform/fileTypes";
+import { GlobListEditor, Row } from "../components/Form";
+import { useSetting } from "../components/context";
+import styles from "./FileTypes.module.css";
+
+function useLanguages(): LanguageInfo[] {
+ const [langs, setLangs] = useState<LanguageInfo[]>([]);
+ useEffect(() => {
+ if (!isTauri()) return;
+ let live = true;
+ void commands
+ .languages()
+ .then((list) => live && setLangs([...list].sort((a, b) => a.name.localeCompare(b.name))))
+ .catch(() => {});
+ return () => {
+ live = false;
+ };
+ }, []);
+ return langs;
+}
+
+/** Applies an edited pattern list as additions / removals (a pattern moves between languages). */
+export function applyPatternEdit(
+ assoc: FileTypeAssociations,
+ langs: readonly LanguageInfo[],
+ lang: LanguageInfo,
+ next: readonly string[],
+): FileTypeAssociations {
+ const before = effectivePatterns(lang, assoc).map((p) => p.pattern);
+ let out = assoc;
+ for (const p of before) if (!next.includes(p)) out = removePattern(out, lang, p);
+ for (const p of next) if (!before.includes(p)) out = addPattern(out, langs, lang.id, p);
+ return out;
+}
+
+export function RecognizedFileTypes() {
+ const langs = useLanguages();
+ const [assoc, setAssoc] = useSetting<FileTypeAssociations>("files.fileTypes");
+ const [filter, setFilter] = useState("");
+ const [selectedId, setSelectedId] = useState<string | null>(null);
+ const shown = useMemo(() => {
+ const q = filter.trim().toLowerCase();
+ return q
+ ? langs.filter(
+ (l) =>
+ l.name.toLowerCase().includes(q) ||
+ effectivePatterns(l, assoc ?? {}).some((p) => p.pattern.toLowerCase().includes(q)),
+ )
+ : langs;
+ }, [langs, filter, assoc]);
+ const selected = langs.find((l) => l.id === selectedId) ?? shown[0] ?? null;
+ if (!isTauri()) return null;
+ const current = assoc ?? {};
+ const patterns = selected ? effectivePatterns(selected, current).map((p) => p.pattern) : [];
+ const hashbangs = selected ? (current[selected.id]?.hashbangs ?? []) : [];
+
+ return (
+ <div className={styles.fileTypes}>
+ <div className={styles.types}>
+ <Input
+ className={styles.filter}
+ value={filter}
+ placeholder="Filter file types"
+ aria-label="Filter file types"
+ onChange={(e) => setFilter(e.target.value)}
+ />
+ <div className={styles.typeList} role="listbox" aria-label="Recognized file types">
+ {shown.map((l) => {
+ const sample = sampleFileName(l);
+ return (
+ <button
+ key={l.id}
+ type="button"
+ role="option"
+ aria-selected={l.id === selected?.id}
+ className={clsx(styles.type, l.id === selected?.id && styles.typeSelected)}
+ onClick={() => setSelectedId(l.id)}
+ >
+ <Icon name={sample ? fileIconName(sample) : "file-text"} size={16} />
+ <span className={styles.typeName}>{l.name}</span>
+ {current[l.id] && <span className={styles.modified}>modified</span>}
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ {selected && (
+ <div className={styles.patterns}>
+ <Row label="File name patterns" stacked hint="* matches any characters, ? one (e.g. *.foo, Jenkinsfile).">
+ <GlobListEditor
+ value={patterns}
+ onChange={(next) => setAssoc(applyPatternEdit(current, langs, selected, next))}
+ placeholder="*.ext"
+ aria-label={`File name patterns of ${selected.name}`}
+ />
+ </Row>
+ <Row
+ label="Hashbang patterns"
+ stacked
+ hint="Interpreters run by a #! first line, e.g. node for #!/usr/bin/env node."
+ >
+ <GlobListEditor
+ value={hashbangs}
+ onChange={(next) => setAssoc(setHashbangs(current, selected.id, next))}
+ placeholder="interpreter"
+ aria-label={`Hashbang patterns of ${selected.name}`}
+ />
+ </Row>
+ {selected.firstLine && (
+ <div className={styles.note}>
+ <T>Also recognized by its first line:</T> <code className={styles.code}>{selected.firstLine}</code>
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/src/features/settings/pages/builtins.tsx b/src/features/settings/pages/builtins.tsx
index 48db92996..3904f2a53 100644
--- a/src/features/settings/pages/builtins.tsx
+++ b/src/features/settings/pages/builtins.tsx
@@ -2,6 +2,7 @@
import { GlobListEditor, Row } from "../components/Form";
import { useSetting } from "../components/context";
import { KeymapPage, keymapSearchLabels } from "../keymap/KeymapPage";
+import { RecognizedFileTypes } from "./FileTypes";
import type { PageSpec } from "./spec";
export { APPEARANCE_GROUP } from "./behavior";
@@ -48,8 +49,19 @@ export const BUILTIN_PAGES: PageSpec[] = [
group: EDITOR_GROUP,
order: 29,
projectScope: true,
- keywords: ["ignore", "ignored", "excluded", "glob", "exclude patterns"],
+ keywords: ["ignore", "ignored", "excluded", "glob", "exclude patterns", "associate", "association", "extension"],
sections: [
+ {
+ title: "Recognized File Types",
+ options: [
+ {
+ kind: "custom",
+ label: "File name patterns",
+ keywords: ["Hashbang patterns", "file type", "language"],
+ component: RecognizedFileTypes,
+ },
+ ],
+ },
{
title: "Ignored Files and Folders",
options: [
diff --git a/src/features/settings/pages/editor/CodeStyle.module.css b/src/features/settings/pages/editor/CodeStyle.module.css
new file mode 100644
index 000000000..353f21703
--- /dev/null
+++ b/src/features/settings/pages/editor/CodeStyle.module.css
@@ -0,0 +1,40 @@
+.page {
+ display: flex;
+ flex-direction: column;
+ max-width: 760px;
+}
+
+.scheme {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.tabs {
+ display: flex;
+ gap: 4px;
+ margin: 8px 0 4px;
+ border-bottom: 1px solid var(--border);
+}
+
+.tab {
+ height: 26px;
+ padding: 0 10px;
+ border: none;
+ border-bottom: 2px solid transparent;
+ background: none;
+ color: var(--fg-secondary);
+ font: inherit;
+ cursor: default;
+}
+.tab:hover {
+ color: var(--fg);
+}
+.tabOn {
+ color: var(--fg);
+ border-bottom-color: var(--accent);
+}
+.tab:focus-visible {
+ outline: none;
+ box-shadow: inset 0 0 0 1px var(--accent);
+}
diff --git a/src/features/settings/pages/editor/Inspections.module.css b/src/features/settings/pages/editor/Inspections.module.css
new file mode 100644
index 000000000..dcde60517
--- /dev/null
+++ b/src/features/settings/pages/editor/Inspections.module.css
@@ -0,0 +1,123 @@
+.page {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ min-height: 420px;
+}
+.profileRow {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ min-height: 30px;
+ margin-bottom: 8px;
+}
+.profileSelect {
+ min-width: 220px;
+}
+.toolbar {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+ margin-bottom: 6px;
+}
+.search {
+ flex: 1;
+ max-width: 320px;
+ margin-right: 4px;
+}
+.split {
+ flex: 1;
+ min-height: 0;
+ display: flex;
+ gap: 12px;
+}
+.treeWrap {
+ flex: 3;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ border-radius: var(--radius-small);
+ box-shadow: inset 0 0 0 1px var(--border);
+ padding: 2px 0;
+}
+.empty {
+ padding: 8px 12px;
+ color: var(--fg-subtle);
+}
+.row {
+ flex: 1;
+ min-width: 0;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding-right: 8px;
+}
+.name {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.groupName {
+ font-weight: 600;
+}
+.off {
+ color: var(--fg-subtle);
+}
+.level {
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+ white-space: nowrap;
+}
+.check {
+ display: inline-flex;
+ flex: none;
+}
+.details {
+ flex: 2;
+ min-width: 0;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ padding: 2px 4px;
+ overflow: auto;
+}
+.description {
+ margin: 0;
+ color: var(--fg);
+ line-height: 1.5;
+ white-space: pre-wrap;
+ overflow-wrap: anywhere;
+}
+.severityRow {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding-top: 10px;
+ border-top: 1px solid var(--border);
+}
+.levelSelect {
+ min-width: 160px;
+}
+.profileLevel {
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+}
+.nameBody {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 14px;
+}
+.nameRow {
+ display: grid;
+ grid-template-columns: 60px minmax(0, 1fr);
+ align-items: center;
+ gap: 8px;
+}
+.nameError {
+ color: var(--danger);
+ font-size: var(--fs-small);
+ padding-left: 68px;
+}
diff --git a/src/features/settings/pages/editor/codeStyle.tsx b/src/features/settings/pages/editor/codeStyle.tsx
index 3b79ee85f..af2b8c417 100644
--- a/src/features/settings/pages/editor/codeStyle.tsx
+++ b/src/features/settings/pages/editor/codeStyle.tsx
@@ -3,7 +3,9 @@
* `languages/*.toml`) and Editor › File Encodings. Indentation feeds the
* editor's effective indent (EditorConfig › detected › language override ›
* language definition › Other File Types); line separator and encodings feed
- * new-file creation in the backend (`ide-workspace::FileDefaults`).
+ * new-file creation in the backend (`ide-workspace::FileDefaults`). The
+ * Scheme (Default / Project) is the scope these pages share; the Formatter tab
+ * feeds `platform/formatGuard`.
*/
import { useId, useState } from "react";
import { Button, Checkbox, Input, type SelectOption, T } from "@/ui";
@@ -12,7 +14,8 @@ import { ENCODING_CHOICES, lineCommentDefaults, type LanguageCodeStyle } from "@
import { NumberInput, Row } from "../../components/Form";
import { useSetting } from "../../components/context";
import type { PageSpec } from "../spec";
-import { editorPage } from "./kit";
+import { CODE_STYLE_SCOPE, CodeStyleMain, SchemeRow, formatterLabels } from "./codeStyleScheme";
+import { editorPage, sectionLabels, type EditorSection } from "./kit";
import styles from "./Editor.module.css";
function VisualGuidesRow() {
@@ -53,13 +56,7 @@ const LINE_SEPARATORS: SelectOption[] = [
{ value: "cr", label: "Classic Mac OS (\\r)" },
];
-const CODE_STYLE = editorPage({
- id: "editor.codeStyle",
- title: "Code Style",
- order: 24,
- projectScope: true,
- keywords: ["indent", "indentation", "tabs", "line separator", "editorconfig", "right margin"],
- sections: [
+const GENERAL_SECTIONS: EditorSection[] = [
{
items: [
{
@@ -94,25 +91,41 @@ const CODE_STYLE = editorPage({
},
],
},
- ],
-});
+];
-const OTHER = editorPage({
- id: "editor.codeStyle.other",
- title: "Other File Types",
- order: 1000,
- projectScope: true,
- keywords: ["tab size", "indent"],
- sections: [
- {
- title: "Tabs and Indents",
+/** Shared by Code Style and its sub-pages: the scheme is one scope. */
+const SCHEME_SCOPE = { projectScope: true, scopeGroup: CODE_STYLE_SCOPE, ownScopeSwitch: true } as const;
+
+const CODE_STYLE: PageSpec = {
+ id: "editor.codeStyle",
+ title: "Code Style",
+ group: "Editor",
+ order: 24,
+ ...SCHEME_SCOPE,
+ keywords: ["indent", "indentation", "tabs", "line separator", "editorconfig", "right margin", "scheme", "formatter"],
+ component: () => <CodeStyleMain general={GENERAL_SECTIONS} />,
+ dynamicLabels: () => [...sectionLabels(GENERAL_SECTIONS), ...formatterLabels()],
+};
+
+const OTHER = {
+ ...editorPage({
+ id: "editor.codeStyle.other",
+ title: "Other File Types",
+ order: 1000,
+ keywords: ["tab size", "indent"],
+ sections: [
+ { items: [{ t: "custom", label: "Scheme", component: SchemeRow }] },
+ {
+ title: "Tabs and Indents",
items: [
- { t: "check", key: "editor.insertSpaces", label: "Use tab character", invert: true },
- { t: "number", key: "editor.tabSize", label: "Tab size", min: 1, max: 16 },
- ],
- },
- ],
-});
+ { t: "check", key: "editor.insertSpaces", label: "Use tab character", invert: true },
+ { t: "number", key: "editor.tabSize", label: "Tab size", min: 1, max: 16 },
+ ],
+ },
+ ],
+ }),
+ ...SCHEME_SCOPE,
+};
/** Tabs and Indents of one language: overrides on top of the language definition. */
function LanguageStyle({ lang }: { lang: LanguageInfo }) {
@@ -141,6 +154,7 @@ function LanguageStyle({ lang }: { lang: LanguageInfo }) {
};
return (
<div className={styles.page}>
+ <SchemeRow />
<section aria-label="Tabs and Indents">
<div className={styles.previewTitle}>
<T>Tabs and Indents</T>
@@ -231,8 +245,8 @@ export async function codeStyleLanguagePages(): Promise<PageSpec[]> {
title: lang.name,
group: "Editor",
order: 100,
- projectScope: true,
- keywords: ["Tabs and Indents", "Tab size", "Indent", "Use tab character", "Hard wrap at", "Comment Code", "Line comment at first column"],
+ ...SCHEME_SCOPE,
+ keywords: ["Scheme", "Tabs and Indents", "Tab size", "Indent", "Use tab character", "Hard wrap at", "Comment Code", "Line comment at first column"],
component: () => <LanguageStyle lang={lang} />,
}));
}
diff --git a/src/features/settings/pages/editor/codeStyleScheme.tsx b/src/features/settings/pages/editor/codeStyleScheme.tsx
new file mode 100644
index 000000000..e142efbbc
--- /dev/null
+++ b/src/features/settings/pages/editor/codeStyleScheme.tsx
@@ -0,0 +1,149 @@
+/**
+ * Code Style › Scheme (IDEA's Default = IDE-level, Project = stored in the
+ * project) and the Formatter tab. The scheme is the scope shared by Code Style
+ * and its language pages (`scopeGroup`); "Copy to Project" / "Copy to IDE"
+ * stage every Code Style value in the other scope.
+ */
+import { useState } from "react";
+import clsx from "clsx";
+import { Button, T, type SelectOption } from "@/ui";
+import { useProject } from "@/platform/project";
+import { GlobListEditor, Row, Select } from "../../components/Form";
+import { usePageContext, useSetting } from "../../components/context";
+import { setPageScope, stage, stagedValue, useSettingsDialog, type Scope } from "../../model/staging";
+import { EditorSections, sectionLabels, type EditorSection } from "./kit";
+import styles from "./CodeStyle.module.css";
+
+export const CODE_STYLE_SCOPE = "editor.codeStyle";
+
+/** What a Code Style scheme holds. */
+export const CODE_STYLE_KEYS = [
+ "editor.tabSize",
+ "editor.insertSpaces",
+ "editor.codeStyle.lineSeparator",
+ "editor.codeStyle.hardWrapAt",
+ "editor.codeStyle.visualGuides",
+ "editor.codeStyle.detectIndents",
+ "editor.codeStyle.editorconfig",
+ "editor.codeStyle.languages",
+ "editor.codeStyle.doNotFormat",
+ "editor.codeStyle.formatterTagsEnabled",
+ "editor.codeStyle.formatterOffTag",
+ "editor.codeStyle.formatterOnTag",
+ "editor.codeStyle.formatterTagsRegexp",
+] as const;
+
+/** Stages the `from` scheme's values in the `to` scheme (`page` owns the staged edits). */
+export function copyScheme(page: string, from: Scope, to: Scope) {
+ const s = useSettingsDialog.getState();
+ for (const key of CODE_STYLE_KEYS) {
+ const value = stagedValue(s, from, key);
+ if (value !== undefined) stage(page, to, key, value);
+ }
+}
+
+export function SchemeRow() {
+ const { pageId, scope } = usePageContext();
+ const hasProject = useProject((s) => !!s.project);
+ const newProjects = useSettingsDialog((s) => s.newProjects);
+ const canProject = hasProject && !newProjects;
+ const options: SelectOption<Scope>[] = [
+ { value: "global", label: "Default (IDE)" },
+ ...(canProject ? [{ value: "project" as const, label: "Project" }] : []),
+ ];
+ const other: Scope = scope === "global" ? "project" : "global";
+ return (
+ <Row
+ label="Scheme"
+ hint={
+ scope === "project" ? "Stored in the project." : "Stored in the IDE; used by projects without their own scheme."
+ }
+ >
+ <span className={styles.scheme}>
+ <Select<Scope>
+ value={scope}
+ options={options}
+ onChange={(v) => setPageScope(CODE_STYLE_SCOPE, v)}
+ aria-label="Scheme"
+ />
+ {canProject && (
+ <Button
+ size="small"
+ onClick={() => {
+ copyScheme(pageId, scope, other);
+ setPageScope(CODE_STYLE_SCOPE, other);
+ }}
+ >
+ <T>{scope === "global" ? "Copy to Project" : "Copy to IDE"}</T>
+ </Button>
+ )}
+ </span>
+ </Row>
+ );
+}
+
+function DoNotFormatRow() {
+ const [globs, setGlobs] = useSetting<string[]>("editor.codeStyle.doNotFormat");
+ return (
+ <Row label="Do not format" stacked hint="File name patterns and folders (glob), e.g. *.min.js, generated/**.">
+ <GlobListEditor value={globs ?? []} onChange={setGlobs} placeholder="*.min.js" aria-label="Do not format" />
+ </Row>
+ );
+}
+
+export const FORMATTER_SECTIONS: EditorSection[] = [
+ {
+ items: [
+ { t: "custom", label: "Do not format", keywords: ["glob", "exclude from formatting"], component: DoNotFormatRow },
+ {
+ t: "check",
+ key: "editor.codeStyle.formatterTagsEnabled",
+ label: "Turn formatter on/off with markers in code comments",
+ children: [
+ { t: "text", key: "editor.codeStyle.formatterOffTag", label: "Off", placeholder: "@formatter:off" },
+ { t: "text", key: "editor.codeStyle.formatterOnTag", label: "On", placeholder: "@formatter:on" },
+ {
+ t: "check",
+ key: "editor.codeStyle.formatterTagsRegexp",
+ label: "Enable regular expressions in formatter markers",
+ },
+ ],
+ },
+ ],
+ },
+];
+
+type Tab = "general" | "formatter";
+
+/** Code Style: Scheme, then the General / Formatter tabs. */
+export function CodeStyleMain({ general }: { general: EditorSection[] }) {
+ const [tab, setTab] = useState<Tab>("general");
+ const tabs: Array<[Tab, string]> = [
+ ["general", "General"],
+ ["formatter", "Formatter"],
+ ];
+ return (
+ <div className={styles.page}>
+ <SchemeRow />
+ <div className={styles.tabs} role="tablist" aria-label="Code Style">
+ {tabs.map(([id, label]) => (
+ <button
+ key={id}
+ type="button"
+ role="tab"
+ aria-selected={tab === id}
+ className={clsx(styles.tab, tab === id && styles.tabOn)}
+ onClick={() => setTab(id)}
+ >
+ <T>{label}</T>
+ </button>
+ ))}
+ </div>
+ <div role="tabpanel">
+ <EditorSections sections={tab === "general" ? general : FORMATTER_SECTIONS} />
+ </div>
+ </div>
+ );
+}
+
+export const formatterLabels = () => ["Scheme", "Formatter", ...sectionLabels(FORMATTER_SECTIONS)];
diff --git a/src/features/settings/pages/editor/general.tsx b/src/features/settings/pages/editor/general.tsx
index 369b86527..eb1cf7f80 100644
--- a/src/features/settings/pages/editor/general.tsx
+++ b/src/features/settings/pages/editor/general.tsx
@@ -5,10 +5,11 @@
* Editing and Inlay Hints. Every option is read by `editor/core` or
* `editor/lsp` through `platform/editorSettings`.
*/
-import { useEffect, useState } from "react";
+import { useEffect, useId, useState } from "react";
+import clsx from "clsx";
import { commands, isTauri } from "@/platform/ipc";
import { Checkbox } from "@/ui";
-import { SearchLabel } from "../../components/Form";
+import { SearchLabel, Select } from "../../components/Form";
import { useLabelMatch, useSetting } from "../../components/context";
import { editorPage, type Item } from "./kit";
import styles from "./Editor.module.css";
@@ -79,6 +80,13 @@ function InlayLanguages() {
return <LanguageChecks k={`${P}.inlay.disabledLanguages`} label="Show inlay hints for:" disabled={!on} />;
}
+function InlineCompletionLanguages() {
+ const [on] = useSetting<boolean>(`${P}.inlineCompletion.enabled`);
+ return (
+ <LanguageChecks k={`${P}.inlineCompletion.disabledLanguages`} label="Show inline completion for:" disabled={!on} />
+ );
+}
+
const GENERAL = editorPage({
id: "editor.general",
title: "General",
@@ -273,7 +281,7 @@ const COMPLETION = editorPage({
id: "editor.general.codeCompletion",
title: "Code Completion",
order: 3,
- keywords: ["autocomplete", "suggestions", "case sensitive", "parameter info"],
+ keywords: ["autocomplete", "suggestions", "case sensitive", "parameter info", "popup", "sort", "parentheses"],
sections: [
{
items: [
@@ -290,11 +298,29 @@ const COMPLETION = editorPage({
],
},
},
- { t: "check", key: `${P}.completion.autoPopup`, label: "Show suggestions as you type" },
{
t: "check",
- key: `${P}.completion.insertOnSpecialKeys`,
- label: "Insert selected suggestion by pressing space, dot, or other context-dependent keys",
+ key: `${P}.completion.autoInsertSingle`,
+ label: "Automatically insert single suggestions",
+ hint: "When Basic Completion (⌃Space) finds only one suggestion.",
+ },
+ {
+ t: "check",
+ key: `${P}.completion.sortAlphabetically`,
+ label: "Sort suggestions alphabetically",
+ hint: "Also toggled by Sort by name in the completion popup.",
+ },
+ {
+ t: "check",
+ key: `${P}.completion.autoPopup`,
+ label: "Show suggestions as you type",
+ children: [
+ {
+ t: "check",
+ key: `${P}.completion.insertOnSpecialKeys`,
+ label: "Insert selected suggestion by pressing space, dot, or other context-dependent keys",
+ },
+ ],
},
{
t: "check",
@@ -302,6 +328,12 @@ const COMPLETION = editorPage({
label: "Show the documentation popup in",
inline: ms(`${P}.completion.documentationDelay`),
},
+ {
+ t: "check",
+ key: `${P}.completion.insertParentheses`,
+ label: "Insert parentheses automatically when applicable",
+ hint: "Function and method suggestions get (); the caret goes inside unless there are no parameters.",
+ },
],
},
{
@@ -347,7 +379,7 @@ const TABS = editorPage({
id: "editor.general.editorTabs",
title: "Editor Tabs",
order: 5,
- keywords: ["tab limit", "preview tab", "close button"],
+ keywords: ["tab limit", "preview tab", "close button", "pinned", "squeeze", "rows"],
sections: [
{
title: "Appearance",
@@ -358,19 +390,41 @@ const TABS = editorPage({
label: "Tab placement",
options: [
{ value: "top", label: "Top" },
+ { value: "bottom", label: "Bottom" },
+ { value: "left", label: "Left" },
+ { value: "right", label: "Right" },
{ value: "none", label: "None" },
],
},
- { t: "check", key: `${P}.tabs.multipleRows`, label: "Show tabs in multiple rows" },
+ {
+ t: "custom",
+ label: "Show tabs in:",
+ keywords: ["One row", "Scroll the tabs panel", "Squeeze tabs", "Multiple rows"],
+ component: TabRows,
+ },
+ { t: "check", key: `${P}.tabs.pinnedSeparateRow`, label: "Show pinned tabs in a separate row" },
+ { t: "check", key: `${P}.tabs.showFileIcon`, label: "Show file icon" },
{ t: "check", key: `${P}.tabs.showExtension`, label: "Show file extension" },
+ {
+ t: "check",
+ key: `${P}.tabs.showDirectoryForNonUnique`,
+ label: "Show directory for non-unique file names",
+ },
{ t: "check", key: `${P}.tabs.markModified`, label: "Mark modified (*)" },
- { t: "check", key: `${P}.tabs.showCloseButton`, label: "Show close button" },
+ { t: "check", key: `${P}.tabs.showFullPathOnHover`, label: "Show full path on mouse hover" },
+ { t: "custom", label: "Close button position:", keywords: ["Right", "Left", "None"], component: CloseButtonPosition },
],
},
{
- title: "Opening Policy",
+ title: "Tab Order",
items: [
+ { t: "check", key: `${P}.tabs.sortAlphabetically`, label: "Sort tabs alphabetically" },
{ t: "check", key: `${P}.tabs.openAtEnd`, label: "Open new tabs at the end" },
+ ],
+ },
+ {
+ title: "Opening Policy",
+ items: [
{ t: "check", key: `${P}.tabs.previewTab`, label: "Enable preview tab" },
],
},
@@ -402,6 +456,67 @@ const TABS = editorPage({
],
});
+/** Show tabs in: one row (scroll or squeeze when they don't fit) or multiple rows. */
+function TabRows() {
+ const [multiple, setMultiple] = useSetting<boolean>(`${P}.tabs.multipleRows`);
+ const [overflow, setOverflow] = useSetting<string>(`${P}.tabs.oneRowOverflow`);
+ const [placement] = useSetting<string>(`${P}.tabs.placement`);
+ const matched = useLabelMatch("Show tabs in:");
+ const name = useId();
+ // Vertical (left / right) tabs always scroll in one column.
+ const disabled = placement === "none" || placement === "left" || placement === "right";
+ const radio = (label: string, checked: boolean, onChange: () => void, off = disabled) => (
+ <label className={clsx(styles.radio, off && styles.dim)}>
+ <input type="radio" name={name} checked={checked} disabled={off} onChange={onChange} />
+ <SearchLabel text={label} />
+ </label>
+ );
+ return (
+ <div className={clsx(styles.radioBlock, matched && styles.matched)} role="radiogroup" aria-label="Show tabs in">
+ <div className={clsx(styles.radioLabel, disabled && styles.dim)}>
+ <SearchLabel text="Show tabs in" />:
+ </div>
+ <div className={styles.radios}>
+ {radio("One row, and if tabs don't fit:", !multiple, () => setMultiple(false))}
+ <div className={styles.children} role="radiogroup" aria-label="If tabs don't fit">
+ {radio("Scroll the tabs panel", !multiple && overflow !== "squeeze", () => setOverflow("scroll"), disabled || multiple)}
+ {radio("Squeeze tabs", !multiple && overflow === "squeeze", () => setOverflow("squeeze"), disabled || multiple)}
+ </div>
+ {radio("Multiple rows", multiple, () => setMultiple(true))}
+ </div>
+ </div>
+ );
+}
+
+const CLOSE_POSITIONS = [
+ { value: "right", label: "Right" },
+ { value: "left", label: "Left" },
+ { value: "none", label: "None" },
+];
+
+/** Close button position: `showCloseButton` off is "None", else `closeButtonPosition`. */
+function CloseButtonPosition() {
+ const [show, setShow] = useSetting<boolean>(`${P}.tabs.showCloseButton`);
+ const [position, setPosition] = useSetting<string>(`${P}.tabs.closeButtonPosition`);
+ const matched = useLabelMatch("Close button position:");
+ return (
+ <div className={clsx(styles.check, matched && styles.matched)}>
+ <span>
+ <SearchLabel text="Close button position:" />
+ </span>
+ <Select
+ value={show ? (position === "left" ? "left" : "right") : "none"}
+ options={CLOSE_POSITIONS}
+ aria-label="Close button position"
+ onChange={(v) => {
+ setShow(v !== "none");
+ if (v !== "none") setPosition(v);
+ }}
+ />
+ </div>
+ );
+}
+
const GUTTER = editorPage({
id: "editor.general.gutterIcons",
title: "Gutter Icons",
@@ -515,6 +630,40 @@ const SMART_KEYS = editorPage({
],
});
+const INLINE_COMPLETION = editorPage({
+ id: "editor.general.inlineCompletion",
+ title: "Inline Completion",
+ order: 7,
+ keywords: ["ghost text", "inline suggestions", "full line completion", "copilot"],
+ sections: [
+ {
+ items: [
+ {
+ t: "note",
+ text: "Gray suggestions at the caret from language servers that support inline completion. Tab accepts a suggestion, Escape dismisses it.",
+ },
+ {
+ t: "check",
+ key: `${P}.inlineCompletion.enabled`,
+ label: "Enable inline completion",
+ children: [
+ {
+ t: "check",
+ key: `${P}.inlineCompletion.onlyOnPause`,
+ label: "Show only when typing pauses for",
+ inline: ms(`${P}.inlineCompletion.pauseMs`, 3000),
+ },
+ ],
+ },
+ ],
+ },
+ {
+ title: "Languages",
+ items: [{ t: "custom", label: "Show inline completion for:", component: InlineCompletionLanguages }],
+ },
+ ],
+});
+
const STICKY = editorPage({
id: "editor.general.stickyLines",
title: "Sticky Lines",
@@ -603,7 +752,13 @@ const INLAY_HINTS = editorPage({
keywords: ["hints", "code vision", "usages", "parameter hints", "type hints"],
sections: [
{ items: INLAY },
- { title: "Code Vision", items: [{ t: "check", key: `${P}.inlay.codeVisionUsages`, label: "Usages" }] },
+ {
+ title: "Code Vision",
+ items: [
+ { t: "check", key: `${P}.inlay.codeVisionUsages`, label: "Usages" },
+ { t: "check", key: `${P}.inlay.codeVisionAuthor`, label: "Code author" },
+ ],
+ },
{ title: "Languages", items: [{ t: "custom", label: "Show inlay hints for:", component: InlayLanguages }] },
],
});
@@ -617,6 +772,7 @@ export const GENERAL_PAGES = [
FOLDING,
TABS,
GUTTER,
+ INLINE_COMPLETION,
RICH_COPY,
SMART_KEYS,
STICKY,
diff --git a/src/features/settings/pages/editor/index.ts b/src/features/settings/pages/editor/index.ts
index 44ecae364..0b4b51e1b 100644
--- a/src/features/settings/pages/editor/index.ts
+++ b/src/features/settings/pages/editor/index.ts
@@ -1,10 +1,20 @@
-/** Settings › Editor pages (General and sub-pages, Code Editing, Font, Color Scheme, Code Style, File Encodings, Inlay Hints). */
+/** Settings › Editor pages (General and sub-pages, Code Editing, Font, Color Scheme, Code Style, Inspections, Natural Languages › Spelling, File Encodings, Inlay Hints). */
import type { PageSpec } from "../spec";
import { GENERAL_PAGES } from "./general";
import { FONT_PAGE } from "./font";
import { COLOR_SCHEME_PAGE } from "./colorScheme";
import { CODE_STYLE_PAGES } from "./codeStyle";
+import { INSPECTIONS_PAGE } from "./inspections";
+import { NATURAL_LANGUAGES_PAGE, SPELLING_PAGE } from "./spelling";
export { codeStyleLanguagePages } from "./codeStyle";
-export const EDITOR_PAGES: PageSpec[] = [...GENERAL_PAGES, FONT_PAGE, COLOR_SCHEME_PAGE, ...CODE_STYLE_PAGES];
+export const EDITOR_PAGES: PageSpec[] = [
+ ...GENERAL_PAGES,
+ FONT_PAGE,
+ COLOR_SCHEME_PAGE,
+ ...CODE_STYLE_PAGES,
+ INSPECTIONS_PAGE,
+ NATURAL_LANGUAGES_PAGE,
+ SPELLING_PAGE,
+];
diff --git a/src/features/settings/pages/editor/inspections.tsx b/src/features/settings/pages/editor/inspections.tsx
new file mode 100644
index 000000000..926a37bb3
--- /dev/null
+++ b/src/features/settings/pages/editor/inspections.tsx
@@ -0,0 +1,449 @@
+/**
+ * Editor › Inspections: IDEA's inspection profile editor. `Default` is stored
+ * in the IDE settings, `Project Default` in the project; copies (gear menu:
+ * Duplicate / Copy to IDE·Project / Rename / Delete) at either level. The
+ * chosen one is in effect for the project (editor highlighting, Problems,
+ * Inspect Code).
+ */
+import { useEffect, useId, useMemo, useState, type MouseEvent } from "react";
+import clsx from "clsx";
+import { commands, isTauri } from "@/platform/ipc";
+import {
+ copyProfileName,
+ effectiveProfileId,
+ listProfiles,
+ overridesOf,
+ profileLabel,
+ profileLocation,
+ seenDiagnosticCodes,
+ validateProfileName,
+ type CustomProfiles,
+ type InspectionLevel,
+ type InspectionSettingsValid,
+ type ProfileId,
+ type ProfileLevel,
+ type ProfileOverrides,
+} from "@/platform/inspections";
+import { confirm } from "@/workbench/messages";
+import {
+ Checkbox,
+ Dialog,
+ IconButton,
+ Input,
+ SearchField,
+ Select,
+ T,
+ Tree,
+ showContextMenu,
+ type MenuItem,
+} from "@/ui";
+import { useSetting } from "../../components/context";
+import { useSettingsDialog } from "../../model/staging";
+import { useProject } from "@/platform/project";
+import type { PageSpec } from "../spec";
+import {
+ AS_REPORTED,
+ INSPECTION_KEYWORDS,
+ LEVEL_OPTIONS,
+ buildInspectionTree,
+ checkState,
+ copyProfile,
+ deleteProfile,
+ filterInspectionTree,
+ isEnabled,
+ setEnabled,
+ renameProfile,
+ setLevel,
+ withProfileOverrides,
+ type InspectionNode,
+ type LanguageServers,
+} from "./inspectionsModel";
+import styles from "./Inspections.module.css";
+
+let languagesCache: LanguageServers[] | null = null;
+
+async function loadLanguages(): Promise<LanguageServers[]> {
+ if (languagesCache) return languagesCache;
+ if (!isTauri()) return [];
+ const list = await commands.languages();
+ languagesCache = list.map((l) => ({ name: l.name, servers: l.languageServers ?? [] }));
+ return languagesCache;
+}
+
+function useLanguages(): LanguageServers[] {
+ const [langs, setLangs] = useState<LanguageServers[]>(() => languagesCache ?? []);
+ useEffect(() => {
+ let alive = true;
+ void loadLanguages().then(
+ (l) => alive && setLangs(l),
+ () => {},
+ );
+ return () => {
+ alive = false;
+ };
+ }, []);
+ return langs;
+}
+
+function expandableKeys(nodes: readonly InspectionNode[], out = new Set<string>()): Set<string> {
+ for (const n of nodes) {
+ if (n.children.length) out.add(n.key);
+ expandableKeys(n.children, out);
+ }
+ return out;
+}
+
+function InspectionsPage() {
+ const hasProject = useProject((s) => !!s.project);
+ const newProjects = useSettingsDialog((s) => s.newProjects);
+ const projectAvailable = hasProject && !newProjects;
+ const [chosen, setChosen] = useSetting<ProfileId>("inspections.profile", "project");
+ const [ideOverrides, setIde] = useSetting<ProfileOverrides>("inspections.default", "global");
+ const [projectOverrides, setProject] = useSetting<ProfileOverrides>("inspections.project", "project");
+ const [ideProfiles, setIdeProfiles] = useSetting<CustomProfiles>("inspections.ideProfiles", "global");
+ const [projectProfiles, setProjectProfiles] = useSetting<CustomProfiles>("inspections.projectProfiles", "project");
+ const settings: InspectionSettingsValid = {
+ profile: chosen,
+ default: ideOverrides,
+ project: projectOverrides,
+ ideProfiles,
+ projectProfiles,
+ };
+ const profileId = effectiveProfileId(settings, projectAvailable);
+ const location = profileLocation(profileId);
+ const overrides = overridesOf(settings, profileId);
+ const [nameDialog, setNameDialog] = useState<NameDialogState | null>(null);
+
+ /** Stages the parts of `next` that changed. */
+ const apply = (next: InspectionSettingsValid) => {
+ if (next.default !== settings.default) setIde(next.default);
+ if (next.project !== settings.project) setProject(next.project);
+ if (next.ideProfiles !== settings.ideProfiles) setIdeProfiles(next.ideProfiles);
+ if (next.projectProfiles !== settings.projectProfiles) setProjectProfiles(next.projectProfiles);
+ if (next.profile !== settings.profile) setChosen(next.profile);
+ };
+ const setOverrides = (o: ProfileOverrides) => apply(withProfileOverrides(settings, profileId, o));
+
+ const languages = useLanguages();
+ const seen = useMemo(() => seenDiagnosticCodes(), []);
+ const tree = useMemo(
+ () => buildInspectionTree(languages, seen, [ideOverrides, projectOverrides]),
+ [languages, seen, ideOverrides, projectOverrides],
+ );
+ const [query, setQuery] = useState("");
+ const roots = useMemo(() => filterInspectionTree(tree, query), [tree, query]);
+ const [expandedKeys, setExpandedKeys] = useState<Set<string>>(() => new Set());
+ const filtering = !!query.trim();
+ const expanded = useMemo(() => (filtering ? expandableKeys(roots) : expandedKeys), [filtering, roots, expandedKeys]);
+ const [selected, setSelected] = useState<InspectionNode | null>(null);
+
+ const profiles = listProfiles(settings, projectAvailable);
+ const profileOptions = profiles.map((p) => ({
+ value: p.id,
+ label: p.label,
+ detail: p.level === "project" ? "Project" : "IDE",
+ }));
+ const label = profileLabel(settings, profileId);
+ const otherLevel: ProfileLevel = location.level === "project" ? "ide" : "project";
+ const isCopy = location.key !== null;
+
+ const confirmDelete = async () => {
+ if (!(await confirm({ title: "Delete Profile", message: `Delete inspection profile '${label}'?`, ok: "Delete" })))
+ return;
+ apply(deleteProfile(settings, profileId));
+ };
+
+ const gearMenu = (e: MouseEvent<HTMLButtonElement>) => {
+ const r = e.currentTarget.getBoundingClientRect();
+ const items: MenuItem[] = [
+ {
+ label: "Duplicate…",
+ icon: "copy",
+ run: () =>
+ setNameDialog({
+ mode: "copy",
+ level: location.level,
+ initial: copyProfileName(label, location.level, settings),
+ }),
+ },
+ {
+ label: otherLevel === "project" ? "Copy to Project…" : "Copy to IDE…",
+ disabled: otherLevel === "project" && !projectAvailable,
+ run: () =>
+ setNameDialog({
+ mode: "copy",
+ level: otherLevel,
+ initial: validateProfileName(label, otherLevel, settings)
+ ? copyProfileName(label, otherLevel, settings)
+ : label,
+ }),
+ },
+ {
+ label: "Rename…",
+ icon: "edit",
+ disabled: !isCopy,
+ run: () => setNameDialog({ mode: "rename", level: location.level, initial: label }),
+ },
+ { label: "Restore Defaults", icon: "undo", disabled: !Object.keys(overrides).length, run: () => setOverrides({}) },
+ // Default and Project Default cannot be deleted.
+ ...(isCopy
+ ? ([
+ { kind: "separator" },
+ { label: "Delete", icon: "trash", danger: true, run: () => void confirmDelete() },
+ ] satisfies MenuItem[])
+ : []),
+ ];
+ showContextMenu({ x: r.left, y: r.bottom + 2 }, items);
+ };
+
+ return (
+ <div className={styles.page}>
+ <div className={styles.profileRow}>
+ <span>
+ <T>Profile:</T>
+ </span>
+ <Select
+ className={styles.profileSelect}
+ aria-label="Inspection profile"
+ value={profileId}
+ options={profileOptions}
+ onChange={(v) => setChosen(v)}
+ disabled={profileOptions.length < 2}
+ />
+ <IconButton icon="settings" title="Profile Actions" onClick={gearMenu} />
+ <span className={styles.profileLevel}><T>{location.level === "project" ? "Stored in Project" : "Stored in IDE"}</T></span>
+ </div>
+
+ <div className={styles.toolbar}>
+ <SearchField
+ className={styles.search}
+ value={query}
+ onChange={setQuery}
+ placeholder="Search inspections"
+ aria-label="Search inspections"
+ />
+ <IconButton icon="expand-all" title="Expand All" onClick={() => setExpandedKeys(expandableKeys(tree))} />
+ <IconButton icon="collapse-all" title="Collapse All" onClick={() => setExpandedKeys(new Set())} />
+ <IconButton
+ icon="refresh"
+ title="Reset to Default"
+ disabled={!selected?.id || !overrides[selected.id]}
+ onClick={() => {
+ if (!selected?.id) return;
+ const next = { ...overrides };
+ delete next[selected.id];
+ setOverrides(next);
+ }}
+ />
+ </div>
+
+ <div className={styles.split}>
+ <div
+ className={styles.treeWrap}
+ onKeyDown={(e) => {
+ // Space toggles the selected inspection, as in IDEA.
+ if (e.key !== " " || !selected || (e.target as HTMLElement).tagName === "INPUT") return;
+ e.preventDefault();
+ setOverrides(setEnabled(overrides, selected, checkState(overrides, selected) !== "on"));
+ }}
+ >
+ <Tree<InspectionNode>
+ aria-label="Inspections"
+ roots={roots}
+ getKey={(n) => n.key}
+ getLabel={(n) => n.name}
+ getChildren={(n) => (n.children.length ? n.children : undefined)}
+ isExpandable={(n) => n.children.length > 0}
+ expanded={expanded}
+ onExpandedChange={(_set, node, isExpanded) => {
+ if (filtering) return;
+ setExpandedKeys((prev) => {
+ const next = new Set(prev);
+ if (isExpanded) next.add(node.key);
+ else next.delete(node.key);
+ return next;
+ });
+ }}
+ multiSelect={false}
+ speedSearch={false}
+ onSelectionChange={(_sel, node) => setSelected(node)}
+ renderNode={(n) => (
+ <InspectionRow
+ node={n}
+ overrides={overrides}
+ onToggle={(on) => setOverrides(setEnabled(overrides, n, on))}
+ />
+ )}
+ empty={
+ <div className={styles.empty}>
+ <T>Nothing to show</T>
+ </div>
+ }
+ />
+ </div>
+ <Details node={selected} overrides={overrides} onChange={setOverrides} />
+ </div>
+
+ {nameDialog && (
+ <ProfileNameDialog
+ title={nameDialog.mode === "rename" ? "Rename Profile" : "Copy Profile"}
+ initial={nameDialog.initial}
+ validate={(name) =>
+ validateProfileName(name, nameDialog.level, settings, nameDialog.mode === "rename" ? profileId : undefined)
+ }
+ onCancel={() => setNameDialog(null)}
+ onSubmit={(name) => {
+ apply(
+ nameDialog.mode === "rename"
+ ? renameProfile(settings, profileId, name)
+ : copyProfile(settings, profileId, name, nameDialog.level),
+ );
+ setNameDialog(null);
+ }}
+ />
+ )}
+ </div>
+ );
+}
+
+interface NameDialogState {
+ mode: "copy" | "rename";
+ /** Level the (new) profile is stored at. */
+ level: ProfileLevel;
+ initial: string;
+}
+
+function ProfileNameDialog({
+ title,
+ initial,
+ validate,
+ onCancel,
+ onSubmit,
+}: {
+ title: string;
+ initial: string;
+ validate: (name: string) => string | null;
+ onCancel: () => void;
+ onSubmit: (name: string) => void;
+}) {
+ const [name, setName] = useState(initial);
+ const id = useId();
+ const error = validate(name);
+ const submit = () => !error && onSubmit(name.trim());
+ return (
+ <Dialog
+ open
+ onClose={onCancel}
+ title={title}
+ width={380}
+ buttons={[
+ { label: "OK", role: "default", disabled: !!error, onClick: submit },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <div className={styles.nameBody}>
+ <div className={styles.nameRow}>
+ <label htmlFor={id}>
+ <T>Name:</T>
+ </label>
+ <Input
+ id={id}
+ autoFocus
+ value={name}
+ invalid={!!error}
+ onChange={(e) => setName(e.target.value)}
+ onFocus={(e) => e.currentTarget.select()}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ submit();
+ }
+ }}
+ />
+ </div>
+ {error && name.trim() !== "" && <div className={styles.nameError}>{error}</div>}
+ </div>
+ </Dialog>
+ );
+}
+
+function InspectionRow({
+ node,
+ overrides,
+ onToggle,
+}: {
+ node: InspectionNode;
+ overrides: ProfileOverrides;
+ onToggle: (on: boolean) => void;
+}) {
+ const state = checkState(overrides, node);
+ const level = node.id ? overrides[node.id]?.severity : undefined;
+ const levelLabel = level ? LEVEL_OPTIONS.find((o) => o.value === level)?.label : undefined;
+ return (
+ <span className={styles.row}>
+ <span className={clsx(styles.name, !node.id && styles.groupName, state === "off" && styles.off)}>
+ {node.name}
+ </span>
+ {levelLabel && <span className={styles.level}>{levelLabel}</span>}
+ <span className={styles.check}>
+ <Checkbox
+ checked={state === "on"}
+ indeterminate={state === "mixed"}
+ onChange={() => onToggle(state !== "on")}
+ aria-label={`Enable ${node.name}`}
+ />
+ </span>
+ </span>
+ );
+}
+
+function Details({
+ node,
+ overrides,
+ onChange,
+}: {
+ node: InspectionNode | null;
+ overrides: ProfileOverrides;
+ onChange: (o: ProfileOverrides) => void;
+}) {
+ if (!node) {
+ return (
+ <div className={styles.details}>
+ <p className={styles.description}>
+ <T>Select an inspection to see its description and change its severity.</T>
+ </p>
+ </div>
+ );
+ }
+ const id = node.id;
+ return (
+ <div className={styles.details}>
+ <p className={styles.description}>{node.description}</p>
+ {id && (
+ <div className={styles.severityRow}>
+ <span>
+ <T>Severity:</T>
+ </span>
+ <Select
+ className={styles.levelSelect}
+ aria-label="Severity"
+ value={overrides[id]?.severity ?? AS_REPORTED}
+ options={LEVEL_OPTIONS}
+ disabled={!isEnabled(overrides, id)}
+ onChange={(v) => onChange(setLevel(overrides, id, v === AS_REPORTED ? undefined : (v as InspectionLevel)))}
+ />
+ </div>
+ )}
+ </div>
+ );
+}
+
+export const INSPECTIONS_PAGE: PageSpec = {
+ id: "editor.inspections",
+ title: "Inspections",
+ group: "Editor",
+ order: 25,
+ keywords: INSPECTION_KEYWORDS,
+ component: InspectionsPage,
+ dynamicLabels: () => (languagesCache ?? []).flatMap((l) => [l.name, ...l.servers]),
+};
diff --git a/src/features/settings/pages/editor/inspectionsModel.ts b/src/features/settings/pages/editor/inspectionsModel.ts
new file mode 100644
index 000000000..342a3c45a
--- /dev/null
+++ b/src/features/settings/pages/editor/inspectionsModel.ts
@@ -0,0 +1,250 @@
+/**
+ * Editor › Inspections tree: language → language server → diagnostic codes
+ * seen, plus the built-in checks; enabled / severity state against a
+ * profile's overrides (`@/platform/inspections`).
+ */
+import {
+ BUILTIN_INSPECTIONS,
+ INSPECTION_LEVELS,
+ codeInspectionId,
+ customProfileId,
+ newProfileKey,
+ overridesOf,
+ producerInspectionId,
+ profileLocation,
+ type CustomProfile,
+ type InspectionLevel,
+ type InspectionOverride,
+ type InspectionSettingsValid,
+ type ProfileId,
+ type ProfileLevel,
+ type ProfileOverrides,
+ type SeenCode,
+} from "@/platform/inspections";
+
+export interface InspectionNode {
+ /** Unique in the tree (a server serving several languages appears under each). */
+ key: string;
+ /** Inspection id; absent for language / category groups. */
+ id?: string;
+ name: string;
+ description: string;
+ children: InspectionNode[];
+}
+
+export interface LanguageServers {
+ name: string;
+ servers: readonly string[];
+}
+
+const OTHER = "Other";
+
+function serverNode(group: string, server: string, codes: readonly SeenCode[], languages: string): InspectionNode {
+ const id = producerInspectionId(server);
+ return {
+ key: `${group}/${id}`,
+ id,
+ name: server,
+ description: `Problems the ${server} language server reports${languages ? ` in ${languages} files` : ""}. Severity "As reported" keeps the level the server assigns; a code below can override it.`,
+ children: [...codes]
+ .sort((a, b) => a.code.localeCompare(b.code, undefined, { numeric: true }))
+ .map((c) => ({
+ key: `${group}/${codeInspectionId(id, c.code)}`,
+ id: codeInspectionId(id, c.code),
+ name: c.code,
+ description: `${server} problems with code ${c.code}${c.source && c.source !== server ? ` (${c.source})` : ""}.${c.sample ? `\n\nExample: ${c.sample}` : ""}`,
+ children: [],
+ })),
+ };
+}
+
+/**
+ * The inspection tree: one group per language that has language servers, the
+ * built-in checks under their category, and servers known only from seen
+ * diagnostics or stored overrides under "Other". Groups sort by name.
+ */
+export function buildInspectionTree(
+ languages: readonly LanguageServers[],
+ seen: readonly SeenCode[],
+ overrides: readonly ProfileOverrides[] = [],
+): InspectionNode[] {
+ const codes = new Map<string, Map<string, SeenCode>>();
+ const addCode = (c: SeenCode) => {
+ let m = codes.get(c.producer);
+ if (!m) codes.set(c.producer, (m = new Map()));
+ if (!m.has(c.code)) m.set(c.code, c);
+ };
+ seen.forEach(addCode);
+ // Codes with stored overrides stay listed even if not seen in this session.
+ for (const profile of overrides) {
+ for (const id of Object.keys(profile)) {
+ const m = /^lsp:([^:]+):(.+)$/.exec(id);
+ if (m) addCode({ producer: m[1]!, code: m[2]!, source: "", sample: "" });
+ else if (id.startsWith("lsp:") && !codes.has(id.slice(4))) codes.set(id.slice(4), new Map());
+ }
+ }
+ const servedBy = new Map<string, string[]>();
+ for (const l of languages) {
+ for (const s of l.servers) servedBy.set(s, [...(servedBy.get(s) ?? []), l.name]);
+ }
+
+ const groups = new Map<string, InspectionNode>();
+ const group = (name: string) => {
+ let g = groups.get(name);
+ if (!g) groups.set(name, (g = { key: `group:${name}`, name, description: "", children: [] }));
+ return g;
+ };
+ for (const l of languages) {
+ if (!l.servers.length) continue;
+ const g = group(l.name);
+ for (const s of l.servers) {
+ g.children.push(serverNode(l.name, s, [...(codes.get(s)?.values() ?? [])], servedBy.get(s)!.join(", ")));
+ }
+ }
+ const builtinProducers = new Set(BUILTIN_INSPECTIONS.map((b) => b.producer));
+ for (const b of BUILTIN_INSPECTIONS) {
+ group(b.group).children.push({
+ key: `${b.group}/${b.id}`,
+ id: b.id,
+ name: b.name,
+ description: b.description,
+ children: [],
+ });
+ }
+ for (const [producer, list] of codes) {
+ if (servedBy.has(producer) || builtinProducers.has(producer)) continue;
+ group(OTHER).children.push(serverNode(OTHER, producer, [...list.values()], ""));
+ }
+ for (const g of groups.values()) {
+ g.description = `${g.children.length} inspection${g.children.length === 1 ? "" : "s"}.`;
+ }
+ return [...groups.values()].sort((a, b) => a.name.localeCompare(b.name));
+}
+
+/** Nodes whose name, id or description (or an ancestor's name) contain every query word; ancestors kept. */
+export function filterInspectionTree(nodes: readonly InspectionNode[], query: string): InspectionNode[] {
+ const terms = query.toLowerCase().split(/\s+/).filter(Boolean);
+ if (!terms.length) return [...nodes];
+ const walk = (list: readonly InspectionNode[], trail: string): InspectionNode[] =>
+ list.flatMap((n) => {
+ const hay = `${trail} ${n.name} ${n.id ?? ""} ${n.description}`.toLowerCase();
+ if (terms.every((t) => hay.includes(t))) return [n];
+ const children = walk(n.children, `${trail} ${n.name}`);
+ return children.length ? [{ ...n, children }] : [];
+ });
+ return walk(nodes, "");
+}
+
+/** Inspection ids of a node and its descendants. */
+export function inspectionIds(node: InspectionNode): string[] {
+ return [...(node.id ? [node.id] : []), ...node.children.flatMap(inspectionIds)];
+}
+
+export const isEnabled = (o: ProfileOverrides, id: string) => o[id]?.enabled !== false;
+
+export type CheckState = "on" | "off" | "mixed";
+
+/** Checkbox of a node: an inspection that is off is off; otherwise mixed when some descendant is off. */
+export function checkState(o: ProfileOverrides, node: InspectionNode): CheckState {
+ if (node.id && !isEnabled(o, node.id)) return "off";
+ const ids = inspectionIds(node);
+ const on = ids.filter((id) => isEnabled(o, id)).length;
+ if (on === ids.length) return "on";
+ return on === 0 ? "off" : "mixed";
+}
+
+function withOverride(o: ProfileOverrides, id: string, patch: Partial<InspectionOverride>): ProfileOverrides {
+ const next: Record<string, InspectionOverride> = { ...o };
+ const entry: InspectionOverride = { ...o[id], ...patch };
+ for (const k of Object.keys(entry) as (keyof InspectionOverride)[]) if (entry[k] === undefined) delete entry[k];
+ if (Object.keys(entry).length) next[id] = entry;
+ else delete next[id];
+ return next;
+}
+
+/** Turns a node and all its descendants on or off (on is the default, so it removes the override). */
+export function setEnabled(o: ProfileOverrides, node: InspectionNode, enabled: boolean): ProfileOverrides {
+ return inspectionIds(node).reduce((acc, id) => withOverride(acc, id, { enabled: enabled ? undefined : false }), o);
+}
+
+/** `undefined` restores the default ("As reported"). */
+export function setLevel(o: ProfileOverrides, id: string, level: InspectionLevel | undefined): ProfileOverrides {
+ return withOverride(o, id, { severity: level });
+}
+
+export const AS_REPORTED = "";
+
+export const LEVEL_OPTIONS = [
+ { value: AS_REPORTED, label: "As reported" },
+ ...INSPECTION_LEVELS.map((l) => ({ value: l.value, label: l.label })),
+];
+
+/** Search texts for the settings search (built-in checks and levels; servers load asynchronously). */
+export const INSPECTION_KEYWORDS = [
+ "inspections",
+ "inspection profile",
+ "code analysis",
+ "lint",
+ "linter",
+ "diagnostics",
+ "severity",
+ "highlighting level",
+ "language server",
+ "copy profile",
+ "rename profile",
+ "delete profile",
+ "spelling",
+ "proofreading",
+ ...BUILTIN_INSPECTIONS.map((b) => b.name),
+ ...INSPECTION_LEVELS.map((l) => l.label),
+];
+
+// --- profile management (gear menu) ------------------------------------------
+
+/** Replaces the overrides of profile `id`. */
+export function withProfileOverrides(
+ s: InspectionSettingsValid,
+ id: ProfileId,
+ overrides: ProfileOverrides,
+): InspectionSettingsValid {
+ const { level, key } = profileLocation(id);
+ if (key === null) return level === "project" ? { ...s, project: overrides } : { ...s, default: overrides };
+ const field = level === "project" ? "projectProfiles" : "ideProfiles";
+ const existing = s[field][key];
+ if (!existing) return s;
+ return { ...s, [field]: { ...s[field], [key]: { ...existing, overrides } } };
+}
+
+/** Copy of profile `from` named `name` at `level`, made the chosen profile. */
+export function copyProfile(
+ s: InspectionSettingsValid,
+ from: ProfileId,
+ name: string,
+ level: ProfileLevel,
+): InspectionSettingsValid {
+ const field = level === "project" ? "projectProfiles" : "ideProfiles";
+ const key = newProfileKey(name, s[field]);
+ const copy: CustomProfile = { name: name.trim(), overrides: { ...overridesOf(s, from) } };
+ return { ...s, [field]: { ...s[field], [key]: copy }, profile: customProfileId(level, key) };
+}
+
+/** Renames a copied profile (the two defaults keep their names). */
+export function renameProfile(s: InspectionSettingsValid, id: ProfileId, name: string): InspectionSettingsValid {
+ const { level, key } = profileLocation(id);
+ if (key === null) return s;
+ const field = level === "project" ? "projectProfiles" : "ideProfiles";
+ const existing = s[field][key];
+ if (!existing) return s;
+ return { ...s, [field]: { ...s[field], [key]: { ...existing, name: name.trim() } } };
+}
+
+/** Deletes a copied profile; the chosen profile falls back to the level's default. */
+export function deleteProfile(s: InspectionSettingsValid, id: ProfileId): InspectionSettingsValid {
+ const { level, key } = profileLocation(id);
+ if (key === null) return s;
+ const field = level === "project" ? "projectProfiles" : "ideProfiles";
+ const rest = { ...s[field] };
+ delete rest[key];
+ const profile = s.profile === id ? (level === "project" ? "project" : "default") : s.profile;
+ return { ...s, [field]: rest, profile };
+}
diff --git a/src/features/settings/pages/editor/spelling.tsx b/src/features/settings/pages/editor/spelling.tsx
new file mode 100644
index 000000000..84d9aa9c7
--- /dev/null
+++ b/src/features/settings/pages/editor/spelling.tsx
@@ -0,0 +1,106 @@
+/**
+ * Editor › Natural Languages (the bundled language) and its Spelling page:
+ * the Typo inspection's accepted words (project- and application-level
+ * dictionaries, also filled by the "Save to dictionary" quick fix) and custom
+ * dictionary files.
+ */
+import { useSettingsDialog } from "../../model/staging";
+import { useSetting } from "../../components/context";
+import { GlobListEditor, Row, Section } from "../../components/Form";
+import { useProject } from "@/platform/project";
+import { T } from "@/ui";
+import type { PageSpec } from "../spec";
+import styles from "../../components/Form.module.css";
+
+function NaturalLanguagesPage() {
+ return (
+ <Section title="Languages">
+ <Row label="English (USA)" hint="Bundled Hunspell dictionary (SCOWL en_US) and common programming terms.">
+ <span className={styles.hint}>
+ <T>Used by Proofreading › Typo</T>
+ </span>
+ </Row>
+ </Section>
+ );
+}
+
+const words = (list: readonly string[]) => [...new Set(list.map((w) => w.trim()).filter(Boolean))];
+
+function SpellingPage() {
+ const hasProject = useProject((s) => !!s.project);
+ const newProjects = useSettingsDialog((s) => s.newProjects);
+ const [projectWords, setProjectWords] = useSetting<string[]>("spelling.projectWords", "project");
+ const [ideWords, setIdeWords] = useSetting<string[]>("spelling.ideWords", "global");
+ const [dictionaries, setDictionaries] = useSetting<string[]>("spelling.customDictionaries", "global");
+ return (
+ <>
+ <Section title="Accepted words">
+ {hasProject && !newProjects && (
+ <Row label="Project dictionary" stacked hint="Stored with the project.">
+ <GlobListEditor
+ aria-label="Project dictionary"
+ value={projectWords ?? []}
+ onChange={(v) => setProjectWords(words(v))}
+ placeholder="word"
+ emptyText="No words"
+ itemLabel="Word"
+ />
+ </Row>
+ )}
+ <Row label="Application dictionary" stacked hint="Accepted in every project.">
+ <GlobListEditor
+ aria-label="Application dictionary"
+ value={ideWords ?? []}
+ onChange={(v) => setIdeWords(words(v))}
+ placeholder="word"
+ emptyText="No words"
+ itemLabel="Word"
+ />
+ </Row>
+ </Section>
+ <Section title="Custom dictionaries">
+ <Row
+ label="Dictionary files"
+ stacked
+ hint="Plain-text word lists (one word per line) or Hunspell .dic files. Relative paths resolve against the project root, ~/ against the home folder."
+ >
+ <GlobListEditor
+ aria-label="Custom dictionaries"
+ value={dictionaries ?? []}
+ onChange={(v) => setDictionaries(words(v))}
+ placeholder="~/dictionaries/team.dic"
+ emptyText="No custom dictionaries"
+ itemLabel="Dictionary path"
+ />
+ </Row>
+ </Section>
+ </>
+ );
+}
+
+export const NATURAL_LANGUAGES_PAGE: PageSpec = {
+ id: "editor.naturalLanguages",
+ title: "Natural Languages",
+ group: "Editor",
+ order: 26,
+ keywords: ["natural languages", "English", "grammar", "proofreading"],
+ component: NaturalLanguagesPage,
+};
+
+export const SPELLING_PAGE: PageSpec = {
+ id: "editor.naturalLanguages.spelling",
+ title: "Spelling",
+ group: "Editor",
+ order: 1,
+ keywords: [
+ "spelling",
+ "typo",
+ "dictionary",
+ "accepted words",
+ "project dictionary",
+ "application dictionary",
+ "custom dictionaries",
+ "hunspell",
+ ],
+ component: SpellingPage,
+};
diff --git a/src/features/settings/pages/registry.tsx b/src/features/settings/pages/registry.tsx
index 9666f8d13..8cbe5211e 100644
--- a/src/features/settings/pages/registry.tsx
+++ b/src/features/settings/pages/registry.tsx
@@ -36,6 +36,12 @@ export function pageLabels(id: string): string[] {
}
}
+/** Labels of a built-in page's options (each is a Search Everywhere entry). */
+export function optionLabels(id: string): string[] {
+ const spec = specs.get(id);
+ return (spec?.sections ?? []).flatMap((s) => s.options.map((o) => o.label)).filter((l) => !!l.trim());
+}
+
function toContribution(spec: PageSpec): SettingsPageContribution {
const component = spec.component ?? (() => <OptionsPage spec={spec} />);
return { id: spec.id, title: spec.title, group: spec.group, order: spec.order, keywords: spec.keywords, component };
diff --git a/src/features/settings/pages/spec.ts b/src/features/settings/pages/spec.ts
index 03e186abc..140b1005d 100644
--- a/src/features/settings/pages/spec.ts
+++ b/src/features/settings/pages/spec.ts
@@ -39,6 +39,10 @@ export interface PageSpec {
projectScope?: boolean;
/** Scope shown first with a project open (toolchains belong to the project, like IDEA's project SDK). */
defaultScope?: "global" | "project";
+ /** Pages sharing one scope choice (Code Style and its language pages: the scheme). */
+ scopeGroup?: string;
+ /** The page picks its scope itself (Code Style's Scheme): no Global / This project switch. */
+ ownScopeSwitch?: boolean;
sections?: SectionSpec[];
/** Rendered below the sections (previews). */
footer?: ComponentType;
diff --git a/src/features/settings/searchIndex.ts b/src/features/settings/searchIndex.ts
new file mode 100644
index 000000000..28a4c4331
--- /dev/null
+++ b/src/features/settings/searchIndex.ts
@@ -0,0 +1,32 @@
+/**
+ * The settings search index for Search Everywhere: every page plus the
+ * option labels of the built-in pages, with the page's breadcrumb.
+ */
+import { useSettingsPages, type SettingsSearchEntry } from "@/workbench/contributions";
+import { loadBuiltinPages } from "./dialog/LazySettingsDialog";
+import { breadcrumb, buildPageTree, flatten } from "./model/pages";
+
+let cached: { pages: unknown; entries: SettingsSearchEntry[] } | null = null;
+
+export async function settingsSearchEntries(): Promise<SettingsSearchEntry[]> {
+ await loadBuiltinPages();
+ const { optionLabels } = await import("./pages/registry");
+ const pages = useSettingsPages.getState().pages;
+ if (cached?.pages === pages) return cached.entries;
+ const tree = buildPageTree(pages.values());
+ const entries: SettingsSearchEntry[] = [];
+ for (const node of flatten(tree)) {
+ const page = node.page;
+ if (!page) continue;
+ const path = breadcrumb(tree, node.key);
+ entries.push({ pageId: page.id, title: page.title, path: path.slice(0, -1), keywords: page.keywords });
+ const seen = new Set<string>();
+ for (const label of optionLabels(page.id)) {
+ if (seen.has(label)) continue;
+ seen.add(label);
+ entries.push({ pageId: page.id, title: label, path });
+ }
+ }
+ cached = { pages, entries };
+ return entries;
+}
diff --git a/src/features/templates/__tests__/files.test.ts b/src/features/templates/__tests__/files.test.ts
index 0c6d05298..f1aa7872f 100644
--- a/src/features/templates/__tests__/files.test.ts
+++ b/src/features/templates/__tests__/files.test.ts
@@ -1,5 +1,16 @@
import { describe, expect, it } from "vitest";
-import { inferGoPackage, inferJvmPackage, planFile, renderFileTemplate, styleName } from "../files/model";
+import {
+ caretAfterReformat,
+ expandIncludes,
+ fragmentResolver,
+ inferGoPackage,
+ inferJvmPackage,
+ planFile,
+ reformatsOnCreate,
+ renderFileTemplate,
+ styleName,
+ withKind,
+} from "../files/model";
import { BUILTIN_FILE_TEMPLATES } from "../files/builtins";
const tpl = (id: string) => BUILTIN_FILE_TEMPLATES.find((t) => t.id === id)!;
@@ -49,6 +60,34 @@ describe("file naming", () => {
expect(planFile(tpl("file"), "/p", " ")).toBeNull();
expect(planFile(tpl("file"), "/p", "../x")).toBeNull();
});
+
+ it("lets a kind pick the extension (Stylesheet › SCSS)", () => {
+ const css = tpl("stylesheet");
+ const kind = (id: string) => css.kinds.find((k) => k.id === id);
+ expect(planFile(withKind(css, kind("css")), "/p/web", "main")?.path).toBe("/p/web/main.css");
+ expect(planFile(withKind(css, kind("scss")), "/p/web", "main")?.path).toBe("/p/web/main.scss");
+ expect(planFile(withKind(css, kind("less")), "/p/web", "main.less")?.path).toBe("/p/web/main.less");
+ expect(withKind(css, kind("css"))).toBe(css);
+ });
+
+ it("prefills fixed names (Dockerfile, .editorconfig, .gitignore)", () => {
+ for (const [id, name] of [
+ ["dockerfile", "Dockerfile"],
+ ["editorconfig", ".editorconfig"],
+ ["gitignore", ".gitignore"],
+ ] as const) {
+ const t = tpl(id);
+ expect(t.defaultName).toBe(name);
+ expect(planFile(t, "/p", t.defaultName!)?.path).toBe(`/p/${name}`);
+ }
+ });
+
+ it("offers IDEA's common file kinds", () => {
+ const ids = BUILTIN_FILE_TEMPLATES.map((t) => t.id);
+ for (const id of ["stylesheet", "dockerfile", "editorconfig", "json", "yaml", "toml", "shell", "gitignore"])
+ expect(ids).toContain(id);
+ expect(new Set(ids).size).toBe(ids.length);
+ });
});
describe("rendering", () => {
@@ -70,3 +109,73 @@ describe("rendering", () => {
expect(r).toEqual({ text: "a$b 2030", caret: 8 });
});
});
+
+describe("includes", () => {
+ const resolve = fragmentResolver([
+ { name: "File Header", body: "/**\n * @author $USER$\n */\n" },
+ { name: "Empty", body: "" },
+ { name: "Method", body: "@Test\nvoid test() {\n $END$\n}\n" },
+ ]);
+
+ it("expands #parse lines with the directive's indent and drops empty ones", () => {
+ expect(expandIncludes('#parse("File Header")\nclass A {\n #parse("Method")\n}', resolve)).toBe(
+ "/**\n * @author $USER$\n */\nclass A {\n @Test\n void test() {\n $END$\n }\n}",
+ );
+ expect(expandIncludes('a\n#parse("Empty")\nb', resolve)).toBe("a\nb");
+ expect(expandIncludes('#parse("Missing")', resolve)).toBe('#parse("Missing")');
+ });
+
+ it("resolves IDEA names with an extension", () => {
+ expect(expandIncludes('#parse("File Header.java")', resolve)).toBe("/**\n * @author $USER$\n */");
+ });
+
+ it("renders includes with the template variables and ${VAR} syntax", () => {
+ const r = renderFileTemplate(
+ '#parse("File Header")\nclass ${NAME} {}',
+ { name: "Foo", fileName: "Foo.java", user: "ann" },
+ resolve,
+ );
+ expect(r.text).toBe("/**\n * @author ann\n */\nclass Foo {}");
+ });
+
+ it("builds the built-in test templates from code templates", () => {
+ const r = renderFileTemplate(tpl("java").kinds.find((k) => k.id === "test")!.body, {
+ name: "FooTest",
+ fileName: "FooTest.java",
+ });
+ expect(r.text).toContain("class FooTest {\n\n @Test\n void test() {\n \n }\n}\n");
+ expect(r.text.startsWith("import org.junit")).toBe(true);
+ });
+});
+
+describe("reformat according to style", () => {
+ it("is on unless the user turned it off", () => {
+ expect(reformatsOnCreate({})).toBe(true);
+ expect(reformatsOnCreate({ reformat: true })).toBe(true);
+ expect(reformatsOnCreate({ reformat: false })).toBe(false);
+ });
+
+ const at = (text: string) => ({ text: text.replace("|", ""), caret: text.indexOf("|") });
+ const moved = (before: string, after: string) => {
+ const b = at(before);
+ const a = at(after);
+ return [caretAfterReformat(b.text, b.caret, a.text), a.caret];
+ };
+
+ it("keeps the caret inside the re-indented body", () => {
+ const [got, want] = moved("class Foo {\n |\n}\n", "class Foo {\n |\n}\n");
+ expect(got).toBe(want);
+ });
+ it("follows the tokens when whitespace around them changes", () => {
+ const [got, want] = moved("fn main(){let x=1;|}", "fn main() {\n let x = 1;|\n}");
+ expect(got).toBe(want);
+ });
+ it("keeps spaces typed after a token on its line", () => {
+ const [got, want] = moved("return |;", "return |;");
+ expect(got).toBe(want);
+ });
+ it("stays at the start of the text and clamps past the end", () => {
+ expect(caretAfterReformat(" a", 0, "a")).toBe(0);
+ expect(caretAfterReformat("a b|".replace("|", ""), 3, "a")).toBe(1);
+ });
+});
diff --git a/src/features/templates/__tests__/views.test.tsx b/src/features/templates/__tests__/views.test.tsx
index 4ff741e41..ce63f2169 100644
--- a/src/features/templates/__tests__/views.test.tsx
+++ b/src/features/templates/__tests__/views.test.tsx
@@ -9,6 +9,9 @@ import { showChooser } from "../popup/store";
import { BUILTIN_TEMPLATES } from "../live/builtins";
import { useLiveTemplates } from "../live/store";
import { usePostfixSettings } from "../postfix/store";
+import { reloadFileTemplates, resetInclude, saveInclude, setTemplateScheme, useFileTemplates } from "../files/store";
+import { useProject } from "@/platform/project";
+import type { ProjectInfo } from "@/platform/ipc";
describe("settings pages", () => {
it("groups and filters live templates", () => {
@@ -39,6 +42,38 @@ describe("settings pages", () => {
render(<FileTemplatesPage />);
expect(screen.getByText("Kotlin Class/File")).toBeInTheDocument();
});
+
+ it("edits includes and code templates in their tabs", () => {
+ render(<FileTemplatesPage />);
+ fireEvent.click(screen.getByRole("tab", { name: "Includes" }));
+ fireEvent.change(screen.getByLabelText("Include body"), { target: { value: "// header" } });
+ expect(useFileTemplates.getState().includes.find((f) => f.name === "File Header")?.body).toBe("// header");
+ fireEvent.click(screen.getByText("Restore Default"));
+ expect(useFileTemplates.getState().includes.find((f) => f.name === "File Header")?.body).toBe("");
+ fireEvent.click(screen.getByRole("tab", { name: "Code" }));
+ expect(screen.getByText("JUnit5 Test Method")).toBeInTheDocument();
+ fireEvent.change(screen.getByLabelText("Code template body"), { target: { value: "@Test\nvoid t() {}\n" } });
+ expect(useFileTemplates.getState().codeTemplates[0]?.body).toBe("@Test\nvoid t() {}\n");
+ fireEvent.click(screen.getByText("Restore Default"));
+ });
+
+ it("keeps a project scheme seeded from Default", () => {
+ useProject.setState({ project: { root: "/proj", name: "proj" } as unknown as ProjectInfo });
+ reloadFileTemplates();
+ saveInclude({ name: "File Header", body: "// default" });
+ setTemplateScheme("project");
+ expect(useFileTemplates.getState().scheme).toBe("project");
+ expect(useFileTemplates.getState().includes[0]?.body).toBe("// default");
+ saveInclude({ name: "File Header", body: "// project" });
+ setTemplateScheme("default");
+ expect(useFileTemplates.getState().includes[0]?.body).toBe("// default");
+ setTemplateScheme("project");
+ expect(useFileTemplates.getState().includes[0]?.body).toBe("// project");
+ setTemplateScheme("default");
+ resetInclude("File Header");
+ useProject.setState({ project: null });
+ reloadFileTemplates();
+ });
});
describe("dialogs", () => {
@@ -50,6 +85,35 @@ describe("dialogs", () => {
expect(screen.getByText("Data class")).toBeInTheDocument();
});
+ it("prefills fixed names and follows the kind's extension", () => {
+ render(<NewFileDialogHost />);
+ act(() => openNewFileDialog({ directory: "/p", templateId: "dockerfile" }));
+ expect(screen.getByLabelText("Name")).toHaveValue("Dockerfile");
+ act(() => openNewFileDialog({ directory: "/p", templateId: "stylesheet" }));
+ expect(screen.getByLabelText("Name")).toHaveAttribute("placeholder", "Name (.css)");
+ fireEvent.keyDown(screen.getByLabelText("Name"), { key: "ArrowDown" });
+ expect(screen.getByLabelText("Name")).toHaveAttribute("placeholder", "Name (.scss)");
+ });
+
+ it("names an ad-hoc template from another feature", () => {
+ render(<NewFileDialogHost />);
+ act(() =>
+ openNewFileDialog({
+ directory: "/p",
+ template: {
+ id: "http-request",
+ name: "HTTP Request",
+ icon: "file-http",
+ extension: "http",
+ nameStyle: "asis",
+ kinds: [{ id: "request", label: "HTTP Request", body: "GET /\n" }],
+ },
+ }),
+ );
+ expect(screen.getByRole("dialog", { name: "New HTTP Request" })).toBeInTheDocument();
+ expect(screen.getByLabelText("Name")).toHaveAttribute("placeholder", "Name (.http)");
+ });
+
it("chooser filters by typing and picks with Enter", () => {
let picked = "";
render(<ChooserHost />);
diff --git a/src/features/templates/files/NewFileDialog.tsx b/src/features/templates/files/NewFileDialog.tsx
index a046bcfa7..97c42c323 100644
--- a/src/features/templates/files/NewFileDialog.tsx
+++ b/src/features/templates/files/NewFileDialog.tsx
@@ -6,7 +6,7 @@ import { relativePath, useProject } from "@/platform/project";
import { notifications } from "@/workbench/contributions";
import { Dialog, Icon, Input, List, listNavigate } from "@/ui";
import { createFromTemplate, packageFor } from "./create";
-import { planFile, type FileTemplate } from "./model";
+import { planFile, withKind, type FileTemplate } from "./model";
import { useFileTemplates } from "./store";
import styles from "./NewFileDialog.module.css";
@@ -17,6 +17,8 @@ interface Request {
name?: string;
/** Preselected kind id. */
kindId?: string;
+ /** An ad-hoc template contributed by another feature (New › HTTP Request). */
+ template?: FileTemplate;
}
const useNewFile = create<{ request: Request | null; seq: number }>(() => ({ request: null, seq: 0 }));
@@ -34,10 +36,16 @@ export function NewFileDialogHost() {
const [picked, setPicked] = useState<{ seq: number; id: string } | null>(null);
if (!request) return null;
const id = request.templateId ?? (picked?.seq === seq ? picked.id : undefined);
- const template = id ? templates.find((t) => t.id === id) : undefined;
+ const template = request.template ?? (id ? templates.find((t) => t.id === id) : undefined);
if (template)
return (
- <NameStep key={`${seq}:${template.id}`} template={template} directory={request.directory} initialName={request.name} initialKind={request.kindId} />
+ <NameStep
+ key={`${seq}:${template.id}`}
+ template={template}
+ directory={request.directory}
+ initialName={request.name ?? template.defaultName}
+ initialKind={request.kindId}
+ />
);
return (
<TemplateStep
@@ -114,7 +122,8 @@ function NameStep({
const [busy, setBusy] = useState(false);
const [pkg, setPkg] = useState("");
const root = useProject((s) => s.project?.root ?? "");
- const plan = name.trim() ? planFile(template, directory, name) : null;
+ const effective = withKind(template, template.kinds[kind]);
+ const plan = name.trim() ? planFile(effective, directory, name) : null;
useEffect(() => {
if (!template.packageStyle) return;
@@ -186,7 +195,7 @@ function NameStep({
data-autofocus
value={name}
invalid={!!error}
- placeholder={template.extension ? `Name (.${template.extension})` : "File name with extension"}
+ placeholder={effective.extension ? `Name (.${effective.extension})` : "File name with extension"}
aria-label="Name"
onChange={(e) => {
setName(e.target.value);
diff --git a/src/features/templates/files/builtins.ts b/src/features/templates/files/builtins.ts
index 987a89119..7f92c16ad 100644
--- a/src/features/templates/files/builtins.ts
+++ b/src/features/templates/files/builtins.ts
@@ -1,5 +1,42 @@
-/** Built-in file templates for the "New ▸" menu. */
-import type { FileTemplate } from "./model";
+/** Built-in file templates for the "New ▸" menu, with the includes and code templates they `#parse`. */
+import type { FileTemplate, TemplateFragment } from "./model";
+
+/** Includes tab: fragments file templates pull in with `#parse("…")`. */
+export const BUILTIN_INCLUDES: readonly TemplateFragment[] = [{ name: "File Header", body: "" }];
+
+/** Code tab: the members the built-in test templates generate. */
+export const BUILTIN_CODE_TEMPLATES: readonly TemplateFragment[] = [
+ {
+ name: "JUnit5 Test Method",
+ description: "Java Class › JUnit 5 Test",
+ body: "@Test\nvoid test() {\n $END$\n}\n",
+ },
+ {
+ name: "Kotlin JUnit5 Test Method",
+ description: "Kotlin Class/File › JUnit 5 Test",
+ body: "@Test\nfun test() {\n $END$\n}\n",
+ },
+ {
+ name: "Go Test Function",
+ description: "Go File › Test file",
+ body: "func Test$NAME$(t *testing.T) {\n\t$END$\n}\n",
+ },
+ {
+ name: "Rust Test Function",
+ description: "Rust File › Test module",
+ body: "#[test]\nfn it_works() {\n $END$\n}\n",
+ },
+ {
+ name: "Vitest Test",
+ description: "TypeScript File › Test",
+ body: 'it("works", () => {\n $END$\n});\n',
+ },
+ {
+ name: "pytest Test Function",
+ description: "Python File › Test (pytest)",
+ body: "def test_$NAME$():\n $END$\n",
+ },
+];
export const BUILTIN_FILE_TEMPLATES: readonly FileTemplate[] = [
{
@@ -22,7 +59,7 @@ export const BUILTIN_FILE_TEMPLATES: readonly FileTemplate[] = [
{
id: "test",
label: "Test module",
- body: "#[cfg(test)]\nmod tests {\n use super::*;\n\n #[test]\n fn it_works() {\n $END$\n }\n}\n",
+ body: '#[cfg(test)]\nmod tests {\n use super::*;\n\n #parse("Rust Test Function")\n}\n',
},
],
},
@@ -38,7 +75,7 @@ export const BUILTIN_FILE_TEMPLATES: readonly FileTemplate[] = [
{
id: "test",
label: "Test",
- body: 'import { describe, expect, it } from "vitest";\n\ndescribe("$NAME$", () => {\n it("works", () => {\n $END$\n });\n});\n',
+ body: 'import { describe, expect, it } from "vitest";\n\ndescribe("$NAME$", () => {\n #parse("Vitest Test")\n});\n',
},
],
},
@@ -82,7 +119,7 @@ export const BUILTIN_FILE_TEMPLATES: readonly FileTemplate[] = [
label: "Class",
body: "class $NAME$:\n def __init__(self):\n $END$\n",
},
- { id: "test", label: "Test (pytest)", body: "def test_$NAME$():\n $END$\n" },
+ { id: "test", label: "Test (pytest)", body: '#parse("pytest Test Function")\n' },
{ id: "script", label: "Script", body: 'def main():\n $END$\n\n\nif __name__ == "__main__":\n main()\n' },
],
},
@@ -98,7 +135,7 @@ export const BUILTIN_FILE_TEMPLATES: readonly FileTemplate[] = [
{
id: "test",
label: "Test file",
- body: 'package $PACKAGE$\n\nimport "testing"\n\nfunc Test$NAME$(t *testing.T) {\n\t$END$\n}\n',
+ body: 'package $PACKAGE$\n\nimport "testing"\n\n#parse("Go Test Function")\n',
},
{ id: "main", label: "Main", body: "package main\n\nfunc main() {\n\t$END$\n}\n" },
],
@@ -112,19 +149,35 @@ export const BUILTIN_FILE_TEMPLATES: readonly FileTemplate[] = [
packageStyle: "jvm",
dottedPackages: true,
kinds: [
- { id: "class", label: "Class", body: "package $PACKAGE$;\n\npublic class $NAME$ {\n $END$\n}\n" },
- { id: "interface", label: "Interface", body: "package $PACKAGE$;\n\npublic interface $NAME$ {\n $END$\n}\n" },
- { id: "enum", label: "Enum", body: "package $PACKAGE$;\n\npublic enum $NAME$ {\n $END$\n}\n" },
- { id: "record", label: "Record", body: "package $PACKAGE$;\n\npublic record $NAME$($END$) {\n}\n" },
+ {
+ id: "class",
+ label: "Class",
+ body: 'package $PACKAGE$;\n\n#parse("File Header")\npublic class $NAME$ {\n $END$\n}\n',
+ },
+ {
+ id: "interface",
+ label: "Interface",
+ body: 'package $PACKAGE$;\n\n#parse("File Header")\npublic interface $NAME$ {\n $END$\n}\n',
+ },
+ {
+ id: "enum",
+ label: "Enum",
+ body: 'package $PACKAGE$;\n\n#parse("File Header")\npublic enum $NAME$ {\n $END$\n}\n',
+ },
+ {
+ id: "record",
+ label: "Record",
+ body: 'package $PACKAGE$;\n\n#parse("File Header")\npublic record $NAME$($END$) {\n}\n',
+ },
{
id: "annotation",
label: "Annotation",
- body: "package $PACKAGE$;\n\npublic @interface $NAME$ {\n $END$\n}\n",
+ body: 'package $PACKAGE$;\n\n#parse("File Header")\npublic @interface $NAME$ {\n $END$\n}\n',
},
{
id: "test",
label: "JUnit 5 Test",
- body: "package $PACKAGE$;\n\nimport org.junit.jupiter.api.Test;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\nclass $NAME$ {\n\n @Test\n void test() {\n $END$\n }\n}\n",
+ body: 'package $PACKAGE$;\n\nimport org.junit.jupiter.api.Test;\n\nimport static org.junit.jupiter.api.Assertions.*;\n\n#parse("File Header")\nclass $NAME$ {\n\n #parse("JUnit5 Test Method")\n}\n',
},
],
},
@@ -137,16 +190,36 @@ export const BUILTIN_FILE_TEMPLATES: readonly FileTemplate[] = [
packageStyle: "jvm",
dottedPackages: true,
kinds: [
- { id: "class", label: "Class", body: "package $PACKAGE$\n\nclass $NAME$ {\n $END$\n}\n" },
+ {
+ id: "class",
+ label: "Class",
+ body: 'package $PACKAGE$\n\n#parse("File Header")\nclass $NAME$ {\n $END$\n}\n',
+ },
{ id: "file", label: "File", body: "package $PACKAGE$\n\n$END$\n" },
- { id: "interface", label: "Interface", body: "package $PACKAGE$\n\ninterface $NAME$ {\n $END$\n}\n" },
- { id: "data", label: "Data class", body: "package $PACKAGE$\n\ndata class $NAME$($END$)\n" },
- { id: "enum", label: "Enum class", body: "package $PACKAGE$\n\nenum class $NAME$ {\n $END$\n}\n" },
- { id: "object", label: "Object", body: "package $PACKAGE$\n\nobject $NAME$ {\n $END$\n}\n" },
+ {
+ id: "interface",
+ label: "Interface",
+ body: 'package $PACKAGE$\n\n#parse("File Header")\ninterface $NAME$ {\n $END$\n}\n',
+ },
+ {
+ id: "data",
+ label: "Data class",
+ body: 'package $PACKAGE$\n\n#parse("File Header")\ndata class $NAME$($END$)\n',
+ },
+ {
+ id: "enum",
+ label: "Enum class",
+ body: 'package $PACKAGE$\n\n#parse("File Header")\nenum class $NAME$ {\n $END$\n}\n',
+ },
+ {
+ id: "object",
+ label: "Object",
+ body: 'package $PACKAGE$\n\n#parse("File Header")\nobject $NAME$ {\n $END$\n}\n',
+ },
{
id: "test",
label: "JUnit 5 Test",
- body: "package $PACKAGE$\n\nimport org.junit.jupiter.api.Test\nimport org.junit.jupiter.api.Assertions.*\n\nclass $NAME$ {\n\n @Test\n fun test() {\n $END$\n }\n}\n",
+ body: 'package $PACKAGE$\n\nimport org.junit.jupiter.api.Test\nimport org.junit.jupiter.api.Assertions.*\n\n#parse("File Header")\nclass $NAME$ {\n\n #parse("Kotlin JUnit5 Test Method")\n}\n',
},
],
},
@@ -173,4 +246,88 @@ export const BUILTIN_FILE_TEMPLATES: readonly FileTemplate[] = [
nameStyle: "asis",
kinds: [{ id: "md", label: "Markdown file", body: "# $NAME$\n\n$END$\n" }],
},
+ {
+ // IDEA's "Stylesheet": one dialog, the kind picks the language.
+ id: "stylesheet",
+ name: "Stylesheet",
+ icon: "file-css",
+ extension: "css",
+ nameStyle: "asis",
+ kinds: [
+ { id: "css", label: "CSS File", body: "$END$\n" },
+ { id: "scss", label: "SCSS File", body: "$END$\n", extension: "scss" },
+ { id: "sass", label: "Sass File", body: "$END$\n", extension: "sass" },
+ { id: "less", label: "Less File", body: "$END$\n", extension: "less" },
+ ],
+ },
+ {
+ id: "json",
+ name: "JSON File",
+ icon: "file-json",
+ extension: "json",
+ nameStyle: "asis",
+ kinds: [{ id: "json", label: "JSON file", body: "{\n $END$\n}\n" }],
+ },
+ {
+ id: "yaml",
+ name: "YAML File",
+ icon: "file-yaml",
+ extension: "yaml",
+ nameStyle: "asis",
+ kinds: [{ id: "yaml", label: "YAML file", body: "$END$\n" }],
+ },
+ {
+ id: "toml",
+ name: "TOML File",
+ icon: "file-toml",
+ extension: "toml",
+ nameStyle: "asis",
+ kinds: [{ id: "toml", label: "TOML file", body: "$END$\n" }],
+ },
+ {
+ id: "shell",
+ name: "Shell Script",
+ icon: "file-shell",
+ extension: "sh",
+ nameStyle: "asis",
+ kinds: [
+ { id: "bash", label: "Bash script", body: "#!/usr/bin/env bash\nset -euo pipefail\n\n$END$\n" },
+ { id: "sh", label: "POSIX sh script", body: "#!/bin/sh\n\n$END$\n" },
+ { id: "zsh", label: "Zsh script", body: "#!/usr/bin/env zsh\n\n$END$\n", extension: "zsh" },
+ ],
+ },
+ {
+ id: "dockerfile",
+ name: "Dockerfile",
+ icon: "file-docker",
+ extension: "",
+ nameStyle: "asis",
+ defaultName: "Dockerfile",
+ kinds: [{ id: "dockerfile", label: "Dockerfile", body: "FROM $END$\n" }],
+ },
+ {
+ id: "editorconfig",
+ name: "EditorConfig File",
+ icon: "file-config",
+ extension: "",
+ nameStyle: "asis",
+ defaultName: ".editorconfig",
+ kinds: [
+ {
+ id: "default",
+ label: "Default properties",
+ body: "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\nindent_style = space\nindent_size = 4\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n$END$",
+ },
+ { id: "root", label: "Root only", body: "root = true\n\n[*]\n$END$\n" },
+ ],
+ },
+ {
+ id: "gitignore",
+ name: ".gitignore File",
+ icon: "file-git",
+ extension: "",
+ nameStyle: "asis",
+ defaultName: ".gitignore",
+ kinds: [{ id: "gitignore", label: ".gitignore file", body: "$END$\n" }],
+ },
];
diff --git a/src/features/templates/files/create.ts b/src/features/templates/files/create.ts
index fdd3c240a..12f9122cb 100644
--- a/src/features/templates/files/create.ts
+++ b/src/features/templates/files/create.ts
@@ -9,13 +9,17 @@ import { activeEditor, editorsFor, type TextEditorHandle } from "@/editor/api";
import { editorService, maybeEditorService, notifications } from "@/workbench/contributions";
import {
GO_PACKAGE_RE,
+ caretAfterReformat,
inferGoPackage,
inferJvmPackage,
planFile,
+ reformatsOnCreate,
renderFileTemplate,
+ withKind,
type FileTemplate,
type FileTemplateKind,
} from "./model";
+import { templateIncludes } from "./store";
async function siblingGoPackage(directory: string): Promise<string | null> {
if (!isTauri()) return null;
@@ -85,17 +89,21 @@ export async function createFromTemplate(
/** Called once the file exists (e.g. to close the dialog before the editor takes focus). */
onCreated?: () => void,
): Promise<string> {
- const plan = planFile(t, directory, input);
+ const plan = planFile(withKind(t, kind), directory, input);
if (!plan) throw new Error("Invalid file name");
const project = useProject.getState().project;
const packageName = await packageFor(t, plan.directory);
- const { text, caret } = renderFileTemplate(kind.body, {
- name: plan.name,
- fileName: plan.fileName,
- packageName,
- projectName: project?.name,
- user: userName(project?.root ?? ""),
- });
+ const { text, caret } = renderFileTemplate(
+ kind.body,
+ {
+ name: plan.name,
+ fileName: plan.fileName,
+ packageName,
+ projectName: project?.name,
+ user: userName(project?.root ?? ""),
+ },
+ templateIncludes(),
+ );
await call(commands.fsCreateFile(plan.path));
notifyFileOperation({ kind: "created", paths: [plan.path] });
onCreated?.();
@@ -119,6 +127,15 @@ export async function createFromTemplate(
userEvent: "input",
});
view.focus();
+ if (reformatsOnCreate(t)) {
+ // Keep the caret at `$END$` whatever edits the formatter made.
+ const before = view.state.doc.toString();
+ const at = view.state.selection.main.head;
+ const applied = await editorService().reformat?.(plan.path);
+ const after = view.state.doc.toString();
+ if (applied && after !== before)
+ view.dispatch({ selection: EditorSelection.cursor(caretAfterReformat(before, at, after)), scrollIntoView: true });
+ }
await executeAction("file.save");
}
return plan.path;
diff --git a/src/features/templates/files/model.ts b/src/features/templates/files/model.ts
index 524911972..547b81d54 100644
--- a/src/features/templates/files/model.ts
+++ b/src/features/templates/files/model.ts
@@ -4,10 +4,14 @@
*
* Body variables: `$NAME$` (the entered name, styled per template),
* `$PACKAGE$`, `$FILE_NAME$`, `$DATE$`, `$TIME$`, `$YEAR$`, `$USER$`,
- * `$PROJECT_NAME$`, `$END$` (caret). A line mentioning `$PACKAGE$` is
- * dropped, together with one following blank line, when the package is empty.
+ * `$PROJECT_NAME$`, `$END$` (caret); IDEA's `${NAME}` spelling works too. A
+ * line mentioning `$PACKAGE$` is dropped, together with one following blank
+ * line, when the package is empty. `#parse("File Header")` inserts an include
+ * or code template (indented like the directive; a line whose include is
+ * empty disappears).
*/
import { formatDate, pascalCase, snakeCase, kebabCase } from "../live/model";
+import { BUILTIN_CODE_TEMPLATES, BUILTIN_INCLUDES } from "./builtins";
export type NameStyle = "asis" | "snake" | "pascal" | "kebab";
@@ -15,6 +19,8 @@ export interface FileTemplateKind {
id: string;
label: string;
body: string;
+ /** Overrides the template's extension (Stylesheet › CSS / SCSS / Less). */
+ extension?: string;
}
export interface FileTemplate {
@@ -31,6 +37,71 @@ export interface FileTemplate {
dottedPackages?: boolean;
kinds: FileTemplateKind[];
enabled?: boolean;
+ /** Prefilled name for fixed-name files (`Dockerfile`, `.editorconfig`). */
+ defaultName?: string;
+ /** Reformat according to style: run Reformat Code on the new file (unset: on, as IDEA). */
+ reformat?: boolean;
+}
+
+/** A fragment for `#parse` (Includes tab: "File Header") or a Code tab template. */
+export interface TemplateFragment {
+ /** The name `#parse` refers to, e.g. `File Header`. */
+ name: string;
+ body: string;
+ /** What uses it (Code tab). */
+ description?: string;
+}
+
+/** Finds the body of an include or code template by its `#parse` name. */
+export type IncludeResolver = (name: string) => string | undefined;
+
+export function fragmentResolver(...lists: ReadonlyArray<readonly TemplateFragment[]>): IncludeResolver {
+ return (name) => {
+ for (const list of lists) {
+ // IDEA names carry the extension (`File Header.java`); ours may omit it.
+ const hit = list.find((f) => f.name === name) ?? list.find((f) => name.startsWith(`${f.name}.`));
+ if (hit) return hit.body;
+ }
+ return undefined;
+ };
+}
+
+const builtinResolver = fragmentResolver(BUILTIN_INCLUDES, BUILTIN_CODE_TEMPLATES);
+
+const PARSE_LINE = /^([ \t]*)#parse\(\s*"([^"]+)"\s*\)[ \t]*$/;
+const PARSE_INLINE = /#parse\(\s*"([^"]+)"\s*\)/g;
+
+/** Expands `#parse("name")` directives (nested up to a few levels); unknown names stay as written. */
+export function expandIncludes(body: string, resolve: IncludeResolver, depth = 0): string {
+ if (depth > 4 || !body.includes("#parse")) return body;
+ const out: string[] = [];
+ for (const line of body.split("\n")) {
+ const m = PARSE_LINE.exec(line);
+ if (!m) {
+ out.push(
+ line.replace(PARSE_INLINE, (all, name: string) => {
+ const inc = resolve(name);
+ return inc === undefined ? all : expandIncludes(inc.replace(/\n$/, ""), resolve, depth + 1);
+ }),
+ );
+ continue;
+ }
+ const inc = resolve(m[2]!);
+ if (inc === undefined) {
+ out.push(line);
+ continue;
+ }
+ const text = expandIncludes(inc.replace(/\r\n?/g, "\n").replace(/\n$/, ""), resolve, depth + 1);
+ if (!text) continue;
+ const indent = m[1]!;
+ for (const l of text.split("\n")) out.push(l ? indent + l : l);
+ }
+ return out.join("\n");
+}
+
+/** The template as seen by `planFile` for `kind` (its extension override applied). */
+export function withKind(t: FileTemplate, kind: FileTemplateKind | undefined): FileTemplate {
+ return kind?.extension !== undefined && kind.extension !== t.extension ? { ...t, extension: kind.extension } : t;
}
export function styleName(name: string, style: NameStyle): string {
@@ -162,7 +233,11 @@ export interface FileTemplateVars {
}
/** Renders a body; returns the text and the caret offset (`$END$`, else the end). */
-export function renderFileTemplate(body: string, vars: FileTemplateVars): { text: string; caret: number } {
+export function renderFileTemplate(
+ body: string,
+ vars: FileTemplateVars,
+ includes: IncludeResolver = builtinResolver,
+): { text: string; caret: number } {
const now = vars.now ?? new Date();
const values: Record<string, string> = {
NAME: vars.name,
@@ -175,11 +250,11 @@ export function renderFileTemplate(body: string, vars: FileTemplateVars): { text
TIME: formatDate(now, "HH:mm"),
YEAR: String(now.getFullYear()),
};
- let lines = body.replace(/\r\n?/g, "\n").split("\n");
+ let lines = expandIncludes(body.replace(/\r\n?/g, "\n"), includes).split("\n");
if (!values.PACKAGE) {
const out: string[] = [];
for (let i = 0; i < lines.length; i++) {
- if (/\$PACKAGE(_NAME)?\$/.test(lines[i]!)) {
+ if (/\$PACKAGE(_NAME)?\$|\$\{PACKAGE(_NAME)?\}/.test(lines[i]!)) {
if (lines[i + 1]?.trim() === "") i++;
continue;
}
@@ -198,14 +273,15 @@ export function renderFileTemplate(body: string, vars: FileTemplateVars): { text
i += 2;
continue;
}
- const close = src.indexOf("$", i + 1);
- const key = close > 0 ? src.slice(i + 1, close) : "";
+ const braced = src[i + 1] === "{";
+ const close = braced ? src.indexOf("}", i + 2) : src.indexOf("$", i + 1);
+ const key = close > 0 ? src.slice(i + (braced ? 2 : 1), close) : "";
if (key === "END") {
if (caret < 0) caret = text.length;
i = close + 1;
continue;
}
- if (key in values) {
+ if (Object.hasOwn(values, key)) {
text += values[key];
i = close + 1;
continue;
@@ -216,3 +292,46 @@ export function renderFileTemplate(body: string, vars: FileTemplateVars): { text
}
return { text, caret: caret < 0 ? text.length : caret };
}
+
+/** Whether "Reformat according to style" is on (IDEA's default, unless the user turned it off). */
+export const reformatsOnCreate = (t: Pick<FileTemplate, "reformat">) => t.reformat !== false;
+
+const isSpace = (c: string) => c === " " || c === "\t" || c === "\r" || c === "\n";
+
+/**
+ * Where the caret (`$END$`) goes after Reformat Code turned `before` into
+ * `after`: behind the same number of non-whitespace characters, then on the
+ * same line below them (past the new indentation), since formatters mostly
+ * change whitespace and may replace the whole text in one edit.
+ */
+export function caretAfterReformat(before: string, caret: number, after: string): number {
+ caret = Math.max(0, Math.min(caret, before.length));
+ let tokens = 0;
+ let lastToken = -1;
+ for (let i = 0; i < caret; i++)
+ if (!isSpace(before[i]!)) {
+ tokens++;
+ lastToken = i;
+ }
+ const gap = before.slice(lastToken + 1, caret);
+ const newlines = gap.split("\n").length - 1;
+ let p = 0;
+ for (let seen = 0; p < after.length && seen < tokens; p++) if (!isSpace(after[p]!)) seen++;
+ if (tokens && p >= after.length) return after.length;
+ if (!newlines) {
+ // Same line as the token before: keep the spaces typed between them, as far as they still exist.
+ let n = gap.length;
+ for (; n > 0 && p < after.length && (after[p] === " " || after[p] === "\t"); n--) p++;
+ return p;
+ }
+ let q = p;
+ for (let n = 0; n < newlines; ) {
+ const nl = after.indexOf("\n", q);
+ if (nl < 0 || !/^[ \t\r]*$/.test(after.slice(q, nl))) break;
+ q = nl + 1;
+ n++;
+ }
+ if (q === p) return p;
+ while (q < after.length && (after[q] === " " || after[q] === "\t")) q++;
+ return q;
+}
diff --git a/src/features/templates/files/store.ts b/src/features/templates/files/store.ts
index 077f60320..82d578f7a 100644
--- a/src/features/templates/files/store.ts
+++ b/src/features/templates/files/store.ts
@@ -1,64 +1,201 @@
+/**
+ * File and Code Templates: the built-ins plus the user's customisations, kept
+ * per scheme as IDEA does. `Default` lives in the user's storage; `Project`
+ * is a copy for the open project (keyed by its root), seeded from Default on
+ * first use.
+ */
import { create } from "zustand";
+import { useProject } from "@/platform/project";
import { loadJson, saveJson } from "../storage";
-import { BUILTIN_FILE_TEMPLATES } from "./builtins";
-import type { FileTemplate } from "./model";
+import { BUILTIN_CODE_TEMPLATES, BUILTIN_FILE_TEMPLATES, BUILTIN_INCLUDES } from "./builtins";
+import { fragmentResolver, type FileTemplate, type IncludeResolver, type TemplateFragment } from "./model";
export const FILE_TEMPLATES_KEY = "openidea.fileTemplates.v1";
-const KEY = FILE_TEMPLATES_KEY;
const BUILTIN_IDS = new Set(BUILTIN_FILE_TEMPLATES.map((t) => t.id));
+const BUILTIN_INCLUDE_NAMES = new Set(BUILTIN_INCLUDES.map((f) => f.name));
+
+export type TemplateScheme = "default" | "project";
interface Customizations {
templates: Record<string, FileTemplate>;
deleted: string[];
+ /** Includes by name: edited built-ins and the user's own. */
+ includes: Record<string, TemplateFragment>;
+ deletedIncludes: string[];
+ /** Edited code template bodies by name. */
+ code: Record<string, string>;
}
-export function mergeFileTemplates(c: Customizations): FileTemplate[] {
+const EMPTY: Customizations = { templates: {}, deleted: [], includes: {}, deletedIncludes: [], code: {} };
+
+export function mergeFileTemplates(c: Pick<Customizations, "templates" | "deleted">): FileTemplate[] {
const deleted = new Set(c.deleted);
const out = BUILTIN_FILE_TEMPLATES.filter((t) => !deleted.has(t.id)).map((t) => c.templates[t.id] ?? t);
for (const t of Object.values(c.templates)) if (!BUILTIN_IDS.has(t.id) && !deleted.has(t.id)) out.push(t);
return out;
}
-const initial = loadJson<Customizations>(KEY, { templates: {}, deleted: [] });
+export function mergeIncludes(c: Pick<Customizations, "includes" | "deletedIncludes">): TemplateFragment[] {
+ const deleted = new Set(c.deletedIncludes);
+ const out = BUILTIN_INCLUDES.filter((f) => !deleted.has(f.name)).map((f) => c.includes[f.name] ?? f);
+ for (const f of Object.values(c.includes))
+ if (!BUILTIN_INCLUDE_NAMES.has(f.name) && !deleted.has(f.name)) out.push(f);
+ return out;
+}
+
+export function mergeCodeTemplates(c: Pick<Customizations, "code">): TemplateFragment[] {
+ return BUILTIN_CODE_TEMPLATES.map((f) => (f.name in c.code ? { ...f, body: c.code[f.name]! } : f));
+}
+
+const projectRoot = () => useProject.getState().project?.root ?? null;
+const schemeKey = (root: string) => `${FILE_TEMPLATES_KEY}.scheme:${root}`;
+const projectKey = (root: string) => `${FILE_TEMPLATES_KEY}.project:${root}`;
+
+function readScheme(root: string | null): TemplateScheme {
+ return root && loadJson<{ scheme: TemplateScheme }>(schemeKey(root), { scheme: "default" }).scheme === "project"
+ ? "project"
+ : "default";
+}
-export const useFileTemplates = create<{ custom: Customizations; templates: FileTemplate[] }>(() => ({
- custom: initial,
- templates: mergeFileTemplates(initial),
-}));
+const storageKey = (scheme: TemplateScheme, root: string | null) =>
+ scheme === "project" && root ? projectKey(root) : FILE_TEMPLATES_KEY;
+
+interface FileTemplatesState {
+ scheme: TemplateScheme;
+ root: string | null;
+ custom: Customizations;
+ templates: FileTemplate[];
+ includes: TemplateFragment[];
+ codeTemplates: TemplateFragment[];
+}
+
+function snapshot(root: string | null): FileTemplatesState {
+ const scheme = readScheme(root);
+ const custom = { ...EMPTY, ...loadJson<Partial<Customizations>>(storageKey(scheme, root), {}) } as Customizations;
+ return {
+ scheme,
+ root,
+ custom,
+ templates: mergeFileTemplates(custom),
+ includes: mergeIncludes(custom),
+ codeTemplates: mergeCodeTemplates(custom),
+ };
+}
+
+export const useFileTemplates = create<FileTemplatesState>(() => snapshot(projectRoot()));
function commit(custom: Customizations) {
- saveJson(KEY, custom);
- useFileTemplates.setState({ custom, templates: mergeFileTemplates(custom) });
+ const { scheme, root } = useFileTemplates.getState();
+ saveJson(storageKey(scheme, root), custom);
+ useFileTemplates.setState({
+ custom,
+ templates: mergeFileTemplates(custom),
+ includes: mergeIncludes(custom),
+ codeTemplates: mergeCodeTemplates(custom),
+ });
}
+const custom = () => useFileTemplates.getState().custom;
+
export const fileTemplates = () => useFileTemplates.getState().templates;
export const isBuiltinFileTemplate = (id: string) => BUILTIN_IDS.has(id);
+/** `#parse` lookup over the current scheme's includes, then its code templates. */
+export function templateIncludes(): IncludeResolver {
+ const s = useFileTemplates.getState();
+ return fragmentResolver(s.includes, s.codeTemplates);
+}
+
export function saveFileTemplate(t: FileTemplate) {
- const c = useFileTemplates.getState().custom;
- commit({ templates: { ...c.templates, [t.id]: t }, deleted: c.deleted.filter((d) => d !== t.id) });
+ const c = custom();
+ commit({ ...c, templates: { ...c.templates, [t.id]: t }, deleted: c.deleted.filter((d) => d !== t.id) });
}
export function removeFileTemplate(id: string) {
- const c = useFileTemplates.getState().custom;
+ const c = custom();
const templates = { ...c.templates };
delete templates[id];
- commit({ templates, deleted: BUILTIN_IDS.has(id) ? [...new Set([...c.deleted, id])] : c.deleted });
+ commit({ ...c, templates, deleted: BUILTIN_IDS.has(id) ? [...new Set([...c.deleted, id])] : c.deleted });
}
export function resetFileTemplate(id: string) {
- const c = useFileTemplates.getState().custom;
+ const c = custom();
const templates = { ...c.templates };
delete templates[id];
- commit({ templates, deleted: c.deleted.filter((d) => d !== id) });
+ commit({ ...c, templates, deleted: c.deleted.filter((d) => d !== id) });
}
export function isModifiedFileTemplate(id: string): boolean {
- return BUILTIN_IDS.has(id) && id in useFileTemplates.getState().custom.templates;
+ return BUILTIN_IDS.has(id) && id in custom().templates;
}
-/** Re-reads customisations (changed by another window). */
+/** Saves an include; `previous` is its name before a rename. */
+export function saveInclude(f: TemplateFragment, previous = f.name) {
+ const c = custom();
+ const includes = { ...c.includes };
+ let deleted = c.deletedIncludes.filter((d) => d !== f.name);
+ if (previous !== f.name) {
+ delete includes[previous];
+ if (BUILTIN_INCLUDE_NAMES.has(previous)) deleted = [...new Set([...deleted, previous])];
+ }
+ commit({ ...c, includes: { ...includes, [f.name]: f }, deletedIncludes: deleted });
+}
+
+export function removeInclude(name: string) {
+ const c = custom();
+ const includes = { ...c.includes };
+ delete includes[name];
+ const deletedIncludes = BUILTIN_INCLUDE_NAMES.has(name)
+ ? [...new Set([...c.deletedIncludes, name])]
+ : c.deletedIncludes;
+ commit({ ...c, includes, deletedIncludes });
+}
+
+export function resetInclude(name: string) {
+ const c = custom();
+ const includes = { ...c.includes };
+ delete includes[name];
+ commit({ ...c, includes, deletedIncludes: c.deletedIncludes.filter((d) => d !== name) });
+}
+
+export const isBuiltinInclude = (name: string) => BUILTIN_INCLUDE_NAMES.has(name);
+export const isModifiedInclude = (name: string) => BUILTIN_INCLUDE_NAMES.has(name) && name in custom().includes;
+
+export function saveCodeTemplate(name: string, body: string) {
+ const c = custom();
+ commit({ ...c, code: { ...c.code, [name]: body } });
+}
+
+export function resetCodeTemplate(name: string) {
+ const c = custom();
+ const code = { ...c.code };
+ delete code[name];
+ commit({ ...c, code });
+}
+
+export const isModifiedCodeTemplate = (name: string) => name in custom().code;
+
+/**
+ * Switches the open project between the Default and Project schemes. A
+ * project scheme used for the first time starts as a copy of Default.
+ */
+export function setTemplateScheme(scheme: TemplateScheme) {
+ const root = useFileTemplates.getState().root;
+ if (!root) return;
+ if (scheme === "project" && globalThis.localStorage?.getItem(projectKey(root)) == null)
+ saveJson(projectKey(root), loadJson<Partial<Customizations>>(FILE_TEMPLATES_KEY, {}));
+ saveJson(schemeKey(root), { scheme });
+ useFileTemplates.setState(snapshot(root));
+}
+
+/** Re-reads customisations (changed by another window, or another project opened). */
export function reloadFileTemplates() {
- const custom = loadJson<Customizations>(KEY, { templates: {}, deleted: [] });
- useFileTemplates.setState({ custom, templates: mergeFileTemplates(custom) });
+ useFileTemplates.setState(snapshot(projectRoot()));
+}
+
+/** Follows the open project (its scheme and Project templates). */
+export function watchTemplateProject(): () => void {
+ return useProject.subscribe((s, prev) => {
+ if (s.project?.root !== prev.project?.root) reloadFileTemplates();
+ });
}
diff --git a/src/features/templates/index.ts b/src/features/templates/index.ts
index a5bce4595..7de5f4ef4 100644
--- a/src/features/templates/index.ts
+++ b/src/features/templates/index.ts
@@ -6,12 +6,18 @@
import { lazyComponent } from "@/ui";
import { registerAction, registerActions, type Action } from "@/platform/actions";
import { activeEditor, registerEditorContribution } from "@/editor/api";
-import { notifications, registerMenuGroup, registerOverlay, registerSettingsPage } from "@/workbench/contributions";
+import {
+ notifications,
+ registerMenuGroup,
+ registerOverlay,
+ registerSettingsPage,
+ type MenuGroupContext,
+} from "@/workbench/contributions";
import { insertLiveTemplate, surroundTarget, surroundWith, templateEditorExtension } from "./editor";
import { ChooserHost } from "./popup/Chooser";
import { NewFileDialogHost, openNewFileDialog } from "./files/NewFileDialog";
import { defaultDirectory } from "./files/create";
-import { fileTemplates, useFileTemplates } from "./files/store";
+import { fileTemplates, useFileTemplates, watchTemplateProject } from "./files/store";
import type { FileTemplate } from "./files/model";
import { syncTemplatesFromStorage } from "./sync";
import { tagAtCaret, updateTag } from "./emmet/editor";
@@ -48,8 +54,16 @@ interface NewFileArg {
extension?: string;
name?: string;
kindId?: string;
+ /** An ad-hoc template from another feature (New › HTTP Request), not kept in the template store. */
+ template?: FileTemplate;
}
+const isTemplate = (t: unknown): t is FileTemplate =>
+ !!t &&
+ typeof (t as FileTemplate).name === "string" &&
+ Array.isArray((t as FileTemplate).kinds) &&
+ (t as FileTemplate).kinds.length > 0;
+
function templateForExtension(extension: string | undefined, kindId: string | undefined): string | undefined {
if (!extension) return undefined;
const matching = fileTemplates().filter((t) => t.enabled !== false && t.extension === extension);
@@ -68,7 +82,9 @@ function newFileAction(t: FileTemplate): Action {
category: "File",
icon: t.icon,
when: "projectOpen",
- keywords: ["new", "create", "template", t.extension].filter(Boolean),
+ keywords: [
+ ...new Set(["new", "create", "template", t.extension, ...t.kinds.map((k) => k.extension), t.defaultName]),
+ ].filter((k): k is string => !!k),
run: ({ arg }) => {
const directory = directoryOf(arg);
if (directory) openNewFileDialog({ directory, templateId: t.id });
@@ -76,6 +92,37 @@ function newFileAction(t: FileTemplate): Action {
};
}
+/** New popup / New › entries: the enabled templates ("File" is the project view's own entry), then From Template…. */
+function registerNewMenuGroups(): () => void {
+ const arg = (ctx: MenuGroupContext) => (ctx.paths[0] ? { directory: ctx.paths[0] } : undefined);
+ const disposers = [
+ registerMenuGroup({
+ id: "templates.new",
+ menus: ["new"],
+ order: 10,
+ items: (_menu, ctx) =>
+ fileTemplates()
+ .filter((t) => t.enabled !== false && t.id !== "file")
+ .map((t) => ({
+ kind: "action",
+ action: `templates.new.${t.id}`,
+ arg: arg(ctx),
+ label: t.name,
+ icon: t.icon,
+ })),
+ }),
+ registerMenuGroup({
+ id: "templates.newFromTemplate",
+ menus: ["new"],
+ order: 100,
+ items: (_menu, ctx) => [
+ { kind: "action", action: "templates.newFromTemplate", arg: arg(ctx), label: "From Template…" },
+ ],
+ }),
+ ];
+ return () => disposers.forEach((d) => d());
+}
+
function registerFileTemplateActions(): () => void {
let disposers: Array<() => void> = [];
const sync = (templates: FileTemplate[]) => {
@@ -117,7 +164,7 @@ export function activateSettingsPages(): () => void {
title: "File and Code Templates",
group: "Editor",
order: 26,
- keywords: ["new file", "class", "template", "package"],
+ keywords: ["new file", "class", "template", "package", "includes", "file header", "code", "scheme", "reformat"],
component: lazyComponent(() => import("./settings/FileTemplatesPage").then((m) => m.FileTemplatesPage)),
}),
];
@@ -181,13 +228,22 @@ export function activate(): () => void {
const directory = directoryOf(arg);
if (!directory) return;
const a = (arg ?? {}) as NewFileArg;
- openNewFileDialog({ directory, templateId: a.templateId ?? templateForExtension(a.extension, a.kindId), name: a.name, kindId: a.kindId });
+ if (isTemplate(a.template))
+ return openNewFileDialog({ directory, template: a.template, name: a.name, kindId: a.kindId });
+ openNewFileDialog({
+ directory,
+ templateId: a.templateId ?? templateForExtension(a.extension, a.kindId),
+ name: a.name,
+ kindId: a.kindId,
+ });
},
},
]),
registerFileTemplateActions(),
+ registerNewMenuGroups(),
activateSettingsPages(),
syncTemplatesFromStorage(),
+ watchTemplateProject(),
];
return () => disposers.reverse().forEach((d) => d());
}
diff --git a/src/features/templates/settings/FileTemplatesPage.tsx b/src/features/templates/settings/FileTemplatesPage.tsx
index 55d0f52ad..5dcf838bd 100644
--- a/src/features/templates/settings/FileTemplatesPage.tsx
+++ b/src/features/templates/settings/FileTemplatesPage.tsx
@@ -1,15 +1,27 @@
-/** Settings › Editor › File Templates. */
-import { useState } from "react";
+/** Settings › Editor › File and Code Templates: Files, Includes and Code tabs per scheme. */
+import { useEffect, useState } from "react";
import clsx from "clsx";
+import { tx, useTx } from "@/platform/i18n";
import { Button, Checkbox, Icon, IconButton, Input, Select, T } from "@/ui";
-import type { FileTemplate, NameStyle } from "../files/model";
+import { reformatsOnCreate, type FileTemplate, type NameStyle, type TemplateFragment } from "../files/model";
import {
isBuiltinFileTemplate,
+ isBuiltinInclude,
+ isModifiedCodeTemplate,
isModifiedFileTemplate,
+ isModifiedInclude,
+ reloadFileTemplates,
removeFileTemplate,
+ removeInclude,
+ resetCodeTemplate,
resetFileTemplate,
+ resetInclude,
+ saveCodeTemplate,
saveFileTemplate,
+ saveInclude,
+ setTemplateScheme,
useFileTemplates,
+ type TemplateScheme,
} from "../files/store";
import styles from "./Settings.module.css";
@@ -20,7 +32,59 @@ const NAME_STYLES: Array<{ value: NameStyle; label: string }> = [
{ value: "kebab", label: "kebab-case" },
];
+const SCHEMES: Array<{ value: TemplateScheme; label: string }> = [
+ { value: "default", label: "Default" },
+ { value: "project", label: "Project" },
+];
+
+type TabId = "files" | "includes" | "code";
+const TABS: Array<{ id: TabId; label: string }> = [
+ { id: "files", label: "Files" },
+ { id: "includes", label: "Includes" },
+ { id: "code", label: "Code" },
+];
+
export function FileTemplatesPage() {
+ const scheme = useFileTemplates((s) => s.scheme);
+ const root = useFileTemplates((s) => s.root);
+ const [tab, setTab] = useState<TabId>("files");
+ useEffect(() => reloadFileTemplates(), []);
+
+ return (
+ <div className={styles.page}>
+ <div className={styles.row}>
+ <span className={styles.label}>
+ <T>Scheme</T>
+ </span>
+ <Select value={scheme} options={SCHEMES} disabled={!root} onChange={setTemplateScheme} aria-label="Scheme" />
+ {scheme === "project" && (
+ <span className={styles.hint}>
+ <T>Templates of this project only</T>
+ </span>
+ )}
+ </div>
+ <div className={styles.tabs} role="tablist" aria-label={tx("Template kinds")}>
+ {TABS.map((t) => (
+ <button
+ key={t.id}
+ type="button"
+ role="tab"
+ aria-selected={tab === t.id}
+ className={clsx(styles.tab, tab === t.id && styles.tabActive)}
+ onClick={() => setTab(t.id)}
+ >
+ <T>{t.label}</T>
+ </button>
+ ))}
+ </div>
+ {tab === "files" && <FilesTab key={scheme} />}
+ {tab === "includes" && <IncludesTab key={scheme} />}
+ {tab === "code" && <CodeTab key={scheme} />}
+ </div>
+ );
+}
+
+function FilesTab() {
const templates = useFileTemplates((s) => s.templates);
useFileTemplates((s) => s.custom);
const [selectedId, setSelectedId] = useState<string | null>(templates[0]?.id ?? null);
@@ -40,57 +104,55 @@ export function FileTemplatesPage() {
};
return (
- <div className={styles.page}>
- <div className={styles.split}>
- <div className={styles.side}>
- <div className={styles.toolbar}>
- <IconButton icon="plus" size="small" title="Add Template" onClick={add} />
- <IconButton
- icon="minus"
- size="small"
- title="Remove Template"
- disabled={!selected}
- onClick={() => {
- if (!selected) return;
- removeFileTemplate(selected.id);
- setSelectedId(null);
- }}
- />
- </div>
- <div className={styles.items} role="listbox" aria-label="File templates">
- {templates.map((t) => (
- <div
- key={t.id}
- role="option"
- aria-selected={t.id === selectedId}
- className={clsx(
- styles.item,
- t.id === selectedId && styles.itemSelected,
- t.enabled === false && styles.disabledItem,
- )}
- onClick={() => setSelectedId(t.id)}
- >
- <Checkbox
- checked={t.enabled !== false}
- onChange={(v) => saveFileTemplate({ ...t, enabled: v })}
- aria-label={`Enable ${t.name}`}
- />
- <Icon name={t.icon} size={14} />
- <span className={clsx(isModifiedFileTemplate(t.id) && styles.modified)}>{t.name}</span>
- </div>
- ))}
- </div>
+ <div className={styles.split}>
+ <div className={styles.side}>
+ <div className={styles.toolbar}>
+ <IconButton icon="plus" size="small" title="Add Template" onClick={add} />
+ <IconButton
+ icon="minus"
+ size="small"
+ title="Remove Template"
+ disabled={!selected}
+ onClick={() => {
+ if (!selected) return;
+ removeFileTemplate(selected.id);
+ setSelectedId(null);
+ }}
+ />
</div>
- <div className={styles.editor}>
- {selected ? (
- <FileTemplateEditor key={selected.id} template={selected} />
- ) : (
- <div className={styles.empty}>
- <T>Select a template to edit it</T>
+ <div className={styles.items} role="listbox" aria-label={tx("File templates")}>
+ {templates.map((t) => (
+ <div
+ key={t.id}
+ role="option"
+ aria-selected={t.id === selectedId}
+ className={clsx(
+ styles.item,
+ t.id === selectedId && styles.itemSelected,
+ t.enabled === false && styles.disabledItem,
+ )}
+ onClick={() => setSelectedId(t.id)}
+ >
+ <Checkbox
+ checked={t.enabled !== false}
+ onChange={(v) => saveFileTemplate({ ...t, enabled: v })}
+ aria-label={`Enable ${t.name}`}
+ />
+ <Icon name={t.icon} size={14} />
+ <span className={clsx(isModifiedFileTemplate(t.id) && styles.modified)}>{t.name}</span>
</div>
- )}
+ ))}
</div>
</div>
+ <div className={styles.editor}>
+ {selected ? (
+ <FileTemplateEditor key={selected.id} template={selected} />
+ ) : (
+ <div className={styles.empty}>
+ <T>Select a template to edit it</T>
+ </div>
+ )}
+ </div>
</div>
);
}
@@ -140,7 +202,7 @@ function FileTemplateEditor({ template: t }: { template: FileTemplate }) {
<span className={styles.label}>
<T>Kinds</T>
</span>
- <div className={clsx(styles.tabs, styles.grow)} role="tablist" aria-label="Kinds">
+ <div className={clsx(styles.tabs, styles.grow)} role="tablist" aria-label={tx("Kinds")}>
{t.kinds.map((k, i) => (
<button
key={k.id}
@@ -191,13 +253,16 @@ function FileTemplateEditor({ template: t }: { template: FileTemplate }) {
className={styles.body}
value={kind.body}
spellCheck={false}
- aria-label="Template body"
+ aria-label={tx("Template body")}
onChange={(e) => updateKind({ body: e.target.value })}
/>
+ <Checkbox checked={reformatsOnCreate(t)} onChange={(v) => update({ reformat: v })} label="Reformat according to style" />
<div className={styles.hint}>
- Variables: <code>$NAME$</code> <code>$PACKAGE$</code> <code>$FILE_NAME$</code> <code>$PROJECT_NAME$</code>{" "}
- <code>$USER$</code> <code>$DATE$</code> <code>$TIME$</code> <code>$YEAR$</code>; <code>$END$</code> places the
- caret. A line with <code>$PACKAGE$</code> is omitted (with one following blank line) when there is no package.
+ <T>Variables:</T> <code>$NAME$</code> <code>$PACKAGE$</code> <code>$FILE_NAME$</code> <code>$PROJECT_NAME$</code>{" "}
+ <code>$USER$</code> <code>$DATE$</code> <code>$TIME$</code> <code>$YEAR$</code> <T>(or</T> <code>{"${NAME}"}</code>…);{" "}
+ <code>$END$</code> <T>places the caret. A line with</T> <code>$PACKAGE$</code>{" "}
+ <T>is omitted (with one following blank line) when there is no package.</T> <code>#parse("File Header")</code>{" "}
+ <T>inserts a template from the Includes or Code tab.</T>
</div>
{isBuiltinFileTemplate(t.id) && isModifiedFileTemplate(t.id) && (
<div className={styles.buttons}>
@@ -209,3 +274,206 @@ function FileTemplateEditor({ template: t }: { template: FileTemplate }) {
</>
);
}
+
+function FragmentList({
+ label,
+ items,
+ selected,
+ onSelect,
+ modified,
+}: {
+ label: string;
+ items: TemplateFragment[];
+ selected: string | null;
+ onSelect: (name: string) => void;
+ modified: (name: string) => boolean;
+}) {
+ return (
+ <div className={styles.items} role="listbox" aria-label={label}>
+ {items.map((f) => (
+ <div
+ key={f.name}
+ role="option"
+ aria-selected={f.name === selected}
+ className={clsx(styles.item, f.name === selected && styles.itemSelected)}
+ onClick={() => onSelect(f.name)}
+ >
+ <Icon name="file" size={14} />
+ <span className={clsx(modified(f.name) && styles.modified)}>{f.name}</span>
+ </div>
+ ))}
+ </div>
+ );
+}
+
+function IncludesTab() {
+ const includes = useFileTemplates((s) => s.includes);
+ useFileTemplates((s) => s.custom);
+ const [selectedName, setSelectedName] = useState<string | null>(includes[0]?.name ?? null);
+ const selected = includes.find((f) => f.name === selectedName) ?? null;
+
+ const add = () => {
+ let name = "New Include";
+ for (let i = 2; includes.some((f) => f.name === name); i++) name = `New Include ${i}`;
+ saveInclude({ name, body: "" });
+ setSelectedName(name);
+ };
+
+ return (
+ <div className={styles.split}>
+ <div className={styles.side}>
+ <div className={styles.toolbar}>
+ <IconButton icon="plus" size="small" title="Add Include" onClick={add} />
+ <IconButton
+ icon="minus"
+ size="small"
+ title="Remove Include"
+ disabled={!selected}
+ onClick={() => {
+ if (!selected) return;
+ removeInclude(selected.name);
+ setSelectedName(null);
+ }}
+ />
+ </div>
+ <FragmentList
+ label="Includes"
+ items={includes}
+ selected={selectedName}
+ onSelect={setSelectedName}
+ modified={isModifiedInclude}
+ />
+ </div>
+ <div className={styles.editor}>
+ {selected ? (
+ <IncludeEditor key={selected.name} include={selected} onRename={setSelectedName} taken={includes} />
+ ) : (
+ <div className={styles.empty}>
+ <T>Select a template to edit it</T>
+ </div>
+ )}
+ </div>
+ </div>
+ );
+}
+
+function IncludeEditor({
+ include: f,
+ onRename,
+ taken,
+}: {
+ include: TemplateFragment;
+ onRename: (name: string) => void;
+ taken: TemplateFragment[];
+}) {
+ const [name, setName] = useState(f.name);
+ const builtin = isBuiltinInclude(f.name);
+ const commitName = () => {
+ const next = name.trim();
+ if (!next || next === f.name || taken.some((x) => x.name === next)) return setName(f.name);
+ saveInclude({ ...f, name: next }, f.name);
+ onRename(next);
+ };
+ return (
+ <>
+ <div className={styles.row}>
+ <span className={styles.label}>
+ <T>Name</T>
+ </span>
+ <Input
+ className={styles.grow}
+ value={name}
+ disabled={builtin}
+ onChange={(e) => setName(e.target.value)}
+ onBlur={commitName}
+ onKeyDown={(e) => e.key === "Enter" && commitName()}
+ aria-label="Include name"
+ />
+ </div>
+ <textarea
+ className={styles.body}
+ value={f.body}
+ spellCheck={false}
+ aria-label={tx("Include body")}
+ onChange={(e) => saveInclude({ ...f, body: e.target.value })}
+ />
+ <div className={styles.hint}>
+ <WithCode
+ text="File templates insert this with {code}, indented like the directive; a directive line whose include is empty is dropped. The file template variables apply."
+ code={`#parse("${f.name}")`}
+ />
+ </div>
+ {builtin && isModifiedInclude(f.name) && (
+ <div className={styles.buttons}>
+ <Button size="small" onClick={() => resetInclude(f.name)}>
+ <T>Restore Default</T>
+ </Button>
+ </div>
+ )}
+ </>
+ );
+}
+
+function CodeTab() {
+ const code = useFileTemplates((s) => s.codeTemplates);
+ useFileTemplates((s) => s.custom);
+ const [selectedName, setSelectedName] = useState<string | null>(code[0]?.name ?? null);
+ const selected = code.find((f) => f.name === selectedName) ?? null;
+ return (
+ <div className={styles.split}>
+ <div className={styles.side}>
+ <FragmentList
+ label="Code templates"
+ items={code}
+ selected={selectedName}
+ onSelect={setSelectedName}
+ modified={isModifiedCodeTemplate}
+ />
+ </div>
+ <div className={styles.editor}>
+ {selected ? (
+ <>
+ {selected.description && (
+ <div className={styles.hint}>
+ <T>Used by</T> <T>{selected.description}</T>
+ </div>
+ )}
+ <textarea
+ className={styles.body}
+ value={selected.body}
+ spellCheck={false}
+ aria-label={tx("Code template body")}
+ onChange={(e) => saveCodeTemplate(selected.name, e.target.value)}
+ />
+ <div className={styles.hint}>
+ <WithCode text="Inserted where a file template says {code}." code={`#parse("${selected.name}")`} />
+ </div>
+ {isModifiedCodeTemplate(selected.name) && (
+ <div className={styles.buttons}>
+ <Button size="small" onClick={() => resetCodeTemplate(selected.name)}>
+ <T>Restore Default</T>
+ </Button>
+ </div>
+ )}
+ </>
+ ) : (
+ <div className={styles.empty}>
+ <T>Select a template to edit it</T>
+ </div>
+ )}
+ </div>
+ </div>
+ );
+}
+
+/** Translated `text` with its `{code}` placeholder rendered as `<code>`. */
+function WithCode({ text, code }: { text: string; code: string }) {
+ const [before, after = ""] = useTx()(text).split("{code}");
+ return (
+ <>
+ {before}
+ <code>{code}</code>
+ {after}
+ </>
+ );
+}
diff --git a/src/features/templates/sync.ts b/src/features/templates/sync.ts
index 72f9dd0fb..6b2c03be6 100644
--- a/src/features/templates/sync.ts
+++ b/src/features/templates/sync.ts
@@ -7,12 +7,14 @@ const reloaders: Record<string, () => void> = {
[LIVE_TEMPLATES_KEY]: reloadLiveTemplates,
[LIVE_TEMPLATE_OPTIONS_KEY]: reloadLiveTemplates,
[POSTFIX_KEY]: reloadPostfixSettings,
- [FILE_TEMPLATES_KEY]: reloadFileTemplates,
};
export function syncTemplatesFromStorage(): () => void {
const onStorage = (e: StorageEvent) => {
- if (e.key) reloaders[e.key]?.();
+ if (!e.key) return;
+ // File templates also keep per-project schemes under keys extending FILE_TEMPLATES_KEY.
+ if (e.key.startsWith(FILE_TEMPLATES_KEY)) reloadFileTemplates();
+ else reloaders[e.key]?.();
};
window.addEventListener("storage", onStorage);
return () => window.removeEventListener("storage", onStorage);
diff --git a/src/features/terminal/embedded.ts b/src/features/terminal/embedded.ts
new file mode 100644
index 000000000..f307bbdc9
--- /dev/null
+++ b/src/features/terminal/embedded.ts
@@ -0,0 +1,111 @@
+/**
+ * Terminal widgets embedded in other views (the `embeddedTerminal` service):
+ * an xterm.js instance with the terminal's font, theme and links, whose input
+ * and size go to the owner instead of a terminal PTY (a Run console emulating
+ * a terminal feeds its process).
+ */
+import { Terminal, type IDisposable } from "@xterm/xterm";
+import { FitAddon } from "@xterm/addon-fit";
+import "@xterm/xterm/css/xterm.css";
+import type { EmbeddedTerminal, EmbeddedTerminalOptions } from "@/workbench/contributions";
+import { useProject } from "@/platform/project";
+import { workflowSettings } from "@/platform/workflowSettings";
+import { findTerminalLinks } from "./links";
+import { openExternal, openFileLink } from "./session";
+import { readTerminalTheme, terminalFont, withFontExtras } from "./theme";
+
+const live = new Set<Terminal>();
+
+/** Follows a theme change (called with the terminal sessions' own update). */
+export function applyThemeToEmbedded() {
+ const theme = readTerminalTheme();
+ for (const t of live) t.options.theme = theme;
+}
+
+export function createEmbeddedTerminal(host: HTMLElement, opts: EmbeddedTerminalOptions): EmbeddedTerminal {
+ const settings = workflowSettings().terminal;
+ const editor = useProject.getState().settings?.editor as
+ { fontFamily?: string; fontSize?: number; lineHeight?: number } | undefined;
+ const font = withFontExtras(terminalFont(settings, editor), settings);
+ const term = new Terminal({
+ fontFamily: font.family,
+ fontSize: font.size,
+ lineHeight: font.lineHeight,
+ letterSpacing: font.letterSpacing,
+ cursorBlink: settings.cursorBlink,
+ cursorWidth: 2,
+ cursorInactiveStyle: "outline",
+ allowProposedApi: true,
+ scrollback: 10_000,
+ macOptionIsMeta: settings.optionAsMeta,
+ macOptionClickForcesSelection: true,
+ drawBoldTextInBrightColors: false,
+ minimumContrastRatio: 1,
+ smoothScrollDuration: 0,
+ convertEol: false,
+ theme: readTerminalTheme(),
+ });
+ const fit = new FitAddon();
+ term.loadAddon(fit);
+ live.add(term);
+ const disposables: IDisposable[] = [
+ term.onData((d) => opts.onData(d)),
+ term.onBinary((d) => opts.onData(d)),
+ term.onResize(({ cols, rows }) => opts.onResize(cols, rows)),
+ term.registerLinkProvider({
+ provideLinks(y, callback) {
+ const line = term.buffer.active.getLine(y - 1);
+ const found = line ? findTerminalLinks(line.translateToString(true)) : [];
+ if (!found.length) return callback(undefined);
+ callback(
+ found.map((l) => ({
+ text: l.text,
+ range: { start: { x: l.start + 1, y }, end: { x: l.end, y } },
+ decorations: { underline: true, pointerCursor: true },
+ activate: (event: MouseEvent) => {
+ event.preventDefault();
+ if (l.kind === "url") void openExternal(l.url);
+ else void openFileLink(l, opts.cwd ?? useProject.getState().project?.root ?? "");
+ },
+ })),
+ );
+ },
+ }),
+ ];
+ term.open(host);
+ if (opts["aria-label"]) term.textarea?.setAttribute("aria-label", opts["aria-label"]);
+
+ let raf = 0;
+ const doFit = () => {
+ raf = 0;
+ if (!host.isConnected || host.offsetWidth === 0 || host.offsetHeight === 0) return;
+ const dims = fit.proposeDimensions();
+ if (!dims || !Number.isFinite(dims.cols) || !Number.isFinite(dims.rows)) return;
+ if (dims.cols !== term.cols || dims.rows !== term.rows) term.resize(dims.cols, dims.rows);
+ };
+ const scheduleFit = () => {
+ if (!raf) raf = requestAnimationFrame(doFit);
+ };
+ const observer = new ResizeObserver(scheduleFit);
+ observer.observe(host);
+ scheduleFit();
+ // The owner learns the initial size even when it matches xterm's default.
+ queueMicrotask(() => opts.onResize(term.cols, term.rows));
+
+ return {
+ write: (data) => term.write(data),
+ clear: () => term.reset(),
+ focus: () => term.focus(),
+ fit: () => {
+ cancelAnimationFrame(raf);
+ doFit();
+ },
+ dispose: () => {
+ cancelAnimationFrame(raf);
+ observer.disconnect();
+ for (const d of disposables) d.dispose();
+ live.delete(term);
+ term.dispose();
+ },
+ };
+}
diff --git a/src/features/terminal/index.ts b/src/features/terminal/index.ts
index 66ba36f37..5ad80c385 100644
--- a/src/features/terminal/index.ts
+++ b/src/features/terminal/index.ts
@@ -6,7 +6,7 @@ import { registerActions } from "@/platform/actions";
import { onIdeEvent } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { onWorkflowSettingsChange } from "@/platform/workflowSettings";
-import { registerToolWindow, toolWindowService } from "@/workbench/contributions";
+import { provideEmbeddedTerminal, registerToolWindow, toolWindowService } from "@/workbench/contributions";
import { lazyComponent } from "@/ui";
import { installTerminalKeys } from "./keys";
import { loadTerminalRuntime, terminalRuntime } from "./loader";
@@ -191,11 +191,17 @@ export function activate(): () => void {
];
if (typeof MutationObserver !== "undefined" && typeof document !== "undefined") {
- const observer = new MutationObserver(() => terminalRuntime()?.applyThemeToAll());
+ const observer = new MutationObserver(() => {
+ terminalRuntime()?.applyThemeToAll();
+ terminalRuntime()?.applyThemeToEmbedded();
+ });
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme", "style"] });
disposers.push(() => observer.disconnect());
}
+ provideEmbeddedTerminal(async (host, options) => (await loadTerminalRuntime()).createEmbeddedTerminal(host, options));
+ disposers.push(() => provideEmbeddedTerminal(undefined));
+
return () => {
disposers.reverse().forEach((d) => d());
terminalRuntime()?.closeAll();
diff --git a/src/features/terminal/runtime.ts b/src/features/terminal/runtime.ts
index fe8bc152d..3839fd99b 100644
--- a/src/features/terminal/runtime.ts
+++ b/src/features/terminal/runtime.ts
@@ -15,4 +15,5 @@ export {
useTerminals,
} from "./store";
export { TerminalTabs, TerminalView } from "./TerminalView";
+export { applyThemeToEmbedded, createEmbeddedTerminal } from "./embedded";
export { closeTerminalFind, openTerminalFind, useTerminalFind } from "./FindBar";
diff --git a/src/features/todo/TodoView.module.css b/src/features/todo/TodoView.module.css
index 38ee6a3c4..35b8bf548 100644
--- a/src/features/todo/TodoView.module.css
+++ b/src/features/todo/TodoView.module.css
@@ -32,6 +32,19 @@
color: var(--warning);
border-bottom: 1px solid var(--border);
}
+.scopeBar {
+ flex: none;
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ height: 32px;
+ padding: 0 8px;
+ border-bottom: 1px solid var(--border);
+}
+.scopeSelect {
+ min-width: 200px;
+ max-width: 360px;
+}
.row {
display: flex;
align-items: center;
diff --git a/src/features/todo/TodoView.test.tsx b/src/features/todo/TodoView.test.tsx
index ff718e318..af16084ad 100644
--- a/src/features/todo/TodoView.test.tsx
+++ b/src/features/todo/TodoView.test.tsx
@@ -1,7 +1,8 @@
import { describe, expect, it } from "vitest";
-import { act, render, screen } from "@testing-library/react";
+import { act, fireEvent, render, screen } from "@testing-library/react";
import { TodoView, useTodoView, useTodoViewOptions } from "./TodoView";
import { useTodos } from "./store";
+import { setLocalChanges } from "@/workbench/contributions";
describe("TodoView", () => {
it("renders grouped items with the keyword emphasised and filters by keyword", () => {
@@ -29,6 +30,36 @@ describe("TodoView", () => {
act(() => useTodoView.getState().showAll());
});
+ it("lists only changed files on the Changes tab, by change list", () => {
+ let clear = () => {};
+ act(() => {
+ clear = setLocalChanges("vcs", [
+ { id: "default", name: "Changes", active: true, files: [{ path: "/p/src/b.ts" }] },
+ { id: "ui", name: "UI work", active: false, files: [{ path: "/p/src/a.ts" }] },
+ ]);
+ useTodos.setState({
+ scannedOnce: true,
+ scanned: new Map([
+ ["/p/src/a.ts", [{ path: "/p/src/a.ts", line: 0, col: 3, keyword: "TODO", text: "TODO a" }]],
+ ["/p/src/b.ts", [{ path: "/p/src/b.ts", line: 0, col: 3, keyword: "TODO", text: "TODO b" }]],
+ ]),
+ });
+ useTodoView.getState().setTab("changes");
+ });
+ render(<TodoView />);
+ expect(screen.getByText("b.ts")).toBeInTheDocument();
+ expect(screen.queryByText("a.ts")).toBeNull();
+ fireEvent.click(screen.getByLabelText("Changelist"));
+ fireEvent.click(screen.getByRole("option", { name: /UI work/ }));
+ expect(useTodoView.getState().changelist).toBe("ui");
+ expect(screen.getByText("a.ts")).toBeInTheDocument();
+ expect(screen.queryByText("b.ts")).toBeNull();
+ act(() => {
+ useTodoView.setState({ tab: "project", changelist: null });
+ clear();
+ });
+ });
+
it("shows the preview pane and does not autoscroll by default, as IDEA", () => {
expect(useTodoViewOptions.getState()).toEqual({ preview: true, autoscroll: false });
render(<TodoView />);
diff --git a/src/features/todo/TodoView.tsx b/src/features/todo/TodoView.tsx
index 655c4bd2b..8e799ecb4 100644
--- a/src/features/todo/TodoView.tsx
+++ b/src/features/todo/TodoView.tsx
@@ -1,15 +1,18 @@
-/** TODO tool window: "Project" and "Current File" tabs, grouped by file. */
-import { useCallback, useMemo, useRef, useState } from "react";
+/** TODO tool window: "Project", "Current File", "Scope Based" and "Changes" tabs, grouped by file. */
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { create } from "zustand";
import clsx from "clsx";
-import { useEditorRegistry } from "@/editor/api";
+import { openEditorPaths, useEditorRegistry } from "@/editor/api";
+import { executeAction } from "@/platform/actions";
import { basename, relativeDir, useProject } from "@/platform/project";
-import { editorService, useOccurrenceNavigator } from "@/workbench/contributions";
+import { EDIT_SCOPES_ACTION, useCustomScopeList } from "@/platform/search";
+import { editorService, useLocalChanges, useOccurrenceNavigator } from "@/workbench/contributions";
import {
EmptyState,
Icon,
IconButton,
Menu,
+ Select,
SourcePreview,
SplitGroup,
SplitHandle,
@@ -24,18 +27,46 @@ import {
T,
} from "@/ui";
import { previewText } from "./ipc";
-import { activePatterns, countItems, groupTodos, mergeLive, type TodoGroup, type TodoItem } from "./model";
-import { scanProject, updateTodoSettings, useTodoSettings, useTodos } from "./store";
+import {
+ BUILTIN_TODO_SCOPES,
+ activePatterns,
+ changedPaths,
+ countItems,
+ groupTodos,
+ mergeLive,
+ todoSearchScope,
+ type TodoGroup,
+ type TodoItem,
+ type TodoScope,
+} from "./model";
+import { scanProject, scanScope, updateTodoSettings, useTodoSettings, useTodos } from "./store";
import styles from "./TodoView.module.css";
-type Tab = "project" | "file";
+type Tab = "project" | "file" | "scope" | "changes";
+
+const SCOPE_KEY = "openidea.todo.scope.v1";
+
+function loadScope(): TodoScope {
+ try {
+ const v = globalThis.localStorage?.getItem(SCOPE_KEY);
+ if (v && (BUILTIN_TODO_SCOPES.some((s) => s.value === v) || v.startsWith("custom:"))) return v as TodoScope;
+ } catch {
+ /* storage unavailable */
+ }
+ return "projectFiles";
+}
interface ViewState {
tab: Tab;
/** Hidden keywords (filter). */
hidden: string[];
collapsed: Set<string>;
+ /** The Scope Based tab's scope. */
+ scope: TodoScope;
+ /** The Changes tab's change list (null: the active one). */
+ changelist: string | null;
setTab(tab: Tab): void;
+ setScope(scope: TodoScope): void;
toggleKeyword(k: string): void;
showAll(): void;
}
@@ -44,7 +75,17 @@ export const useTodoView = create<ViewState>((set) => ({
tab: "project",
hidden: [],
collapsed: new Set(),
+ scope: loadScope(),
+ changelist: null,
setTab: (tab) => set({ tab }),
+ setScope: (scope) => {
+ set({ scope });
+ try {
+ globalThis.localStorage?.setItem(SCOPE_KEY, scope);
+ } catch {
+ /* storage unavailable */
+ }
+ },
toggleKeyword: (k) =>
set((s) => ({ hidden: s.hidden.includes(k) ? s.hidden.filter((h) => h !== k) : [...s.hidden, k] })),
showAll: () => set({ hidden: [] }),
@@ -106,21 +147,112 @@ function keywordFilter(hidden: readonly string[], all: readonly string[]): Set<s
return hidden.length ? new Set(all.filter((k) => !hidden.includes(k))) : null;
}
+/** Files of the chosen change list (the VCS change lists; empty without VCS). */
+function useChangedPaths(): Set<string> {
+ const lists = useLocalChanges((s) => s.lists);
+ const listId = useTodoView((s) => s.changelist);
+ return useMemo(() => changedPaths(lists, listId), [lists, listId]);
+}
+
/** Groups for a tab (exported for the badge and tests). */
export function useTodoGroups(tab: Tab): TodoGroup[] {
const scanned = useTodos((s) => s.scanned);
+ const scoped = useTodos((s) => s.scoped);
const live = useTodos((s) => s.live);
const hidden = useTodoView((s) => s.hidden);
const patterns = useTodoSettings((s) => s.patterns);
const current = useEditorRegistry((s) => s.active?.ctx.path ?? null);
+ const changed = useChangedPaths();
return useMemo(() => {
- const merged = mergeLive(scanned, live);
const keywords = keywordFilter(
hidden,
patterns.map((p) => p.keyword.trim()),
);
+ if (tab === "scope") {
+ // Open editors' unsaved text, for the files the scope scan found.
+ const inScope = new Map([...live].filter(([path]) => scoped.has(path)));
+ return groupTodos(mergeLive(scoped, inScope), { keywords });
+ }
+ const merged = mergeLive(scanned, live);
+ if (tab === "changes") return groupTodos(merged, { keywords, paths: changed });
return groupTodos(merged, tab === "file" ? { keywords, path: current } : { keywords });
- }, [scanned, live, hidden, patterns, tab, current]);
+ }, [scanned, scoped, live, hidden, patterns, tab, current, changed]);
+}
+
+/** The Scope Based tab's scope as the backend scope, with a key that changes when it does. */
+function useScopeQuery() {
+ const scope = useTodoView((s) => s.scope);
+ const custom = useCustomScopeList();
+ // Open tabs change with the active editor (or its count): re-read them then.
+ const openKey = useEditorRegistry((s) => (scope === "openFiles" ? `${s.editors.size}:${s.active?.ctx.path ?? ""}` : ""));
+ return useMemo(() => {
+ const search = todoSearchScope(scope, custom, scope === "openFiles" ? openEditorPaths() : []);
+ return { search, key: JSON.stringify(search) };
+ }, [scope, custom, openKey]); // eslint-disable-line react-hooks/exhaustive-deps
+}
+
+/** Rescans the chosen scope when it changes, and (debounced) when the project index does. */
+function useScopeScan(active: boolean) {
+ const { search, key } = useScopeQuery();
+ const scanned = useTodos((s) => s.scanned);
+ const scopedKey = useTodos((s) => s.scopedKey);
+ const fresh = scopedKey === key;
+ useEffect(() => {
+ if (!active) return;
+ if (!fresh) {
+ void scanScope(key, search);
+ return;
+ }
+ const t = setTimeout(() => void scanScope(key, search), 800);
+ return () => clearTimeout(t);
+ // `fresh` only gates the first scan of a scope; later ones follow the project index.
+ }, [active, key, scanned]); // eslint-disable-line react-hooks/exhaustive-deps
+}
+
+/** IDEA's "Changelist:" chooser above the Changes tab (when there is more than one list). */
+function ChangelistBar() {
+ const lists = useLocalChanges((s) => s.lists);
+ const chosen = useTodoView((s) => s.changelist);
+ if (lists.length < 2) return null;
+ const value = lists.find((l) => l.id === chosen)?.id ?? lists.find((l) => l.active)?.id ?? lists[0]!.id;
+ return (
+ <div className={styles.scopeBar}>
+ <span className={styles.muted}>
+ <T>Changelist:</T>
+ </span>
+ <Select<string>
+ aria-label="Changelist"
+ className={styles.scopeSelect}
+ value={value}
+ options={lists.map((l) => ({ value: l.id, label: l.name, detail: `${l.files.length} file${l.files.length === 1 ? "" : "s"}` }))}
+ onChange={(id) => useTodoView.setState({ changelist: id })}
+ />
+ </div>
+ );
+}
+
+function ScopeBar() {
+ const scope = useTodoView((s) => s.scope);
+ const setScope = useTodoView((s) => s.setScope);
+ const custom = useCustomScopeList();
+ const options = [
+ ...BUILTIN_TODO_SCOPES,
+ ...custom.map((c) => ({ value: `custom:${c.name}` as TodoScope, label: c.name, detail: c.pattern })),
+ ];
+ return (
+ <div className={styles.scopeBar}>
+ <span className={styles.muted}>
+ <T>Scope:</T>
+ </span>
+ <Select<TodoScope> aria-label="Scope" className={styles.scopeSelect} value={scope} options={options} onChange={setScope} />
+ <IconButton
+ icon="more-horizontal"
+ size="small"
+ title="Edit Scopes…"
+ onClick={() => void executeAction(EDIT_SCOPES_ACTION, scope.startsWith("custom:") ? { select: scope.slice(7) } : undefined)}
+ />
+ </div>
+ );
}
export function useTodoBadge(): number | null {
@@ -193,13 +325,14 @@ export function TodoHeaderActions() {
);
}
-/** Scope tabs in the tool window header: "Project" / "Current File". */
+/** Scope tabs in the tool window header: "Project" / "Current File" / "Scope Based" / "Changes". */
export function TodoTabs() {
const tab = useTodoView((s) => s.tab);
const setTab = useTodoView((s) => s.setTab);
const current = useEditorRegistry((s) => s.active?.ctx.path ?? null);
const projectCount = countItems(useTodoGroups("project"));
const fileCount = countItems(useTodoGroups("file"));
+ const changesCount = countItems(useTodoGroups("changes"));
return (
<Tabs
variant="compact"
@@ -225,6 +358,13 @@ export function TodoTabs() {
text: "Current File",
trailing: fileCount ? <span className={styles.tabCount}>{fileCount}</span> : undefined,
},
+ { id: "scope", label: "Scope Based" },
+ {
+ id: "changes",
+ label: "Changes",
+ tooltip: "TODO items in files of a changelist",
+ trailing: changesCount ? <span className={styles.tabCount}>{changesCount}</span> : undefined,
+ },
]}
/>
);
@@ -235,8 +375,10 @@ export function TodoView() {
const collapsed = useTodoView((s) => s.collapsed);
const root = useProject((s) => s.project?.root ?? "");
const current = useEditorRegistry((s) => s.active?.ctx.path ?? null);
- const { scanning, error, limitHit, scannedOnce } = useTodos();
+ const { scanning, error, limitHit, scannedOnce, scopedScanning, scopedKey } = useTodos();
const groups = useTodoGroups(tab);
+ useScopeScan(tab === "scope");
+ const scopeKey = useScopeQuery().key;
const showPreview = useTodoViewOptions((o) => o.preview);
const tree = useRef<TreeHandle>(null);
const [lead, setLead] = useState<Node | null>(null);
@@ -289,6 +431,16 @@ export function TodoView() {
const empty =
tab === "file" && !current ? (
<EmptyState icon="todo" title="No file is open" />
+ ) : tab === "scope" ? (
+ scopedScanning || scopedKey !== scopeKey ? (
+ <div className={styles.loading}>
+ <Spinner size={14} /> <T>Scanning for TODO items…</T>
+ </div>
+ ) : (
+ <EmptyState icon="todo" title="No TODO items found in this scope" />
+ )
+ ) : tab === "changes" ? (
+ <EmptyState icon="todo" title="No TODO items in changed files" />
) : error && tab === "project" ? (
<EmptyState icon="todo" title="TODO items unavailable">
{error}
@@ -308,6 +460,8 @@ export function TodoView() {
<T>Too many matches; showing the first 10 000.</T>
</div>
)}
+ {tab === "scope" && <ScopeBar />}
+ {tab === "changes" && <ChangelistBar />}
<div className={styles.body}>
<SplitGroup orientation="horizontal" id="todo-preview-split">
<SplitPanel id="items" minSize={160} className={styles.panel}>
diff --git a/src/features/todo/model.ts b/src/features/todo/model.ts
index fd572774c..73fa89a49 100644
--- a/src/features/todo/model.ts
+++ b/src/features/todo/model.ts
@@ -3,6 +3,8 @@
* matches, local scanning of editor text, grouping and filters.
*/
import type { FileMatches, SearchQuery, SearchScope } from "@/platform/ipc";
+import type { CustomScope } from "@/platform/search";
+import { localChangedPaths, type LocalChangelist } from "@/workbench/contributions";
export interface TodoPattern {
id: string;
@@ -139,6 +141,8 @@ export interface TodoFilter {
keywords: ReadonlySet<string> | null;
/** Restrict to one file (Current File tab). */
path?: string | null;
+ /** Restrict to these files (Changes tab). */
+ paths?: ReadonlySet<string>;
}
export function filterItems(items: readonly TodoItem[], f: TodoFilter): TodoItem[] {
@@ -147,7 +151,8 @@ export function filterItems(items: readonly TodoItem[], f: TodoFilter): TodoItem
/** Groups by file (sorted by path), items by position; empty groups dropped. */
export function groupTodos(map: ReadonlyMap<string, readonly TodoItem[]>, f: TodoFilter): TodoGroup[] {
- const paths = f.path !== undefined ? (f.path && map.has(f.path) ? [f.path] : []) : [...map.keys()];
+ const all = f.path !== undefined ? (f.path && map.has(f.path) ? [f.path] : []) : [...map.keys()];
+ const paths = f.paths ? all.filter((p) => f.paths!.has(p)) : all;
const groups: TodoGroup[] = [];
for (const path of paths) {
const items = filterItems(map.get(path) ?? [], f).sort((a, b) => a.line - b.line || a.col - b.col);
@@ -167,3 +172,43 @@ export function mergeLive(
for (const [path, items] of live) out.set(path, items);
return out;
}
+
+/** A scope of the "Scope Based" tab: a built-in one or a custom scope (`custom:<name>`, `@/platform/search`). */
+export type TodoScope = "projectFiles" | "productionFiles" | "testFiles" | "openFiles" | `custom:${string}`;
+
+export const BUILTIN_TODO_SCOPES: ReadonlyArray<{ value: TodoScope; label: string }> = [
+ { value: "projectFiles", label: "Project Files" },
+ { value: "productionFiles", label: "Project Production Files" },
+ { value: "testFiles", label: "Project Test Files" },
+ { value: "openFiles", label: "Open Files" },
+];
+
+/** The backend scope to scan, or null when there is nothing to scan (no open files, unknown custom scope). */
+export function todoSearchScope(
+ scope: TodoScope,
+ custom: readonly CustomScope[],
+ openPaths: readonly string[],
+): SearchScope | null {
+ switch (scope) {
+ case "projectFiles":
+ return { kind: "project" };
+ case "productionFiles":
+ return { kind: "fileSet", set: "production" };
+ case "testFiles":
+ return { kind: "fileSet", set: "test" };
+ case "openFiles":
+ return openPaths.length ? { kind: "files", paths: [...openPaths] } : null;
+ }
+ const name = scope.slice("custom:".length);
+ const found = custom.find((c) => c.name === name);
+ return found ? { kind: "pattern", pattern: found.pattern } : null;
+}
+
+/**
+ * Files with local changes in change list `listId` (the active one when unset or
+ * gone), from the VCS change lists: unversioned and ignored files belong to no list.
+ */
+export function changedPaths(lists: readonly LocalChangelist[], listId?: string | null): Set<string> {
+ const id = lists.find((l) => l.id === listId)?.id ?? lists.find((l) => l.active)?.id ?? lists[0]?.id;
+ return new Set(id ? localChangedPaths(lists, id, true) : []);
+}
diff --git a/src/features/todo/store.ts b/src/features/todo/store.ts
index c4eea06fc..68d449eb2 100644
--- a/src/features/todo/store.ts
+++ b/src/features/todo/store.ts
@@ -5,7 +5,7 @@
import { Channel } from "@tauri-apps/api/core";
import { create } from "zustand";
import { call, cancelRequestSafe, commands, isTauri, nextRequestId, onIdeEvent } from "./ipc";
-import type { RequestId, SearchEvent, SearchQuery } from "@/platform/ipc";
+import type { RequestId, SearchEvent, SearchQuery, SearchScope } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { onEditorEvent } from "@/editor/api";
import { buildTodoQuery, DEFAULT_TODO_SETTINGS, itemsFromMatches, type TodoItem, type TodoSettings } from "./model";
@@ -51,6 +51,10 @@ interface TodoState {
error: string | null;
limitHit: boolean;
scannedOnce: boolean;
+ /** Results of the "Scope Based" tab's scan, for the scope `scopedKey`. */
+ scoped: Map<string, TodoItem[]>;
+ scopedKey: string | null;
+ scopedScanning: boolean;
}
export const useTodos = create<TodoState>(() => ({
@@ -60,6 +64,9 @@ export const useTodos = create<TodoState>(() => ({
error: null,
limitHit: false,
scannedOnce: false,
+ scoped: new Map(),
+ scopedKey: null,
+ scopedScanning: false,
}));
export function setLiveTodos(path: string, items: TodoItem[] | null) {
@@ -71,11 +78,18 @@ export function setLiveTodos(path: string, items: TodoItem[] | null) {
});
}
-let inflight: RequestId | null = null;
+/** The running scan of a consumer (the project index, the Scope Based tab). */
+interface Slot {
+ id: RequestId | null;
+}
+
+const projectSlot: Slot = { id: null };
+const scopeSlot: Slot = { id: null };
function run(
query: SearchQuery,
onFile: (path: string, items: TodoItem[]) => void,
+ slot: Slot = projectSlot,
): Promise<{ limitHit: boolean } | null> {
const settings = useTodoSettings.getState();
return new Promise((resolve, reject) => {
@@ -84,14 +98,14 @@ function run(
const finish = (v: { limitHit: boolean } | null) => {
if (settled) return;
settled = true;
- if (inflight === id) inflight = null;
+ if (slot.id === id) slot.id = null;
resolve(v);
};
- if (inflight !== null) cancelRequestSafe(inflight);
- inflight = id;
+ if (slot.id !== null) cancelRequestSafe(slot.id);
+ slot.id = id;
const channel = new Channel<SearchEvent>();
channel.onmessage = (ev) => {
- if (settled || inflight !== id) return;
+ if (settled || slot.id !== id) return;
if (ev.type === "file") onFile(ev.file.path, itemsFromMatches(ev.file, settings));
else finish(ev.summary.cancelled ? null : { limitHit: ev.summary.limitHit });
};
@@ -100,7 +114,7 @@ function run(
(e) => {
if (settled) return;
settled = true;
- if (inflight === id) inflight = null;
+ if (slot.id === id) slot.id = null;
reject(e);
},
);
@@ -157,7 +171,7 @@ export async function scanProject(): Promise<void> {
/** Rescans a few files (after saves / external changes). */
export async function rescanFiles(paths: string[], removed: string[] = []): Promise<void> {
if (!isTauri()) return;
- if (inflight !== null) {
+ if (projectSlot.id !== null) {
// Wait for the running scan instead of cancelling it.
queueRefresh(paths, removed, 1000);
return;
@@ -198,6 +212,37 @@ function dropPaths(paths: string[]) {
});
}
+let scopeSeq = 0;
+
+/**
+ * Scans `scope` for the Scope Based tab (null: nothing to scan). `key` names the
+ * scope, so the view can tell whether the results are for the chosen one.
+ */
+export async function scanScope(key: string, scope: SearchScope | null): Promise<void> {
+ const seq = ++scopeSeq;
+ const query = scope && isTauri() ? buildTodoQuery(useTodoSettings.getState(), scope) : null;
+ if (!query) {
+ if (scopeSlot.id !== null) cancelRequestSafe(scopeSlot.id);
+ useTodos.setState({ scoped: new Map(), scopedKey: key, scopedScanning: false });
+ return;
+ }
+ useTodos.setState((s) => ({ scopedScanning: true, scoped: s.scopedKey === key ? s.scoped : new Map(), scopedKey: key }));
+ const found = new Map<string, TodoItem[]>();
+ try {
+ const r = await run(
+ query,
+ (path, items) => {
+ if (items.length) found.set(path, items);
+ },
+ scopeSlot,
+ );
+ if (seq !== scopeSeq || !r) return;
+ useTodos.setState({ scoped: found, scopedScanning: false });
+ } catch {
+ if (seq === scopeSeq) useTodos.setState({ scoped: new Map(), scopedScanning: false });
+ }
+}
+
// --- incremental refresh -------------------------------------------------------
const pending = new Set<string>();
@@ -236,7 +281,7 @@ export function installTodoIndex(): () => void {
const r = s.project?.root ?? null;
if (r === root) return;
root = r;
- useTodos.setState({ scanned: new Map(), live: new Map(), scannedOnce: false, error: null });
+ useTodos.setState({ scanned: new Map(), live: new Map(), scannedOnce: false, error: null, scoped: new Map(), scopedKey: null });
if (r) start();
});
let settings = useTodoSettings.getState();
@@ -262,7 +307,8 @@ export function installTodoIndex(): () => void {
return () => {
if (startTimer) clearTimeout(startTimer);
if (timer) clearTimeout(timer);
- if (inflight !== null) cancelRequestSafe(inflight);
+ if (projectSlot.id !== null) cancelRequestSafe(projectSlot.id);
+ if (scopeSlot.id !== null) cancelRequestSafe(scopeSlot.id);
unsubProject();
unsubSettings();
unsubFs();
diff --git a/src/features/todo/todo.test.ts b/src/features/todo/todo.test.ts
index 46e5fbe0b..9eba2ff60 100644
--- a/src/features/todo/todo.test.ts
+++ b/src/features/todo/todo.test.ts
@@ -6,6 +6,8 @@ import { languages } from "@codemirror/language-data";
import type { FileMatches } from "@/platform/ipc";
import {
buildTodoQuery,
+ changedPaths,
+ todoSearchScope,
countItems,
DEFAULT_TODO_SETTINGS,
groupTodos,
@@ -129,3 +131,30 @@ describe("editor highlighting", () => {
view.destroy();
});
});
+
+describe("scope based and changes tabs", () => {
+ it("maps scopes to backend scopes", () => {
+ const custom = [{ name: "Web", pattern: "file:web//*" }];
+ expect(todoSearchScope("projectFiles", custom, [])).toEqual({ kind: "project" });
+ expect(todoSearchScope("testFiles", custom, [])).toEqual({ kind: "fileSet", set: "test" });
+ expect(todoSearchScope("openFiles", custom, [])).toBeNull();
+ expect(todoSearchScope("openFiles", custom, ["/p/a.ts"])).toEqual({ kind: "files", paths: ["/p/a.ts"] });
+ expect(todoSearchScope("custom:Web", custom, [])).toEqual({ kind: "pattern", pattern: "file:web//*" });
+ expect(todoSearchScope("custom:Gone", custom, [])).toBeNull();
+ });
+
+ it("keeps only files of the chosen change list (the active one by default)", () => {
+ const lists = [
+ { id: "default", name: "Changes", active: true, files: [{ path: "/p/a.ts" }, { path: "/p/new.ts" }, { path: "/p/gone.ts", deleted: true }] },
+ { id: "ui", name: "UI", active: false, files: [{ path: "/p/b.ts" }] },
+ ];
+ const changed = changedPaths(lists);
+ expect([...changed]).toEqual(["/p/a.ts", "/p/new.ts"]);
+ const item = (path: string) => ({ path, line: 0, col: 0, keyword: "TODO", text: "TODO" });
+ const map = new Map(["/p/a.ts", "/p/b.ts"].map((p) => [p, [item(p)]]));
+ expect(groupTodos(map, { keywords: null, paths: changed }).map((g) => g.path)).toEqual(["/p/a.ts"]);
+ expect([...changedPaths(lists, "ui")]).toEqual(["/p/b.ts"]);
+ expect([...changedPaths(lists, "gone")]).toEqual(["/p/a.ts", "/p/new.ts"]);
+ expect(changedPaths([]).size).toBe(0);
+ });
+});
diff --git a/src/features/vcs/CommitView.tsx b/src/features/vcs/CommitView.tsx
index 88d752a9d..b5f70fbd1 100644
--- a/src/features/vcs/CommitView.tsx
+++ b/src/features/vcs/CommitView.tsx
@@ -313,7 +313,7 @@ function ChangesPanel() {
<SplitGroup orientation="vertical" className={styles.split}>
<SplitPanel defaultSize="62%" minSize="20%">
<div className={styles.changes}>
- <div className={styles.toolbar} role="toolbar" aria-label="Changes">
+ <div className={styles.toolbar} role="toolbar" aria-label={tx("Changes")}>
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void refreshNow()} />
<IconButton icon="undo" action="vcs.rollback" size="small" />
<IconButton icon="git-pull" action="vcs.update" size="small" />
@@ -730,7 +730,7 @@ function StashesPanel() {
const current = stashes[active];
return (
<div className={styles.changes}>
- <div className={styles.toolbar} role="toolbar" aria-label="Stashes">
+ <div className={styles.toolbar} role="toolbar" aria-label={tx("Stashes")}>
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void loadStashes()} />
<IconButton icon="plus" title="Stash Changes…" size="small" onClick={() => void stashChanges()} />
<span className={styles.sep} />
diff --git a/src/features/vcs/DiffEditor.tsx b/src/features/vcs/DiffEditor.tsx
index 35a4358d4..7da9a4202 100644
--- a/src/features/vcs/DiffEditor.tsx
+++ b/src/features/vcs/DiffEditor.tsx
@@ -472,7 +472,7 @@ export function DiffEditor({ input }: { input: EditorInput }) {
}
}}
>
- <div className={styles.toolbar} role="toolbar" aria-label="Diff">
+ <div className={styles.toolbar} role="toolbar" aria-label={tx("Diff")}>
<IconButton icon="arrow-up" title="Previous Difference" shortcut={shortcutLabel("diff.prevDifference")} size="small" onClick={() => step(-1)} />
<IconButton icon="arrow-down" title="Next Difference" shortcut={shortcutLabel("diff.nextDifference")} size="small" onClick={() => step(1)} />
<span className={styles.sep} />
diff --git a/src/features/vcs/GitLog.module.css b/src/features/vcs/GitLog.module.css
index 1c42d7a5e..257ab1def 100644
--- a/src/features/vcs/GitLog.module.css
+++ b/src/features/vcs/GitLog.module.css
@@ -139,6 +139,10 @@
cursor: default;
font-size: var(--fs-ui);
}
+/* View Options › Highlight › Current Branch (before .row:hover / .selected so they win). */
+.currentBranch {
+ background: color-mix(in srgb, var(--accent) 7%, transparent);
+}
.row:hover {
background: var(--bg-tree-hover);
}
@@ -169,6 +173,18 @@
overflow: hidden;
text-overflow: ellipsis;
}
+.colHash {
+ flex: none;
+ width: 72px;
+ overflow: hidden;
+}
+.mine {
+ font-weight: 600;
+ color: var(--fg);
+}
+.mergeSubject {
+ color: var(--fg-subtle);
+}
.muted {
color: var(--fg-subtle);
}
@@ -197,6 +213,9 @@
overflow: hidden;
margin-left: auto;
}
+.refsLeft {
+ margin-left: 0;
+}
.ref {
display: inline-flex;
align-items: center;
diff --git a/src/features/vcs/GitLog.tsx b/src/features/vcs/GitLog.tsx
index 3eb4f7f6b..21093f1b6 100644
--- a/src/features/vcs/GitLog.tsx
+++ b/src/features/vcs/GitLog.tsx
@@ -32,23 +32,25 @@ import {
T,
} from "@/ui";
import { commitFileDiffData, openDiff, withChain } from "./diffInput";
-import { laneColor, type GraphRow } from "./graph";
+import { collapseLinear, computeGraph, hideLongEdges, laneColor, reachableFrom, type GraphRow } from "./graph";
import {
extendCommitSelection,
goToChild,
goToParent,
+ isMine,
loadMore,
ME,
dateRangeLabel,
- inDateRange,
refsSignature,
reloadLog,
selectCommit,
selectedCommits,
setLogFilters,
toggleCommitSelection,
+ updateLogOptions,
useGitLog,
} from "./logStore";
+import { refLabels, useLogOptions, type LogOptions } from "./logOptions";
import { KIND_COLOR, baseName, formatTime, relTo, type EffectiveKind } from "./model";
import { clearConsole, useVcsConsole } from "./ops";
import { currentRepo, loadBranches, useVcs } from "./store";
@@ -455,10 +457,77 @@ function FilterBar() {
/>
<span className={styles.grow} />
<IconButton icon="refresh" title="Refresh" size="small" onClick={() => void reloadLog()} />
+ <IconButton
+ icon="sort"
+ title="Graph Options"
+ size="small"
+ aria-haspopup="menu"
+ onClick={(e) => menuBelow(e, graphOptionsMenu(useLogOptions.getState()))}
+ />
+ <IconButton
+ icon="eye"
+ title="View Options"
+ size="small"
+ aria-haspopup="menu"
+ onClick={(e) => menuBelow(e, viewOptionsMenu(useLogOptions.getState()))}
+ />
+ <IconButton icon="search" title="Go to Hash/Branch/Tag" size="small" action="vcs.log.goToRef" />
</div>
);
}
+const toggle = (label: string, o: LogOptions, key: keyof LogOptions): MenuItem => ({
+ label,
+ checked: !!o[key],
+ run: () => updateLogOptions({ [key]: !o[key] }),
+});
+
+/** IDEA's Git Log › Graph Options (sort, first parent / no merges, linear branches). */
+export function graphOptionsMenu(o: LogOptions): MenuItem[] {
+ return [
+ { kind: "header", label: "Sort" },
+ { label: "By Commit Date", checked: o.sort === "date", run: () => updateLogOptions({ sort: "date" }) },
+ { label: "Topologically", checked: o.sort === "topo", run: () => updateLogOptions({ sort: "topo" }) },
+ { kind: "separator" },
+ { kind: "header", label: "Options" },
+ toggle("First Parent", o, "firstParent"),
+ toggle("No Merges", o, "noMerges"),
+ { kind: "separator" },
+ { kind: "header", label: "Branch Actions" },
+ {
+ label: "Collapse Linear Branches",
+ disabled: o.collapseLinear,
+ run: () => updateLogOptions({ collapseLinear: true }),
+ },
+ {
+ label: "Expand Linear Branches",
+ disabled: !o.collapseLinear,
+ run: () => updateLogOptions({ collapseLinear: false }),
+ },
+ ];
+}
+
+/** IDEA's Git Log › View Options (what rows show and highlight). */
+export function viewOptionsMenu(o: LogOptions): MenuItem[] {
+ return [
+ { kind: "header", label: "Show" },
+ toggle("Compact References View", o, "compactRefs"),
+ toggle("Tag Names", o, "tagNames"),
+ toggle("Long Edges", o, "longEdges"),
+ toggle("Commit Timestamp", o, "commitTimestamp"),
+ toggle("References on the Left", o, "refsOnLeft"),
+ {
+ label: "Columns",
+ submenu: [toggle("Author", o, "showAuthor"), toggle("Date", o, "showDate"), toggle("Hash", o, "showHash")],
+ },
+ { kind: "separator" },
+ { kind: "header", label: "Highlight" },
+ toggle("My Commits", o, "highlightMine"),
+ toggle("Merge Commits", o, "highlightMerges"),
+ toggle("Current Branch", o, "highlightCurrentBranch"),
+ ];
+}
+
/** IDEA's Git Log commit context menu (Git.Log.ContextMenu); `selection` = all selected commits, newest first. */
export function commitMenu(c: Commit, selection: Commit[] = [c]): MenuItem[] {
const many = selection.length > 1 && selection.some((x) => x.id === c.id);
@@ -521,14 +590,28 @@ export function commitMenu(c: Commit, selection: Commit[] = [c]): MenuItem[] {
function CommitList() {
const all = useGitLog((s) => s.commits);
const allRows = useGitLog((s) => s.rows);
- const date = useGitLog((s) => s.filters.date);
- // The date filter is applied here; the graph is hidden while it is active (rows are no longer contiguous).
- const commits = useMemo(
- () => (date == null ? all : all.filter((c) => inDateRange(c.timeMs ?? 0, date))),
- [all, date],
+ const opts = useLogOptions();
+ const user = useGitLog((s) => s.user);
+ const headCommit = useVcs((s) => s.branch?.headCommit ?? null);
+ const branches = useVcs((s) => s.branches);
+ const remoteNames = useMemo(() => new Set(branches.filter((b) => b.remote).map((b) => b.name)), [branches]);
+ // Date, No Merges and First Parent are applied by the backend with parent rewriting,
+ // so the graph stays connected under them.
+ const collapsed = useMemo(
+ () => (opts.collapseLinear ? collapseLinear(all, new Set(headCommit ? [headCommit] : [])) : null),
+ [all, opts.collapseLinear, headCommit],
);
- const rows = date == null ? allRows : [];
- const exhausted = date?.after != null && all.length > 0 && (all[all.length - 1]!.timeMs ?? 0) < date.after;
+ const commits = collapsed ? collapsed.commits : all;
+ const rows = useMemo(() => {
+ const laid = collapsed ? computeGraph(collapsed.graph).rows : allRows;
+ return opts.longEdges ? laid : hideLongEdges(laid);
+ }, [collapsed, allRows, opts.longEdges]);
+ const onBranch = useMemo(() => {
+ if (!opts.highlightCurrentBranch) return null;
+ const reach = reachableFrom(all, headCommit);
+ // Nothing to tell apart when only the current branch is shown.
+ return all.every((c) => reach.has(c.id)) ? null : reach;
+ }, [all, headCommit, opts.highlightCurrentBranch]);
const loading = useGitLog((s) => s.loading);
const done = useGitLog((s) => s.done);
const error = useGitLog((s) => s.error);
@@ -536,9 +619,8 @@ function CommitList() {
const selection = useGitLog((s) => s.selection);
const selectedSet = useMemo(() => new Set(selection), [selection]);
const revealTick = useGitLog((s) => s.revealTick);
- const headCommit = useVcs((s) => s.branch?.headCommit ?? null);
const scrollRef = useRef<HTMLDivElement>(null);
- const finished = done || exhausted;
+ const finished = done;
const virtualizer = useVirtualizer({
count: commits.length + (finished ? 0 : 1),
getScrollElement: () => scrollRef.current,
@@ -633,6 +715,10 @@ function CommitList() {
top={v.start}
selected={selectedSet.has(c.id)}
head={c.id === headCommit}
+ mine={opts.highlightMine && isMine(c, user)}
+ onBranch={!!onBranch?.has(c.id)}
+ opts={opts}
+ remoteNames={remoteNames}
onPick={pick}
/>
);
@@ -650,6 +736,10 @@ const CommitRow = memo(function CommitRow({
top,
selected,
head,
+ mine,
+ onBranch,
+ opts,
+ remoteNames,
onPick,
}: {
id: string;
@@ -658,14 +748,29 @@ const CommitRow = memo(function CommitRow({
top: number;
selected: boolean;
head: boolean;
+ mine: boolean;
+ onBranch: boolean;
+ opts: LogOptions;
+ remoteNames: ReadonlySet<string>;
onPick: (id: string, e: ReactMouseEvent) => void;
}) {
+ const merge = opts.highlightMerges && c.parents.length > 1;
+ const refs = c.refs.length > 0 && (
+ <RefLabels
+ refs={c.refs}
+ compact={opts.compactRefs}
+ tagNames={opts.tagNames}
+ remoteNames={remoteNames}
+ left={opts.refsOnLeft}
+ />
+ );
+ const time = opts.commitTimestamp ? (c.commitTimeMs ?? c.timeMs) : c.timeMs;
return (
<div
id={id}
role="option"
aria-selected={selected}
- className={clsx(styles.row, selected && styles.selected)}
+ className={clsx(styles.row, onBranch && styles.currentBranch, selected && styles.selected)}
style={{ transform: `translateY(${top}px)` }}
onMouseDown={(e) => {
if (e.shiftKey) e.preventDefault(); // no text selection on range clicks
@@ -678,15 +783,19 @@ const CommitRow = memo(function CommitRow({
>
<span className={styles.colSubject}>
{graph && <GraphCell row={graph} head={head} />}
- <span className={clsx(styles.subject, head && styles.headSubject)} title={c.message}>
+ {opts.refsOnLeft && refs}
+ <span className={clsx(styles.subject, head && styles.headSubject, merge && styles.mergeSubject)} title={c.message}>
{c.summary}
</span>
- {c.refs.length > 0 && <RefLabels refs={c.refs} />}
- </span>
- <span className={clsx(styles.colAuthor, styles.muted)} title={`${c.author} <${c.email}>`}>
- {c.author}
+ {!opts.refsOnLeft && refs}
</span>
- <span className={clsx(styles.colDate, styles.muted)}>{formatTime(c.timeMs)}</span>
+ {opts.showAuthor && (
+ <span className={clsx(styles.colAuthor, styles.muted, mine && styles.mine)} title={`${c.author} <${c.email}>`}>
+ {c.author}
+ </span>
+ )}
+ {opts.showDate && <span className={clsx(styles.colDate, styles.muted)}>{formatTime(time)}</span>}
+ {opts.showHash && <span className={clsx(styles.colHash, styles.muted, styles.hash)}>{c.shortId}</span>}
</div>
);
});
@@ -707,10 +816,20 @@ export function GraphCell({ row, head }: { row: GraphRow; head?: boolean }) {
return (
<svg className={styles.graph} width={width} height={ROW} aria-hidden>
{row.up.map((s, i) => (
- <path key={`u${i}`} d={seg(x(s.from), 0, x(s.to), cy)} stroke={laneColor(s.color)} />
+ <path
+ key={`u${i}`}
+ d={seg(x(s.from), 0, x(s.to), cy) + (s.arrow ? arrowHead(x(s.from), 0, -1) : "")}
+ stroke={laneColor(s.color)}
+ strokeDasharray={s.dashed ? "2 2" : undefined}
+ />
))}
{row.down.map((s, i) => (
- <path key={`d${i}`} d={seg(x(s.from), cy, x(s.to), ROW)} stroke={laneColor(s.color)} />
+ <path
+ key={`d${i}`}
+ d={seg(x(s.from), cy, x(s.to), ROW) + (s.arrow ? arrowHead(x(s.to), ROW, 1) : "")}
+ stroke={laneColor(s.color)}
+ strokeDasharray={s.dashed ? "2 2" : undefined}
+ />
))}
<circle
cx={x(row.lane)}
@@ -724,19 +843,42 @@ export function GraphCell({ row, head }: { row: GraphRow; head?: boolean }) {
);
}
-export function RefLabels({ refs }: { refs: string[] }) {
+/** Arrow head at (`px`, `py`) pointing up (`dir` -1) or down (1): a long edge continues. */
+function arrowHead(px: number, py: number, dir: 1 | -1) {
+ const back = py - dir * 4;
+ return `M${px - 3} ${back}L${px} ${py}L${px + 3} ${back}`;
+}
+
+const REF_KIND_CLASS = {
+ head: styles.refHead,
+ local: styles.refLocal,
+ remote: styles.refRemote,
+ tag: styles.refTag,
+};
+
+const NO_REMOTES: ReadonlySet<string> = new Set();
+
+export function RefLabels({
+ refs,
+ compact = false,
+ tagNames = true,
+ remoteNames = NO_REMOTES,
+ left = false,
+}: {
+ refs: string[];
+ compact?: boolean;
+ tagNames?: boolean;
+ remoteNames?: ReadonlySet<string>;
+ left?: boolean;
+}) {
+ const labels = refLabels(refs, { compact, tagNames }, remoteNames);
return (
- <span className={styles.refs}>
- {refs.map((r) => {
- const tag = r.startsWith("tag: ");
- const kind =
- r === "HEAD" ? styles.refHead : tag ? styles.refTag : r.includes("/") ? styles.refRemote : styles.refLocal;
- return (
- <span key={r} className={clsx(styles.ref, kind)} title={r}>
- {tag ? r.slice(5) : r}
- </span>
- );
- })}
+ <span className={clsx(styles.refs, left && styles.refsLeft)}>
+ {labels.map((l) => (
+ <span key={`${l.kind}:${l.title}`} className={clsx(styles.ref, REF_KIND_CLASS[l.kind])} title={l.title}>
+ {l.text}
+ </span>
+ ))}
</span>
);
}
diff --git a/src/features/vcs/RevisionChooser.tsx b/src/features/vcs/RevisionChooser.tsx
index 9377bc59c..d0074cf05 100644
--- a/src/features/vcs/RevisionChooser.tsx
+++ b/src/features/vcs/RevisionChooser.tsx
@@ -3,7 +3,8 @@ import { useEffect, useMemo, useState, type KeyboardEvent } from "react";
import { Dialog, HighlightedText, Icon, List, SearchField, fuzzyMatch, listNavigate } from "@/ui";
import { sortLocal, sortRemote } from "./branches";
import { openDialog } from "./dialogs";
-import { loadBranches, useVcs } from "./store";
+import { call, commands } from "@/platform/ipc";
+import { currentRepo, loadBranches, useVcs } from "./store";
import styles from "./common.module.css";
interface Item {
@@ -12,11 +13,18 @@ interface Item {
matches: number[] | null;
}
-export function chooseRevision(title: string): Promise<string | null> {
+export interface ChooseRevisionOptions {
+ /** Offer the repository's tags too. */
+ tags?: boolean;
+ placeholder?: string;
+}
+
+export function chooseRevision(title: string, options: ChooseRevisionOptions = {}): Promise<string | null> {
return new Promise((resolve) => {
const close = openDialog(() => (
<Chooser
title={title}
+ options={options}
onDone={(r) => {
close();
resolve(r);
@@ -26,18 +34,36 @@ export function chooseRevision(title: string): Promise<string | null> {
});
}
-function Chooser({ title, onDone }: { title: string; onDone: (rev: string | null) => void }) {
+function Chooser({
+ title,
+ options,
+ onDone,
+}: {
+ title: string;
+ options: ChooseRevisionOptions;
+ onDone: (rev: string | null) => void;
+}) {
const branches = useVcs((s) => s.branches);
+ const [tags, setTags] = useState<string[]>([]);
const [query, setQuery] = useState("");
const [active, setActive] = useState(0);
useEffect(() => {
void loadBranches().catch(() => undefined);
- }, []);
+ if (!options.tags) return;
+ let alive = true;
+ call(commands.vcsTags(currentRepo()))
+ .then((t) => alive && setTags(t))
+ .catch(() => undefined);
+ return () => {
+ alive = false;
+ };
+ }, [options.tags]);
const items = useMemo(() => {
const all: Item[] = [
{ rev: "HEAD", detail: "Last commit", matches: null },
...sortLocal(branches).map((b) => ({ rev: b.name, detail: b.current ? "current branch" : "local", matches: null })),
...sortRemote(branches).map((b) => ({ rev: b.name, detail: "remote", matches: null })),
+ ...tags.map((t) => ({ rev: t, detail: "tag", matches: null })),
];
const q = query.trim();
const filtered = q
@@ -48,7 +74,7 @@ function Chooser({ title, onDone }: { title: string; onDone: (rev: string | null
: all;
if (q && !filtered.some((i) => i.rev === q)) filtered.push({ rev: q, detail: "revision", matches: null });
return filtered;
- }, [branches, query]);
+ }, [branches, tags, query]);
const idx = Math.min(active, items.length - 1);
const onKeyDown = (e: KeyboardEvent) => {
if (e.key === "Enter") {
@@ -74,7 +100,7 @@ function Chooser({ title, onDone }: { title: string; onDone: (rev: string | null
setActive(0);
}}
onKeyDown={onKeyDown}
- placeholder="Branch, tag or commit hash"
+ placeholder={options.placeholder ?? "Branch, tag or commit hash"}
aria-label="Revision"
variant="bare"
/>
@@ -93,7 +119,7 @@ function Chooser({ title, onDone }: { title: string; onDone: (rev: string | null
className={styles.grow}
renderItem={(i) => (
<span className={styles.fileRow} style={{ flex: 1, padding: 0 }}>
- <Icon name={i.detail === "revision" ? "commit" : "branch"} size={14} />
+ <Icon name={i.detail === "revision" ? "commit" : i.detail === "tag" ? "tag" : "branch"} size={14} />
<HighlightedText className={`${styles.fileName} ${styles.mono}`} text={i.rev} indices={i.matches} tone="accent" />
<span className={styles.fileDir}>{i.detail}</span>
</span>
diff --git a/src/features/vcs/__tests__/changelists.test.ts b/src/features/vcs/__tests__/changelists.test.ts
index 871381dc8..439247294 100644
--- a/src/features/vcs/__tests__/changelists.test.ts
+++ b/src/features/vcs/__tests__/changelists.test.ts
@@ -7,6 +7,7 @@ import {
editList,
initialChangelists,
listOf,
+ localChangelists,
moveFiles,
removeList,
setActiveList,
@@ -39,6 +40,15 @@ const shape = (nodes: ChangeNode[], depth = 0): string[] =>
nodes.flatMap((n) => [`${" ".repeat(depth)}${n.label}`, ...shape(n.children ?? [], depth + 1)]);
describe("change list model", () => {
+ it("publishes each list with its files (unversioned left out, deletions marked)", () => {
+ const { state, feature } = twoLists();
+ const lists = localChangelists([...status, fs("gone.ts", null, "deleted"), fs("c.ts", "conflicted", null)], "/r", state);
+ expect(lists.map((l) => [l.id, l.active, l.files])).toEqual([
+ ["default", true, [{ path: "/r/src/a.ts" }, { path: "/r/README.md" }, { path: "/r/gone.ts", deleted: true }, { path: "/r/c.ts" }]],
+ [feature, false, [{ path: "/r/src/b.ts" }]],
+ ]);
+ });
+
it("assigns new changes to the active list and forgets unchanged files", () => {
const { state, feature } = twoLists();
const synced = syncAssignments(state, ["src/a.ts", "src/b.ts", "README.md"])!;
diff --git a/src/features/vcs/__tests__/logOptions.test.ts b/src/features/vcs/__tests__/logOptions.test.ts
new file mode 100644
index 000000000..eb42b26b5
--- /dev/null
+++ b/src/features/vcs/__tests__/logOptions.test.ts
@@ -0,0 +1,176 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+const vcsLog = vi.fn();
+const vcsConfigGet = vi.fn();
+
+vi.mock("@/platform/ipc", async (importOriginal) => {
+ const real = await importOriginal<typeof import("@/platform/ipc")>();
+ return {
+ ...real,
+ commands: {
+ ...real.commands,
+ vcsLog: (repo: unknown, query: unknown) => vcsLog(repo, query),
+ vcsConfigGet: (repo: unknown, key: string) => vcsConfigGet(repo, key),
+ },
+ };
+});
+
+import { collapseLinear, computeGraph, hideLongEdges, reachableFrom } from "../graph";
+import { DEFAULT_LOG_OPTIONS, parseLogOptions, refLabels, setLogOptions, useLogOptions } from "../logOptions";
+import { emptyFilters, goToRef, isMine, reloadLog, updateLogOptions, useGitLog } from "../logStore";
+import { defaultWorktreePath, disabledMergeFlags, remoteBranchesOf, validateRemoteName } from "../gitMenuDialogs";
+import type { Branch, Commit } from "@/bindings";
+
+const c = (id: string, parents: string[] = [], refs: string[] = []) => ({ id, parents, refs });
+
+describe("Collapse Linear Branches", () => {
+ it("hides linear commits and links the remaining ones with dashed edges", () => {
+ // m merges f3 into main; f1..f3 is a linear branch from base, b a commit on main.
+ const commits = [
+ c("t", ["m"], ["main"]),
+ c("m", ["b", "f3"]),
+ c("f3", ["f2"]),
+ c("f2", ["f1"]),
+ c("f1", ["base"]),
+ c("b", ["base"]),
+ c("base"),
+ ];
+ const { commits: shown, graph } = collapseLinear(commits, new Set());
+ expect(shown.map((x) => x.id)).toEqual(["t", "m", "base"]);
+ expect(graph.find((g) => g.id === "m")).toEqual({ id: "m", parents: ["base"], dashed: [true] });
+ expect(graph.find((g) => g.id === "t")).toEqual({ id: "t", parents: ["m"] });
+ const { rows } = computeGraph(graph);
+ expect(rows[1]!.down.some((s) => s.dashed)).toBe(true);
+ expect(rows[2]!.up.some((s) => s.dashed)).toBe(true);
+ });
+
+ it("keeps referenced and kept commits", () => {
+ const commits = [c("d", ["c"]), c("c", ["b"], ["tag: v1"]), c("b", ["a"]), c("a")];
+ expect(collapseLinear(commits, new Set()).commits.map((x) => x.id)).toEqual(["d", "c", "a"]);
+ const chain = [c("e", ["d"]), c("d", ["c"]), c("c", ["b"]), c("b", ["a"]), c("a")];
+ expect(collapseLinear(chain, new Set(["c"])).commits.map((x) => x.id)).toEqual(["e", "c", "a"]);
+ expect(collapseLinear(chain, new Set()).commits.map((x) => x.id)).toEqual(["e", "a"]);
+ });
+});
+
+describe("long edges", () => {
+ it("hides the middle of a long straight lane and puts arrows on the stubs", () => {
+ // t's parent p is 40 rows below; the commits in between sit in lane 0.
+ const between = Array.from({ length: 40 }, (_, i) => c(`x${i}`, i < 39 ? [`x${i + 1}`] : []));
+ const { rows } = computeGraph([c("t", ["p"]), ...between, c("p")]);
+ const hidden = hideLongEdges(rows);
+ // The x chain sits in lane 1; the edge t → p passes through lane 0.
+ const lane0 = (r: (typeof rows)[number]) => r.up.concat(r.down).filter((s) => s.from === 0 && s.to === 0);
+ expect(lane0(rows[20]!)).toHaveLength(2);
+ expect(lane0(hidden[20]!)).toHaveLength(0);
+ expect(hidden[20]!.lane).toBe(1);
+ expect(hidden.some((r) => r.down.some((s) => s.arrow === "down"))).toBe(true);
+ expect(hidden.some((r) => r.up.some((s) => s.arrow === "up"))).toBe(true);
+ expect(hideLongEdges(rows.slice(0, 10))).toEqual(rows.slice(0, 10));
+ });
+});
+
+describe("highlighting", () => {
+ it("finds the loaded commits of the current branch", () => {
+ const commits = [c("s", ["a"]), c("h", ["a"]), c("a", ["r"]), c("r")];
+ expect([...reachableFrom(commits, "h")].sort()).toEqual(["a", "h", "r"]);
+ expect(reachableFrom(commits, null).size).toBe(0);
+ });
+
+ it("matches my commits by email or name", () => {
+ const commit = { email: "[email protected]", author: "Me" } as Commit;
+ expect(isMine(commit, "[email protected]")).toBe(true);
+ expect(isMine(commit, "me")).toBe(true);
+ expect(isMine(commit, null)).toBe(false);
+ });
+});
+
+describe("reference labels", () => {
+ const remotes = new Set(["origin/main", "origin/feat/x"]);
+ const refs = ["HEAD", "main", "origin/main", "feat/x", "tag: v1", "tag: v2"];
+
+ it("merges a branch with its remote-tracking branches in the compact view", () => {
+ const labels = refLabels(refs, { compact: true, tagNames: false }, remotes);
+ expect(labels.map((l) => [l.kind, l.text])).toEqual([
+ ["local", "origin & main"],
+ ["local", "feat/x"],
+ ["tag", ""],
+ ]);
+ expect(labels[2]!.title).toBe("v1, v2");
+ });
+
+ it("lists every reference otherwise", () => {
+ const labels = refLabels(refs, { compact: false, tagNames: true }, remotes);
+ expect(labels.map((l) => l.text)).toEqual(["HEAD", "main", "feat/x", "origin/main", "v1", "v2"]);
+ });
+});
+
+describe("log options", () => {
+ beforeEach(() => {
+ vcsLog.mockReset().mockResolvedValue({ status: "ok", data: [] });
+ vcsConfigGet.mockReset().mockResolvedValue({ status: "ok", data: null });
+ useLogOptions.setState(DEFAULT_LOG_OPTIONS);
+ });
+
+ it("parses stored options with per-field defaults", () => {
+ expect(parseLogOptions(null)).toEqual(DEFAULT_LOG_OPTIONS);
+ expect(parseLogOptions({ sort: "topo", longEdges: true, showHash: "yes" })).toEqual({
+ ...DEFAULT_LOG_OPTIONS,
+ sort: "topo",
+ longEdges: true,
+ });
+ });
+
+ it("reloads only for options that change the query", () => {
+ expect(setLogOptions({ compactRefs: false })).toBe(false);
+ expect(setLogOptions({ noMerges: true })).toBe(true);
+ expect(JSON.parse(localStorage.getItem("openidea.vcs.logOptions")!).noMerges).toBe(true);
+ });
+
+ it("sends the graph options and the date range to the backend", async () => {
+ useGitLog.setState({ filters: { ...emptyFilters(), date: { after: 1000, before: 5000, label: "x" } } });
+ updateLogOptions({ sort: "topo", firstParent: true });
+ await reloadLog();
+ const q = vcsLog.mock.calls.map((x) => x[1] as Record<string, unknown>).find((x) => x.range === null)!;
+ expect(q).toMatchObject({ order: "topo", firstParent: true, noMerges: false, sinceMs: 1000, untilMs: 5000 });
+ });
+
+ it("goes to a reference by resolving it and selecting the commit", async () => {
+ const commit = { id: "abc123", parents: [], refs: [], summary: "s", message: "s" } as unknown as Commit;
+ vcsLog.mockImplementation(async (_r: unknown, q: { branch: string | null }) => ({
+ status: "ok",
+ data: q.branch === "v1" || q.branch === null ? [commit] : [],
+ }));
+ useGitLog.setState({ filters: emptyFilters(), commits: [], done: false });
+ expect(await goToRef("v1")).toBe(true);
+ expect(useGitLog.getState().selected).toBe("abc123");
+ expect(await goToRef("nope")).toBe(false);
+ });
+});
+
+describe("Git menu dialogs", () => {
+ it("disables merge flags git refuses together", () => {
+ expect([...disabledMergeFlags(new Set(["ffOnly"]))].sort()).toEqual(["noCommit", "noFf", "squash"]);
+ expect(disabledMergeFlags(new Set(), true).size).toBe(4);
+ expect(disabledMergeFlags(new Set()).size).toBe(0);
+ });
+
+ it("lists a remote's branches without its prefix", () => {
+ const b = (name: string, remote: boolean) => ({ name, remote, current: false }) as Branch;
+ const branches = [b("main", false), b("origin/main", true), b("origin/HEAD", true), b("fork/dev", true)];
+ expect(remoteBranchesOf(branches, "origin")).toEqual(["main"]);
+ });
+
+ it("validates remote names", () => {
+ expect(validateRemoteName("origin", ["origin"])).toMatch(/already exists/);
+ expect(validateRemoteName("my remote", [])).toBe("Invalid remote name");
+ expect(validateRemoteName("", [])).toBe("Enter a remote name");
+ expect(validateRemoteName("upstream", ["origin"])).toBeNull();
+ });
+
+ it("suggests a worktree folder next to the repository", () => {
+ expect(defaultWorktreePath("/src/app", "feature/x")).toBe("/src/app-feature-x");
+ expect(defaultWorktreePath("/src/app/", "main")).toBe("/src/app-main");
+ expect(defaultWorktreePath("C:\\src\\app", "fix")).toBe("C:\\src\\app-fix");
+ });
+});
diff --git a/src/features/vcs/__tests__/recentChanges.test.ts b/src/features/vcs/__tests__/recentChanges.test.ts
new file mode 100644
index 000000000..9e9bb2e70
--- /dev/null
+++ b/src/features/vcs/__tests__/recentChanges.test.ts
@@ -0,0 +1,31 @@
+import { describe, expect, it } from "vitest";
+import type { HistoryEntry } from "@/bindings";
+import { recentChangeLabel, recentChanges } from "../recentChanges";
+
+const e = (path: string, t: number, label = "Saved", kind: HistoryEntry["kind"] = "snapshot"): HistoryEntry => ({
+ id: `${path}@${t}`,
+ path,
+ timestampMs: t,
+ label,
+ size: 1,
+ kind,
+});
+
+describe("View › Recent Changes", () => {
+ it("lists newest first and collapses runs of saves of one file", () => {
+ const rows = recentChanges([
+ e("/p/a.ts", 1),
+ e("/p/a.ts", 3),
+ e("/p/a.ts", 2),
+ e("/p", 4, "Before Git checkout", "label"),
+ e("/p/b.ts", 5),
+ ]);
+ expect(rows.map((r) => r.id)).toEqual(["/p/b.ts@5", "/p@4", "/p/a.ts@3"]);
+ expect(recentChanges([e("/p/a", 1), e("/p/b", 2), e("/p/c", 3)], 2)).toHaveLength(2);
+ });
+
+ it("labels revisions by project-relative path", () => {
+ expect(recentChangeLabel(e("/p/src/a.ts", 1), "/p")).toBe("src/a.ts — Saved");
+ expect(recentChangeLabel(e("/p", 1, "Release", "label"), "/p")).toBe("Release");
+ });
+});
diff --git a/src/features/vcs/actions.tsx b/src/features/vcs/actions.tsx
index 57c370ea2..117e96a9f 100644
--- a/src/features/vcs/actions.tsx
+++ b/src/features/vcs/actions.tsx
@@ -28,6 +28,14 @@ import { allRepos, runRemote } from "./ops";
import { showPushDialog, showUpdateDialog, type PushTarget } from "./remoteUi";
import { chooseRevision } from "./RevisionChooser";
import { showCloneDialog } from "./clone";
+import {
+ showManageRemotes,
+ showMergeDialog,
+ showNewWorktree,
+ showPullDialog,
+ showRebaseDialog,
+ showWorktrees,
+} from "./gitMenuDialogs";
import { refreshNow, repoName } from "./store";
const VCS = "vcsAvailable";
@@ -86,6 +94,7 @@ const OPERATIONS: MenuItem[] = [
{ kind: "action", action: "vcs.commit" },
{ kind: "action", action: "vcs.push" },
{ kind: "action", action: "vcs.update" },
+ { kind: "action", action: "vcs.pull" },
{ kind: "action", action: "vcs.fetch" },
{ kind: "separator" },
{ kind: "action", action: "vcs.rollback" },
@@ -192,6 +201,54 @@ export function registerVcsActions(): () => void {
keywords: ["pull"],
run: showUpdateDialog,
},
+ {
+ id: "vcs.pull",
+ title: "Pull…",
+ category: "Git",
+ icon: "git-pull",
+ when: VCS,
+ run: showPullDialog,
+ },
+ {
+ id: "vcs.merge",
+ title: "Merge…",
+ category: "Git",
+ when: VCS,
+ keywords: ["merge branch"],
+ run: showMergeDialog,
+ },
+ {
+ id: "vcs.rebase",
+ title: "Rebase…",
+ category: "Git",
+ when: VCS,
+ keywords: ["rebase branch"],
+ run: showRebaseDialog,
+ },
+ {
+ id: "vcs.manageRemotes",
+ title: "Manage Remotes…",
+ category: "Git",
+ when: VCS,
+ keywords: ["remote", "origin", "url"],
+ run: showManageRemotes,
+ },
+ {
+ id: "vcs.newWorktree",
+ title: "New Worktree…",
+ category: "Git",
+ when: VCS,
+ keywords: ["worktree"],
+ run: () => showNewWorktree(),
+ },
+ {
+ id: "vcs.worktrees",
+ title: "Worktrees…",
+ category: "Git",
+ when: VCS,
+ keywords: ["worktree"],
+ run: showWorktrees,
+ },
{
id: "vcs.fetch",
title: "Fetch",
diff --git a/src/features/vcs/branchOps.ts b/src/features/vcs/branchOps.ts
index 3f4802ef2..b52b4bb03 100644
--- a/src/features/vcs/branchOps.ts
+++ b/src/features/vcs/branchOps.ts
@@ -174,7 +174,7 @@ export async function checkoutRevision() {
await performCheckout(r.value, () => `Checked out ${r.value}`);
}
-function conflictActions(message: string) {
+export function conflictActions(message: string) {
return conflictedFiles().length || /conflict/i.test(message)
? [{ label: "Resolve Conflicts…", run: () => void executeAction("vcs.resolveConflicts") }]
: [];
@@ -184,7 +184,7 @@ function conflictActions(message: string) {
* A merge / rebase that stopped on conflicts isn't an error in IDEA: it opens
* the Conflicts dialog instead of an error balloon.
*/
-async function openConflictsInstead(): Promise<boolean> {
+export async function openConflictsInstead(): Promise<boolean> {
await refreshNow();
if (!conflictedFiles().length) return false;
void executeAction("vcs.resolveConflicts");
diff --git a/src/features/vcs/changelists.ts b/src/features/vcs/changelists.ts
index cd532124d..b61193f2c 100644
--- a/src/features/vcs/changelists.ts
+++ b/src/features/vcs/changelists.ts
@@ -7,9 +7,10 @@ import { create } from "zustand";
import type { Changelist, ChangelistState, FileStatus } from "@/bindings";
import { call, commands, isTauri } from "@/platform/ipc";
import { useProject } from "@/platform/project";
+import { setLocalChanges, type LocalChangelist } from "@/workbench/contributions";
import type { CheckState } from "./changes";
import { groupOf } from "./changes";
-import { relTo, stripSlash } from "./model";
+import { effectiveKind, relTo, stripSlash } from "./model";
import { useVcs } from "./store";
export const DEFAULT_LIST_ID = "default";
@@ -160,6 +161,20 @@ export function changedRels(status: readonly FileStatus[], root: string): string
return status.filter((f) => groupOf(f) === "changes").map((f) => relTo(root, stripSlash(f.path)));
}
+/** The lists with their files, for the `useLocalChanges` service (conflicted files stay in their list). */
+export function localChangelists(status: readonly FileStatus[], root: string, state: ChangelistState): LocalChangelist[] {
+ const lists = state.lists.map((l): LocalChangelist => ({ id: l.id, name: l.name, active: l.id === state.active, files: [] }));
+ const byId = new Map(lists.map((l) => [l.id, l]));
+ for (const f of status) {
+ const group = groupOf(f);
+ if (group !== "changes" && group !== "conflicts") continue;
+ const path = stripSlash(f.path);
+ const list = byId.get(listOf(state, relTo(root, path))) ?? lists[0];
+ list?.files.push(effectiveKind(f) === "deleted" ? { path, deleted: true } : { path });
+ }
+ return lists;
+}
+
export function relOf(path: string): string {
return relTo(useVcs.getState().root ?? "", stripSlash(path));
}
@@ -196,9 +211,29 @@ export function installChangelists(): () => void {
const offVcs = useVcs.subscribe((s, p) => {
if (s.status !== p.status) sync();
});
+ let clearPublished: (() => void) | null = null;
+ const publish = () => {
+ const { status, root, available } = useVcs.getState();
+ if (!available || !root) {
+ clearPublished?.();
+ clearPublished = null;
+ return;
+ }
+ clearPublished = setLocalChanges("vcs", localChangelists(status, root, useChangelists.getState().state));
+ };
+ publish();
+ const offPublishVcs = useVcs.subscribe((s, p) => {
+ if (s.status !== p.status || s.root !== p.root || s.available !== p.available) publish();
+ });
+ const offPublishLists = useChangelists.subscribe((s, p) => {
+ if (s.state !== p.state) publish();
+ });
return () => {
offProject();
offVcs();
+ offPublishVcs();
+ offPublishLists();
+ clearPublished?.();
clearTimeout(saveTimer);
};
}
diff --git a/src/features/vcs/commitChecks.tsx b/src/features/vcs/commitChecks.tsx
index ea45664c7..0f7cbe155 100644
--- a/src/features/vcs/commitChecks.tsx
+++ b/src/features/vcs/commitChecks.tsx
@@ -6,6 +6,7 @@
*/
import type { ReactNode } from "react";
import type { Diagnostic } from "@/bindings";
+import { formatExcluded, formatGuardOptions, guardTextEdits } from "@/platform/formatGuard";
import { call, commands, isTauri, onIdeEvent } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import { workflowSettings } from "@/platform/workflowSettings";
@@ -140,15 +141,21 @@ async function modifyFile(path: string, mods: Modifications) {
await step("Cleanup", async () =>
applyKind(info.id, (await call(commands.docSnapshot(info.id))).text, "source.fixAll"),
);
- if (mods.reformat)
+ const { project, settings } = useProject.getState();
+ const guard = formatGuardOptions(settings);
+ if (mods.reformat && !formatExcluded(path, project?.root ?? null, guard.doNotFormat))
await step("Reformat code", async () => {
- const editor = useProject.getState().settings?.editor as
- { tabSize?: number; insertSpaces?: boolean } | undefined;
- const edits = await call(
- commands.lspFormat(info.id, null, {
- tabSize: editor?.tabSize ?? 4,
- insertSpaces: editor?.insertSpaces ?? true,
- }),
+ const editor = settings?.editor as { tabSize?: number; insertSpaces?: boolean } | undefined;
+ const text = (await call(commands.docSnapshot(info.id))).text;
+ const edits = guardTextEdits(
+ text,
+ await call(
+ commands.lspFormat(info.id, null, {
+ tabSize: editor?.tabSize ?? 4,
+ insertSpaces: editor?.insertSpaces ?? true,
+ }),
+ ),
+ guard,
);
if (edits.length) await call(commands.applyWorkspaceEdit({ files: [{ kind: "edit", path, edits }] }));
});
diff --git a/src/features/vcs/common.module.css b/src/features/vcs/common.module.css
index 2014098e8..580352b4d 100644
--- a/src/features/vcs/common.module.css
+++ b/src/features/vcs/common.module.css
@@ -226,3 +226,44 @@
border: 1px solid var(--border);
border-radius: var(--radius-small);
}
+/* Pull / Merge / Rebase dialogs. */
+.fieldRow {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ min-width: 0;
+}
+.optionGrid {
+ display: grid;
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ gap: 4px 12px;
+}
+/* Manage Remotes / Worktrees lists. */
+.manageBar {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+}
+.manageRow {
+ width: 100%;
+ height: var(--h-row);
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ padding: 0 8px;
+ border: none;
+ background: none;
+ color: var(--fg);
+ font: inherit;
+ text-align: left;
+ white-space: nowrap;
+ overflow: hidden;
+ cursor: default;
+}
+.manageRow:hover {
+ background: var(--bg-hover);
+}
+.manageRowSelected,
+.manageRowSelected:hover {
+ background: var(--bg-list-selected);
+}
diff --git a/src/features/vcs/gitMenuDialogs.tsx b/src/features/vcs/gitMenuDialogs.tsx
new file mode 100644
index 000000000..a722db9b7
--- /dev/null
+++ b/src/features/vcs/gitMenuDialogs.tsx
@@ -0,0 +1,678 @@
+/** Git menu dialogs: Pull…, Merge…, Rebase…, Manage Remotes… and Worktrees. */
+import { useEffect, useMemo, useState } from "react";
+import clsx from "clsx";
+import type { Branch, MergeOptions, Remote, Worktree } from "@/bindings";
+import { executeAction } from "@/platform/actions";
+import { call, commands } from "@/platform/ipc";
+import { notifications } from "@/workbench/contributions";
+import { Checkbox, Dialog, IconButton, Input, Select, T, type SelectOption } from "@/ui";
+import { sortLocal, sortRemote } from "./branches";
+import { conflictActions, openConflictsInstead, validateBranchName } from "./branchOps";
+import { confirmDialog, openDialog } from "./dialogs";
+import { errorMessage, runOp, runRemote, saveAll } from "./ops";
+import { currentRepo, loadBranches, refreshNow, useVcs } from "./store";
+import styles from "./common.module.css";
+
+// --- shared -----------------------------------------------------------------
+
+export type MergeFlag = "noFf" | "ffOnly" | "squash" | "noCommit";
+
+/** Flags git refuses together with `flag`. */
+const EXCLUSIVE: Record<MergeFlag, MergeFlag[]> = {
+ noFf: ["ffOnly", "squash"],
+ ffOnly: ["noFf", "squash", "noCommit"],
+ squash: ["noFf", "ffOnly"],
+ noCommit: ["ffOnly"],
+};
+
+/** Merge flags that cannot be turned on next to the `on` ones (and with `--rebase`). */
+export function disabledMergeFlags(on: ReadonlySet<MergeFlag>, rebase = false): Set<MergeFlag> {
+ if (rebase) return new Set<MergeFlag>(["noFf", "ffOnly", "squash", "noCommit"]);
+ const out = new Set<MergeFlag>();
+ for (const f of on) for (const x of EXCLUSIVE[f]) out.add(x);
+ return out;
+}
+
+export function mergeOptionsOf(on: ReadonlySet<MergeFlag>, message: string | null = null): MergeOptions {
+ return {
+ noFf: on.has("noFf"),
+ ffOnly: on.has("ffOnly"),
+ squash: on.has("squash"),
+ noCommit: on.has("noCommit"),
+ message: message?.trim() || null,
+ };
+}
+
+const FLAG_LABELS: Array<[MergeFlag, string]> = [
+ ["noFf", "--no-ff"],
+ ["ffOnly", "--ff-only"],
+ ["squash", "--squash"],
+ ["noCommit", "--no-commit"],
+];
+
+function MergeFlags({
+ on,
+ setOn,
+ rebase = false,
+}: {
+ on: Set<MergeFlag>;
+ setOn: (next: Set<MergeFlag>) => void;
+ rebase?: boolean;
+}) {
+ const disabled = disabledMergeFlags(on, rebase);
+ return (
+ <div className={styles.optionGrid} role="group" aria-label="Merge options">
+ {FLAG_LABELS.map(([flag, label]) => (
+ <Checkbox
+ key={flag}
+ label={label}
+ checked={on.has(flag)}
+ disabled={disabled.has(flag) && !on.has(flag)}
+ onChange={(v) => {
+ const next = new Set(on);
+ if (v) next.add(flag);
+ else next.delete(flag);
+ setOn(next);
+ }}
+ />
+ ))}
+ </div>
+ );
+}
+
+function useBranches(): Branch[] {
+ const branches = useVcs((s) => s.branches);
+ useEffect(() => {
+ void loadBranches().catch(() => undefined);
+ }, []);
+ return branches;
+}
+
+const branchOptions = (list: readonly Branch[]): SelectOption[] =>
+ list.filter((b) => !b.name.endsWith("/HEAD")).map((b) => ({ value: b.name, label: b.name, icon: "branch" }));
+
+/** Remote branches of `remote` without the remote prefix (`origin/main` → `main`). */
+export function remoteBranchesOf(branches: readonly Branch[], remote: string): string[] {
+ const prefix = `${remote}/`;
+ return sortRemote(branches)
+ .filter((b) => b.name.startsWith(prefix) && b.name !== `${prefix}HEAD`)
+ .map((b) => b.name.slice(prefix.length));
+}
+
+// --- Pull -------------------------------------------------------------------
+
+export function showPullDialog() {
+ openDialog((close) => <PullDialog onClose={close} />);
+}
+
+function PullDialog({ onClose }: { onClose: () => void }) {
+ const info = useVcs((s) => s.branch);
+ const branches = useBranches();
+ const [remotes, setRemotes] = useState<Remote[] | null>(null);
+ const [remote, setRemote] = useState<string | null>(null);
+ const [chosenBranch, setBranch] = useState<string | null>(null);
+ const [rebase, setRebase] = useState(false);
+ const [flags, setFlags] = useState<Set<MergeFlag>>(() => new Set());
+
+ useEffect(() => {
+ let alive = true;
+ call(commands.vcsRemotes(currentRepo()))
+ .then((list) => {
+ if (!alive) return;
+ setRemotes(list);
+ const upstreamRemote = info?.upstream?.split("/")[0];
+ setRemote(list.find((r) => r.name === upstreamRemote)?.name ?? list[0]?.name ?? null);
+ })
+ .catch(() => alive && setRemotes([]));
+ return () => {
+ alive = false;
+ };
+ }, [info?.upstream]);
+
+ const remoteBranches = useMemo(() => (remote ? remoteBranchesOf(branches, remote) : []), [branches, remote]);
+ // Default: the upstream's branch, else the same name as the current branch.
+ const upstream = remote && info?.upstream?.startsWith(`${remote}/`) ? info.upstream.slice(remote.length + 1) : null;
+ const preferred = upstream ?? info?.head ?? null;
+ const branch =
+ chosenBranch && remoteBranches.includes(chosenBranch)
+ ? chosenBranch
+ : preferred && remoteBranches.includes(preferred)
+ ? preferred
+ : (remoteBranches[0] ?? null);
+
+ const run = async () => {
+ if (!remote) return;
+ onClose();
+ await saveAll();
+ await runRemote(
+ { op: "pullFrom", remote, branches: branch ? [branch] : [], rebase, options: mergeOptionsOf(rebase ? new Set() : flags) },
+ `${info?.head ?? "HEAD"} ← ${remote}${branch ? `/${branch}` : ""}`,
+ );
+ };
+
+ return (
+ <Dialog
+ open
+ title={`Pull to ${info?.head ?? "HEAD"}`}
+ onClose={onClose}
+ width={460}
+ buttons={[
+ { label: "Pull", role: "default", disabled: !remote, onClick: () => void run() },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <div className={styles.form}>
+ {remotes && !remotes.length ? (
+ <div className={styles.hint}>
+ <T>No remotes are configured. Add one with Git › Manage Remotes….</T>
+ </div>
+ ) : (
+ <div className={styles.fieldRow}>
+ <Select
+ aria-label="Remote"
+ value={remote}
+ options={(remotes ?? []).map((r) => ({ value: r.name, label: r.name, detail: r.url }))}
+ onChange={setRemote}
+ />
+ <Select
+ aria-label="Remote branch"
+ className={styles.grow}
+ value={branch}
+ placeholder="Branch"
+ options={remoteBranches.map((b) => ({ value: b, label: b, icon: "branch" }))}
+ onChange={setBranch}
+ />
+ </div>
+ )}
+ <div className={styles.fieldLabel}>
+ <T>Options:</T>
+ </div>
+ <Checkbox label="--rebase" checked={rebase} onChange={setRebase} />
+ <MergeFlags on={flags} setOn={setFlags} rebase={rebase} />
+ <div className={styles.hint}>
+ <T>Uncommitted changes are stashed before the pull and restored afterwards.</T>
+ </div>
+ </div>
+ </Dialog>
+ );
+}
+
+// --- Merge ------------------------------------------------------------------
+
+export function showMergeDialog() {
+ openDialog((close) => <MergeDialog onClose={close} />);
+}
+
+function MergeDialog({ onClose }: { onClose: () => void }) {
+ const head = useVcs((s) => s.branch?.head ?? null);
+ const branches = useBranches();
+ const [branch, setBranch] = useState<string | null>(null);
+ const [flags, setFlags] = useState<Set<MergeFlag>>(() => new Set());
+ const [withMessage, setWithMessage] = useState(false);
+ const [message, setMessage] = useState("");
+ const options = useMemo(
+ () => [...branchOptions(sortLocal(branches).filter((b) => !b.current)), ...branchOptions(sortRemote(branches))],
+ [branches],
+ );
+
+ const run = async () => {
+ if (!branch) return;
+ onClose();
+ await saveAll();
+ const target = head ?? "HEAD";
+ await runOp(
+ `Merge ${branch} into ${target}`,
+ () => call(commands.vcsMergeWith(currentRepo(), [branch], mergeOptionsOf(flags, withMessage ? message : null))),
+ { success: `Merged ${branch} into ${target}`, errorActions: conflictActions, onError: openConflictsInstead },
+ );
+ await refreshNow();
+ };
+
+ return (
+ <Dialog
+ open
+ title={`Merge into ${head ?? "HEAD"}`}
+ onClose={onClose}
+ width={460}
+ buttons={[
+ { label: "Merge", role: "default", disabled: !branch, onClick: () => void run() },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <div className={styles.form}>
+ <div className={styles.fieldLabel}>
+ <T>Branch to merge:</T>
+ </div>
+ <Select aria-label="Branch to merge" value={branch} placeholder="Select branch" options={options} onChange={setBranch} />
+ <div className={styles.fieldLabel}>
+ <T>Options:</T>
+ </div>
+ <MergeFlags on={flags} setOn={setFlags} />
+ <Checkbox label="-m (commit message)" checked={withMessage} onChange={setWithMessage} />
+ {withMessage && (
+ <Input
+ aria-label="Commit message"
+ value={message}
+ placeholder={branch ? `Merge branch '${branch}' into ${head ?? "HEAD"}` : ""}
+ onChange={(e) => setMessage(e.target.value)}
+ />
+ )}
+ </div>
+ </Dialog>
+ );
+}
+
+// --- Rebase -----------------------------------------------------------------
+
+export function showRebaseDialog() {
+ openDialog((close) => <RebaseDialog onClose={close} />);
+}
+
+function RebaseDialog({ onClose }: { onClose: () => void }) {
+ const head = useVcs((s) => s.branch?.head ?? null);
+ const branches = useBranches();
+ const [upstream, setUpstream] = useState<string | null>(null);
+ const [useOnto, setUseOnto] = useState(false);
+ const [onto, setOnto] = useState<string | null>(null);
+ const [rebaseMerges, setRebaseMerges] = useState(false);
+ const [keepEmpty, setKeepEmpty] = useState(false);
+ const options = useMemo(
+ () => [...branchOptions(sortLocal(branches).filter((b) => !b.current)), ...branchOptions(sortRemote(branches))],
+ [branches],
+ );
+ const ready = !!upstream && (!useOnto || !!onto);
+
+ const run = async () => {
+ if (!upstream) return;
+ onClose();
+ await saveAll();
+ const target = useOnto && onto ? onto : upstream;
+ const current = head ?? "HEAD";
+ await runOp(
+ `Rebase ${current} onto ${target}`,
+ () =>
+ call(
+ commands.vcsRebaseWith(currentRepo(), upstream, {
+ onto: useOnto ? onto : null,
+ rebaseMerges,
+ keepEmpty,
+ }),
+ ),
+ { success: `Rebased ${current} onto ${target}`, errorActions: conflictActions, onError: openConflictsInstead },
+ );
+ await refreshNow();
+ };
+
+ return (
+ <Dialog
+ open
+ title="Rebase"
+ onClose={onClose}
+ width={460}
+ buttons={[
+ { label: "Rebase", role: "default", disabled: !ready, onClick: () => void run() },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <div className={styles.form}>
+ <div className={styles.fieldLabel}>
+ {useOnto ? `Rebase commits of ${head ?? "HEAD"} not on:` : `Rebase ${head ?? "HEAD"} onto:`}
+ </div>
+ <Select aria-label="Upstream" value={upstream} placeholder="Select branch" options={options} onChange={setUpstream} />
+ <Checkbox label="--onto" checked={useOnto} onChange={setUseOnto} />
+ {useOnto && (
+ <Select aria-label="New base" value={onto} placeholder="New base" options={options} onChange={setOnto} />
+ )}
+ <Checkbox label="--rebase-merges" checked={rebaseMerges} onChange={setRebaseMerges} />
+ <Checkbox label="--keep-empty" checked={keepEmpty} onChange={setKeepEmpty} />
+ <div className={styles.hint}>
+ <T>Uncommitted changes are stashed before the rebase and restored afterwards.</T>
+ </div>
+ </div>
+ </Dialog>
+ );
+}
+
+// --- Manage Remotes ---------------------------------------------------------
+
+/** Error for a remote name, or null (`existing`: the other remotes' names). */
+export function validateRemoteName(name: string, existing: readonly string[]): string | null {
+ const n = name.trim();
+ if (!n) return "Enter a remote name";
+ if (/\s/.test(n) || n.startsWith("-") || /[~^:?*[\\]/.test(n) || n.includes("..")) return "Invalid remote name";
+ if (existing.includes(n)) return `Remote '${n}' already exists`;
+ return null;
+}
+
+export function showManageRemotes() {
+ openDialog((close) => <RemotesDialog onClose={close} />);
+}
+
+function RemotesDialog({ onClose }: { onClose: () => void }) {
+ const [remotes, setRemotes] = useState<Remote[]>([]);
+ const [selected, setSelected] = useState<string | null>(null);
+ const [error, setError] = useState<string | null>(null);
+ const reload = () =>
+ call(commands.vcsRemotes(currentRepo()))
+ .then((list) => {
+ setRemotes(list);
+ setSelected((s) => (s && list.some((r) => r.name === s) ? s : (list[0]?.name ?? null)));
+ })
+ .catch((e) => setError(errorMessage(e)));
+ useEffect(() => {
+ void reload();
+ }, []);
+
+ const apply = async (edit: Parameters<typeof commands.vcsEditRemote>[1]) => {
+ try {
+ await call(commands.vcsEditRemote(currentRepo(), edit));
+ setError(null);
+ } catch (e) {
+ setError(errorMessage(e));
+ }
+ await reload();
+ void loadBranches().catch(() => undefined);
+ };
+ const edit = (remote?: Remote) =>
+ openDialog((close) => (
+ <RemoteEditDialog
+ remote={remote}
+ existing={remotes.map((r) => r.name).filter((n) => n !== remote?.name)}
+ onDone={(r) => {
+ close();
+ if (!r) return;
+ void apply(
+ remote ? { op: "edit", name: remote.name, new_name: r.name, url: r.url } : { op: "add", name: r.name, url: r.url },
+ );
+ }}
+ />
+ ));
+ const remove = async () => {
+ if (!selected) return;
+ const ok = await confirmDialog({
+ title: "Remove Remote",
+ message: `Remove remote '${selected}'? Its remote-tracking branches are deleted.`,
+ okLabel: "Remove",
+ danger: true,
+ });
+ if (ok) await apply({ op: "remove", name: selected });
+ };
+ const current = remotes.find((r) => r.name === selected);
+
+ return (
+ <Dialog
+ open
+ title="Git Remotes"
+ onClose={onClose}
+ width={560}
+ buttons={[{ label: "OK", role: "default", autoFocus: true, onClick: onClose }]}
+ >
+ <div className={styles.form}>
+ <div className={styles.manageBar} role="toolbar" aria-label="Remotes">
+ <IconButton icon="plus" title="Add Remote…" size="small" onClick={() => edit()} />
+ <IconButton icon="minus" title="Remove Remote" size="small" disabled={!current} onClick={() => void remove()} />
+ <IconButton icon="edit" title="Edit Remote…" size="small" disabled={!current} onClick={() => edit(current)} />
+ </div>
+ <div className={styles.choiceList} role="listbox" aria-label="Remotes">
+ {!remotes.length && (
+ <div className={styles.empty}>
+ <T>No remotes</T>
+ </div>
+ )}
+ {remotes.map((r) => (
+ <button
+ key={r.name}
+ type="button"
+ role="option"
+ aria-selected={r.name === selected}
+ className={clsx(styles.manageRow, r.name === selected && styles.manageRowSelected)}
+ onClick={() => setSelected(r.name)}
+ onDoubleClick={() => edit(r)}
+ >
+ <span className={styles.fileName}>{r.name}</span>
+ <span className={clsx(styles.fileDir, styles.mono)}>{r.url}</span>
+ </button>
+ ))}
+ </div>
+ {error && <div className={styles.error}>{error}</div>}
+ </div>
+ </Dialog>
+ );
+}
+
+function RemoteEditDialog({
+ remote,
+ existing,
+ onDone,
+}: {
+ remote?: Remote;
+ existing: readonly string[];
+ onDone: (r: { name: string; url: string } | null) => void;
+}) {
+ const [name, setName] = useState(remote?.name ?? (existing.includes("origin") ? "" : "origin"));
+ const [url, setUrl] = useState(remote?.url ?? "");
+ const error = validateRemoteName(name, existing) ?? (url.trim() ? null : "Enter the remote URL");
+ const submit = () => {
+ if (!error) onDone({ name: name.trim(), url: url.trim() });
+ };
+ return (
+ <Dialog
+ open
+ title={remote ? "Edit Remote" : "Define Remote"}
+ onClose={() => onDone(null)}
+ width={460}
+ buttons={[
+ { label: "OK", role: "default", disabled: !!error, onClick: submit },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <form
+ className={styles.form}
+ onSubmit={(e) => {
+ e.preventDefault();
+ submit();
+ }}
+ >
+ <label className={styles.fieldLabel}>
+ <T>Name:</T>
+ </label>
+ <Input data-autofocus aria-label="Name" value={name} onChange={(e) => setName(e.target.value)} />
+ <label className={styles.fieldLabel}>
+ <T>URL:</T>
+ </label>
+ <Input aria-label="URL" mono value={url} onChange={(e) => setUrl(e.target.value)} />
+ {error && (name || url) && <div className={styles.error}>{error}</div>}
+ </form>
+ </Dialog>
+ );
+}
+
+// --- Worktrees --------------------------------------------------------------
+
+/** Default folder of a new worktree: next to the repository, `<repo>-<branch>`. */
+export function defaultWorktreePath(repoRoot: string, branch: string): string {
+ const sep = repoRoot.includes("\\") && !repoRoot.includes("/") ? "\\" : "/";
+ const trimmed = repoRoot.replace(/[\\/]+$/, "");
+ const cut = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
+ const parent = cut > 0 ? trimmed.slice(0, cut) : trimmed;
+ const name = trimmed.slice(cut + 1);
+ const suffix = branch.replace(/[\\/]/g, "-");
+ return `${parent}${sep}${name}-${suffix || "worktree"}`;
+}
+
+export function showWorktrees() {
+ openDialog((close) => <WorktreesDialog onClose={close} />);
+}
+
+export function showNewWorktree(onCreated?: () => void) {
+ openDialog((close) => (
+ <NewWorktreeDialog
+ onClose={(created) => {
+ close();
+ if (created) onCreated?.();
+ }}
+ />
+ ));
+}
+
+function WorktreesDialog({ onClose }: { onClose: () => void }) {
+ const [list, setList] = useState<Worktree[]>([]);
+ const [selected, setSelected] = useState<string | null>(null);
+ const [error, setError] = useState<string | null>(null);
+ const reload = () =>
+ call(commands.vcsWorktrees(currentRepo()))
+ .then((l) => {
+ setList(l);
+ setError(null);
+ })
+ .catch((e) => setError(errorMessage(e)));
+ useEffect(() => {
+ void reload();
+ }, []);
+ const current = list.find((w) => w.path === selected);
+
+ const remove = async () => {
+ if (!current || current.main) return;
+ const ok = await confirmDialog({
+ title: "Remove Worktree",
+ message: `Remove the worktree at ${current.path}? Its folder is deleted.`,
+ okLabel: "Remove",
+ danger: true,
+ });
+ if (!ok) return;
+ try {
+ await call(commands.vcsRemoveWorktree(currentRepo(), current.path, false));
+ } catch (e) {
+ const force = await confirmDialog({
+ title: "Remove Worktree",
+ message: `${errorMessage(e)}\n\nRemove it anyway, discarding its changes?`,
+ okLabel: "Force Remove",
+ danger: true,
+ });
+ if (force) await call(commands.vcsRemoveWorktree(currentRepo(), current.path, true)).catch((x) => setError(errorMessage(x)));
+ }
+ setSelected(null);
+ await reload();
+ };
+
+ return (
+ <Dialog
+ open
+ title="Worktrees"
+ onClose={onClose}
+ width={620}
+ buttons={[{ label: "Close", role: "default", autoFocus: true, onClick: onClose }]}
+ >
+ <div className={styles.form}>
+ <div className={styles.manageBar} role="toolbar" aria-label="Worktrees">
+ <IconButton icon="plus" title="New Worktree…" size="small" onClick={() => showNewWorktree(() => void reload())} />
+ <IconButton
+ icon="minus"
+ title="Remove Worktree"
+ size="small"
+ disabled={!current || current.main}
+ onClick={() => void remove()}
+ />
+ <IconButton
+ icon="folder"
+ title="Open in New Window"
+ size="small"
+ disabled={!current}
+ onClick={() => current && void executeAction("file.openProjectPath", current.path)}
+ />
+ </div>
+ <div className={styles.choiceList} role="listbox" aria-label="Worktrees">
+ {list.map((w) => (
+ <button
+ key={w.path}
+ type="button"
+ role="option"
+ aria-selected={w.path === selected}
+ className={clsx(styles.manageRow, w.path === selected && styles.manageRowSelected)}
+ onClick={() => setSelected(w.path)}
+ onDoubleClick={() => void executeAction("file.openProjectPath", w.path)}
+ >
+ <span className={styles.fileName}>{w.branch ?? (w.head ? w.head.slice(0, 8) : <T>(bare)</T>)}</span>
+ <span className={clsx(styles.fileDir, styles.mono)}>{w.path}</span>
+ {(w.main || w.locked || w.prunable) && (
+ <span className={styles.fileDir}>{w.main ? "main" : w.locked ? "locked" : "prunable"}</span>
+ )}
+ </button>
+ ))}
+ </div>
+ {error && <div className={styles.error}>{error}</div>}
+ </div>
+ </Dialog>
+ );
+}
+
+function NewWorktreeDialog({ onClose }: { onClose: (created: boolean) => void }) {
+ const root = useVcs((s) => s.repo ?? s.root) ?? "";
+ const branches = useBranches();
+ const [source, setSource] = useState<string | null>(null);
+ const [createBranch, setCreateBranch] = useState(true);
+ const [newBranch, setNewBranch] = useState("");
+ const [path, setPath] = useState<string | null>(null);
+ const [error, setError] = useState<string | null>(null);
+ const options = useMemo(() => [...branchOptions(sortLocal(branches)), ...branchOptions(sortRemote(branches))], [branches]);
+ const sourceRemote = branches.find((b) => b.name === source)?.remote ?? false;
+ // A remote branch `origin/x` suggests the local name `x`.
+ const shortSource = source && sourceRemote ? source.slice(source.indexOf("/") + 1) : (source ?? "");
+ const suggestedBranch = source ? (sourceRemote ? shortSource : `${shortSource}-wt`) : "";
+ const branchName = newBranch.trim() || suggestedBranch;
+ const target = path ?? (source ? defaultWorktreePath(root, createBranch ? branchName : shortSource) : "");
+ const invalid = !source
+ ? "Choose what to check out"
+ : createBranch
+ ? validateBranchName(branchName)
+ : !target.trim()
+ ? "Enter a folder"
+ : null;
+
+ const create = async () => {
+ if (invalid || !source) return;
+ try {
+ await call(commands.vcsAddWorktree(currentRepo(), target.trim(), source, createBranch ? branchName : null));
+ notifications().notify({ group: "vcs", level: "info", title: `Created worktree at ${target.trim()}` });
+ void loadBranches().catch(() => undefined);
+ onClose(true);
+ } catch (e) {
+ setError(errorMessage(e));
+ }
+ };
+
+ return (
+ <Dialog
+ open
+ title="New Worktree"
+ onClose={() => onClose(false)}
+ width={520}
+ buttons={[
+ { label: "Create", role: "default", disabled: !!invalid, onClick: () => void create() },
+ { label: "Cancel", role: "cancel" },
+ ]}
+ >
+ <div className={styles.form}>
+ <div className={styles.fieldLabel}>
+ <T>Check out:</T>
+ </div>
+ <Select aria-label="Check out" value={source} placeholder="Select branch" options={options} onChange={setSource} />
+ <Checkbox label="Create a new branch" checked={createBranch} onChange={setCreateBranch} />
+ {createBranch && (
+ <Input
+ aria-label="New branch name"
+ mono
+ value={newBranch}
+ placeholder={suggestedBranch}
+ onChange={(e) => setNewBranch(e.target.value)}
+ />
+ )}
+ <div className={styles.fieldLabel}>
+ <T>Folder:</T>
+ </div>
+ <Input aria-label="Folder" mono value={target} onChange={(e) => setPath(e.target.value)} />
+ {(error ?? (source && invalid)) && <div className={styles.error}>{error ?? invalid}</div>}
+ </div>
+ </Dialog>
+ );
+}
diff --git a/src/features/vcs/graph.ts b/src/features/vcs/graph.ts
index d6a689d40..9bcf18798 100644
--- a/src/features/vcs/graph.ts
+++ b/src/features/vcs/graph.ts
@@ -1,6 +1,7 @@
/**
* Commit graph lanes for the Git log (computed client-side from parents, for
- * commits in topological order, children before parents).
+ * commits in topological order, children before parents), plus the graph
+ * transformations of the log's Graph / View options.
*/
export interface GraphSegment {
@@ -9,6 +10,10 @@ export interface GraphSegment {
/** Lane at the segment's end (node level for `up`, bottom edge for `down`). */
to: number;
color: number;
+ /** Stands for collapsed commits (Collapse Linear Branches). */
+ dashed?: true;
+ /** A long edge continues out of sight in this direction (Show Long Edges off). */
+ arrow?: "up" | "down";
}
export interface GraphRow {
@@ -26,6 +31,7 @@ export interface GraphRow {
interface Lane {
id: string;
color: number;
+ dashed?: true;
}
export interface GraphState {
@@ -33,6 +39,13 @@ export interface GraphState {
nextColor: number;
}
+export interface GraphCommit {
+ id: string;
+ parents: readonly string[];
+ /** Per parent: the link skips collapsed commits. */
+ dashed?: readonly boolean[];
+}
+
export const emptyGraphState = (): GraphState => ({ lanes: [], nextColor: 0 });
const firstFree = (lanes: Array<Lane | null>) => {
@@ -40,12 +53,18 @@ const firstFree = (lanes: Array<Lane | null>) => {
return i < 0 ? lanes.length : i;
};
+const seg = (from: number, to: number, color: number, dashed?: boolean): GraphSegment =>
+ dashed ? { from, to, color, dashed: true } : { from, to, color };
+
+const laneOf = (id: string, color: number, dashed: boolean): Lane =>
+ dashed ? { id, color, dashed: true } : { id, color };
+
/**
* Lays out `commits` (continuing from `state`, so pages can be appended).
* Each lane keeps its position while it lives; freed slots are reused.
*/
export function computeGraph(
- commits: ReadonlyArray<{ id: string; parents: readonly string[] }>,
+ commits: ReadonlyArray<GraphCommit>,
state: GraphState = emptyGraphState(),
): { rows: GraphRow[]; state: GraphState } {
const lanes = [...state.lanes];
@@ -71,7 +90,7 @@ export function computeGraph(
const up: GraphSegment[] = [];
lanes.forEach((l, i) => {
if (!l) return;
- up.push({ from: i, to: l.id === c.id ? lane : i, color: l.color });
+ up.push(seg(i, l.id === c.id ? lane : i, l.color, l.dashed));
});
for (const m of matching) lanes[m] = null;
if (lane >= lanes.length) lanes.length = lane + 1;
@@ -79,26 +98,27 @@ export function computeGraph(
const down: GraphSegment[] = [];
lanes.forEach((l, i) => {
- if (l) down.push({ from: i, to: i, color: l.color });
+ if (l) down.push(seg(i, i, l.color, l.dashed));
});
c.parents.forEach((p, k) => {
+ const dashed = !!c.dashed?.[k];
// The first parent continues this lane even if another lane also leads to it
// (both lines then converge at the parent's node, like `git log --graph`).
if (k === 0) {
- lanes[lane] = { id: p, color };
- down.push({ from: lane, to: lane, color });
+ lanes[lane] = laneOf(p, color, dashed);
+ down.push(seg(lane, lane, color, dashed));
return;
}
const existing = lanes.findIndex((l) => l?.id === p);
if (existing >= 0) {
- down.push({ from: lane, to: existing, color: lanes[existing]!.color });
+ down.push(seg(lane, existing, lanes[existing]!.color, dashed));
return;
}
const slot = firstFree(lanes);
const col = nextColor++;
- lanes[slot] = { id: p, color: col };
- down.push({ from: lane, to: slot, color: col });
+ lanes[slot] = laneOf(p, col, dashed);
+ down.push(seg(lane, slot, col, dashed));
});
while (lanes.length && lanes[lanes.length - 1] === null) lanes.pop();
@@ -108,6 +128,103 @@ export function computeGraph(
return { rows, state: { lanes, nextColor } };
}
+/**
+ * Collapse Linear Branches: hides the commits of linear chains (one parent, one child,
+ * no references) so that only branch points, merges, tips and referenced commits stay,
+ * linked by dashed edges. Commits in `keep` (HEAD) stay visible.
+ */
+export function collapseLinear<C extends { id: string; parents: readonly string[]; refs: readonly string[] }>(
+ commits: readonly C[],
+ keep: ReadonlySet<string>,
+): { commits: C[]; graph: GraphCommit[] } {
+ const byId = new Map(commits.map((c) => [c.id, c]));
+ const children = new Map<string, number>();
+ for (const c of commits) for (const p of c.parents) children.set(p, (children.get(p) ?? 0) + 1);
+ const hidden = (c: C | undefined): boolean =>
+ !!c && c.parents.length === 1 && children.get(c.id) === 1 && !c.refs.length && !keep.has(c.id);
+
+ const visible: C[] = [];
+ const graph: GraphCommit[] = [];
+ for (const c of commits) {
+ if (hidden(c)) continue;
+ const dashed: boolean[] = [];
+ const parents: string[] = [];
+ for (const p of c.parents) {
+ let cur = p;
+ let skipped = false;
+ for (let next = byId.get(cur), guard = 0; next && guard < commits.length && hidden(next); guard++) {
+ cur = next.parents[0]!;
+ next = byId.get(cur);
+ skipped = true;
+ }
+ // Two collapsed lines can lead to the same commit: draw one edge.
+ const seen = parents.indexOf(cur);
+ if (seen >= 0) dashed[seen] = dashed[seen]! || skipped;
+ else {
+ parents.push(cur);
+ dashed.push(skipped);
+ }
+ }
+ visible.push(c);
+ graph.push(dashed.some(Boolean) ? { id: c.id, parents, dashed } : { id: c.id, parents });
+ }
+ return { commits: visible, graph };
+}
+
+/** Ids of the loaded commits reachable from `head` (log order: children before parents). */
+export function reachableFrom(
+ commits: ReadonlyArray<{ id: string; parents: readonly string[] }>,
+ head: string | null,
+): Set<string> {
+ const out = new Set<string>();
+ if (!head) return out;
+ out.add(head);
+ for (const c of commits) if (out.has(c.id)) for (const p of c.parents) out.add(p);
+ return out;
+}
+
+/** Edges running straight through at least this many rows are long. */
+export const LONG_EDGE = 30;
+/** Rows of a hidden long edge still drawn next to each of its ends. */
+const LONG_EDGE_STUB = 2;
+
+const onLane = (i: number) => (s: GraphSegment) => s.from === i && s.to === i;
+
+const passes = (row: GraphRow, i: number) => row.lane !== i && row.up.some(onLane(i)) && row.down.some(onLane(i));
+
+/**
+ * Show Long Edges off: the middle of a straight run of a lane through `minLength` or
+ * more rows is not drawn; the visible stubs end in arrows (IDEA's long-edge arrows).
+ */
+export function hideLongEdges(rows: readonly GraphRow[], minLength = LONG_EDGE): GraphRow[] {
+ const out = rows.slice();
+ const width = Math.max(0, ...rows.map((r) => r.width));
+ const edit = (r: number, fn: (row: GraphRow) => GraphRow) => {
+ out[r] = fn(out[r]!);
+ };
+ for (let i = 0; i < width; i++) {
+ const lane = onLane(i);
+ let start = -1;
+ for (let r = 0; r <= rows.length; r++) {
+ if (r < rows.length && passes(rows[r]!, i)) {
+ if (start < 0) start = r;
+ continue;
+ }
+ if (start >= 0 && r - start >= minLength) {
+ const from = start + LONG_EDGE_STUB;
+ const to = r - 1 - LONG_EDGE_STUB;
+ for (let k = from; k <= to; k++) {
+ edit(k, (row) => ({ ...row, up: row.up.filter((s) => !lane(s)), down: row.down.filter((s) => !lane(s)) }));
+ }
+ edit(from - 1, (row) => ({ ...row, down: row.down.map((s) => (lane(s) ? { ...s, arrow: "down" } : s)) }));
+ edit(to + 1, (row) => ({ ...row, up: row.up.map((s) => (lane(s) ? { ...s, arrow: "up" } : s)) }));
+ }
+ start = -1;
+ }
+ }
+ return out;
+}
+
/** Lane colours (tokens), cycled by colour index. */
export const LANE_COLORS = [
"var(--accent)",
diff --git a/src/features/vcs/historyActions.tsx b/src/features/vcs/historyActions.tsx
index 310efa85b..94825bc83 100644
--- a/src/features/vcs/historyActions.tsx
+++ b/src/features/vcs/historyActions.tsx
@@ -20,7 +20,8 @@ import {
} from "./changelistsUi";
import { useChangelists } from "./changelists";
import { useCommit } from "./commitStore";
-import { goToChild, goToParent, selectedCommits, useGitLog } from "./logStore";
+import { goToChild, goToParent, goToRef, selectedCommits, useGitLog } from "./logStore";
+import { chooseRevision } from "./RevisionChooser";
import {
cherryPick,
controlOperation,
@@ -208,6 +209,26 @@ export function registerHistoryActions(): () => void {
run: () => showResetDialog(),
},
+ // --- Git Log toolbar ---
+ {
+ id: "vcs.log.goToRef",
+ title: "Go to Hash/Branch/Tag",
+ category: "Git Log",
+ icon: "search",
+ when: VCS,
+ keyWhen: IN_GIT_LOG,
+ keywords: ["find commit", "jump"],
+ run: async () => {
+ toolWindowService().show("git", true);
+ const rev = await chooseRevision("Go to Hash/Branch/Tag", {
+ tags: true,
+ placeholder: "Enter hash or branch/tag name",
+ });
+ if (rev && !(await goToRef(rev)))
+ notifications().notify({ group: "vcs", level: "warning", title: `'${rev}' was not found in the log` });
+ },
+ },
+
// --- Git Log commit context menu ---
{
id: "vcs.log.copyRevision",
diff --git a/src/features/vcs/index.ts b/src/features/vcs/index.ts
index f1d96e2c1..8aa1e3405 100644
--- a/src/features/vcs/index.ts
+++ b/src/features/vcs/index.ts
@@ -43,7 +43,7 @@ function trackTitleItem(): () => void {
let dispose: (() => void) | null = null;
const sync = (available: boolean) => {
if (available && !dispose) {
- dispose = registerTitleItem({ id: "vcs.branch", align: "left", priority: 10, component: BranchWidget });
+ dispose = registerTitleItem({ id: "vcs.branch", title: "VCS Widget", align: "left", priority: 10, component: BranchWidget });
} else if (!available && dispose) {
dispose();
dispose = null;
diff --git a/src/features/vcs/localHistoryActions.ts b/src/features/vcs/localHistoryActions.ts
index 78bd0d104..a97be69c3 100644
--- a/src/features/vcs/localHistoryActions.ts
+++ b/src/features/vcs/localHistoryActions.ts
@@ -4,6 +4,7 @@ import { call, commands } from "@/platform/ipc";
import { notifications } from "@/workbench/contributions";
import { promptText } from "./dialogs";
import { errorMessage } from "./ops";
+import { showRecentChanges } from "./recentChanges";
/** Local History › Put Label…: names the current state of every file in the project. */
export async function putLabel(): Promise<boolean> {
@@ -35,5 +36,14 @@ export function registerLocalHistoryActions(): () => void {
keywords: ["local history", "label", "checkpoint"],
run: () => void putLabel(),
},
+ {
+ id: "localHistory.recentChanges",
+ title: "Recent Changes",
+ category: "View",
+ icon: "history",
+ when: "projectOpen",
+ keywords: ["local history", "recent changes", "activity"],
+ run: () => void showRecentChanges(),
+ },
]);
}
diff --git a/src/features/vcs/logOptions.ts b/src/features/vcs/logOptions.ts
new file mode 100644
index 000000000..67c394c9c
--- /dev/null
+++ b/src/features/vcs/logOptions.ts
@@ -0,0 +1,131 @@
+/**
+ * Git Log presentation options (IDEA's Graph Options and View Options menus),
+ * persisted across sessions.
+ */
+import { create } from "zustand";
+
+export type LogSort = "date" | "topo";
+
+export interface LogOptions {
+ sort: LogSort;
+ firstParent: boolean;
+ noMerges: boolean;
+ collapseLinear: boolean;
+ compactRefs: boolean;
+ tagNames: boolean;
+ longEdges: boolean;
+ commitTimestamp: boolean;
+ refsOnLeft: boolean;
+ showAuthor: boolean;
+ showDate: boolean;
+ showHash: boolean;
+ highlightMine: boolean;
+ highlightMerges: boolean;
+ highlightCurrentBranch: boolean;
+}
+
+/** IDEA's defaults. */
+export const DEFAULT_LOG_OPTIONS: LogOptions = {
+ sort: "date",
+ firstParent: false,
+ noMerges: false,
+ collapseLinear: false,
+ compactRefs: true,
+ tagNames: false,
+ longEdges: false,
+ commitTimestamp: false,
+ refsOnLeft: false,
+ showAuthor: true,
+ showDate: true,
+ showHash: false,
+ highlightMine: true,
+ highlightMerges: true,
+ highlightCurrentBranch: true,
+};
+
+/** Options that change which commits the backend returns (a reload is needed). */
+export const QUERY_OPTIONS: ReadonlyArray<keyof LogOptions> = ["sort", "firstParent", "noMerges"];
+
+const KEY = "openidea.vcs.logOptions";
+
+export function parseLogOptions(raw: unknown): LogOptions {
+ const o = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};
+ const out = { ...DEFAULT_LOG_OPTIONS };
+ for (const k of Object.keys(out) as Array<keyof LogOptions>) {
+ if (k === "sort") out.sort = o.sort === "topo" ? "topo" : o.sort === "date" ? "date" : DEFAULT_LOG_OPTIONS.sort;
+ else if (typeof o[k] === "boolean") (out as Record<string, unknown>)[k] = o[k];
+ }
+ return out;
+}
+
+function load(): LogOptions {
+ try {
+ const raw = localStorage.getItem(KEY);
+ return parseLogOptions(raw ? JSON.parse(raw) : null);
+ } catch {
+ return { ...DEFAULT_LOG_OPTIONS };
+ }
+}
+
+export const useLogOptions = create<LogOptions>(() => load());
+
+export const logOptions = () => useLogOptions.getState();
+
+export type RefKind = "head" | "local" | "remote" | "tag";
+
+export interface RefLabel {
+ kind: RefKind;
+ /** Empty for a tag shown without its name. */
+ text: string;
+ title: string;
+}
+
+/**
+ * Reference labels of a commit row. `refs` are decorations (`HEAD`, `main`,
+ * `origin/main`, `tag: v1`); `remoteNames` the remote-tracking branch names.
+ * Compact: a local branch absorbs its remote-tracking branches (`origin & main`) and
+ * HEAD is left out next to other references. Without tag names, tags are one icon.
+ */
+export function refLabels(
+ refs: readonly string[],
+ opts: { compact: boolean; tagNames: boolean },
+ remoteNames: ReadonlySet<string>,
+): RefLabel[] {
+ const isRemote = (r: string) => (remoteNames.size ? remoteNames.has(r) : r.includes("/"));
+ const tags = refs.filter((r) => r.startsWith("tag: ")).map((r) => r.slice(5));
+ const branches = refs.filter((r) => r !== "HEAD" && !r.startsWith("tag: "));
+ const out: RefLabel[] = [];
+ if (refs.includes("HEAD") && (!opts.compact || !branches.length)) out.push({ kind: "head", text: "HEAD", title: "HEAD" });
+ const locals = branches.filter((b) => !isRemote(b));
+ const remotes = branches.filter(isRemote);
+ const absorbed = new Set<string>();
+ for (const l of locals) {
+ const tracking = opts.compact ? remotes.filter((r) => r.endsWith(`/${l}`)) : [];
+ tracking.forEach((r) => absorbed.add(r));
+ const prefixes = tracking.map((r) => r.slice(0, -l.length - 1));
+ out.push({
+ kind: "local",
+ text: prefixes.length ? `${prefixes.join(", ")} & ${l}` : l,
+ title: [l, ...tracking].join(", "),
+ });
+ }
+ for (const r of remotes) if (!absorbed.has(r)) out.push({ kind: "remote", text: r, title: r });
+ if (tags.length) {
+ if (opts.tagNames) out.push(...tags.map((t) => ({ kind: "tag" as const, text: t, title: t })));
+ else out.push({ kind: "tag", text: "", title: tags.join(", ") });
+ }
+ return out;
+}
+
+/** Updates options and persists them; returns whether the log has to be reloaded. */
+export function setLogOptions(patch: Partial<LogOptions>): boolean {
+ const before = useLogOptions.getState();
+ useLogOptions.setState(patch);
+ const after = useLogOptions.getState();
+ try {
+ localStorage.setItem(KEY, JSON.stringify(after));
+ } catch {
+ // Storage unavailable: the options last for this session.
+ }
+ return QUERY_OPTIONS.some((k) => before[k] !== after[k]);
+}
diff --git a/src/features/vcs/logStore.ts b/src/features/vcs/logStore.ts
index 9fc587041..0da03ac31 100644
--- a/src/features/vcs/logStore.ts
+++ b/src/features/vcs/logStore.ts
@@ -3,11 +3,12 @@ import { create } from "zustand";
import type { Branch, BranchInfo, Commit } from "@/bindings";
import { call, commands } from "@/platform/ipc";
import { workflowSettings } from "@/platform/workflowSettings";
-import { computeGraph, emptyGraphState, type GraphRow, type GraphState } from "./graph";
+import { collapseLinear, computeGraph, emptyGraphState, type GraphRow, type GraphState } from "./graph";
+import { logOptions, setLogOptions, type LogOptions } from "./logOptions";
import { clearConsole, errorMessage } from "./ops";
import { currentRepo, repoOf, selectRepo, useVcs } from "./store";
-/** Date filter: commits made after / before the given times (epoch ms); applied client-side. */
+/** Date filter: commits made (committer time) after / before the given times (epoch ms). */
export interface LogDateFilter {
after: number | null;
before: number | null;
@@ -48,6 +49,8 @@ interface LogState {
tab: "log" | "console";
/** Bumped to ask the list to scroll the selection into view. */
revealTick: number;
+ /** The current user (`user.email`, else `user.name`), for View Options › Highlight › My Commits. */
+ user: string | null;
generation: number;
}
@@ -118,6 +121,7 @@ const initialLog = (): Omit<LogState, "generation"> => ({
outgoing: null,
tab: "log",
revealTick: 0,
+ user: null,
});
export const useGitLog = create<LogState>(() => ({ ...initialLog(), generation: 0 }));
@@ -165,6 +169,7 @@ export function reloadLog(): Promise<void> {
}));
loadPromise = null;
void loadOutgoing();
+ void currentUser().then((user) => useGitLog.setState({ user }));
return loadMore();
}
@@ -216,6 +221,7 @@ export function loadMore(): Promise<void> {
if (useGitLog.getState().generation === gen) useGitLog.setState({ done: true });
return;
}
+ const o = logOptions();
const page = await call(
commands.vcsLog(currentRepo(), {
branch: null,
@@ -229,6 +235,12 @@ export function loadMore(): Promise<void> {
range: null,
skip: s.commits.length,
limit: Math.min(PAGE, cap - s.commits.length),
+ order: o.sort,
+ firstParent: o.firstParent,
+ noMerges: o.noMerges,
+ // The date filter runs in the backend so the graph stays connected.
+ sinceMs: f.date?.after ?? null,
+ untilMs: f.date?.before ?? null,
}),
);
const cur = useGitLog.getState();
@@ -337,3 +349,56 @@ export function goToChild(c: Commit) {
if (commits[i]!.parents.includes(c.id)) return selectCommit(commits[i]!.id, true);
}
}
+
+/** Graph / View Options change; options that change the query reload the log. */
+export function updateLogOptions(patch: Partial<LogOptions>) {
+ if (setLogOptions(patch)) void reloadLog();
+}
+
+/** Highlight › My Commits: authored by the current user. */
+export function isMine(c: Commit, user: string | null): boolean {
+ if (!user) return false;
+ const u = user.toLowerCase();
+ return c.email.toLowerCase() === u || c.author.toLowerCase() === u;
+}
+
+/**
+ * Go to Hash/Branch/Tag: selects the commit `rev` names, paging the log until it is
+ * loaded (and clearing the filters when they hide it). False when there is no such commit.
+ */
+export async function goToRef(rev: string): Promise<boolean> {
+ const target = rev.trim();
+ if (!target) return false;
+ let id: string | undefined;
+ try {
+ const [hit] = await call(
+ commands.vcsLog(currentRepo(), {
+ branch: target,
+ path: null,
+ author: null,
+ text: null,
+ range: null,
+ skip: 0,
+ limit: 1,
+ }),
+ );
+ id = hit?.id;
+ } catch {
+ id = undefined;
+ }
+ if (!id) return false;
+ useGitLog.setState({ tab: "log" });
+ const find = () => useGitLog.getState().commits.some((c) => c.id === id);
+ if (!useGitLog.getState().commits.length) await reloadLog();
+ for (let i = 0; i < MAX_SEARCH_PAGES && !find() && !useGitLog.getState().done; i++) await loadMore();
+ if (!find()) await revealCommit(id);
+ if (!find()) return false;
+ // A commit inside a collapsed linear branch: expand them (IDEA does the same).
+ if (logOptions().collapseLinear) {
+ const head = useVcs.getState().branch?.headCommit;
+ const shown = collapseLinear(useGitLog.getState().commits, new Set(head ? [head] : [])).commits;
+ if (!shown.some((c) => c.id === id)) setLogOptions({ collapseLinear: false });
+ }
+ selectCommit(id, true);
+ return true;
+}
diff --git a/src/features/vcs/ops.ts b/src/features/vcs/ops.ts
index 2416b14b1..b3c34b77b 100644
--- a/src/features/vcs/ops.ts
+++ b/src/features/vcs/ops.ts
@@ -112,6 +112,7 @@ export async function saveAll() {
const REMOTE_TITLE: Record<RemoteOp["op"], [string, string]> = {
fetch: ["Fetching", "Fetch"],
pull: ["Updating project", "Update"],
+ pullFrom: ["Pulling", "Pull"],
push: ["Pushing", "Push"],
deleteBranch: ["Deleting remote branch", "Delete remote branch"],
pushBranch: ["Pushing", "Push"],
@@ -191,7 +192,7 @@ export async function runRemote(
}
}
try {
- const before = op.op === "pull" ? await headCommit(repo) : null;
+ const before = op.op === "pull" || op.op === "pullFrom" ? await headCommit(repo) : null;
await call(commands.vcsRemote(repo, request, op, channel));
const after = before ? await headCommit(repo) : null;
if (before && after && before !== after) updated.push({ repo, from: before, to: after });
@@ -203,7 +204,7 @@ export async function runRemote(
}
if (failures.length) throw new Error(failures.join("\n"));
lastRemoteError = null;
- if (op.op === "pull") await notifyUpdated(updated);
+ if (op.op === "pull" || op.op === "pullFrom") await notifyUpdated(updated);
else
notifications().notify({
group: "vcs",
diff --git a/src/features/vcs/recentChanges.ts b/src/features/vcs/recentChanges.ts
new file mode 100644
index 000000000..8388d2a94
--- /dev/null
+++ b/src/features/vcs/recentChanges.ts
@@ -0,0 +1,59 @@
+/**
+ * View › Recent Changes (⌥⇧C): the project's latest Local History events —
+ * labels, system events and saved file revisions — in a popup; choosing one
+ * opens its Local History.
+ */
+import type { HistoryEntry } from "@/bindings";
+import { openPopup, type ListPopupItem } from "@/editor/lsp/popupStore";
+import { call, commands } from "@/platform/ipc";
+import { relativePath, useProject } from "@/platform/project";
+import { notifications } from "@/workbench/contributions";
+import { openLocalHistory } from "./localHistoryKind";
+import { formatTime } from "./model";
+import { errorMessage } from "./ops";
+
+const MAX_ROWS = 40;
+
+/**
+ * Newest first; consecutive revisions of one file with the same label collapse
+ * into the newest (typing saves often).
+ */
+export function recentChanges(entries: readonly HistoryEntry[], limit = MAX_ROWS): HistoryEntry[] {
+ const sorted = [...entries].sort((a, b) => (b.timestampMs ?? 0) - (a.timestampMs ?? 0));
+ const out: HistoryEntry[] = [];
+ for (const e of sorted) {
+ const prev = out[out.length - 1];
+ if (prev && prev.kind !== "label" && e.kind !== "label" && prev.path === e.path && prev.label === e.label) continue;
+ out.push(e);
+ if (out.length >= limit) break;
+ }
+ return out;
+}
+
+export function recentChangeLabel(e: HistoryEntry, root: string): string {
+ if (e.kind === "label") return e.label;
+ return `${relativePath(root, e.path)}${e.label ? ` — ${e.label}` : ""}`;
+}
+
+export async function showRecentChanges() {
+ const root = useProject.getState().project?.root;
+ if (!root) return;
+ let entries: HistoryEntry[];
+ try {
+ entries = recentChanges((await call(commands.historyListDir(root))).entries);
+ } catch (e) {
+ notifications().notify({ level: "error", title: "Cannot read Local History", body: errorMessage(e) });
+ return;
+ }
+ const now = Date.now();
+ const items: ListPopupItem[] = entries.map((e, i) => ({
+ id: `${i}`,
+ label: recentChangeLabel(e, root),
+ detail: formatTime(e.timestampMs, now),
+ icon: e.kind === "label" ? "bookmark" : "history",
+ run: () => openLocalHistory(e.kind === "label" ? root : e.path),
+ }));
+ if (!items.length)
+ items.push({ id: "none", label: "No recent changes", disabled: "Local History has no entries yet", run: () => {} });
+ openPopup({ kind: "list", anchor: { x: window.innerWidth / 2 - 200, y: 96 }, title: "Recent Changes", items });
+}
diff --git a/src/features/vcs/remoteUi.tsx b/src/features/vcs/remoteUi.tsx
index 920abc942..742088310 100644
--- a/src/features/vcs/remoteUi.tsx
+++ b/src/features/vcs/remoteUi.tsx
@@ -44,7 +44,7 @@ function UpdateDialog({ onClose }: { onClose: () => void }) {
{ label: "Cancel", role: "cancel" },
]}
>
- <div className={styles.form} role="radiogroup" aria-label="Update type">
+ <div className={styles.form} role="radiogroup" aria-label={tx("Update type")}>
<div className={styles.hint}>
{branch?.upstream
? `Update ${branch.head ?? "HEAD"} from ${branch.upstream}${branch.behind ? ` (${branch.behind} incoming)` : ""}`
diff --git a/src/platform/actions.ts b/src/platform/actions.ts
index 0f605e8a4..b3d017887 100644
--- a/src/platform/actions.ts
+++ b/src/platform/actions.ts
@@ -140,6 +140,20 @@ export function actionToggled(action: Action | undefined): boolean | undefined {
}
}
+type ActionListener = (id: string, arg: unknown) => void;
+const listeners = new Set<ActionListener>();
+/** Actions running synchronously inside another action's `run`. */
+let nesting = 0;
+
+/**
+ * Called before each action the user runs (keyboard, menus, Find Action), not
+ * for the actions an action runs itself. Macro recording listens here.
+ */
+export function onActionExecuted(listener: ActionListener): () => void {
+ listeners.add(listener);
+ return () => void listeners.delete(listener);
+}
+
/** Runs an action if registered and enabled. Returns whether it ran. */
export async function executeAction(id: string, arg?: unknown): Promise<boolean> {
const action = getAction(id);
@@ -149,8 +163,22 @@ export async function executeAction(id: string, arg?: unknown): Promise<boolean>
}
const ctx = getContext();
if (!isActionEnabled(action, ctx)) return false;
+ if (nesting === 0)
+ for (const l of listeners)
+ try {
+ l(id, arg);
+ } catch (e) {
+ console.error("action listener failed", e);
+ }
try {
- await action.run({ ctx, arg });
+ let pending: void | Promise<void>;
+ nesting++;
+ try {
+ pending = action.run({ ctx, arg });
+ } finally {
+ nesting--;
+ }
+ await pending;
} catch (e) {
console.error(`action ${id} failed`, e);
}
diff --git a/src/platform/editorSettings.ts b/src/platform/editorSettings.ts
index 1545d945f..204067d33 100644
--- a/src/platform/editorSettings.ts
+++ b/src/platform/editorSettings.ts
@@ -86,6 +86,9 @@ export const EDITOR_EXTRA_DEFAULTS = {
caseSensitivity: "first",
autoPopup: true,
insertOnSpecialKeys: false,
+ autoInsertSingle: true,
+ sortAlphabetically: false,
+ insertParentheses: true,
showDocumentation: false,
documentationDelay: 500,
parameterInfo: true,
@@ -96,9 +99,16 @@ export const EDITOR_EXTRA_DEFAULTS = {
tabs: {
placement: "top",
multipleRows: false,
+ oneRowOverflow: "scroll",
+ pinnedSeparateRow: false,
+ showFileIcon: true,
showExtension: true,
+ showDirectoryForNonUnique: true,
markModified: false,
+ showFullPathOnHover: true,
showCloseButton: true,
+ closeButtonPosition: "right",
+ sortAlphabetically: false,
previewTab: true,
openAtEnd: false,
tabLimit: 30,
@@ -125,7 +135,8 @@ export const EDITOR_EXTRA_DEFAULTS = {
nextErrorErrorsOnly: true,
stickyLinesMax: 5,
},
- inlay: { types: true, parameters: true, other: true, disabledLanguages: [] as string[], codeVisionUsages: true },
+ inlay: { types: true, parameters: true, other: true, disabledLanguages: [] as string[], codeVisionUsages: true, codeVisionAuthor: true },
+ inlineCompletion: { enabled: true, onlyOnPause: false, pauseMs: 500, disabledLanguages: [] as string[] },
gutterIconsDisabled: [] as string[],
showGutterIcons: true,
codeStyle: {
@@ -135,6 +146,13 @@ export const EDITOR_EXTRA_DEFAULTS = {
detectIndents: true,
editorconfig: true,
languages: {} as Record<string, LanguageCodeStyle>,
+ /** Formatter › Do not format: globs Reformat Code skips. */
+ doNotFormat: [] as string[],
+ /** Formatter › Turn formatter on/off with markers in code comments. */
+ formatterTagsEnabled: false,
+ formatterOffTag: "@formatter:off",
+ formatterOnTag: "@formatter:on",
+ formatterTagsRegexp: false,
},
encodings: { global: "utf-8", project: "utf-8", properties: "iso-8859-1", utf8Bom: "never" },
};
@@ -171,14 +189,33 @@ export function validateEditorExtras(raw: unknown): EditorExtras {
return coerceLike(raw, EDITOR_EXTRA_DEFAULTS);
}
-let cache: { raw: unknown; value: EditorExtras } | null = null;
+let cache: { raw: unknown; powerSave: boolean; value: EditorExtras } | null = null;
+
+/** File › Power Save Mode (`general.powerSaveMode`). */
+export function isPowerSaveMode(settings: unknown = useProject.getState().settings): boolean {
+ const general = settings && typeof settings === "object" ? (settings as Obj).general : undefined;
+ return isObj(general) && general.powerSaveMode === true;
+}
+
+/** Power Save Mode turns off the editor's automatic popups and background highlighting. */
+export function powerSaveExtras(p: EditorExtras): EditorExtras {
+ return {
+ ...p,
+ completion: { ...p.completion, autoPopup: false, parameterInfo: false, showDocumentation: false },
+ codeEditing: { ...p.codeEditing, quickDocOnHover: false, highlightUsages: false },
+ inlay: { ...p.inlay, codeVisionUsages: false },
+ inlineCompletion: { ...p.inlineCompletion, enabled: false },
+ };
+}
/** Effective Editor-group settings (validated, memoised per settings object). */
export function editorPrefs(settings: unknown = useProject.getState().settings): EditorExtras {
const raw = settings && typeof settings === "object" ? (settings as Obj).editor : undefined;
- if (cache && cache.raw === raw) return cache.value;
- const value = validateEditorExtras(raw);
- cache = { raw, value };
+ const powerSave = isPowerSaveMode(settings);
+ if (cache && cache.raw === raw && cache.powerSave === powerSave) return cache.value;
+ const valid = validateEditorExtras(raw);
+ const value = powerSave ? powerSaveExtras(valid) : valid;
+ cache = { raw, powerSave, value };
return value;
}
diff --git a/src/platform/fileTypes.ts b/src/platform/fileTypes.ts
new file mode 100644
index 000000000..4d78c7874
--- /dev/null
+++ b/src/platform/fileTypes.ts
@@ -0,0 +1,165 @@
+/**
+ * Settings › Editor › File Types: the user's file name / hashbang patterns per
+ * language (`files.fileTypes`) and per-file Override File Type
+ * (`files.fileTypeOverrides`, project scope). The backend registry
+ * (`ide-language`) detects languages with them; this module holds the shared
+ * model and mirrors the name matching for the UI (file icons).
+ */
+import type { LanguageInfo_Serialize as LanguageInfo } from "./ipc";
+
+export interface FileTypeAssociation {
+ /** Added file name patterns (`*.foo`, `Jenkinsfile`, `Dockerfile.*`). */
+ patterns: string[];
+ /** Patterns of the language definition the user removed. */
+ removedPatterns: string[];
+ /** Interpreters run by a `#!` first line (`node`). */
+ hashbangs: string[];
+}
+
+export type FileTypeAssociations = Record<string, FileTypeAssociation>;
+
+const strings = (v: unknown): string[] =>
+ Array.isArray(v)
+ ? [
+ ...new Set(
+ v
+ .filter((x): x is string => typeof x === "string")
+ .map((x) => x.trim())
+ .filter(Boolean),
+ ),
+ ]
+ : [];
+
+const isObj = (v: unknown): v is Record<string, unknown> => !!v && typeof v === "object" && !Array.isArray(v);
+
+export function validateFileTypes(raw: unknown): FileTypeAssociations {
+ const out: FileTypeAssociations = {};
+ if (!isObj(raw)) return out;
+ for (const [id, a] of Object.entries(raw)) {
+ if (!id.trim() || !isObj(a)) continue;
+ out[id] = {
+ patterns: strings(a.patterns),
+ removedPatterns: strings(a.removedPatterns),
+ hashbangs: strings(a.hashbangs),
+ };
+ }
+ return out;
+}
+
+export function validateFileTypeOverrides(raw: unknown): Record<string, string> {
+ const out: Record<string, string> = {};
+ if (!isObj(raw)) return out;
+ for (const [path, lang] of Object.entries(raw))
+ if (path.trim() && typeof lang === "string" && lang.trim()) out[path] = lang.trim();
+ return out;
+}
+
+/** Built-in file name patterns of a language definition: `*.ext` and file names. */
+export function builtinPatterns(lang: Pick<LanguageInfo, "extensions" | "filenames">): string[] {
+ return [...lang.extensions.map((e) => `*.${e}`), ...(lang.filenames ?? [])];
+}
+
+const EMPTY: FileTypeAssociation = { patterns: [], removedPatterns: [], hashbangs: [] };
+
+/** Effective file name patterns of a language: definition minus removed, plus added. */
+export function effectivePatterns(
+ lang: Pick<LanguageInfo, "id" | "extensions" | "filenames">,
+ assoc: FileTypeAssociations,
+): Array<{ pattern: string; builtin: boolean }> {
+ const own = assoc[lang.id] ?? EMPTY;
+ const removed = new Set(own.removedPatterns.map((p) => p.toLowerCase()));
+ const out = builtinPatterns(lang)
+ .filter((p) => !removed.has(p.toLowerCase()))
+ .map((pattern) => ({ pattern, builtin: true }));
+ for (const pattern of own.patterns)
+ if (!out.some((o) => o.pattern === pattern)) out.push({ pattern, builtin: false });
+ return out;
+}
+
+function withAssoc(assoc: FileTypeAssociations, id: string, f: (a: FileTypeAssociation) => FileTypeAssociation) {
+ const next = { ...assoc, [id]: f(assoc[id] ?? EMPTY) };
+ const a = next[id]!;
+ if (!a.patterns.length && !a.removedPatterns.length && !a.hashbangs.length) delete next[id];
+ return next;
+}
+
+/**
+ * Adds `pattern` to `id`. As in IDEA a pattern belongs to one file type: it is
+ * taken away from any other language that has it (built-in or added).
+ */
+export function addPattern(
+ assoc: FileTypeAssociations,
+ langs: ReadonlyArray<Pick<LanguageInfo, "id" | "extensions" | "filenames">>,
+ id: string,
+ pattern: string,
+): FileTypeAssociations {
+ const p = pattern.trim();
+ if (!p) return assoc;
+ let next = assoc;
+ for (const l of langs) {
+ if (l.id === id || !effectivePatterns(l, next).some((e) => e.pattern === p)) continue;
+ next = removePattern(next, l, p);
+ }
+ const lang = langs.find((l) => l.id === id);
+ return withAssoc(next, id, (a) => {
+ // Re-adding a removed built-in pattern restores it.
+ if (lang && builtinPatterns(lang).includes(p))
+ return { ...a, removedPatterns: a.removedPatterns.filter((r) => r !== p) };
+ return a.patterns.includes(p) ? a : { ...a, patterns: [...a.patterns, p] };
+ });
+}
+
+export function removePattern(
+ assoc: FileTypeAssociations,
+ lang: Pick<LanguageInfo, "id" | "extensions" | "filenames">,
+ pattern: string,
+): FileTypeAssociations {
+ const builtin = builtinPatterns(lang).includes(pattern);
+ return withAssoc(assoc, lang.id, (a) => ({
+ ...a,
+ patterns: a.patterns.filter((p) => p !== pattern),
+ removedPatterns:
+ builtin && !a.removedPatterns.includes(pattern) ? [...a.removedPatterns, pattern] : a.removedPatterns,
+ }));
+}
+
+export function setHashbangs(assoc: FileTypeAssociations, id: string, hashbangs: string[]): FileTypeAssociations {
+ return withAssoc(assoc, id, (a) => ({ ...a, hashbangs: strings(hashbangs) }));
+}
+
+/** `*` matches any run of characters, `?` one (as `ide-language`'s file name patterns). */
+export function wildcardMatch(pattern: string, name: string): boolean {
+ const re = new RegExp(
+ `^${pattern
+ .replace(/[.+^${}()|[\]\\]/g, "\\$&")
+ .replace(/\*/g, ".*")
+ .replace(/\?/g, ".")}$`,
+ "s",
+ );
+ return re.test(name);
+}
+
+/** Language a user-added pattern assigns to `fileName` (null: none applies). */
+export function userFileType(assoc: FileTypeAssociations, fileName: string): string | null {
+ const lower = fileName.toLowerCase();
+ let glob: { id: string; len: number } | null = null;
+ let ext: { id: string; len: number } | null = null;
+ for (const [id, a] of Object.entries(assoc)) {
+ for (const p of a.patterns) {
+ const simpleExt = /^\*\.[^*?]+$/.test(p);
+ if (!/[*?]/.test(p)) {
+ if (p === fileName) return id;
+ } else if (simpleExt) {
+ const e = p.slice(1).toLowerCase();
+ if (lower.endsWith(e) && lower.length > e.length && (!ext || e.length > ext.len)) ext = { id, len: e.length };
+ } else if (wildcardMatch(p, fileName) && (!glob || p.length > glob.len)) glob = { id, len: p.length };
+ }
+ }
+ return glob?.id ?? ext?.id ?? null;
+}
+
+/** File name standing for a language when picking its icon (`x.py`). */
+export function sampleFileName(lang: Pick<LanguageInfo, "extensions" | "filenames">): string | null {
+ if (lang.extensions[0]) return `file.${lang.extensions[0]}`;
+ return lang.filenames?.find((n) => !/[*?]/.test(n)) ?? null;
+}
diff --git a/src/platform/formatGuard.ts b/src/platform/formatGuard.ts
new file mode 100644
index 000000000..7a47679d5
--- /dev/null
+++ b/src/platform/formatGuard.ts
@@ -0,0 +1,222 @@
+/**
+ * Code Style › Formatter: "Do not format" globs and formatter on/off markers
+ * in code comments (`@formatter:off` … `@formatter:on`). Reformat Code, format
+ * on save and the before-commit reformat skip excluded files and leave the
+ * text between markers untouched.
+ */
+import { editorPrefs } from "./editorSettings";
+
+export interface FormatGuardOptions {
+ doNotFormat: readonly string[];
+ formatterTagsEnabled: boolean;
+ formatterOffTag: string;
+ formatterOnTag: string;
+ formatterTagsRegexp: boolean;
+}
+
+export interface TextChangeLike {
+ from: number;
+ to: number;
+ insert: string;
+}
+
+/** The Formatter options of the effective settings. */
+export function formatGuardOptions(settings?: unknown): FormatGuardOptions {
+ const cs = editorPrefs(settings).codeStyle;
+ return {
+ doNotFormat: cs.doNotFormat,
+ formatterTagsEnabled: cs.formatterTagsEnabled,
+ formatterOffTag: cs.formatterOffTag,
+ formatterOnTag: cs.formatterOnTag,
+ formatterTagsRegexp: cs.formatterTagsRegexp,
+ };
+}
+
+function globRegExp(glob: string): RegExp {
+ let re = "";
+ for (let i = 0; i < glob.length; i++) {
+ const c = glob[i]!;
+ if (c === "*" && glob[i + 1] === "*") {
+ re += ".*";
+ i++;
+ if (glob[i + 1] === "/") i++;
+ } else if (c === "*") re += "[^/]*";
+ else if (c === "?") re += "[^/]";
+ else re += c.replace(/[.+^${}()|[\]\\]/g, "\\$&");
+ }
+ return new RegExp(`^${re}$`);
+}
+
+/**
+ * Whether "Do not format" excludes `path`. A pattern without `/` matches the
+ * file name or any folder name (`*.min.js`, `generated`); one with `/` matches
+ * the project-relative path or a folder containing it (`src/gen/**`, `vendor/`).
+ */
+export function formatExcluded(path: string, root: string | null, globs: readonly string[]): boolean {
+ const rel = root && path.startsWith(root + "/") ? path.slice(root.length + 1) : path;
+ const segments = rel.split("/").filter(Boolean);
+ for (const raw of globs) {
+ const glob = raw.trim().replace(/^\.\//, "");
+ if (!glob) continue;
+ if (!glob.includes("/")) {
+ const re = globRegExp(glob);
+ if (segments.some((s) => re.test(s))) return true;
+ continue;
+ }
+ const re = globRegExp(glob.replace(/^\/+/, "").replace(/\/+$/, ""));
+ for (let i = segments.length; i > 0; i--) if (re.test(segments.slice(0, i).join("/"))) return true;
+ }
+ return false;
+}
+
+/** A comment opener before the marker on its line (`//`, `#`, `/*`, `<!--`, `--`, `;`, `*`, `%`). */
+const COMMENT_BEFORE = /(\/\/|#|\/\*|<!--|--|;|\*|%|\{-|\(\*|')/;
+
+function markerMatcher(tag: string, regexp: boolean): RegExp | null {
+ if (!tag.trim()) return null;
+ try {
+ return new RegExp(regexp ? tag : tag.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g");
+ } catch {
+ return null;
+ }
+}
+
+/** Marker hits in comments: offsets of their lines (`start`..`end`, end excludes the newline). */
+function markerLines(text: string, re: RegExp): Array<{ start: number; end: number }> {
+ const out: Array<{ start: number; end: number }> = [];
+ re.lastIndex = 0;
+ let m: RegExpExecArray | null;
+ while ((m = re.exec(text))) {
+ if (m[0] === "") {
+ re.lastIndex++;
+ continue;
+ }
+ const start = text.lastIndexOf("\n", m.index - 1) + 1;
+ const nl = text.indexOf("\n", m.index + m[0].length);
+ const end = nl < 0 ? text.length : nl;
+ if (COMMENT_BEFORE.test(text.slice(start, m.index)) && out.at(-1)?.start !== start) out.push({ start, end });
+ re.lastIndex = Math.max(re.lastIndex, end);
+ }
+ return out;
+}
+
+/**
+ * Text the formatter must not touch: from the line of each off marker to the
+ * end of the line of the next on marker (or the end of the text).
+ */
+export function protectedRegions(text: string, opts: FormatGuardOptions): Array<{ from: number; to: number }> {
+ if (!opts.formatterTagsEnabled) return [];
+ const off = markerMatcher(opts.formatterOffTag, opts.formatterTagsRegexp);
+ const on = markerMatcher(opts.formatterOnTag, opts.formatterTagsRegexp);
+ if (!off) return [];
+ const offs = markerLines(text, off);
+ const ons = on ? markerLines(text, on) : [];
+ const out: Array<{ from: number; to: number }> = [];
+ let pos = 0;
+ for (const o of offs) {
+ if (o.start < pos) continue;
+ const end = ons.find((x) => x.start > o.start);
+ out.push({ from: o.start, to: end ? end.end : text.length });
+ pos = end ? end.end : text.length;
+ if (!end) break;
+ }
+ return out;
+}
+
+const touches = (c: { from: number; to: number }, r: { from: number; to: number }) =>
+ c.from === c.to ? c.from > r.from && c.from < r.to : c.from < r.to && c.to > r.from;
+
+/** The change minus its common prefix / suffix with the replaced text. */
+function narrow(text: string, c: TextChangeLike): TextChangeLike | null {
+ const old = text.slice(c.from, c.to);
+ if (old === c.insert) return null;
+ const max = Math.min(old.length, c.insert.length);
+ let s = 0;
+ while (s < max && old.charCodeAt(s) === c.insert.charCodeAt(s)) s++;
+ let eo = old.length;
+ let ei = c.insert.length;
+ while (eo > s && ei > s && old.charCodeAt(eo - 1) === c.insert.charCodeAt(ei - 1)) {
+ eo--;
+ ei--;
+ }
+ return { from: c.from + s, to: c.from + eo, insert: c.insert.slice(s, ei) };
+}
+
+/**
+ * Drops formatting changes inside protected regions. A change replacing whole
+ * regions (a formatter rewriting the file) is split around them, provided the
+ * formatted text keeps the same markers; other overlapping changes are dropped.
+ */
+export function guardFormatChanges<T extends TextChangeLike>(
+ text: string,
+ changes: readonly T[],
+ opts: FormatGuardOptions,
+): TextChangeLike[] {
+ const regions = protectedRegions(text, opts);
+ if (!regions.length) return [...changes];
+ const out: TextChangeLike[] = [];
+ for (const raw of changes) {
+ const c = narrow(text, raw);
+ if (!c) continue;
+ const hit = regions.filter((r) => touches(c, r));
+ if (!hit.length) {
+ out.push(c);
+ continue;
+ }
+ // Whole regions inside the change: map them onto the formatted text.
+ if (hit.some((r) => r.from < c.from || r.to > c.to)) continue;
+ const local = protectedRegions(c.insert, opts);
+ if (local.length !== hit.length) continue;
+ let oldPos = c.from;
+ let newPos = 0;
+ for (let i = 0; i <= hit.length; i++) {
+ const oldEnd = i < hit.length ? hit[i]!.from : c.to;
+ const newEnd = i < hit.length ? local[i]!.from : c.insert.length;
+ const piece = narrow(text, { from: oldPos, to: oldEnd, insert: c.insert.slice(newPos, newEnd) });
+ if (piece) out.push(piece);
+ if (i < hit.length) {
+ oldPos = hit[i]!.to;
+ newPos = local[i]!.to;
+ }
+ }
+ }
+ return out;
+}
+
+interface PosLike {
+ line: number;
+ col: number;
+}
+
+/** [`guardFormatChanges`] for LSP-style edits (0-based lines, UTF-16 columns) against `text`. */
+export function guardTextEdits(
+ text: string,
+ edits: ReadonlyArray<{ range: { start: PosLike; end: PosLike }; new_text: string }>,
+ opts: FormatGuardOptions,
+): Array<{ range: { start: PosLike; end: PosLike }; new_text: string }> {
+ if (!protectedRegions(text, opts).length) return [...edits];
+ const starts = [0];
+ for (let i = text.indexOf("\n"); i >= 0; i = text.indexOf("\n", i + 1)) starts.push(i + 1);
+ const offset = (p: PosLike) => {
+ const line = Math.min(Math.max(0, p.line), starts.length - 1);
+ const end = line + 1 < starts.length ? starts[line + 1]! - 1 : text.length;
+ return Math.min(starts[line]! + p.col, end);
+ };
+ const pos = (o: number): PosLike => {
+ let lo = 0;
+ let hi = starts.length - 1;
+ while (lo < hi) {
+ const mid = (lo + hi + 1) >> 1;
+ if (starts[mid]! <= o) lo = mid;
+ else hi = mid - 1;
+ }
+ return { line: lo, col: o - starts[lo]! };
+ };
+ const changes = edits
+ .map((e) => ({ from: offset(e.range.start), to: offset(e.range.end), insert: e.new_text }))
+ .sort((a, b) => a.from - b.from || a.to - b.to);
+ return guardFormatChanges(text, changes, opts).map((c) => ({
+ range: { start: pos(c.from), end: pos(c.to) },
+ new_text: c.insert,
+ }));
+}
diff --git a/src/platform/inspections.test.ts b/src/platform/inspections.test.ts
new file mode 100644
index 000000000..f86aa4661
--- /dev/null
+++ b/src/platform/inspections.test.ts
@@ -0,0 +1,144 @@
+import { afterEach, describe, expect, it } from "vitest";
+import type { Diagnostic } from "@/bindings";
+import {
+ activeProfileId,
+ applyProfile,
+ applyProfileMixed,
+ copyProfileName,
+ effectiveProfileId,
+ isTypoStyled,
+ listProfiles,
+ newProfileKey,
+ overridesOf,
+ profileLabel,
+ validateProfileName,
+ inspectionProfile,
+ producerInspectionId,
+ subscribeInspectionProfile,
+ validateInspections,
+} from "./inspections";
+import { useProject } from "./project";
+
+const diag = (code: string | null, severity: Diagnostic["severity"] = "warning", server?: string): Diagnostic => ({
+ range: { start: { line: 0, col: 0 }, end: { line: 0, col: 1 } },
+ severity,
+ message: `m ${code}`,
+ source: "Ruff",
+ code,
+ server,
+});
+
+describe("inspection profiles", () => {
+ afterEach(() => useProject.setState({ project: null, settings: null }));
+
+ it("validates leniently", () => {
+ expect(
+ validateInspections({
+ profile: "project",
+ default: { "lsp:ruff": { enabled: false, severity: "loud" }, empty: {}, x: { severity: "typo" } },
+ project: 3,
+ }),
+ ).toEqual({
+ profile: "project",
+ default: { "lsp:ruff": { enabled: false }, x: { severity: "typo" } },
+ project: {},
+ ideProfiles: {},
+ projectProfiles: {},
+ });
+ expect(validateInspections(undefined).profile).toBe("default");
+ expect(effectiveProfileId(validateInspections({ profile: "project" }), false)).toBe("default");
+ });
+
+ it("maps built-in producers to their inspections", () => {
+ expect(producerInspectionId("file-references")).toBe("builtin:file-references");
+ expect(producerInspectionId("ruff")).toBe("lsp:ruff");
+ });
+
+ it("drops disabled inspections and remaps severities", () => {
+ const items = [diag("F401"), diag("E501", "error"), diag(null, "info")];
+ expect(applyProfile({}, "ruff", items)).toBe(items);
+ expect(applyProfile({ "lsp:ruff": { enabled: false } }, "ruff", items)).toEqual([]);
+ const out = applyProfile(
+ {
+ "lsp:ruff": { severity: "error" },
+ "lsp:ruff:F401": { severity: "weakWarning" },
+ "lsp:ruff:E501": { enabled: false },
+ },
+ "ruff",
+ items,
+ );
+ expect(out.map((d) => [d.code, d.severity])).toEqual([
+ ["F401", "info"],
+ [null, "error"],
+ ]);
+ expect(applyProfile({ "lsp:ruff": { severity: "none" } }, "ruff", [diag("x")])[0]!.severity).toBe("hint");
+ });
+
+ it("groups mixed results by reporting server", () => {
+ const out = applyProfileMixed({ "lsp:ruff": { enabled: false } }, [
+ diag("a", "warning", "ruff"),
+ diag("b", "warning", "ty"),
+ ]);
+ expect(out.map((d) => d.code)).toEqual(["b"]);
+ });
+
+ it("follows the project's choice of profile and notifies on content changes", () => {
+ const calls: number[] = [];
+ const off = subscribeInspectionProfile(() => calls.push(1));
+ const settings = {
+ inspections: { profile: "project", default: { a: { enabled: false } }, project: { b: { enabled: false } } },
+ };
+ useProject.setState({ settings: settings as never });
+ expect(activeProfileId()).toBe("default");
+ expect(inspectionProfile()).toEqual({ a: { enabled: false } });
+ useProject.setState({ project: { root: "/p" } as never });
+ expect(activeProfileId()).toBe("project");
+ expect(inspectionProfile()).toEqual({ b: { enabled: false } });
+ useProject.setState({ settings: JSON.parse(JSON.stringify(settings)) });
+ off();
+ expect(calls.length).toBe(2);
+ });
+
+ it("gives the Typo inspection its default level and marks typo-level diagnostics", () => {
+ const typo = { ...diag(null, "info"), source: "Spelling" };
+ const [shown] = applyProfile({}, "spelling", [typo]);
+ expect(shown!.severity).toBe("info");
+ expect(isTypoStyled(shown!)).toBe(true);
+ const [asError] = applyProfile({ "builtin:spelling": { severity: "error" } }, "spelling", [typo]);
+ expect(asError!.severity).toBe("error");
+ expect(isTypoStyled(asError!)).toBe(false);
+ expect(applyProfile({ "builtin:spelling": { enabled: false } }, "spelling", [typo])).toEqual([]);
+ // Any inspection can be shown at the Typo level.
+ expect(isTypoStyled(applyProfile({ "lsp:ruff": { severity: "typo" } }, "ruff", [diag("x")])[0]!)).toBe(true);
+ });
+
+ it("lists, labels and resolves copied profiles", () => {
+ const s = validateInspections({
+ profile: "ide:strict",
+ default: { a: { enabled: false } },
+ ideProfiles: { strict: { name: "Strict", overrides: { b: { severity: "error" } } }, bad: 3 },
+ projectProfiles: { team: { name: "Team", overrides: {} } },
+ });
+ expect(s.ideProfiles.bad).toEqual({ name: "bad", overrides: {} });
+ expect(listProfiles(s, true).map((p) => [p.id, p.label, p.level])).toEqual([
+ ["project", "Project Default", "project"],
+ ["project:team", "Team", "project"],
+ ["default", "Default", "ide"],
+ ["ide:bad", "bad", "ide"],
+ ["ide:strict", "Strict", "ide"],
+ ]);
+ expect(listProfiles(s, false).map((p) => p.id)).toEqual(["default", "ide:bad", "ide:strict"]);
+ expect(effectiveProfileId(s, false)).toBe("ide:strict");
+ expect(effectiveProfileId({ ...s, profile: "project:team" }, false)).toBe("default");
+ expect(effectiveProfileId({ ...s, profile: "ide:gone" }, true)).toBe("default");
+ expect(overridesOf(s, "ide:strict")).toEqual({ b: { severity: "error" } });
+ expect(profileLabel(s, "project")).toBe("Project Default");
+ expect(validateProfileName("Strict", "ide", s)).toMatch(/already exists/);
+ expect(validateProfileName("Strict", "project", s)).toBeNull();
+ expect(validateProfileName("Strict", "ide", s, "ide:strict")).toBeNull();
+ expect(validateProfileName(" ", "ide", s)).toMatch(/empty/);
+ expect(copyProfileName("Strict", "ide", s)).toBe("Strict copy");
+ expect(newProfileKey("Strict copy!", s.ideProfiles)).toBe("strict-copy");
+ expect(newProfileKey("Strict", s.ideProfiles)).toBe("strict-2");
+ });
+});
diff --git a/src/platform/inspections.ts b/src/platform/inspections.ts
new file mode 100644
index 000000000..aed55b4f4
--- /dev/null
+++ b/src/platform/inspections.ts
@@ -0,0 +1,436 @@
+/**
+ * Inspection profiles (Settings › Editor › Inspections). Every diagnostic
+ * producer is an inspection: a language server (`lsp:<server>`), optionally
+ * refined per diagnostic code (`lsp:<server>:<code>`), or a built-in check.
+ * The profile in effect disables inspections and remaps their severity; the
+ * editor, Problems view and Inspect Code all filter through `applyProfile`.
+ * Besides `Default` (IDE) and `Project Default`, profiles made with Copy live
+ * at either level (`ide:<key>` / `project:<key>`).
+ * Mirrors `ide-core::inspection_settings`.
+ */
+import type { Diagnostic, Severity } from "@/bindings";
+import { useProject } from "./project";
+
+export type InspectionLevel = "error" | "warning" | "weakWarning" | "serverProblem" | "typo" | "none";
+/** `default`, `project`, `ide:<key>` or `project:<key>`. */
+export type ProfileId = string;
+export type ProfileLevel = "ide" | "project";
+
+export interface InspectionOverride {
+ enabled?: boolean;
+ severity?: InspectionLevel;
+}
+
+export type ProfileOverrides = Readonly<Record<string, InspectionOverride>>;
+
+export interface CustomProfile {
+ name: string;
+ overrides: ProfileOverrides;
+}
+
+export type CustomProfiles = Readonly<Record<string, CustomProfile>>;
+
+export interface InspectionSettingsValid {
+ profile: ProfileId;
+ default: ProfileOverrides;
+ project: ProfileOverrides;
+ ideProfiles: CustomProfiles;
+ projectProfiles: CustomProfiles;
+}
+
+export const DEFAULT_INSPECTIONS: InspectionSettingsValid = {
+ profile: "default",
+ default: {},
+ project: {},
+ ideProfiles: {},
+ projectProfiles: {},
+};
+
+/** IDEA's highlighting levels and the editor severity each one is shown with. */
+export const INSPECTION_LEVELS: readonly { value: InspectionLevel; label: string; severity: Severity }[] = [
+ { value: "error", label: "Error", severity: "error" },
+ { value: "warning", label: "Warning", severity: "warning" },
+ { value: "weakWarning", label: "Weak Warning", severity: "info" },
+ { value: "serverProblem", label: "Server Problem", severity: "warning" },
+ { value: "typo", label: "Typo", severity: "info" },
+ { value: "none", label: "No highlighting", severity: "hint" },
+];
+
+export const PROFILE_LABELS: Record<"default" | "project", string> = { default: "Default", project: "Project Default" };
+
+export function levelSeverity(level: InspectionLevel): Severity {
+ return INSPECTION_LEVELS.find((l) => l.value === level)?.severity ?? "warning";
+}
+
+type Obj = Record<string, unknown>;
+const obj = (v: unknown): Obj => (v && typeof v === "object" && !Array.isArray(v) ? (v as Obj) : {});
+const LEVELS = new Set<string>(INSPECTION_LEVELS.map((l) => l.value));
+
+function validateOverrides(raw: unknown): Record<string, InspectionOverride> {
+ const out: Record<string, InspectionOverride> = {};
+ for (const [id, v] of Object.entries(obj(raw))) {
+ const o = obj(v);
+ const entry: InspectionOverride = {};
+ if (typeof o.enabled === "boolean") entry.enabled = o.enabled;
+ if (typeof o.severity === "string" && LEVELS.has(o.severity)) entry.severity = o.severity as InspectionLevel;
+ if (id && (entry.enabled !== undefined || entry.severity !== undefined)) out[id] = entry;
+ }
+ return out;
+}
+
+function validateCustom(raw: unknown): Record<string, CustomProfile> {
+ const out: Record<string, CustomProfile> = {};
+ for (const [key, v] of Object.entries(obj(raw))) {
+ const o = obj(v);
+ if (!key.trim()) continue;
+ const name = typeof o.name === "string" && o.name.trim() ? o.name.trim() : key;
+ out[key] = { name, overrides: validateOverrides(o.overrides) };
+ }
+ return out;
+}
+
+const CUSTOM_ID = /^(ide|project):(.+)$/;
+
+export function validateInspections(raw: unknown): InspectionSettingsValid {
+ const r = obj(raw);
+ const profile =
+ typeof r.profile === "string" && (r.profile === "project" || CUSTOM_ID.test(r.profile)) ? r.profile : "default";
+ return {
+ profile,
+ default: validateOverrides(r.default),
+ project: validateOverrides(r.project),
+ ideProfiles: validateCustom(r.ideProfiles),
+ projectProfiles: validateCustom(r.projectProfiles),
+ };
+}
+
+/** Where a profile is stored: its level, and its key among that level's copies (null for the two defaults). */
+export function profileLocation(id: ProfileId): { level: ProfileLevel; key: string | null } {
+ if (id === "project") return { level: "project", key: null };
+ const m = CUSTOM_ID.exec(id);
+ if (!m) return { level: "ide", key: null };
+ return { level: m[1] as ProfileLevel, key: m[2]! };
+}
+
+export const customProfileId = (level: ProfileLevel, key: string): ProfileId => `${level}:${key}`;
+
+function customOf(s: InspectionSettingsValid, id: ProfileId): CustomProfile | undefined {
+ const { level, key } = profileLocation(id);
+ if (key === null) return undefined;
+ return (level === "ide" ? s.ideProfiles : s.projectProfiles)[key];
+}
+
+/** Whether profile `id` exists (project-level ones only with a project open). */
+export function profileExists(s: InspectionSettingsValid, id: ProfileId, hasProject: boolean): boolean {
+ if (id === "default") return true;
+ if (profileLocation(id).level === "project" && !hasProject) return false;
+ return id === "project" || !!customOf(s, id);
+}
+
+/** The profile chosen, if it exists here; else `Default`. */
+export function effectiveProfileId(s: InspectionSettingsValid, hasProject: boolean): ProfileId {
+ return profileExists(s, s.profile, hasProject) ? s.profile : "default";
+}
+
+export function profileLabel(s: InspectionSettingsValid, id: ProfileId): string {
+ if (id === "default" || id === "project") return PROFILE_LABELS[id];
+ return customOf(s, id)?.name ?? id;
+}
+
+/** Overrides of profile `id` (empty when it does not exist). */
+export function overridesOf(s: InspectionSettingsValid, id: ProfileId): ProfileOverrides {
+ if (id === "default") return s.default;
+ if (id === "project") return s.project;
+ return customOf(s, id)?.overrides ?? {};
+}
+
+export interface ProfileEntry {
+ id: ProfileId;
+ label: string;
+ level: ProfileLevel;
+}
+
+/** Profiles to choose from: project level first (with a project), then IDE level; copies by name. */
+export function listProfiles(s: InspectionSettingsValid, hasProject: boolean): ProfileEntry[] {
+ const copies = (level: ProfileLevel, map: CustomProfiles): ProfileEntry[] =>
+ Object.entries(map)
+ .map(([key, p]) => ({ id: customProfileId(level, key), label: p.name, level }))
+ .sort((a, b) => a.label.localeCompare(b.label));
+ const project: ProfileEntry[] = hasProject
+ ? [{ id: "project", label: PROFILE_LABELS.project, level: "project" }, ...copies("project", s.projectProfiles)]
+ : [];
+ return [...project, { id: "default", label: PROFILE_LABELS.default, level: "ide" }, ...copies("ide", s.ideProfiles)];
+}
+
+/** Error text for a proposed profile name, or null when valid (names are unique per level). */
+export function validateProfileName(
+ name: string,
+ level: ProfileLevel,
+ s: InspectionSettingsValid,
+ ownId?: ProfileId,
+): string | null {
+ const n = name.trim();
+ if (!n) return "Profile name cannot be empty";
+ const taken = listProfiles(s, true).some((p) => p.level === level && p.id !== ownId && p.label === n);
+ return taken ? `A profile named '${n}' already exists` : null;
+}
+
+/** `<name> copy`, numbered when taken at `level`. */
+export function copyProfileName(name: string, level: ProfileLevel, s: InspectionSettingsValid): string {
+ const base = `${name} copy`;
+ if (!validateProfileName(base, level, s)) return base;
+ for (let i = 2; ; i++) if (!validateProfileName(`${base} ${i}`, level, s)) return `${base} ${i}`;
+}
+
+/** A fresh storage key for a copy named `name` among `existing`. */
+export function newProfileKey(name: string, existing: CustomProfiles): string {
+ const slug =
+ name
+ .toLowerCase()
+ .replace(/[^a-z0-9]+/g, "-")
+ .replace(/^-|-$/g, "") || "profile";
+ if (!existing[slug]) return slug;
+ for (let i = 2; ; i++) if (!existing[`${slug}-${i}`]) return `${slug}-${i}`;
+}
+
+// --- inspection identity -----------------------------------------------------
+
+export interface BuiltinInspection {
+ id: string;
+ /** Producer key the diagnostics arrive under. */
+ producer: string;
+ name: string;
+ group: string;
+ description: string;
+ /** Highlighting level when the profile sets none (else as reported). */
+ defaultLevel?: InspectionLevel;
+}
+
+/** Producer key of the Typo inspection's diagnostics. */
+export const SPELLING_PRODUCER = "spelling";
+export const SPELLING_INSPECTION = "builtin:spelling";
+
+/** Checks the IDE runs itself (not a language server). */
+export const BUILTIN_INSPECTIONS: readonly BuiltinInspection[] = [
+ {
+ id: "builtin:file-references",
+ producer: "file-references",
+ name: "Unresolved file references",
+ group: "General",
+ description:
+ "Reports paths in HTML attributes, CSS url() and @import that do not name an existing file, resolved relative to the file, the project root and its resource roots.",
+ },
+ {
+ id: "builtin:build",
+ producer: "build",
+ name: "Build problems",
+ group: "General",
+ description: "Compiler errors and warnings of the last Build Project, shown at their source positions.",
+ },
+ {
+ id: "builtin:sql",
+ producer: "sql-inspections",
+ name: "Unresolved database references",
+ group: "SQL",
+ description:
+ "Reports tables, columns and aliases in query consoles that the data source's schema does not contain.",
+ },
+ {
+ id: SPELLING_INSPECTION,
+ producer: SPELLING_PRODUCER,
+ name: "Typo",
+ group: "Proofreading",
+ description:
+ "Reports misspelt words in comments, string literals and the names declarations introduce (camelCase and snake_case parts checked separately), and in plain text and Markdown. Words can be saved to the project or application dictionary (Editor › Natural Languages › Spelling).",
+ defaultLevel: "typo",
+ },
+];
+
+const BUILTIN_BY_PRODUCER = new Map(BUILTIN_INSPECTIONS.map((b) => [b.producer, b]));
+
+/** Inspection id of everything a producer reports. */
+export function producerInspectionId(producer: string): string {
+ return BUILTIN_BY_PRODUCER.get(producer)?.id ?? `lsp:${producer}`;
+}
+
+export const codeInspectionId = (base: string, code: string) => `${base}:${code}`;
+
+/** Producer of a diagnostic: the reporting server, else the event's producer, else its `source`. */
+export function producerOf(d: Diagnostic, fallback?: string): string {
+ return d.server ?? fallback ?? d.source ?? "";
+}
+
+/** Set on diagnostics shown at the Typo level (rendered as a typo, not a weak warning). */
+export interface TypoStyled {
+ typo?: boolean;
+}
+
+export const isTypoStyled = (d: object): boolean => (d as TypoStyled).typo === true;
+
+/**
+ * `items` of `producer` under `profile`: disabled inspections dropped, severity
+ * overrides applied (a code's own override wins over its server's, which wins
+ * over a built-in check's default level). Returns `items` itself when the
+ * profile changes nothing.
+ */
+export function applyProfile<D extends Diagnostic>(
+ profile: ProfileOverrides,
+ producer: string,
+ items: readonly D[],
+): readonly D[] {
+ const base = producerInspectionId(producer);
+ const own = profile[base];
+ if (own?.enabled === false) return [];
+ const fallback = BUILTIN_BY_PRODUCER.get(producer)?.defaultLevel;
+ let changed = false;
+ const out: D[] = [];
+ for (const d of items) {
+ const code = d.code ? profile[codeInspectionId(base, d.code)] : undefined;
+ if (code?.enabled === false) {
+ changed = true;
+ continue;
+ }
+ const level = code?.severity ?? own?.severity ?? fallback;
+ const severity = level ? levelSeverity(level) : d.severity;
+ if (level === "typo") {
+ changed = true;
+ out.push({ ...d, severity, typo: true });
+ } else if (severity !== d.severity) {
+ changed = true;
+ out.push({ ...d, severity });
+ } else {
+ out.push(d);
+ }
+ }
+ return changed ? out : items;
+}
+
+/** Applies `profile` to diagnostics of mixed producers (Inspect Code results). */
+export function applyProfileMixed<D extends Diagnostic>(profile: ProfileOverrides, items: readonly D[]): D[] {
+ const byProducer = new Map<string, D[]>();
+ for (const d of items) {
+ const p = producerOf(d);
+ let list = byProducer.get(p);
+ if (!list) byProducer.set(p, (list = []));
+ list.push(d);
+ }
+ return [...byProducer].flatMap(([p, list]) => applyProfile(profile, p, list));
+}
+
+// --- profile in effect --------------------------------------------------------
+
+let cache: { raw: unknown; hasProject: boolean; id: ProfileId; value: ProfileOverrides } | null = null;
+
+function current(): { id: ProfileId; value: ProfileOverrides } {
+ const { settings, project } = useProject.getState();
+ const raw = obj(settings).inspections;
+ const hasProject = !!project;
+ if (cache && cache.raw === raw && cache.hasProject === hasProject) return cache;
+ const valid = validateInspections(raw);
+ const id = effectiveProfileId(valid, hasProject);
+ cache = { raw, hasProject, id, value: overridesOf(valid, id) };
+ return cache;
+}
+
+/** Overrides of the profile in effect. */
+export function inspectionProfile(): ProfileOverrides {
+ return current().value;
+}
+
+export function activeProfileId(): ProfileId {
+ return current().id;
+}
+
+/** Overrides of a named profile from the effective settings. */
+export function profileOverrides(id: ProfileId): ProfileOverrides {
+ return overridesOf(inspectionSettings(), id);
+}
+
+/** Validated inspection settings (effective). */
+export function inspectionSettings(): InspectionSettingsValid {
+ return validateInspections(obj(useProject.getState().settings).inspections);
+}
+
+/** Calls `listener` whenever the profile in effect changes (its content, not just identity). */
+export function subscribeInspectionProfile(listener: () => void): () => void {
+ let last = JSON.stringify(inspectionProfile());
+ return useProject.subscribe((s, prev) => {
+ if (s.settings === prev.settings && s.project === prev.project) return;
+ const next = JSON.stringify(inspectionProfile());
+ if (next === last) return;
+ last = next;
+ listener();
+ });
+}
+
+// --- diagnostic codes seen ----------------------------------------------------
+
+/** A diagnostic code met at runtime, offered as its own inspection in Settings. */
+export interface SeenCode {
+ producer: string;
+ code: string;
+ source: string;
+ sample: string;
+}
+
+const SEEN_KEY = "openidea.inspections.seenCodes";
+const SEEN_LIMIT = 500;
+let seen: Map<string, SeenCode> | null = null;
+let saveTimer: ReturnType<typeof setTimeout> | null = null;
+
+function loadSeen(): Map<string, SeenCode> {
+ if (seen) return seen;
+ seen = new Map();
+ try {
+ const raw = JSON.parse(localStorage.getItem(SEEN_KEY) ?? "[]");
+ if (Array.isArray(raw)) {
+ for (const e of raw) {
+ const o = obj(e);
+ if (typeof o.producer === "string" && typeof o.code === "string") {
+ seen.set(`${o.producer}\u0000${o.code}`, {
+ producer: o.producer,
+ code: o.code,
+ source: typeof o.source === "string" ? o.source : "",
+ sample: typeof o.sample === "string" ? o.sample : "",
+ });
+ }
+ }
+ }
+ } catch {
+ // Unavailable storage: the list lives for this session only.
+ }
+ return seen;
+}
+
+/** Records the codes of a producer's diagnostics (persisted, shared with the Settings window). */
+export function noteDiagnosticCodes(producer: string, items: readonly Diagnostic[]) {
+ if (!producer) return;
+ const map = loadSeen();
+ let added = false;
+ for (const d of items) {
+ if (!d.code) continue;
+ const key = `${producer}\u0000${d.code}`;
+ if (map.has(key)) continue;
+ map.set(key, { producer, code: d.code, source: d.source ?? "", sample: d.message.slice(0, 200) });
+ added = true;
+ }
+ if (!added) return;
+ while (map.size > SEEN_LIMIT) map.delete(map.keys().next().value!);
+ saveTimer ??= setTimeout(() => {
+ saveTimer = null;
+ try {
+ localStorage.setItem(SEEN_KEY, JSON.stringify([...map.values()]));
+ } catch {
+ // Ignored: see loadSeen.
+ }
+ }, 1000);
+}
+
+/** Codes seen in any window (re-read from storage, merged with this window's unsaved ones). */
+export function seenDiagnosticCodes(): SeenCode[] {
+ const mine = seen;
+ seen = null;
+ const map = loadSeen();
+ for (const [k, v] of mine ?? []) if (!map.has(k)) map.set(k, v);
+ return [...map.values()];
+}
diff --git a/src/platform/keymaps/ideaParity.test.ts b/src/platform/keymaps/ideaParity.test.ts
index 5faf6f262..26a5161d4 100644
--- a/src/platform/keymaps/ideaParity.test.ts
+++ b/src/platform/keymaps/ideaParity.test.ts
@@ -47,6 +47,8 @@ describe("IDEA keymap parity", () => {
// Rerun in the Find / Find Usages tool windows uses the Rerun shortcut.
["find.rerun", ["Meta+R"], ["Ctrl+F5"]],
["usages.rerun", ["Meta+R"], ["Ctrl+F5"]],
+ // Vcs.Log.GoToRef: Find in the Git Log table.
+ ["vcs.log.goToRef", ["Meta+F"], ["Ctrl+F"]],
])("%s", (id, mac, win) => {
expect(intellijMacos[id]).toEqual(mac);
expect(intellijWindows[id]).toEqual(win);
@@ -68,5 +70,6 @@ describe("IDEA keymap parity", () => {
order(km, "navigate.nextError", "vcs.changelist.edit");
order(km, "debug.setValue", "vcs.changelist.edit");
order(km, "find.replaceInFile", "find.rerun");
+ order(km, "find.inFile", "vcs.log.goToRef");
});
});
diff --git a/src/platform/keymaps/intellij-macos.ts b/src/platform/keymaps/intellij-macos.ts
index dd377dbc4..903016574 100644
--- a/src/platform/keymaps/intellij-macos.ts
+++ b/src/platform/keymaps/intellij-macos.ts
@@ -72,6 +72,12 @@ export const intellijMacos: Record<string, string[]> = {
// Code
"code.completion": ["Ctrl+Space"],
+ "editor.inlineCompletion.trigger": ["Alt+\\"],
+ "editor.inlineCompletion.accept": ["Tab"],
+ "editor.inlineCompletion.acceptWord": ["Meta+Right"],
+ "editor.inlineCompletion.dismiss": ["Escape"],
+ "editor.inlineCompletion.next": ["Alt+]"],
+ "editor.inlineCompletion.previous": ["Alt+["],
"code.parameterInfo": ["Meta+P"],
"code.quickDocumentation": ["F1", "Ctrl+J"],
"code.quickDefinition": ["Alt+Space", "Meta+Y"],
@@ -157,6 +163,7 @@ export const intellijMacos: Record<string, string[]> = {
// Project view (when: projectViewFocus)
"project.newFile": ["Meta+N"],
+ "project.newInThisDirectory": ["Ctrl+Alt+N"],
"project.rename": ["Shift+F6"],
"project.move": ["F6"],
"project.delete": ["Delete", "Backspace", "Meta+Backspace"],
@@ -211,6 +218,7 @@ export const intellijMacos: Record<string, string[]> = {
"run.stop": ["Meta+F2"],
// Rerun in the Run / Debug tool window only (when / keyWhen); Meta+R stays with the editor elsewhere.
"run.rerun": ["Meta+R"],
+ "coverage.manageReports": ["Meta+Alt+F6"],
"debug.rerun": ["Meta+R"],
// Rerun in the Find / Find Usages tool windows only (when).
"find.rerun": ["Meta+R"],
@@ -250,10 +258,15 @@ export const intellijMacos: Record<string, string[]> = {
"vcs.branches": [],
"vcs.annotate": [],
"vcs.localHistory": [],
+ "localHistory.recentChanges": ["Alt+Shift+C"],
+ // Run Anything (⌃⌃) and View › Quick Switch Scheme… (⌃`)
+ "runAnything.show": ["Ctrl Ctrl"],
+ "view.quickSwitchScheme": ["Ctrl+`"],
// Commit tool window (change lists) and Git log; keyWhen limits them to those tool windows.
"vcs.changelist.move": ["Meta+Shift+M"],
"vcs.changelist.edit": ["F2", "Shift+F6"],
"vcs.log.copyRevision": ["Meta+Alt+Shift+C"],
+ "vcs.log.goToRef": ["Meta+F"],
// View › Appearance › Zoom IDE
"view.zoomIn": ["Ctrl+Alt+="],
"view.zoomOut": ["Ctrl+Alt+-"],
@@ -289,6 +302,7 @@ export const intellijMacos: Record<string, string[]> = {
"db.openConsole": ["Meta+Shift+L"],
"db.newDataSource": [],
"db.new": ["Meta+N"],
+ "services.addService": ["Meta+N"],
"db.properties": ["Shift+Enter"],
"db.refresh": ["Meta+R"],
"db.disconnect": ["Meta+F2"],
@@ -312,7 +326,8 @@ export const intellijMacos: Record<string, string[]> = {
"db.collapseAll": [],
// Terminal (keyWhen: terminalFocus); after VCS Update / Go to Test so it wins there.
"terminal.new": ["Meta+T"],
- // Last: later bindings win, so ⌘N is Generate in the editor and New in tool windows.
+ // Last: later bindings win, so ⌘N is Generate in editors with Generate actions (keyWhen)
+ // and New elsewhere (the project view, other editors: the New popup for the file).
"code.generate": ["Meta+N"],
// Find in Files popup (findPopupOpen): after the editor's Find Next, Jump to Source and
// selection keys, so these win while the popup is open.
@@ -320,4 +335,7 @@ export const intellijMacos: Record<string, string[]> = {
"find.popup.previousResult": ["Meta+Shift+G"],
"find.popup.openResult": ["F4", "Meta+Down"],
"find.popup.recentSearches": ["Alt+Down"],
+ // Search fields (find bar, Find in Files): last, so they win over editor keys while one is focused.
+ "find.field.newLine": ["Meta+Shift+Enter"],
+ "find.field.recentSearches": ["Alt+Down"],
};
diff --git a/src/platform/keymaps/intellij-windows.ts b/src/platform/keymaps/intellij-windows.ts
index 3a923c877..278649171 100644
--- a/src/platform/keymaps/intellij-windows.ts
+++ b/src/platform/keymaps/intellij-windows.ts
@@ -73,6 +73,12 @@ export const intellijWindows: Record<string, string[]> = {
// Code
"code.completion": ["Ctrl+Space"],
+ "editor.inlineCompletion.trigger": ["Alt+\\"],
+ "editor.inlineCompletion.accept": ["Tab"],
+ "editor.inlineCompletion.acceptWord": ["Ctrl+Right"],
+ "editor.inlineCompletion.dismiss": ["Escape"],
+ "editor.inlineCompletion.next": ["Alt+]"],
+ "editor.inlineCompletion.previous": ["Alt+["],
"code.parameterInfo": ["Ctrl+P"],
"code.quickDocumentation": ["Ctrl+Q"],
"code.quickDefinition": ["Ctrl+Shift+I"],
@@ -158,6 +164,7 @@ export const intellijWindows: Record<string, string[]> = {
// Project view (when: projectViewFocus)
"project.newFile": ["Alt+Insert"],
+ "project.newInThisDirectory": ["Ctrl+Alt+Insert"],
"project.rename": ["Shift+F6"],
"project.move": ["F6"],
"project.delete": ["Delete"],
@@ -209,6 +216,7 @@ export const intellijWindows: Record<string, string[]> = {
"run.stop": ["Ctrl+F2"],
// Rerun in the Run / Debug tool window only (when / keyWhen); Ctrl+F5 stays with the editor elsewhere.
"run.rerun": ["Ctrl+F5"],
+ "coverage.manageReports": ["Ctrl+Alt+F6"],
"debug.rerun": ["Ctrl+F5"],
// Rerun in the Find / Find Usages tool windows only (when).
"find.rerun": ["Ctrl+F5"],
@@ -248,9 +256,14 @@ export const intellijWindows: Record<string, string[]> = {
"vcs.branches": ["Ctrl+Shift+`"],
"vcs.annotate": [],
"vcs.localHistory": [],
+ "localHistory.recentChanges": ["Alt+Shift+C"],
+ // Run Anything (⌃⌃) and View › Quick Switch Scheme… (⌃`)
+ "runAnything.show": ["Ctrl Ctrl"],
+ "view.quickSwitchScheme": ["Ctrl+`"],
"vcs.changelist.move": ["Alt+Shift+M"],
"vcs.changelist.edit": ["F2", "Shift+F6"],
"vcs.log.copyRevision": ["Ctrl+Alt+Shift+C"],
+ "vcs.log.goToRef": ["Ctrl+F"],
// View › Appearance › Zoom IDE
"view.zoomIn": ["Alt+Shift+="],
"view.zoomOut": ["Alt+Shift+-"],
@@ -286,6 +299,7 @@ export const intellijWindows: Record<string, string[]> = {
"db.openConsole": ["Ctrl+Shift+Q"],
"db.newDataSource": [],
"db.new": ["Alt+Insert"],
+ "services.addService": ["Alt+Insert"],
"db.properties": ["Shift+Enter"],
"db.refresh": ["Ctrl+F5"],
"db.disconnect": ["Ctrl+F2"],
@@ -309,7 +323,8 @@ export const intellijWindows: Record<string, string[]> = {
"db.collapseAll": [],
// Terminal (keyWhen: terminalFocus); after VCS Update / Go to Test so it wins there.
"terminal.new": ["Ctrl+Shift+T"],
- // Last: later bindings win, so Alt+Insert is Generate in the editor and New in tool windows.
+ // Last: later bindings win, so Alt+Insert is Generate in editors with Generate actions (keyWhen)
+ // and New elsewhere (the project view, other editors: the New popup for the file).
"code.generate": ["Alt+Insert"],
// Find in Files popup (findPopupOpen): after the editor's Find Next, Jump to Source and
// selection keys, so these win while the popup is open.
@@ -317,4 +332,7 @@ export const intellijWindows: Record<string, string[]> = {
"find.popup.previousResult": ["Shift+F3", "Ctrl+Shift+L"],
"find.popup.openResult": ["F4"],
"find.popup.recentSearches": ["Alt+Down"],
+ // Search fields (find bar, Find in Files): last, so they win over editor keys while one is focused.
+ "find.field.newLine": ["Ctrl+Shift+Enter"],
+ "find.field.recentSearches": ["Alt+Down"],
};
diff --git a/src/platform/keymaps/newElement.test.ts b/src/platform/keymaps/newElement.test.ts
new file mode 100644
index 000000000..cdc37a50f
--- /dev/null
+++ b/src/platform/keymaps/newElement.test.ts
@@ -0,0 +1,28 @@
+import { describe, expect, it } from "vitest";
+import { compileWhen } from "@/platform/context";
+import { GENERATE_KEY_WHEN } from "@/editor/lsp/actions";
+import { intellijMacos } from "./intellij-macos";
+import { intellijWindows } from "./intellij-windows";
+import { vscodeMacos } from "./vscode-macos";
+
+/** IDEA's NewElement (⌘N / Alt+Insert, shared with Generate) and NewElementSamePlace (⌃⌥N / Ctrl+Alt+Insert). */
+describe("New keymap", () => {
+ it("binds New in This Directory like IDEA", () => {
+ expect(intellijMacos["project.newInThisDirectory"]).toEqual(["Ctrl+Alt+N"]);
+ expect(intellijWindows["project.newInThisDirectory"]).toEqual(["Ctrl+Alt+Insert"]);
+ expect(vscodeMacos["project.newInThisDirectory"]).toEqual([]);
+ });
+
+ it.each([intellijMacos, intellijWindows])("lets Generate win the New key only where it applies", (km) => {
+ const ids = Object.keys(km);
+ const key = km["project.newFile"]![0]!;
+ expect(km["code.generate"]).toContain(key);
+ expect(ids.indexOf("project.newFile")).toBeLessThan(ids.indexOf("code.generate"));
+ const generate = compileWhen(GENERATE_KEY_WHEN);
+ expect(generate({ editorLangId: "java" })).toBe(true);
+ expect(generate({ editorLangId: "rust" })).toBe(true);
+ expect(generate({ editorLangId: "python" })).toBe(false);
+ expect(generate({ editorLangId: "markdown" })).toBe(false);
+ expect(generate({})).toBe(false);
+ });
+});
diff --git a/src/platform/keymaps/vscode-macos.ts b/src/platform/keymaps/vscode-macos.ts
index 86e61b642..a204ce635 100644
--- a/src/platform/keymaps/vscode-macos.ts
+++ b/src/platform/keymaps/vscode-macos.ts
@@ -73,6 +73,12 @@ export const vscodeMacos: Record<string, string[]> = {
// Code
"code.completion": ["Ctrl+Space"],
+ "editor.inlineCompletion.trigger": ["Alt+\\"],
+ "editor.inlineCompletion.accept": ["Tab"],
+ "editor.inlineCompletion.acceptWord": ["Meta+Right"],
+ "editor.inlineCompletion.dismiss": ["Escape"],
+ "editor.inlineCompletion.next": ["Alt+]"],
+ "editor.inlineCompletion.previous": ["Alt+["],
"code.parameterInfo": ["Meta+Shift+Space"],
"code.quickDocumentation": ["Meta+K Meta+I"],
"code.quickDefinition": ["Alt+F12"],
@@ -159,6 +165,7 @@ export const vscodeMacos: Record<string, string[]> = {
// Explorer (when: projectViewFocus)
"project.newFile": [],
+ "project.newInThisDirectory": [],
"project.rename": ["Enter"],
"project.move": [],
"project.delete": ["Meta+Backspace"],
@@ -209,6 +216,7 @@ export const vscodeMacos: Record<string, string[]> = {
"run.chooseConfig": [],
"run.editConfigs": [],
"run.rerun": [],
+ "coverage.manageReports": [],
"web.openInBrowser": [],
"debug.toggleBreakpoint": ["F9"],
"debug.viewBreakpoints": [],
@@ -246,10 +254,14 @@ export const vscodeMacos: Record<string, string[]> = {
"vcs.branches": [],
"vcs.annotate": [],
"vcs.localHistory": [],
+ "localHistory.recentChanges": [],
+ "runAnything.show": [],
+ "view.quickSwitchScheme": [],
// Commit tool window (change lists) and Git log; keyWhen limits them to those tool windows.
"vcs.changelist.move": [],
"vcs.changelist.edit": [],
"vcs.log.copyRevision": [],
+ "vcs.log.goToRef": [],
// View › Appearance (VS Code: workbench.action.zoomIn / zoomOut / zoomReset)
"view.zoomIn": ["Meta+="],
"view.zoomOut": ["Meta+-"],
@@ -283,6 +295,7 @@ export const vscodeMacos: Record<string, string[]> = {
"db.openConsole": [],
"db.newDataSource": [],
"db.new": [],
+ "services.addService": [],
"db.properties": [],
"db.refresh": [],
"db.disconnect": [],
@@ -309,4 +322,7 @@ export const vscodeMacos: Record<string, string[]> = {
"find.popup.previousResult": ["Meta+Shift+G"],
"find.popup.openResult": [],
"find.popup.recentSearches": ["Alt+Down"],
+ // Search fields (find bar, Find in Files): last, so they win over editor keys while one is focused.
+ "find.field.newLine": ["Meta+Shift+Enter"],
+ "find.field.recentSearches": ["Alt+Down"],
};
diff --git a/src/platform/languageSettings.ts b/src/platform/languageSettings.ts
index 1215e2cf9..8140d26f3 100644
--- a/src/platform/languageSettings.ts
+++ b/src/platform/languageSettings.ts
@@ -27,8 +27,15 @@ export interface ProjectStructureValid {
excluded: string[];
/** Auto-detected roots the user unmarked. */
unmarked: string[];
+ /** Content roots besides the project folder (absolute paths). */
+ contentRoots: string[];
+ /** "Exclude files": `;`-separated name patterns. */
+ excludeFiles: string;
}
+/** The folder lists of `ProjectStructureValid` (marks). */
+export type FolderListKey = "sourceRoots" | "testRoots" | "resourceRoots" | "testResourceRoots" | "excluded" | "unmarked";
+
export const DEFAULT_LANGUAGES: LanguagesValid = {
python: { interpreter: "", activateVirtualenv: true },
node: { interpreter: "", packageManager: "" },
@@ -45,6 +52,8 @@ export const DEFAULT_PROJECT_STRUCTURE: ProjectStructureValid = {
testResourceRoots: [],
excluded: [],
unmarked: [],
+ contentRoots: [],
+ excludeFiles: "",
};
type Obj = Record<string, unknown>;
@@ -122,15 +131,27 @@ export function validateProjectStructure(raw: unknown): ProjectStructureValid {
testResourceRoots: folders(p.testResourceRoots),
excluded: folders(p.excluded),
unmarked: folders(p.unmarked),
+ contentRoots: Array.isArray(p.contentRoots)
+ ? [...new Set(p.contentRoots.filter((x): x is string => typeof x === "string" && !!x.trim()))]
+ : [],
+ excludeFiles: typeof p.excludeFiles === "string" ? p.excludeFiles : "",
};
}
+/** The "Exclude files" name patterns (`*.log;tmp*`). */
+export function excludeFilePatterns(excludeFiles: string): string[] {
+ return excludeFiles
+ .split(";")
+ .map((p) => p.trim())
+ .filter(Boolean);
+}
+
/** Root kinds, as in IDEA's Project Structure (`ide-workspace::roots::RootKind`). */
export type FolderRole = "source" | "test" | "resources" | "testResources" | "excluded";
export const FOLDER_ROLES: readonly FolderRole[] = ["source", "test", "resources", "testResources", "excluded"];
-const ROLE_KEYS: Record<FolderRole, Exclude<keyof ProjectStructureValid, "unmarked">> = {
+const ROLE_KEYS: Record<FolderRole, Exclude<FolderListKey, "unmarked">> = {
source: "sourceRoots",
test: "testRoots",
resources: "resourceRoots",
@@ -216,6 +237,7 @@ export function markFolder(
): ProjectStructureValid {
const r = storedFolder(rel);
const next: ProjectStructureValid = {
+ ...ps,
sourceRoots: ps.sourceRoots.filter((x) => x !== r),
testRoots: ps.testRoots.filter((x) => x !== r),
resourceRoots: ps.resourceRoots.filter((x) => x !== r),
@@ -253,7 +275,7 @@ export const PROJECT_STRUCTURE_KEYS = [
"testResourceRoots",
"excluded",
"unmarked",
-] as const satisfies ReadonlyArray<keyof ProjectStructureValid>;
+] as const satisfies ReadonlyArray<FolderListKey>;
/** Effective Project Structure of the open project (reactive). */
export function useProjectStructure(): ProjectStructureValid {
diff --git a/src/platform/locales/en.json b/src/platform/locales/en.json
index 9112762f7..912da289a 100644
--- a/src/platform/locales/en.json
+++ b/src/platform/locales/en.json
@@ -268,6 +268,14 @@
"menu.vcs.stash": "Stash Changes…",
"menu.vcs.unstash": "Unstash Changes…",
"menu.vcs.update": "Update Project…",
+ "menu.vcs.pull": "Pull…",
+ "menu.vcs.merge": "Merge…",
+ "menu.vcs.rebase": "Rebase…",
+ "menu.vcs.newWorktree": "New Worktree…",
+ "menu.vcs.worktrees": "Worktrees…",
+ "menu.vcs.manageRemotes": "Manage Remotes…",
+ "menu.vcs.clone": "Clone…",
+ "menu.vcs.operations": "VCS Operations Popup…",
"menu.view": "View",
"menu.view.notifications": "Notifications",
"menu.view.toggleTheme": "Toggle Light/Dark Theme",
@@ -318,5 +326,59 @@
"menu.github.createPullRequest": "Create Pull Request…",
"menu.github.checkoutPullRequest": "Checkout Pull Request…",
"menu.github.openInBrowser": "Open on GitHub",
+ "menu.file.newProject": "New Project…",
+ "menu.file.renameProject": "Rename Project…",
+ "menu.file.reloadAllFromDisk": "Reload All from Disk",
+ "menu.file.invalidateCaches": "Invalidate Caches…",
+ "menu.manageIdeSettings": "Manage IDE Settings",
+ "menu.file.exportSettings": "Export Settings…",
+ "menu.file.importSettings": "Import Settings…",
+ "menu.file.togglePowerSave": "Power Save Mode",
+ "menu.macros": "Macros",
+ "menu.macro.startRecording": "Start Macro Recording",
+ "menu.macro.stopRecording": "Stop Macro Recording",
+ "menu.macro.playBack": "Play Back Last Macro",
+ "menu.macro.playSaved": "Play Saved Macros…",
+ "menu.macro.edit": "Edit Macros…",
+ "menu.bookmarks": "Bookmarks",
+ "menu.navigate.toggleBookmarkWithMnemonic": "Toggle Bookmark with Mnemonic",
+ "menu.navigate.nextBookmark": "Next Bookmark",
+ "menu.navigate.prevBookmark": "Previous Bookmark",
+ "menu.view.toggleCompactMode": "Compact Mode",
+ "menu.view.zoomIn": "Zoom In IDE",
+ "menu.view.zoomOut": "Zoom Out IDE",
+ "menu.view.resetZoom": "Reset IDE Zoom",
+ "menu.toolbar.customize": "Customize Main Toolbar…",
+ "menu.code.quickDefinition": "Quick Definition",
+ "menu.code.quickTypeDefinition": "Quick Type Definition",
+ "menu.localHistory.recentChanges": "Recent Changes",
+ "menu.diff.compareWithClipboard": "Compare with Clipboard",
+ "menu.view.quickSwitchScheme": "Quick Switch Scheme…",
+ "menu.editor.resetFontSize": "Reset Font Size in All Editors",
+ "menu.code.cleanup": "Code Cleanup…",
+ "menu.runAnything.show": "Run Anything…",
+ "menu.localHistory.putLabel": "Put Label…",
+ "menu.toolWindowLayouts": "Tool Window Layouts",
+ "menu.layout.save": "Save Current Layout as…",
+ "menu.layout.restoreDefault": "Restore Default Layout",
+ "menu.layout.rename": "Rename Layout…",
+ "menu.layout.delete": "Delete Layout…",
+ "menu.activeToolWindow": "Active Tool Window",
+ "menu.toolwindow.hideActive": "Hide Active Tool Window",
+ "menu.toolwindow.maximize": "Maximize Tool Window",
+ "menu.toolwindow.closeContent": "Close Active Tab",
+ "menu.toolwindow.jumpToLast": "Jump to Last Tool Window",
+ "menu.toolwindow.focusEditor": "Focus Editor",
+ "menu.editorTabs": "Editor Tabs",
+ "menu.editor.nextTab": "Select Next Tab",
+ "menu.editor.prevTab": "Select Previous Tab",
+ "menu.editor.pinTab": "Pin Tab",
+ "menu.editor.closeTab": "Close Tab",
+ "menu.editor.closeOtherTabs": "Close Other Tabs",
+ "menu.editor.closeAllTabs": "Close All Tabs",
+ "menu.editor.reopenClosedTab": "Reopen Closed Tab",
+ "menu.editor.moveToOppositeGroup": "Move to Opposite Group",
+ "run.services.configurationCount": "{count} configurations",
+ "search.bookmarks.count": "{count, plural, one {# bookmark} other {# bookmarks}}",
"settings.zoom.hint": "Change with {zoomIn} or {zoomOut}. Set to 100% with {reset}"
}
diff --git a/src/platform/locales/text/zh.json b/src/platform/locales/text/zh.json
index d38d056aa..834a9b57f 100644
--- a/src/platform/locales/text/zh.json
+++ b/src/platform/locales/text/zh.json
@@ -1870,6 +1870,8 @@
"Show All": "全部显示",
"Show All Frames": "显示所有帧",
"Show Bookmarks": "显示书签",
+ "Show Inherited": "显示继承的成员",
+ "Show inherited members": "显示继承的成员",
"Show Build": "显示构建",
"Show Commit in Git Log": "在 Git 日志中显示提交",
"Show Container Log": "显示容器日志",
@@ -2221,6 +2223,7 @@
"usages": "处用法",
"more": "更多",
"Usages": "用法",
+ "Code author": "代码作者",
"Usages Detected": "检测到用法",
"Usages actions": "用法操作",
"Usages of '{symbol}'": "'{symbol}' 的用法",
@@ -2518,5 +2521,742 @@
"Select In…": "选择位置…",
"Next Result": "下一个结果",
"Previous Result": "上一个结果",
- "Open Result": "打开结果"
+ "Open Result": "打开结果",
+ "Graph Options": "图形选项",
+ "Go to Hash/Branch/Tag": "转到哈希/分支/标签",
+ "Enter hash or branch/tag name": "输入哈希或分支/标签名称",
+ "Sort": "排序",
+ "By Commit Date": "按提交日期",
+ "Topologically": "拓扑",
+ "First Parent": "第一个父级",
+ "No Merges": "无合并",
+ "Branch Actions": "分支操作",
+ "Collapse Linear Branches": "折叠线性分支",
+ "Expand Linear Branches": "展开线性分支",
+ "Compact References View": "紧凑引用视图",
+ "Tag Names": "标签名称",
+ "Long Edges": "长边",
+ "Commit Timestamp": "提交时间戳",
+ "References on the Left": "左侧引用",
+ "Hash": "哈希",
+ "Highlight": "高亮显示",
+ "My Commits": "我的提交",
+ "Merge Commits": "合并提交",
+ "Rebase…": "变基…",
+ "Manage Remotes…": "管理远程…",
+ "Clone…": "克隆…",
+ "New Worktree…": "新建工作树…",
+ "Worktrees…": "工作树…",
+ "Worktrees": "工作树",
+ "New Worktree": "新建工作树",
+ "Git Remotes": "Git 远程",
+ "Define Remote": "定义远程",
+ "Edit Remote": "编辑远程",
+ "Add Remote…": "添加远程…",
+ "Remove Remote": "移除远程",
+ "Edit Remote…": "编辑远程…",
+ "Remove Worktree": "移除工作树",
+ "Branch to merge:": "要合并的分支:",
+ "Check out:": "检出:",
+ "Create a new branch": "创建新分支",
+ "Folder:": "文件夹:",
+ "Options:": "选项:",
+ "No remotes": "无远程",
+ "Include disabled actions": "包括禁用的操作",
+ "Symbol Kinds": "符号类型",
+ "⌥↵ to assign a shortcut": "⌥↵ 分配快捷键",
+ "Open Settings Page": "打开设置页面",
+ "Assign Shortcut…": "分配快捷键…",
+ "New List…": "新建列表…",
+ "Rename List…": "重命名列表…",
+ "Make Default": "设为默认",
+ "Delete List": "删除列表",
+ "Move to Another List": "移动到其他列表",
+ "New Bookmark List…": "新建书签列表…",
+ "Toggle File Bookmark": "切换文件书签",
+ "New Bookmark List": "新建书签列表",
+ "Rename Bookmark List": "重命名书签列表",
+ "Delete Bookmark List": "删除书签列表",
+ "Add Bookmark": "添加书签",
+ "Remove Bookmark": "移除书签",
+ "Interfaces": "接口",
+ "Structs": "结构体",
+ "Enums": "枚举",
+ "Traits": "特征",
+ "Type Aliases": "类型别名",
+ "Functions": "函数",
+ "Methods": "方法",
+ "Constructors": "构造函数",
+ "Fields": "字段",
+ "Constants": "常量",
+ "Enum Members": "枚举成员",
+ "Modules": "模块",
+ "Namespaces": "命名空间",
+ "List name": "列表名称",
+ "Add Service": "添加服务",
+ "Add service": "添加服务",
+ "No services configured.": "未配置服务。",
+ "Select service to view details": "选择服务以查看详细信息",
+ "Run Configuration Type": "运行配置类型",
+ "Docker Registry…": "Docker 注册表…",
+ "Docker Connection…": "Docker 连接…",
+ "Show Output": "显示输出",
+ "Address:": "地址:",
+ "Username:": "用户名:",
+ "Scope Based": "基于范围",
+ "Scope:": "范围:",
+ "Edit Scopes…": "编辑范围…",
+ "Import a report collected in CI from disk": "从磁盘导入在 CI 中收集的报告",
+ "Manage Coverage Reports…": "管理覆盖率报告…",
+ "Coverage Reports": "覆盖率报告",
+ "Show Selected": "显示所选项",
+ "Import…": "导入…",
+ "Reload All from Disk": "从磁盘全部重新加载",
+ "Reset Font Size in All Editors": "重置所有编辑器中的字体大小",
+ "Library source (read-only).": "库源代码(只读)。",
+ "Search In Selection": "在所选内容中搜索",
+ "Search Scope": "搜索范围",
+ "Filter Search Results": "过滤搜索结果",
+ "Filter search results": "过滤搜索结果",
+ "Replace (⌥P)": "替换 (⌥P)",
+ "Replace All (⌥A)": "全部替换 (⌥A)",
+ "Include (⌥L)": "包括 (⌥L)",
+ "Exclude (⌥L)": "排除 (⌥L)",
+ "Recent searches": "最近的搜索",
+ "New Line": "新行",
+ "New Line in Search Field": "在搜索字段中插入新行",
+ "Quick Type Definition": "快速类型定义",
+ "Code Cleanup in File": "文件中的代码清理",
+ "Nothing to generate here": "此处没有可生成的内容",
+ "Sort by name": "按名称排序",
+ "Sort suggestions by relevance": "按相关性对建议排序",
+ "Sort suggestions alphabetically": "按字母顺序对建议排序",
+ "Press ↵ to insert, ⇥ to replace": "按 ↵ 插入,按 ⇥ 替换",
+ "Formatting is turned off for this file (Code Style › Formatter › Do not format)": "此文件已关闭格式化(代码样式 › 格式化程序 › 不格式化)",
+ "No type definition found": "未找到类型定义",
+ "No definition found": "未找到定义",
+ "Typo: Change to…": "拼写错误:更改为…",
+ "Spelling": "拼写",
+ "No refactoring applies here": "此处没有适用的重构",
+ "Inline Completion": "内联补全",
+ "Call Inline Completion": "调用内联补全",
+ "Inline completion is off for this language": "此语言已关闭内联补全",
+ "No inline suggestions": "没有内联建议",
+ "No language server provides inline completion": "没有语言服务器提供内联补全",
+ "Insert Inline Proposal": "插入内联建议",
+ "Insert Inline Proposal: Next Word": "插入内联建议:下一个单词",
+ "Hide Inline Proposal": "隐藏内联建议",
+ "Show Next Inline Proposal": "显示下一个内联建议",
+ "Show Previous Inline Proposal": "显示上一个内联建议",
+ "Inspection profile:": "检查配置文件:",
+ "Inspection profile": "检查配置文件",
+ "Configure inspections": "配置检查",
+ "Run Code Cleanup": "运行代码清理",
+ "Apply the language servers' automatic fixes": "应用语言服务器的自动修复",
+ "No files with a language server in this scope": "此范围内没有带语言服务器的文件",
+ "Code Cleanup": "代码清理",
+ "Code Cleanup…": "代码清理…",
+ "Clean Up": "清理",
+ "No custom scopes": "没有自定义范围",
+ "Custom scope": "自定义范围",
+ "Custom Scopes": "自定义范围",
+ "Choose a scope": "选择范围",
+ "Enter a project name": "请输入项目名称",
+ "The name contains characters a folder name cannot have": "名称包含文件夹名称中不能使用的字符",
+ "Project Location": "项目位置",
+ "New Project": "新建项目",
+ "New Project…": "新建项目…",
+ "Create Git repository": "创建 Git 仓库",
+ "Export Settings": "导出设置",
+ "Export Settings…": "导出设置…",
+ "OpenIDEA settings": "OpenIDEA 设置",
+ "Settings exported": "设置已导出",
+ "Cannot export settings": "无法导出设置",
+ "Import Settings": "导入设置",
+ "Import Settings…": "导入设置…",
+ "Settings imported": "设置已导入",
+ "Restart to apply imported templates, macros and layouts.": "重启以应用导入的模板、宏和布局。",
+ "Cannot import settings": "无法导入设置",
+ "Rename Project": "重命名项目",
+ "Rename Project…": "重命名项目…",
+ "New project name:": "新项目名称:",
+ "Cannot rename project": "无法重命名项目",
+ "Power Save Mode": "省电模式",
+ "Cannot change Power Save Mode": "无法更改省电模式",
+ "Power save mode is on: completion and documentation popups and usage highlighting are off.": "省电模式已开启:补全和文档弹出窗口以及用法高亮显示已关闭。",
+ "This needs the desktop app": "此功能需要桌面应用",
+ "Turn Off": "关闭",
+ "Build Tools": "构建工具",
+ "Import a Coverage Report…": "导入覆盖率报告…",
+ "Choose the shown coverage suite, delete suites and imported reports": "选择显示的覆盖率套件,删除套件和导入的报告",
+ "Import Coverage Report": "导入覆盖率报告",
+ "Coverage reports (lcov, JaCoCo XML, Go cover profile)": "覆盖率报告(lcov、JaCoCo XML、Go cover profile)",
+ "All files": "所有文件",
+ "Importing coverage needs the desktop app": "导入覆盖率需要桌面应用",
+ "Coverage reports": "覆盖率报告",
+ "not loaded": "未加载",
+ "No coverage reports. Run with coverage or import a report.": "没有覆盖率报告。请使用覆盖率运行或导入报告。",
+ "No color": "无颜色",
+ "Verify CA": "验证 CA",
+ "Verify Full": "完全验证",
+ "Manual": "手动",
+ "Name or pattern, e.g. app_*": "名称或模式,例如 app_*",
+ "Schemas": "架构",
+ "Advanced": "高级",
+ "Data source type": "数据源类型",
+ "path/to/database.db (absolute or project-relative)": "path/to/database.db(绝对路径或相对于项目的路径)",
+ "Connection type:": "连接类型:",
+ "Connection type": "连接类型",
+ "URL only": "仅 URL",
+ "from the URL": "来自 URL",
+ "Connects with the URL alone: host, port, database, SSL and parameters come from it.": "仅使用 URL 连接:主机、端口、数据库、SSL 和参数均来自 URL。",
+ "Editing the URL fills in the settings above.": "编辑 URL 会填写上方的设置。",
+ "Connection": "连接",
+ "Transaction control:": "事务控制:",
+ "Transaction control": "事务控制",
+ "Default schema:": "默认架构:",
+ "public (search_path, e.g. app, public)": "public(search_path,例如 app, public)",
+ "Time zone:": "时区:",
+ "Server default, e.g. UTC or Europe/Berlin": "服务器默认值,例如 UTC 或 Europe/Berlin",
+ "UTC (+00:00), e.g. Europe/Berlin or +08:00": "UTC (+00:00),例如 Europe/Berlin 或 +08:00",
+ "Run keep-alive query each": "执行保持活动查询,间隔",
+ "Auto-disconnect after": "在以下时间后自动断开连接",
+ "Startup script:": "启动脚本:",
+ "Runs on every new connection, before any other statement.": "在每个新连接上、任何其他语句之前运行。",
+ "Passphrase:": "密码短语:",
+ "Mode:": "模式:",
+ "CA file:": "CA 文件:",
+ "System roots when empty": "为空时使用系统根证书",
+ "CA Certificate File": "CA 证书文件",
+ "Client certificate file:": "客户端证书文件:",
+ "Client Certificate File": "客户端证书文件",
+ "Client key file:": "客户端密钥文件:",
+ "Client Key File": "客户端密钥文件",
+ "schemas (databases)": "架构(数据库)",
+ "Show system schemas and template databases": "显示系统架构和模板数据库",
+ "Show system schemas": "显示系统架构",
+ "Load Names from Server": "从服务器加载名称",
+ "Driver properties": "驱动程序属性",
+ "Property name": "属性名称",
+ "Property value": "属性值",
+ "Remove property": "移除属性",
+ "Add Property": "添加属性",
+ "Color:": "颜色:",
+ "Color": "颜色",
+ "Add comment": "添加注释",
+ "Connecting…": "正在连接…",
+ "OceanBase (MySQL mode)": "OceanBase(MySQL 模式)",
+ "HTTP Request": "HTTP 请求",
+ "External Libraries": "外部库",
+ "library root": "库根",
+ "Scratch File": "临时文件",
+ "Stop Macro Recording": "停止宏录制",
+ "Start Macro Recording": "开始宏录制",
+ "Recording macro…": "正在录制宏…",
+ "Rename Macro": "重命名宏",
+ "Enter a macro name": "请输入宏名称",
+ "A macro with this name exists": "已存在同名的宏",
+ "Delete Macro": "删除宏",
+ "Edit Macros": "编辑宏",
+ "Edit Macros…": "编辑宏…",
+ "No saved macros": "没有已保存的宏",
+ "Recorded steps": "录制的步骤",
+ "Macro playback stopped": "宏回放已停止",
+ "A recorded step could not run here.": "某个录制的步骤无法在此处运行。",
+ "Nothing was recorded": "未录制任何内容",
+ "Enter Macro Name": "输入宏名称",
+ "Name (leave empty to keep it only as the last macro):": "名称(留空则仅保留为上一个宏):",
+ "Play Back Last Macro": "回放上一个宏",
+ "Play Saved Macros…": "播放已保存的宏…",
+ "Play Saved Macro": "播放已保存的宏",
+ "Search for file type": "搜索文件类型",
+ "File types": "文件类型",
+ "this view": "此视图",
+ "New in This Directory…": "在此目录中新建…",
+ "All Changed Files": "所有已更改的文件",
+ "Scratches and Consoles": "临时文件和控制台",
+ "Run Anything": "运行任何内容",
+ "Run Anything…": "运行任何内容…",
+ "Run a command, configuration or goal": "运行命令、配置或目标",
+ "Run Anything entries": "“运行任何内容”条目",
+ "Press Enter to run the command in the project directory": "按 Enter 在项目目录中运行命令",
+ "Type a command": "输入命令",
+ "Enter to run, Tab to complete. Other commands run in the project directory.": "按 Enter 运行,按 Tab 补全。其他命令将在项目目录中运行。",
+ "Recent": "最近",
+ "Search types": "搜索类型",
+ "Search configuration types": "搜索配置类型",
+ "Configuration types": "配置类型",
+ "Redirect input": "重定向输入",
+ "Paths to \".env\" files": "\".env\" 文件路径",
+ "Save console output to file": "将控制台输出保存到文件",
+ "Show console when a message is printed to stdout": "当消息输出到 stdout 时显示控制台",
+ "Show console when a message is printed to stderr": "当消息输出到 stderr 时显示控制台",
+ "Add before launch task": "添加启动前任务",
+ "Open run/debug tool window when started": "启动时打开运行/调试工具窗口",
+ "Focus run/debug tool window when started": "启动时聚焦运行/调试工具窗口",
+ "Emulate terminal in output console": "在输出控制台中模拟终端",
+ "Operating System": "操作系统",
+ "Logs": "日志",
+ "Before Launch": "启动前",
+ "Before launch": "启动前",
+ "Before launch tasks": "启动前任务",
+ "Store as project file": "存储为项目文件",
+ "Modify options": "修改选项",
+ "e.g. ./gradlew or cargo": "例如 ./gradlew 或 cargo",
+ "Edit Environment Variables": "编辑环境变量",
+ "System environment variables are not passed": "不传递系统环境变量",
+ "Redirect input from": "重定向输入自",
+ "File relative to the project root": "相对于项目根目录的文件",
+ "Shell command, e.g. make generate": "Shell 命令,例如 make generate",
+ "Remove Task": "移除任务",
+ "Add task": "添加任务",
+ "Add configuration…": "添加配置…",
+ "Add configuration": "添加配置",
+ "New Folder": "新建文件夹",
+ "Remove Folder": "移除文件夹",
+ "Create New Folder": "创建新文件夹",
+ "Unnamed": "未命名",
+ "No run configurations added.": "未添加运行配置。",
+ "Add new…": "新增…",
+ "Edit configuration templates…": "编辑配置模板…",
+ "Templates": "模板",
+ "Configuration templates": "配置模板",
+ "Back to configurations": "返回配置",
+ "Select a configuration type": "选择配置类型",
+ "Add new run configuration…": "添加新的运行配置…",
+ "or select run configuration to edit": "或选择要编辑的运行配置",
+ "Folder name": "文件夹名称",
+ "Name is required": "名称为必填项",
+ "Environment variable names can't be empty": "环境变量名称不能为空",
+ "Environment Variables": "环境变量",
+ "User environment variables:": "用户环境变量:",
+ "User environment variables": "用户环境变量",
+ "Include system environment variables": "包括系统环境变量",
+ "System environment variables": "系统环境变量",
+ "Click the Run icon in the editor gutter": "点击编辑器装订区域中的“运行”图标",
+ "Select \"Run…\" in the editor context menu": "在编辑器上下文菜单中选择“运行…”",
+ "Launch a": "启动",
+ "run configuration": "运行配置",
+ "Run Current File": "运行当前文件",
+ "Debug Current File": "调试当前文件",
+ "Run Another Configuration": "运行另一个配置",
+ "Run External Tool": "运行外部工具",
+ "Run Shell Command": "运行 Shell 命令",
+ "Run shell command": "运行 Shell 命令",
+ "Activate Tool Window": "激活工具窗口",
+ "Building is not available": "构建不可用",
+ "A build is already running": "已有构建正在运行",
+ "The before launch tasks run in a cycle": "启动前任务形成了循环",
+ "No command": "没有命令",
+ "Compound": "复合",
+ "Add at least one configuration": "请至少添加一个配置",
+ "A compound configuration can't include itself": "复合配置不能包含自身",
+ "Some configurations no longer exist": "某些配置已不存在",
+ "Command is required": "命令为必填项",
+ "A before launch task runs a missing configuration or this one": "某个启动前任务运行了不存在的配置或此配置本身",
+ "A before launch task is incomplete": "某个启动前任务不完整",
+ "Run Widget": "运行微件",
+ "Run Configurations": "运行配置",
+ "Starting": "正在启动",
+ "Stopped": "已停止",
+ "Finished": "已完成",
+ "Remove from Services": "从服务中移除",
+ "Configuration": "配置",
+ "Type": "类型",
+ "Not started": "未启动",
+ "Started": "已启动",
+ "Shell Script": "Shell 脚本",
+ "Run a script file, script text or command line": "运行脚本文件、脚本文本或命令行",
+ "Script file": "脚本文件",
+ "Script text": "脚本文本",
+ "Script path": "脚本路径",
+ "Script options": "脚本选项",
+ "Interpreter path": "解释器路径",
+ "Run the script directly": "直接运行脚本",
+ "Interpreter options": "解释器选项",
+ "Run an executable with arguments": "使用实参运行可执行文件",
+ "Executable": "可执行文件",
+ "Path or command on PATH": "路径或 PATH 中的命令",
+ "Program arguments": "程序实参",
+ "Run a package.json script": "运行 package.json 脚本",
+ "package.json directory": "package.json 目录",
+ "Tasks": "任务",
+ "Use the Gradle wrapper": "使用 Gradle 包装器",
+ "Goals": "目标",
+ "Use the Maven wrapper": "使用 Maven 包装器",
+ "Run or debug several configurations together": "同时运行或调试多个配置",
+ " · default": " · 默认",
+ "Bookmarked file": "已添加书签的文件",
+ "(empty line)": "(空行)",
+ "Name cannot be empty": "名称不能为空",
+ "Every scope needs a name": "每个范围都需要名称",
+ "Scopes": "范围",
+ "Add Scope": "添加范围",
+ "Remove Scope": "移除范围",
+ "Pattern:": "模式:",
+ "files by name, anywhere": "按名称匹配任意位置的文件",
+ "files directly in a folder": "直接位于文件夹中的文件",
+ "at any depth": "任意深度",
+ "Add a scope to define it by a file pattern.": "添加一个范围,并用文件模式定义它。",
+ "Just now": "刚刚",
+ "Show Fields": "显示字段",
+ "Show Non-Public": "显示非公共成员",
+ "Sort by Visibility": "按可见性排序",
+ "Show fields": "显示字段",
+ "Show non-public": "显示非公共成员",
+ "Docker CLI default (DOCKER_HOST / current context)": "Docker CLI 默认值(DOCKER_HOST/当前上下文)",
+ "Docker CLI default": "Docker CLI 默认值",
+ "Unix socket": "Unix 套接字",
+ "TCP / SSH host": "TCP/SSH 主机",
+ "Docker context": "Docker 上下文",
+ "Edit Docker Connection": "编辑 Docker 连接",
+ "New Docker Connection": "新建 Docker 连接",
+ "Connect to Docker daemon with:": "连接 Docker 守护进程的方式:",
+ "Socket path or Engine API URL:": "套接字路径或 Engine API URL:",
+ "Engine API URL:": "Engine API URL:",
+ "tcp://build-host:2376 or ssh://me@build-host": "tcp://build-host:2376 或 ssh://me@build-host",
+ "Certificates folder (TLS, optional):": "证书文件夹(TLS,可选):",
+ "contains ca.pem, cert.pem and key.pem": "包含 ca.pem、cert.pem 和 key.pem",
+ "Certificates Folder": "证书文件夹",
+ "Context name:": "上下文名称:",
+ "e.g. desktop-linux, orbstack, colima": "例如 desktop-linux、orbstack、colima",
+ "Docker Registry": "Docker 注册表",
+ "Edit Docker Registry": "编辑 Docker 注册表",
+ "New Docker Registry": "新建 Docker 注册表",
+ "docker.io, ghcr.io, registry.example.com:5000": "docker.io、ghcr.io、registry.example.com:5000",
+ "Unchanged": "未更改",
+ "Password or access token": "密码或访问令牌",
+ "Images from this registry are pulled with these credentials.": "将使用这些凭据从此注册表拉取镜像。",
+ "not running": "未运行",
+ "Remove Docker Connection": "移除 Docker 连接",
+ "Remove Docker Registry": "移除 Docker 注册表",
+ "Edit Registry…": "编辑注册表…",
+ "Test Login": "测试登录",
+ "Remove Registry": "移除注册表",
+ "Edit Connection…": "编辑连接…",
+ "Remove Connection": "移除连接",
+ "Waiting for output…": "正在等待输出…",
+ "No output": "无输出",
+ "Address": "地址",
+ "Username": "用户名",
+ "Edit…": "编辑…",
+ "Add a run configuration type, Docker connection or registry to the Services tool window": "向服务工具窗口添加运行配置类型、Docker 连接或注册表",
+ "Dangling Images": "悬空镜像",
+ "Compose Down": "Compose 停止 (down)",
+ "Cannot read Docker settings": "无法读取 Docker 设置",
+ "Cannot save Docker settings": "无法保存 Docker 设置",
+ "Cannot save the registry password": "无法保存注册表密码",
+ "Server": "服务器",
+ "Container name": "容器名称",
+ "Derived from the image": "从镜像派生",
+ "Bind ports": "绑定端口",
+ "Bind mounts": "绑定挂载",
+ "Container environment": "容器环境",
+ "Run options": "运行选项",
+ "e.g. --rm --network host": "例如 --rm --network host",
+ "Build an image from a Dockerfile and run a container from it": "从 Dockerfile 构建镜像并从中运行容器",
+ "Relative to the project root": "相对于项目根目录",
+ "Context folder": "上下文文件夹",
+ "The Dockerfile's folder": "Dockerfile 所在文件夹",
+ "Image tag": "镜像标签",
+ "Derived from the context folder": "从上下文文件夹派生",
+ "Build stage": "构建阶段",
+ "The last stage": "最后一个阶段",
+ "Build args": "构建实参",
+ "Build options": "构建选项",
+ "e.g. --no-cache --platform linux/amd64": "例如 --no-cache --platform linux/amd64",
+ "Run built image": "运行构建的镜像",
+ "The image's default": "镜像的默认值",
+ "Docker Image": "Docker 镜像",
+ "Run a container from an image": "从镜像运行容器",
+ "Image ID or name": "镜像 ID 或名称",
+ "e.g. postgres:16": "例如 postgres:16",
+ "Pull the image before running": "运行前拉取镜像",
+ "Compose files": "Compose 文件",
+ "All services": "所有服务",
+ "The folder name": "文件夹名称",
+ "Run in the background (-d)": "在后台运行 (-d)",
+ "Build images before starting (--build)": "启动前构建镜像 (--build)",
+ "Up options": "Up 选项",
+ "e.g. --force-recreate --remove-orphans": "例如 --force-recreate --remove-orphans",
+ "Compact Mode": "紧凑模式",
+ "Override File Type": "覆盖文件类型",
+ "Revert File Type Override": "还原文件类型覆盖",
+ "Add Content Root": "添加内容根",
+ "Exclude files:": "排除文件:",
+ "Filter file types": "过滤文件类型",
+ "Recognized file types": "已识别的文件类型",
+ "Recognized File Types": "已识别的文件类型",
+ "File name patterns": "文件名模式",
+ "* matches any characters, ? one (e.g. *.foo, Jenkinsfile).": "* 匹配任意字符,? 匹配一个字符(例如 *.foo、Jenkinsfile)。",
+ "Hashbang patterns": "Hashbang 模式",
+ "Interpreters run by a #! first line, e.g. node for #!/usr/bin/env node.": "由首行 #! 运行的解释器,例如 #!/usr/bin/env node 对应 node。",
+ "Also recognized by its first line:": "也可通过首行识别:",
+ "Default (IDE)": "默认 (IDE)",
+ "Stored in the project.": "存储在项目中。",
+ "Copy to Project": "复制到项目",
+ "Copy to IDE": "复制到 IDE",
+ "Copy to Project…": "复制到项目…",
+ "Copy to IDE…": "复制到 IDE…",
+ "Do not format": "不格式化",
+ "File name patterns and folders (glob), e.g. *.min.js, generated/**.": "文件名模式和文件夹 (glob),例如 *.min.js、generated/**。",
+ "Turn formatter on/off with markers in code comments": "使用代码注释中的标记开启/关闭格式化程序",
+ "Off": "关",
+ "On": "开",
+ "Enable regular expressions in formatter markers": "在格式化程序标记中启用正则表达式",
+ "Show inline completion for:": "为以下语言显示内联补全:",
+ "Automatically insert single suggestions": "自动插入单个建议",
+ "When Basic Completion (⌃Space) finds only one suggestion.": "当基本补全 (⌃Space) 只找到一个建议时。",
+ "Also toggled by Sort by name in the completion popup.": "也可通过补全弹出窗口中的“按名称排序”切换。",
+ "Insert parentheses automatically when applicable": "适用时自动插入圆括号",
+ "Left": "左侧",
+ "Right": "右侧",
+ "Show tabs in:": "标签页显示方式:",
+ "Show tabs in": "标签页显示方式",
+ "Show pinned tabs in a separate row": "在单独的行中显示固定的标签页",
+ "Show file icon": "显示文件图标",
+ "Show directory for non-unique file names": "为不唯一的文件名显示目录",
+ "Show full path on mouse hover": "鼠标悬停时显示完整路径",
+ "Close button position:": "关闭按钮位置:",
+ "Close button position": "关闭按钮位置",
+ "Tab Order": "标签页顺序",
+ "Sort tabs alphabetically": "按字母顺序对标签页排序",
+ "One row, and if tabs don't fit:": "单行,标签页放不下时:",
+ "If tabs don't fit": "标签页放不下时",
+ "Scroll the tabs panel": "滚动标签页面板",
+ "Squeeze tabs": "压缩标签页",
+ "Multiple rows": "多行",
+ "Gray suggestions at the caret from language servers that support inline completion. Tab accepts a suggestion, Escape dismisses it.": "在光标处以灰色显示来自支持内联补全的语言服务器的建议。按 Tab 接受建议,按 Escape 取消。",
+ "Enable inline completion": "启用内联补全",
+ "Show only when typing pauses for": "仅在输入暂停以下时长后显示",
+ "Inspections": "检查",
+ "Delete Profile": "删除配置文件",
+ "Rename Profile": "重命名配置文件",
+ "Copy Profile": "复制配置文件",
+ "Profile:": "配置文件:",
+ "Profile Actions": "配置文件操作",
+ "Stored in Project": "存储在项目中",
+ "Stored in IDE": "存储在 IDE 中",
+ "Search inspections": "搜索检查",
+ "Reset to Default": "重置为默认值",
+ "Select an inspection to see its description and change its severity.": "选择一项检查以查看其描述并更改其严重性。",
+ "Severity:": "严重性:",
+ "As reported": "按报告",
+ "Error": "错误",
+ "Weak Warning": "弱警告",
+ "Server Problem": "服务器问题",
+ "Typo": "拼写错误",
+ "No highlighting": "无高亮显示",
+ "Project Default": "项目默认",
+ "Profile name cannot be empty": "配置文件名称不能为空",
+ "Unresolved file references": "未解析的文件引用",
+ "Reports paths in HTML attributes, CSS url() and @import that do not name an existing file, resolved relative to the file, the project root and its resource roots.": "报告 HTML 特性、CSS url() 和 @import 中未指向现有文件的路径,路径相对于该文件、项目根目录及其资源根进行解析。",
+ "Build problems": "构建问题",
+ "Unresolved database references": "未解析的数据库引用",
+ "Reports tables, columns and aliases in query consoles that the data source's schema does not contain.": "报告查询控制台中数据源架构不包含的表、列和别名。",
+ "Proofreading": "校对",
+ "Reports misspelt words in comments, string literals and the names declarations introduce (camelCase and snake_case parts checked separately), and in plain text and Markdown. Words can be saved to the project or application dictionary (Editor › Natural Languages › Spelling).": "报告注释、字符串字面量和声明引入的名称(camelCase 和 snake_case 的各部分分别检查)以及纯文本和 Markdown 中拼写错误的单词。单词可以保存到项目词典或应用程序词典(编辑器 › 自然语言 › 拼写)。",
+ "English (USA)": "英语(美国)",
+ "Bundled Hunspell dictionary (SCOWL en_US) and common programming terms.": "捆绑的 Hunspell 词典 (SCOWL en_US) 和常用编程术语。",
+ "Used by Proofreading › Typo": "由“校对 › 拼写错误”使用",
+ "Accepted words": "已接受的单词",
+ "Project dictionary": "项目词典",
+ "Stored with the project.": "随项目存储。",
+ "No words": "没有单词",
+ "Word": "单词",
+ "Application dictionary": "应用程序词典",
+ "Accepted in every project.": "在所有项目中接受。",
+ "Custom dictionaries": "自定义词典",
+ "Dictionary files": "词典文件",
+ "Plain-text word lists (one word per line) or Hunspell .dic files. Relative paths resolve against the project root, ~/ against the home folder.": "纯文本单词列表(每行一个单词)或 Hunspell .dic 文件。相对路径相对于项目根目录解析,~/ 相对于主文件夹解析。",
+ "No custom dictionaries": "没有自定义词典",
+ "Dictionary path": "词典路径",
+ "Natural Languages": "自然语言",
+ "Java Class › JUnit 5 Test": "Java 类 › JUnit 5 测试",
+ "Kotlin Class/File › JUnit 5 Test": "Kotlin 类/文件 › JUnit 5 测试",
+ "Go File › Test file": "Go 文件 › 测试文件",
+ "Rust File › Test module": "Rust 文件 › 测试模块",
+ "TypeScript File › Test": "TypeScript 文件 › 测试",
+ "Python File › Test (pytest)": "Python 文件 › 测试 (pytest)",
+ "CSS File": "CSS 文件",
+ "SCSS File": "SCSS 文件",
+ "Sass File": "Sass 文件",
+ "Less File": "Less 文件",
+ "JSON file": "JSON 文件",
+ "YAML file": "YAML 文件",
+ "TOML file": "TOML 文件",
+ "Bash script": "Bash 脚本",
+ "POSIX sh script": "POSIX sh 脚本",
+ "Zsh script": "Zsh 脚本",
+ "Default properties": "默认属性",
+ "Root only": "仅根",
+ ".gitignore file": ".gitignore 文件",
+ "Includes": "包含",
+ "Template kinds": "模板类型",
+ "Reformat according to style": "按照样式重新格式化",
+ "New Include": "新建包含",
+ "Add Include": "添加包含",
+ "Remove Include": "移除包含",
+ "Include name": "包含名称",
+ "Include body": "包含正文",
+ "Code templates": "代码模板",
+ "Used by": "用于",
+ "Code template body": "代码模板正文",
+ "Changelist": "变更列表",
+ "No TODO items found in this scope": "在此范围内未找到 TODO 项",
+ "No TODO items in changed files": "已更改的文件中没有 TODO 项",
+ "Author": "作者",
+ "Merge options": "合并选项",
+ "Pull": "拉取",
+ "No remotes are configured. Add one with Git › Manage Remotes….": "未配置远程。请使用 Git › 管理远程… 添加一个。",
+ "Remote branch": "远程分支",
+ "Uncommitted changes are stashed before the pull and restored afterwards.": "拉取前会储藏未提交的更改,之后再恢复。",
+ "Branch to merge": "要合并的分支",
+ "Select branch": "选择分支",
+ "-m (commit message)": "-m(提交消息)",
+ "Upstream": "上游",
+ "New base": "新基",
+ "Uncommitted changes are stashed before the rebase and restored afterwards.": "变基前会储藏未提交的更改,之后再恢复。",
+ "Enter a remote name": "请输入远程名称",
+ "Invalid remote name": "远程名称无效",
+ "Remotes": "远程",
+ "Enter the remote URL": "请输入远程 URL",
+ "Force Remove": "强制移除",
+ "(bare)": "(裸)",
+ "Choose what to check out": "选择要签出的内容",
+ "Enter a folder": "请输入文件夹",
+ "Check out": "签出",
+ "New branch name": "新分支名称",
+ "Folder": "文件夹",
+ "VCS Widget": "VCS 微件",
+ "Recent Changes": "最近的更改",
+ "Cannot read Local History": "无法读取本地历史记录",
+ "No recent changes": "没有最近的更改",
+ "Local History has no entries yet": "本地历史记录中还没有条目",
+ "Customize Main Toolbar": "自定义主工具栏",
+ "Customize Main Toolbar…": "自定义主工具栏…",
+ "Left group": "左侧组",
+ "Right group": "右侧组",
+ "Add…": "添加…",
+ "Move to Right": "移到右侧",
+ "Move to Left": "移到左侧",
+ "Widget": "微件",
+ "Actions and widgets to add": "要添加的操作和微件",
+ "Don't Show Again": "不再显示",
+ "Customize Toolbar…": "自定义工具栏…",
+ "Restore Default Toolbar": "恢复默认工具栏",
+ "View Mode": "视图模式",
+ "Value must not be empty": "值不能为空",
+ "Nothing to choose from": "没有可选择的内容",
+ "Project Widget": "项目微件",
+ "Editor Color Scheme": "编辑器配色方案",
+ "Quick Switch Scheme…": "快速切换方案…",
+ "No saved layouts. Use Save Current Layout as… first.": "没有已保存的布局。请先使用“将当前布局另存为…”。",
+ "Enter a layout name": "请输入布局名称",
+ "A layout with this name exists": "已存在同名的布局",
+ "Save Current Layout as…": "将当前布局另存为…",
+ "Save Current Layout as": "将当前布局另存为",
+ "Layout name:": "布局名称:",
+ "Restore Tool Window Layout": "恢复工具窗口布局",
+ "Restores the saved layout named `arg`, or asks which one.": "恢复名为 `arg` 的已保存布局,或询问要恢复哪一个。",
+ "Restore Layout": "恢复布局",
+ "Rename Tool Window Layout…": "重命名工具窗口布局…",
+ "Rename Layout": "重命名布局",
+ "Delete Tool Window Layout…": "删除工具窗口布局…",
+ "Delete Layout": "删除布局",
+ "Formatted {count} lines": "已格式化 {count} 行",
+ "Formatted {count} line": "已格式化 {count} 行",
+ " the Reformat dialog": "重新格式化对话框",
+ "The file changed while formatting; try again": "格式化期间文件已更改,请重试",
+ "No lines changed: content is already properly formatted": "没有更改任何行:内容已正确格式化",
+ "The file is read-only": "文件为只读",
+ "No documentation found": "未找到文档",
+ "Cannot read the definition's file": "无法读取定义所在的文件",
+ "Cannot find declaration to go to": "找不到要转到的声明",
+ "No structure information for this file": "此文件没有结构信息",
+ "No super method found": "未找到超方法",
+ "No super class found": "未找到超类",
+ "No parameters": "无形参",
+ "No usages found in file": "文件中未找到用法",
+ "No type information found": "未找到类型信息",
+ "Nothing to rename": "没有可重命名的内容",
+ "The file changed; rename cancelled": "文件已更改,重命名已取消",
+ "No suggestions": "无建议",
+ "No intentions available": "没有可用的意图操作",
+ "The document changed; invoke the refactoring again": "文档已更改,请重新调用重构",
+ "The document changed; the name was not applied": "文档已更改,名称未应用",
+ "The file changed; Safe Delete cancelled": "文件已更改,安全删除已取消",
+ "No language server is available": "没有可用的语言服务器",
+ "Separate variables with semicolon: VAR=value; VAR1=value1": "使用分号分隔变量:VAR=value; VAR1=value1",
+ "Relative to the project root; separate with semicolon": "相对于项目根目录;使用分号分隔",
+ "Configurations of the compound": "复合配置中的配置",
+ "Another configuration has this name": "已有其他配置使用此名称",
+ "Invalid directory": "目录无效",
+ "Application": "应用程序",
+ "Java Single File": "Java 单文件",
+ "Rust Single File": "Rust 单文件",
+ "Kotlin Single File": "Kotlin 单文件",
+ "C/C++ Single File": "C/C++ 单文件",
+ "Native Executable": "原生可执行文件",
+ "Kotlin Script": "Kotlin 脚本",
+ "{name} is required": "{name} 为必填项",
+ "{name} project": "{name} 项目",
+ "{adapter} (no launch template)": "{adapter}(无启动模板)",
+ "Before launch command {n}": "启动前命令 {n}",
+ "Invalid environment variable name: {key}": "环境变量名称无效:{key}",
+ "Run '{name}'": "运行 '{name}'",
+ "'{name}' failed": "'{name}' 失败",
+ "'{name}' was not started": "'{name}' 未启动",
+ "External tool '{name}'": "外部工具 '{name}'",
+ "Activate '{name}' tool window": "激活 '{name}' 工具窗口",
+ "Configuration '{name}' no longer exists": "配置 '{name}' 已不存在",
+ "External tool '{name}' no longer exists": "外部工具 '{name}' 已不存在",
+ "'{name}' was not run": "'{name}' 未运行",
+ "Tool window '{name}' is not available": "工具窗口 '{name}' 不可用",
+ "Unknown before launch task '{name}'": "未知的启动前任务 '{name}'",
+ "Variable {n} name": "变量 {n} 名称",
+ "Variable {n} value": "变量 {n} 值",
+ "Duplicate environment variable: {key}": "环境变量重复:{key}",
+ "Nothing to show in {view}": "{view}中没有可显示的内容",
+ "Stopped Containers": "已停止的容器",
+ "Unused Images": "未使用的镜像",
+ "Unused Volumes": "未使用的卷",
+ "Unused Networks": "未使用的网络",
+ "Unused Containers": "未使用的容器",
+ "Everything Unused (System Prune)": "所有未使用的对象(系统清理)",
+ "Remove all stopped containers?": "移除所有已停止的容器?",
+ "Remove all dangling (untagged) images?": "移除所有悬空(无标签)镜像?",
+ "Remove all images not used by a container?": "移除所有未被容器使用的镜像?",
+ "Remove all anonymous volumes not used by a container? Their data is lost.": "移除所有未被容器使用的匿名卷?其数据将丢失。",
+ "Remove all networks not used by a container?": "移除所有未被容器使用的网络?",
+ "Remove stopped containers, unused networks, dangling images and the build cache?": "移除已停止的容器、未使用的网络、悬空镜像和构建缓存?",
+ "Prune {target}": "清理{target}",
+ "Prune {target}…": "清理{target}…",
+ "Pruning {target}…": "正在清理 {target}…",
+ "Pruning {target}": "清理 {target}",
+ "Pulling {name}…": "正在拉取 {name}…",
+ "Pulling {name}": "拉取 {name}",
+ "containers": "容器",
+ "images": "镜像",
+ "volumes": "卷",
+ "networks": "网络",
+ "unused images": "未使用的镜像",
+ "Compose project '{name}'": "Compose 项目 '{name}'",
+ "Engine {server} · CLI {client}": "引擎 {server} · CLI {client}",
+ " · context {name}": " · 上下文 {name}",
+ "Failed (exit {code})": "失败(退出代码 {code})",
+ "No configurations of this type": "没有此类型的配置",
+ "system": "系统",
+ "{name} cancelled": "{name}已取消",
+ "Image to pull:": "要拉取的镜像:",
+ "Pull Image": "拉取镜像",
+ "Not a {name} URL": "不是 {name} URL",
+ "Duplicate scope name '{name}'": "范围名称 '{name}' 重复",
+ "Scope '{name}' has no pattern": "范围 '{name}' 没有模式",
+ "Unnamed ({n})": "未命名 ({n})",
+ "Project will be created in: {path}": "项目将创建在:{path}",
+ "(or": "(或",
+ "inserts a template from the Includes or Code tab.": "插入“包含”或“代码”标签页中的模板。",
+ "File templates insert this with {code}, indented like the directive; a directive line whose include is empty is dropped. The file template variables apply.": "文件模板通过 {code} 插入此内容,缩进与该指令一致;所含内容为空的指令行将被删除。文件模板变量同样适用。",
+ "Inserted where a file template says {code}.": "插入到文件模板中写有 {code} 的位置。"
}
diff --git a/src/platform/locales/zh.json b/src/platform/locales/zh.json
index 5c04ca9ee..b0bddcb6c 100644
--- a/src/platform/locales/zh.json
+++ b/src/platform/locales/zh.json
@@ -268,6 +268,14 @@
"menu.vcs.stash": "贮藏更改…",
"menu.vcs.unstash": "取消贮藏更改…",
"menu.vcs.update": "更新项目…",
+ "menu.vcs.pull": "拉取…",
+ "menu.vcs.merge": "合并…",
+ "menu.vcs.rebase": "变基…",
+ "menu.vcs.newWorktree": "新建工作树…",
+ "menu.vcs.worktrees": "工作树…",
+ "menu.vcs.manageRemotes": "管理远程…",
+ "menu.vcs.clone": "克隆…",
+ "menu.vcs.operations": "VCS 操作弹出窗口…",
"menu.view": "视图",
"menu.view.notifications": "通知",
"menu.view.toggleTheme": "切换亮色/暗色主题",
@@ -318,5 +326,59 @@
"menu.github.createPullRequest": "创建拉取请求…",
"menu.github.checkoutPullRequest": "签出拉取请求…",
"menu.github.openInBrowser": "在 GitHub 上打开",
+ "menu.file.newProject": "新建项目…",
+ "menu.file.renameProject": "重命名项目…",
+ "menu.file.reloadAllFromDisk": "从磁盘全部重新加载",
+ "menu.file.invalidateCaches": "清除缓存…",
+ "menu.manageIdeSettings": "管理 IDE 设置",
+ "menu.file.exportSettings": "导出设置…",
+ "menu.file.importSettings": "导入设置…",
+ "menu.file.togglePowerSave": "省电模式",
+ "menu.macros": "宏",
+ "menu.macro.startRecording": "开始录制宏",
+ "menu.macro.stopRecording": "停止录制宏",
+ "menu.macro.playBack": "回放上一个宏",
+ "menu.macro.playSaved": "播放已保存的宏…",
+ "menu.macro.edit": "编辑宏…",
+ "menu.bookmarks": "书签",
+ "menu.navigate.toggleBookmarkWithMnemonic": "使用助记符切换书签",
+ "menu.navigate.nextBookmark": "下一个书签",
+ "menu.navigate.prevBookmark": "上一个书签",
+ "menu.view.toggleCompactMode": "紧凑模式",
+ "menu.view.zoomIn": "放大 IDE",
+ "menu.view.zoomOut": "缩小 IDE",
+ "menu.view.resetZoom": "重置 IDE 缩放",
+ "menu.toolbar.customize": "自定义主工具栏…",
+ "menu.code.quickDefinition": "快速定义",
+ "menu.code.quickTypeDefinition": "快速类型定义",
+ "menu.localHistory.recentChanges": "最近的更改",
+ "menu.diff.compareWithClipboard": "与剪贴板比较",
+ "menu.view.quickSwitchScheme": "快速切换方案…",
+ "menu.editor.resetFontSize": "重置所有编辑器中的字体大小",
+ "menu.code.cleanup": "代码清理…",
+ "menu.runAnything.show": "运行任何内容…",
+ "menu.localHistory.putLabel": "添加标签…",
+ "menu.toolWindowLayouts": "工具窗口布局",
+ "menu.layout.save": "将当前布局另存为…",
+ "menu.layout.restoreDefault": "恢复默认布局",
+ "menu.layout.rename": "重命名布局…",
+ "menu.layout.delete": "删除布局…",
+ "menu.activeToolWindow": "活动工具窗口",
+ "menu.toolwindow.hideActive": "隐藏活动工具窗口",
+ "menu.toolwindow.maximize": "最大化工具窗口",
+ "menu.toolwindow.closeContent": "关闭活动标签页",
+ "menu.toolwindow.jumpToLast": "跳转到上一个工具窗口",
+ "menu.toolwindow.focusEditor": "聚焦编辑器",
+ "menu.editorTabs": "编辑器标签页",
+ "menu.editor.nextTab": "选择下一个标签页",
+ "menu.editor.prevTab": "选择上一个标签页",
+ "menu.editor.pinTab": "固定标签页",
+ "menu.editor.closeTab": "关闭标签页",
+ "menu.editor.closeOtherTabs": "关闭其他标签页",
+ "menu.editor.closeAllTabs": "关闭所有标签页",
+ "menu.editor.reopenClosedTab": "重新打开已关闭的标签页",
+ "menu.editor.moveToOppositeGroup": "移动到另一组",
+ "run.services.configurationCount": "{count} 个配置",
+ "search.bookmarks.count": "{count} 个书签",
"settings.zoom.hint": "使用 {zoomIn} 或 {zoomOut} 更改,使用 {reset} 重置为 100%"
}
diff --git a/src/platform/projectRoots.ts b/src/platform/projectRoots.ts
index 96f3a39e4..d41ee51ab 100644
--- a/src/platform/projectRoots.ts
+++ b/src/platform/projectRoots.ts
@@ -138,3 +138,30 @@ export function inFileSet(set: ProjectFileSet, path: string, roots: readonly Roo
if (set === "all") return true;
return isTestPath(roots, rel) === (set === "test");
}
+
+/** A module: the project itself or a folder with a build file roots were detected from. */
+export interface ProjectModule {
+ name: string;
+ /** Project-relative, `/`-separated; `""` is the project root. */
+ path: string;
+}
+
+/** Modules of the project, root first, then by path. */
+export function projectModules(detected: readonly RootFolder[], projectName: string): ProjectModule[] {
+ const dirs = new Set([""]);
+ for (const r of detected) {
+ if (!r.detectedFrom) continue;
+ const i = r.detectedFrom.lastIndexOf("/");
+ dirs.add(i < 0 ? "" : r.detectedFrom.slice(0, i));
+ }
+ return [...dirs]
+ .sort((a, b) => (a === "" ? -1 : b === "" ? 1 : a < b ? -1 : a > b ? 1 : 0))
+ .map((path) => ({ path, name: path ? path.slice(path.lastIndexOf("/") + 1) : projectName }));
+}
+
+/** Modules of the open project (reactive). */
+export function useProjectModules(): ProjectModule[] {
+ const detected = useDetectedRoots();
+ const name = useProject((s) => s.project?.name ?? "");
+ return useMemo(() => projectModules(detected, name), [detected, name]);
+}
diff --git a/src/platform/search.test.ts b/src/platform/search.test.ts
new file mode 100644
index 000000000..c46228f09
--- /dev/null
+++ b/src/platform/search.test.ts
@@ -0,0 +1,71 @@
+import { beforeEach, describe, expect, it } from "vitest";
+import { useProject } from "./project";
+import { projectModules } from "./projectRoots";
+import {
+ contextAccepts,
+ customScopes,
+ findCustomScope,
+ rememberSearch,
+ saveCustomScopes,
+ searchHistory,
+ useCustomScopes,
+} from "./search";
+
+const openProject = (root: string | null) =>
+ useProject.setState({
+ project: root ? ({ root, name: "p", isGit: false } as never) : null,
+ });
+
+describe("shared search pieces", () => {
+ beforeEach(() => {
+ localStorage.clear();
+ useCustomScopes.setState({ root: null, scopes: [] });
+ openProject(null);
+ });
+
+ it("search context accepts matches like the backend", () => {
+ expect(contextAccepts("any", "comment")).toBe(true);
+ expect(contextAccepts("inComments", "comment")).toBe(true);
+ expect(contextAccepts("inComments", null)).toBe(false);
+ expect(contextAccepts("exceptStringLiterals", "comment")).toBe(true);
+ expect(contextAccepts("exceptStringLiterals", "string")).toBe(false);
+ expect(contextAccepts("exceptCommentsAndStringLiterals", null)).toBe(true);
+ });
+
+ it("history is shared, newest first and unique", () => {
+ rememberSearch("find", "a");
+ rememberSearch("find", "b\nc");
+ rememberSearch("find", "a");
+ expect(searchHistory("find")).toEqual(["a", "b\nc"]);
+ });
+
+ it("custom scopes are saved per project", () => {
+ openProject("/p1");
+ saveCustomScopes([
+ { name: " Sources ", pattern: " file:src//* " },
+ { name: "", pattern: "x" },
+ ]);
+ expect(customScopes()).toEqual([{ name: "Sources", pattern: "file:src//*" }]);
+ openProject("/p2");
+ expect(customScopes()).toEqual([]);
+ openProject("/p1");
+ expect(findCustomScope("Sources")?.pattern).toBe("file:src//*");
+ });
+
+ it("modules are the project and the folders of detected build files", () => {
+ const modules = projectModules(
+ [
+ { path: "web/src", kind: "source", detectedFrom: "web/package.json" },
+ { path: "src", kind: "source", detectedFrom: "Cargo.toml" },
+ { path: "crates/a/src", kind: "source", detectedFrom: "crates/a/Cargo.toml" },
+ { path: "gen", kind: "excluded", detectedFrom: null },
+ ],
+ "app",
+ );
+ expect(modules).toEqual([
+ { path: "", name: "app" },
+ { path: "crates/a", name: "a" },
+ { path: "web", name: "web" },
+ ]);
+ });
+});
diff --git a/src/platform/search.ts b/src/platform/search.ts
new file mode 100644
index 000000000..172345198
--- /dev/null
+++ b/src/platform/search.ts
@@ -0,0 +1,149 @@
+/**
+ * Search pieces shared by Find / Replace in the editor and Find in Files:
+ * the search context filter, Preserve Case, the recent-search history and the
+ * user's custom (named) scopes, persisted per project.
+ */
+import { useEffect } from "react";
+import { create } from "zustand";
+import type { SearchContext } from "./ipc";
+import { useProject } from "./project";
+
+export type { SearchContext };
+
+/** IDEA's search context filter: anywhere, only / except comments and string literals. */
+export const SEARCH_CONTEXTS: ReadonlyArray<{ value: SearchContext; label: string }> = [
+ { value: "any", label: "Anywhere" },
+ { value: "inComments", label: "In Comments" },
+ { value: "inStringLiterals", label: "In String Literals" },
+ { value: "exceptComments", label: "Except Comments" },
+ { value: "exceptStringLiterals", label: "Except String Literals" },
+ { value: "exceptCommentsAndStringLiterals", label: "Except Comments and String Literals" },
+];
+
+export type LiteralKind = "comment" | "string";
+
+/** Whether a match starting in `kind` (`null`: plain code) is kept (as the backend's `SearchContext::accepts`). */
+export function contextAccepts(context: SearchContext, kind: LiteralKind | null): boolean {
+ switch (context) {
+ case "any":
+ return true;
+ case "inComments":
+ return kind === "comment";
+ case "inStringLiterals":
+ return kind === "string";
+ case "exceptComments":
+ return kind !== "comment";
+ case "exceptStringLiterals":
+ return kind !== "string";
+ case "exceptCommentsAndStringLiterals":
+ return kind === null;
+ }
+}
+
+/** IDEA's "Preserve case" (same rules as the backend's `preserve_case`). */
+export function preserveCase(found: string, replacement: string): string {
+ const letters = [...found].filter((c) => c.toLowerCase() !== c.toUpperCase());
+ const first = letters[0];
+ if (!first || !replacement) return replacement;
+ const isUpper = (c: string) => c === c.toUpperCase() && c !== c.toLowerCase();
+ if (letters.length > 1 && letters.every(isUpper)) return replacement.toUpperCase();
+ const [head = "", ...rest] = [...replacement];
+ return (isUpper(first) ? head.toUpperCase() : head.toLowerCase()) + rest.join("");
+}
+
+function load(key: string): unknown {
+ try {
+ const raw = globalThis.localStorage?.getItem(key);
+ return raw ? JSON.parse(raw) : null;
+ } catch {
+ return null;
+ }
+}
+
+function save(key: string, value: unknown) {
+ try {
+ globalThis.localStorage?.setItem(key, JSON.stringify(value));
+ } catch {
+ /* storage unavailable */
+ }
+}
+
+const HISTORY_KEYS = { find: "openidea.search.findHistory.v1", replace: "openidea.search.replaceHistory.v1" };
+const MAX_HISTORY = 20;
+
+/** Recent search (or replace) strings, newest first; shared by the find bar and Find in Files. */
+export function searchHistory(kind: "find" | "replace"): string[] {
+ const v = load(HISTORY_KEYS[kind]);
+ return Array.isArray(v) ? v.filter((x): x is string => typeof x === "string") : [];
+}
+
+export function rememberSearch(kind: "find" | "replace", text: string) {
+ if (!text.trim()) return;
+ save(HISTORY_KEYS[kind], [text, ...searchHistory(kind).filter((x) => x !== text)].slice(0, MAX_HISTORY));
+}
+
+/**
+ * A user-defined scope: a name and an IDEA-style pattern
+ * (`file:src//*.ts&&!file:*test*`), matched by the backend (`SearchScope::Pattern`).
+ */
+export interface CustomScope {
+ name: string;
+ pattern: string;
+}
+
+interface CustomScopesState {
+ /** Project the scopes belong to. */
+ root: string | null;
+ scopes: CustomScope[];
+}
+
+export const useCustomScopes = create<CustomScopesState>(() => ({ root: null, scopes: [] }));
+
+const scopesKey = (root: string) => `openidea.scopes.v1:${root}`;
+
+function validScopes(v: unknown): CustomScope[] {
+ if (!Array.isArray(v)) return [];
+ return v.flatMap((x) => {
+ const s = x as Partial<CustomScope> | null;
+ return s && typeof s.name === "string" && typeof s.pattern === "string" && s.name.trim()
+ ? [{ name: s.name, pattern: s.pattern }]
+ : [];
+ });
+}
+
+/** Custom scopes of the open project (loaded on first use after the project changes). */
+export function customScopes(): CustomScope[] {
+ const root = useProject.getState().project?.root ?? null;
+ const s = useCustomScopes.getState();
+ if (s.root === root) return s.scopes;
+ const scopes = root ? validScopes(load(scopesKey(root))) : [];
+ useCustomScopes.setState({ root, scopes });
+ return scopes;
+}
+
+/** Reactive {@link customScopes}. */
+export function useCustomScopeList(): CustomScope[] {
+ const root = useProject((p) => p.project?.root ?? null);
+ const state = useCustomScopes();
+ const stale = state.root !== root;
+ useEffect(() => {
+ if (stale) customScopes();
+ }, [stale]);
+ return stale ? NO_SCOPES : state.scopes;
+}
+
+const NO_SCOPES: CustomScope[] = [];
+
+export function saveCustomScopes(scopes: CustomScope[]) {
+ const root = useProject.getState().project?.root ?? null;
+ const clean = validScopes(scopes).map((s) => ({ name: s.name.trim(), pattern: s.pattern.trim() }));
+ useCustomScopes.setState({ root, scopes: clean });
+ if (root) save(scopesKey(root), clean);
+}
+
+export function findCustomScope(name: string): CustomScope | null {
+ return customScopes().find((s) => s.name === name) ?? null;
+}
+
+/** Action that opens the scope editor (registered by the search feature); `arg`: `{ select?: string }`. */
+export const EDIT_SCOPES_ACTION = "search.editScopes";
diff --git a/src/styles/tokens.css b/src/styles/tokens.css
index 829e1fd97..f90bdbb51 100644
--- a/src/styles/tokens.css
+++ b/src/styles/tokens.css
@@ -328,6 +328,14 @@
--project-color-8-end: #279ccd;
--project-color-9: #5fad65;
--project-color-9-end: #3d968b;
+ /* Data source colours (IDEA's Color: red marks production); drawn as tints. */
+ --db-color-red: #e5534b;
+ --db-color-orange: #e08855;
+ --db-color-yellow: #d4b106;
+ --db-color-green: #5fad65;
+ --db-color-blue: #3b92b8;
+ --db-color-violet: #955ae0;
+ --tint-strength: 22%;
}
/* Windows caption buttons (frameless title bar): the system close red in every theme. */
diff --git a/src/ui/Button.tsx b/src/ui/Button.tsx
index dcc83eedb..dff8f3183 100644
--- a/src/ui/Button.tsx
+++ b/src/ui/Button.tsx
@@ -64,6 +64,7 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(functio
onClick,
disabled,
type = "button",
+ "aria-label": ariaLabel,
...rest
},
ref,
@@ -76,7 +77,7 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(functio
<button
ref={ref}
type={type}
- aria-label={label}
+ aria-label={tx(ariaLabel) ?? label}
aria-pressed={pressed}
aria-keyshortcuts={keys}
disabled={disabled}
diff --git a/src/ui/Input.module.css b/src/ui/Input.module.css
index b2c3955cb..a41fa40f9 100644
--- a/src/ui/Input.module.css
+++ b/src/ui/Input.module.css
@@ -93,6 +93,15 @@
line-height: 20px;
padding: 0;
}
+/* A multi-line capable field holding one line looks like a text input. */
+.searchAreaSingle {
+ height: 20px;
+ overflow: hidden;
+}
+.leading:is(button) {
+ margin-right: 2px;
+ margin-left: -4px;
+}
.invalid .searchInput {
color: var(--danger);
}
diff --git a/src/ui/Input.tsx b/src/ui/Input.tsx
index 8243cbbd3..00850ac8d 100644
--- a/src/ui/Input.tsx
+++ b/src/ui/Input.tsx
@@ -1,8 +1,19 @@
-import { forwardRef, type InputHTMLAttributes, type ReactNode, type Ref, type TextareaHTMLAttributes } from "react";
+import {
+ forwardRef,
+ useEffect,
+ useRef,
+ type InputHTMLAttributes,
+ type FocusEvent,
+ type KeyboardEvent,
+ type ReactNode,
+ type Ref,
+ type TextareaHTMLAttributes,
+} from "react";
import clsx from "clsx";
import { Icon, type IconName } from "./icons";
import { IconButton } from "./Button";
import styles from "./Input.module.css";
+import { setContext } from "@/platform/context";
import { useTx } from "@/platform/i18n";
export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
@@ -13,7 +24,7 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
}
export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
- { invalid, mono, variant = "framed", className, spellCheck = false, autoComplete = "off", placeholder, ...rest },
+ { invalid, mono, variant = "framed", className, spellCheck = false, autoComplete = "off", placeholder, "aria-label": ariaLabel, ...rest },
ref,
) {
const tx = useTx();
@@ -26,6 +37,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
autoCapitalize="off"
aria-invalid={invalid || undefined}
placeholder={tx(placeholder)}
+ aria-label={tx(ariaLabel)}
className={clsx(styles.input, variant === "bare" ? styles.bare : styles.framed, mono && styles.mono, className)}
{...rest}
/>
@@ -54,6 +66,32 @@ export interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElem
size?: "normal" | "large";
variant?: "framed" | "bare";
className?: string;
+ /**
+ * IDEA's multi-line search field: always a text area that grows with the
+ * text, plus a New Line button (⇧⌘↵ / ⇧Ctrl↵ inserts one too).
+ */
+ multiline?: boolean;
+ /** Turns the leading magnifier into IDEA's search-history button (magnifier ▾). */
+ onHistory?: () => void;
+}
+
+const isNewLineKey = (e: KeyboardEvent) => e.key === "Enter" && e.shiftKey && (e.metaKey || e.ctrlKey) && !e.altKey;
+
+interface FieldCommands {
+ newLine?: () => void;
+ history?: () => void;
+}
+let focusedField: FieldCommands | null = null;
+
+/**
+ * New Line / Recent Searches in the focused search field, for the shortcut
+ * actions that win over editor bindings of the same keys (contexts
+ * `searchFieldNewLine` / `searchFieldHistory`).
+ */
+export function runSearchFieldCommand(command: keyof FieldCommands): boolean {
+ const run = focusedField?.[command];
+ run?.();
+ return !!run;
}
export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(
@@ -69,13 +107,70 @@ export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(functi
variant = "framed",
className,
placeholder,
+ multiline,
+ onHistory,
+ "aria-label": ariaLabel,
...rest
},
ref,
) {
const tx = useTx();
+ const inner = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null);
+ const setRef = (el: HTMLInputElement | HTMLTextAreaElement | null) => {
+ inner.current = el;
+ if (typeof ref === "function") ref(el as HTMLInputElement);
+ else if (ref) ref.current = el as HTMLInputElement;
+ };
+ const insertNewLine = () => {
+ const el = inner.current;
+ const start = el?.selectionStart ?? value.length;
+ const end = el?.selectionEnd ?? value.length;
+ onChange(`${value.slice(0, start)}\n${value.slice(end)}`);
+ setTimeout(() => {
+ el?.focus();
+ el?.setSelectionRange(start + 1, start + 1);
+ }, 0);
+ };
+ const commands = useRef<FieldCommands>({});
+ commands.current.newLine = multiline ? insertNewLine : undefined;
+ commands.current.history = onHistory;
+ const { onKeyDown, onFocus, onBlur, ...fieldProps } = rest;
+ const keyDown = (e: KeyboardEvent<HTMLInputElement>) => {
+ if (multiline && isNewLineKey(e)) {
+ e.preventDefault();
+ insertNewLine();
+ return;
+ }
+ onKeyDown?.(e);
+ };
+ const focus = (e: FocusEvent<HTMLInputElement>) => {
+ focusedField = commands.current;
+ setContext("searchFieldNewLine", !!multiline);
+ setContext("searchFieldHistory", !!onHistory);
+ onFocus?.(e);
+ };
+ const blur = (e: FocusEvent<HTMLInputElement>) => {
+ if (focusedField === commands.current) {
+ focusedField = null;
+ setContext("searchFieldNewLine", false);
+ setContext("searchFieldHistory", false);
+ }
+ onBlur?.(e);
+ };
+ const handlers = { onKeyDown: keyDown, onFocus: focus, onBlur: blur };
+ // Removing a focused field fires no blur.
+ useEffect(() => {
+ const own = commands.current;
+ return () => {
+ if (focusedField !== own) return;
+ focusedField = null;
+ setContext("searchFieldNewLine", false);
+ setContext("searchFieldHistory", false);
+ };
+ }, []);
// A multi-line query (e.g. Find over a multi-line selection) is shown as such.
const lines = value.split("\n").length;
+ const iconSize = size === "large" ? 15 : 14;
return (
<div
className={clsx(
@@ -88,25 +183,42 @@ export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(functi
)}
data-invalid={invalid || undefined}
>
- {leadingIcon && <Icon name={leadingIcon} size={size === "large" ? 15 : 14} className={styles.leading} />}
- {lines > 1 ? (
+ {onHistory ? (
+ <IconButton
+ icon="search-history"
+ title="Recent Searches"
+ shortcut="⌥↓"
+ size="small"
+ iconSize={iconSize}
+ tabIndex={-1}
+ className={styles.leading}
+ onClick={onHistory}
+ />
+ ) : (
+ leadingIcon && <Icon name={leadingIcon} size={iconSize} className={styles.leading} />
+ )}
+ {lines > 1 || multiline ? (
<textarea
- ref={ref as unknown as Ref<HTMLTextAreaElement>}
- className={clsx(styles.searchInput, styles.searchArea)}
+ ref={setRef as Ref<HTMLTextAreaElement>}
+ className={clsx(styles.searchInput, styles.searchArea, lines === 1 && styles.searchAreaSingle)}
rows={Math.min(lines, 5)}
+ wrap="off"
value={value}
spellCheck={false}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
aria-invalid={invalid || undefined}
+ aria-multiline={multiline || undefined}
placeholder={tx(placeholder)}
+ aria-label={tx(ariaLabel)}
onChange={(e) => onChange(e.target.value)}
- {...(rest as TextareaHTMLAttributes<HTMLTextAreaElement>)}
+ {...(handlers as unknown as TextareaHTMLAttributes<HTMLTextAreaElement>)}
+ {...(fieldProps as TextareaHTMLAttributes<HTMLTextAreaElement>)}
/>
) : (
<input
- ref={ref}
+ ref={setRef as Ref<HTMLInputElement>}
className={styles.searchInput}
value={value}
spellCheck={false}
@@ -115,14 +227,27 @@ export const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(functi
autoCapitalize="off"
aria-invalid={invalid || undefined}
placeholder={tx(placeholder)}
+ aria-label={tx(ariaLabel)}
onChange={(e) => onChange(e.target.value)}
- {...rest}
+ {...handlers}
+ {...fieldProps}
/>
)}
{trailing}
{clearable && value && (
<IconButton icon="close" title="Clear" size="small" iconSize={12} tabIndex={-1} onClick={() => onChange("")} />
)}
+ {multiline && (
+ <IconButton
+ icon="new-line"
+ title="New Line"
+ shortcut="⇧⌘↵"
+ size="small"
+ tabIndex={-1}
+ onMouseDown={(e) => e.preventDefault()}
+ onClick={insertNewLine}
+ />
+ )}
{toggles?.map((t) => (
<IconButton
key={t.id}
diff --git a/src/ui/Select.tsx b/src/ui/Select.tsx
index f6730b463..cc4ca258c 100644
--- a/src/ui/Select.tsx
+++ b/src/ui/Select.tsx
@@ -95,7 +95,7 @@ export function Select<V extends string = string>({
type="button"
aria-haspopup="listbox"
aria-expanded={open}
- aria-label={aria["aria-label"]}
+ aria-label={tx(aria["aria-label"])}
disabled={disabled}
className={clsx(styles.trigger, styles[variant], className)}
onClick={() => (open ? setOpen(false) : openPopup())}
@@ -148,7 +148,7 @@ export function Select<V extends string = string>({
focusable={false}
hoverSelects
rowHeight={24}
- aria-label={aria["aria-label"]}
+ aria-label={tx(aria["aria-label"])}
className={styles.list}
renderItem={(o) => (
<>
diff --git a/src/ui/Tabs.module.css b/src/ui/Tabs.module.css
index 33921a6a3..cfbcff89d 100644
--- a/src/ui/Tabs.module.css
+++ b/src/ui/Tabs.module.css
@@ -48,6 +48,13 @@
background: var(--bg-tab-selected);
box-shadow: inset 0 0 0 1px var(--border-tab-selected);
}
+.tinted,
+.tinted:hover {
+ background: color-mix(in srgb, var(--tab-tint) var(--tint-strength, 22%), transparent);
+}
+.tinted.selected {
+ background: color-mix(in srgb, var(--tab-tint) var(--tint-strength, 22%), var(--bg-tab-selected));
+}
.tabButton {
display: flex;
align-items: center;
@@ -125,6 +132,98 @@
justify-content: flex-end;
}
+/* Tabs that don't fit: squeezed (labels ellipsized) or wrapped into rows. */
+.squeeze .scroller {
+ flex: 0 1 auto;
+}
+.squeeze .tab {
+ flex: 0 1 auto;
+ min-width: 40px;
+}
+.squeeze .tabButton {
+ flex: 1 1 auto;
+ min-width: 0;
+ overflow: hidden;
+}
+.squeeze .tabLabel {
+ min-width: 0;
+}
+.wrap {
+ height: auto;
+ min-height: var(--h-header);
+}
+.wrap .scroller {
+ flex: 1;
+ flex-wrap: wrap;
+ overflow: visible;
+ row-gap: 2px;
+ padding: 3px 0;
+}
+.wrap .tab {
+ height: calc(var(--h-header) - 6px);
+}
+
+/* Vertical strip (editor tabs placed left / right): a scrolling column of full-width tabs. */
+.vertical {
+ flex-direction: column;
+ height: auto;
+ min-height: 0;
+ padding: 4px;
+}
+.vertical .scroller {
+ flex: 0 1 auto;
+ flex-direction: column;
+ align-items: stretch;
+ min-height: 0;
+ overflow-x: hidden;
+ overflow-y: auto;
+ scrollbar-width: thin;
+}
+.vertical .scroller::-webkit-scrollbar {
+ display: initial;
+}
+.vertical .tab {
+ height: 24px;
+ min-height: 24px;
+}
+.vertical .tabButton {
+ flex: 1 1 auto;
+ min-width: 0;
+}
+.vertical .tabLabel {
+ min-width: 0;
+ max-width: none;
+}
+.vertical .trailing {
+ flex: none;
+ justify-content: flex-end;
+ padding-bottom: 4px;
+}
+.vertical .dropBefore::before,
+.vertical .dropAfter::after {
+ top: auto;
+ bottom: auto;
+ left: 4px;
+ right: 4px;
+ width: auto;
+ height: 2px;
+}
+.vertical .dropBefore::before {
+ top: -2px;
+}
+.vertical .dropAfter::after {
+ bottom: -2px;
+}
+
+/* Close button on the left of the label */
+.closeLeft .closeSlot {
+ order: -1;
+ margin: 0 0 0 4px;
+}
+.closeLeft .closable .tabButton {
+ padding: 0 10px 0 2px;
+}
+
/* drag & drop */
.dragging {
opacity: 0.5;
diff --git a/src/ui/Tabs.test.tsx b/src/ui/Tabs.test.tsx
index df66673b8..701429bbe 100644
--- a/src/ui/Tabs.test.tsx
+++ b/src/ui/Tabs.test.tsx
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import { fireEvent, render, screen } from "@testing-library/react";
-import { dropIndex, revealHorizontally, TabStripRegistry, Tabs, type TabStripHandle } from "./Tabs";
+import { dropIndex, revealHorizontally, revealVertically, TabStripRegistry, Tabs, type TabStripHandle } from "./Tabs";
describe("dropIndex", () => {
it("finds the insertion index from tab midpoints", () => {
@@ -41,6 +41,18 @@ describe("revealHorizontally", () => {
});
});
+describe("revealVertically", () => {
+ it("scrolls a column of tabs just enough to show the tab", () => {
+ const el = (top: number, bottom: number, scrollTop = 0) =>
+ ({ scrollTop, getBoundingClientRect: () => ({ top, bottom }) }) as unknown as HTMLElement;
+ const scroller = el(0, 300, 50);
+ revealVertically(scroller, el(290, 314));
+ expect(scroller.scrollTop).toBe(64);
+ revealVertically(scroller, el(-20, 4));
+ expect(scroller.scrollTop).toBe(44);
+ });
+});
+
describe("Tabs interactions", () => {
const items = [
{ id: "a", label: "A" },
@@ -76,4 +88,30 @@ describe("Tabs interactions", () => {
unmount();
expect(handles).toHaveLength(0);
});
+
+ it("a vertical strip moves with ↑/↓, shows actions above the tabs and has no overflow dropdown", () => {
+ const onSelect = vi.fn();
+ render(
+ <Tabs
+ items={items}
+ activeId="a"
+ onSelect={onSelect}
+ orientation="vertical"
+ aria-label="Vertical"
+ trailing={<button type="button">Actions</button>}
+ />,
+ );
+ const list = screen.getByRole("tablist", { name: "Vertical" });
+ expect(list.getAttribute("aria-orientation")).toBe("vertical");
+ const [first] = screen.getAllByRole("tab");
+ fireEvent.keyDown(first!, { key: "ArrowDown" });
+ expect(onSelect).toHaveBeenLastCalledWith("b");
+ fireEvent.keyDown(first!, { key: "ArrowUp" });
+ expect(onSelect).toHaveBeenLastCalledWith("c");
+ fireEvent.keyDown(first!, { key: "ArrowRight" });
+ expect(onSelect).toHaveBeenCalledTimes(2);
+ const actions = screen.getByRole("button", { name: "Actions" });
+ expect(actions.compareDocumentPosition(list) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ expect(screen.queryByRole("button", { name: "Show Hidden Tabs" })).toBeNull();
+ });
});
diff --git a/src/ui/Tabs.tsx b/src/ui/Tabs.tsx
index a48fd6a84..a768acf23 100644
--- a/src/ui/Tabs.tsx
+++ b/src/ui/Tabs.tsx
@@ -1,7 +1,7 @@
/**
- * Tab strip with the design's accent underline. Roving focus (←/→, Home/End),
- * closable tabs (button, middle click, Delete), horizontal wheel scrolling and
- * an overflow dropdown listing every tab when they don't fit.
+ * Tab strip with the design's accent underline. Roving focus (←/→ or ↑/↓ when
+ * vertical, Home/End), closable tabs (button, middle click, Delete), wheel
+ * scrolling and an overflow dropdown listing every tab when they don't fit.
*/
import {
createContext,
@@ -10,6 +10,7 @@ import {
useLayoutEffect,
useRef,
useState,
+ type CSSProperties,
type DragEvent,
type KeyboardEvent,
type MouseEvent,
@@ -35,6 +36,8 @@ export interface TabItem {
modified?: boolean;
/** CSS colour for the label (VCS status etc.), e.g. `var(--vcs-modified)`. */
color?: string;
+ /** CSS colour the tab background is tinted with (IDEA's data source / file colours). */
+ tint?: string;
italic?: boolean;
tooltip?: string;
/** Trailing content (counts, badges). */
@@ -91,6 +94,12 @@ export interface TabsProps {
panelIdPrefix?: string;
/** Enables drag & drop reordering (and moving between strips of the same type). */
dnd?: TabsDnd;
+ /** Tabs that don't fit: `scroll` the strip (default), `squeeze` them, or `wrap` into rows. */
+ layout?: "scroll" | "squeeze" | "wrap";
+ /** Side of the label the close button sits on. */
+ closePosition?: "right" | "left";
+ /** `vertical`: a column of tabs (editor tabs placed left / right); always scrolls, `layout` is ignored. */
+ orientation?: "horizontal" | "vertical";
}
export function Tabs({
@@ -106,8 +115,12 @@ export function Tabs({
className,
panelIdPrefix,
dnd,
+ layout = "scroll",
+ closePosition = "right",
+ orientation = "horizontal",
...aria
}: TabsProps) {
+ const vertical = orientation === "vertical";
const scrollRef = useRef<HTMLDivElement>(null);
const tabRefs = useRef(new Map<string, HTMLButtonElement>());
const [overflow, setOverflow] = useState(false);
@@ -136,12 +149,12 @@ export function Tabs({
);
const accepts = (e: DragEvent) => !!dnd && [...e.dataTransfer.types].includes(dnd.type);
- const indexAt = (x: number) =>
+ const indexAt = (e: DragEvent) =>
dropIndex(
- x,
+ vertical ? e.clientY : e.clientX,
items.map((it) => {
const r = tabRefs.current.get(it.id)?.parentElement?.getBoundingClientRect();
- return { left: r?.left ?? 0, width: r?.width ?? 0 };
+ return vertical ? { left: r?.top ?? 0, width: r?.height ?? 0 } : { left: r?.left ?? 0, width: r?.width ?? 0 };
}),
);
const dropHandlers = dnd
@@ -150,7 +163,7 @@ export function Tabs({
if (!accepts(e)) return;
e.preventDefault();
e.dataTransfer.dropEffect = "move";
- const i = indexAt(e.clientX);
+ const i = indexAt(e);
if (i !== drop) setDrop(i);
},
onDragLeave: (e: DragEvent<HTMLDivElement>) => {
@@ -160,7 +173,7 @@ export function Tabs({
if (!accepts(e)) return;
e.preventDefault();
const payload = e.dataTransfer.getData(dnd.type);
- const i = indexAt(e.clientX);
+ const i = indexAt(e);
setDrop(null);
if (payload) dnd.onDrop(payload, i);
},
@@ -170,20 +183,21 @@ export function Tabs({
useLayoutEffect(() => {
const el = scrollRef.current;
if (!el) return;
- const measure = () => setOverflow(el.scrollWidth > el.clientWidth + 1);
+ // A vertical strip shows its scrollbar instead of the overflow dropdown.
+ const measure = () => setOverflow(!vertical && el.scrollWidth > el.clientWidth + 1);
measure();
if (typeof ResizeObserver === "undefined") return;
const ro = new ResizeObserver(measure);
ro.observe(el);
return () => ro.disconnect();
- }, [items.length]);
+ }, [items.length, vertical]);
useEffect(() => {
// The whole tab (label + close button) into view, without scrolling any outer container.
const tab = activeId ? tabRefs.current.get(activeId)?.parentElement : null;
const scroller = scrollRef.current;
- if (tab && scroller) revealHorizontally(scroller, tab);
- }, [activeId]);
+ if (tab && scroller) (vertical ? revealVertically : revealHorizontally)(scroller, tab);
+ }, [activeId, vertical]);
const focusTab = (index: number) => {
const item = items[(index + items.length) % items.length];
@@ -195,10 +209,10 @@ export function Tabs({
const onKeyDown = (e: KeyboardEvent, index: number, item: TabItem) => {
if (e.metaKey || e.ctrlKey || e.altKey) return;
switch (e.key) {
- case "ArrowRight":
+ case vertical ? "ArrowDown" : "ArrowRight":
focusTab(index + 1);
break;
- case "ArrowLeft":
+ case vertical ? "ArrowUp" : "ArrowLeft":
focusTab(index - 1);
break;
case "Home":
@@ -227,15 +241,26 @@ export function Tabs({
}));
return (
- <div className={clsx(styles.strip, styles[variant], className)} {...dropHandlers}>
+ <div
+ className={clsx(
+ styles.strip,
+ styles[variant],
+ vertical ? styles.vertical : layout !== "scroll" && styles[layout],
+ closePosition === "left" && styles.closeLeft,
+ className,
+ )}
+ {...dropHandlers}
+ >
+ {vertical && trailing && <div className={styles.trailing}>{trailing}</div>}
<div
ref={scrollRef}
role="tablist"
- aria-label={aria["aria-label"]}
+ aria-label={tx(aria["aria-label"])}
+ aria-orientation={vertical ? "vertical" : undefined}
className={styles.scroller}
onWheel={(e) => {
const el = scrollRef.current;
- if (el && Math.abs(e.deltaY) > Math.abs(e.deltaX)) el.scrollLeft += e.deltaY;
+ if (el && !vertical && Math.abs(e.deltaY) > Math.abs(e.deltaX)) el.scrollLeft += e.deltaY;
}}
>
{items.map((item, index) => {
@@ -251,7 +276,9 @@ export function Tabs({
dragging === item.id && styles.dragging,
drop === index && styles.dropBefore,
drop === items.length && index === items.length - 1 && styles.dropAfter,
+ item.tint && styles.tinted,
)}
+ style={item.tint ? ({ "--tab-tint": item.tint } as CSSProperties) : undefined}
draggable={!!dnd}
onDragStart={
dnd
@@ -339,7 +366,7 @@ export function Tabs({
/>
</>
)}
- {trailing && <div className={styles.trailing}>{trailing}</div>}
+ {!vertical && trailing && <div className={styles.trailing}>{trailing}</div>}
</div>
);
}
@@ -351,3 +378,11 @@ export function revealHorizontally(scroller: HTMLElement, child: HTMLElement) {
if (c.left < s.left) scroller.scrollLeft -= s.left - c.left;
else if (c.right > s.right) scroller.scrollLeft += Math.min(c.right - s.right, c.left - s.left);
}
+
+/** Scrolls `scroller` vertically just enough to show all of `child`. */
+export function revealVertically(scroller: HTMLElement, child: HTMLElement) {
+ const s = scroller.getBoundingClientRect();
+ const c = child.getBoundingClientRect();
+ if (c.top < s.top) scroller.scrollTop -= s.top - c.top;
+ else if (c.bottom > s.bottom) scroller.scrollTop += Math.min(c.bottom - s.bottom, c.top - s.top);
+}
diff --git a/src/ui/Tree.tsx b/src/ui/Tree.tsx
index a38096b53..a5b07581c 100644
--- a/src/ui/Tree.tsx
+++ b/src/ui/Tree.tsx
@@ -28,6 +28,7 @@ import { fuzzyMatch } from "./match";
import { acquirePopup } from "./popupState";
import styles from "./Tree.module.css";
import { T } from "./T";
+import { tx } from "@/platform/i18n";
export interface TreeRowState {
depth: number;
@@ -466,7 +467,7 @@ export function Tree<T>(props: TreeProps<T>) {
<div
ref={scrollRef}
role="tree"
- aria-label={props["aria-label"]}
+ aria-label={tx(props["aria-label"])}
aria-multiselectable={multiSelect || undefined}
aria-activedescendant={
leadRow && !leadRow.loading && virtualizer.getVirtualItems().some((v) => v.index === leadIndex)
diff --git a/src/ui/icons.tsx b/src/ui/icons.tsx
index 9e7b66f9f..8cd450b90 100644
--- a/src/ui/icons.tsx
+++ b/src/ui/icons.tsx
@@ -182,6 +182,8 @@ const ICONS = {
"text-match": "openidea/nodes/textMatch",
"open-in-tool-window": "general/openInToolWindow",
"preserve-case": "openidea/inline/preserveCase",
+ "new-line": "openidea/inline/newLine",
+ "search-history": "openidea/inline/searchHistory",
filter: "general/filter",
refresh: "general/refresh",
settings: "general/settings",
@@ -253,6 +255,18 @@ const ICONS = {
"db-sqlite": "openidea/database/sqlite",
"db-postgres": "openidea/database/postgres",
"db-mysql": "openidea/database/mysql",
+ "db-mariadb": "openidea/database/mariadb",
+ "db-aurora": "openidea/database/aurora",
+ "db-redshift": "openidea/database/redshift",
+ "db-cockroach": "openidea/database/cockroach",
+ "db-greenplum": "openidea/database/greenplum",
+ "db-neon": "openidea/database/neon",
+ "db-oceanbase": "openidea/database/oceanbase",
+ "db-singlestore": "openidea/database/singlestore",
+ "db-supabase": "openidea/database/supabase",
+ "db-tidb": "openidea/database/tidb",
+ "db-timescale": "openidea/database/timescale",
+ "db-yugabyte": "openidea/database/yugabyte",
export: "openidea/general/export",
web: "openidea/general/web",
"browser-chrome": "openidea/browsers/chrome",
@@ -790,8 +804,17 @@ const EXT_ICONS = table({
/** Source files for languages without a file-type icon. */
const CODE_EXT = new Set(["astro", "nim", "wit", "wat", "sol", "v", "sv"]);
+let iconOverride: ((fileName: string) => IconName | null) | null = null;
+
+/** Lets the user's file type associations (Settings › File Types) pick icons first. */
+export function setFileIconOverride(resolve: ((fileName: string) => IconName | null) | null) {
+ iconOverride = resolve;
+}
+
/** Picks a file-type icon from a file name. */
export function fileIconName(fileName: string): IconName {
+ const custom = iconOverride?.(fileName);
+ if (custom) return custom;
const lower = fileName.toLowerCase();
const named = FILE_NAMES[lower] ?? NAME_PATTERNS.find(([re]) => re.test(lower))?.[1];
if (named) return named;
diff --git a/src/ui/openidea/database/aurora.svg b/src/ui/openidea/database/aurora.svg
new file mode 100644
index 000000000..58152fae8
--- /dev/null
+++ b/src/ui/openidea/database/aurora.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: Amazon Aurora data source (cylinder) -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2.5 4V12C2.5 13.1 5 14 8 14C11 14 13.5 13.1 13.5 12V4" fill="#3B48CC"/><ellipse cx="8" cy="4" rx="5.5" ry="2" fill="#5A6BEF"/><path d="M2.5 8C2.5 9.1 5 10 8 10C11 10 13.5 9.1 13.5 8" stroke="#FFFFFF" stroke-width="0.8"/>
+</svg>
diff --git a/src/ui/openidea/database/cockroach.svg b/src/ui/openidea/database/cockroach.svg
new file mode 100644
index 000000000..ceb835b8b
--- /dev/null
+++ b/src/ui/openidea/database/cockroach.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: CockroachDB data source (insect mark) -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M8 4.2C6.6 2.6 4.6 1.9 2.6 2.2C2.4 5.6 4.4 8.7 8 10.4C11.6 8.7 13.6 5.6 13.4 2.2C11.4 1.9 9.4 2.6 8 4.2Z" stroke="#6933FF" stroke-width="1.3" stroke-linejoin="round"/><path d="M8 4.2V14" stroke="#6933FF" stroke-width="1.3" stroke-linecap="round"/>
+</svg>
diff --git a/src/ui/openidea/database/greenplum.svg b/src/ui/openidea/database/greenplum.svg
new file mode 100644
index 000000000..630269789
--- /dev/null
+++ b/src/ui/openidea/database/greenplum.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: Greenplum data source (ring) -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="8" cy="8" r="6" stroke="#8DC63F" stroke-width="1.6"/><path d="M5.5 10.5C6 7.5 8 5.6 11 5.4C10.8 8.3 8.6 10.4 5.5 10.5Z" fill="#3AA14A"/>
+</svg>
diff --git a/src/ui/openidea/database/mariadb.svg b/src/ui/openidea/database/mariadb.svg
new file mode 100644
index 000000000..af5229093
--- /dev/null
+++ b/src/ui/openidea/database/mariadb.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: MariaDB data source (seal) -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M14.5 2.5C13 2.6 12.4 3.6 11.4 4.4C9.6 5.8 7.4 5.4 5.6 6.6C3.6 7.9 3 10.4 1.5 12.6C3.4 11.6 4.4 12.4 6.4 11.3C8.1 10.3 8.8 8.4 10.4 7.4C11.9 6.4 13.9 5.9 14.5 2.5Z" fill="#C0765A"/><circle cx="12.4" cy="4.5" r="0.6" fill="#FFFFFF"/>
+</svg>
diff --git a/src/ui/openidea/database/neon.svg b/src/ui/openidea/database/neon.svg
new file mode 100644
index 000000000..a0e2a20f7
--- /dev/null
+++ b/src/ui/openidea/database/neon.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: Neon data source -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect x="2" y="2" width="12" height="12" rx="3" fill="#00E599"/><path d="M5.5 11V5L10.5 11V7" stroke="#0C2B21" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/src/ui/openidea/database/oceanbase.svg b/src/ui/openidea/database/oceanbase.svg
new file mode 100644
index 000000000..2e11eac71
--- /dev/null
+++ b/src/ui/openidea/database/oceanbase.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: OceanBase data source (wave) -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="8" cy="8" r="6.5" fill="#006AFF"/><path d="M3.5 9C5 7.2 6.5 7.2 8 9C9.5 10.8 11 10.8 12.5 9" stroke="#FFFFFF" stroke-width="1.3" stroke-linecap="round"/>
+</svg>
diff --git a/src/ui/openidea/database/redshift.svg b/src/ui/openidea/database/redshift.svg
new file mode 100644
index 000000000..63e56c2d0
--- /dev/null
+++ b/src/ui/openidea/database/redshift.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: Amazon Redshift data source (columns) -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M2 3.5L5 2.5V13.5L2 12.5V3.5Z" fill="#2E73B8"/><path d="M14 3.5L11 2.5V13.5L14 12.5V3.5Z" fill="#205B98"/><rect x="6" y="2" width="4" height="12" rx="0.5" fill="#5294CF"/>
+</svg>
diff --git a/src/ui/openidea/database/singlestore.svg b/src/ui/openidea/database/singlestore.svg
new file mode 100644
index 000000000..fd3b838dc
--- /dev/null
+++ b/src/ui/openidea/database/singlestore.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: SingleStore data source -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M13 4.5A6 6 0 1 0 13.5 10" stroke="#AA00FF" stroke-width="1.8" stroke-linecap="round"/><circle cx="8" cy="8" r="2" fill="#AA00FF"/>
+</svg>
diff --git a/src/ui/openidea/database/supabase.svg b/src/ui/openidea/database/supabase.svg
new file mode 100644
index 000000000..1545d2dc4
--- /dev/null
+++ b/src/ui/openidea/database/supabase.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: Supabase data source (bolt) -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M9 1.5L2.5 9.5H8L7 14.5L13.5 6.5H8L9 1.5Z" fill="#3ECF8E" stroke="#249361" stroke-width="0.8" stroke-linejoin="round"/>
+</svg>
diff --git a/src/ui/openidea/database/tidb.svg b/src/ui/openidea/database/tidb.svg
new file mode 100644
index 000000000..88f6e114b
--- /dev/null
+++ b/src/ui/openidea/database/tidb.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: TiDB data source (hexagon) -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M8 1.5L13.6 4.75V11.25L8 14.5L2.4 11.25V4.75L8 1.5Z" fill="#E30C34"/><path d="M5.5 6H10.5M8 6V11.5" stroke="#FFFFFF" stroke-width="1.3" stroke-linecap="round"/>
+</svg>
diff --git a/src/ui/openidea/database/timescale.svg b/src/ui/openidea/database/timescale.svg
new file mode 100644
index 000000000..bc9b817b8
--- /dev/null
+++ b/src/ui/openidea/database/timescale.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: TimescaleDB data source (tiger stripes) -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect x="2" y="2" width="12" height="12" rx="3" fill="#FDB515"/><path d="M5 2.5L7 8L5 13.5M9 2.5L11 8L9 13.5" stroke="#141E35" stroke-width="1.3" stroke-linejoin="round"/>
+</svg>
diff --git a/src/ui/openidea/database/yugabyte.svg b/src/ui/openidea/database/yugabyte.svg
new file mode 100644
index 000000000..b1b9d67b5
--- /dev/null
+++ b/src/ui/openidea/database/yugabyte.svg
@@ -0,0 +1,4 @@
+<!-- OpenIDEA: YugabyteDB data source -->
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M3 2.5L8 8.5L13 2.5" stroke="#FF6E42" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><path d="M8 8.5V13.5" stroke="#FF6E42" stroke-width="1.8" stroke-linecap="round"/>
+</svg>
diff --git a/src/ui/openidea/inline/newLine.svg b/src/ui/openidea/inline/newLine.svg
new file mode 100644
index 000000000..ef17e8ff1
--- /dev/null
+++ b/src/ui/openidea/inline/newLine.svg
@@ -0,0 +1,4 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M12.5 3V8.5C12.5 9.32843 11.8284 10 11 10H3" stroke="#6C707E" stroke-linecap="round"/>
+<path d="M5.5 7.5L3 10L5.5 12.5" stroke="#6C707E" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/src/ui/openidea/inline/newLine_dark.svg b/src/ui/openidea/inline/newLine_dark.svg
new file mode 100644
index 000000000..fd64540d6
--- /dev/null
+++ b/src/ui/openidea/inline/newLine_dark.svg
@@ -0,0 +1,4 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M12.5 3V8.5C12.5 9.32843 11.8284 10 11 10H3" stroke="#CED0D6" stroke-linecap="round"/>
+<path d="M5.5 7.5L3 10L5.5 12.5" stroke="#CED0D6" stroke-linecap="round" stroke-linejoin="round"/>
+</svg>
diff --git a/src/ui/openidea/inline/searchHistory.svg b/src/ui/openidea/inline/searchHistory.svg
new file mode 100644
index 000000000..dad03f4c1
--- /dev/null
+++ b/src/ui/openidea/inline/searchHistory.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="6" cy="6" r="3.5" stroke="#6C707E"/>
+<path d="M8.5 8.5L11.5 11.5" stroke="#6C707E" stroke-linecap="round"/>
+<path d="M11 5H15L13 7.5L11 5Z" fill="#6C707E"/>
+</svg>
diff --git a/src/ui/openidea/inline/searchHistory_dark.svg b/src/ui/openidea/inline/searchHistory_dark.svg
new file mode 100644
index 000000000..6113d010b
--- /dev/null
+++ b/src/ui/openidea/inline/searchHistory_dark.svg
@@ -0,0 +1,5 @@
+<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+<circle cx="6" cy="6" r="3.5" stroke="#CED0D6"/>
+<path d="M8.5 8.5L11.5 11.5" stroke="#CED0D6" stroke-linecap="round"/>
+<path d="M11 5H15L13 7.5L11 5Z" fill="#CED0D6"/>
+</svg>
diff --git a/src/workbench/MainToolbarDialog.module.css b/src/workbench/MainToolbarDialog.module.css
new file mode 100644
index 000000000..1259a3233
--- /dev/null
+++ b/src/workbench/MainToolbarDialog.module.css
@@ -0,0 +1,75 @@
+.body {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ padding: 14px;
+}
+.sides {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 12px;
+}
+.side {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ min-width: 0;
+}
+.heading {
+ margin: 0;
+ color: var(--fg-secondary);
+ font-size: var(--fs-small);
+ font-weight: 600;
+}
+.list {
+ height: 200px;
+ border: 1px solid var(--border);
+ border-radius: var(--radius-control);
+}
+.row {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ min-width: 0;
+ flex: 1;
+ padding: 0 6px;
+}
+.activeRow .rowLabel {
+ color: var(--fg-strong);
+}
+.rowIcon {
+ flex: none;
+ color: var(--fg-muted);
+}
+.rowLabel {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.rowDetail {
+ margin-left: auto;
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+ white-space: nowrap;
+}
+.empty {
+ padding: 6px 8px;
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+}
+.buttons {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+}
+.picker {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+}
+.pickerList {
+ height: 180px;
+ border: 1px solid var(--border);
+ border-radius: var(--radius-control);
+}
diff --git a/src/workbench/MainToolbarDialog.tsx b/src/workbench/MainToolbarDialog.tsx
new file mode 100644
index 000000000..7bdd653fd
--- /dev/null
+++ b/src/workbench/MainToolbarDialog.tsx
@@ -0,0 +1,224 @@
+/** Customize Main Toolbar dialog: the entries of each side, reorderable, plus added actions. */
+import { useMemo, useState } from "react";
+import clsx from "clsx";
+import { create } from "zustand";
+import { allActions } from "@/platform/actions";
+import { t } from "@/platform/i18n";
+import { Button, Dialog, Icon, List, SearchField, T, fuzzyMatch } from "@/ui";
+import { useContributions } from "./contributions";
+import {
+ ACTION_PREFIX,
+ editableToolbar,
+ isActionEntry,
+ saveToolbar,
+ defaultToolbar,
+ entryAction,
+ useMainToolbarSettings,
+ widgetTitle,
+ type ToolbarLayout,
+} from "./mainToolbar";
+import styles from "./MainToolbarDialog.module.css";
+
+const useCustomize = create<{ open: boolean }>(() => ({ open: false }));
+export const showCustomizeToolbar = () => useCustomize.setState({ open: true });
+
+export function MainToolbarDialogHost() {
+ const open = useCustomize((s) => s.open);
+ return open ? <CustomizeDialog onClose={() => useCustomize.setState({ open: false })} /> : null;
+}
+
+type Side = "left" | "right";
+const SIDES: Side[] = ["left", "right"];
+
+function move(layout: ToolbarLayout, side: Side, index: number, delta: -1 | 1): ToolbarLayout {
+ const list = [...layout[side]];
+ const j = index + delta;
+ if (j < 0 || j >= list.length) return layout;
+ [list[index], list[j]] = [list[j]!, list[index]!];
+ return { ...layout, [side]: list };
+}
+
+function remove(layout: ToolbarLayout, side: Side, index: number): ToolbarLayout {
+ const id = layout[side][index];
+ if (id === undefined) return layout;
+ return {
+ ...layout,
+ [side]: layout[side].filter((_, i) => i !== index),
+ hidden: isActionEntry(id) || layout.hidden.includes(id) ? layout.hidden : [...layout.hidden, id],
+ };
+}
+
+function CustomizeDialog({ onClose }: { onClose: () => void }) {
+ const items = useContributions((s) => s.titleItems);
+ const saved = useMainToolbarSettings();
+ const [layout, setLayout] = useState<ToolbarLayout>(() => editableToolbar(saved, items.values()));
+ const [sel, setSel] = useState<{ side: Side; index: number }>({ side: "left", index: 0 });
+ const [adding, setAdding] = useState(false);
+ const selected = layout[sel.side][sel.index];
+
+ const apply = async () => {
+ await saveToolbar(layout);
+ onClose();
+ };
+ const add = (id: string) => {
+ const side = sel.side;
+ const at = selected === undefined ? layout[side].length : sel.index + 1;
+ const list = [...layout[side].filter((x) => x !== id)];
+ list.splice(Math.min(at, list.length), 0, id);
+ setLayout({ ...layout, [side]: list, hidden: layout.hidden.filter((x) => x !== id) });
+ setSel({ side, index: list.indexOf(id) });
+ setAdding(false);
+ };
+
+ return (
+ <Dialog
+ open
+ title="Customize Main Toolbar"
+ onClose={onClose}
+ width={620}
+ footerStart={
+ <Button
+ onClick={() => {
+ setLayout(defaultToolbar(items.values()));
+ setSel({ side: "left", index: 0 });
+ }}
+ >
+ <T>Restore Defaults</T>
+ </Button>
+ }
+ buttons={[
+ { label: "OK", role: "default", onClick: () => void apply() },
+ { label: t("common.cancel"), role: "cancel" },
+ ]}
+ >
+ <div className={styles.body}>
+ <div className={styles.sides}>
+ {SIDES.map((side) => (
+ <section key={side} className={styles.side} aria-label={side === "left" ? "Left" : "Right"}>
+ <h3 className={styles.heading}>{side === "left" ? <T>Left</T> : <T>Right</T>}</h3>
+ <List
+ items={layout[side]}
+ getKey={(id) => id}
+ activeIndex={sel.side === side ? sel.index : -1}
+ onActiveChange={(index) => setSel({ side, index })}
+ rowHeight={24}
+ className={styles.list}
+ aria-label={side === "left" ? "Left group" : "Right group"}
+ empty={
+ <div className={styles.empty}>
+ <T>Empty</T>
+ </div>
+ }
+ renderItem={(id) => (
+ <div className={styles.row}>
+ <Icon name={isActionEntry(id) ? (allActionIcon(id) ?? "run") : "main-menu"} size={14} className={styles.rowIcon} />
+ <span className={styles.rowLabel}>{widgetTitle(id, items)}</span>
+ </div>
+ )}
+ />
+ </section>
+ ))}
+ </div>
+ <div className={styles.buttons}>
+ <Button onClick={() => setAdding((v) => !v)} aria-expanded={adding}>
+ <T>Add…</T>
+ </Button>
+ <Button
+ disabled={selected === undefined}
+ onClick={() => {
+ setLayout(remove(layout, sel.side, sel.index));
+ setSel({ ...sel, index: Math.max(0, sel.index - 1) });
+ }}
+ >
+ <T>Remove</T>
+ </Button>
+ <Button
+ disabled={sel.index <= 0 || selected === undefined}
+ onClick={() => {
+ setLayout(move(layout, sel.side, sel.index, -1));
+ setSel({ ...sel, index: sel.index - 1 });
+ }}
+ >
+ <T>Move Up</T>
+ </Button>
+ <Button
+ disabled={selected === undefined || sel.index >= layout[sel.side].length - 1}
+ onClick={() => {
+ setLayout(move(layout, sel.side, sel.index, 1));
+ setSel({ ...sel, index: sel.index + 1 });
+ }}
+ >
+ <T>Move Down</T>
+ </Button>
+ <Button
+ disabled={selected === undefined}
+ onClick={() => {
+ if (selected === undefined) return;
+ const other: Side = sel.side === "left" ? "right" : "left";
+ setLayout({
+ ...layout,
+ [sel.side]: layout[sel.side].filter((_, i) => i !== sel.index),
+ [other]: [...layout[other], selected],
+ });
+ setSel({ side: other, index: layout[other].length });
+ }}
+ >
+ {sel.side === "left" ? <T>Move to Right</T> : <T>Move to Left</T>}
+ </Button>
+ </div>
+ {adding && <AddPicker hidden={layout.hidden} present={[...layout.left, ...layout.right]} onPick={add} />}
+ </div>
+ </Dialog>
+ );
+}
+
+function allActionIcon(id: string): string | undefined {
+ return allActions().find((a) => a.id === entryAction(id))?.icon;
+}
+
+/** Removed widgets, then every visible action with an icon, filtered by the query. */
+function AddPicker({ hidden, present, onPick }: { hidden: string[]; present: string[]; onPick: (id: string) => void }) {
+ const items = useContributions((s) => s.titleItems);
+ const [query, setQuery] = useState("");
+ const [active, setActive] = useState(0);
+ const candidates = useMemo(() => {
+ const widgets = hidden.map((id) => ({ id, label: widgetTitle(id, items), detail: "Widget", icon: "main-menu" }));
+ const actions = allActions()
+ .filter((a) => !a.hidden && a.icon && !present.includes(`${ACTION_PREFIX}${a.id}`))
+ .map((a) => ({ id: `${ACTION_PREFIX}${a.id}`, label: a.title, detail: a.category ?? "", icon: a.icon! }))
+ .sort((a, b) => a.label.localeCompare(b.label));
+ const all = [...widgets, ...actions];
+ return query.trim() ? all.filter((c) => fuzzyMatch(c.label, query.trim())) : all;
+ }, [hidden, present, items, query]);
+ return (
+ <div className={styles.picker}>
+ <SearchField
+ value={query}
+ onChange={(v) => {
+ setQuery(v);
+ setActive(0);
+ }}
+ placeholder="Search actions"
+ aria-label="Search actions"
+ autoFocus
+ />
+ <List
+ items={candidates}
+ getKey={(c) => c.id}
+ activeIndex={active}
+ onActiveChange={setActive}
+ onActivate={(c) => onPick(c.id)}
+ rowHeight={24}
+ className={styles.pickerList}
+ aria-label="Actions and widgets to add"
+ renderItem={(c, state) => (
+ <div className={clsx(styles.row, state.active && styles.activeRow)}>
+ <Icon name={c.icon} size={14} className={styles.rowIcon} />
+ <span className={styles.rowLabel}>{c.label}</span>
+ <span className={styles.rowDetail}>{c.detail}</span>
+ </div>
+ )}
+ />
+ </div>
+ );
+}
diff --git a/src/workbench/Notifications.tsx b/src/workbench/Notifications.tsx
index 437f4a9a2..d81306ffa 100644
--- a/src/workbench/Notifications.tsx
+++ b/src/workbench/Notifications.tsx
@@ -3,10 +3,12 @@ import { useTxTemplate } from "@/platform/i18n";
import { EmptyState, IconButton, Toast, T } from "@/ui";
import {
balloonTimeout,
+ canSuppress,
clearNotifications,
dismissBalloon,
markAllNotificationsRead,
removeNotification,
+ suppressGroup,
useNotifications,
type IdeNotification,
} from "./notificationStore";
@@ -34,6 +36,15 @@ function useWindowActive(): boolean {
return useSyncExternalStore(subscribeWindowFocus, () => document.hasFocus(), () => true);
}
+const DONT_SHOW_AGAIN = "Don't Show Again";
+
+/** The notification's own actions, then "Don't Show Again" for its group (IDEA). */
+export function notificationActions(n: IdeNotification, wrap: (run: () => void) => () => void = (r) => r) {
+ const own = n.actions ?? [];
+ if (!canSuppress(n)) return own;
+ return [...own, { label: DONT_SHOW_AGAIN, run: wrap(() => void suppressGroup(n.group).catch(() => {})) }];
+}
+
function Balloon({ n }: { n: IdeNotification }) {
const [hover, setHover] = useState(false);
const active = useWindowActive();
@@ -57,7 +68,7 @@ function Balloon({ n }: { n: IdeNotification }) {
level={n.level}
title={txt(n.title)}
body={n.body}
- actions={n.actions?.map((a) => ({
+ actions={notificationActions(n).map((a) => ({
label: txt(a.label),
run: () => {
dismissBalloon(n.id);
@@ -120,7 +131,7 @@ export function NotificationsToolWindow() {
title={txt(n.title)}
body={n.body}
meta={timeLabel(n.time)}
- actions={n.actions?.map((a) => ({ ...a, label: txt(a.label) }))}
+ actions={notificationActions(n).map((a) => ({ ...a, label: txt(a.label) }))}
onClose={() => removeNotification(n.id)}
/>
))
diff --git a/src/workbench/OverlayHost.tsx b/src/workbench/OverlayHost.tsx
index 00f7b4487..dbfe9349c 100644
--- a/src/workbench/OverlayHost.tsx
+++ b/src/workbench/OverlayHost.tsx
@@ -1,6 +1,7 @@
import { ContextMenuHost, TooltipHost } from "@/ui";
import { useContributions } from "./contributions";
import { ErrorBoundary } from "./ErrorBoundary";
+import { InputDialogsHost } from "./inputDialogs";
import { MessagesHost } from "./messages";
import { Balloons } from "./Notifications";
@@ -15,6 +16,7 @@ export function OverlayHost() {
</ErrorBoundary>
))}
<MessagesHost />
+ <InputDialogsHost />
<Balloons />
<ContextMenuHost />
<TooltipHost />
diff --git a/src/workbench/TitleBar.test.tsx b/src/workbench/TitleBar.test.tsx
index d33f1e897..eccac34b0 100644
--- a/src/workbench/TitleBar.test.tsx
+++ b/src/workbench/TitleBar.test.tsx
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, it } from "vitest";
import { fireEvent, render, screen } from "@testing-library/react";
import { registerActions } from "@/platform/actions";
import { useThemeOverride } from "./theme";
-import { gearMenuItems, TitleBar } from "./TitleBar";
+import { customizeToolbarItems, gearMenuItems, TitleBar } from "./TitleBar";
let disposers: Array<() => void> = [];
afterEach(() => {
@@ -12,22 +12,53 @@ afterEach(() => {
});
describe("title bar gear menu", () => {
- it("lists Settings, Plugins, Theme and Keymap switches and Check for Updates", () => {
+ it("lists Run Anything, Settings, Plugins, quick switches, toolbar customization and Check for Updates", () => {
const items = gearMenuItems("dark", "intellij-macos", ["Mine"]);
expect(items.map((i) => ("action" in i ? i.action : "label" in i ? i.label : i.kind))).toEqual([
+ "runAnything.show",
+ "separator",
"file.settings",
"plugins.settings",
"separator",
"Theme",
"Keymap",
+ "View Mode",
+ "separator",
+ "Customize Main Toolbar",
"separator",
"app.checkForUpdates",
]);
- const theme = (items[3] as { submenu: Array<{ label?: string; checked?: boolean }> }).submenu;
+ type Sub = { submenu: Array<{ label?: string; checked?: boolean; action?: string }> };
+ const theme = (items[5] as Sub).submenu;
expect(theme.filter((i) => i.checked).map((i) => i.label)).toEqual(["Islands Dark"]);
- const keymap = (items[4] as { submenu: Array<{ label?: string; checked?: boolean }> }).submenu;
+ const keymap = (items[6] as Sub).submenu;
expect(keymap.map((i) => i.label)).toContain("Mine");
expect(keymap.filter((i) => i.checked).map((i) => i.label)).toEqual(["macOS"]);
+ // View Mode only switches the existing modes.
+ expect((items[7] as Sub).submenu.map((i) => i.action)).toEqual(["editor.toggleZen", "window.toggleFullScreen"]);
+ });
+
+ it("lists every widget with a checkbox in Customize Main Toolbar", () => {
+ const toggled: string[] = [];
+ let reset = 0;
+ const items = customizeToolbarItems(
+ { left: ["project", "vcs.branch"], right: ["action:navigate.searchEverywhere"] },
+ ["run.widget"],
+ new Map([["run.widget", { id: "run.widget", align: "right", priority: 1, component: () => null, title: "Run Widget" }]]),
+ (id) => toggled.push(id),
+ () => void reset++,
+ );
+ const rows = items.filter((i): i is { id: string; label: string; checked: boolean; run: () => void } => "checked" in i);
+ expect(rows.map((r) => [r.label, r.checked])).toEqual([
+ ["Project Widget", true],
+ ["VCS Widget", true],
+ ["navigate.searchEverywhere", true],
+ ["Run Widget", false],
+ ]);
+ rows[3]!.run();
+ expect(toggled).toEqual(["run.widget"]);
+ (items.at(-1) as { run: () => void }).run();
+ expect(reset).toBe(1);
});
it("opens a menu instead of Settings directly, and switches the theme", async () => {
diff --git a/src/workbench/TitleBar.tsx b/src/workbench/TitleBar.tsx
index 8035a3db8..86f4b70b1 100644
--- a/src/workbench/TitleBar.tsx
+++ b/src/workbench/TitleBar.tsx
@@ -1,17 +1,30 @@
import { useMemo, useRef, useState } from "react";
import clsx from "clsx";
import { useActions } from "@/platform/actions";
-import { call, commands, isTauri } from "@/platform/ipc";
-import { PRESET_TITLES, shortcutLabel, useKeymap } from "@/platform/keymap";
+import { shortcutLabel, useKeymap } from "@/platform/keymap";
import { useProject } from "@/platform/project";
-import { BarButton, Icon, IconButton, Menu, type MenuItem, T } from "@/ui";
+import { BarButton, Icon, IconButton, Menu, type MenuItem, showContextMenu, T } from "@/ui";
import { useContributions, useWorkbenchSlots, type TitleItemContribution } from "./contributions";
import { ErrorBoundary, Slot } from "./ErrorBoundary";
import { MainMenu } from "./MainMenu";
+import {
+ editableToolbar,
+ entryAction,
+ isActionEntry,
+ PROJECT_WIDGET,
+ resolveToolbar,
+ saveToolbar,
+ SEARCH_ENTRY,
+ toggleWidget,
+ useMainToolbarSettings,
+ VCS_WIDGET,
+ widgetTitle,
+} from "./mainToolbar";
import { WindowControls } from "./WindowControls";
import { usePlatform } from "@/platform/platformInfo";
import { projectInitials } from "./projectColor";
-import { currentThemeId, setTheme, THEME_CHOICES, useThemeOverride } from "./theme";
+import { keymapItems, themeItems, VIEW_MODE_ITEMS } from "./quickSwitch";
+import { currentThemeId, useThemeOverride } from "./theme";
import styles from "./TitleBar.module.css";
export function orderTitleItems(items: Iterable<TitleItemContribution>) {
@@ -106,56 +119,81 @@ function VcsFallback() {
);
}
-async function selectKeymap(id: string) {
- if (!isTauri()) return;
- try {
- useProject.setState({ settings: await call(commands.settingsSet("global", "keymap", JSON.stringify(id))) });
- } catch (e) {
- console.warn("cannot switch keymap", e);
- }
+/**
+ * Customize Main Toolbar ›: a checkbox per widget (and added action), then the
+ * dialog and Restore Default. Also the title bar's context menu.
+ */
+export function customizeToolbarItems(
+ shown: { left: string[]; right: string[] },
+ hidden: readonly string[],
+ items: ReadonlyMap<string, TitleItemContribution>,
+ toggle: (id: string) => void,
+ reset: () => void,
+): MenuItem[] {
+ const entries = [...shown.left, ...shown.right, ...hidden.filter((id) => !isActionEntry(id))];
+ return [
+ ...entries.map<MenuItem>((id) => ({
+ id: `toolbar.${id}`,
+ label: widgetTitle(id, items),
+ checked: !hidden.includes(id),
+ run: () => toggle(id),
+ })),
+ { kind: "separator" },
+ { kind: "action", action: "toolbar.customize", label: "Customize Toolbar…" },
+ { id: "toolbar.reset", label: "Restore Default Toolbar", run: reset },
+ ];
}
-/** IDEA's main toolbar gear: Settings, Plugins, quick Theme / Keymap switches, Check for Updates. */
-export function gearMenuItems(themeId: string, keymapId: string, customKeymaps: string[]): MenuItem[] {
+/** IDEA's main toolbar gear: Run Anything, Settings, Plugins, quick switches, toolbar customization, updates. */
+export function gearMenuItems(
+ themeId: string,
+ keymapId: string,
+ customKeymaps: string[],
+ customize: MenuItem[] = [{ kind: "action", action: "toolbar.customize", label: "Customize Toolbar…" }],
+): MenuItem[] {
return [
+ { kind: "action", action: "runAnything.show" },
+ { kind: "separator" },
{ kind: "action", action: "file.settings" },
{ kind: "action", action: "plugins.settings" },
{ kind: "separator" },
{
id: "gear.theme",
label: "Theme",
- submenu: [
- ...THEME_CHOICES.map<MenuItem>((c) => ({
- id: `theme.${c.id}`,
- label: c.label,
- checked: c.id === themeId,
- run: () => void setTheme(c.id),
- })),
- { kind: "separator" },
- { kind: "action", action: "settings.appearance" },
- ],
+ submenu: [...themeItems(themeId), { kind: "separator" }, { kind: "action", action: "settings.appearance" }],
},
{
id: "gear.keymap",
label: "Keymap",
submenu: [
- ...[...Object.keys(PRESET_TITLES), ...customKeymaps].map<MenuItem>((id) => ({
- id: `keymap.${id}`,
- label: PRESET_TITLES[id] ?? id,
- verbatim: !PRESET_TITLES[id],
- checked: id === keymapId,
- run: () => void selectKeymap(id),
- })),
+ ...keymapItems(keymapId, customKeymaps),
{ kind: "separator" },
{ kind: "action", action: "settings.keymap", label: "Configure Keymap…" },
],
},
+ { id: "gear.viewMode", label: "View Mode", submenu: VIEW_MODE_ITEMS },
+ { kind: "separator" },
+ { id: "gear.customizeToolbar", label: "Customize Main Toolbar", submenu: customize },
{ kind: "separator" },
{ kind: "action", action: "app.checkForUpdates" },
];
}
-function GearButton() {
+/** Toolbar entries and the customization menu, from the saved layout. */
+function useToolbar() {
+ const map = useContributions((s) => s.titleItems);
+ const saved = useMainToolbarSettings();
+ const shown = useMemo(() => resolveToolbar(saved, map.values()), [saved, map]);
+ const toggle = (id: string) => {
+ const layout = editableToolbar(saved, map.values());
+ const side = map.get(id)?.align ?? (id === SEARCH_ENTRY ? "right" : "left");
+ void saveToolbar(toggleWidget(layout, id, side));
+ };
+ const menu = customizeToolbarItems(shown, saved?.hidden ?? [], map, toggle, () => void saveToolbar(null));
+ return { map, shown, menu };
+}
+
+function GearButton({ customize }: { customize: MenuItem[] }) {
const [open, setOpen] = useState(false);
const ref = useRef<HTMLButtonElement>(null);
const settings = useProject((s) => s.settings);
@@ -167,6 +205,7 @@ function GearButton() {
currentThemeId(),
typeof settings?.keymap === "string" ? settings.keymap : preset,
customs && typeof customs === "object" ? Object.keys(customs) : [],
+ customize,
);
return (
<>
@@ -191,6 +230,30 @@ function GearButton() {
);
}
+/** One main toolbar entry: a built-in widget, a contributed one or an added action. */
+function ToolbarEntry({ id, items }: { id: string; items: ReadonlyMap<string, TitleItemContribution> }) {
+ const actions = useActions((s) => s.actions);
+ if (id === PROJECT_WIDGET) return <ProjectButton />;
+ const item = items.get(id);
+ if (item) return <TitleItem item={item} />;
+ if (id === VCS_WIDGET) return <VcsFallback />;
+ if (!isActionEntry(id)) return null;
+ const action = actions.get(entryAction(id));
+ if (!action) return null;
+ return (
+ <div className={styles.tools}>
+ <IconButton
+ icon={action.icon ?? "run"}
+ action={action.id}
+ title={action.title}
+ shortcut={shortcutLabel(action.id) ?? (action.id === "navigate.searchEverywhere" ? "⇧⇧" : undefined)}
+ iconSize={18}
+ className={styles.tool}
+ />
+ </div>
+ );
+}
+
/**
* 40px main toolbar. macOS: native traffic lights overlay its left edge.
* Windows: the window is frameless, so the bar carries IDEA's main menu (☰) and
@@ -209,8 +272,7 @@ export function TitleBar({
}) {
const overlay = usePlatform((s) => s.overlayTitleBar);
const frameless = usePlatform((s) => s.framelessTitleBar);
- const map = useContributions((s) => s.titleItems);
- const { left, right } = useMemo(() => orderTitleItems(map.values()), [map]);
+ const { map, shown, menu } = useToolbar();
const [menuExpanded, setMenuExpanded] = useState(false);
const className = clsx(styles.bar, overlay && styles.overlay, frameless && styles.frameless);
if (bare)
@@ -224,36 +286,30 @@ export function TitleBar({
)}
</header>
);
+ const entry = (id: string) => <ToolbarEntry key={id} id={id} items={map} />;
return (
- <header className={clsx(className, minimal && styles.minimal)} data-tauri-drag-region>
+ <header
+ className={clsx(className, minimal && styles.minimal)}
+ data-tauri-drag-region
+ onContextMenu={(e) => {
+ if (minimal || e.defaultPrevented) return;
+ e.preventDefault();
+ showContextMenu(e, menu);
+ }}
+ >
{frameless && !minimal && <MainMenu onExpandedChange={setMenuExpanded} />}
{title && (
<span className={styles.windowTitle} data-tauri-drag-region>
{typeof title === "string" ? <T>{title}</T> : title}
</span>
)}
- {!minimal && !menuExpanded && (
- <>
- <ProjectButton />
- {left.length > 0 ? left.map((i) => <TitleItem key={i.id} item={i} />) : <VcsFallback />}
- </>
- )}
+ {!minimal && !menuExpanded && shown.left.map(entry)}
<div className={styles.drag} data-tauri-drag-region />
{!minimal && (
<>
- {right.map((i) => (
- <TitleItem key={i.id} item={i} />
- ))}
+ {shown.right.map(entry)}
<div className={styles.tools}>
- <IconButton
- icon="search"
- action="navigate.searchEverywhere"
- title="Search Everywhere"
- shortcut={shortcutLabel("navigate.searchEverywhere") ?? "⇧⇧"}
- iconSize={18}
- className={styles.tool}
- />
- <GearButton />
+ <GearButton customize={menu} />
</div>
</>
)}
diff --git a/src/workbench/Workbench.test.tsx b/src/workbench/Workbench.test.tsx
index c17902ebb..6cb74fba6 100644
--- a/src/workbench/Workbench.test.tsx
+++ b/src/workbench/Workbench.test.tsx
@@ -4,9 +4,10 @@ import { emitLocalIdeEvent } from "@/platform/ipc";
import { registerStatusItem, registerToolWindow, type StatusItemContribution } from "./contributions";
import { orderStatusItems, StatusBar, TaskStatus } from "./StatusBar";
import { orderTitleItems } from "./TitleBar";
-import { Balloons, NOTIFICATIONS_TOOL_WINDOW, NotificationsToolWindow } from "./Notifications";
+import { Balloons, NOTIFICATIONS_TOOL_WINDOW, notificationActions, NotificationsToolWindow } from "./Notifications";
import {
BALLOON_TIMEOUT,
+ canSuppress,
clearNotifications,
installNotifyEvents,
STICKY_BALLOON_TIMEOUT,
@@ -316,3 +317,23 @@ describe("workbench shell", () => {
useProject.setState({ project: null });
});
});
+
+describe("Don't Show Again", () => {
+ it("is offered for non-error notifications of groups still shown as balloons", async () => {
+ const { useProject } = await import("@/platform/project");
+ const base = { id: 1, time: 0, read: false, balloon: true, sticky: false, logged: true, title: "x" } as const;
+ const own = [{ label: "Open", run: () => {} }];
+ expect(notificationActions({ ...base, level: "info", group: "vcs", actions: own }).map((a) => a.label)).toEqual([
+ "Open",
+ "Don't Show Again",
+ ]);
+ expect(notificationActions({ ...base, level: "error", group: "vcs" })).toEqual([]);
+ useProject.setState({ settings: { notifications: { groups: { vcs: { display: "none" } } } } as never });
+ try {
+ expect(canSuppress({ level: "warning", group: "vcs" })).toBe(false);
+ expect(canSuppress({ level: "warning", group: "run" })).toBe(true);
+ } finally {
+ useProject.setState({ settings: null });
+ }
+ });
+});
diff --git a/src/workbench/activate.ts b/src/workbench/activate.ts
index d8a58b9eb..ed1c3bf56 100644
--- a/src/workbench/activate.ts
+++ b/src/workbench/activate.ts
@@ -7,6 +7,7 @@ import { useProject } from "@/platform/project";
import {
provideNotificationService,
provideToolWindowService,
+ registerOverlay,
registerStatusItem,
registerToolWindow,
} from "./contributions";
@@ -22,6 +23,7 @@ import {
} from "./Notifications";
import { loadPlatformInfo } from "@/platform/platformInfo";
import { registerShellActions } from "./shellActions";
+import { MainToolbarDialogHost } from "./MainToolbarDialog";
import { StatusInfo, TaskStatus } from "./StatusBar";
import { installTaskEvents } from "./tasks";
import { installToolWindowActions } from "./toolwindows/actions";
@@ -60,6 +62,7 @@ export function activateWorkbench(): () => void {
installTaskEvents(),
installNotifyEvents(),
installBrowserGuards(),
+ registerOverlay({ id: "workbench.customizeToolbar", component: MainToolbarDialogHost }),
registerStatusItem({ id: "workbench.tasks", align: "right", priority: 0, component: TaskStatus }),
registerStatusItem({ id: "workbench.info", align: "left", priority: 5, component: StatusInfo }),
registerToolWindow({
diff --git a/src/workbench/contributions.ts b/src/workbench/contributions.ts
index 91f97b1c6..4ead44649 100644
--- a/src/workbench/contributions.ts
+++ b/src/workbench/contributions.ts
@@ -46,6 +46,12 @@ export interface ToolWindowContribution {
* present the header title also gets a "▾" opening just these items.
*/
headerMenu?: MenuItem[] | ((id: string) => MenuItem[]);
+ /**
+ * The title as a view switcher (IDEA's "Project ▾" panes): a React hook
+ * returning the current view's label and the items the title opens instead
+ * of `headerMenu`'s.
+ */
+ titleMenu?: (id: string) => { label: string; items: MenuItem[] };
/** Badge (e.g. problem count) shown on the stripe button. */
useBadge?: () => number | string | null;
/** Only shown when a project is open (default true). */
@@ -81,6 +87,8 @@ export interface TitleItemContribution {
/** Higher = further from the centre (closer to the window edge). */
priority: number;
component: ComponentType;
+ /** Name in Customize Main Toolbar (defaults to the id). */
+ title?: string;
}
/** Popups / dialogs rendered above the workbench (Search Everywhere, Settings…). */
@@ -114,6 +122,73 @@ export interface ServiceViewContribution {
onUse?: boolean;
}
+/** A node of the Services tree; `key` is unique across providers (prefix it with the provider id). */
+export interface ServiceTreeItem {
+ key: string;
+ label: string;
+ icon: string;
+ /** Grey text after the label (status, counts…). */
+ detail?: string;
+ /** Greyed label (stopped, not running). */
+ dim?: boolean;
+ /** Undefined for leaves. */
+ children?: ServiceTreeItem[];
+}
+
+/** A toolbar button the Services tree shows for the selected node. */
+export interface ServiceItemAction {
+ id: string;
+ title: string;
+ icon: string;
+ disabled?: boolean;
+ run(): void;
+}
+
+/**
+ * Top-level nodes of the Services tree (IDEA's ServiceViewContributor): Docker
+ * connections, run configurations… Each provider owns its nodes' toolbar,
+ * context menu and detail pane, and adds entries to the "Add Service" menu.
+ */
+export interface ServiceProviderContribution {
+ id: string;
+ /** Root order; lower first. */
+ order?: number;
+ /** React hook: this provider's root nodes (none: nothing shown). */
+ useRoots(): ServiceTreeItem[];
+ /** Keeps the provider's data live while the tree is shown; returns a disposer. */
+ watch?(): () => void;
+ /** Toolbar buttons for a selected node of this provider. */
+ actions?(item: ServiceTreeItem): ServiceItemAction[];
+ menu?(item: ServiceTreeItem): MenuItem[];
+ /** Double click / Enter. */
+ activate?(item: ServiceTreeItem): void;
+ /** Right pane for a selected node. */
+ detail?: ComponentType<{ item: ServiceTreeItem }>;
+ /** Status line above the tree (a long operation in progress…); renders null when idle. */
+ banner?: ComponentType;
+ /** Entries of the "Add Service" (+, ⌘N) menu. */
+ addMenu?(): MenuItem[];
+}
+
+export const useServiceProviders = create<{ providers: Map<string, ServiceProviderContribution> }>(() => ({
+ providers: new Map(),
+}));
+
+export function registerServiceProvider(p: ServiceProviderContribution): () => void {
+ useServiceProviders.setState((s) => ({ providers: new Map(s.providers).set(p.id, p) }));
+ return () =>
+ useServiceProviders.setState((s) => {
+ if (s.providers.get(p.id) !== p) return s;
+ const providers = new Map(s.providers);
+ providers.delete(p.id);
+ return { providers };
+ });
+}
+
+export function serviceProviders(map = useServiceProviders.getState().providers): ServiceProviderContribution[] {
+ return [...map.values()].sort((a, b) => (a.order ?? 0) - (b.order ?? 0) || a.id.localeCompare(b.id));
+}
+
export interface EditorInput {
kind: string; // "file" for text documents
/** Stable key; tabs with equal keys are the same tab. */
@@ -313,6 +388,8 @@ export interface EditorService {
closePath?(path: string): void;
/** Closes the tab of the input with this `key` (e.g. a merge editor once applied). */
closeInput?(key: string): void;
+ /** Reformat Code on the whole open document at `path` (quietly); whether anything changed. */
+ reformat?(path: string): Promise<boolean>;
}
export interface ToolWindowService {
@@ -342,10 +419,32 @@ export interface NotificationService {
expire?(key: string): void;
}
+/** A terminal widget (xterm) embedded in another view, e.g. a Run console emulating a terminal. */
+export interface EmbeddedTerminal {
+ write(data: string): void;
+ clear(): void;
+ focus(): void;
+ /** Re-measures the host element (after it was shown or resized). */
+ fit(): void;
+ dispose(): void;
+}
+
+export interface EmbeddedTerminalOptions {
+ /** Keystrokes and pastes, as terminal input. */
+ onData(data: string): void;
+ onResize(cols: number, rows: number): void;
+ /** Directory relative file links resolve against. */
+ cwd?: string;
+ "aria-label"?: string;
+}
+
+export type EmbeddedTerminalFactory = (host: HTMLElement, options: EmbeddedTerminalOptions) => Promise<EmbeddedTerminal>;
+
const services: {
editor?: EditorService;
toolWindows?: ToolWindowService;
notifications?: NotificationService;
+ embeddedTerminal?: EmbeddedTerminalFactory;
} = {};
function need<T>(s: T | undefined, name: string): T {
@@ -356,6 +455,7 @@ function need<T>(s: T | undefined, name: string): T {
export const provideEditorService = (s: EditorService) => void (services.editor = s);
export const provideToolWindowService = (s: ToolWindowService) => void (services.toolWindows = s);
export const provideNotificationService = (s: NotificationService) => void (services.notifications = s);
+export const provideEmbeddedTerminal = (f: EmbeddedTerminalFactory | undefined) => void (services.embeddedTerminal = f);
export const editorService = (): EditorService => need(services.editor, "editor");
export const toolWindowService = (): ToolWindowService => need(services.toolWindows, "toolWindows");
@@ -363,6 +463,8 @@ export const notifications = (): NotificationService =>
services.notifications ?? { notify: (n) => console.info(`[${n.level}] ${n.title}`) };
/** The editor service if one has been provided (for optional integrations). */
export const maybeEditorService = (): EditorService | undefined => services.editor;
+/** Creates terminal widgets; provided by the terminal feature. */
+export const embeddedTerminal = (): EmbeddedTerminalFactory | undefined => services.embeddedTerminal;
// ---------------------------------------------------------------------------
// File decorations: colour / badge / tooltip for a path, shown by the project
@@ -372,6 +474,8 @@ export const maybeEditorService = (): EditorService | undefined => services.edit
export interface FileDecoration {
/** CSS colour, normally a token like `var(--vcs-modified)`. */
color?: string;
+ /** CSS colour tinting the editor tab (a data source's colour on its console). */
+ tint?: string;
/** Short badge text, e.g. a problem count. */
badge?: string;
tooltip?: string;
@@ -483,18 +587,54 @@ export function registerSettingsPage(page: SettingsPageContribution): () => void
});
}
+/** A searchable settings entry: a page, or an option label on it (Search Everywhere's "Settings: …" items). */
+export interface SettingsSearchEntry {
+ pageId: string;
+ /** Page title or option label. */
+ title: string;
+ /** Breadcrumb of the page ("Editor", "General"). */
+ path: string[];
+ /** Extra words that match this entry (page keywords). */
+ keywords?: string[];
+}
+
+let settingsSearchIndex: (() => Promise<SettingsSearchEntry[]>) | null = null;
+
+/** The settings feature provides its search index (pages load lazily, so it is async). */
+export function provideSettingsSearchIndex(index: () => Promise<SettingsSearchEntry[]>): () => void {
+ settingsSearchIndex = index;
+ return () => {
+ if (settingsSearchIndex === index) settingsSearchIndex = null;
+ };
+}
+
+export function searchableSettings(): Promise<SettingsSearchEntry[]> {
+ return settingsSearchIndex ? settingsSearchIndex() : Promise.resolve([]);
+}
+
// ---------------------------------------------------------------------------
-// Project view roots shown below the project ("Scratches").
+// Project view roots shown below the project ("External Libraries", "Scratches").
-export interface ProjectViewRootContribution {
- id: string;
+export interface ProjectViewRootEntry {
label: string;
/** Icon name from `ui/icons`. */
icon: string;
- /** Folder whose contents the node lists (outside the project). */
- path: string;
+ /** Folder whose contents the node lists (outside the project); omitted for a group of `children`. */
+ path?: string;
+ /** Child nodes of a group node (one per SDK, then its library folders). */
+ children?: readonly ProjectViewRootEntry[];
+ /** Grey text after the label ("library root"). */
+ detail?: string;
+ /** Library sources: shown read-only (no new / rename / move / delete). */
+ readOnly?: boolean;
+}
+
+export interface ProjectViewRootContribution extends ProjectViewRootEntry {
+ id: string;
/** Lower first. */
order?: number;
+ /** Which project view mode lists it besides "Project" ("Scratches and Consoles"). */
+ scope?: "scratches";
}
export const useProjectViewRoots = create<{ roots: Map<string, ProjectViewRootContribution> }>(() => ({
@@ -525,6 +665,8 @@ export function projectViewRoots(map: ReadonlyMap<string, ProjectViewRootContrib
// `stopProcess` is the Stop chooser (as IDEA): one item per running process
// a feature can stop (features/run: run sessions, features/debugger: debug sessions).
// `selectIn` is the Select In chooser (⌥F1): targets for a file besides the project view.
+// `new` is the New popup / New › submenu (IDEA's NewGroup): file kinds a feature creates
+// in `paths[0]`, the target directory (features/templates: file templates, http-client: HTTP Request).
export type ContextMenuId =
| "editor"
@@ -533,7 +675,8 @@ export type ContextMenuId =
| "editorGutter"
| "openIn"
| "stopProcess"
- | "selectIn";
+ | "selectIn"
+ | "new";
export interface MenuGroupContext {
/** Files / directories the menu is for (absolute paths; a virtual URI for virtual documents). */
@@ -647,6 +790,72 @@ export function runExecutors(map = useRunExecutors.getState().executors): RunExe
return [...map.values()].sort((a, b) => (a.order ?? 0) - (b.order ?? 0) || a.id.localeCompare(b.id));
}
+// ---------------------------------------------------------------------------
+// Run configuration types (IDEA's "Add New Configuration" list), contributed by
+// features and edited by features/run. A type is declarative: its form fields
+// write `RunConfig.params`, and `commandLine` turns them into what is launched.
+
+export interface RunConfigTypeField {
+ /** Key in `RunConfig.params`. */
+ key: string;
+ label: string;
+ /** `checkbox` values are `"true"` or absent. */
+ control?: "text" | "textarea" | "select" | "checkbox";
+ mono?: boolean;
+ placeholder?: string;
+ options?: ReadonlyArray<{ value: string; label: string }>;
+ /** Values offered while typing (e.g. the scripts of detected configurations). */
+ suggestions?(configs: readonly RunConfig[], params: Readonly<Record<string, string>>): string[];
+ required?: boolean;
+ visible?(params: Readonly<Record<string, string>>): boolean;
+}
+
+export interface RunConfigTypeContribution {
+ /** Stored as `RunConfig.kind`. */
+ id: string;
+ label: string;
+ icon: string;
+ description?: string;
+ /** Parent node in "Add New Configuration" (e.g. `Docker`). */
+ group?: string;
+ /** Params of a new configuration (before templates apply). */
+ defaults?: Readonly<Record<string, string>>;
+ fields: readonly RunConfigTypeField[];
+ /**
+ * What is launched for `params`; null when the type runs no process itself (Compound).
+ * `stop`: a shell command line run on Stop before the process is signalled (`docker stop …`).
+ */
+ commandLine(
+ params: Readonly<Record<string, string>>,
+ ): { command: string; args: string[]; cwd?: string | null; stop?: string | null } | null;
+ /** Params that reproduce a configuration made elsewhere (detection, older files); null when it doesn't fit. */
+ paramsFrom?(config: RunConfig): Record<string, string> | null;
+ /** The type's fields set the working directory (no separate field). */
+ ownsWorkingDirectory?: boolean;
+ /** "Emulate terminal in output console" applies (default true). */
+ terminal?: boolean;
+ /** Adjusts what is launched right before it starts (e.g. the environment selecting a Docker daemon). */
+ prepareLaunch?(config: RunConfig): Promise<RunConfig>;
+}
+
+export const useRunConfigTypes = create<{ types: Map<string, RunConfigTypeContribution> }>(() => ({ types: new Map() }));
+
+export function registerRunConfigType(type: RunConfigTypeContribution): () => void {
+ useRunConfigTypes.setState((s) => ({ types: new Map(s.types).set(type.id, type) }));
+ return () =>
+ useRunConfigTypes.setState((s) => {
+ if (s.types.get(type.id) !== type) return s;
+ const types = new Map(s.types);
+ types.delete(type.id);
+ return { types };
+ });
+}
+
+/** Registered configuration types, by label. */
+export function runConfigTypes(map = useRunConfigTypes.getState().types): RunConfigTypeContribution[] {
+ return [...map.values()].sort((a, b) => a.label.localeCompare(b.label));
+}
+
// ---------------------------------------------------------------------------
// Occurrence navigators: result views (Find, Usages, Problems, TODO…) let
// Next / Previous Occurrence step through their results from anywhere, the
@@ -695,6 +904,127 @@ export function useOccurrenceNavigator(toolWindow: string, nav: OccurrenceNaviga
);
}
+// ---------------------------------------------------------------------------
+// Editor notification banners (IDEA's EditorNotificationProvider): a feature
+// answers, per file, with a banner shown above its text editor, or null.
+
+export interface EditorBanner {
+ text: string;
+ level?: "info" | "warning";
+ /** Icon name (`ui/icons`); defaults to the level's icon. */
+ icon?: string;
+ /** Links on the right ("Install", "Ignore"). */
+ actions?: Array<{ label: string; run: () => void }>;
+}
+
+export interface EditorBannerContribution {
+ id: string;
+ /** Lower first. */
+ order?: number;
+ /** A React hook (may read stores), called for each open text editor's file. */
+ useBanner(path: string): EditorBanner | null;
+}
+
+export const useEditorBanners = create<{ banners: Map<string, EditorBannerContribution> }>(() => ({
+ banners: new Map(),
+}));
+
+export function registerEditorBanner(banner: EditorBannerContribution): () => void {
+ useEditorBanners.setState((s) => ({ banners: new Map(s.banners).set(banner.id, banner) }));
+ return () =>
+ useEditorBanners.setState((s) => {
+ if (s.banners.get(banner.id) !== banner) return s;
+ const banners = new Map(s.banners);
+ banners.delete(banner.id);
+ return { banners };
+ });
+}
+
+// ---------------------------------------------------------------------------
+// Local changes: the VCS provider publishes its change lists (IDEA's
+// ChangeListManager) for features that filter by changed files (TODO › Changes,
+// the project view's "All Changed Files"). Unversioned and ignored files belong
+// to no list.
+
+export interface LocalChangedFile {
+ path: string;
+ /** Deleted in the working tree (no longer on disk). */
+ deleted?: boolean;
+}
+
+export interface LocalChangelist {
+ id: string;
+ name: string;
+ /** New changes go to the active list. */
+ active: boolean;
+ files: LocalChangedFile[];
+}
+
+export const useLocalChanges = create<{ provider: string | null; lists: LocalChangelist[] }>(() => ({
+ provider: null,
+ lists: [],
+}));
+
+/** Replaces the change lists (one VCS provider at a time); the returned function clears them. */
+export function setLocalChanges(provider: string, lists: LocalChangelist[]): () => void {
+ useLocalChanges.setState({ provider, lists });
+ return () => {
+ if (useLocalChanges.getState().provider === provider) useLocalChanges.setState({ provider: null, lists: [] });
+ };
+}
+
+/** Paths of the changed files, of one list (`listId`) or all; `existing` leaves out deleted files. */
+export function localChangedPaths(lists: readonly LocalChangelist[], listId?: string | null, existing = false): string[] {
+ const out: string[] = [];
+ for (const l of lists) {
+ if (listId && l.id !== listId) continue;
+ for (const f of l.files) if (!existing || !f.deleted) out.push(f.path);
+ }
+ return out.sort();
+}
+
+// ---------------------------------------------------------------------------
+// Run Anything (⌃⌃) providers: features offer entries for the typed text
+// (run configurations, `mvn …` / `gradle …` command lines) and may take over
+// running a whole command line; anything else runs as a shell command.
+
+export interface RunAnythingItem {
+ /** Stable within the provider. */
+ key: string;
+ label: string;
+ detail?: string;
+ icon?: string;
+ /** Text put in the field when the item is completed with Tab (default: label). */
+ completion?: string;
+ run(): void | Promise<void>;
+}
+
+export interface RunAnythingProvider {
+ id: string;
+ /** Group heading, e.g. "Run Configurations". */
+ group: string;
+ /** Lower first. */
+ order?: number;
+ /** Matching entries for the field's text (cheap, synchronous). */
+ items(query: string): RunAnythingItem[];
+ /** Runs `line` when it belongs to this provider (`mvn clean`); false leaves it to the next one. */
+ execute?(line: string): boolean | Promise<boolean>;
+}
+
+const runAnythingProviders = new Map<string, RunAnythingProvider>();
+
+export function registerRunAnythingProvider(p: RunAnythingProvider): () => void {
+ runAnythingProviders.set(p.id, p);
+ return () => {
+ if (runAnythingProviders.get(p.id) === p) runAnythingProviders.delete(p.id);
+ };
+}
+
+/** Registered providers in order. */
+export function runAnythingProviderList(): RunAnythingProvider[] {
+ return [...runAnythingProviders.values()].sort((a, b) => (a.order ?? 100) - (b.order ?? 100) || a.id.localeCompare(b.id));
+}
+
// ---------------------------------------------------------------------------
// Status bar info text (IDEA's status bar message, e.g. "3 of 12" after Next
// Occurrence). Cleared by the next message or after a while.
diff --git a/src/workbench/inputDialogs.module.css b/src/workbench/inputDialogs.module.css
new file mode 100644
index 000000000..b7106f1d7
--- /dev/null
+++ b/src/workbench/inputDialogs.module.css
@@ -0,0 +1,34 @@
+.form {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 14px;
+}
+.label {
+ color: var(--fg-secondary);
+ font-size: var(--fs-small);
+}
+.error {
+ color: var(--danger);
+ font-size: var(--fs-small);
+}
+.hint {
+ color: var(--fg-subtle);
+ font-size: var(--fs-small);
+ line-height: 1.5;
+}
+.list {
+ height: 200px;
+ border: 1px solid var(--border);
+ border-radius: var(--radius-control, 4px);
+}
+.row,
+.activeRow {
+ padding: 0 8px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.activeRow {
+ color: var(--fg-strong);
+}
diff --git a/src/workbench/inputDialogs.tsx b/src/workbench/inputDialogs.tsx
new file mode 100644
index 000000000..1afc40a63
--- /dev/null
+++ b/src/workbench/inputDialogs.tsx
@@ -0,0 +1,167 @@
+/**
+ * Promise-based input dialogs for shell and feature actions (IDEA's
+ * `Messages.showInputDialog` and a simple chooser):
+ *
+ * const name = await promptInput({ title: "Save Layout", label: "Name:" });
+ * const picked = await chooseItem({ title: "Delete Layout", items: names });
+ *
+ * Rendered by `InputDialogsHost` (in `OverlayHost`).
+ */
+import { useState, type ReactNode } from "react";
+import { create } from "zustand";
+import { t } from "@/platform/i18n";
+import { Dialog, Input, List, T } from "@/ui";
+import styles from "./inputDialogs.module.css";
+
+export interface PromptInputOptions {
+ title: string;
+ label?: string;
+ initial?: string;
+ placeholder?: string;
+ okLabel?: string;
+ /** An error message for `value`, or null when valid (default: must not be blank). */
+ validate?: (value: string) => string | null;
+ /** Extra content under the field (hints). */
+ hint?: ReactNode;
+}
+
+export interface ChooseItemOptions {
+ title: string;
+ items: readonly string[];
+ /** Shown when `items` is empty. */
+ empty?: string;
+}
+
+type Request =
+ | { kind: "prompt"; id: number; options: PromptInputOptions; resolve: (v: string | null) => void }
+ | { kind: "choose"; id: number; options: ChooseItemOptions; resolve: (v: string | null) => void };
+
+const useInputDialogs = create<{ stack: Request[] }>(() => ({ stack: [] }));
+let seq = 0;
+
+function open(make: (id: number, finish: (v: string | null) => void) => Request): Promise<string | null> {
+ return new Promise((resolve) => {
+ const id = ++seq;
+ const finish = (v: string | null) => {
+ useInputDialogs.setState((s) => ({ stack: s.stack.filter((r) => r.id !== id) }));
+ resolve(v);
+ };
+ useInputDialogs.setState((s) => ({ stack: [...s.stack, make(id, finish)] }));
+ });
+}
+
+/** A text field dialog; resolves with the trimmed value, or null when cancelled. */
+export function promptInput(options: PromptInputOptions): Promise<string | null> {
+ return open((id, resolve) => ({ kind: "prompt", id, options, resolve }));
+}
+
+/** A list to pick one entry from; resolves with it, or null when cancelled. */
+export function chooseItem(options: ChooseItemOptions): Promise<string | null> {
+ return open((id, resolve) => ({ kind: "choose", id, options, resolve }));
+}
+
+export function InputDialogsHost() {
+ const stack = useInputDialogs((s) => s.stack);
+ return (
+ <>
+ {stack.map((r) =>
+ r.kind === "prompt" ? (
+ <PromptDialog key={r.id} options={r.options} done={r.resolve} />
+ ) : (
+ <ChooseDialog key={r.id} options={r.options} done={r.resolve} />
+ ),
+ )}
+ </>
+ );
+}
+
+const notBlank = (v: string) => (v.trim() ? null : "Value must not be empty");
+
+function PromptDialog({ options, done }: { options: PromptInputOptions; done: (v: string | null) => void }) {
+ const [value, setValue] = useState(options.initial ?? "");
+ const [touched, setTouched] = useState(false);
+ const error = (options.validate ?? notBlank)(value);
+ const submit = () => {
+ setTouched(true);
+ if (!error) done(value.trim());
+ };
+ return (
+ <Dialog
+ open
+ title={options.title}
+ onClose={() => done(null)}
+ width={420}
+ buttons={[
+ { label: options.okLabel ?? "OK", role: "default", disabled: !!error, onClick: submit },
+ { label: t("common.cancel"), role: "cancel" },
+ ]}
+ >
+ <form
+ className={styles.form}
+ onSubmit={(e) => {
+ e.preventDefault();
+ submit();
+ }}
+ >
+ {options.label && (
+ <label className={styles.label}>
+ <T>{options.label}</T>
+ </label>
+ )}
+ <Input
+ data-autofocus
+ aria-label={options.label ?? options.title}
+ value={value}
+ placeholder={options.placeholder}
+ invalid={touched && !!error}
+ onChange={(e) => {
+ setTouched(true);
+ setValue(e.target.value);
+ }}
+ />
+ {touched && error && (
+ <div className={styles.error}>
+ <T>{error}</T>
+ </div>
+ )}
+ {options.hint && <div className={styles.hint}>{options.hint}</div>}
+ </form>
+ </Dialog>
+ );
+}
+
+function ChooseDialog({ options, done }: { options: ChooseItemOptions; done: (v: string | null) => void }) {
+ const [active, setActive] = useState(0);
+ const pick = options.items[active];
+ return (
+ <Dialog
+ open
+ title={options.title}
+ onClose={() => done(null)}
+ width={360}
+ buttons={[
+ { label: "OK", role: "default", disabled: pick === undefined, onClick: () => pick !== undefined && done(pick) },
+ { label: t("common.cancel"), role: "cancel" },
+ ]}
+ >
+ <div className={styles.form}>
+ <List
+ items={options.items}
+ getKey={(item) => item}
+ activeIndex={active}
+ onActiveChange={setActive}
+ onActivate={(item) => done(item)}
+ rowHeight={24}
+ className={styles.list}
+ aria-label={options.title}
+ empty={
+ <div className={styles.hint}>
+ <T>{options.empty ?? "Nothing to choose from"}</T>
+ </div>
+ }
+ renderItem={(item, state) => <div className={state.active ? styles.activeRow : styles.row}>{item}</div>}
+ />
+ </div>
+ </Dialog>
+ );
+}
diff --git a/src/workbench/mainToolbar.test.ts b/src/workbench/mainToolbar.test.ts
new file mode 100644
index 000000000..ae356148f
--- /dev/null
+++ b/src/workbench/mainToolbar.test.ts
@@ -0,0 +1,44 @@
+import { describe, expect, it } from "vitest";
+import type { TitleItemContribution } from "./contributions";
+import { defaultToolbar, editableToolbar, resolveToolbar, SEARCH_ENTRY, toggleWidget, VCS_WIDGET } from "./mainToolbar";
+
+const item = (id: string, align: "left" | "right", priority: number): TitleItemContribution => ({
+ id,
+ align,
+ priority,
+ component: () => null,
+});
+const items = [item("run.widget", "right", 10), item("build.project", "right", 0), item(VCS_WIDGET, "left", 0)];
+
+describe("main toolbar layout", () => {
+ it("defaults to the project and VCS widgets, contributed widgets by priority, then Search Everywhere", () => {
+ expect(defaultToolbar(items)).toEqual({
+ left: ["project", VCS_WIDGET],
+ right: ["build.project", "run.widget", SEARCH_ENTRY],
+ hidden: [],
+ });
+ // Without a VCS widget the left side keeps its "Version Control" fallback.
+ expect(defaultToolbar([]).left).toEqual(["project", VCS_WIDGET]);
+ });
+
+ it("keeps the saved order and appends widgets registered since", () => {
+ const saved = { left: ["project"], right: [SEARCH_ENTRY, "run.widget"], hidden: [VCS_WIDGET] };
+ expect(resolveToolbar(saved, items)).toEqual({
+ left: ["project"],
+ right: [SEARCH_ENTRY, "run.widget", "build.project"],
+ });
+ });
+
+ it("hides and re-adds widgets; removed actions are dropped, not hidden", () => {
+ const layout = editableToolbar(null, items);
+ const hidden = toggleWidget(layout, "run.widget", "right");
+ expect(hidden.right).toEqual(["build.project", SEARCH_ENTRY]);
+ expect(hidden.hidden).toEqual(["run.widget"]);
+ const shown = toggleWidget(hidden, "run.widget", "right");
+ expect(shown.right).toEqual(["build.project", SEARCH_ENTRY, "run.widget"]);
+ expect(shown.hidden).toEqual([]);
+ expect(toggleWidget(layout, SEARCH_ENTRY, "right").hidden).toEqual([]);
+ // A hidden widget stays hidden after reload.
+ expect(resolveToolbar(hidden, items).right).not.toContain("run.widget");
+ });
+});
diff --git a/src/workbench/mainToolbar.ts b/src/workbench/mainToolbar.ts
new file mode 100644
index 000000000..e05a8d778
--- /dev/null
+++ b/src/workbench/mainToolbar.ts
@@ -0,0 +1,100 @@
+/**
+ * Customize Main Toolbar: which widgets (project, VCS, run…) and actions the
+ * title bar shows on each side, in which order. Stored in
+ * `appearance.mainToolbar` (global settings); unset = the default toolbar.
+ */
+import type { MainToolbarSettings } from "@/bindings";
+import { getAction } from "@/platform/actions";
+import { call, commands, isTauri } from "@/platform/ipc";
+import { useProject } from "@/platform/project";
+import type { TitleItemContribution } from "./contributions";
+
+export const PROJECT_WIDGET = "project";
+/** Shown as "Version Control ▾" while the project has no repository. */
+export const VCS_WIDGET = "vcs.branch";
+export const ACTION_PREFIX = "action:";
+export const SEARCH_ENTRY = `${ACTION_PREFIX}navigate.searchEverywhere`;
+
+export interface ToolbarLayout {
+ left: string[];
+ right: string[];
+ hidden: string[];
+}
+
+export const isActionEntry = (id: string) => id.startsWith(ACTION_PREFIX);
+export const entryAction = (id: string) => id.slice(ACTION_PREFIX.length);
+
+const byPriority = (a: TitleItemContribution, b: TitleItemContribution) => a.priority - b.priority || a.id.localeCompare(b.id);
+
+/** Widgets in their default place (built-ins included), by side. */
+function defaultWidgets(items: Iterable<TitleItemContribution>): { left: string[]; right: string[] } {
+ const all = [...items];
+ const left = all.filter((i) => i.align === "left").sort(byPriority).map((i) => i.id);
+ const right = all.filter((i) => i.align === "right").sort(byPriority).map((i) => i.id);
+ return { left: [PROJECT_WIDGET, ...(left.includes(VCS_WIDGET) ? [] : [VCS_WIDGET]), ...left], right };
+}
+
+export function defaultToolbar(items: Iterable<TitleItemContribution>): ToolbarLayout {
+ const { left, right } = defaultWidgets(items);
+ return { left, right: [...right, SEARCH_ENTRY], hidden: [] };
+}
+
+/**
+ * The entries to show per side: the saved order, plus widgets registered since
+ * (not listed, not removed) at their default side's end.
+ */
+export function resolveToolbar(
+ saved: MainToolbarSettings | null | undefined,
+ items: Iterable<TitleItemContribution>,
+): { left: string[]; right: string[] } {
+ const list = [...items];
+ if (!saved) {
+ const d = defaultToolbar(list);
+ return { left: d.left, right: d.right };
+ }
+ const left = [...(saved.left ?? [])];
+ const right = [...(saved.right ?? [])];
+ const known = new Set([...left, ...right, ...(saved.hidden ?? [])]);
+ const d = defaultWidgets(list);
+ for (const id of d.left) if (!known.has(id)) left.push(id);
+ for (const id of d.right) if (!known.has(id)) right.push(id);
+ return { left, right };
+}
+
+/** The full editable layout (Customize Main Toolbar dialog). */
+export function editableToolbar(saved: MainToolbarSettings | null | undefined, items: Iterable<TitleItemContribution>): ToolbarLayout {
+ const list = [...items];
+ const { left, right } = resolveToolbar(saved, list);
+ return { left, right, hidden: saved ? [...(saved.hidden ?? [])] : [] };
+}
+
+export function widgetTitle(id: string, items: ReadonlyMap<string, TitleItemContribution>): string {
+ if (id === PROJECT_WIDGET) return "Project Widget";
+ if (id === VCS_WIDGET && !items.has(id)) return "VCS Widget";
+ if (isActionEntry(id)) return getAction(entryAction(id))?.title ?? entryAction(id);
+ return items.get(id)?.title ?? id;
+}
+
+/** Shows or removes a widget, keeping the rest of the layout. */
+export function toggleWidget(layout: ToolbarLayout, id: string, defaultSide: "left" | "right"): ToolbarLayout {
+ const shown = layout.left.includes(id) || layout.right.includes(id);
+ if (shown)
+ return {
+ left: layout.left.filter((x) => x !== id),
+ right: layout.right.filter((x) => x !== id),
+ hidden: [...layout.hidden.filter((x) => x !== id), ...(isActionEntry(id) ? [] : [id])],
+ };
+ const side = defaultSide === "left" ? { left: [...layout.left, id], right: layout.right } : { left: layout.left, right: [...layout.right, id] };
+ return { ...side, hidden: layout.hidden.filter((x) => x !== id) };
+}
+
+export function useMainToolbarSettings(): MainToolbarSettings | null | undefined {
+ return useProject((s) => s.settings?.appearance?.mainToolbar);
+}
+
+/** Saves `layout`; `null` restores the default toolbar. */
+export async function saveToolbar(layout: ToolbarLayout | null): Promise<void> {
+ if (!isTauri()) return;
+ const settings = await call(commands.settingsSet("global", "appearance.mainToolbar", JSON.stringify(layout)));
+ useProject.setState({ settings });
+}
diff --git a/src/workbench/notificationStore.ts b/src/workbench/notificationStore.ts
index d24950758..cdb966ab3 100644
--- a/src/workbench/notificationStore.ts
+++ b/src/workbench/notificationStore.ts
@@ -1,7 +1,7 @@
/** Notification center: balloons + history, backing `NotificationService`. */
import type { ReactNode } from "react";
import { create } from "zustand";
-import { onIdeEvent } from "@/platform/ipc";
+import { call, commands, onIdeEvent } from "@/platform/ipc";
import { useProject } from "@/platform/project";
import type { NotificationService } from "./contributions";
@@ -53,6 +53,25 @@ export function notificationPrefs(group: string): NotificationPrefs {
return { balloons: n?.balloons !== false, sound: n?.sound === true, display, log: g?.log !== false };
}
+/** Errors always show; other notifications offer "Don't Show Again" for their group. */
+export function canSuppress(n: Pick<IdeNotification, "level" | "group">): boolean {
+ return n.level !== "error" && notificationPrefs(n.group).display !== "none";
+}
+
+/**
+ * "Don't Show Again": the group's balloons are turned off (Settings ›
+ * Notifications › "No popup"); its notifications are still logged.
+ */
+export async function suppressGroup(group: string): Promise<void> {
+ const groups = { ...(useProject.getState().settings?.notifications?.groups ?? {}) };
+ groups[group] = { ...(groups[group] ?? {}), display: "none", log: groups[group]?.log ?? true };
+ const settings = await call(commands.settingsSet("global", "notifications.groups", JSON.stringify(groups)));
+ useProject.setState({ settings });
+ useNotifications.setState((s) => ({
+ items: s.items.flatMap((x) => (x.group !== group || !x.balloon ? [x] : x.logged ? [{ ...x, balloon: false }] : [])),
+ }));
+}
+
function groupOf(n: { group?: string; key?: string }): string {
if (n.group) return n.group;
if (n.key?.startsWith("app.update")) return "updates";
diff --git a/src/workbench/quickSwitch.ts b/src/workbench/quickSwitch.ts
new file mode 100644
index 000000000..03c4d5696
--- /dev/null
+++ b/src/workbench/quickSwitch.ts
@@ -0,0 +1,80 @@
+/**
+ * Theme / color scheme / keymap / view mode switches shared by the main
+ * toolbar's gear menu and View › Quick Switch Scheme… (⌃`).
+ */
+import { call, commands, isTauri } from "@/platform/ipc";
+import { SCHEMES } from "@/platform/colorScheme";
+import { PRESET_TITLES, useKeymap } from "@/platform/keymap";
+import { useProject } from "@/platform/project";
+import type { MenuItem } from "@/ui";
+import { currentThemeId, setTheme, THEME_CHOICES } from "./theme";
+
+async function setGlobal(key: string, value: unknown, what: string) {
+ if (!isTauri()) return;
+ try {
+ useProject.setState({ settings: await call(commands.settingsSet("global", key, JSON.stringify(value))) });
+ } catch (e) {
+ console.warn(`cannot switch ${what}`, e);
+ }
+}
+
+export const selectKeymap = (id: string) => setGlobal("keymap", id, "keymap");
+
+export function themeItems(themeId: string = currentThemeId()): MenuItem[] {
+ return THEME_CHOICES.map<MenuItem>((c) => ({
+ id: `theme.${c.id}`,
+ label: c.label,
+ checked: c.id === themeId,
+ run: () => void setTheme(c.id),
+ }));
+}
+
+export function keymapItems(keymapId: string, customKeymaps: string[]): MenuItem[] {
+ return [...Object.keys(PRESET_TITLES), ...customKeymaps].map<MenuItem>((id) => ({
+ id: `keymap.${id}`,
+ label: PRESET_TITLES[id] ?? id,
+ verbatim: !PRESET_TITLES[id],
+ checked: id === keymapId,
+ run: () => void selectKeymap(id),
+ }));
+}
+
+export function colorSchemeItems(current: string | undefined): MenuItem[] {
+ const value = current && SCHEMES.some((s) => s.id === current) ? current : "theme-default";
+ return [
+ { id: "scheme.theme-default", label: "Theme default", checked: value === "theme-default", run: () => void setGlobal("editor.colorScheme", "theme-default", "color scheme") },
+ ...SCHEMES.map<MenuItem>((s) => ({
+ id: `scheme.${s.id}`,
+ label: s.name,
+ checked: s.id === value,
+ run: () => void setGlobal("editor.colorScheme", s.id, "color scheme"),
+ })),
+ ];
+}
+
+/** The existing view modes: Distraction Free Mode and Full Screen. */
+export const VIEW_MODE_ITEMS: MenuItem[] = [
+ { kind: "action", action: "editor.toggleZen" },
+ { kind: "action", action: "window.toggleFullScreen" },
+];
+
+/** The keymap in effect and the user's custom keymaps. */
+export function keymapState(): { keymapId: string; customs: string[] } {
+ const settings = useProject.getState().settings;
+ const customs = settings?.customKeymaps;
+ return {
+ keymapId: typeof settings?.keymap === "string" ? settings.keymap : useKeymap.getState().preset,
+ customs: customs && typeof customs === "object" ? Object.keys(customs) : [],
+ };
+}
+
+/** View › Quick Switch Scheme…: IDEA's popup of the switchable schemes. */
+export function quickSwitchItems(): MenuItem[] {
+ const { keymapId, customs } = keymapState();
+ return [
+ { id: "qs.scheme", label: "Editor Color Scheme", submenu: colorSchemeItems(useProject.getState().settings?.editor?.colorScheme) },
+ { id: "qs.keymap", label: "Keymap", submenu: keymapItems(keymapId, customs) },
+ { id: "qs.viewMode", label: "View Mode", submenu: VIEW_MODE_ITEMS },
+ { id: "qs.theme", label: "Theme", submenu: themeItems() },
+ ];
+}
diff --git a/src/workbench/shellActions.ts b/src/workbench/shellActions.ts
index 677a8bee9..7fa0bd995 100644
--- a/src/workbench/shellActions.ts
+++ b/src/workbench/shellActions.ts
@@ -1,6 +1,9 @@
import { executeAction, getAction, registerActions } from "@/platform/actions";
import { isTauri } from "@/platform/ipc";
import { closeProject, confirmLeaveProject, openProject, useProject } from "@/platform/project";
+import { runSearchFieldCommand, showContextMenu } from "@/ui";
+import { showCustomizeToolbar } from "./MainToolbarDialog";
+import { quickSwitchItems } from "./quickSwitch";
import { notify } from "./notificationStore";
import { NOTIFICATIONS_TOOL_WINDOW } from "./Notifications";
import { activateToolWindow } from "./toolwindows/store";
@@ -60,6 +63,20 @@ export function registerShellActions(): () => void {
keywords: ["appearance", "theme"],
run: toggleTheme,
},
+ {
+ id: "view.quickSwitchScheme",
+ title: "Quick Switch Scheme…",
+ category: "View",
+ keywords: ["theme", "color scheme", "keymap", "view mode"],
+ run: () => showContextMenu({ x: window.innerWidth / 2 - 120, y: 96 }, quickSwitchItems()),
+ },
+ {
+ id: "toolbar.customize",
+ title: "Customize Main Toolbar…",
+ category: "View",
+ keywords: ["toolbar", "widgets", "title bar"],
+ run: showCustomizeToolbar,
+ },
{
id: "view.notifications",
title: "Notifications",
@@ -67,5 +84,22 @@ export function registerShellActions(): () => void {
icon: "bell",
run: () => activateToolWindow(NOTIFICATIONS_TOOL_WINDOW),
},
+ // Keys of search fields (find bar, Find in Files) that are editor shortcuts elsewhere.
+ {
+ id: "find.field.newLine",
+ title: "New Line in Search Field",
+ category: "Find",
+ hidden: true,
+ when: "searchFieldNewLine",
+ run: () => void runSearchFieldCommand("newLine"),
+ },
+ {
+ id: "find.field.recentSearches",
+ title: "Recent Searches",
+ category: "Find",
+ hidden: true,
+ when: "searchFieldHistory",
+ run: () => void runSearchFieldCommand("history"),
+ },
]);
}
diff --git a/src/workbench/toolwindows/ToolWindows.tsx b/src/workbench/toolwindows/ToolWindows.tsx
index 84ccd395f..942154307 100644
--- a/src/workbench/toolwindows/ToolWindows.tsx
+++ b/src/workbench/toolwindows/ToolWindows.tsx
@@ -553,6 +553,8 @@ function staticHeaderMenu(items: MenuItem[] | undefined): (id: string) => MenuIt
return f;
}
+const noTitleMenu = (): { label: string; items: MenuItem[] } | null => null;
+
function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: boolean }) {
const ref = useRef<HTMLElement>(null);
const focusRequest = useToolWindowLayout((s) => s.focusRequest);
@@ -580,6 +582,9 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: bo
const useHeaderMenu = typeof tw.headerMenu === "function" ? tw.headerMenu : staticHeaderMenu(tw.headerMenu);
const own = useHeaderMenu(tw.id);
+ const useTitleMenu = tw.titleMenu ?? noTitleMenu;
+ const titleMenu = useTitleMenu(tw.id);
+ const titleItems = titleMenu?.items ?? own;
const more: MenuItem[] = [
...own,
...(own.length ? [{ kind: "separator" } as MenuItem] : []),
@@ -606,7 +611,7 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: bo
className={clsx(styles.header, Tabs && styles.headerTabbed)}
onDoubleClick={(e) => e.target === e.currentTarget && toggleMaximizeToolWindow(tw.id)}
>
- {Tabs && tw.tabsReplaceTitle ? null : own.length > 0 ? (
+ {Tabs && tw.tabsReplaceTitle ? null : titleItems.length > 0 ? (
<>
<button
ref={titleRef}
@@ -617,7 +622,7 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: bo
onClick={() => setTitleOpen((v) => !v)}
>
<span className={styles.title}>
- <T>{tw.title}</T>
+ <T>{titleMenu?.label ?? tw.title}</T>
</span>
<Icon name="chevron-down" size={12} className={styles.titleChevron} />
</button>
@@ -625,8 +630,8 @@ function ToolWindowView({ tw, hidden }: { tw: ToolWindowContribution; hidden: bo
open={titleOpen}
onClose={() => setTitleOpen(false)}
anchor={titleRef}
- items={own}
- aria-label={`${tx(tw.title)} view options`}
+ items={titleItems}
+ aria-label={titleMenu ? `${tx(tw.title)} views` : `${tx(tw.title)} view options`}
/>
</>
) : (
diff --git a/src/workbench/toolwindows/actions.ts b/src/workbench/toolwindows/actions.ts
index 657afbe6b..66d1a9511 100644
--- a/src/workbench/toolwindows/actions.ts
+++ b/src/workbench/toolwindows/actions.ts
@@ -1,7 +1,20 @@
-import { registerAction, registerActions } from "@/platform/actions";
+import { registerAction, registerActions, type Action } from "@/platform/actions";
+import { setContext } from "@/platform/context";
import { formatMessage, tx } from "@/platform/i18n";
import { occurrenceNavigator, showStatusInfo, useContributions } from "../contributions";
+import { isDistractionFree, setDistractionFree } from "../distractionFree";
import { focusEditor } from "../focus";
+import { chooseItem, promptInput } from "../inputDialogs";
+import { confirm } from "../messages";
+import {
+ deleteLayout,
+ layoutNames,
+ renameLayout,
+ restoreDefaultLayout,
+ restoreLayout,
+ saveLayout,
+ useToolWindowLayouts,
+} from "./layouts";
import { closeSelectedContent } from "./content";
import {
activateToolWindow,
@@ -32,6 +45,84 @@ export function goToOccurrence(dir: 1 | -1): boolean {
return false;
}
+/** Window › Tool Window Layouts. */
+function layoutActions(): Action[] {
+ const exitDistractionFree = () => {
+ if (isDistractionFree()) setDistractionFree(false);
+ };
+ const pick = (title: string) =>
+ chooseItem({ title, items: layoutNames(), empty: "No saved layouts. Use Save Current Layout as… first." });
+ const free = (current?: string) => (v: string) =>
+ !v.trim() ? "Enter a layout name" : v.trim() !== current && layoutNames().includes(v.trim()) ? "A layout with this name exists" : null;
+ return [
+ {
+ id: "layout.save",
+ title: "Save Current Layout as…",
+ category: "Window",
+ keywords: ["tool window layout", "store layout"],
+ when: "projectOpen",
+ run: async () => {
+ const active = useToolWindowLayouts.getState().active;
+ const name = await promptInput({
+ title: "Save Current Layout as",
+ label: "Layout name:",
+ initial: active ?? "",
+ okLabel: "Save",
+ validate: (v) => (v.trim() ? null : "Enter a layout name"),
+ });
+ if (name) saveLayout(name);
+ },
+ },
+ {
+ id: "layout.restore",
+ title: "Restore Tool Window Layout",
+ description: "Restores the saved layout named `arg`, or asks which one.",
+ category: "Window",
+ keywords: ["tool window layout"],
+ when: "projectOpen",
+ run: async ({ arg }) => {
+ exitDistractionFree();
+ const name = typeof arg === "string" ? arg : await pick("Restore Layout");
+ if (name) restoreLayout(name);
+ },
+ },
+ {
+ id: "layout.restoreDefault",
+ title: "Restore Default Layout",
+ category: "Window",
+ keywords: ["tool window layout", "reset"],
+ when: "projectOpen",
+ run: () => {
+ exitDistractionFree();
+ restoreDefaultLayout();
+ },
+ },
+ {
+ id: "layout.rename",
+ title: "Rename Tool Window Layout…",
+ category: "Window",
+ when: "toolWindowLayoutsSaved",
+ run: async () => {
+ const from = await pick("Rename Layout");
+ if (!from) return;
+ const to = await promptInput({ title: "Rename Layout", label: "New name:", initial: from, okLabel: "Rename", validate: free(from) });
+ if (to) renameLayout(from, to);
+ },
+ },
+ {
+ id: "layout.delete",
+ title: "Delete Tool Window Layout…",
+ category: "Window",
+ when: "toolWindowLayoutsSaved",
+ run: async () => {
+ const name = await pick("Delete Layout");
+ if (name && (await confirm({ title: "Delete Layout", message: `Delete the layout '${name}'?`, ok: "Delete", icon: "warning" })))
+ deleteLayout(name);
+ },
+ },
+ ];
+}
+
/** Registers `toolwindow.<id>` for every tool window plus the generic tool window actions. */
export function installToolWindowActions(): () => void {
const perWindow = new Map<string, { title: string; icon: string; dispose: () => void }>();
@@ -62,6 +153,9 @@ export function installToolWindowActions(): () => void {
const unsubscribe = useContributions.subscribe((s, prev) => {
if (s.toolWindows !== prev.toolWindows) sync();
});
+ const publishLayouts = () => setContext("toolWindowLayoutsSaved", useToolWindowLayouts.getState().layouts.length > 0);
+ publishLayouts();
+ const unsubscribeLayouts = useToolWindowLayouts.subscribe(publishLayouts);
const disposeStatic = registerActions([
{ id: "toolwindow.hideAll", title: "Hide All Tool Windows", category: "Window", run: hideAllToolWindows },
@@ -118,6 +212,7 @@ export function installToolWindowActions(): () => void {
when: "projectOpen",
run: () => void goToOccurrence(-1),
},
+ ...layoutActions(),
{
id: "toolwindow.maximize",
title: "Maximize Tool Window",
@@ -133,6 +228,7 @@ export function installToolWindowActions(): () => void {
return () => {
unsubscribe();
+ unsubscribeLayouts();
disposeStatic();
perWindow.forEach((e) => e.dispose());
perWindow.clear();
diff --git a/src/workbench/toolwindows/layouts.test.ts b/src/workbench/toolwindows/layouts.test.ts
new file mode 100644
index 000000000..25bb7e610
--- /dev/null
+++ b/src/workbench/toolwindows/layouts.test.ts
@@ -0,0 +1,102 @@
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import { getContext, setContext } from "@/platform/context";
+import { executeAction } from "@/platform/actions";
+import { registerToolWindow } from "../contributions";
+import { installToolWindowActions } from "./actions";
+import {
+ _reloadLayouts,
+ deleteLayout,
+ layoutNames,
+ renameLayout,
+ restoreDefaultLayout,
+ restoreLayout,
+ saveLayout,
+ useToolWindowLayouts,
+} from "./layouts";
+import {
+ isToolWindowVisible,
+ loadToolWindowLayout,
+ resetToolWindowLayout,
+ setToolWindowSize,
+ showToolWindow,
+ useToolWindowLayout,
+} from "./store";
+
+const Empty = () => null;
+let disposers: Array<() => void> = [];
+
+beforeEach(() => {
+ localStorage.clear();
+ _reloadLayouts();
+ resetToolWindowLayout();
+ disposers = [
+ registerToolWindow({ id: "project", title: "Project", icon: "folder", anchor: "left", component: Empty }),
+ registerToolWindow({ id: "structure", title: "Structure", icon: "structure", anchor: "left", component: Empty }),
+ registerToolWindow({ id: "terminal", title: "Terminal", icon: "terminal", anchor: "bottom", component: Empty }),
+ installToolWindowActions(),
+ ];
+ loadToolWindowLayout("/work/a");
+});
+
+afterEach(() => disposers.forEach((d) => d()));
+
+describe("tool window layouts", () => {
+ it("saves and restores visible windows and sizes by name", () => {
+ showToolWindow("structure");
+ showToolWindow("terminal");
+ setToolWindowSize("bottom", 400);
+ saveLayout("Debugging");
+ showToolWindow("project");
+ setToolWindowSize("bottom", 200);
+
+ expect(restoreLayout("Debugging")).toBe(true);
+ expect(isToolWindowVisible("structure")).toBe(true);
+ expect(isToolWindowVisible("terminal")).toBe(true);
+ expect(useToolWindowLayout.getState().sizes.bottom).toBe(400);
+ expect(useToolWindowLayouts.getState().active).toBe("Debugging");
+ expect(restoreLayout("Missing")).toBe(false);
+ });
+
+ it("restores the default layout", () => {
+ showToolWindow("terminal");
+ restoreDefaultLayout();
+ expect(isToolWindowVisible("terminal")).toBe(false);
+ expect(isToolWindowVisible("project")).toBe(true);
+ });
+
+ it("replaces a layout of the same name, renames and deletes", () => {
+ saveLayout("A");
+ saveLayout("B");
+ saveLayout("A");
+ expect(layoutNames()).toEqual(["A", "B"]);
+ expect(renameLayout("A", "B")).toBe(false);
+ expect(renameLayout("A", " ")).toBe(false);
+ expect(renameLayout("A", "C")).toBe(true);
+ expect(layoutNames()).toEqual(["C", "B"]);
+ expect(useToolWindowLayouts.getState().active).toBe("C");
+ deleteLayout("C");
+ expect(layoutNames()).toEqual(["B"]);
+ expect(useToolWindowLayouts.getState().active).toBeNull();
+ });
+
+ it("persists across reloads and ignores malformed entries", () => {
+ saveLayout("Kept");
+ _reloadLayouts();
+ expect(layoutNames()).toEqual(["Kept"]);
+ localStorage.setItem("openidea.toolWindowLayouts.v1", JSON.stringify({ layouts: [{ name: "" }, { nope: 1 }, { name: "X", layout: 5 }] }));
+ _reloadLayouts();
+ expect(layoutNames()).toEqual(["X"]);
+ });
+
+ it("restores by name through the action (Window › Tool Window Layouts items)", async () => {
+ expect(getContext().toolWindowLayoutsSaved).toBeFalsy();
+ showToolWindow("terminal");
+ saveLayout("Run");
+ expect(getContext().toolWindowLayoutsSaved).toBe(true);
+ restoreDefaultLayout();
+ setContext("projectOpen", true);
+ await executeAction("layout.restore", "Run");
+ setContext("projectOpen", false);
+ expect(isToolWindowVisible("terminal")).toBe(true);
+ });
+});
diff --git a/src/workbench/toolwindows/layouts.ts b/src/workbench/toolwindows/layouts.ts
new file mode 100644
index 000000000..88e37a0f0
--- /dev/null
+++ b/src/workbench/toolwindows/layouts.ts
@@ -0,0 +1,100 @@
+/**
+ * Window › Tool Window Layouts (IDEA's ToolWindowLayoutManager): named
+ * snapshots of the tool window layout (visible windows, sizes, placements),
+ * shared by every project and kept in localStorage.
+ */
+import { create } from "zustand";
+import {
+ applyToolWindowLayout,
+ defaultLayoutSnapshot,
+ sanitizeLayoutSnapshot,
+ toolWindowLayoutSnapshot,
+ type ToolWindowLayoutSnapshot,
+} from "./store";
+
+const STORAGE_KEY = "openidea.toolWindowLayouts.v1";
+
+interface LayoutsState {
+ /** Saved layouts by name, in save order. */
+ layouts: ReadonlyArray<{ name: string; layout: ToolWindowLayoutSnapshot }>;
+ /** Name of the layout last saved or restored (shown checked). */
+ active: string | null;
+}
+
+function read(): LayoutsState {
+ try {
+ const raw: unknown = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? "null");
+ if (!raw || typeof raw !== "object") return { layouts: [], active: null };
+ const r = raw as { layouts?: unknown; active?: unknown };
+ const layouts = Array.isArray(r.layouts)
+ ? r.layouts
+ .filter((l): l is { name: string; layout: unknown } => !!l && typeof l.name === "string" && !!l.name.trim())
+ .map((l) => ({ name: l.name, layout: sanitizeLayoutSnapshot(l.layout) }))
+ : [];
+ const active = typeof r.active === "string" && layouts.some((l) => l.name === r.active) ? r.active : null;
+ return { layouts, active };
+ } catch {
+ return { layouts: [], active: null };
+ }
+}
+
+export const useToolWindowLayouts = create<LayoutsState>(read);
+
+function write(next: LayoutsState) {
+ useToolWindowLayouts.setState(next);
+ try {
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(next));
+ } catch {
+ /* storage unavailable */
+ }
+}
+
+export function layoutNames(): string[] {
+ return useToolWindowLayouts.getState().layouts.map((l) => l.name);
+}
+
+/** Save Current Layout as…: replaces a layout of the same name. */
+export function saveLayout(name: string) {
+ const n = name.trim();
+ if (!n) return;
+ const { layouts } = useToolWindowLayouts.getState();
+ const entry = { name: n, layout: toolWindowLayoutSnapshot() };
+ const i = layouts.findIndex((l) => l.name === n);
+ write({ layouts: i >= 0 ? layouts.map((l, j) => (j === i ? entry : l)) : [...layouts, entry], active: n });
+}
+
+export function restoreLayout(name: string): boolean {
+ const s = useToolWindowLayouts.getState();
+ const found = s.layouts.find((l) => l.name === name);
+ if (!found) return false;
+ applyToolWindowLayout(found.layout);
+ write({ ...s, active: name });
+ return true;
+}
+
+export function restoreDefaultLayout() {
+ applyToolWindowLayout(defaultLayoutSnapshot());
+ write({ ...useToolWindowLayouts.getState(), active: null });
+}
+
+/** Renames `from`; false when `to` is empty or taken by another layout. */
+export function renameLayout(from: string, to: string): boolean {
+ const n = to.trim();
+ const s = useToolWindowLayouts.getState();
+ if (!n || (n !== from && s.layouts.some((l) => l.name === n))) return false;
+ write({
+ layouts: s.layouts.map((l) => (l.name === from ? { ...l, name: n } : l)),
+ active: s.active === from ? n : s.active,
+ });
+ return true;
+}
+
+export function deleteLayout(name: string) {
+ const s = useToolWindowLayouts.getState();
+ write({ layouts: s.layouts.filter((l) => l.name !== name), active: s.active === name ? null : s.active });
+}
+
+/** Test helper: re-reads storage. */
+export function _reloadLayouts() {
+ useToolWindowLayouts.setState(read());
+}
diff --git a/src/workbench/toolwindows/store.ts b/src/workbench/toolwindows/store.ts
index cec63b835..4b990df1f 100644
--- a/src/workbench/toolwindows/store.ts
+++ b/src/workbench/toolwindows/store.ts
@@ -551,6 +551,66 @@ export const toolWindowServiceImpl: ToolWindowService = {
isVisible: isToolWindowVisible,
};
+/** What Window › Tool Window Layouts saves and restores. */
+export interface ToolWindowLayoutSnapshot {
+ visible: SlotRecord;
+ sizes: Record<ToolWindowAnchor, number>;
+ splits: Record<ToolWindowAnchor, number>;
+ placements: Record<string, ToolWindowPlacement>;
+ stripeButtons: Record<string, boolean>;
+}
+
+export function toolWindowLayoutSnapshot(): ToolWindowLayoutSnapshot {
+ const s = useToolWindowLayout.getState();
+ return {
+ visible: { ...(s.distractionFreeStash ?? s.visible) },
+ sizes: { ...s.sizes },
+ splits: { ...s.splits },
+ placements: { ...s.placements },
+ stripeButtons: { ...s.stripeButtons },
+ };
+}
+
+/** Validates a stored snapshot (unknown shape: from storage). */
+export function sanitizeLayoutSnapshot(raw: unknown): ToolWindowLayoutSnapshot {
+ const r = raw && typeof raw === "object" ? (raw as Record<string, unknown>) : {};
+ return {
+ visible: sanitizeVisible(r.visible),
+ sizes: sanitizeSizes(r.sizes),
+ splits: sanitizeSplits(r.splits),
+ placements: sanitizePlacements(r.placements),
+ stripeButtons: sanitizeStripeButtons(r.stripeButtons),
+ };
+}
+
+/** The layout of a fresh project (Restore Default Layout). */
+export function defaultLayoutSnapshot(): ToolWindowLayoutSnapshot {
+ return sanitizeLayoutSnapshot(null);
+}
+
+/** Applies a saved layout to this project (and persists it as the project's layout). */
+export function applyToolWindowLayout(snapshot: ToolWindowLayoutSnapshot) {
+ const s = useToolWindowLayout.getState();
+ const placements = { ...snapshot.placements };
+ // Windows registered later keep their saved area; unknown ones simply never show.
+ const visible = reconcile(snapshot.visible, placements) ?? { ...snapshot.visible };
+ const mounted = new Set(s.mounted);
+ for (const id of Object.values(visible)) if (id) mounted.add(id);
+ const hadFocus = !!s.focused && !Object.values(visible).includes(s.focused);
+ update({
+ visible,
+ sizes: { ...snapshot.sizes },
+ splits: { ...snapshot.splits },
+ placements,
+ stripeButtons: { ...snapshot.stripeButtons },
+ mounted,
+ maximized: null,
+ stashed: null,
+ distractionFreeStash: null,
+ });
+ if (hadFocus) focusEditor();
+}
+
/** Test helper. */
export function resetToolWindowLayout() {
lastUsed = null;