Skip to content

Update Language Server flags #28

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

Merged
merged 3 commits into from
Jan 13, 2022
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
32 changes: 4 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
name: VS Code Arduino Tools
name: Build

on:
push:
branches:
- main
workflow_dispatch:
pull_request:
branches:
- main
schedule:
- cron: '0 2 * * *' # run every day at 2AM

jobs:

build:
runs-on: ubuntu-latest
steps:
Expand All @@ -22,26 +15,9 @@ jobs:
- name: Install Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
node-version: "12.x"
registry-url: "https://registry.npmjs.org"

- name: Build VS Code Extension
run: |
yarn

- name: Upload VS Code Extension [GitHub Actions]
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: build-artifacts/

- name: Upload VS Code Extension [S3]
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main')
uses: docker://plugins/s3
env:
PLUGIN_SOURCE: "build-artifacts/*"
PLUGIN_STRIP_PREFIX: "build-artifacts/"
PLUGIN_TARGET: "/vscode-arduino-tools/nightly"
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
yarn
42 changes: 42 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Deploy

on:
push:
tags:
- "*"
workflow_dispatch:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: "12.x"
registry-url: "https://registry.npmjs.org"

- name: Build VS Code Extension
run: |
yarn

- name: Upload VS Code Extension [GitHub Actions]
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: build-artifacts/

- name: Upload VS Code Extension [S3]
uses: docker://plugins/s3
env:
PLUGIN_SOURCE: "build-artifacts/*"
PLUGIN_STRIP_PREFIX: "build-artifacts/"
PLUGIN_TARGET: "/vscode-arduino-tools"
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ In order to ease code reviews and have your contributions merged faster, here is
- Your PR must pass all CI tests before we will merge it. If you're seeing an error and don't think it's your fault, it may not be! The reviewer will help you if there are test failures that seem not related to the change you are making.

## Build

To build the Arduino Tools VS Code extension (VSIX), execute:

```
yarn
```
Expand All @@ -54,11 +56,17 @@ Or from the [_Command Palette_](https://code.visualstudio.com/docs/editor/extens
You can also start the extension in debug mode.
Open the `Debug` panel, and select the `Launch Arduino Tools – VS Code Extension` launch configuration.

## Deployments

To deploy a new release of the tools you have to do the following:

- update the `version` in the package.json file
- push a tag to the repo with `v` and the version you spacified in the package.json, for example `v0.0.2-beta.1`

## Donations

This open source code was written by the Arduino team and is maintained on a daily basis with the help of the community. We invest a considerable amount of time in development, testing and optimization. Please consider [donating](https://www.arduino.cc/en/donate/) or [sponsoring](https://github.com/sponsors/arduino) to support our work, as well as [buying original Arduino boards](https://store.arduino.cc/) which is the best way to make sure our effort can continue in the long term.

## License

The code contained in this repository is licensed under the terms of the Apache 2.0 license. If you have questions about licensing please contact us at [license@arduino.cc](mailto:license@arduino.cc).

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vscode-arduino-tools",
"private": true,
"version": "0.0.1-beta.1",
"version": "0.0.2-beta.1",
"publisher": "arduino",
"license": "Apache-2.0",
"author": "Arduino SA",
Expand Down
13 changes: 7 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { LanguageClient, CloseAction, ErrorAction, InitializeError, Message, Rev

interface LanguageServerConfig {
readonly lsPath: string;
readonly cliPath: string;
readonly cliConfigPath: string;
readonly cliDaemonAddr: string;
readonly cliDaemonInstance: string;
readonly clangdPath: string;
readonly board: {
readonly fqbn: string;
Expand All @@ -29,7 +29,8 @@ interface LanguageServerConfig {
}

interface DebugConfig {
readonly cliPath: string;
readonly cliPath?: string;
readonly cliDaemonAddr?: string;
readonly board: {
readonly fqbn: string;
readonly name?: string;
Expand Down Expand Up @@ -103,7 +104,7 @@ async function startDebug(_: ExtensionContext, config: DebugConfig): Promise<boo
let rawStdErr: string | undefined = undefined;
try {
const args = ['debug', '-I', '-b', config.board.fqbn, config.sketchPath, '--format', 'json'];
const { stdout, stderr } = spawnSync(config.cliPath, args, { encoding: 'utf8' });
const { stdout, stderr } = spawnSync(config?.cliPath || '.', args, { encoding: 'utf8' });
rawStdout = stdout.trim();
rawStdErr = stderr.trim();
} catch (err) {
Expand Down Expand Up @@ -188,8 +189,8 @@ async function startLanguageServer(context: ExtensionContext, config: LanguageSe
}

async function buildLanguageClient(config: LanguageServerConfig): Promise<LanguageClient> {
const { lsPath: command, clangdPath, cliPath, cliConfigPath, board, flags, env, log } = config;
const args = ['-clangd', clangdPath, '-cli', cliPath, '-cli-config', cliConfigPath, '-fqbn', board.fqbn];
const { lsPath: command, clangdPath, cliDaemonAddr, cliDaemonInstance, board, flags, env, log } = config;
const args = ['-clangd', clangdPath, '-cli-daemon-addr', cliDaemonAddr, '-cli-daemon-instance', cliDaemonInstance, '-fqbn', board.fqbn];
if (board.name) {
args.push('-board-name', board.name);
}
Expand Down