Maligan / unity-zed

Zed integration as Unity external script editor
MIT License
18 stars 2 forks source link

Not working on linux ( at least not flatpaks ) #1

Closed sfjohansson closed 1 month ago

sfjohansson commented 1 month ago

Flathub is very popular for installing apps on linux: https://flathub.org/apps/dev.zed.Zed

Maligan commented 1 month ago

Thank you for report, will try reproduce on virtual machine :-)

sfjohansson commented 1 month ago

I'd be happy to help, I'd assume it might just be just the discovering of zed here:

    public class ZedDiscovery
    {
        public CodeEditor.Installation[] GetInstallations()
        {
            var results = new List<CodeEditor.Installation>();

            var candidates = new NPath[] {
                new ("/Applications/Zed.app/Contents/MacOS/cli"),
                new ("/usr/local/bin/zed"),
            };

Perhaps an option to manually set the path is an easy option that solves most cases

Maligan commented 1 month ago

Does flatpak have a default installation places? In cases for per-user installation and per-machine installation?

As I see there are a system-wide /var/lib/flatpak/ and user-wide ~/.var/app/ but I have to check them to be sure...

sfjohansson commented 1 month ago

you can actually use the terminal command to get app information

flatpak info dev.zed.Zed

Zed - High-performance code editor

          ID: dev.zed.Zed
         Ref: app/dev.zed.Zed/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: v0.152.4
     License: AGPL-3.0-or-later and Apache-2.0 and GPL-3.0-or-later
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 151.4 MB
     Runtime: org.freedesktop.Sdk/x86_64/23.08
         Sdk: org.freedesktop.Sdk/x86_64/23.08

      Commit: dcc8eb5b199d9ca6d79e172875f8a110522273c2b17608a3ffcd4fd38905e41d
      Parent: f98817c43cb5131a2c7649668c8643ae423f067fdf381275b0982e126563ea29
     Subject: Update to v0.152.4 (#18) (27de1768)
        Date: 2024-09-17 01:57:14 +0000

and

~  flatpak info --show-location dev.zed.Zed                                                                                                                                                                                                                                                                                                                                                                                                                              INT ✘  12:27:31 
/var/lib/flatpak/app/dev.zed.Zed/x86_64/stable/dcc8eb5b199d9ca6d79e172875f8a110522273c2b17608a3ffcd4fd38905e41d
Maligan commented 1 month ago

Yes, I did try this way but it has several cons:

Anyway I didn't add default installation paths for Linux/Windows and will try them at the first step, If this doesn't help I will add custom GUI into Preference tab.

sfjohansson commented 1 month ago

just checking it on startup and save it somewhere could be an option:

using UnityEditor;
using UnityEngine;

[InitializeOnLoad]
public static class EditorStartup
{
    public static string pathExternalEditor;

    // Static constructor
    static EditorStartup()
    {
        // This code will run when the editor loads
        pathExternalEditor = "Editor Loaded at: " + System.DateTime.Now;
        Debug.Log("Editor has started. Static string saved: " + myStaticString);
    }
}
sfjohansson commented 1 month ago

I just tested the 0.2.1 Release and my flatpak installation is discovered. I can select it and it will open scripts in Zed.

Should the csharp solution work fully, ie going to implementations of this or that, finding usages etc?

I returned a little later and it kicked off indexing the project. It racked up some 140k warnings in the solution. I managed to navigate to class via a field usage before it crashed.

I assume the last is based on Zed just having had enough and tossed in the towel...

Maligan commented 1 month ago

Oh, thank you I implement only discovering of system installation of Zed will do it for userwide!

Zed use C# language server via omnisharp https://zed.dev/docs/languages/csharp

It works perfect for small-to-medium pet project of mine, but crashes when I try to start my huge working project ~ 160 asmdef etc. 3GB of RAM usages.

I check the status of omnisharp via task manager and it really has some problems.

Unfortunately it's a Zed's problem. Maybe I can tweak some behaviors with changing workdir settings but I can't find omnisharp integration docs / configuration which can help with that.

sfjohansson commented 1 month ago

Probably not many that uses Zed for C# at this point...well I'd say that the issue of discovering Zed is resolved! :)