Skip to content

copilot: Fix config dir logic to support Flatpak environments #32901

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2025

Conversation

imumesh18
Copy link
Contributor

@imumesh18 imumesh18 commented Jun 17, 2025

Closes #30784

In github copilot we were not handling the config path correctly for FLATPAK.

  • Only tested on mac don't have access to other platform. But this should work on other platform as well. It follows the similar pattern seen in zed config path resolution.
  • Macos
  • Linux
  • Linux with Flatpak
  • Windows

Release Notes:

  • Fix copilot config detection for flatpack

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jun 17, 2025
@imumesh18 imumesh18 force-pushed the push-kntlvryrzzou branch from 6cc7a85 to 3d5755e Compare June 17, 2025 20:06
@vixalien
Copy link
Contributor

I don't know why the builds are skipped, otherwise I can't really build Zed locally.

@imumesh18
Copy link
Contributor Author

@vixalien builds are disabled by default someone from zed team needs to add run bundling tag to enable builds.

@imumesh18 imumesh18 force-pushed the push-kntlvryrzzou branch from 3d5755e to 12fa865 Compare June 18, 2025 08:27
@imumesh18 imumesh18 marked this pull request as ready for review June 18, 2025 08:35
@vixalien
Copy link
Contributor

okie cool I'll test it when a build happens...

@imumesh18
Copy link
Contributor Author

Hey @vixalien in case you want to test it you can also try building this on local. Here is the flatpack build instructions: https://zed.dev/docs/development/linux#flatpak

@bennetbo bennetbo added the run-bundling Configures PR to run the bundle step label Jun 18, 2025
@bennetbo
Copy link
Contributor

Hey, gonna start a build now so that people can test

@vixalien
Copy link
Contributor

vixalien commented Jun 18, 2025 via email

@keramblock
Copy link

keramblock commented Jun 18, 2025

Macos build failed on some kind of upload

@bennetbo
Copy link
Contributor

@vixalien
Copy link
Contributor

Just built a flatpak with the build artifact, and sadly it does not work:

image

image

Zed: v0.193.0 (Zed Dev 80cf9ca8d208d3d6650ffdf4ec28ce4b64e93dc0) 
OS: Linux Wayland org.freedesktop.platform 24.08
Memory: 31.1 GiB
Architecture: x86_64
GPU: Intel(R) Iris(R) Xe Graphics (TGL GT2) || Intel open-source Mesa driver || Mesa 25.1.3 (git-ba95e694fe)

@vixalien
Copy link
Contributor

Also, it's a bit sad that Zed's CI doesn't automatically generate a flatpak, since it just needs to repackage the build artefacts from x86 and arm.

@vixalien
Copy link
Contributor

Update: it seems to work some of the time, and after a delay.

See attached video.

Screencast.From.2025-06-19.00-01-22.mp4

@imumesh18
Copy link
Contributor Author

Hey @vixalien give it sometime as we are starting the lsp and then initialising and fetching the models using api it takes time.

@vixalien
Copy link
Contributor

Okay there's a 30s~ delay.

Maybe Zed can improve the UX a bit by showing a spinner somewhere

@imumesh18
Copy link
Contributor Author

It shouldn't be that big, I am guessing could be caused due to local build. Nice to know at least the issue is resolved. Also agree zed can provide a better feedback in terms of any of the provider still in init phase, which I will leave it for later.

Switch to LocalAppData on Windows and remove Flatpak-specific logic. Now prefer
XDG_CONFIG_HOME if set, otherwise fallback to ~/.config.
@imumesh18 imumesh18 force-pushed the push-kntlvryrzzou branch from e57aa6f to 9ea8d2f Compare June 19, 2025 13:17
@imumesh18
Copy link
Contributor Author

imumesh18 commented Jun 19, 2025

Hey @bennetbo I have updated the logic a bit more and simplified it. I checked the lsp js code and looked how they are storing the config so that we can better align with their path resolution and hence updated the logic to match that. It should now handle all the platform gracefully. Below is the detail breakdown.

Platform Condition Directory Path Example
Windows Always %LOCALAPPDATA%\github-copilot C:\Users\username\AppData\Local\github-copilot
Linux/FreeBSD XDG_CONFIG_HOME set ${XDG_CONFIG_HOME}/github-copilot /home/username/.local/config/github-copilot
Linux/FreeBSD XDG_CONFIG_HOME not set ~/.config/github-copilot /home/username/.config/github-copilot
macOS XDG_CONFIG_HOME set ${XDG_CONFIG_HOME}/github-copilot /Users/username/.local/config/github-copilot
macOS XDG_CONFIG_HOME not set ~/.config/github-copilot /Users/username/.config/github-copilot
Other Unix-like XDG_CONFIG_HOME set ${XDG_CONFIG_HOME}/github-copilot /home/username/.local/config/github-copilot
Other Unix-like XDG_CONFIG_HOME not set ~/.config/github-copilot /home/username/.config/github-copilot

@bennetbo bennetbo removed the run-bundling Configures PR to run the bundle step label Jun 19, 2025
Copy link
Contributor

@bennetbo bennetbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for investigating this 😄 Great work! Also thanks for testing to everyone involved

@bennetbo bennetbo merged commit e914d84 into zed-industries:main Jun 19, 2025
20 of 22 checks passed
@imumesh18 imumesh18 deleted the push-kntlvryrzzou branch June 19, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Agent Panel: Zed doesn't detect that I'm logged in to Github Copilot Chat
5 participants