diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index eef6b9e393..39a7cc45b4 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -166,8 +166,8 @@ jobs:
os-version: lunar
- os-name: ubuntu
os-version: mantic
- # - os-name: ubuntu
- # os-version: noble
+ - os-name: ubuntu
+ os-version: noble
steps:
- uses: actions/checkout@v4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e31fa27cad..2d770c0584 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,28 @@
## Unreleased
+### Features/Changes
+
+- Add Ubuntu 24.04 LTS (noble) build
+
+### Bug Fixes
+
+## 0.4.2
+
+### Features/Changes
+- Implement "Run in terminal"
+- Implement document symbols in a panel
+- Implement "Go To Location" functionality in the Diff editor.
+- Implement on screen find which is similar to `f` in vim but for the whole screen.
+- Make file explorer horizontal scrollable
+- Implement "Reveal in system file explorer"
+
+### Bug Fixes
+- Fix markdown syntax highlighting
+- Fix click issue on window error message
+
+## 0.4.1
+
### Features/Changes
- Add fedora builds
- Finish tree sitter dynamic libary support by downloading from https://github.com/lapce/tree-sitter-grammars
diff --git a/Cargo.lock b/Cargo.lock
index f08869645e..512e479805 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1684,7 +1684,7 @@ checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
[[package]]
name = "floem"
version = "0.1.1"
-source = "git+https://github.com/lapce/floem?rev=54f0d1bcf0e1a91d82492ee7300a526adb60eb5c#54f0d1bcf0e1a91d82492ee7300a526adb60eb5c"
+source = "git+https://github.com/lapce/floem?rev=157631a49d6ba13a3467dcb994eb46a98c52eb76#157631a49d6ba13a3467dcb994eb46a98c52eb76"
dependencies = [
"bitflags 2.6.0",
"copypasta",
@@ -1702,7 +1702,6 @@ dependencies = [
"image",
"indexmap",
"lapce-xi-rope",
- "once_cell",
"parking_lot",
"peniko",
"raw-window-handle 0.6.0",
@@ -1722,13 +1721,12 @@ dependencies = [
[[package]]
name = "floem-editor-core"
version = "0.1.1"
-source = "git+https://github.com/lapce/floem?rev=54f0d1bcf0e1a91d82492ee7300a526adb60eb5c#54f0d1bcf0e1a91d82492ee7300a526adb60eb5c"
+source = "git+https://github.com/lapce/floem?rev=157631a49d6ba13a3467dcb994eb46a98c52eb76#157631a49d6ba13a3467dcb994eb46a98c52eb76"
dependencies = [
"bitflags 2.6.0",
"itertools 0.12.1",
"lapce-xi-rope",
"memchr",
- "once_cell",
"serde",
"strum",
"strum_macros",
@@ -1800,7 +1798,7 @@ dependencies = [
[[package]]
name = "floem_reactive"
version = "0.1.1"
-source = "git+https://github.com/lapce/floem?rev=54f0d1bcf0e1a91d82492ee7300a526adb60eb5c#54f0d1bcf0e1a91d82492ee7300a526adb60eb5c"
+source = "git+https://github.com/lapce/floem?rev=157631a49d6ba13a3467dcb994eb46a98c52eb76#157631a49d6ba13a3467dcb994eb46a98c52eb76"
dependencies = [
"smallvec",
]
@@ -1808,7 +1806,7 @@ dependencies = [
[[package]]
name = "floem_renderer"
version = "0.1.1"
-source = "git+https://github.com/lapce/floem?rev=54f0d1bcf0e1a91d82492ee7300a526adb60eb5c#54f0d1bcf0e1a91d82492ee7300a526adb60eb5c"
+source = "git+https://github.com/lapce/floem?rev=157631a49d6ba13a3467dcb994eb46a98c52eb76#157631a49d6ba13a3467dcb994eb46a98c52eb76"
dependencies = [
"cosmic-text",
"image",
@@ -1821,7 +1819,7 @@ dependencies = [
[[package]]
name = "floem_tiny_skia_renderer"
version = "0.1.1"
-source = "git+https://github.com/lapce/floem?rev=54f0d1bcf0e1a91d82492ee7300a526adb60eb5c#54f0d1bcf0e1a91d82492ee7300a526adb60eb5c"
+source = "git+https://github.com/lapce/floem?rev=157631a49d6ba13a3467dcb994eb46a98c52eb76#157631a49d6ba13a3467dcb994eb46a98c52eb76"
dependencies = [
"anyhow",
"bytemuck",
@@ -1838,7 +1836,7 @@ dependencies = [
[[package]]
name = "floem_vger_renderer"
version = "0.1.1"
-source = "git+https://github.com/lapce/floem?rev=54f0d1bcf0e1a91d82492ee7300a526adb60eb5c#54f0d1bcf0e1a91d82492ee7300a526adb60eb5c"
+source = "git+https://github.com/lapce/floem?rev=157631a49d6ba13a3467dcb994eb46a98c52eb76#157631a49d6ba13a3467dcb994eb46a98c52eb76"
dependencies = [
"anyhow",
"floem-vger",
@@ -2906,7 +2904,7 @@ dependencies = [
[[package]]
name = "lapce"
-version = "0.4.0"
+version = "0.4.2"
dependencies = [
"lapce-app",
"lapce-proxy",
@@ -2914,7 +2912,7 @@ dependencies = [
[[package]]
name = "lapce-app"
-version = "0.4.0"
+version = "0.4.2"
dependencies = [
"Inflector",
"alacritty_terminal",
@@ -2971,14 +2969,14 @@ dependencies = [
"tracing-subscriber",
"unicode-width",
"url",
- "windows-sys 0.52.0",
+ "windows-sys 0.36.1",
"zip",
"zstd",
]
[[package]]
name = "lapce-core"
-version = "0.4.0"
+version = "0.4.2"
dependencies = [
"ahash",
"anyhow",
@@ -3006,7 +3004,7 @@ dependencies = [
[[package]]
name = "lapce-proxy"
-version = "0.4.0"
+version = "0.4.2"
dependencies = [
"alacritty_terminal",
"anyhow",
@@ -3055,7 +3053,7 @@ dependencies = [
[[package]]
name = "lapce-rpc"
-version = "0.4.0"
+version = "0.4.2"
dependencies = [
"anyhow",
"crossbeam-channel",
diff --git a/Cargo.toml b/Cargo.toml
index 658c97f93d..b142f39dc7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ path = "lapce-proxy/src/bin/lapce-proxy.rs"
members = ["lapce-app", "lapce-proxy", "lapce-rpc", "lapce-core"]
[workspace.package]
-version = "0.4.0"
+version = "0.4.2"
edition = "2021"
rust-version = "1.77.0"
license = "Apache-2.0"
@@ -76,9 +76,9 @@ lapce-core = { path = "./lapce-core" }
lapce-rpc = { path = "./lapce-rpc" }
lapce-proxy = { path = "./lapce-proxy" }
-floem = { git = "https://github.com/lapce/floem", rev = "54f0d1bcf0e1a91d82492ee7300a526adb60eb5c", features = ["editor", "serde", "default-image-formats", "rfd-async-std"] }
+floem = { git = "https://github.com/lapce/floem", rev = "157631a49d6ba13a3467dcb994eb46a98c52eb76", features = ["editor", "serde", "default-image-formats", "rfd-async-std"] }
# floem = { path = "../floem", features = ["editor", "serde", "default-image-formats", "rfd-async-std"] }
-floem-editor-core = { git = "https://github.com/lapce/floem", rev = "54f0d1bcf0e1a91d82492ee7300a526adb60eb5c", features = ["serde"] }
+floem-editor-core = { git = "https://github.com/lapce/floem", rev = "157631a49d6ba13a3467dcb994eb46a98c52eb76", features = ["serde"] }
# floem-editor-core = { path = "../floem/editor-core/", features = ["serde"] }
[patch.crates-io]
diff --git a/defaults/dark-theme.toml b/defaults/dark-theme.toml
index 478d501a64..8d3c6ce0c4 100644
--- a/defaults/dark-theme.toml
+++ b/defaults/dark-theme.toml
@@ -68,6 +68,14 @@ dim-text = "#5C6370"
"variable.other.member" = "$red"
"tag" = "$blue"
+"markup.heading" = "$red"
+"markup.bold" = "$orange"
+"markup.italic" = "$orange"
+"markup.list" = "$orange"
+"markup.link.url" = "$blue"
+"markup.link.label" = "$purple"
+"markup.link.text" = "$purple"
+
"bracket.color.1" = "$blue"
"bracket.color.2" = "$yellow"
"bracket.color.3" = "$purple"
diff --git a/defaults/icon-theme.toml b/defaults/icon-theme.toml
index 8bda5b1de8..4a818c9bee 100644
--- a/defaults/icon-theme.toml
+++ b/defaults/icon-theme.toml
@@ -36,6 +36,7 @@ name = "Lapce Codicons"
"keyboard" = "keyboard.svg"
"breadcrumb_separator" = "chevron-right.svg"
"symbol_color" = "symbol-color.svg"
+"type_hierarchy" = "type-hierarchy.svg"
"window.close" = "chrome-close.svg"
"window.restore" = "chrome-restore.svg"
@@ -103,6 +104,7 @@ name = "Lapce Codicons"
"search.replace" = "replace.svg"
"search.replace_all" = "replace-all.svg"
+"document_symbol" = "symbol-class.svg"
"symbol_kind.array" = "symbol-array.svg"
"symbol_kind.boolean" = "symbol-boolean.svg"
"symbol_kind.class" = "symbol-class.svg"
diff --git a/defaults/light-theme.toml b/defaults/light-theme.toml
index 5cef4861b2..570e6f75b2 100644
--- a/defaults/light-theme.toml
+++ b/defaults/light-theme.toml
@@ -74,6 +74,14 @@ dim-text = "#A0A1A7"
"variable.other.member" = "$red"
"tag" = "$blue"
+"markup.heading" = "$red"
+"markup.bold" = "$orange"
+"markup.italic" = "$orange"
+"markup.list" = "$orange"
+"markup.link.url" = "$blue"
+"markup.link.label" = "$purple"
+"markup.link.text" = "$purple"
+
"bracket.color.1" = "$blue"
"bracket.color.2" = "$yellow"
"bracket.color.3" = "$purple"
diff --git a/defaults/settings.toml b/defaults/settings.toml
index 99da8916f3..6ee6042913 100644
--- a/defaults/settings.toml
+++ b/defaults/settings.toml
@@ -5,6 +5,8 @@ modal = false
color-theme = "Lapce Dark"
icon-theme = "Lapce Codicons"
custom-titlebar = true
+file-exploerer-double-click = false
+auto-reload-plugin = false
[editor]
font-family = "monospace"
@@ -21,7 +23,9 @@ wrap-style = "editor-width"
wrap-column = 80
wrap-width = 600 # px
sticky-header = true
+completion-width = 600
completion-show-documentation = true
+completion-item-show-detail = false
show-signature = true
signature-label-code-block = true
auto-closing-matching-pairs = true
diff --git a/extra/linux/dev.lapce.lapce.metainfo.xml b/extra/linux/dev.lapce.lapce.metainfo.xml
index 99d322aff3..2156280bdf 100644
--- a/extra/linux/dev.lapce.lapce.metainfo.xml
+++ b/extra/linux/dev.lapce.lapce.metainfo.xml
@@ -30,6 +30,6 @@
-
+
diff --git a/extra/macos/Lapce.app/Contents/Info.plist b/extra/macos/Lapce.app/Contents/Info.plist
index 2f6f78e208..45b6321f10 100644
--- a/extra/macos/Lapce.app/Contents/Info.plist
+++ b/extra/macos/Lapce.app/Contents/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.4.0
+ 0.4.2
CFBundleSupportedPlatforms
MacOSX
diff --git a/extra/windows/wix/lapce.wxs b/extra/windows/wix/lapce.wxs
index b2d0e4c600..dbc0890515 100644
--- a/extra/windows/wix/lapce.wxs
+++ b/extra/windows/wix/lapce.wxs
@@ -1,6 +1,6 @@
-
+
diff --git a/icons/codicons/type-hierarchy.svg b/icons/codicons/type-hierarchy.svg
new file mode 100644
index 0000000000..bcbc902e40
--- /dev/null
+++ b/icons/codicons/type-hierarchy.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/lapce-app/src/about.rs b/lapce-app/src/about.rs
index 7a3c47b913..a800a99ad3 100644
--- a/lapce-app/src/about.rs
+++ b/lapce-app/src/about.rs
@@ -3,7 +3,7 @@ use std::rc::Rc;
use floem::{
event::EventListener,
keyboard::Modifiers,
- reactive::{RwSignal, Scope},
+ reactive::{RwSignal, Scope, SignalGet, SignalUpdate},
style::{CursorStyle, Display, Position},
views::{container, label, stack, svg, Decorators},
View,
diff --git a/lapce-app/src/alert.rs b/lapce-app/src/alert.rs
index c56f32eb8b..8e2b7ac853 100644
--- a/lapce-app/src/alert.rs
+++ b/lapce-app/src/alert.rs
@@ -6,7 +6,7 @@ use std::{
use floem::{
event::EventListener,
- reactive::{ReadSignal, RwSignal, Scope},
+ reactive::{ReadSignal, RwSignal, Scope, SignalGet, SignalUpdate},
style::CursorStyle,
views::{container, dyn_stack, label, stack, svg, Decorators},
View,
diff --git a/lapce-app/src/app.rs b/lapce-app/src/app.rs
index 36a04eb11d..507ab0e21b 100644
--- a/lapce-app/src/app.rs
+++ b/lapce-app/src/app.rs
@@ -23,7 +23,7 @@ use floem::{
},
reactive::{
create_effect, create_memo, create_rw_signal, provide_context, use_context,
- ReadSignal, RwSignal, Scope,
+ ReadSignal, RwSignal, Scope, SignalGet, SignalUpdate, SignalWith,
},
style::{
AlignItems, CursorStyle, Display, FlexDirection, JustifyContent, Position,
@@ -38,9 +38,7 @@ use floem::{
views::{
clip, container, drag_resize_window_area, drag_window_area, dyn_stack,
empty, label, rich_text,
- scroll::{
- scroll, HideBar, PropagatePointerWheel, VerticalScrollAsHorizontal,
- },
+ scroll::{scroll, PropagatePointerWheel, VerticalScrollAsHorizontal},
stack, svg, tab, text, tooltip, virtual_stack, Decorators, VirtualDirection,
VirtualItemSize, VirtualVector,
},
@@ -256,7 +254,9 @@ impl AppData {
match cmd {
AppCommand::SaveApp => {
let db: Arc = use_context().unwrap();
- let _ = db.save_app(self);
+ if let Err(err) = db.save_app(self) {
+ tracing::error!("{:?}", err);
+ }
}
AppCommand::WindowClosed(window_id) => {
if self.app_terminated.get_untracked() {
@@ -264,7 +264,9 @@ impl AppData {
}
let db: Arc = use_context().unwrap();
if self.windows.with_untracked(|w| w.len()) == 1 {
- let _ = db.insert_app(self.clone());
+ if let Err(err) = db.insert_app(self.clone()) {
+ tracing::error!("{:?}", err);
+ }
}
let window_data = self
.windows
@@ -273,7 +275,9 @@ impl AppData {
if let Some(window_data) = window_data {
window_data.scope.dispose();
}
- let _ = db.save_app(self);
+ if let Err(err) = db.save_app(self) {
+ tracing::error!("{:?}", err);
+ }
}
AppCommand::CloseWindow(window_id) => {
floem::close_window(window_id);
@@ -359,24 +363,29 @@ impl AppData {
}
} else if files.is_empty() {
// There were no dirs and no files specified, so we'll load the last windows
- if let Ok(app_info) = db.get_app() {
- for info in app_info.windows {
- let config = self
- .default_window_config()
- .size(info.size)
- .position(info.pos);
- let config = if cfg!(target_os = "macos")
- || self.config.get_untracked().core.custom_titlebar
- {
- config.show_titlebar(false)
- } else {
- config
- };
- let app_data = self.clone();
- app = app.window(
- move |window_id| app_data.app_view(window_id, info),
- Some(config),
- );
+ match db.get_app() {
+ Ok(app_info) => {
+ for info in app_info.windows {
+ let config = self
+ .default_window_config()
+ .size(info.size)
+ .position(info.pos);
+ let config = if cfg!(target_os = "macos")
+ || self.config.get_untracked().core.custom_titlebar
+ {
+ config.show_titlebar(false)
+ } else {
+ config
+ };
+ let app_data = self.clone();
+ app = app.window(
+ move |window_id| app_data.app_view(window_id, info),
+ Some(config),
+ );
+ }
+ }
+ Err(err) => {
+ tracing::error!("{:?}", err);
}
}
}
@@ -1055,9 +1064,9 @@ fn editor_tab_header(
.with_untracked(|editor_tab| editor_tab.children[active].1)
.get_untracked()
})
+ .scroll_style(|s| s.hide_bars(true))
.style(|s| {
- s.set(HideBar, true)
- .set(VerticalScrollAsHorizontal, true)
+ s.set(VerticalScrollAsHorizontal, true)
.absolute()
.size_full()
}),
@@ -2261,10 +2270,11 @@ fn palette_item(
.style(move |s| {
let config = config.get();
let size = config.ui.icon_size() as f32;
- s.min_width(size)
- .size(size, size)
- .margin_right(5.0)
- .color(config.color(LapceColor::LAPCE_ICON_ACTIVE))
+ s.min_width(size).size(size, size).margin_right(5.0).color(
+ config.symbol_color(&kind).unwrap_or_else(|| {
+ config.color(LapceColor::LAPCE_ICON_ACTIVE)
+ }),
+ )
}),
focus_text(
move || text.clone(),
@@ -2795,10 +2805,10 @@ fn window_message_view(
}),
stack((
text(title.clone()).style(|s| {
- s.min_width(0.0).line_height(1.6).font_weight(Weight::BOLD)
+ s.min_width(0.0).line_height(1.8).font_weight(Weight::BOLD)
}),
text(message.message.clone()).style(|s| {
- s.min_width(0.0).line_height(1.6).margin_top(5.0)
+ s.min_width(0.0).line_height(1.8).margin_top(5.0)
}),
))
.style(move |s| {
@@ -2818,6 +2828,7 @@ fn window_message_view(
)
.style(|s| s.margin_left(6.0)),
))
+ .on_event_stop(EventListener::PointerDown, |_| {})
.style(move |s| {
let config = config.get();
s.width_full()
@@ -2846,7 +2857,11 @@ fn window_message_view(
.style(|s| s.flex_col().width_full()),
)
.style(|s| {
- s.absolute().width_full().min_height(0.0).max_height_full()
+ s.absolute()
+ .width_full()
+ .min_height(0.0)
+ .max_height_full()
+ .set(PropagatePointerWheel, false)
}),
)
.style(|s| s.size_full()),
@@ -2930,6 +2945,7 @@ fn hover(window_tab_data: Rc) -> impl View {
layout_rect.set(rect);
})
.on_event_stop(EventListener::PointerMove, |_| {})
+ .on_event_stop(EventListener::PointerDown, |_| {})
.style(move |s| {
let active = window_tab_data.common.hover.active.get();
if !active {
@@ -2996,7 +3012,16 @@ fn completion(window_tab_data: Rc) -> impl View {
)
}),
focus_text(
- move || item.item.label.clone(),
+ move || {
+ if config.get().editor.completion_item_show_detail {
+ item.item
+ .detail
+ .clone()
+ .unwrap_or(item.item.label.clone())
+ } else {
+ item.item.label.clone()
+ }
+ },
move || item.indices.clone(),
move || config.get().color(LapceColor::EDITOR_FOCUS),
)
@@ -3060,7 +3085,7 @@ fn completion(window_tab_data: Rc) -> impl View {
let config = config.get();
let origin = window_tab_data.completion_origin();
s.position(Position::Absolute)
- .width(400.0)
+ .width(config.editor.completion_width as i32)
.max_height(400.0)
.margin_left(origin.x as f32)
.margin_top(origin.y as f32)
@@ -3617,7 +3642,11 @@ fn window(window_data: WindowData) -> impl View {
}
pub fn launch() {
- logging::panic_hook();
+ let cli = Cli::parse();
+
+ if !cli.wait {
+ logging::panic_hook();
+ }
let (reload_handle, _guard) = logging::logging();
trace!(TraceLevel::INFO, "Starting up Lapce..");
@@ -3653,8 +3682,6 @@ pub fn launch() {
load_shell_env();
}
- let cli = Cli::parse();
-
// small hack to unblock terminal if launched from it
// launch it as a separate process that waits
if !cli.wait {
@@ -3702,18 +3729,25 @@ pub fn launch() {
// If the cli is not requesting a new window, and we're not developing a plugin, we try to open
// in the existing Lapce process
if !cli.new {
- if let Ok(socket) = get_socket() {
- if let Err(e) = try_open_in_existing_process(socket, &cli.paths) {
- trace!(TraceLevel::ERROR, "failed to open path(s): {e}");
- };
- return;
+ match get_socket() {
+ Ok(socket) => {
+ if let Err(e) = try_open_in_existing_process(socket, &cli.paths) {
+ trace!(TraceLevel::ERROR, "failed to open path(s): {e}");
+ };
+ return;
+ }
+ Err(err) => {
+ tracing::error!("{:?}", err);
+ }
}
}
#[cfg(feature = "updater")]
crate::update::cleanup();
- let _ = lapce_proxy::register_lapce_path();
+ if let Err(err) = lapce_proxy::register_lapce_path() {
+ tracing::error!("{:?}", err);
+ }
let db = match LapceDb::new() {
Ok(db) => Arc::new(db),
Err(e) => {
@@ -3736,16 +3770,24 @@ pub fn launch() {
let (tx, rx) = crossbeam_channel::bounded(1);
let mut watcher = notify::recommended_watcher(ConfigWatcher::new(tx)).unwrap();
if let Some(path) = LapceConfig::settings_file() {
- let _ = watcher.watch(&path, notify::RecursiveMode::Recursive);
+ if let Err(err) = watcher.watch(&path, notify::RecursiveMode::Recursive) {
+ tracing::error!("{:?}", err);
+ }
}
if let Some(path) = Directory::themes_directory() {
- let _ = watcher.watch(&path, notify::RecursiveMode::Recursive);
+ if let Err(err) = watcher.watch(&path, notify::RecursiveMode::Recursive) {
+ tracing::error!("{:?}", err);
+ }
}
if let Some(path) = LapceConfig::keymaps_file() {
- let _ = watcher.watch(&path, notify::RecursiveMode::Recursive);
+ if let Err(err) = watcher.watch(&path, notify::RecursiveMode::Recursive) {
+ tracing::error!("{:?}", err);
+ }
}
if let Some(path) = Directory::plugins_directory() {
- let _ = watcher.watch(&path, notify::RecursiveMode::Recursive);
+ if let Err(err) = watcher.watch(&path, notify::RecursiveMode::Recursive) {
+ tracing::error!("{:?}", err);
+ }
}
let windows = scope.create_rw_signal(im::HashMap::new());
@@ -3775,6 +3817,7 @@ pub fn launch() {
let notification = create_signal_from_channel(rx);
create_effect(move |_| {
if notification.get().is_some() {
+ tracing::debug!("notification reload_config");
app_data.reload_config();
}
});
@@ -3802,38 +3845,44 @@ pub fn launch() {
}
}
});
- std::thread::spawn(move || {
- use self::grammars::*;
- let updated = match find_grammar_release() {
- Ok(release) => {
- let mut updated = false;
- match fetch_grammars(&release) {
- Err(e) => {
- trace!(
- TraceLevel::ERROR,
- "failed to fetch grammars: {e}"
- );
+ std::thread::Builder::new()
+ .name("FindGrammar".to_owned())
+ .spawn(move || {
+ use self::grammars::*;
+ let updated = match find_grammar_release() {
+ Ok(release) => {
+ let mut updated = false;
+ match fetch_grammars(&release) {
+ Err(e) => {
+ trace!(
+ TraceLevel::ERROR,
+ "failed to fetch grammars: {e}"
+ );
+ }
+ Ok(u) => updated |= u,
}
- Ok(u) => updated |= u,
- }
- match fetch_queries(&release) {
- Err(e) => {
- trace!(
- TraceLevel::ERROR,
- "failed to fetch grammars: {e}"
- );
+ match fetch_queries(&release) {
+ Err(e) => {
+ trace!(
+ TraceLevel::ERROR,
+ "failed to fetch grammars: {e}"
+ );
+ }
+ Ok(u) => updated |= u,
}
- Ok(u) => updated |= u,
+ updated
}
- updated
- }
- Err(e) => {
- trace!(TraceLevel::ERROR, "failed to obtain release info: {e}");
- false
- }
- };
- send(updated);
- });
+ Err(e) => {
+ trace!(
+ TraceLevel::ERROR,
+ "failed to obtain release info: {e}"
+ );
+ false
+ }
+ };
+ send(updated);
+ })
+ .unwrap();
}
#[cfg(feature = "updater")]
@@ -3846,12 +3895,17 @@ pub fn launch() {
latest_release.set(Arc::new(Some(release)));
}
});
- std::thread::spawn(move || loop {
- if let Ok(release) = crate::update::get_latest_release() {
- let _ = tx.send(release);
- }
- std::thread::sleep(std::time::Duration::from_secs(60 * 60));
- });
+ std::thread::Builder::new()
+ .name("LapceUpdater".to_owned())
+ .spawn(move || loop {
+ if let Ok(release) = crate::update::get_latest_release() {
+ if let Err(err) = tx.send(release) {
+ tracing::error!("{:?}", err);
+ }
+ }
+ std::thread::sleep(std::time::Duration::from_secs(60 * 60));
+ })
+ .unwrap();
}
{
@@ -3865,9 +3919,14 @@ pub fn launch() {
}
}
});
- std::thread::spawn(move || {
- let _ = listen_local_socket(tx);
- });
+ std::thread::Builder::new()
+ .name("ListenLocalSocket".to_owned())
+ .spawn(move || {
+ if let Err(err) = listen_local_socket(tx) {
+ tracing::error!("{:?}", err);
+ }
+ })
+ .unwrap();
}
{
@@ -3880,7 +3939,9 @@ pub fn launch() {
app.on_event(move |event| match event {
floem::AppEvent::WillTerminate => {
app_data.app_terminated.set(true);
- let _ = db.insert_app(app_data.clone());
+ if let Err(err) = db.insert_app(app_data.clone()) {
+ tracing::error!("{:?}", err);
+ }
}
floem::AppEvent::Reopen {
has_visible_windows,
@@ -3894,7 +3955,7 @@ pub fn launch() {
}
/// Uses a login shell to load the correct shell environment for the current user.
-fn load_shell_env() {
+pub fn load_shell_env() {
use std::process::Command;
use tracing::warn;
@@ -3921,7 +3982,10 @@ fn load_shell_env() {
command.args(["--login", "-c", "printenv"]);
#[cfg(windows)]
- command.args(["{ ls env: | foreach { '{0}={1}' -f $_.Name, $_.Value } }"]);
+ command.args(&[
+ "-Command",
+ "Get-ChildItem env: | ForEach-Object { \"{0}={1}\" -f $_.Name, $_.Value }",
+ ]);
let env = match command.output() {
Ok(output) => String::from_utf8(output.stdout).unwrap_or_default(),
@@ -3937,7 +4001,8 @@ fn load_shell_env() {
env.split('\n')
.filter_map(|line| line.split_once('='))
- .for_each(|(key, value)| {
+ .for_each(|(key, value)| unsafe {
+ let value = value.trim_matches('\r');
if let Ok(v) = std::env::var(key) {
if v != value {
warn!("Overwriting '{key}', previous value: '{v}', new value '{value}'");
@@ -3986,7 +4051,11 @@ pub fn try_open_in_existing_process(
fn listen_local_socket(tx: Sender) -> Result<()> {
let local_socket = Directory::local_socket()
.ok_or_else(|| anyhow!("can't get local socket folder"))?;
- let _ = std::fs::remove_file(&local_socket);
+ if local_socket.exists() {
+ if let Err(err) = std::fs::remove_file(&local_socket) {
+ tracing::error!("{:?}", err);
+ }
+ }
let socket =
interprocess::local_socket::LocalSocketListener::bind(local_socket)?;
@@ -4005,8 +4074,12 @@ fn listen_local_socket(tx: Sender) -> Result<()> {
}
let stream_ref = reader.get_mut();
- let _ = stream_ref.write_all(b"received");
- let _ = stream_ref.flush();
+ if let Err(err) = stream_ref.write_all(b"received") {
+ tracing::error!("{:?}", err);
+ }
+ if let Err(err) = stream_ref.flush() {
+ tracing::error!("{:?}", err);
+ }
}
});
}
diff --git a/lapce-app/src/app/logging.rs b/lapce-app/src/app/logging.rs
index 4a033ac218..1c083c1373 100644
--- a/lapce-app/src/app/logging.rs
+++ b/lapce-app/src/app/logging.rs
@@ -50,6 +50,7 @@ pub(super) fn logging() -> (Handle, Option) {
fmt::Subscriber::default()
.with_line_number(true)
.with_target(true)
+ .with_thread_names(true)
.with_filter(console_filter_targets),
)
.init();
diff --git a/lapce-app/src/code_action.rs b/lapce-app/src/code_action.rs
index 0db20e3d17..f3b93903ff 100644
--- a/lapce-app/src/code_action.rs
+++ b/lapce-app/src/code_action.rs
@@ -3,7 +3,7 @@ use std::rc::Rc;
use floem::{
keyboard::Modifiers,
peniko::kurbo::Rect,
- reactive::{RwSignal, Scope},
+ reactive::{RwSignal, Scope, SignalGet, SignalUpdate},
};
use lapce_core::{command::FocusCommand, mode::Mode, movement::Movement};
use lapce_rpc::plugin::PluginId;
diff --git a/lapce-app/src/code_lens.rs b/lapce-app/src/code_lens.rs
index 3dddfd164f..960f9385b7 100644
--- a/lapce-app/src/code_lens.rs
+++ b/lapce-app/src/code_lens.rs
@@ -1,6 +1,6 @@
use std::rc::Rc;
-use lapce_rpc::dap_types::RunDebugConfig;
+use lapce_rpc::dap_types::{ConfigSource, RunDebugConfig};
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -39,12 +39,12 @@ impl CodeLensData {
pub fn run(&self, command: &str, args: Vec) {
match command {
"rust-analyzer.runSingle" | "rust-analyzer.debugSingle" => {
- if let Some(config) = self.get_rust_command_config(&args) {
- let mode = if command == "rust-analyzer.runSingle" {
- RunDebugMode::Run
- } else {
- RunDebugMode::Debug
- };
+ let mode = if command == "rust-analyzer.runSingle" {
+ RunDebugMode::Run
+ } else {
+ RunDebugMode::Debug
+ };
+ if let Some(config) = self.get_rust_command_config(&args, mode) {
self.common
.internal_command
.send(InternalCommand::RunAndDebug { mode, config });
@@ -56,7 +56,11 @@ impl CodeLensData {
}
}
- fn get_rust_command_config(&self, args: &[Value]) -> Option {
+ fn get_rust_command_config(
+ &self,
+ args: &[Value],
+ mode: RunDebugMode,
+ ) -> Option {
if let Some(args) = args.first() {
let Ok(mut cargo_args) =
serde_json::from_value::(args.clone())
@@ -85,6 +89,8 @@ impl CodeLensData {
prelaunch: None,
debug_command: None,
dap_id: Default::default(),
+ tracing_output: mode == RunDebugMode::Debug,
+ config_source: ConfigSource::CodeLens,
})
} else {
tracing::error!("no args");
diff --git a/lapce-app/src/command.rs b/lapce-app/src/command.rs
index 1ea715861c..20352612e9 100644
--- a/lapce-app/src/command.rs
+++ b/lapce-app/src/command.rs
@@ -187,9 +187,35 @@ pub enum LapceWorkbenchCommand {
#[strum(message = "Show Call Hierarchy")]
ShowCallHierarchy,
- #[strum(serialize = "reveal_in_file_tree")]
- #[strum(message = "Reveal in File Tree")]
- RevealInFileTree,
+ #[strum(serialize = "find_references")]
+ #[strum(message = "Find References")]
+ FindReferences,
+
+ #[strum(serialize = "go_to_implementation")]
+ #[strum(message = "Go to Implementation")]
+ GoToImplementation,
+
+ #[strum(serialize = "reveal_in_panel")]
+ #[strum(message = "Reveal in Panel")]
+ RevealInPanel,
+
+ #[strum(serialize = "source_control_open_active_file_remote_url")]
+ #[strum(message = "Source Control: Open Remote File Url")]
+ SourceControlOpenActiveFileRemoteUrl,
+
+ #[cfg(not(target_os = "macos"))]
+ #[strum(serialize = "reveal_in_file_explorer")]
+ #[strum(message = "Reveal in System File Explorer")]
+ RevealInFileExplorer,
+
+ #[cfg(target_os = "macos")]
+ #[strum(serialize = "reveal_in_file_explorer")]
+ #[strum(message = "Reveal in Finder")]
+ RevealInFileExplorer,
+
+ #[strum(serialize = "run_in_terminal")]
+ #[strum(message = "Run in Terminal")]
+ RunInTerminal,
#[strum(serialize = "reveal_active_file_in_file_explorer")]
#[strum(message = "Reveal Active File in File Explorer")]
@@ -372,6 +398,10 @@ pub enum LapceWorkbenchCommand {
#[strum(serialize = "palette.palette_help")]
PaletteHelp,
+ #[strum(message = "List Palette Types and Files")]
+ #[strum(serialize = "palette.palette_help_and_file")]
+ PaletteHelpAndFile,
+
#[strum(message = "Run and Debug Restart Current Running")]
#[strum(serialize = "palette.run_and_debug_restart")]
RunAndDebugRestart,
@@ -562,6 +592,14 @@ pub enum LapceWorkbenchCommand {
#[strum(serialize = "quit")]
#[strum(message = "Quit Editor")]
Quit,
+
+ #[strum(serialize = "go_to_location")]
+ #[strum(message = "Go to Location")]
+ GoToLocation,
+
+ #[strum(serialize = "add_run_debug_config")]
+ #[strum(message = "Add Run Debug Config")]
+ AddRunDebugConfig,
}
#[derive(Clone, Debug)]
@@ -570,6 +608,9 @@ pub enum InternalCommand {
OpenFile {
path: PathBuf,
},
+ OpenAndConfirmedFile {
+ path: PathBuf,
+ },
OpenFileInNewTab {
path: PathBuf,
},
diff --git a/lapce-app/src/completion.rs b/lapce-app/src/completion.rs
index b71cfe1dae..201612651e 100644
--- a/lapce-app/src/completion.rs
+++ b/lapce-app/src/completion.rs
@@ -2,7 +2,7 @@ use std::{borrow::Cow, path::PathBuf, str::FromStr, sync::Arc};
use floem::{
peniko::kurbo::Rect,
- reactive::{ReadSignal, RwSignal, Scope},
+ reactive::{ReadSignal, RwSignal, Scope, SignalGet, SignalUpdate, SignalWith},
views::editor::{id::EditorId, text::Document},
};
use lapce_core::{
diff --git a/lapce-app/src/config.rs b/lapce-app/src/config.rs
index 4258f636a0..1611db2b78 100644
--- a/lapce-app/src/config.rs
+++ b/lapce-app/src/config.rs
@@ -566,10 +566,13 @@ impl LapceConfig {
let path = Directory::config_directory()?.join("settings.toml");
if !path.exists() {
- let _ = std::fs::OpenOptions::new()
+ if let Err(err) = std::fs::OpenOptions::new()
.create_new(true)
.write(true)
- .open(&path);
+ .open(&path)
+ {
+ tracing::error!("{:?}", err);
+ }
}
Some(path)
@@ -579,10 +582,13 @@ impl LapceConfig {
let path = Directory::config_directory()?.join("keymaps.toml");
if !path.exists() {
- let _ = std::fs::OpenOptions::new()
+ if let Err(err) = std::fs::OpenOptions::new()
.create_new(true)
.write(true)
- .open(&path);
+ .open(&path)
+ {
+ tracing::error!("{:?}", err);
+ }
}
Some(path)
@@ -655,6 +661,36 @@ impl LapceConfig {
Some(self.ui_svg(kind_str))
}
+ pub fn symbol_color(&self, kind: &SymbolKind) -> Option {
+ let theme_str = match *kind {
+ SymbolKind::METHOD => "method",
+ SymbolKind::FUNCTION => "method",
+ SymbolKind::ENUM => "enum",
+ SymbolKind::ENUM_MEMBER => "enum-member",
+ SymbolKind::CLASS => "class",
+ SymbolKind::VARIABLE => "field",
+ SymbolKind::STRUCT => "structure",
+ SymbolKind::CONSTANT => "constant",
+ SymbolKind::PROPERTY => "property",
+ SymbolKind::FIELD => "field",
+ SymbolKind::INTERFACE => "interface",
+ SymbolKind::ARRAY => "",
+ SymbolKind::BOOLEAN => "",
+ SymbolKind::EVENT => "",
+ SymbolKind::FILE => "",
+ SymbolKind::KEY => "",
+ SymbolKind::OBJECT => "",
+ SymbolKind::NAMESPACE => "",
+ SymbolKind::NUMBER => "number",
+ SymbolKind::OPERATOR => "",
+ SymbolKind::TYPE_PARAMETER => "",
+ SymbolKind::STRING => "string",
+ _ => return None,
+ };
+
+ self.style_color(theme_str)
+ }
+
pub fn logo_svg(&self) -> String {
self.svg_store.read().logo_svg()
}
diff --git a/lapce-app/src/config/core.rs b/lapce-app/src/config/core.rs
index fce5ddfb8f..32e24b62d7 100644
--- a/lapce-app/src/config/core.rs
+++ b/lapce-app/src/config/core.rs
@@ -14,4 +14,12 @@ pub struct CoreConfig {
desc = "Enable customised titlebar and disable OS native one (Linux, BSD, Windows)"
)]
pub custom_titlebar: bool,
+ #[field_names(
+ desc = "Only allow double-click to open files in the file explorer"
+ )]
+ pub file_exploerer_double_click: bool,
+ #[field_names(
+ desc = "Enable auto-reload for the plugin when its configuration changes."
+ )]
+ pub auto_reload_plugin: bool,
}
diff --git a/lapce-app/src/config/editor.rs b/lapce-app/src/config/editor.rs
index 68ac74438b..506edac4f4 100644
--- a/lapce-app/src/config/editor.rs
+++ b/lapce-app/src/config/editor.rs
@@ -96,10 +96,16 @@ pub struct EditorConfig {
desc = "Show code context like functions and classes at the top of editor when scroll"
)]
pub sticky_header: bool,
+ #[field_names(desc = "The number of pixels to show completion")]
+ pub completion_width: usize,
#[field_names(
desc = "If the editor should show the documentation of the current completion item"
)]
pub completion_show_documentation: bool,
+ #[field_names(
+ desc = "Should the completion item use the `detail` field to replace the label `field`?"
+ )]
+ pub completion_item_show_detail: bool,
#[field_names(
desc = "If the editor should show the signature of the function as the parameters are being typed"
)]
diff --git a/lapce-app/src/config/icon.rs b/lapce-app/src/config/icon.rs
index a53812e88b..bce4e47bdf 100644
--- a/lapce-app/src/config/icon.rs
+++ b/lapce-app/src/config/icon.rs
@@ -38,6 +38,7 @@ impl LapceIcons {
pub const KEYBOARD: &'static str = "keyboard";
pub const BREADCRUMB_SEPARATOR: &'static str = "breadcrumb_separator";
pub const SYMBOL_COLOR: &'static str = "symbol_color";
+ pub const TYPE_HIERARCHY: &'static str = "type_hierarchy";
pub const FILE: &'static str = "file";
pub const FILE_EXPLORER: &'static str = "file_explorer";
@@ -108,6 +109,12 @@ impl LapceIcons {
pub const FILE_TYPE_SYMLINK_FILE: &'static str = "file-symlink-file";
pub const FILE_TYPE_SYMLINK_DIRECTORY: &'static str = "file-symlink-directory";
+ pub const DOCUMENT_SYMBOL: &'static str = "document_symbol";
+
+ pub const REFERENCES: &'static str = "document_symbol";
+
+ pub const IMPLEMENTATION: &'static str = "document_symbol";
+
pub const SYMBOL_KIND_ARRAY: &'static str = "symbol_kind.array";
pub const SYMBOL_KIND_BOOLEAN: &'static str = "symbol_kind.boolean";
pub const SYMBOL_KIND_CLASS: &'static str = "symbol_kind.class";
diff --git a/lapce-app/src/config/watcher.rs b/lapce-app/src/config/watcher.rs
index c5ea690322..7f65fd65f6 100644
--- a/lapce-app/src/config/watcher.rs
+++ b/lapce-app/src/config/watcher.rs
@@ -9,8 +9,8 @@ pub struct ConfigWatcher {
impl notify::EventHandler for ConfigWatcher {
fn handle_event(&mut self, event: notify::Result) {
- if let Ok(event) = event {
- match event.kind {
+ match event {
+ Ok(event) => match event.kind {
notify::EventKind::Create(_)
| notify::EventKind::Modify(_)
| notify::EventKind::Remove(_) => {
@@ -30,13 +30,18 @@ impl notify::EventHandler for ConfigWatcher {
std::thread::sleep(std::time::Duration::from_millis(
500,
));
- let _ = tx.send(());
+ if let Err(err) = tx.send(()) {
+ tracing::error!("{:?}", err);
+ }
config_mutex
.store(false, std::sync::atomic::Ordering::Relaxed);
});
}
}
_ => {}
+ },
+ Err(err) => {
+ tracing::error!("{:?}", err);
}
}
}
diff --git a/lapce-app/src/db.rs b/lapce-app/src/db.rs
index 1ed885931f..a017deec48 100644
--- a/lapce-app/src/db.rs
+++ b/lapce-app/src/db.rs
@@ -6,7 +6,7 @@ use std::{
use anyhow::{anyhow, Result};
use crossbeam_channel::{unbounded, Sender};
-use floem::peniko::kurbo::Vec2;
+use floem::{peniko::kurbo::Vec2, reactive::SignalGet};
use lapce_core::directory::Directory;
use lapce_rpc::plugin::VoltID;
use sha2::{Digest, Sha256};
@@ -14,7 +14,7 @@ use sha2::{Digest, Sha256};
use crate::{
app::{AppData, AppInfo},
doc::DocInfo,
- panel::{data::PanelOrder, kind::PanelKind, position::PanelPosition},
+ panel::{data::PanelOrder, kind::PanelKind},
window::{WindowData, WindowInfo},
window_tab::WindowTabData,
workspace::{LapceWorkspace, WorkspaceInfo},
@@ -51,7 +51,9 @@ impl LapceDb {
.ok_or_else(|| anyhow!("can't get config directory"))?
.join("db");
let workspace_folder = folder.join("workspaces");
- let _ = std::fs::create_dir_all(&workspace_folder);
+ if let Err(err) = std::fs::create_dir_all(&workspace_folder) {
+ tracing::error!("{:?}", err);
+ }
let (save_tx, save_rx) = unbounded();
@@ -61,35 +63,57 @@ impl LapceDb {
folder,
};
let local_db = db.clone();
- std::thread::spawn(move || -> Result<()> {
- loop {
- let event = save_rx.recv()?;
- match event {
- SaveEvent::App(info) => {
- let _ = local_db.insert_app_info(info);
- }
- SaveEvent::Workspace(workspace, info) => {
- let _ = local_db.insert_workspace(&workspace, &info);
- }
- SaveEvent::RecentWorkspace(workspace) => {
- let _ = local_db.insert_recent_workspace(workspace);
- }
- SaveEvent::Doc(info) => {
- let _ = local_db.insert_doc(&info);
- }
- SaveEvent::DisabledVolts(volts) => {
- let _ = local_db.insert_disabled_volts(volts);
- }
- SaveEvent::WorkspaceDisabledVolts(workspace, volts) => {
- let _ = local_db
- .insert_workspace_disabled_volts(workspace, volts);
- }
- SaveEvent::PanelOrder(order) => {
- let _ = local_db.insert_panel_orders(&order);
+ std::thread::Builder::new()
+ .name("SaveEventHandler".to_owned())
+ .spawn(move || -> Result<()> {
+ loop {
+ let event = save_rx.recv()?;
+ match event {
+ SaveEvent::App(info) => {
+ if let Err(err) = local_db.insert_app_info(info) {
+ tracing::error!("{:?}", err);
+ }
+ }
+ SaveEvent::Workspace(workspace, info) => {
+ if let Err(err) =
+ local_db.insert_workspace(&workspace, &info)
+ {
+ tracing::error!("{:?}", err);
+ }
+ }
+ SaveEvent::RecentWorkspace(workspace) => {
+ if let Err(err) =
+ local_db.insert_recent_workspace(workspace)
+ {
+ tracing::error!("{:?}", err);
+ }
+ }
+ SaveEvent::Doc(info) => {
+ if let Err(err) = local_db.insert_doc(&info) {
+ tracing::error!("{:?}", err);
+ }
+ }
+ SaveEvent::DisabledVolts(volts) => {
+ if let Err(err) = local_db.insert_disabled_volts(volts) {
+ tracing::error!("{:?}", err);
+ }
+ }
+ SaveEvent::WorkspaceDisabledVolts(workspace, volts) => {
+ if let Err(err) = local_db
+ .insert_workspace_disabled_volts(workspace, volts)
+ {
+ tracing::error!("{:?}", err);
+ }
+ }
+ SaveEvent::PanelOrder(order) => {
+ if let Err(err) = local_db.insert_panel_orders(&order) {
+ tracing::error!("{:?}", err);
+ }
+ }
}
}
- }
- });
+ })
+ .unwrap();
Ok(db)
}
@@ -100,7 +124,9 @@ impl LapceDb {
}
pub fn save_disabled_volts(&self, volts: Vec) {
- let _ = self.save_tx.send(SaveEvent::DisabledVolts(volts));
+ if let Err(err) = self.save_tx.send(SaveEvent::DisabledVolts(volts)) {
+ tracing::error!("{:?}", err);
+ }
}
pub fn save_workspace_disabled_volts(
@@ -108,9 +134,12 @@ impl LapceDb {
workspace: Arc,
volts: Vec,
) {
- let _ = self
+ if let Err(err) = self
.save_tx
- .send(SaveEvent::WorkspaceDisabledVolts(workspace, volts));
+ .send(SaveEvent::WorkspaceDisabledVolts(workspace, volts))
+ {
+ tracing::error!("{:?}", err);
+ }
}
pub fn insert_disabled_volts(&self, volts: Vec) -> Result<()> {
@@ -127,7 +156,9 @@ impl LapceDb {
let folder = self
.workspace_folder
.join(workspace_folder_name(&workspace));
- let _ = std::fs::create_dir_all(&folder);
+ if let Err(err) = std::fs::create_dir_all(&folder) {
+ tracing::error!("{:?}", err);
+ }
let volts = serde_json::to_string_pretty(&volts)?;
std::fs::write(folder.join(DISABLED_VOLTS), volts)?;
@@ -219,7 +250,9 @@ impl LapceDb {
info: &WorkspaceInfo,
) -> Result<()> {
let folder = self.workspace_folder.join(workspace_folder_name(workspace));
- let _ = std::fs::create_dir_all(&folder);
+ if let Err(err) = std::fs::create_dir_all(&folder) {
+ tracing::error!("{:?}", err);
+ }
let workspace_info = serde_json::to_string_pretty(info)?;
std::fs::write(folder.join(WORKSPACE_INFO), workspace_info)?;
Ok(())
@@ -228,7 +261,9 @@ impl LapceDb {
pub fn save_app(&self, data: &AppData) -> Result<()> {
let windows = data.windows.get_untracked();
for (_, window) in &windows {
- let _ = self.save_window(window.clone());
+ if let Err(err) = self.save_window(window.clone()) {
+ tracing::error!("{:?}", err);
+ }
}
let info = AppInfo {
@@ -259,7 +294,9 @@ impl LapceDb {
return Ok(());
}
for (_, window) in &windows {
- let _ = self.insert_window(window.clone());
+ if let Err(err) = self.insert_window(window.clone()) {
+ tracing::error!("{:?}", err);
+ }
}
let info = AppInfo {
windows: windows
@@ -299,14 +336,18 @@ impl LapceDb {
pub fn save_window(&self, data: WindowData) -> Result<()> {
for (_, window_tab) in data.window_tabs.get_untracked().into_iter() {
- let _ = self.save_window_tab(window_tab);
+ if let Err(err) = self.save_window_tab(window_tab) {
+ tracing::error!("{:?}", err);
+ }
}
Ok(())
}
pub fn insert_window(&self, data: WindowData) -> Result<()> {
for (_, window_tab) in data.window_tabs.get_untracked().into_iter() {
- let _ = self.insert_window_tab(window_tab);
+ if let Err(err) = self.insert_window_tab(window_tab) {
+ tracing::error!("{:?}", err);
+ }
}
let info = data.info();
let info = serde_json::to_string_pretty(&info)?;
@@ -331,7 +372,8 @@ impl LapceDb {
use strum::IntoEnumIterator;
for kind in PanelKind::iter() {
if kind.position(&panel_orders).is_none() {
- let panels = panel_orders.entry(PanelPosition::LeftTop).or_default();
+ let panels =
+ panel_orders.entry(kind.default_position()).or_default();
panels.push_back(kind);
}
}
@@ -340,7 +382,9 @@ impl LapceDb {
}
pub fn save_panel_orders(&self, order: PanelOrder) {
- let _ = self.save_tx.send(SaveEvent::PanelOrder(order));
+ if let Err(err) = self.save_tx.send(SaveEvent::PanelOrder(order)) {
+ tracing::error!("{:?}", err);
+ }
}
fn insert_panel_orders(&self, order: &PanelOrder) -> Result<()> {
@@ -362,7 +406,9 @@ impl LapceDb {
scroll_offset: (scroll_offset.x, scroll_offset.y),
cursor_offset,
};
- let _ = self.save_tx.send(SaveEvent::Doc(info));
+ if let Err(err) = self.save_tx.send(SaveEvent::Doc(info)) {
+ tracing::error!("{:?}", err);
+ }
}
fn insert_doc(&self, info: &DocInfo) -> Result<()> {
@@ -370,7 +416,9 @@ impl LapceDb {
.workspace_folder
.join(workspace_folder_name(&info.workspace))
.join(WORKSPACE_FILES);
- let _ = std::fs::create_dir_all(&folder);
+ if let Err(err) = std::fs::create_dir_all(&folder) {
+ tracing::error!("{:?}", err);
+ }
let contents = serde_json::to_string_pretty(info)?;
std::fs::write(folder.join(doc_path_name(&info.path)), contents)?;
Ok(())
diff --git a/lapce-app/src/debug.rs b/lapce-app/src/debug.rs
index 71aebe827b..a213af5b79 100644
--- a/lapce-app/src/debug.rs
+++ b/lapce-app/src/debug.rs
@@ -8,7 +8,7 @@ use std::{
use floem::{
ext_event::create_ext_action,
- reactive::{Memo, RwSignal, Scope},
+ reactive::{Memo, RwSignal, Scope, SignalGet, SignalUpdate, SignalWith},
views::VirtualVector,
};
use lapce_rpc::{
diff --git a/lapce-app/src/doc.rs b/lapce-app/src/doc.rs
index cd64958b1c..3369db3d3a 100644
--- a/lapce-app/src/doc.rs
+++ b/lapce-app/src/doc.rs
@@ -17,7 +17,9 @@ use floem::{
ext_event::create_ext_action,
keyboard::Modifiers,
peniko::Color,
- reactive::{batch, ReadSignal, RwSignal, Scope},
+ reactive::{
+ batch, ReadSignal, RwSignal, Scope, SignalGet, SignalUpdate, SignalWith,
+ },
text::{Attrs, AttrsList, FamilyOwned, TextLayout},
views::editor::{
actions::CommonAction,
@@ -64,8 +66,8 @@ use lapce_xi_rope::{
Interval, Rope, RopeDelta, Transformer,
};
use lsp_types::{
- CodeActionOrCommand, CodeLens, Diagnostic, DiagnosticSeverity, InlayHint,
- InlayHintLabel,
+ CodeActionOrCommand, CodeLens, Diagnostic, DiagnosticSeverity,
+ DocumentSymbolResponse, InlayHint, InlayHintLabel,
};
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
@@ -78,7 +80,10 @@ use crate::{
history::DocumentHistory,
keypress::KeyPressFocus,
main_split::Editors,
- panel::kind::PanelKind,
+ panel::{
+ document_symbol::{SymbolData, SymbolInformationItemData},
+ kind::PanelKind,
+ },
window_tab::{CommonData, Focus},
workspace::LapceWorkspace,
};
@@ -205,6 +210,8 @@ pub struct Doc {
editors: Editors,
pub common: Rc,
+
+ pub document_symbol_data: RwSignal