Skip to content

Commit cafa250

Browse files
author
Akos Kitta
committed
feat: flag to limit the thread count used by LS
chore: bump version for the release test: use the latest CLI version for testing feat(test): improve logging for tests - log when core install starts fix(test): regressions due to platform change - change core version to `3.0.0-arduino3r2`, - the vendor ID is `arduino` and not `esp32` anymore, and - use the AVR core for negative tests: it does not have a default programmer set. Hence, the expected error is no triggered. Ref: arduino/arduino-language-server#177 Signed-off-by: Akos Kitta <[email protected]>
1 parent 1437f94 commit cafa250

File tree

5 files changed

+25
-21
lines changed

5 files changed

+25
-21
lines changed

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "vscode-arduino-tools",
4-
"version": "0.1.1",
4+
"version": "0.1.2",
55
"description": "Arduino Tools extension for VS Code",
66
"license": "Apache-2.0",
77
"author": "Arduino SA",
@@ -25,7 +25,7 @@
2525
"compile-tests": "tsc -p . --outDir lib",
2626
"format": "prettier --write . && prettier-package-json --write ./package.json",
2727
"generate": "node ./scripts/generate.js 1.5.1",
28-
"postinstall": "node ./scripts/cli 0.35.0-rc.7",
28+
"postinstall": "node ./scripts/cli 0.35.2",
2929
"lint": "eslint src --ext ts",
3030
"prepackage": "yarn clean && yarn compile && yarn lint && yarn webpack",
3131
"package": "mkdirp build-artifacts && vsce package --out ./build-artifacts",

Diff for: src/ino.ts

+9
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ export interface StartLanguageServerParams {
5555
* If `true`, the logging is not forwarded to the _Output_ view via the language client.
5656
*/
5757
readonly silentOutput?: boolean;
58+
/**
59+
* Number of async workers used by `clangd`. Background index also uses this many workers. If `0`, `clangd` uses all available cores. It's `0` by default.
60+
*/
61+
readonly jobs?: number;
5862
}
5963

6064
/**
@@ -177,6 +181,7 @@ async function buildLanguageClient(
177181
flags,
178182
env,
179183
log,
184+
jobs,
180185
} = config;
181186
const args = [
182187
'-clangd',
@@ -216,6 +221,10 @@ async function buildLanguageClient(
216221
args.push('-logpath', logPath);
217222
}
218223
}
224+
// https://github.com/arduino/arduino-language-server/pull/177
225+
if (jobs) {
226+
args.push('-jobs', String(jobs));
227+
}
219228
const clientOptions: LanguageClientOptions = {
220229
initializationOptions: {},
221230
documentSelector: ['ino', 'c', 'cpp', 'cc', 'cxx', 'h', 'hpp', 'pde'],

Diff for: src/test/suite/debug.slow-test.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('debug (slow)', function () {
3838
describe('createLaunchConfig', () => {
3939
it('should create with the required custom board options (USBMode=hwcdc)', async () => {
4040
const configOptions = 'USBMode=hwcdc';
41-
const fqbn = `esp32:esp32:nano_nora:${configOptions}`;
41+
const fqbn = `arduino:esp32:nano_nora:${configOptions}`;
4242
const name = 'the board name';
4343
const programmer = 'esptool';
4444
const actual = await createLaunchConfig({
@@ -50,14 +50,14 @@ describe('debug (slow)', function () {
5050
});
5151
const expected = {
5252
name: `${name} (${configOptions},${programmer})`,
53-
configId: 'esp32:esp32:nano_nora:USBMode=hwcdc,programmer=esptool',
53+
configId: 'arduino:esp32:nano_nora:USBMode=hwcdc,programmer=esptool',
5454
cwd: '${workspaceRoot}',
5555
request: 'attach',
5656
type: 'cortex-debug',
5757
executable: fromBuildPath('my_sketch.ino.elf'),
5858
toolchainPrefix: 'xtensa-esp32s3-elf',
5959
svdFile: fromDataDir(
60-
'packages/esp32/hardware/esp32/3.0.0-arduino3/tools/ide-debug/svd/esp32s3.svd'
60+
'packages/arduino/hardware/esp32/3.0.0-arduino3r2/tools/ide-debug/svd/esp32s3.svd'
6161
),
6262
objdumpPath: fromDataDir(
6363
'/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-12.2.0_20230208/bin/xtensa-esp32s3-elf-objdump'
@@ -86,7 +86,7 @@ describe('debug (slow)', function () {
8686
});
8787

8888
it('should fail when the required custom board options are missing', async () => {
89-
const fqbn = 'esp32:esp32:nano_nora';
89+
const fqbn = 'arduino:esp32:nano_nora';
9090
const programmer = 'esptool';
9191
await assert.rejects(
9292
createLaunchConfig({
@@ -155,7 +155,7 @@ describe('debug (slow)', function () {
155155

156156
it('should build the debug --info arguments', async () => {
157157
const { file, args } = buildDebugInfoArgs({
158-
board: { fqbn: 'arduino:esp32:nano_nora' },
158+
board: { fqbn: 'arduino:esp32:nano_nora:USBMode=hwcdc' },
159159
cliPath: testEnv.cliPath,
160160
sketchPath,
161161
cliConfigPath: testEnv.cliConfigPath,
@@ -173,10 +173,8 @@ describe('debug (slow)', function () {
173173
this.skip();
174174
}
175175
await assert.rejects(
176-
cliExec(
177-
['debug', '-I', '-b', 'arduino:esp32:nano_nora', sketchPath],
178-
locale
179-
),
176+
// Can be any arbitrary board that does not have a default programmer defined in the platform. Otherwise, the error does not occur.
177+
cliExec(['debug', '-I', '-b', 'arduino:avr:uno', sketchPath], locale),
180178
(reason) => isMissingProgrammerError(reason)
181179
);
182180
})
@@ -188,7 +186,7 @@ describe('debug (slow)', function () {
188186
'debug',
189187
'-I',
190188
'-b',
191-
'arduino:esp32:nano_nora',
189+
'arduino:esp32:nano_nora:USBMode=hwcdc',
192190
'-P',
193191
'unknown',
194192
sketchPath,

Diff for: src/test/suite/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ async function setup(tracked: typeof temp): Promise<TestEnv> {
9292
const params: PrepareTestEnvParams = {
9393
...testEnv,
9494
platformsToInstall: [
95-
{ platform: 'esp32:esp32', version: '3.0.0-arduino3' },
96-
{ platform: 'arduino:esp32' },
95+
{ platform: 'arduino:avr' }, // this is an arbitrary core without default programmer set to get the expected error from the CLI with the --programmer value is missing
96+
{ platform: 'arduino:esp32', version: '3.0.0-arduino3r2' },
9797
{ platform: 'arduino:samd' }, // samd is need to get the tools for the manually (Git) installed core
9898
],
9999
additionalUrls: [

Diff for: src/test/testEnv.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,11 @@ async function prepareWithCli(params: PrepareTestEnvParams): Promise<void> {
135135
await cliExec(['core', 'update-index'], cliConfigPath);
136136
log('Updated index');
137137
for (const { platform, version } of params.platformsToInstall ?? []) {
138-
const args = [
139-
'core',
140-
'install',
141-
version ? `${platform}@${version}` : platform,
142-
'--skip-post-install',
143-
];
138+
const toInstall = version ? `${platform}@${version}` : platform;
139+
log(`Installing ${toInstall}...`);
140+
const args = ['core', 'install', toInstall, '--skip-post-install'];
144141
await cliExec(args, cliConfigPath);
145-
log(`Installed ${platform}`);
142+
log(`Done. Installed ${platform}`);
146143
}
147144
log('Done');
148145
}

0 commit comments

Comments
 (0)