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

In VsCode 1.72 Node was updated to version 20, before this upgrade, it was possible to execute cmd/bat scripts as executable. #758

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ recommend to run `npm run format` before sending a patch.

To create a new release, create a commit that:

- increases the version number in `package.json`
- increases the version number in `package.json` and `package-lock.json`
- updates `CHANGELOG.md` to cover changes since the last release

Our CI will recognize the commit and publish new versions to the VSCode
Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"description": "In restricted mode clangd.path and clangd.arguments are not respected.",
"restrictedConfigurations": [
"clangd.path",
"clangd.useScriptAsExecutable",
"clangd.arguments"
]
}
Expand All @@ -103,6 +104,12 @@
"scope": "machine-overridable",
"description": "The path to clangd executable, e.g.: /usr/bin/clangd."
},
"clangd.useScriptAsExecutable": {
"type": "boolean",
"default": false,
"scope": "machine-overridable",
"description": "Allows the path to be a script e.g.: clangd.sh."
},
"clangd.arguments": {
"type": "array",
"default": [],
Expand Down Expand Up @@ -397,4 +404,4 @@
]
}
}
}
}
15 changes: 13 additions & 2 deletions src/clangd-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,22 @@ export class ClangdContext implements vscode.Disposable {
private constructor(subscriptions: vscode.Disposable[], clangdPath: string,
outputChannel: vscode.OutputChannel) {
this.subscriptions = subscriptions;
const clangdArguments = config.get<string[]>('arguments');
const useScriptAsExecutable = config.get<boolean>('useScriptAsExecutable');
let clangdArguments = config.get<string[]>('arguments');
if (useScriptAsExecutable) {
let quote = (str: string) => { return `"${str}"`; };
clangdPath = quote(clangdPath)
for (var i = 0; i < clangdArguments.length; i++) {
clangdArguments[i] = quote(clangdArguments[i]);
}
}
const clangd: vscodelc.Executable = {
command: clangdPath,
args: clangdArguments,
options: {cwd: vscode.workspace.rootPath || process.cwd()}
options: {
cwd: vscode.workspace.rootPath || process.cwd(),
shell: useScriptAsExecutable
}
};
const traceFile = config.get<string>('trace');
if (!!traceFile) {
Expand Down
Loading