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

perf: find path efficiently for clangd argus, close #765. #780

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

ayamir
Copy link
Owner

@ayamir ayamir commented Jun 1, 2023

Signed-off-by: ayamir <lgt986452565@gmail.com>
@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented Jun 1, 2023

I'm not sure if this will work or not, especially we will have exe, dll, cmd as file extensions on Windows.
But I'm currently working on linux, can't test this part.

sunchangtan and Groveer can test the patch first.

@ayamir
Copy link
Owner Author

ayamir commented Jun 1, 2023

I'm not sure if this will work or not, especially we will have exe, dll, cmd as file extensions on Windows.
But I'm currently working on linux, can't test this part.

sunchangtan and Groveer can test the patch first.

Test passed on my windows PC, but need more tests to confirm.

@Groveer
Copy link
Contributor

Groveer commented Jun 1, 2023

I'm not sure if this will work or not, especially we will have exe, dll, cmd as file extensions on Windows.
But I'm currently working on linux, can't test this part.

sunchangtan and Groveer can test the patch first.

Test passed on my windows PC, but need more tests to confirm.

I test passed. it works good.

Copy link
Collaborator

@Jint-lzxy Jint-lzxy left a comment

Choose a reason for hiding this comment

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

Also works on my Windows 10 VM :) In fact, checking fs.c - $PATH is correctly resolved:

static bool is_executable_in_path(const char *name, char **abspath)
  FUNC_ATTR_NONNULL_ARG(1)
{
  const char *path_env = os_getenv("PATH");
  // ...... //
  size_t buf_len = strlen(name) + strlen(path) + 2;
  char *buf = xmalloc(buf_len);
  // ...... //

  while (true) {
    char *e = xstrchrnul(p, ENV_SEPCHAR);

    // Combine the $PATH segment with `name`.
    xstrlcpy(buf, p, (size_t)(e - p) + 1);
    append_path(buf, name, buf_len);

#ifdef MSWIN
    if (is_executable_ext(buf, abspath)) {
#else
    // ...... //
#endif
      rv = true;
      goto end;
    }
  // ...... //
}

@ayamir ayamir merged commit ec91437 into main Jun 1, 2023
2 checks passed
@ayamir ayamir deleted the fix/find-exepath-for-clangd branch June 1, 2023 12:00
@sunchangtan
Copy link

I'm not sure if this will work or not, especially we will have exe, dll, cmd as file extensions on Windows. But I'm currently working on linux, can't test this part.

sunchangtan and Groveer can test the patch first.

I test passed. it works good.

singlemancombat pushed a commit to singlemancombat/nvim-config that referenced this pull request Jun 1, 2023
csyJoy pushed a commit to csyJoy/nvimdots that referenced this pull request Jun 4, 2023
bleedingfight pushed a commit to bleedingfight/nvimdots that referenced this pull request Jun 22, 2023
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.

Nvimdots starts up very slowly on the Windows platform, please help analyze this issue.
5 participants