дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-05 01:31:41 +02:00
- ide-web: built-in static server on 127.0.0.1 that serves project files, plus detection and launching of installed browsers. - Open In › Browser in the editor, project view and tab menus; browser bar and built-in preview beside HTML editors; ⌃⇧R opens the default browser. - Emmet: Tab expansion in markup editors and Update Tag with Emmet. Claude-Session: https://claude.ai/code/session_01SaPPsVPuk6ZTNsoUCNCbMv
30 рядки
1005 B
Rust
30 рядки
1005 B
Rust
//! Web browsers: the built-in server's URLs and launching browsers.
|
|
|
|
use super::coverage::blocking;
|
|
use crate::state::AppState;
|
|
use ide_core::{IdeResult, IpcPath};
|
|
use ide_web::Browser;
|
|
use tauri::{State, Window};
|
|
|
|
/// The browsers installed on this machine.
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn web_browsers() -> IdeResult<Vec<Browser>> {
|
|
blocking(|| Ok(ide_web::installed())).await
|
|
}
|
|
|
|
/// The built-in server's URL for `path` (started on first use).
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn web_url(window: Window, state: State<'_, AppState>, path: IpcPath) -> IdeResult<String> {
|
|
let root = state.project(window.label()).ok().map(|p| p.root.clone());
|
|
state.web.url_for(root.as_deref(), &path).await
|
|
}
|
|
|
|
/// Opens `url` in `browser` (an id from `web_browsers`), or the default browser.
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn web_open(url: String, browser: Option<String>) -> IdeResult<()> {
|
|
blocking(move || ide_web::open(&url, browser.as_deref())).await
|
|
}
|