Skip to content

Commit bd8c55c

Browse files
committed
[wip] first pass
1 parent 4df8bd3 commit bd8c55c

6 files changed

Lines changed: 57 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ We currently do not have the capability to support Operating System (OS) certifi
5959

6060
## Contributing
6161

62-
See [CONTRIBUTING.md](CONTRIBUTING.md). A description of the architecture of the extension can be found [here](./docs/project-architecture.md).
62+
See [CONTRIBUTING.md](CONTRIBUTING.md). A description of the architecture of the extension can be found [here](./docs/project-architecture.md). If you are working on unreleased GitHub Actions language service changes, see the [development guide](./docs/development.md#working-with-local-languageservices-changes) for local setup steps.
6363

6464
## License
6565

docs/development.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,39 @@ get working packages.
4444
1. Start and debug extension with the `Watch & Launch Extension` configuration from the "Run and Debug" side panel menu
4545
1. Open a workspace in the remote extension host that contains workflow files in the `.github/workflows` directory
4646

47+
### Working with local languageservices changes
48+
49+
The extension consumes the GitHub Actions language stack from [actions/languageservices](https://github.com/actions/languageservices):
50+
51+
- `@actions/expressions`
52+
- `@actions/workflow-parser`
53+
- `@actions/languageservice`
54+
- `@actions/languageserver`
55+
56+
When you run `script/bootstrap`, the workspace links those packages into this repository's `node_modules/@actions` directory. That means local extension builds can pick up unreleased language service changes before the packages are published.
57+
58+
For example, from a local workspace where `vscode-github-actions` and `actions/languageservices` are sibling repositories:
59+
60+
```shell
61+
cd ~/vscode/actions/languageservices
62+
npm -w @actions/workflow-parser run build
63+
npm -w @actions/languageservice run build
64+
npm -w @actions/languageserver run build
65+
66+
cd ~/vscode/vscode-github-actions
67+
npm run build
68+
```
69+
70+
You can verify the local links with:
71+
72+
```shell
73+
ls -la node_modules/@actions
74+
```
75+
76+
The `@actions/*` packages should point back to the sibling `actions/languageservices` checkout. If they point to registry-installed packages instead, rerun `script/bootstrap` and reinstall from the workspace root before rebuilding.
77+
78+
After rebuilding, reload or restart the Extension Development Host so it starts the newly bundled language server from `dist/server-node.js`.
79+
4780
### Updating dependencies
4881

4982
Once you're happy with your changes, publish the changes to the respective packages. You might have to adjust package versions, so if you made a change to `actions-workflow-parser` and increase the version there, you will have to consume the updated package in `actions-languageservice`.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
"onView:workflows",
2727
"onView:settings",
2828
"workspaceContains:**/.github/workflows/**",
29+
"workspaceContains:**/.github/actions.lock.yml",
30+
"workspaceContains:**/.github/actions.lock.yaml",
2931
"workspaceContains:**/action.yml",
3032
"workspaceContains:**/action.yaml"
3133
],
@@ -39,6 +41,8 @@
3941
"GitHub Actions Workflow"
4042
],
4143
"filenamePatterns": [
44+
"**/.github/actions.lock.yml",
45+
"**/.github/actions.lock.yaml",
4246
"**/.github/workflows/**/*.yml",
4347
"**/.github/workflows/**/*.yaml"
4448
],
@@ -563,8 +567,8 @@
563567
"webpack-cli": "^4.10.0"
564568
},
565569
"dependencies": {
566-
"@actions/languageserver": "^0.3.46",
567-
"@actions/workflow-parser": "^0.3.46",
570+
"@actions/languageserver": "^0.3.53",
571+
"@actions/workflow-parser": "^0.3.53",
568572
"@octokit/rest": "^21.1.1",
569573
"@vscode/vsce": "^2.19.0",
570574
"buffer": "^6.0.3",
@@ -589,4 +593,4 @@
589593
"elliptic": "6.6.1"
590594
}
591595
}
592-
}
596+
}

src/workflow/documentSelector.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ export const WorkflowSelector = {
22
pattern: "**/.github/workflows/*.{yaml,yml}"
33
};
44

5+
export const DependencyLockfileSelector = {
6+
pattern: "**/.github/actions.lock.{yaml,yml}"
7+
};
8+
59
export const ActionSelector = {
610
pattern: "**/action.{yml,yaml}"
711
};

src/workflow/languageServer.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {LanguageClient as NodeLanguageClient, ServerOptions, TransportKind} from
1010
import {userAgent} from "../api/api";
1111
import {getSession} from "../auth/auth";
1212
import {getGitHubContext} from "../git/repository";
13-
import {WorkflowSelector, ActionSelector} from "./documentSelector";
13+
import {ActionSelector, DependencyLockfileSelector, WorkflowSelector} from "./documentSelector";
1414
import {getGitHubApiUri, useEnterprise} from "../configuration/configuration";
1515

1616
let client: BaseLanguageClient;
@@ -24,6 +24,13 @@ export async function initLanguageServer(context: vscode.ExtensionContext) {
2424
const session = await getSession();
2525

2626
const ghContext = await getGitHubContext();
27+
const experimentalFeatures: NonNullable<InitializationOptions["experimentalFeatures"]> = {
28+
allowCaseFunction: true
29+
};
30+
Object.assign(experimentalFeatures, {
31+
allowDependencies: true
32+
});
33+
2734
const initializationOptions: InitializationOptions = {
2835
sessionToken: session?.accessToken,
2936
userAgent: userAgent,
@@ -36,13 +43,11 @@ export async function initLanguageServer(context: vscode.ExtensionContext) {
3643
organizationOwned: repo.organizationOwned
3744
})),
3845
logLevel: PRODUCTION ? LogLevel.Warn : LogLevel.Debug,
39-
experimentalFeatures: {
40-
allowCaseFunction: true
41-
}
46+
experimentalFeatures
4247
};
4348

4449
const clientOptions: LanguageClientOptions = {
45-
documentSelector: [WorkflowSelector, ActionSelector],
50+
documentSelector: [WorkflowSelector, DependencyLockfileSelector, ActionSelector],
4651
initializationOptions: initializationOptions,
4752
progressOnInitialization: true
4853
};

0 commit comments

Comments
 (0)