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

Check for clangd in MinGW installation #440

Merged
merged 1 commit into from
Feb 21, 2025
Merged

Conversation

jld01
Copy link
Contributor

@jld01 jld01 commented Feb 21, 2025

Relates to #424

@jld01
Copy link
Contributor Author

jld01 commented Feb 21, 2025

@jonahgraham and @ghentschke, this patch attempts to find clangd in the MinGW installation known to CDT (eg MSYS2 UCRT64) if it was not found on the system PATH. Note that:

  • MinGW.getMinGWHome() returns null efficiently if not running on a Windows host
  • The MinGW class is not API at present

Please feel free to use or adapt this as you see fit.

Copy link
Member

@jonahgraham jonahgraham left a comment

Choose a reason for hiding this comment

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

@jonahgraham and @ghentschke, this patch attempts to find clangd in the MinGW installation known to CDT (eg MSYS2 UCRT64) if it was not found on the system PATH.

Thanks @jld01 for this - I was hoping something like this would be possible with MinGW class and your implementation is simpler and more straightforward than I expected :-)

Note that:

  • MinGW.getMinGWHome() returns null efficiently if not running on a Windows host

👍

  • The MinGW class is not API at present

In my view CDT LSP is part of CDT so using CDT internal code is not violating any API contract. Ideally an x-friends should be added on org.eclipse.cdt.internal.core at some point to remove warning.

Please feel free to use or adapt this as you see fit.

Thanks.

This LGTM, but I haven't run it on Windows yet. @ghentschke I am hoping you can review to verify that this is the best place to inject the MinGW's location.

@jld01 jld01 marked this pull request as ready for review February 21, 2025 14:34
@jld01 jld01 requested a review from ghentschke February 21, 2025 14:34
@jld01
Copy link
Contributor Author

jld01 commented Feb 21, 2025

Note that the MinGW class performs various checks to find an installation containing gcc. So this code is helpful only if gcc and clangd are in the same folder. Otherwise, clangd will not be found and the code is harmless.

We can improve on this, but time is short for 12.0.0 and the code provides a good improvement where a new user is following the Before you begin help page to install tools.

@jld01 jld01 added this to the 3.0.0 milestone Feb 21, 2025
Copy link
Contributor

@ghentschke ghentschke left a comment

Choose a reason for hiding this comment

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

LGTM

@ghentschke
Copy link
Contributor

Does it also work for MSYS2?

@jld01
Copy link
Contributor Author

jld01 commented Feb 21, 2025

Does it also work for MSYS2?

Yes, the CDT MinGW class will detect MinGW tools installed via the MSYS2 package manager. This is the use case of primary interest.

@jld01 jld01 merged commit 8a64cd0 into eclipse-cdt:main Feb 21, 2025
3 checks passed
@jld01 jld01 self-assigned this Feb 21, 2025
@jld01 jld01 deleted the mingw-path branch February 25, 2025 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants