Repository: lapce/lapce (language: rust)

Issue:
Lapce not working at all on macOS
## Lapce Version

v0.3.1

## System information

macOS Sonoma 14.3 (23D56)

## Describe the bug

Opening Lapce brings up its window. After this point regardless of the user action, the application does not perform any responses. Terminal does not load (cursor stuck forever). Cannot open a file. Cannot change UI preferences. Log file is empty. Checking for an update does not give any response.

It feels like its just stuck at some point.

## Additional information

Re-installing did not help.



Discussion / hints:
Me too. Not working. I can not open files, files and folders seem to be empty. No way to install extensions.


Same here. The editor launches fine, I open a project and then I can't navigate it, the folders do not expand and all the files are empty.
same here - using the latest nightly 
* opens the editor at least
* does not open the editor for remote locations (SSH)
* no syntax highlighting (not even for XML, maybe related to https://github.com/lapce/lapce/issues/272)
I can't drag a file to the editor or say "open with". Then the editor is grey and i tried to open a TXT-File.
same
I had problems starting up on MacOS as well, which might have "just" been a UX issue.

If/when you get to the IDE window, in the title bar press the down arrow, NOT the search icon. This will allow you to open a folder.

![Screen Shot 2024-03-08 at 1 27 15 PM](https://github.com/lapce/lapce/assets/1282571/a663872f-223f-405f-a71d-618ef8a44d61)
> I had problems starting up on MacOS as well, which might have "just" been a UX issue.

I cant seem to install any language support, so all my folders are empty and i cannot see files, except in git i can see changes to the files. I tried uninstalling rustup etc but no luck so i gave up for now.

I love the editor it's fast and looks good but there are so much small errors. Now i see that i can't uninstall a plugin only disable. 
Version 0.3.1
Same problem under Windows 11
But when using Portable version, then it is usable, until trying to connect ssh, then everything stops.


I encountered the same issue and managed to resolve it through a bit of debugging. Here's what I did:

First, I enabled full Rust backtraces to get more insight into the error by running:

```bash
export RUST_BACKTRACE=full
lapce -w
```

This resulted in the following error output, indicating a problem with loading keymaps and a panic related to the system locale configuration:

```bash
2024-04-13T07:04:23.484658Z ERROR lapce_app::keypress: Failed to load from "/Users/.../Library/Application Support/dev.lapce.Lapce-Stable/keymaps.toml": no keymaps
thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/locale_config-0.3.0/src/macos.rs:16:76:
called `Result::unwrap()` on an `Err` value: NotWellFormed
stack backtrace:
   0:        0x1015c432c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4bff038afc05d0ab
   1:        0x1004f56b4 - core::fmt::write::he9fa43146d420946
   2:        0x10159f258 - std::io::Write::write_fmt::hf4fd30c8192b15d9
   3:        0x1015c8868 - std::sys_common::backtrace::print::h5d71f7b09493fc9b
   4:        0x1015c84b0 - std::panicking::default_hook::{{closure}}::hb75620628e95e648
   5:        0x1015c934c - std::panicking::rust_panic_with_hook::h81dc715fa5de32cf
   6:        0x1015c8ef0 - std::panicking::begin_panic_handler::{{closure}}::h26c73eb75670321f
   7:        0x1015c8e5c - std::sys_common::backtrace::__rust_end_short_backtrace::hef4773cf0f80485b
   8:        0x1015c8e50 - _rust_begin_unwind
   9:        0x101dcd6f0 - core::panicking::panic_fmt::h10bd3bfe5bb30d67
  10:        0x101dcda9c - core::result::unwrap_failed::h16d42dbc22454d03
  11:        0x10128630c - locale_config::macos::system_locale::h6064ec15009d2ea0
  12:        0x1012852a8 - std::sync::once::Once::call_once::{{closure}}::h99ad9bc7b268ae71
  13:        0x101e46ab8 - std::sys_common::once::queue::Once::call::he4b6301f8f9b0e9a
  14:        0x101286af4 - std::sync::once::Once::call_once::{{closure}}::h3d4400f39bccac80
  15:        0x101e46ab8 - std::sys_common::once::queue::Once::call::he4b6301f8f9b0e9a
  16:        0x1010596c4 - <lapce_proxy::dispatch::Dispatcher as lapce_rpc::proxy::ProxyHandler>::handle_notification::h597577b7c2668492
  17:        0x100f87824 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8d5f1953dae0a659
  18:        0x100f87054 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h4111dc76b1dd16ba
  19:        0x1015cc57c - std::sys::unix::thread::Thread::new::thread_start::h616a123cfe4994dc
  20:        0x19392af94 - __pthread_joiner_wake

```

The key part of the error was related to the system locale. To address this, I manually set the locale to `en_US.UTF-8` using the following commands:

```bash
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
lapce -w
```

After setting the locale variables manually, Lapce started without any errors. It seems the issue was indeed related to the system locale configuration, and manually specifying the locale as `en_US.UTF-8` provided a workaround.


I realized the issue was because my Mac's language was set to English (US), but my region setting was different. This is a common setup for those who prefer English for the interface but need other settings for things like dates and currency.

Matching the language and region settings fixed the issue for me. However, it's worth noting that many people intentionally use different settings for language and region. This situation highlights that Lapce should be able to handle such differences smoothly.


not working for me as well:


```
❯ set -x LC_ALL=en_US.UTF-8
  set -x LANG=en_US.UTF-8
  lapce -w
set: LC_ALL=en_US.UTF-8: invalid variable name. See `help identifiers`
set: Did you mean `set LC_ALL en_US.UTF-8`?
(Type 'help set' for related documentation)
set: LANG=en_US.UTF-8: invalid variable name. See `help identifiers`
set: Did you mean `set LANG en_US.UTF-8`?
(Type 'help set' for related documentation)
MESA-INTEL: warning: Haswell Vulkan support is incomplete
2024-07-28T08:14:28.767869Z ERROR lapce_app::panic_hook: thread main panicked at <unknown> | file://.//cargo/git/checkouts/floem-69eea0a757d1e3ee/a3dd759/tiny_skia/src/lib.rs:319:17
   0: lapce_app::app::panic_hook::{{closure}}
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/boxed.rs:2029:9
      std::panicking::rust_panic_with_hook
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:785:13
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:659:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:171:18
   4: rust_begin_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
   5: core::panicking::panic_fmt
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
   6: <floem::renderer::Renderer<W> as floem_renderer::Renderer>::draw_text
   7: lapce_app::terminal::view::TerminalView::paint_line_content
   8: <lapce_app::terminal::view::TerminalView as floem::view::Widget>::paint
   9: floem::context::PaintCx::paint_view
  10: floem::context::PaintCx::paint_view
  11: floem::view::Widget::paint
  12: floem::context::PaintCx::paint_view
  13: floem::view::Widget::paint
  14: floem::context::PaintCx::paint_view
  15: floem::view::Widget::paint
  16: floem::context::PaintCx::paint_view
  17: floem::context::PaintCx::paint_view
  18: floem::view::Widget::paint
  19: floem::context::PaintCx::paint_view
  20: floem::view::Widget::paint
  21: floem::context::PaintCx::paint_view
  22: floem::view::Widget::paint
  23: floem::context::PaintCx::paint_view
  24: floem::view::Widget::paint
  25: floem::context::PaintCx::paint_view
  26: floem::view::Widget::paint
  27: floem::context::PaintCx::paint_view
  28: floem::view::Widget::paint
  29: floem::context::PaintCx::paint_view
  30: floem::view::Widget::paint
  31: floem::context::PaintCx::paint_view
  32: floem::view::Widget::paint
  33: floem::context::PaintCx::paint_view
  34: floem::context::PaintCx::paint_view
  35: floem::view::Widget::paint
  36: floem::context::PaintCx::paint_view
  37: floem::view::Widget::paint
  38: floem::context::PaintCx::paint_view
  39: floem::window_handle::WindowHandle::paint
  40: floem::app::Application::run::{{closure}}
  41: lapce_app::app::launch
  42: std::sys_common::backtrace::__rust_begin_short_backtrace
  43: main
  44: __libc_start_call_main
             at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  45: __libc_start_main_impl
             at ./csu/../csu/libc-start.c:360:3
  46: _start


~
❯ lapce --help
Usage: lapce [OPTIONS] [PATHS]...

Arguments:
  [PATHS]...  Paths to file(s) and/or folder(s) to open. When path is a file (that exists or not), it accepts `path:line:column` syntax to specify line and column at which it should open the file

Options:
  -n, --new                        Launch new window even if Lapce is already running
  -w, --wait                       Don't return instantly when opened in a terminal
      --plugin-path <PLUGIN_PATH>  Path(s) to plugins to load. This is primarily used for plugin development to make it easier to test changes to the plugin without needing to copy the plugin to the plugins directory. This will cause any plugin with the same author & name to not run
  -h, --help                       Print help
  -V, --version                    Print version

~
❯ set -x LC_ALL en_US.UTF-8
  set -x LANG en_US.UTF-8
  lapce -w
MESA-INTEL: warning: Haswell Vulkan support is incomplete
2024-07-28T08:15:21.317156Z ERROR lapce_app::panic_hook: thread main panicked at <unknown> | file://.//cargo/git/checkouts/floem-69eea0a757d1e3ee/a3dd759/tiny_skia/src/lib.rs:319:17
   0: lapce_app::app::panic_hook::{{closure}}
   1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/alloc/src/boxed.rs:2029:9
      std::panicking::rust_panic_with_hook
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:785:13
   2: std::panicking::begin_panic_handler::{{closure}}
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:659:13
   3: std::sys_common::backtrace::__rust_end_short_backtrace
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/sys_common/backtrace.rs:171:18
   4: rust_begin_unwind
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/panicking.rs:647:5
   5: core::panicking::panic_fmt
             at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/core/src/panicking.rs:72:14
   6: <floem::renderer::Renderer<W> as floem_renderer::Renderer>::draw_text
   7: lapce_app::terminal::view::TerminalView::paint_line_content
   8: <lapce_app::terminal::view::TerminalView as floem::view::Widget>::paint
   9: floem::context::PaintCx::paint_view
  10: floem::context::PaintCx::paint_view
  11: floem::view::Widget::paint
  12: floem::context::PaintCx::paint_view
  13: floem::view::Widget::paint
  14: floem::context::PaintCx::paint_view
  15: floem::view::Widget::paint
  16: floem::context::PaintCx::paint_view
  17: floem::context::PaintCx::paint_view
  18: floem::view::Widget::paint
  19: floem::context::PaintCx::paint_view
  20: floem::view::Widget::paint
  21: floem::context::PaintCx::paint_view
  22: floem::view::Widget::paint
  23: floem::context::PaintCx::paint_view
  24: floem::view::Widget::paint
  25: floem::context::PaintCx::paint_view
  26: floem::view::Widget::paint
  27: floem::context::PaintCx::paint_view
  28: floem::view::Widget::paint
  29: floem::context::PaintCx::paint_view
  30: floem::view::Widget::paint
  31: floem::context::PaintCx::paint_view
  32: floem::view::Widget::paint
  33: floem::context::PaintCx::paint_view
  34: floem::context::PaintCx::paint_view
  35: floem::view::Widget::paint
  36: floem::context::PaintCx::paint_view
  37: floem::view::Widget::paint
  38: floem::context::PaintCx::paint_view
  39: floem::window_handle::WindowHandle::paint
  40: floem::app::Application::run::{{closure}}
  41: lapce_app::app::launch
  42: std::sys_common::backtrace::__rust_begin_short_backtrace
  43: main
  44: __libc_start_call_main
             at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  45: __libc_start_main_impl
             at ./csu/../csu/libc-start.c:360:3
  46: _start


~
```

The complete Editor is not usable on OSX. So how can that not be seen and fixed? That tells me that this project here is dead. 
> not working for me as well

What device are you using?
@panekj using thinkpad with void linux glibc 
> @panekj using thinkpad with void linux glibc

Please create a new issue, this issue is macOS-only.

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index b3c7fdb20e..102f964aa8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -515,7 +515,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68"
 dependencies = [
  "block-sys",
- "objc2",
+ "objc2 0.4.1",
+]
+
+[[package]]
+name = "block2"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
+dependencies = [
+ "objc2 0.5.2",
 ]
 
 [[package]]
@@ -1781,7 +1790,7 @@ dependencies = [
  "memmap2",
  "ndk",
  "ndk-sys",
- "objc2",
+ "objc2 0.4.1",
  "once_cell",
  "orbclient",
  "percent-encoding",
@@ -2515,9 +2524,9 @@ version = "0.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319"
 dependencies = [
- "block2",
+ "block2 0.3.0",
  "dispatch",
- "objc2",
+ "objc2 0.4.1",
 ]
 
 [[package]]
@@ -3199,13 +3208,12 @@ checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
 
 [[package]]
 name = "locale_config"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08d2c35b16f4483f6c26f0e4e9550717a2f6575bcd6f12a53ff0c490a94a6934"
+version = "0.3.1-alpha.0"
+source = "git+https://github.com/lapce/locale_config.git?branch=lapce#54c9fe6a247c3618c224ec57e6c3a747bc3a96e4"
 dependencies = [
  "lazy_static",
- "objc",
- "objc-foundation",
+ "objc2 0.5.2",
+ "objc2-foundation",
  "regex",
  "winapi",
 ]
@@ -3572,9 +3580,9 @@ dependencies = [
 
 [[package]]
 name = "objc-sys"
-version = "0.3.1"
+version = "0.3.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845"
+checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
 
 [[package]]
 name = "objc2"
@@ -3583,7 +3591,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d"
 dependencies = [
  "objc-sys",
- "objc2-encode",
+ "objc2-encode 3.0.0",
+]
+
+[[package]]
+name = "objc2"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804"
+dependencies = [
+ "objc-sys",
+ "objc2-encode 4.0.3",
 ]
 
 [[package]]
@@ -3592,6 +3610,24 @@ version = "3.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666"
 
+[[package]]
+name = "objc2-encode"
+version = "4.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8"
+
+[[package]]
+name = "objc2-foundation"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
+dependencies = [
+ "bitflags 2.6.0",
+ "block2 0.5.1",
+ "libc",
+ "objc2 0.5.2",
+]
+
 [[package]]
 name = "objc_id"
 version = "0.1.1"
diff --git a/lapce-proxy/Cargo.toml b/lapce-proxy/Cargo.toml
index 96b587a9f7..6acc85dfd2 100644
--- a/lapce-proxy/Cargo.toml
+++ b/lapce-proxy/Cargo.toml
@@ -40,12 +40,11 @@ floem-editor-core = { workspace = true }
 
 # proxy specific dependencies
 
-dyn-clone     = "1.0.16"
-walkdir       = "2.4.0"
-locale_config = "0.3.0"
-jsonrpc-lite  = "0.6.0"
-polling       = "3.5.0"
-libc          = "0.2"
+dyn-clone    = "1.0.16"
+walkdir      = "2.4.0"
+jsonrpc-lite = "0.6.0"
+polling      = "3.5.0"
+libc         = "0.2"
 
 # deleting files
 trash = "3.0.6"
@@ -65,5 +64,6 @@ wasi-common   = "14.0.0"
 git = "https://github.com/lapce/wasi-experimental-http"
 # path = "../../wasi-experimental-http/crates/wasi-experimental-http-wasmtime"
 
-[target.'cfg(target_os = "macos")'.dependencies]
-libc = "0.2"
+[target.'cfg(target_os = "macos")'.dependencies.locale_config]
+git    = "https://github.com/lapce/locale_config.git"
+branch = "lapce"


Test patch: