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

Restore VsCode 1.91 behavior of allowing scripts as executable #730

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

JVApen
Copy link
Contributor

@JVApen JVApen commented Nov 18, 2024

In VsCode 1.72 Node was updated to version 20, before this upgrade, it was possible to execute cmd/bat scripts as executable.After this update this was suddenly broken.
Our use-case for using such a script has to do with the consistency of our clang-tooling.
We build clang-format, clang-tidy, clangd ... all together and put this in a package manager.
In the script, we first download these executables (when needed) and than start the downloaded clangd.
As such, when fixing an issue in clang-tidy, the same issue will get fixed in the clangd exe.
Without this script, it is impossible to automatically trigger this download and it introduces the risk that we do not update all the tooling to the latest version.

Fixes #683

In this reapply, we quote both the command line and the arguments, such that both can contain spaces.
We also introduce the option useScriptAsExecutable, such that this is only enabled when the user wants it.

…t was possible to execute cmd/bat scripts as executable.

     After this update this was suddenly broken.
     Our use-case for using such a script has to do with the consistency of our clang-tooling.
     We build clang-format, clang-tidy, clangd ... all together and put this in a package manager.
     In the script, we first download these executables (when needed) and than start the downloaded clangd.
     As such, when fixing an issue in clang-tidy, the same issue will get fixed in the clangd exe.
     Without this script, it is impossible to automatically trigger this download and it introduces the risk that we do not update all the tooling to the latest version.

Fixes clangd#683

In this reapply, we quote both the command line and the arguments, such that both can contain spaces.
We also introduce the option useScriptAsExecutable, such that this is only enabled when the user wants it.
@JVApen
Copy link
Contributor Author

JVApen commented Nov 18, 2024

@HighCommander4 The issue with the space was clear and should be resolved. However, I had the impression that there were other reasons why it failed which we don't know about.
As such, I've introduced an option, such that this minimizes the risk of breaking peoples experience once again.

Copy link
Contributor

@HighCommander4 HighCommander4 left a comment

Choose a reason for hiding this comment

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

Do you not also need shell: useScriptAsExectuable in clangd.options?

@@ -68,13 +68,23 @@ export class ClangdContext implements vscode.Disposable {
if (!clangdPath)
return null;

const useScriptAsExecutable =
await config.get<boolean>('useScriptAsExecutable');
Copy link
Contributor

Choose a reason for hiding this comment

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

I simplified this a bit in #731 (config.get isn't actually async and doesn't need to be awaited), would you mind rebasing on top of that and querying the config value directly in the constructor?

let quote = (str: string) => { return `"${str}"`; };
clangdPath = quote(clangdPath)
for (var i = 0; i < clangdArguments.length; i++)
clangdArguments[i] = quote(clangdArguments[i]);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indent statement inside loop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Completely agree, will look at it

Copy link
Contributor

@HighCommander4 HighCommander4 left a comment

Choose a reason for hiding this comment

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

LGTM

@HighCommander4 HighCommander4 merged commit ea588aa into clangd:master Nov 20, 2024
1 check passed
HighCommander4 added a commit to HighCommander4/vscode-clangd that referenced this pull request Nov 22, 2024
HighCommander4 added a commit that referenced this pull request Nov 22, 2024
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.

No longer possible to use cmd as clangd executable
2 participants