Skip to content
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

Add zip extract support for Windows #11156

Merged
merged 4 commits into from May 9, 2024

Conversation

huacnlee
Copy link
Contributor

@huacnlee huacnlee commented Apr 29, 2024

Release Notes:

  • Fixed install Node.js runtime and NPM lsp installation on Windows.
  • Update Node runtime command to execute on Windows with no window popup.

Ref #9619, #9424

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Apr 29, 2024
crates/fs/src/fs.rs Outdated Show resolved Hide resolved
crates/fs/src/fs.rs Outdated Show resolved Hide resolved
@huacnlee huacnlee force-pushed the add-zip-unarchive-support branch 4 times, most recently from 01db39c to 5c526a5 Compare April 29, 2024 13:25
@huacnlee
Copy link
Contributor Author

huacnlee commented Apr 29, 2024

image

Node.js runtime have successfully installed on Windows now.

@huacnlee huacnlee force-pushed the add-zip-unarchive-support branch 4 times, most recently from 110db34 to 67868eb Compare April 29, 2024 17:19
@huacnlee huacnlee marked this pull request as ready for review April 29, 2024 17:26
@huacnlee huacnlee force-pushed the add-zip-unarchive-support branch 7 times, most recently from 5471989 to 1d5b131 Compare April 30, 2024 06:57
@huacnlee
Copy link
Contributor Author

Now, Node.js runtime has fixed and Copilot works.

2024-04-30.223822.mp4

@huacnlee
Copy link
Contributor Author

Node runtime have been passed test.

2024-04-30.232507.mp4

@huacnlee
Copy link
Contributor Author

Hi @maxdeviant, @mikayla-maki

I think I have done of all about Windows install zip and Node.js runtime install, we can review and testing now.

I have to do a lot of file change, because there are too many issues on Windows. They are mostly issues that have different path on Windows.

@maxdeviant maxdeviant changed the title Add zip extract supports for Windows Add zip extract support for Windows May 1, 2024
maxdeviant added a commit that referenced this pull request May 3, 2024
Release Notes:

- N/A


---

Follow #11156, to make sure extensions install on window.

https://github.com/tamasfe/taplo/releases/tag/0.8.1

The Taplo have `gz` for windows, so we can just use `gz`.

---------

Co-authored-by: Marshall Bowers <[email protected]>
@eth0net
Copy link

eth0net commented May 5, 2024

Anything I can do to help with this? Was trying to solve the same issue and found this PR 🙂 Those force-pushes are killing me trying to work out what's going on with the current state of the PR so thought it better I just ask 😅

}

#[cfg(windows)]
command.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0);
Copy link
Contributor Author

@huacnlee huacnlee May 6, 2024

Choose a reason for hiding this comment

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

@maxdeviant I'd like to improve the Command::new in entire of the Zed, there have a lot of place need to do this.

For example: crates\languages\src\go.rs

So, can I add a helper in util::process:command in util crate to create smol::process:Command in shortly with Windows special creation_flags? Then other place can just use this method to create command.

This is not related to this PR, I think we can split a new PR to do this.

Copy link
Member

@maxdeviant maxdeviant left a comment

Choose a reason for hiding this comment

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

After multiple attempts to review this PR, I think it's touching a few too many parts.

I think we should refocus on just fixing Node runtime support on Windows and leave the other bits untouched.

We can inline the zip extraction into the node_runtime crate. We don't need to add a new archive crate or touch any of the tar or tar.gz-related code.

futures::pin_mut!(body);
self.host.fs.create_file_with(&zip_path, body).await?;

let unzip_status = std::process::Command::new("unzip")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maxdeviant

How about the part?

I make extract_zip method before , because here it requires the new zip extraction method, the unzip command is not working on Windows. And node_runtime and more places also need to.

@huacnlee huacnlee force-pushed the add-zip-unarchive-support branch from ecc3ba4 to 91e00bd Compare May 9, 2024 01:54
@huacnlee
Copy link
Contributor Author

huacnlee commented May 9, 2024

I have updated:

  1. Moved archive into node_runtime crate as a mod, I keep the methods not just only the zip, we may use that in the future.
  2. Reverted other crate changes, just keep the node_runtime.
  3. The since_v0_0_6.rs still use unzip command to extract zip file, this can't work on Windows, I think we can make author PR to discuss this.
    For example: https://github.com/zed-industries/zed/blob/main/extensions/csharp/src/csharp.rs#L75

@huacnlee
Copy link
Contributor Author

huacnlee commented May 9, 2024

I just did a fresh installation of the Node.js runtime on Windows. It seems that we have to modify the root_path part of Copilot (Commit: 5131e1a), otherwise it will not start and will directly crash.

Reverted this copilot change.

The https://github.com/zed-industries/zed/pull/11591/files#diff-9aed0f58926aee71638164c95da3800a90460d525d736a354c71490e333c8d88R581 is a better way.

@huacnlee huacnlee marked this pull request as draft May 9, 2024 08:33
@huacnlee huacnlee force-pushed the add-zip-unarchive-support branch from 5131e1a to 6a6e6f3 Compare May 9, 2024 11:37
@huacnlee huacnlee marked this pull request as ready for review May 9, 2024 11:45
@huacnlee huacnlee requested a review from maxdeviant May 9, 2024 11:46
Copy link
Member

@maxdeviant maxdeviant left a comment

Choose a reason for hiding this comment

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

Thanks, much better!

@maxdeviant maxdeviant merged commit 5e06ce4 into zed-industries:main May 9, 2024
8 checks passed
@huacnlee
Copy link
Contributor Author

huacnlee commented May 9, 2024

@maxdeviant For other parts of the zip decompression, you can follow up to see how to deal with it. Currently, there are still problems using the unzip command in the extension, and you need to follow up.

However, the parts that have been merged so far and the panic problem caused by Copilot's root_path unwrap will be fixed. Then the most Node.js related ones can already be run.

The HTTP Proxy issue has not been resolved yet. I don’t know if it is a problem with my proxy software. I have tested it before, but it was strange today, so I canceled it first. I'll submit another one after it's resolved.

@CharlesChen0823
Copy link
Contributor

However, the parts that have been merged so far and the panic problem caused by Copilot's root_path unwrap will be fixed. Then the most Node.js related ones can already be run.

this should fixed, currently open immediaterly crashed.

LoganDark added a commit to LoganDark/zed that referenced this pull request May 9, 2024
@huacnlee huacnlee deleted the add-zip-unarchive-support branch May 9, 2024 14:43
LoganDark added a commit to LoganDark/zed that referenced this pull request May 9, 2024
osiewicz pushed a commit to RemcoSmitsDev/zed that referenced this pull request May 18, 2024
Release Notes:

- [x] Fixed install Node.js runtime and NPM lsp installation on Windows.
- [x] Update Node runtime command to execute on Windows with no window
popup.

Ref zed-industries#9619, zed-industries#9424

---------

Co-authored-by: Marshall Bowers <[email protected]>
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.

None yet

5 participants