You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Development workflow for the CloudFormation Language Server. Guides agents through implementation, testing, and PR creation. Use when implementing features, fixing bugs, adding handlers/providers, or making changes to this repository.
3
+
description: Development workflow for the AWS CloudFormation Language Server (this repository). Use when implementing features, fixing bugs, adding tests, or making any code change in cloudformation-languageserver. Covers planning, telemetry, build/lint/test verification, and PR conventions.
4
+
license: Apache-2.0
5
5
---
6
6
7
7
# CFN LSP Development Workflow
@@ -10,10 +10,51 @@ description: >
10
10
11
11
These constraints apply to ALL changes in this repository:
12
12
13
-
-**No backwards-incompatible changes (hard rule)** — Never change or remove existing LSP protocol methods, request types, or response/return types. Additive changes only — breaking the wire contract breaks the already-shipped VS Code and JetBrains clients.
14
-
-**Cross-platform** — All changes must work on macOS, Windows, and Linux
15
-
-**No database locking** — Never lock LMDB or other shared resources; multiple concurrent LSP connections may exist
16
-
-**Performance** — Handlers must respond quickly; avoid blocking the event loop or doing synchronous I/O in request paths. Use `npm run benchmark` to confirm changes haven't regressed latency.
13
+
-**No backwards-incompatible changes (hard rule)** — Never change or remove existing LSP protocol methods, request
14
+
types, or response/return types. Additive changes only — breaking the wire contract breaks the already-shipped VS Code
15
+
and JetBrains clients.
16
+
-**Cross-platform** — All changes must work on macOS, Linux, and Windows. The DataStore layer in particular has two
17
+
persisted backends (LMDB on macOS / Linux, encrypted file store on Windows or when the `FileDb` feature flag is on);
18
+
any persistence change must work against both. See `architecture.md`.
19
+
-**No database locking** — Never hold long locks on LMDB or other shared resources; multiple concurrent LSP
20
+
connections may exist.
21
+
-**Performance** — Handlers must respond quickly; avoid blocking the event loop or doing synchronous I/O in request
22
+
paths. Use `npm run benchmark` to confirm changes haven't regressed latency.
23
+
24
+
## Repository Layout
25
+
26
+
You are working inside the `cloudformation-languageserver` repo. Source lives in `src/`, tests mirror the source tree
27
+
under `tst/`. See `.kiro/steering/structure.md` for directory-level guidance and `.kiro/steering/architecture.md` for
28
+
the component / handler model.
29
+
30
+
## Scratch Files
31
+
32
+
Put scratch files, debug scripts, manual repro templates, ad-hoc benchmark scripts, and any other throwaway artifacts
33
+
under `tmp/` at the repo root. `tmp/` (and `tmp-node-modules/`, `tmp-tst/`) is `.gitignore`d, so it will never be
34
+
committed accidentally. Do **not** scatter scratch files across `src/`, `tst/`, or the workspace root.
35
+
36
+
## Code Quality
37
+
38
+
Hold every change in this repo to a senior-engineer standard. The full rule sets are bundled with this skill — read
`AwsErrorMapper`, `PathUtils`, `String`, `TypeCheck`, etc.). If a needed helper doesn't exist, add it to the
52
+
appropriate `utils/` directory rather than co-locating it in a feature folder, so the next caller can find it.
53
+
-**Respect the layer model.** Handlers stay thin and delegate to a Component or Service (see `architecture.md`).
54
+
Do not let handlers do AWS I/O, file I/O, or schema parsing directly.
55
+
56
+
Apply both rule sets even when the user doesn't mention "quality" or "best practices" — they are the contract for
57
+
contributing to this repo.
17
58
18
59
## Developer Tools
19
60
@@ -23,7 +64,8 @@ These constraints apply to ALL changes in this repository:
23
64
npm run debug-tree -- --file <template.yaml|json>
24
65
```
25
66
26
-
Runs `tools/debug_tree.ts` — builds a `SyntaxTree`, traverses every node, and emits `Context` objects at key positions. The fastest way to diagnose parse/context problems when working on completion, hover, or definition.
67
+
Runs `tools/debug_tree.ts` — builds a `SyntaxTree`, traverses every node, and emits `Context` objects at key positions.
68
+
The fastest way to diagnose parse / context problems when working on completion, hover, or definition.
27
69
28
70
### Benchmarking performance
29
71
@@ -32,114 +74,104 @@ npm run benchmark # default run
32
74
npm run benchmark -- --iterations 100 --templates ./tst/resources --output results.md
33
75
```
34
76
35
-
Runs `tools/benchmark.ts` — measures syntax-tree creation and context-lookup latency across iterations. Use this to verify the Performance constraint above.
36
-
37
-
### Stability testing
38
-
39
-
```bash
40
-
npm run test:stability
41
-
```
42
-
43
-
Runs `tools/stability/` — long-running tests that exercise completion and hover under sustained load.
77
+
Runs `tools/benchmark.ts` — measures syntax-tree creation and context-lookup latency across iterations. Use this to
78
+
verify the Performance constraint above.
44
79
45
80
## Workflow
46
81
47
82
### Step 1: Research
48
83
49
-
Before making changes, locate or set up local workspaces for affected packages:
50
-
51
-
1.**Search parent directories** for existing checkouts:
52
-
- Look for `cloudformation-languageserver/` in `../`, `../../`, etc.
53
-
- Check `LOCAL_TESTING_SERVER_PATH` env var for an existing server bundle path
54
-
55
-
2.**If not found**, ask the user:
56
-
- "Do you have a local checkout? If so, provide the path."
const result =awaitthis.telemetry.measureAsync('Subtask', async () => {
146
+
/* logic */
111
147
});
112
148
```
113
149
114
-
**Metrics emitted by these methods:**
115
-
-`{Name}.count` — invocation count
116
-
-`{Name}.duration` — response time (measure/trackExecution only)
117
-
-`{Name}.fault` — unhandled exception
118
-
119
150
### Step 5: Verify
120
151
121
152
Before creating a PR, **all of these must pass**:
122
153
123
154
```bash
124
-
npm run build # TypeScript compilation
125
-
npm run lint # Linting (zero warnings)
126
-
npm run test# Unit tests + coverage (thresholds: 88% statements, 82% branches, 90% functions, 88% lines)
155
+
npm run build # TypeScript compilation
156
+
npm run lint # Linting (zero warnings — `--max-warnings 0`)
157
+
npm run test# Unit + integration + e2e + coverage
127
158
```
128
159
129
-
Coverage runs automatically with `npm run test` (`coverage.enabled: true` in `vitest.config.ts`).
160
+
Coverage runs automatically with `npm run test` and thresholds are enforced from `vitest.config.ts`.
161
+
If you only need to run a subset while iterating: `npm run test:unit` or `npm run test:integration`.
162
+
Use `npm run lint:fix` for auto-fixable lint violations.
130
163
131
164
### Step 6: Client-Side Changes
132
165
133
-
Some changes require corresponding updates in the editor clients (e.g., features that need UX work). See the client repositories for their own build/test/contribution guides:
166
+
Some changes (new commands, new code lens actions, new UI surfaces) require corresponding updates in the editor
167
+
clients. See the client repositories for their own build / test / contribution guides:
134
168
135
-
| Client | Repository | CloudFormation path |
136
-
|--------|-----------|-------------------|
137
-
| VS Code |[`aws/aws-toolkit-vscode`](https://github.com/aws/aws-toolkit-vscode) (branch: `master`) |`packages/core/src/awsService/cloudformation/`|
0 commit comments