дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-22 17:40:45 +02:00
Порівняти коміти
2
Коміти
| Автор | SHA1 | Дата | |
|---|---|---|---|
|
|
18bdd908ca | ||
|
|
a4ee6110e8 |
No files matched your search
Створено
@@ -4943,7 +4943,6 @@ dependencies = [
|
||||
"portable-pty",
|
||||
"serde",
|
||||
"specta",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ pub struct Settings {
|
||||
pub project_structure: ProjectStructureSettings,
|
||||
/// Version Control (Git, Commit, Confirmation, Issue Navigation).
|
||||
pub vcs: VcsSettings,
|
||||
/// Build, Execution, Deployment › Compiler (Build tool window).
|
||||
pub build: BuildSettings,
|
||||
/// Build, Execution, Deployment › Console.
|
||||
pub console: ConsoleSettings,
|
||||
pub debugger: DebuggerSettings,
|
||||
@@ -510,7 +508,6 @@ impl Default for Settings {
|
||||
languages: LanguagesSettings::default(),
|
||||
project_structure: ProjectStructureSettings::default(),
|
||||
vcs: VcsSettings::default(),
|
||||
build: BuildSettings::default(),
|
||||
console: ConsoleSettings::default(),
|
||||
debugger: DebuggerSettings::default(),
|
||||
run: RunSettings::default(),
|
||||
@@ -1197,31 +1194,11 @@ pub struct ArduinoSettings {
|
||||
}
|
||||
|
||||
/// Languages & Frameworks › Markdown. Like IDEA's, it is application-level only.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Type)]
|
||||
#[serde(default, rename_all = "camelCase")]
|
||||
pub struct MarkdownSettings {
|
||||
/// Preview (and notebook Markdown cell) font size in px; unset follows the editor font size.
|
||||
pub preview_font_size: Option<u32>,
|
||||
/// "Detect commands that can be run right from Markdown files": gutter run icons on
|
||||
/// shell code blocks and on command lines in code blocks.
|
||||
pub run_commands: bool,
|
||||
/// Where those commands run; unset asks when the project and the file's folder differ.
|
||||
pub command_directory: Option<MarkdownCommandDirectory>,
|
||||
}
|
||||
|
||||
impl Default for MarkdownSettings {
|
||||
fn default() -> Self {
|
||||
Self { preview_font_size: None, run_commands: true, command_directory: None }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Type)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum MarkdownCommandDirectory {
|
||||
/// The project's root folder.
|
||||
Project,
|
||||
/// The Markdown file's parent folder.
|
||||
File,
|
||||
}
|
||||
|
||||
impl LanguagesSettings {
|
||||
|
||||
@@ -317,23 +317,6 @@ pub struct SqlResolutionScope {
|
||||
pub schema: String,
|
||||
}
|
||||
|
||||
/// Build, Execution, Deployment › Compiler (Build tool window behaviour).
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
|
||||
#[serde(default, rename_all = "camelCase")]
|
||||
pub struct BuildSettings {
|
||||
/// When to open the Build tool window: `always` | `onError` | `never`.
|
||||
pub open_tool_window: String,
|
||||
/// When to focus the Build tool window: `always` | `onError` | `never`.
|
||||
pub focus_tool_window: String,
|
||||
}
|
||||
|
||||
impl Default for BuildSettings {
|
||||
fn default() -> Self {
|
||||
// Builds open the tool window without taking focus.
|
||||
Self { open_tool_window: "always".into(), focus_tool_window: "never".into() }
|
||||
}
|
||||
}
|
||||
|
||||
/// Build, Execution, Deployment › Console.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
|
||||
#[serde(default, rename_all = "camelCase")]
|
||||
|
||||
@@ -68,16 +68,10 @@ pub enum Incoming {
|
||||
Closed,
|
||||
}
|
||||
|
||||
/// Bounded outgoing queue: an adapter that stops reading its input holds back `send`
|
||||
/// instead of the IDE accumulating unbounded messages. The incoming queue stays unbounded:
|
||||
/// the event loop awaits requests while handling events (`stopped` restores breakpoints), so
|
||||
/// a reader parked on a full queue would never read the response that loop waits for.
|
||||
const OUT_CAPACITY: usize = 256;
|
||||
|
||||
type Pending = HashMap<i64, (String, oneshot::Sender<Result<Value, DapError>>)>;
|
||||
|
||||
struct Inner {
|
||||
out: mpsc::Sender<Vec<u8>>,
|
||||
out: mpsc::UnboundedSender<Vec<u8>>,
|
||||
pending: Mutex<Pending>,
|
||||
seq: AtomicI64,
|
||||
closed: AtomicBool,
|
||||
@@ -120,7 +114,7 @@ impl Connection {
|
||||
R: AsyncRead + Unpin + Send + 'static,
|
||||
W: AsyncWrite + Unpin + Send + 'static,
|
||||
{
|
||||
let (out_tx, mut out_rx) = mpsc::channel::<Vec<u8>>(OUT_CAPACITY);
|
||||
let (out_tx, mut out_rx) = mpsc::unbounded_channel::<Vec<u8>>();
|
||||
let (in_tx, in_rx) = mpsc::unbounded_channel();
|
||||
let inner = Arc::new(Inner {
|
||||
out: out_tx,
|
||||
@@ -189,17 +183,17 @@ impl Connection {
|
||||
self.inner.closed.load(Ordering::Acquire)
|
||||
}
|
||||
|
||||
async fn send(&self, value: &Value) -> Result<(), DapError> {
|
||||
fn send(&self, value: &Value) -> Result<(), DapError> {
|
||||
if self.is_closed() {
|
||||
return Err(DapError::Closed);
|
||||
}
|
||||
let body = serde_json::to_vec(value).map_err(|e| DapError::Protocol(e.to_string()))?;
|
||||
tracing::trace!(target: "ide_dap::wire", "--> {}", String::from_utf8_lossy(&body));
|
||||
self.inner.out.send(body).await.map_err(|_| DapError::Closed)
|
||||
self.inner.out.send(body).map_err(|_| DapError::Closed)
|
||||
}
|
||||
|
||||
/// Sends a request and returns a receiver for its response body, without waiting.
|
||||
pub async fn send_request(
|
||||
pub fn send_request(
|
||||
&self,
|
||||
command: &str,
|
||||
arguments: Value,
|
||||
@@ -211,7 +205,7 @@ impl Connection {
|
||||
if !arguments.is_null() {
|
||||
msg["arguments"] = arguments;
|
||||
}
|
||||
if let Err(e) = self.send(&msg).await {
|
||||
if let Err(e) = self.send(&msg) {
|
||||
self.inner.pending.lock().remove(&seq);
|
||||
return Err(e);
|
||||
}
|
||||
@@ -220,7 +214,7 @@ impl Connection {
|
||||
|
||||
/// Sends a request and waits for the response body (`null` when absent).
|
||||
pub async fn request(&self, command: &str, arguments: Value) -> Result<Value, DapError> {
|
||||
let rx = self.send_request(command, arguments).await?;
|
||||
let rx = self.send_request(command, arguments)?;
|
||||
rx.await.unwrap_or(Err(DapError::Closed))
|
||||
}
|
||||
|
||||
@@ -232,12 +226,7 @@ impl Connection {
|
||||
}
|
||||
|
||||
/// Answers a reverse request.
|
||||
pub async fn respond(
|
||||
&self,
|
||||
request_seq: i64,
|
||||
command: &str,
|
||||
result: Result<Value, String>,
|
||||
) -> Result<(), DapError> {
|
||||
pub fn respond(&self, request_seq: i64, command: &str, result: Result<Value, String>) -> Result<(), DapError> {
|
||||
let seq = self.inner.seq.fetch_add(1, Ordering::Relaxed);
|
||||
let mut msg = json!({
|
||||
"seq": seq,
|
||||
@@ -251,7 +240,7 @@ impl Connection {
|
||||
Ok(_) => {}
|
||||
Err(message) => msg["message"] = Value::String(message),
|
||||
}
|
||||
self.send(&msg).await
|
||||
self.send(&msg)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,62 +319,6 @@ fn error_message(msg: &Value) -> String {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn a_handler_awaiting_a_request_still_gets_its_response_behind_an_event_burst() {
|
||||
// The event loop handles `stopped` by sending `setBreakpoints` and awaiting the reply
|
||||
// while the adapter keeps printing: the reply arrives behind thousands of events.
|
||||
let (client_in, mut adapter_out) = tokio::io::duplex(64 * 1024);
|
||||
let (client_out, adapter_in) = tokio::io::duplex(64 * 1024);
|
||||
let (conn, mut incoming) = Connection::start(client_in, client_out);
|
||||
let adapter = tokio::spawn(async move {
|
||||
let event =
|
||||
|seq: i64, event: &str| json!({"seq": seq, "type": "event", "event": event, "body": {"output": "x"}});
|
||||
framing::write_message(&mut adapter_out, event(0, "stopped").to_string().as_bytes()).await.unwrap();
|
||||
for i in 1..=5000 {
|
||||
framing::write_message(&mut adapter_out, event(i, "output").to_string().as_bytes()).await.unwrap();
|
||||
}
|
||||
let mut requests = BufReader::new(adapter_in);
|
||||
let request = framing::read_message(&mut requests).await.unwrap().unwrap();
|
||||
let request: Value = serde_json::from_slice(&request).unwrap();
|
||||
let response = json!({"seq": 5001, "type": "response", "request_seq": request["seq"], "success": true, "command": request["command"], "body": {"breakpoints": []}});
|
||||
framing::write_message(&mut adapter_out, response.to_string().as_bytes()).await.unwrap();
|
||||
adapter_out
|
||||
});
|
||||
let Some(Incoming::Event { event, .. }) = incoming.recv().await else { panic!("no event") };
|
||||
assert_eq!(event, "stopped");
|
||||
let reply = tokio::time::timeout(Duration::from_secs(10), conn.request("setBreakpoints", json!({})))
|
||||
.await
|
||||
.expect("the reader stalled behind the events")
|
||||
.unwrap();
|
||||
assert_eq!(reply, json!({"breakpoints": []}));
|
||||
let _ = adapter.await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn outgoing_commands_are_backpressured_when_the_adapter_is_slow() {
|
||||
let (writer, _unread_peer) = tokio::io::duplex(32 * 1024);
|
||||
let (reader, _idle_peer) = tokio::io::duplex(32 * 1024);
|
||||
// Nobody reads the writer's pipe, so it fills and the writer task stalls.
|
||||
let (conn, _incoming) = Connection::start(reader, writer);
|
||||
let producer_conn = conn.clone();
|
||||
let sent = Arc::new(std::sync::atomic::AtomicUsize::new(0));
|
||||
let count = sent.clone();
|
||||
let producer = tokio::spawn(async move {
|
||||
for i in 0..2000 {
|
||||
let body = json!({"seq": i, "type": "event", "event": "output", "body": {"output": "x"}});
|
||||
if producer_conn.send(&body).await.is_err() {
|
||||
break;
|
||||
}
|
||||
count.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
});
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
assert!(sent.load(Ordering::Relaxed) < 2000);
|
||||
// The bounded queue held `send` back; closing cancels the writer task.
|
||||
conn.close();
|
||||
producer.abort();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_output_events_with_non_utf8_text() {
|
||||
// "中文" in GBK inside an output event, as netcoredbg sends it on a Chinese Windows.
|
||||
|
||||
@@ -1144,7 +1144,7 @@ impl DebugManager {
|
||||
let mut launch = if launch_in_config {
|
||||
None
|
||||
} else {
|
||||
let reply = s.conn.send_request(request, arguments.clone()).await?;
|
||||
let reply = s.conn.send_request(request, arguments.clone())?;
|
||||
Some(Box::pin(async move { reply.await.unwrap_or(Err(DapError::Closed)) }))
|
||||
};
|
||||
let mut initialized = s.initialized.subscribe();
|
||||
@@ -1222,7 +1222,7 @@ impl DebugManager {
|
||||
}
|
||||
if s.supports("supportsConfigurationDoneRequest") {
|
||||
if s.adapter == kotlin::ADAPTER {
|
||||
drop(s.conn.send_request("configurationDone", json!({})).await?);
|
||||
drop(s.conn.send_request("configurationDone", json!({}))?);
|
||||
} else {
|
||||
s.conn.request_timeout("configurationDone", Value::Null, REQUEST_TIMEOUT).await?;
|
||||
}
|
||||
@@ -1236,7 +1236,7 @@ impl DebugManager {
|
||||
}
|
||||
None => {
|
||||
// GDB 15: the breakpoints are in, so its `run` cannot miss them.
|
||||
let reply = s.conn.send_request(request, arguments).await?;
|
||||
let reply = s.conn.send_request(request, arguments)?;
|
||||
reply.await.unwrap_or(Err(DapError::Closed))?;
|
||||
}
|
||||
}
|
||||
@@ -1246,7 +1246,7 @@ impl DebugManager {
|
||||
// never answered), and the page is already loading: its document and first scripts
|
||||
// are not in the list.
|
||||
if js_debug::is_page(s) {
|
||||
let answer = s.conn.send_request("enableNetworking", js_debug::networking_arguments()).await?;
|
||||
let answer = s.conn.send_request("enableNetworking", js_debug::networking_arguments())?;
|
||||
let session = s.clone();
|
||||
// Not waited for here: the page runs on. A refusal is told to the Network view,
|
||||
// which would otherwise wait for requests that never come.
|
||||
|
||||
@@ -924,11 +924,7 @@ fn on_reverse_request(mgr: &Arc<DebugManager>, s: &Arc<Session>, seq: i64, comma
|
||||
match command {
|
||||
"runInTerminal" => {
|
||||
let result = run_in_terminal(s, &args);
|
||||
let conn = s.conn.clone();
|
||||
let command = command.to_owned();
|
||||
tokio::spawn(async move {
|
||||
let _ = conn.respond(seq, &command, result).await;
|
||||
});
|
||||
let _ = s.conn.respond(seq, command, result);
|
||||
}
|
||||
"startDebugging" => {
|
||||
let mgr = mgr.clone();
|
||||
@@ -937,15 +933,11 @@ fn on_reverse_request(mgr: &Arc<DebugManager>, s: &Arc<Session>, seq: i64, comma
|
||||
let request = args.get("request").and_then(Value::as_str).unwrap_or("launch").to_owned();
|
||||
let configuration = args.get("configuration").cloned().unwrap_or_else(|| json!({}));
|
||||
let result = mgr.start_child(&s, request, configuration).await;
|
||||
let _ = s.conn.respond(seq, "startDebugging", result.map(|_| Value::Null).map_err(|e| e.message)).await;
|
||||
let _ = s.conn.respond(seq, "startDebugging", result.map(|_| Value::Null).map_err(|e| e.message));
|
||||
});
|
||||
}
|
||||
_ => {
|
||||
let conn = s.conn.clone();
|
||||
let command = command.to_owned();
|
||||
tokio::spawn(async move {
|
||||
let _ = conn.respond(seq, &command, Err(format!("unsupported reverse request {command}"))).await;
|
||||
});
|
||||
let _ = s.conn.respond(seq, command, Err(format!("unsupported reverse request {command}")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ use std::path::{Component, Path, PathBuf};
|
||||
|
||||
pub const MANIFEST_FILE: &str = "plugin.toml";
|
||||
/// The plugin API (engine) version this host implements.
|
||||
pub const ENGINE_VERSION: &str = "1.14.0";
|
||||
pub const ENGINE_VERSION: &str = "1.13.0";
|
||||
/// The 0.1 API, still accepted for contribution-only packages and 0.1 components.
|
||||
pub const LEGACY_API: &str = "0.1";
|
||||
/// Marketplace categories, in the order they are shown.
|
||||
|
||||
@@ -176,9 +176,7 @@ impl Call {
|
||||
let r = ide_vfs::split_archive_path(&r).map_or(r.clone(), |(archive, _)| archive);
|
||||
dunce::canonicalize(r).is_ok_and(|r| real.starts_with(r))
|
||||
}) {
|
||||
return Err(IdeError::invalid(
|
||||
"path is outside the project's content roots: ask the user before reading anything else outside the project",
|
||||
));
|
||||
return Err(IdeError::invalid("path is outside the project's content roots"));
|
||||
}
|
||||
Ok(entry.map_or_else(|| real.clone(), |entry| PathBuf::from(format!("{}!/{entry}", real.display()))))
|
||||
})
|
||||
@@ -309,9 +307,7 @@ pub fn resolve_inside(root: &Path, raw: &str) -> IdeResult<PathBuf> {
|
||||
}
|
||||
let root = dunce::canonicalize(root)?;
|
||||
if !real.starts_with(&root) {
|
||||
return Err(IdeError::invalid(
|
||||
"path is outside the project: these tools change files inside it only; ask the user before touching anything outside it",
|
||||
));
|
||||
return Err(IdeError::invalid("path is outside the project"));
|
||||
}
|
||||
if real
|
||||
.strip_prefix(&root)
|
||||
|
||||
@@ -1976,7 +1976,6 @@ pub struct PluginLanguageVisuals {
|
||||
pub injections: Vec<ide_plugin::language_features::Injection>,
|
||||
pub colors: Vec<(String, ide_plugin::language_features::ColorInfo)>,
|
||||
pub gutter_actions: Vec<(String, ide_plugin::language_features::GutterAction)>,
|
||||
pub hover_actions: Vec<(String, ide_plugin::language_features::HoverAction)>,
|
||||
}
|
||||
#[command(trust = trusted)]
|
||||
pub async fn plugin_language_visuals(host: &Host, window: &str, doc: DocId) -> IdeResult<PluginLanguageVisuals> {
|
||||
@@ -1990,20 +1989,14 @@ pub async fn plugin_language_visuals(host: &Host, window: &str, doc: DocId) -> I
|
||||
version: u64::from(snap.version),
|
||||
text: snap.text,
|
||||
};
|
||||
let mut out = PluginLanguageVisuals {
|
||||
version: d.version,
|
||||
injections: vec![],
|
||||
colors: vec![],
|
||||
gutter_actions: vec![],
|
||||
hover_actions: vec![],
|
||||
};
|
||||
let mut out =
|
||||
PluginLanguageVisuals { version: d.version, injections: vec![], colors: vec![], gutter_actions: vec![] };
|
||||
if d.text.len() <= crate::plugins::navigation::MAX_DOCUMENT_BYTES
|
||||
&& let Some(plugins) = crate::plugins::editor_plugin_host()
|
||||
{
|
||||
out.injections = plugins.provide_injections(&d);
|
||||
out.colors = plugins.language_colors(&d);
|
||||
out.gutter_actions = plugins.language_gutter_actions(&d);
|
||||
out.hover_actions = plugins.language_hover_actions(&d);
|
||||
}
|
||||
project.lsp.set_injections_at(
|
||||
doc,
|
||||
|
||||
@@ -276,34 +276,6 @@ impl PluginHost {
|
||||
}
|
||||
out
|
||||
}
|
||||
/// Optional API 1.14 hover actions. Only plugins declaring the
|
||||
/// `hover-actions` provider kind are asked; the released language-features
|
||||
/// export remains unchanged.
|
||||
pub fn language_hover_actions(&self, doc: &ProviderDocument) -> Vec<(String, HoverAction)> {
|
||||
let mut out = Vec::new();
|
||||
for (d, _bounds) in self.feature_documents(doc, None) {
|
||||
let snapshot = d.clone();
|
||||
let text = ide_text::Document::new(&snapshot.text);
|
||||
let d = Arc::new(d);
|
||||
let results = self
|
||||
.document_calls(ProviderKind::HoverActions, &snapshot, move |rt, t| rt.language_hover_actions(&d, t));
|
||||
for (p, items) in results {
|
||||
let commands: std::collections::HashSet<_> =
|
||||
self.ui.items(super::COMMANDS, Some(p.id())).into_iter().map(|c| c.key).collect();
|
||||
for i in items {
|
||||
let lines = text.line_count();
|
||||
let anchor_ok = i.line < lines;
|
||||
let range_ok = i.start_line <= i.end_line && i.end_line < lines;
|
||||
let contains_anchor = i.start_line <= i.line && i.line <= i.end_line;
|
||||
if anchor_ok && range_ok && contains_anchor && commands.contains(&i.command) {
|
||||
out.push((p.id().to_owned(), i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
pub fn language_gutter_actions(&self, doc: &ProviderDocument) -> Vec<(String, GutterAction)> {
|
||||
let mut out = Vec::new();
|
||||
for (d, bounds) in self.feature_documents(doc, None) {
|
||||
|
||||
@@ -54,7 +54,6 @@ pub enum ProviderKind {
|
||||
Implementation,
|
||||
TypeDefinition,
|
||||
GutterActions,
|
||||
HoverActions,
|
||||
Injections,
|
||||
}
|
||||
|
||||
@@ -205,15 +204,11 @@ impl ExtensionPoint for ProvidersPoint {
|
||||
| ProviderKind::Implementation
|
||||
| ProviderKind::TypeDefinition
|
||||
| ProviderKind::GutterActions
|
||||
| ProviderKind::HoverActions
|
||||
| ProviderKind::Injections
|
||||
)
|
||||
}) {
|
||||
pkg.manifest.needs_api("contributes.providers: language features and injections", 4)?;
|
||||
}
|
||||
if d.kinds.contains(&ProviderKind::HoverActions) {
|
||||
pkg.manifest.needs_api("contributes.providers: hover-actions", 14)?;
|
||||
}
|
||||
for l in &d.languages {
|
||||
if l != "*"
|
||||
&& (l.is_empty()
|
||||
|
||||
@@ -152,9 +152,6 @@ async fn editor_ops_merge_the_fixture_format_selection_and_execute_owned_command
|
||||
let visuals = ops::lsp::plugin_language_visuals(&host, "main", doc.id).await.unwrap();
|
||||
assert_eq!(visuals.colors.len(), 1);
|
||||
assert_eq!(visuals.gutter_actions.len(), 1);
|
||||
assert_eq!(visuals.hover_actions.len(), 1);
|
||||
assert_eq!(visuals.hover_actions[0].1.command, "run");
|
||||
assert_eq!(visuals.hover_actions[0].1.end_line, 2);
|
||||
assert_eq!(
|
||||
ops::lsp::plugin_color_presentations(&host, "main", doc.id, ID.into(), visuals.colors[0].1.clone())
|
||||
.await
|
||||
|
||||
@@ -100,22 +100,6 @@ pub struct GutterAction {
|
||||
pub command: String,
|
||||
pub argument: Option<String>,
|
||||
}
|
||||
/// An action rendered at the left edge of a line and revealed by hover.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct HoverAction {
|
||||
/// The line the button is drawn on; normally the declaration line.
|
||||
pub line: u32,
|
||||
/// First line whose leftmost strip reveals this action, inclusive.
|
||||
pub start_line: u32,
|
||||
/// Last line whose leftmost strip reveals this action, inclusive.
|
||||
pub end_line: u32,
|
||||
pub icon: Option<String>,
|
||||
pub label: String,
|
||||
pub tooltip: Option<String>,
|
||||
pub command: String,
|
||||
pub argument: Option<String>,
|
||||
}
|
||||
/// Injection data.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Type)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
|
||||
@@ -16,7 +16,6 @@ use crate::types::{
|
||||
FieldValue, ServiceLog, ServiceLogToggle, ServicePane, ServiceTab, TableSort, View, ViewBody, ViewButton,
|
||||
ViewEvent, ViewField, ViewListItem, ViewTable, ViewTreeItem, Viewport,
|
||||
};
|
||||
use crate::wit_host::hover_actions_bindings::exports::openidea::plugin::hover_actions as wit_hia;
|
||||
use crate::wit_host::injections_bindings::exports::openidea::plugin::injections as wit_inj;
|
||||
use crate::wit_host::language_features_bindings::exports::openidea::plugin::language_features as wit_lf;
|
||||
use crate::wit_host::run_target_validation_bindings::exports::openidea::plugin::run_target_validation as wit_rtv;
|
||||
@@ -58,7 +57,7 @@ use views_bindings::exports::openidea::plugin::view_provider as wit_view;
|
||||
use views_bindings::openidea::plugin::view_types as wit_vt;
|
||||
|
||||
/// The API version of the world above, `major.minor` of [`host_api`].
|
||||
pub const API_VERSION: &str = "1.14";
|
||||
pub const API_VERSION: &str = "1.13";
|
||||
const EPOCH_TICK: Duration = Duration::from_millis(10);
|
||||
pub(crate) const MAX_TEXT: usize = 1 << 20;
|
||||
/// The most text, and the most PNG bytes, `ui.read-clipboard` returns.
|
||||
@@ -1050,7 +1049,6 @@ struct Exports {
|
||||
inlay: Option<wit_inlay::Guest>,
|
||||
endpoints: Option<wit_endpoints::Guest>,
|
||||
search: Option<wit_search::Guest>,
|
||||
hover_actions: Option<wit_hia::Guest>,
|
||||
run_configurations: Option<wit_configs::Guest>,
|
||||
launch_configurations: Option<wit_launch::Guest>,
|
||||
test_results: Option<wit_tests::Guest>,
|
||||
@@ -1192,7 +1190,6 @@ impl Runtime {
|
||||
let inlay_indices = wit_inlay::GuestIndices::new(&pre).ok();
|
||||
let endpoint_indices = wit_endpoints::GuestIndices::new(&pre).ok();
|
||||
let search_indices = wit_search::GuestIndices::new(&pre).ok();
|
||||
let hover_actions_indices = wit_hia::GuestIndices::new(&pre).ok();
|
||||
let configs_indices = wit_configs::GuestIndices::new(&pre).ok();
|
||||
let launch_indices = wit_launch::GuestIndices::new(&pre).ok();
|
||||
let tests_indices = wit_tests::GuestIndices::new(&pre).ok();
|
||||
@@ -1258,8 +1255,6 @@ impl Runtime {
|
||||
None => None,
|
||||
};
|
||||
let search = search_indices.map(|i| i.load(&mut store, &instance)).transpose().map_err(api_hint)?;
|
||||
let hover_actions =
|
||||
hover_actions_indices.map(|i| i.load(&mut store, &instance)).transpose().map_err(api_hint)?;
|
||||
let endpoints = match endpoint_indices {
|
||||
Some(indices) => Some(indices.load(&mut store, &instance).map_err(api_hint)?),
|
||||
None => None,
|
||||
@@ -1283,7 +1278,6 @@ impl Runtime {
|
||||
inlay,
|
||||
endpoints,
|
||||
search,
|
||||
hover_actions,
|
||||
run_configurations,
|
||||
launch_configurations,
|
||||
test_results,
|
||||
@@ -2622,19 +2616,6 @@ fn gutter_action_from(v: wit_lf::GutterAction) -> crate::language_features::Gutt
|
||||
argument: v.argument.map(|v| crate::runtime::clip(v, 65536)),
|
||||
}
|
||||
}
|
||||
fn hover_action_from(v: wit_hia::HoverAction) -> crate::language_features::HoverAction {
|
||||
crate::language_features::HoverAction {
|
||||
line: v.line,
|
||||
start_line: v.start_line,
|
||||
end_line: v.end_line,
|
||||
icon: v.icon.map(|v| crate::runtime::clip(v, 65536)),
|
||||
label: crate::runtime::clip(v.label, 65536),
|
||||
tooltip: v.tooltip.map(|v| crate::runtime::clip(v, 65536)),
|
||||
command: crate::runtime::clip(v.command, 65536),
|
||||
argument: v.argument.map(|v| crate::runtime::clip(v, 65536)),
|
||||
}
|
||||
}
|
||||
|
||||
fn parameter_label_from(v: wit_lf::ParameterLabel) -> crate::language_features::ParameterLabel {
|
||||
use crate::language_features::ParameterLabel as P;
|
||||
match v {
|
||||
@@ -2863,30 +2844,6 @@ impl Runtime {
|
||||
let result = self.language_feature_call(timeout, |p, s| p.call_gutter_actions(s, &d))?;
|
||||
Ok(result.into_iter().take(10000).map(gutter_action_from).collect())
|
||||
}
|
||||
pub fn has_hover_actions(&self) -> bool {
|
||||
self.exports.hover_actions.is_some()
|
||||
}
|
||||
|
||||
pub fn language_hover_actions(
|
||||
&mut self,
|
||||
doc: &ProviderDocument,
|
||||
timeout: Duration,
|
||||
) -> Result<Vec<crate::language_features::HoverAction>, CallError> {
|
||||
if self.exports.hover_actions.is_none() {
|
||||
return Err(CallError::missing_export("hover-actions"));
|
||||
}
|
||||
let d = wit_hia::Document {
|
||||
path: to_ipc(&doc.path),
|
||||
language: doc.language.clone(),
|
||||
version: doc.version,
|
||||
text: doc.text.clone(),
|
||||
};
|
||||
let result = self.call(Invocation::default(), timeout, |exports, store| {
|
||||
exports.hover_actions.as_ref().expect("checked").call_hover_actions(store, &d)
|
||||
})?;
|
||||
Ok(result.into_iter().take(10_000).map(hover_action_from).collect())
|
||||
}
|
||||
|
||||
pub fn provide_injections(
|
||||
&mut self,
|
||||
doc: &ProviderDocument,
|
||||
|
||||
@@ -72,46 +72,6 @@ pub(crate) mod syntax_bindings {
|
||||
});
|
||||
}
|
||||
|
||||
/// The optional `hover-actions` export, bound on its own when present.
|
||||
pub(crate) mod hover_actions_bindings {
|
||||
wasmtime::component::bindgen!({
|
||||
world: "plugin-hover-actions",
|
||||
path: "../../wit",
|
||||
imports: { default: trappable },
|
||||
with: {
|
||||
"openidea:plugin/types": super::bindings::openidea::plugin::types,
|
||||
"openidea:plugin/log": super::bindings::openidea::plugin::log,
|
||||
"openidea:plugin/ui": super::bindings::openidea::plugin::ui,
|
||||
"openidea:plugin/storage": super::bindings::openidea::plugin::storage,
|
||||
"openidea:plugin/workspace": super::bindings::openidea::plugin::workspace,
|
||||
"openidea:plugin/editor": super::bindings::openidea::plugin::editor,
|
||||
"openidea:plugin/decorations": super::bindings::openidea::plugin::decorations,
|
||||
"openidea:plugin/invocation": super::bindings::openidea::plugin::invocation,
|
||||
"openidea:plugin/vcs": super::bindings::openidea::plugin::vcs,
|
||||
"openidea:plugin/build": super::bindings::openidea::plugin::build,
|
||||
"openidea:plugin/commit": super::bindings::openidea::plugin::commit,
|
||||
"openidea:plugin/events": super::bindings::openidea::plugin::events,
|
||||
"openidea:plugin/tasks": super::bindings::openidea::plugin::tasks,
|
||||
"openidea:plugin/diagnostics": super::bindings::openidea::plugin::diagnostics,
|
||||
"openidea:plugin/net": super::bindings::openidea::plugin::net,
|
||||
"openidea:plugin/secrets": super::bindings::openidea::plugin::secrets,
|
||||
"openidea:plugin/run": super::bindings::openidea::plugin::run,
|
||||
"openidea:plugin/process": super::bindings::openidea::plugin::process,
|
||||
"openidea:plugin/output": super::bindings::openidea::plugin::output,
|
||||
"openidea:plugin/auth": super::bindings::openidea::plugin::auth,
|
||||
"openidea:plugin/command-runner": super::bindings::openidea::plugin::command_runner,
|
||||
"openidea:plugin/language-servers": super::bindings::openidea::plugin::language_servers,
|
||||
"openidea:plugin/ipc": super::bindings::openidea::plugin::ipc,
|
||||
"openidea:plugin/fs": super::bindings::openidea::plugin::fs,
|
||||
"openidea:plugin/views": super::bindings::openidea::plugin::views,
|
||||
"openidea:plugin/settings": super::bindings::openidea::plugin::settings,
|
||||
"openidea:plugin/database": super::bindings::openidea::plugin::database,
|
||||
"openidea:plugin/mcp": super::bindings::openidea::plugin::mcp,
|
||||
"openidea:plugin/extensions": super::bindings::openidea::plugin::extensions,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/// The optional `providers` export.
|
||||
pub(crate) mod providers_bindings {
|
||||
wasmtime::component::bindgen!({
|
||||
|
||||
@@ -33,7 +33,6 @@ fn components() -> Vec<PathBuf> {
|
||||
repo().join("crates/ide-plugin/tests/fixtures/diagnostics/dist/plugin.wasm"),
|
||||
repo().join("crates/ide-plugin/tests/fixtures/inlay-hints/dist/plugin.wasm"),
|
||||
repo().join("crates/ide-plugin/tests/fixtures/language-features/dist/plugin.wasm"),
|
||||
repo().join("crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm"),
|
||||
repo().join("crates/ide-plugin/tests/fixtures/symbols/dist/plugin.wasm"),
|
||||
repo().join("crates/ide-plugin/tests/fixtures/api14/dist/plugin.wasm"),
|
||||
repo().join("crates/ide-plugin/tests/fixtures/execution/dist/plugin.wasm"),
|
||||
@@ -93,7 +92,7 @@ fn the_sdk_carries_the_hosts_wit() {
|
||||
|
||||
#[test]
|
||||
fn the_version_check_runs_compatible_components_and_explains_the_rest() {
|
||||
let host = v("1.14.0");
|
||||
let host = v("1.13.0");
|
||||
for ok in [
|
||||
"1.0.0",
|
||||
"1.3.0",
|
||||
@@ -107,16 +106,15 @@ fn the_version_check_runs_compatible_components_and_explains_the_rest() {
|
||||
"1.11.0",
|
||||
"1.12.0",
|
||||
"1.13.0",
|
||||
"1.14.0",
|
||||
"1.0.0-rc.1",
|
||||
] {
|
||||
assert_eq!(check_api(&v(ok), &host), Ok(()), "{ok}");
|
||||
}
|
||||
let newer = check_api(&v("1.15.0"), &host).unwrap_err();
|
||||
assert!(newer.contains("1.15") && newer.contains("update OpenIDEA"), "{newer}");
|
||||
let newer = check_api(&v("1.14.0"), &host).unwrap_err();
|
||||
assert!(newer.contains("1.13") && newer.contains("update OpenIDEA"), "{newer}");
|
||||
assert!(check_api(&v("2.0.0"), &host).unwrap_err().contains("update OpenIDEA"));
|
||||
let older = check_api(&v("0.2.0"), &host).unwrap_err();
|
||||
assert!(older.contains("rebuild it with the 1.14 SDK"), "{older}");
|
||||
assert!(older.contains("rebuild it with the 1.13 SDK"), "{older}");
|
||||
// 0.x: every minor is its own API.
|
||||
assert_eq!(check_api(&v("0.2.0"), &v("0.2.5")), Ok(()));
|
||||
assert!(check_api(&v("0.1.0"), &v("0.2.0")).is_err());
|
||||
@@ -143,21 +141,6 @@ fn shipped_components_are_built_for_this_api() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_1_14_component_exports_the_optional_hover_actions_world() {
|
||||
let engine = PluginEngine::new().unwrap();
|
||||
let component =
|
||||
engine.compile(&repo().join("crates/ide-plugin/tests/fixtures/hover-actions/dist/plugin.wasm")).unwrap();
|
||||
let exports: Vec<String> =
|
||||
component.component_type().exports(engine.engine()).map(|(name, _)| name.to_owned()).collect();
|
||||
assert!(exports.iter().any(|name| name.starts_with("openidea:plugin/[email protected]")), "{exports:?}");
|
||||
// A 1.13-compatible plugin that does not export the new world stays valid.
|
||||
let old = engine.compile(&repo().join("plugins/official/test-runner/dist/plugin.wasm")).unwrap();
|
||||
let old_exports: Vec<String> =
|
||||
old.component_type().exports(engine.engine()).map(|(name, _)| name.to_owned()).collect();
|
||||
assert!(!old_exports.iter().any(|name| name.starts_with("openidea:plugin/hover-actions")));
|
||||
}
|
||||
|
||||
// --- a later host, simulated -------------------------------------------------------------
|
||||
|
||||
struct Data {
|
||||
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
ffc03214c22ab2e732255f56e7d434adb8119094ad706bc395c4c045c4057053
|
||||
1e2844d1172750841afd4ba2a8b811522e90522588b1330474207468cbf2a3df
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
8eaf0a89d176151d71eccd2b67c9793d68c254c5f82fdc70fc8d31e78b4f977b
|
||||
c4d00fe3170a0159e56af61fe715ffb892755cce17cdae5ecb1355fd8e90189e
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
a65bcaee7be6c24e14e2a0d4daa7d6d9ee2785680c09f35e93696b25fc4d0625
|
||||
ce791decf9a771b43872777a5c97050d9b7b48f5dd0ba0342ad0580bceb93d8c
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
799abbd34c0faa68a4ea16c0d5b8e18a6df667b18d47c5467d78921ba8d1903a
|
||||
f8e768db576e717ec00696098faa3434e9cea0680a1770f303bc071206727607
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
0dcd6097bf7c0c89dc334b3acf203bf4c5611914beb201413f148d58a1cb32ff
|
||||
2bd0f9e7f3ca03410389d0b125372eb322fae411272b597795cbd77ea894076d
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
d1671c61724b2b56902b4476d831ccb41bdff2da644d00ca3b8fff962bdf529b
|
||||
30dee06cb90e54e7d930996569a3d44e9c9013077c2439880f99e1c99e15cf58
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
82c878059800ffd425adabb88a273b0e877ca7046b621235762f4db31488e5d6
|
||||
63772fa0f67274c5326a162340aa773c54bd08d0233c726213feedc827bd1a6c
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
88f90bb030b3e58ae52cdb7c665e254bda12fce812944e0ebd952923ad380834
|
||||
910d62d7f53480961b8c25b5e8d6300bee3fc0e413f35d3b7d78d6e238c65387
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
8e04459a5e453c4bc8746bfb5d13317b6a56d09aec28f6025be36421f79e6865
|
||||
b05e1146eb97d5c787c826206b0d2257d1390f21a87501efa8901de3f5cb6017
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
c0aea41383801b3ed39ed1177ffcb40b818e6e259c577a90f1a689332be37195
|
||||
aa14bcafa1009b014ba2ca754711fc3b19149ff05dfefddd10edb94d16551c3d
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
2ec59dc4be1d8f50e24e9e179c37ae95176d85f0feed49741bfdbb9c457b9343
|
||||
3c0d0aa400e83c2f8e77fbec32277a23af290d4469d62d5c0046923ee7ae2c49
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
73d82deae2acdccf346cc8a78670abd6076b79d13b5a32a0b72d6fc337707672
|
||||
a1a3f1691d6d7e837f893580f75935bf83a6c0ae9224ac832c9401885f9ef504
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
28d198f98b792316019f0c03873274938f961edbafd625babe31cb5dccb40db5
|
||||
97f80158eda60e5b34e4760607cfdf5c8f22debf49e438a4b3fffaf7184ad59e
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
c9145df209a7a969c17a041f30d4fe2ffc12e4ce941b318212c904c47e90edef
|
||||
7eff77b3997303adab7b8ef7999b563325e333f0696c63e1a6505579a2a41070
|
||||
-336
@@ -1,336 +0,0 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.104"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
||||
|
||||
[[package]]
|
||||
name = "equivalent"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
||||
|
||||
[[package]]
|
||||
name = "foldhash"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.17.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
||||
dependencies = [
|
||||
"foldhash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
||||
|
||||
[[package]]
|
||||
name = "id-arena"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.14.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4"
|
||||
|
||||
[[package]]
|
||||
name = "leb128fmt"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c"
|
||||
|
||||
[[package]]
|
||||
name = "macro-string"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e7b3a5bbb2f63aaa223a671ea1bd0e7bc16bd30ce387324cf63995deaddbbd2"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
||||
|
||||
[[package]]
|
||||
name = "openidea-plugin"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openidea-test-hover-actions"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"openidea-plugin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bfe0f4c752e450fc2faf62654f1c134747922825d5b04ca717b8874f41a40c0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.107"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "1.0.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.229"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.229"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.229"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.154"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"memchr",
|
||||
"serde",
|
||||
"serde_core",
|
||||
"zmij",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "3.0.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-encoder"
|
||||
version = "0.262.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4495a6f85dd94c411c749303efcbc5defade0b0cbdbc0541495241ab917a9b5a"
|
||||
dependencies = [
|
||||
"leb128fmt",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-metadata"
|
||||
version = "0.262.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c86ff6668190d9fb70372b306b4f9fe8930f0e2f57ce72e4922bf2f117900949"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"indexmap",
|
||||
"wasm-encoder",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.262.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "974d643b125b272607e2fff8012ea14a8328acd7621e4bafa7afb32500052b1b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"hashbrown",
|
||||
"indexmap",
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen"
|
||||
version = "0.63.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b85a987ab61d365382d25c7d47e26edd48941b3bf6e3fbf76eff918bc71dab06"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"wit-bindgen-rust-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-core"
|
||||
version = "0.63.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "775e122e390603abfacd548027016cd0113a6e2bf2f8ce6bdd3658b013456ea8"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"wit-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rust"
|
||||
version = "0.63.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84e26e13b9d972026778d2ffb7985736de116026fdc8d9464f966e12df2eb240"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"indexmap",
|
||||
"prettyplease",
|
||||
"syn",
|
||||
"wasm-metadata",
|
||||
"wit-bindgen-core",
|
||||
"wit-component",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rust-macro"
|
||||
version = "0.63.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16a008a0d6b4840677326beb4edbeb210a2f1b7d0183fb7cc33f466b90fd7fb6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"macro-string",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wit-bindgen-core",
|
||||
"wit-bindgen-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-component"
|
||||
version = "0.262.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "078def49fdb49cab405c3006e05793b3fdaf7069126ba6b9c97d01ec8c98fe4c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitflags",
|
||||
"indexmap",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"wasm-encoder",
|
||||
"wasm-metadata",
|
||||
"wasmparser",
|
||||
"wit-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wit-parser"
|
||||
version = "0.262.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00f0dc051466ffe46787721fca3d088536f158ae400be044f1b1c386ba9397ad"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"hashbrown",
|
||||
"id-arena",
|
||||
"indexmap",
|
||||
"log",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"unicode-ident",
|
||||
"wasmparser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zmij"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
|
||||
@@ -1,20 +0,0 @@
|
||||
[package]
|
||||
name = "openidea-test-hover-actions"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
publish = false
|
||||
|
||||
[workspace]
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
openidea-plugin = { path = "../../../../../sdk/rust/openidea-plugin" }
|
||||
|
||||
[profile.release]
|
||||
opt-level = "s"
|
||||
lto = true
|
||||
strip = true
|
||||
codegen-units = 1
|
||||
panic = "abort"
|
||||
Бінарний файл не відображається.
@@ -1 +0,0 @@
|
||||
ef50da6bb4eb37f1e81055212e7e8ffb0587bd24a9cbcbe0b318e5847c11e0b3
|
||||
@@ -1,14 +0,0 @@
|
||||
id = "test.hover-actions"
|
||||
name = "Hover actions fixture"
|
||||
version = "0.1.0"
|
||||
engines.openidea = "^1.14"
|
||||
wasm = "dist/plugin.wasm"
|
||||
|
||||
[[contributes.providers]]
|
||||
kinds = ["hover-actions"]
|
||||
languages = ["plaintext", "text"]
|
||||
|
||||
[[contributes.commands]]
|
||||
id = "run"
|
||||
title = "Run hover action"
|
||||
icon = "run"
|
||||
@@ -1,32 +0,0 @@
|
||||
//! Minimal API 1.13 fixture for the optional `hover-actions` export.
|
||||
use openidea_plugin::language_features::Document;
|
||||
use openidea_plugin::{Error, HoverAction, HoverActions, Invocation, Plugin, register_plugin};
|
||||
|
||||
#[derive(Default)]
|
||||
struct Fixture;
|
||||
|
||||
impl Plugin for Fixture {
|
||||
fn run_command(&mut self, id: &str, _: &Invocation, arg: Option<&str>) -> Result<Option<String>, Error> {
|
||||
match id {
|
||||
"run" => Ok(arg.map(str::to_owned)),
|
||||
_ => Err(Error::NotFound(id.into())),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl HoverActions for Fixture {
|
||||
fn hover_actions(&mut self, _: &Document) -> Vec<HoverAction> {
|
||||
vec![HoverAction {
|
||||
line: 0,
|
||||
start_line: 0,
|
||||
end_line: 2,
|
||||
icon: Some("run".into()),
|
||||
label: "Run hover action".into(),
|
||||
tooltip: Some("Run hover action".into()),
|
||||
command: "run".into(),
|
||||
argument: Some("hover".into()),
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
register_plugin!(Fixture, hover_actions);
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
0807c0c1cf4b9ab340ca5991c9ca4d74b7ae9917de527b4be0a118ac778cf857
|
||||
507827131b48fc6c679d8c2558c2e519e03e77ebbdeaaf25d9322f36d721201e
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
7a69d58846ddb5dfad48fd2c5dc87cd026a0971b24f8ff743e45c59f33160fbe
|
||||
ba97c6ec41ee0e2996ddd1d1c9432fad2ea0afb4c237f67c2ffb61cd25b4296c
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
7024ae9d20f7b0ca6ce1ff77d9b3913ade91288016c07ac74602c96db766df1b
|
||||
2db9659a4a5fee1cf7179fc5f66ee7ea93f98fa8e844db4213be8cb280998b62
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
312b8299192e159d8008b2ad7217abc442b9f7a95951fc60c4f95b81dee0dfd9
|
||||
f6ca5c93b202794571b09d0882b6809e28cd54be61765265565e991c49f9b021
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
f43c8b7790393f6c55c626882a5a5815de49a29301d67d8ff6164dc51970c3bf
|
||||
ef28c6f306a3adfc7d9fc7e6ec057845b2dc159866cd07745e949436de8a2107
|
||||
@@ -1,11 +1,11 @@
|
||||
id = "test.language-features"
|
||||
name = "Language features fixture"
|
||||
version = "0.1.0"
|
||||
engines.openidea = "^1.14"
|
||||
engines.openidea = "^1.4"
|
||||
wasm = "dist/plugin.wasm"
|
||||
|
||||
[[contributes.providers]]
|
||||
kinds = ["formatting", "signature-help", "document-highlights", "document-links", "code-lenses", "selection-ranges", "folding", "colors", "document-symbols", "implementation", "type-definition", "gutter-actions", "hover-actions", "injections"]
|
||||
kinds = ["formatting", "signature-help", "document-highlights", "document-links", "code-lenses", "selection-ranges", "folding", "colors", "document-symbols", "implementation", "type-definition", "gutter-actions", "injections"]
|
||||
languages = ["plaintext", "text", "sql"]
|
||||
|
||||
[[contributes.providers]]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use openidea_plugin::language_features::*;
|
||||
use openidea_plugin::{
|
||||
Diagnostic, Error, HoverAction, HoverActions, Invocation, Location, Plugin, Position, Range, Severity, TextEdit,
|
||||
register_plugin, text,
|
||||
Diagnostic, Error, Invocation, Location, Plugin, Position, Range, Severity, TextEdit, register_plugin, text,
|
||||
};
|
||||
#[derive(Default)]
|
||||
struct Fixture {
|
||||
@@ -103,20 +102,6 @@ impl LanguageFeatures for Fixture {
|
||||
}]
|
||||
}
|
||||
}
|
||||
impl HoverActions for Fixture {
|
||||
fn hover_actions(&mut self, _: &Document) -> Vec<HoverAction> {
|
||||
vec![HoverAction {
|
||||
line: 0,
|
||||
start_line: 0,
|
||||
end_line: 2,
|
||||
icon: Some("run".into()),
|
||||
label: "Run fixture".into(),
|
||||
tooltip: Some("Run fixture".into()),
|
||||
command: "run".into(),
|
||||
argument: Some("inline".into()),
|
||||
}]
|
||||
}
|
||||
}
|
||||
impl Injections for Fixture {
|
||||
fn injections(&mut self, d: &Document) -> Vec<Injection> {
|
||||
if d.language == "sql" {
|
||||
@@ -156,4 +141,4 @@ impl openidea_plugin::diagnostics::DiagnosticsProvider for Fixture {
|
||||
]
|
||||
}
|
||||
}
|
||||
register_plugin!(Fixture, language_features, hover_actions, injections, providers, hover, diagnostics);
|
||||
register_plugin!(Fixture, language_features, injections, providers, hover, diagnostics);
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
6534015874177fa3bdad1d6fa4dbf571b83572635632c2b0294ca9594346520d
|
||||
abcb633eb89a522e4659cb21770517bb51e889d55c80854d6adc55d0ba33c41b
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
9b1fb340840109da9efa88a1b41d00b1f0b9eb162c5029cf0b647d39a1dc8c36
|
||||
d696eacb402c81a04c42440593363fafe67d11487905a18151976253544415df
|
||||
@@ -5,9 +5,9 @@ wit_bindgen::generate!({
|
||||
inline: "
|
||||
package fixture:misbehave;
|
||||
world misbehave {
|
||||
include openidea:plugin/plugin-syntax@1.14.0;
|
||||
export openidea:plugin/providers@1.14.0;
|
||||
export openidea:plugin/file-actions@1.14.0;
|
||||
include openidea:plugin/plugin-syntax@1.13.0;
|
||||
export openidea:plugin/providers@1.13.0;
|
||||
export openidea:plugin/file-actions@1.13.0;
|
||||
}
|
||||
",
|
||||
path: "../../../../../wit",
|
||||
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
4bde4785c0c30aeb5236a164e813b33b29cafc8c663a25a6621c2b4485a50f42
|
||||
fe55436cf32ce58ba8f8a681617e3e6d7fb94aaac1ce52eb4be620450f68b588
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
f3258dd48ae2468f9b513df27373224dc6b32284de0956642f11509d91adf1fd
|
||||
e6b23695cff3baf9e6d522b778799c937aff0df9037c62b14b96ad0ad2721225
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
91ef32f574c389d6ab1d38e3570c763a695b0e0006b82a2957b8ab3042cd7415
|
||||
c66907db0638d971126a5dd70a9b2e6a18af3d29f2c2fa2d860a726be9b76f75
|
||||
@@ -1,7 +1,7 @@
|
||||
id = "test.search"
|
||||
name = "Search fixture"
|
||||
version = "0.1.0"
|
||||
engines.openidea = "^1.14"
|
||||
engines.openidea = "^1.13"
|
||||
wasm = "dist/plugin.wasm"
|
||||
capabilities.required = ["project.read"]
|
||||
|
||||
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
4fdc7ecd459008c8f6457ff9985807c4808eaaca541e4efad5da2d445ba1552f
|
||||
a5c854e0ddb90ffddc600c196a78efc4e318b675ef8f7ef9c1059d05bbdc6de6
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
958eefe7f24c581db9bfcf64c59c2108dc3ec56d99cc2ae0d9dac087449cac60
|
||||
496e2cb9969f14ef82b2b5982e96c14bf5f586716f15141d5b80b025c4860ef0
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
3aacbd38fd26c73b252dac1f580d1890dcb9feb61ef89275617b47609aa7be5e
|
||||
6b790c68221c7a4071e99ba2794a3f156e90109185814bf6b21cf4f5ef907642
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
2768e1b2e434b9e3e51544879b14ccb24bb03790cb97c30faa6c8cd2f410e702
|
||||
e7974d1c1b09578664869857cfa9ab05080540096c5a2b8601adb2ee30649d6f
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
760f11fff96302bc212c31ac82a18126cac2392c2547ddaf0fa5a358de43f6aa
|
||||
9563467036c1a365aa6df01cc7fbdb50c4b8b66656bb0d3b5864da58a3b8763d
|
||||
Бінарний файл не відображається.
+1
-1
@@ -1 +1 @@
|
||||
d65bc6dfd172ed545ac96d9197ca5af39f97362ad3a0b5967cac4f4e6c56b3a2
|
||||
17d352320df9d4ccb67f80a4b6a7e8b13c7c1402375e1d1cf86154ce9026c9dd
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
67610a3d7d09813deaf1152f1b5b5a7ced9de089ab24c285b9d2f9763242e648
|
||||
f3f3ea4688f068e1b2913bdaa6d2a4ec9f91f441caa5a6f50205fcec0bf6b565
|
||||
Бінарний файл не відображається.
@@ -1 +1 @@
|
||||
d4653877beb8d12faac30170b99cbe48f08c883155aaa588031c1e60586b1e93
|
||||
d0d9887dea30561a313bb45e3ae7520bb49b0e6eef353fd91c0487c498265dc6
|
||||
@@ -11,7 +11,6 @@ serde.workspace = true
|
||||
specta.workspace = true
|
||||
portable-pty.workspace = true
|
||||
parking_lot.workspace = true
|
||||
tokio = { workspace = true, features = ["rt"] }
|
||||
tracing.workspace = true
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
|
||||
@@ -7,7 +7,7 @@ mod utf8;
|
||||
pub use utf8::Utf8Decoder;
|
||||
|
||||
use ide_core::{IdeError, IdeEvent, IdeResult, SharedSink, TerminalId};
|
||||
use parking_lot::{Condvar, Mutex};
|
||||
use parking_lot::Mutex;
|
||||
use portable_pty::{ChildKiller, CommandBuilder, MasterPty, PtySize, native_pty_system};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
@@ -25,85 +25,6 @@ const BATCH_INTERVAL: Duration = Duration::from_millis(4);
|
||||
const BATCH_BYTES: usize = 64 * 1024;
|
||||
/// After the shell exits, how long to keep draining output still in flight.
|
||||
const EXIT_DRAIN: Duration = Duration::from_millis(250);
|
||||
/// High-water mark for output not yet consumed by the pump: producers (the PTY reader or a
|
||||
/// remote channel) block past it, which applies kernel pipe backpressure instead of letting
|
||||
/// a slow UI accumulate unbounded chunks in memory.
|
||||
const OUTPUT_HIGH_WATER: usize = 16 * 1024 * 1024;
|
||||
|
||||
#[derive(Default)]
|
||||
struct BudgetState {
|
||||
pending: usize,
|
||||
closed: bool,
|
||||
}
|
||||
|
||||
/// Byte budget shared by the output producers and the pump that consumes them.
|
||||
#[derive(Clone, Default)]
|
||||
struct ByteBudget(Arc<(Mutex<BudgetState>, Condvar)>);
|
||||
|
||||
impl ByteBudget {
|
||||
/// Reserves `bytes` in the queue, waiting for the pump to catch up. An oversized chunk
|
||||
/// is let through (waiting cannot free memory already allocated by its producer).
|
||||
fn acquire(&self, bytes: usize) -> bool {
|
||||
let (lock, cv) = &*self.0;
|
||||
let mut state = lock.lock();
|
||||
while !state.closed && bytes < OUTPUT_HIGH_WATER && state.pending + bytes > OUTPUT_HIGH_WATER {
|
||||
cv.wait(&mut state);
|
||||
}
|
||||
if state.closed {
|
||||
return false;
|
||||
}
|
||||
state.pending += bytes;
|
||||
true
|
||||
}
|
||||
|
||||
fn release(&self, bytes: usize) {
|
||||
let (lock, cv) = &*self.0;
|
||||
let mut state = lock.lock();
|
||||
state.pending = state.pending.saturating_sub(bytes);
|
||||
cv.notify_all();
|
||||
}
|
||||
|
||||
fn close(&self) {
|
||||
let (lock, cv) = &*self.0;
|
||||
lock.lock().closed = true;
|
||||
cv.notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct OutputSender {
|
||||
tx: mpsc::Sender<Msg>,
|
||||
budget: ByteBudget,
|
||||
}
|
||||
|
||||
struct OutputReceiver {
|
||||
rx: mpsc::Receiver<Msg>,
|
||||
budget: ByteBudget,
|
||||
}
|
||||
|
||||
impl Drop for OutputReceiver {
|
||||
fn drop(&mut self) {
|
||||
// A panicking pump must not leave producers waiting on a budget nobody releases.
|
||||
self.budget.close();
|
||||
}
|
||||
}
|
||||
|
||||
impl OutputSender {
|
||||
fn data(&self, data: &[u8]) -> bool {
|
||||
if !self.budget.acquire(data.len()) {
|
||||
return false;
|
||||
}
|
||||
if self.tx.send(Msg::Data(data.to_vec())).is_err() {
|
||||
self.budget.release(data.len());
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
fn exited(&self, code: Option<i32>) {
|
||||
let _ = self.tx.send(Msg::Exited(code));
|
||||
}
|
||||
}
|
||||
/// Grace period between SIGHUP and SIGKILL on [`TerminalManager::kill`].
|
||||
#[cfg(unix)]
|
||||
const KILL_GRACE: Duration = Duration::from_millis(1500);
|
||||
@@ -143,57 +64,25 @@ pub trait TerminalChannel: Send + Sync {
|
||||
|
||||
/// Where a [`TerminalChannel`] reports its output and exit.
|
||||
#[derive(Clone)]
|
||||
pub struct TerminalFeed(OutputSender);
|
||||
pub struct TerminalFeed(mpsc::Sender<Msg>);
|
||||
|
||||
impl TerminalFeed {
|
||||
pub fn output(&self, data: &[u8]) {
|
||||
// A remote feed is called from a Tokio task: tell the runtime to park this worker
|
||||
// so the byte-budget wait cannot starve other tasks (it spawns a replacement).
|
||||
// Native PTY output comes from a dedicated thread, which blocks directly.
|
||||
if matches!(
|
||||
tokio::runtime::Handle::try_current(),
|
||||
Ok(handle) if handle.runtime_flavor() == tokio::runtime::RuntimeFlavor::MultiThread
|
||||
) {
|
||||
tokio::task::block_in_place(|| self.0.data(data));
|
||||
} else {
|
||||
self.0.data(data);
|
||||
}
|
||||
let _ = self.0.send(Msg::Data(data.to_vec()));
|
||||
}
|
||||
|
||||
pub fn exited(&self, code: Option<i32>) {
|
||||
self.0.exited(code);
|
||||
let _ = self.0.send(Msg::Exited(code));
|
||||
}
|
||||
}
|
||||
|
||||
/// The receiving end of a [`TerminalFeed`], handed to [`TerminalManager::attach`].
|
||||
pub struct FeedReceiver {
|
||||
rx: Option<mpsc::Receiver<Msg>>,
|
||||
budget: Option<ByteBudget>,
|
||||
}
|
||||
|
||||
impl FeedReceiver {
|
||||
fn into_parts(mut self) -> OutputReceiver {
|
||||
OutputReceiver {
|
||||
rx: self.rx.take().expect("feed not already attached"),
|
||||
budget: self.budget.take().expect("feed not already attached"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for FeedReceiver {
|
||||
fn drop(&mut self) {
|
||||
// A channel that never attached must not leave its producers blocked on the budget.
|
||||
if let Some(budget) = self.budget.take() {
|
||||
budget.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct FeedReceiver(mpsc::Receiver<Msg>);
|
||||
|
||||
/// A feed for a channel that is about to be opened.
|
||||
pub fn feed() -> (TerminalFeed, FeedReceiver) {
|
||||
let (tx, rx) = mpsc::channel();
|
||||
let budget = ByteBudget::default();
|
||||
(TerminalFeed(OutputSender { tx, budget: budget.clone() }), FeedReceiver { rx: Some(rx), budget: Some(budget) })
|
||||
(TerminalFeed(tx), FeedReceiver(rx))
|
||||
}
|
||||
|
||||
enum Io {
|
||||
@@ -364,27 +253,15 @@ impl TerminalManager {
|
||||
self.sessions.lock().insert(id, session);
|
||||
|
||||
let (tx, rx) = mpsc::channel::<Msg>();
|
||||
let budget = ByteBudget::default();
|
||||
let out = OutputSender { tx: tx.clone(), budget: budget.clone() };
|
||||
let spawned = spawn_reader(
|
||||
id,
|
||||
reader,
|
||||
out.clone(),
|
||||
tx.clone(),
|
||||
#[cfg(unix)]
|
||||
wait_readable,
|
||||
)
|
||||
.and_then(|_| spawn_waiter(id, child, out))
|
||||
.and_then(|_| {
|
||||
spawn_pump(
|
||||
id,
|
||||
OutputReceiver { rx, budget },
|
||||
on_output,
|
||||
exited,
|
||||
self.sessions.clone(),
|
||||
sink,
|
||||
Instant::now(),
|
||||
)
|
||||
});
|
||||
.and_then(|_| spawn_waiter(id, child, tx))
|
||||
.and_then(|_| spawn_pump(id, rx, on_output, exited, self.sessions.clone(), sink, Instant::now()));
|
||||
if let Err(e) = spawned {
|
||||
if let Some(s) = self.sessions.lock().remove(&id) {
|
||||
terminate(&s);
|
||||
@@ -422,10 +299,7 @@ impl TerminalManager {
|
||||
input_logged: AtomicBool::new(false),
|
||||
});
|
||||
self.sessions.lock().insert(id, session);
|
||||
let output = feed.into_parts();
|
||||
let budget = output.budget.clone();
|
||||
if let Err(e) = spawn_pump(id, output, on_output, exited, self.sessions.clone(), sink, Instant::now()) {
|
||||
budget.close();
|
||||
if let Err(e) = spawn_pump(id, feed.0, on_output, exited, self.sessions.clone(), sink, Instant::now()) {
|
||||
if let Some(s) = self.sessions.lock().remove(&id) {
|
||||
terminate(&s);
|
||||
}
|
||||
@@ -654,7 +528,7 @@ fn terminate(session: &Session) {
|
||||
fn spawn_reader(
|
||||
id: TerminalId,
|
||||
mut reader: Box<dyn Read + Send>,
|
||||
tx: OutputSender,
|
||||
tx: mpsc::Sender<Msg>,
|
||||
#[cfg(unix)] mut wait_readable: impl FnMut() -> std::io::Result<()> + Send + 'static,
|
||||
) -> std::io::Result<()> {
|
||||
std::thread::Builder::new().name(format!("openidea-term-read-{}", id.0)).spawn(move || {
|
||||
@@ -663,9 +537,7 @@ fn spawn_reader(
|
||||
match reader.read(&mut buf) {
|
||||
Ok(0) => break,
|
||||
Ok(n) => {
|
||||
// Blocks past the byte high-water mark: a slow consumer stalls the
|
||||
// PTY reader, which lets the kernel pipe backpressure the shell.
|
||||
if !tx.data(&buf[..n]) {
|
||||
if tx.send(Msg::Data(buf[..n].to_vec())).is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -697,7 +569,7 @@ fn spawn_reader(
|
||||
fn spawn_waiter(
|
||||
id: TerminalId,
|
||||
mut child: Box<dyn portable_pty::Child + Send + Sync>,
|
||||
tx: OutputSender,
|
||||
tx: mpsc::Sender<Msg>,
|
||||
) -> std::io::Result<()> {
|
||||
std::thread::Builder::new().name(format!("openidea-term-wait-{}", id.0)).spawn(move || {
|
||||
let code = match child.wait() {
|
||||
@@ -708,14 +580,14 @@ fn spawn_waiter(
|
||||
None
|
||||
}
|
||||
};
|
||||
tx.exited(code);
|
||||
let _ = tx.send(Msg::Exited(code));
|
||||
})?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn spawn_pump(
|
||||
id: TerminalId,
|
||||
output: OutputReceiver,
|
||||
rx: mpsc::Receiver<Msg>,
|
||||
on_output: Box<dyn Fn(String) + Send>,
|
||||
exited: Arc<AtomicBool>,
|
||||
sessions: Sessions,
|
||||
@@ -755,10 +627,8 @@ fn spawn_pump(
|
||||
(Some(a), None) | (None, Some(a)) => a,
|
||||
(None, None) => Duration::from_secs(3600),
|
||||
};
|
||||
match output.rx.recv_timeout(wait) {
|
||||
match rx.recv_timeout(wait) {
|
||||
Ok(Msg::Data(bytes)) => {
|
||||
// The pump owns these bytes now; wake any producer waiting on the cap.
|
||||
output.budget.release(bytes.len());
|
||||
decoder.decode_into(&bytes, &mut pending);
|
||||
if !pending.is_empty() && batch_started.is_none() {
|
||||
batch_started = Some(Instant::now());
|
||||
@@ -785,7 +655,6 @@ fn spawn_pump(
|
||||
pending.push_str(&decoder.finish());
|
||||
flush(&mut pending, &mut batch_started);
|
||||
exited.store(true, Ordering::Release);
|
||||
output.budget.close();
|
||||
sessions.lock().remove(&id);
|
||||
let code = exit.flatten();
|
||||
tracing::debug!(%id, ?code, "terminal exited");
|
||||
@@ -1004,70 +873,6 @@ fn default_chere_invoking(shell: &str, user: &BTreeMap<String, String>, inherite
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn output_past_the_byte_budget_blocks_the_producer_until_the_pump_drains() {
|
||||
let (feed, receiver) = feed();
|
||||
let chunk = vec![b'x'; 16 * 1024];
|
||||
let chunk_len = chunk.len();
|
||||
let accepted = Arc::new(std::sync::atomic::AtomicUsize::new(0));
|
||||
let count = accepted.clone();
|
||||
let producer = std::thread::spawn(move || {
|
||||
// 64 MiB, four times the high-water mark. With no pump draining it, only the
|
||||
// budget's worth can be accepted; the producer then blocks.
|
||||
for _ in 0..4096 {
|
||||
if !feed.0.data(&chunk) {
|
||||
break;
|
||||
}
|
||||
count.fetch_add(chunk.len(), Ordering::Relaxed);
|
||||
}
|
||||
});
|
||||
// Poll instead of sleeping a fixed time: a loaded CI box may schedule the
|
||||
// producer late, but it must eventually fill the budget.
|
||||
let deadline = Instant::now() + Duration::from_secs(5);
|
||||
let pending = loop {
|
||||
let pending = receiver.budget.as_ref().unwrap().0.0.lock().pending;
|
||||
if pending >= OUTPUT_HIGH_WATER || Instant::now() >= deadline {
|
||||
break pending;
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(1));
|
||||
};
|
||||
assert!(pending <= OUTPUT_HIGH_WATER + chunk_len, "{pending}");
|
||||
assert!(pending > OUTPUT_HIGH_WATER - chunk_len, "the producer should have filled the budget: {pending}");
|
||||
// Closing the feed releases the blocked producer.
|
||||
drop(receiver);
|
||||
producer.join().unwrap();
|
||||
assert!(accepted.load(Ordering::Relaxed) <= OUTPUT_HIGH_WATER + 2 * chunk_len);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "prints the peak buffered output bytes; see issue #3936"]
|
||||
fn output_backpressure_numbers() {
|
||||
let (feed, receiver) = feed();
|
||||
let chunk = vec![b'x'; 16 * 1024];
|
||||
let accepted = Arc::new(std::sync::atomic::AtomicUsize::new(0));
|
||||
let count = accepted.clone();
|
||||
let producer = std::thread::spawn(move || {
|
||||
for _ in 0..4096 {
|
||||
if !feed.0.data(&chunk) {
|
||||
break;
|
||||
}
|
||||
count.fetch_add(chunk.len(), Ordering::Relaxed);
|
||||
}
|
||||
});
|
||||
// No pump (no consumer) for this window: measure how much a fast producer can
|
||||
// pile up before the budget stops it.
|
||||
std::thread::sleep(Duration::from_millis(300));
|
||||
let pending = receiver.budget.as_ref().unwrap().0.0.lock().pending;
|
||||
drop(receiver);
|
||||
producer.join().unwrap();
|
||||
println!(
|
||||
"peak pending {} bytes ({} MiB) of {} MiB produced",
|
||||
pending,
|
||||
pending / (1024 * 1024),
|
||||
accepted.load(Ordering::Relaxed) / (1024 * 1024)
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn login_shell_reads_the_passwd_entry() {
|
||||
|
||||
@@ -69,14 +69,13 @@ The IDE calls these. The first three are in every code plugin; the rest are opti
|
||||
| `language-features` | [language-features.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/language-features.wit) | Formatting, signature help, highlights, links, code lenses, folds, colours, symbols, gutter actions and more (API 1.4) |
|
||||
| `injections` | [injections.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/injections.wit) | Ranges of embedded languages inside a document (API 1.4) |
|
||||
| `hover-provider` | [hover.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover.wit) | Markdown added to the hover of any language |
|
||||
| `hover-actions` | [hover-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover-actions.wit) | Hover-revealed line actions at the left edge of a line (API 1.14): anchor line and inclusive trigger line range |
|
||||
| `inlay-hints-provider` | [inlay.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/inlay.wit) | Inline hints in any language |
|
||||
| `semantic-tokens-provider` | [semantic.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/semantic.wit) | Semantic colouring in any language |
|
||||
| `diagnostics-provider` | [diagnostics.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/diagnostics.wit) | Problems in the current, possibly unsaved document |
|
||||
| `file-actions` | [file-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/file-actions.wit) | Quick fixes and refactorings that create, rename or delete files |
|
||||
| `document-indexer` | [indexing.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/indexing.wit) | Cross-file definitions, references and gutter markers, indexed in the background |
|
||||
| `endpoints-provider` | [endpoints.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/endpoints.wit) | A project's HTTP endpoints for Search Everywhere and the HTTP client |
|
||||
| `search-provider` | [search.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/search.wit) | Cancellable queries for a plugin-defined Search Everywhere tab (API 1.14) |
|
||||
| `search-provider` | [search.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/search.wit) | Cancellable queries for a plugin-defined Search Everywhere tab (API 1.13) |
|
||||
| `view-provider` | [views.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/views.wit) | Content and events of declared views and custom editors |
|
||||
| `detail-provider` | [details.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/details.wit) | The detail pane of the plugin's nodes in the Services tool window |
|
||||
| `commit-checker` | [commit.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/commit.wit) | Before-commit checks |
|
||||
|
||||
@@ -228,7 +228,6 @@ Declare any of these kinds with `engines.openidea = "^1.4"`, implement
|
||||
| `implementation` | `implementation(doc, at)` | Merged with the server's implementations. |
|
||||
| `type-definition` | `type_definition(doc, at)` | Merged with the server's type declarations. |
|
||||
| `gutter-actions` | `gutter_actions(doc)` | Gutter buttons that run one of the plugin's declared commands, with an optional argument. |
|
||||
| `hover-actions` | `hover_actions(doc)` | Actions at the left edge of a line, revealed while the pointer is in the first four editing-area columns for any line in `start-line..=end-line`; the button is anchored to `line` and never covers text (API 1.14). |
|
||||
|
||||
A code lens that offers a command, from the
|
||||
[Blame Annotations](https://github.com/l0ng-ai/openidea/tree/main/plugins/official/blame-annotations)
|
||||
|
||||
@@ -27,8 +27,7 @@ The plugin API has one version number: the version of the WIT package in [`wit/`
|
||||
| 1.10.0 | OpenIDEA 0.1.47 | `build.dependencies`: the Maven / Gradle dependency graph the IDE resolved (`build.read`) |
|
||||
| 1.11.0 | In development on `main` | `ui.read-clipboard`: the clipboard's text and image in commands the user ran (`clipboard.read`) |
|
||||
| 1.12.0 | In development on `main` | `ui.set-console-rules`: highlight rules (regex, palette colours, styles) for Run and Debug console output |
|
||||
| 1.13.0 | OpenIDEA 0.1.49 | Optional `search-provider` export and `searchCategories`: custom Search Everywhere tabs with cancellable queries |
|
||||
| 1.14.0 | In development on `main` | Optional `hover-actions` export: left-edge line actions revealed by line-edge hover, with an anchor line and inclusive trigger range |
|
||||
| 1.13.0 | In development on `main` | Optional `search-provider` export and `searchCategories`: custom Search Everywhere tabs with cancellable queries |
|
||||
|
||||
The full list of what each version added is in [`plugins/README.md`](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md).
|
||||
|
||||
|
||||
@@ -69,14 +69,13 @@ description: "openidea:plugin WIT 包中的每个 interface:一句话说明及
|
||||
| `language-features` | [language-features.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/language-features.wit) | 格式化、签名帮助、高亮、链接、代码透镜、折叠、颜色、符号、装订区操作等(API 1.4) |
|
||||
| `injections` | [injections.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/injections.wit) | 文档中嵌入语言的范围(API 1.4) |
|
||||
| `hover-provider` | [hover.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover.wit) | 向任意语言的悬停追加 Markdown |
|
||||
| `hover-actions` | [hover-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/hover-actions.wit) | 行左侧边缘的 hover 操作(API 1.14):锚定行和包含式触发行范围 |
|
||||
| `inlay-hints-provider` | [inlay.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/inlay.wit) | 任意语言中的内嵌提示 |
|
||||
| `semantic-tokens-provider` | [semantic.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/semantic.wit) | 任意语言中的语义着色 |
|
||||
| `diagnostics-provider` | [diagnostics.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/diagnostics.wit) | 当前文档(可能未保存)中的问题 |
|
||||
| `file-actions` | [file-actions.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/file-actions.wit) | 创建、重命名或删除文件的快速修复和重构 |
|
||||
| `document-indexer` | [indexing.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/indexing.wit) | 在后台索引的跨文件定义、引用和装订区标记 |
|
||||
| `endpoints-provider` | [endpoints.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/endpoints.wit) | 项目的 HTTP 端点,供 随处搜索 和 HTTP 客户端使用 |
|
||||
| `search-provider` | [search.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/search.wit) | 插件自定义全局搜索分类的可取消查询(API 1.14) |
|
||||
| `search-provider` | [search.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/search.wit) | 插件自定义全局搜索分类的可取消查询(API 1.13) |
|
||||
| `view-provider` | [views.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/views.wit) | 声明的视图和自定义编辑器的内容与事件 |
|
||||
| `detail-provider` | [details.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/details.wit) | Services 工具窗口中插件节点的详情面板 |
|
||||
| `commit-checker` | [commit.wit](https://github.com/l0ng-ai/openidea/blob/main/wit/commit.wit) | 提交前检查 |
|
||||
|
||||
@@ -209,7 +209,6 @@ impl InlayHints for MyPlugin {
|
||||
| `implementation` | `implementation(doc, at)` | 与服务器的实现结果合并。 |
|
||||
| `type-definition` | `type_definition(doc, at)` | 与服务器的类型声明结果合并。 |
|
||||
| `gutter-actions` | `gutter_actions(doc)` | 行号槽按钮,执行插件声明的命令,可带参数。 |
|
||||
| `hover-actions` | `hover_actions(doc)` | 行左侧边缘的操作,在 `start-line..=end-line` 内任意一行的编辑区前四列悬浮时显示;按钮锚定到 `line`,不覆盖文本(API 1.14)。 |
|
||||
|
||||
下面是 [Blame Annotations](https://github.com/l0ng-ai/openidea/tree/main/plugins/official/blame-annotations)
|
||||
示例中提供命令入口的代码透镜:
|
||||
|
||||
@@ -24,8 +24,7 @@ description: "engines.openidea、插件 API 从 1.0 到 1.13 的各个版本,
|
||||
| 1.10.0 | OpenIDEA 0.1.47 | `build.dependencies`:IDE 已解析的 Maven / Gradle 依赖图(`build.read`) |
|
||||
| 1.11.0 | `main` 上开发中 | `ui.read-clipboard`:在用户运行的命令中读取剪贴板的文本和图片(`clipboard.read`) |
|
||||
| 1.12.0 | `main` 上开发中 | `ui.set-console-rules`:Run/Debug 控制台输出的高亮规则(正则、调色板颜色、文本样式) |
|
||||
| 1.13.0 | OpenIDEA 0.1.49 | 新增 `search-provider` 导出和 `searchCategories` 贡献点:可取消查询的全局搜索自定义分类 |
|
||||
| 1.14.0 | `main` 上开发中 | 可选 `hover-actions` 导出:行内侧 hover 显示的左侧操作,带锚定行和包含式触发行范围 |
|
||||
| 1.13.0 | `main` 上开发中 | 新增 `search-provider` 导出和 `searchCategories` 贡献点:可取消查询的全局搜索自定义分类 |
|
||||
|
||||
每个版本新增内容的完整列表见 [`plugins/README.md`](https://github.com/l0ng-ai/openidea/blob/main/plugins/README.md)。
|
||||
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { expect, test } from "./fixtures";
|
||||
|
||||
async function showBuild(page: Page) {
|
||||
await page.evaluate(async () => {
|
||||
const storePath = "/src/features/build/store.ts";
|
||||
const layoutPath = "/src/workbench/toolwindows/store.ts";
|
||||
const { useBuildRun } = await import(/* @vite-ignore */ storePath);
|
||||
const { showToolWindow } = await import(/* @vite-ignore */ layoutPath);
|
||||
useBuildRun.setState({
|
||||
title: "Build Project",
|
||||
system: "typescript",
|
||||
status: "failed",
|
||||
durationMs: 1200,
|
||||
selected: null,
|
||||
lines: [
|
||||
{ kind: "out", text: "Compiling TypeScript" },
|
||||
{ kind: "err", text: "Expected a number" },
|
||||
],
|
||||
messages: [{ severity: "error", text: "Expected a number", path: null, range: null, code: null }],
|
||||
});
|
||||
showToolWindow("build", true);
|
||||
});
|
||||
const build = page.getByRole("region", { name: "Build", exact: true });
|
||||
await expect(build.getByRole("log", { name: "Build output" })).toBeVisible();
|
||||
return build;
|
||||
}
|
||||
|
||||
test("Build gives about two thirds of the initial split to output", async ({ workbench: page }) => {
|
||||
const build = await showBuild(page);
|
||||
const tree = build.locator("[data-panel][id=build-tree]");
|
||||
const console = build.locator("[data-panel][id=build-console]");
|
||||
const treeWidth = (await tree.boundingBox())!.width;
|
||||
const consoleWidth = (await console.boundingBox())!.width;
|
||||
expect(treeWidth / (treeWidth + consoleWidth)).toBeCloseTo(0.33, 2);
|
||||
});
|
||||
|
||||
test("Build output and diagnostics respond to a console font change", async ({ workbench: page }) => {
|
||||
const build = await showBuild(page);
|
||||
const log = build.getByRole("log", { name: "Build output" });
|
||||
const rowGap = async () => {
|
||||
const first = (await log.getByText("Compiling TypeScript", { exact: true }).boundingBox())!;
|
||||
const second = (await log.getByText("Expected a number", { exact: true }).boundingBox())!;
|
||||
return second.y - first.y;
|
||||
};
|
||||
await expect.poll(rowGap).toBe(20);
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ path);
|
||||
const { settings } = useProject.getState();
|
||||
useProject.setState({
|
||||
settings: {
|
||||
...settings,
|
||||
terminal: {
|
||||
...settings?.terminal,
|
||||
useEditorFont: false,
|
||||
fontFamily: "Fira Code",
|
||||
fallbackFontFamily: "Maple Mono NF CN",
|
||||
fontSize: 18,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
await expect(log).toHaveCSS("font-size", "18px");
|
||||
await expect(log).toHaveCSS("font-family", /"Fira Code".*"Maple Mono NF CN"/);
|
||||
await expect.poll(rowGap).toBe(27);
|
||||
await build.getByRole("treeitem", { name: "Expected a number", exact: true }).click();
|
||||
const diagnostic = build.getByRole("document", { name: "Build message" });
|
||||
await expect(diagnostic).toContainText("Expected a number");
|
||||
await expect(diagnostic).toHaveCSS("font-size", "18px");
|
||||
await expect(diagnostic).toHaveCSS("line-height", "27px");
|
||||
});
|
||||
@@ -98,59 +98,3 @@ test("commit message history opens above the message without an empty icon colum
|
||||
expect(Math.abs(menuBox!.x - messageBox!.x)).toBeLessThan(2);
|
||||
await expect(row.locator("span")).toHaveCount(1);
|
||||
});
|
||||
|
||||
test("the Commit changes toolbar fits a narrow side pane", async ({ workbench: page }) => {
|
||||
await stubRepository(page);
|
||||
await page.keyboard.press("Meta+k");
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/workbench/toolwindows/store.ts";
|
||||
const layout = await import(/* @vite-ignore */ path);
|
||||
layout.moveToolWindow("commit", "left");
|
||||
layout.setToolWindowSize("left", 164);
|
||||
});
|
||||
const panel = page.getByRole("region", { name: "Commit", exact: true });
|
||||
const toolbar = panel.getByRole("toolbar", { name: "Changes" });
|
||||
await expect(toolbar).toBeVisible();
|
||||
const clipped = await toolbar.evaluate((bar) => {
|
||||
const bounds = bar.getBoundingClientRect();
|
||||
return [...bar.querySelectorAll("button")].flatMap((button) => {
|
||||
const box = button.getBoundingClientRect();
|
||||
return box.right > bounds.right + 1 || box.bottom > bounds.bottom + 1 ? [button.ariaLabel] : [];
|
||||
});
|
||||
});
|
||||
expect(clipped).toEqual([]);
|
||||
const push = panel.getByRole("button", { name: "Commit and Push…" });
|
||||
const overflow = await push.locator("span").evaluate((label) => label.scrollWidth - label.clientWidth);
|
||||
expect(overflow).toBeLessThanOrEqual(1);
|
||||
await toolbar.getByRole("button", { name: "Collapse All" }).click();
|
||||
await expect(panel.getByRole("checkbox", { name: "Include build.gradle.kts in commit" })).toBeHidden();
|
||||
});
|
||||
|
||||
test("the commit message uses the configured editor typography", async ({ workbench: page }) => {
|
||||
await stubRepository(page);
|
||||
await page.keyboard.press("Meta+k");
|
||||
const message = page.getByRole("textbox", { name: "Commit message" });
|
||||
await expect(message).toBeFocused();
|
||||
await page.evaluate(async () => {
|
||||
const path = "/src/platform/project.ts";
|
||||
const { useProject } = await import(/* @vite-ignore */ path);
|
||||
const settings = useProject.getState().settings;
|
||||
useProject.setState({
|
||||
settings: {
|
||||
...settings,
|
||||
editor: {
|
||||
...settings?.editor,
|
||||
fontFamily: "Fira Code",
|
||||
fallbackFont: "Maple Mono NF CN",
|
||||
fontSize: 17,
|
||||
lineHeight: 28,
|
||||
fontWeight: 500,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
await expect(message).toHaveCSS("font-size", "17px");
|
||||
await expect(message).toHaveCSS("line-height", "28px");
|
||||
await expect(message).toHaveCSS("font-weight", "500");
|
||||
await expect(message).toHaveCSS("font-family", /"Fira Code".*"Maple Mono NF CN"/);
|
||||
});
|
||||
Loaded 100 of 273 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Заблокувати користувача