docassemble-lsp 26.10.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- docassemble_lsp-26.10.0/LICENSE +21 -0
- docassemble_lsp-26.10.0/PKG-INFO +156 -0
- docassemble_lsp-26.10.0/README.md +132 -0
- docassemble_lsp-26.10.0/pyproject.toml +74 -0
- docassemble_lsp-26.10.0/pyproject.toml.orig +86 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/__init__.py +10 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/__main__.py +6 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/cli.py +551 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/__init__.py +89 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/accessibility.py +983 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/completion_context.py +1004 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/completion_registry.py +725 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/completion_rules.py +5009 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/definition_models.py +115 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/definitions.py +1305 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/diagnostics.py +67 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/document_facts.py +135 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/document_links.py +572 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/field_keys.py +262 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/field_labels.py +179 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/field_validators.py +539 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/files.py +581 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/fixes.py +1395 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/formatting.py +379 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/indentation.py +42 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/interview_definitions.py +115 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/jinja.py +855 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/line_helpers.py +124 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/logging.py +50 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/messages.py +1255 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/python_modules.py +779 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/python_navigation.py +1561 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/python_paths.py +206 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/question_ids.py +326 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/schema.py +224 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/schema_insert_text.py +48 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/schema_models.py +27 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/schema_snippets.py +670 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/semantic_tokens.py +62 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/__init__.py +41 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/attachments.py +177 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/blocks.py +1202 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/data.py +70 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/fields.py +1202 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/list_collect.py +179 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/lists.py +532 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/orchestrator.py +842 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/review.py +113 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/table.py +135 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/validation_code_safety.py +333 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation/visibility.py +54 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/validation_config.py +76 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/workspace.py +369 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/workspace_navigation.py +333 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/workspace_symbols.py +123 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/yaml_parsing.py +15 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/yaml_shared.py +341 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/core/yesno_shortcuts.py +150 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/data/__init__.py +1 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/data/vendored_docassemble_base_error.pyi +73 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/data/vendored_docassemble_base_functions.pyi +1816 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/data/vendored_docassemble_base_util.pyi +5883 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/lsp/__init__.py +5 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/lsp/server.py +1559 -0
- docassemble_lsp-26.10.0/src/docassemble_lsp/py.typed +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 Jack Adamson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: docassemble-lsp
|
|
3
|
+
Version: 26.10.0
|
|
4
|
+
Summary: Docassemble language server with shared core APIs for CLI and editors
|
|
5
|
+
Keywords: docassemble,lsp,yaml
|
|
6
|
+
Author: Jack Adamson
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Classifier: Programming Language :: Python
|
|
10
|
+
Classifier: Topic :: Text Editors
|
|
11
|
+
Requires-Dist: black>=26.1.0
|
|
12
|
+
Requires-Dist: esprima2>=6.0.0
|
|
13
|
+
Requires-Dist: jinja2>=3.1.6,<4
|
|
14
|
+
Requires-Dist: lsprotocol>=2025.0.0
|
|
15
|
+
Requires-Dist: mako>=1.3.12
|
|
16
|
+
Requires-Dist: pygls>=2.1.1
|
|
17
|
+
Requires-Dist: ruamel-yaml>=0.18.17
|
|
18
|
+
Requires-Dist: tomli>=2.3.0
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Project-URL: Bug Tracker, https://github.com/jpagh/docassemble-yaml/issues
|
|
21
|
+
Project-URL: Homepage, https://github.com/jpagh/docassemble-yaml
|
|
22
|
+
Project-URL: Repository, https://github.com/jpagh/docassemble-yaml
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# docassemble-lsp
|
|
26
|
+
|
|
27
|
+
Language server and command-line checker for [Docassemble](https://docassemble.org)
|
|
28
|
+
interview YAML. A shared workspace model gives interviews diagnostics,
|
|
29
|
+
completion, hover, navigation, formatting, and code actions; the CLI and editor
|
|
30
|
+
integrations are thin adapters over it.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
The package is published to PyPI as `docassemble-lsp`:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv tool install docassemble-lsp
|
|
38
|
+
# or: pipx install docassemble-lsp
|
|
39
|
+
# or: pip install docassemble-lsp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This installs the `docassemble-lsp` command. Editors launch it in language
|
|
43
|
+
server mode over stdio (`docassemble-lsp lsp`).
|
|
44
|
+
|
|
45
|
+
## CLI
|
|
46
|
+
|
|
47
|
+
Validate interviews:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
docassemble-lsp check path/to/interview.yml
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
List known diagnostic codes, severities, and summaries:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
docassemble-lsp codes
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Fail on warnings and conventions as well as errors:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
docassemble-lsp check --strict path/to/interview.yml
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
This is useful for pre-commit or pre-deploy gates where you want any reported finding to block the build, while still preserving the original diagnostic severities in the output.
|
|
66
|
+
|
|
67
|
+
Example pre-commit hook:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
- repo: local
|
|
71
|
+
hooks:
|
|
72
|
+
- id: docassemble-lsp-check
|
|
73
|
+
name: docassemble-lsp check
|
|
74
|
+
entry: docassemble-lsp check --strict
|
|
75
|
+
language: system
|
|
76
|
+
files: '\.(ya?ml)$'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
From a source checkout, the same commands run as `uv run python -m docassemble_lsp ...`.
|
|
80
|
+
|
|
81
|
+
## Editors
|
|
82
|
+
|
|
83
|
+
### VS Code
|
|
84
|
+
|
|
85
|
+
A VS Code extension connects to this language server and brings Docassemble YAML support into the editor. The extension source is at [`vscode/`](https://github.com/jpagh/docassemble-yaml/tree/main/vscode) in this repository; its [`README.md`](https://github.com/jpagh/docassemble-yaml/blob/main/vscode/README.md) covers installation and development.
|
|
86
|
+
|
|
87
|
+
Once installed, any `.yml` file inside a Docassemble package workspace opens with the following features active:
|
|
88
|
+
|
|
89
|
+
- **Diagnostics** — errors, warnings, and convention violations appear inline as you type and on save.
|
|
90
|
+
- **Completions** — top-level block keys, scoped sub-keys, enum values, and field variables are offered at the cursor position.
|
|
91
|
+
- **Hover** — hold the cursor over any supported key to see its documentation and allowed values.
|
|
92
|
+
- **Document symbols** — the outline panel lists all interview blocks in the current file.
|
|
93
|
+
- **Go to definition / find references** — navigate from an `event` name, `def` block, field variable, include path, or asset reference to its definition and find references across the workspace.
|
|
94
|
+
- **Workspace symbols** — search across the workspace for `event` and `def` entities with the symbol picker.
|
|
95
|
+
- **Document links** — local and package-qualified include paths and file-valued keys are ctrl-clickable.
|
|
96
|
+
- **Semantic highlighting** — well-known Docassemble code and template regions are exposed through semantic tokens.
|
|
97
|
+
- **Formatting** — whole-document formatting and on-type indentation for `fields` blocks.
|
|
98
|
+
- **Quick fixes** — deterministic fixes for known diagnostics such as field-shorthand convention violations.
|
|
99
|
+
|
|
100
|
+
#### Extension Configuration
|
|
101
|
+
|
|
102
|
+
Convention rules can be enabled per project in `pyproject.toml`:
|
|
103
|
+
|
|
104
|
+
```toml
|
|
105
|
+
[tool.docassemble-lsp]
|
|
106
|
+
conventions = ["C102"]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The server resolves config per document — each file uses the nearest config found by walking up from the file's own directory — so no per-extension configuration is needed, and multi-root workspaces get per-project behavior: each project's files follow their own config file.
|
|
110
|
+
|
|
111
|
+
Projects without a `pyproject.toml` (e.g. a plain interview repository) can use a dedicated config file instead — `docassemble-lsp.toml`, `.docassemble-lsp.toml`, or `.config/docassemble-lsp.toml`, in that order of precedence within a directory:
|
|
112
|
+
|
|
113
|
+
```toml
|
|
114
|
+
conventions = ["C102"]
|
|
115
|
+
ignore-codes = ["E301"]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
The server walks up to the nearest config file, and a dedicated file wins over the `[tool.docassemble-lsp]` pyproject section in the same directory. The dedicated files accept the same keys as the pyproject section (`conventions`, `ignore-codes`, `yaml_path`, `args`, `check_args`, `format_args`, `lsp_args`).
|
|
119
|
+
|
|
120
|
+
Explicit `--conventions`/`--ignore-codes` flags on the `lsp` command apply to every document on top of the per-project config. The generic `args`/`lsp_args` keys are read from the server's working directory only (not per project); prefer the structured `conventions` and `ignore-codes` keys for per-project behavior.
|
|
121
|
+
|
|
122
|
+
#### Troubleshooting Completions
|
|
123
|
+
|
|
124
|
+
If autocomplete isn't showing classes or custom datatypes you expect:
|
|
125
|
+
|
|
126
|
+
- **Just created a new `.py` file?** Save any YAML file in the package. The LSP rebuilds its workspace index on save.
|
|
127
|
+
- **Installed a new docassemble package in `.venv`?** Restart the language server (Cmd+Shift+P → "Docassemble: Restart Language Server").
|
|
128
|
+
- **Renamed a class or datatype?** Save any YAML file to trigger a re-index.
|
|
129
|
+
|
|
130
|
+
The LSP uses a flat "over-offer" model: it indexes every Python module in your package and makes all classes available in completions, regardless of which YAML file declares the ``modules:`` directive. Docassemble catches any out-of-scope classes at runtime.
|
|
131
|
+
|
|
132
|
+
### Fresh
|
|
133
|
+
|
|
134
|
+
The [`fresh/`](https://github.com/jpagh/docassemble-yaml/tree/main/fresh) bundle adds Docassemble syntax highlighting, interview detection, and LSP wiring for the [Fresh](https://github.com/sinelaw/fresh) terminal editor. It launches this server as `docassemble-lsp lsp`; see [`fresh/README.md`](https://github.com/jpagh/docassemble-yaml/blob/main/fresh/README.md) for installation and configuration.
|
|
135
|
+
|
|
136
|
+
## Project Documentation
|
|
137
|
+
|
|
138
|
+
The internal architecture and implementation roadmap live under `docs/` in the repository:
|
|
139
|
+
|
|
140
|
+
- [`docs/ARCHITECTURE.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/ARCHITECTURE.md) explains the shared LSP/CLI architecture and service boundaries.
|
|
141
|
+
- [`docs/SUBAGENT_GUIDE.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/SUBAGENT_GUIDE.md) gives small implementation agents a safe workflow for future changes.
|
|
142
|
+
- [`docs/FEATURE_PATTERNS.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/FEATURE_PATTERNS.md) documents where each feature family should be extended.
|
|
143
|
+
- [`docs/ROADMAP.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/ROADMAP.md) tracks the current release-readiness and hardening plan.
|
|
144
|
+
- [`docs/INVENTORY.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/INVENTORY.md) records the baseline Docassemble YAML key support surface.
|
|
145
|
+
|
|
146
|
+
## Fixtures And Development
|
|
147
|
+
|
|
148
|
+
The repo keeps a small package fixture modeled on a real Docassemble app include stack at `tests/fixtures/demo_package`. It mirrors the `main.yml -> x_main_include.yml -> x_events.yml` shape from a larger package while staying small enough for CI-backed navigation tests.
|
|
149
|
+
|
|
150
|
+
For local smoke testing against a real package checkout during development:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
uv run python -m docassemble_lsp check /path/to/docassemble-demo/docassemble/demo/data/questions
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
That real-package run is useful for manual validation, but tests should keep using the checked-in fixture so CI does not depend on an external repository.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# docassemble-lsp
|
|
2
|
+
|
|
3
|
+
Language server and command-line checker for [Docassemble](https://docassemble.org)
|
|
4
|
+
interview YAML. A shared workspace model gives interviews diagnostics,
|
|
5
|
+
completion, hover, navigation, formatting, and code actions; the CLI and editor
|
|
6
|
+
integrations are thin adapters over it.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
The package is published to PyPI as `docassemble-lsp`:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv tool install docassemble-lsp
|
|
14
|
+
# or: pipx install docassemble-lsp
|
|
15
|
+
# or: pip install docassemble-lsp
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This installs the `docassemble-lsp` command. Editors launch it in language
|
|
19
|
+
server mode over stdio (`docassemble-lsp lsp`).
|
|
20
|
+
|
|
21
|
+
## CLI
|
|
22
|
+
|
|
23
|
+
Validate interviews:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
docassemble-lsp check path/to/interview.yml
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
List known diagnostic codes, severities, and summaries:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
docassemble-lsp codes
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Fail on warnings and conventions as well as errors:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
docassemble-lsp check --strict path/to/interview.yml
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This is useful for pre-commit or pre-deploy gates where you want any reported finding to block the build, while still preserving the original diagnostic severities in the output.
|
|
42
|
+
|
|
43
|
+
Example pre-commit hook:
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
- repo: local
|
|
47
|
+
hooks:
|
|
48
|
+
- id: docassemble-lsp-check
|
|
49
|
+
name: docassemble-lsp check
|
|
50
|
+
entry: docassemble-lsp check --strict
|
|
51
|
+
language: system
|
|
52
|
+
files: '\.(ya?ml)$'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
From a source checkout, the same commands run as `uv run python -m docassemble_lsp ...`.
|
|
56
|
+
|
|
57
|
+
## Editors
|
|
58
|
+
|
|
59
|
+
### VS Code
|
|
60
|
+
|
|
61
|
+
A VS Code extension connects to this language server and brings Docassemble YAML support into the editor. The extension source is at [`vscode/`](https://github.com/jpagh/docassemble-yaml/tree/main/vscode) in this repository; its [`README.md`](https://github.com/jpagh/docassemble-yaml/blob/main/vscode/README.md) covers installation and development.
|
|
62
|
+
|
|
63
|
+
Once installed, any `.yml` file inside a Docassemble package workspace opens with the following features active:
|
|
64
|
+
|
|
65
|
+
- **Diagnostics** — errors, warnings, and convention violations appear inline as you type and on save.
|
|
66
|
+
- **Completions** — top-level block keys, scoped sub-keys, enum values, and field variables are offered at the cursor position.
|
|
67
|
+
- **Hover** — hold the cursor over any supported key to see its documentation and allowed values.
|
|
68
|
+
- **Document symbols** — the outline panel lists all interview blocks in the current file.
|
|
69
|
+
- **Go to definition / find references** — navigate from an `event` name, `def` block, field variable, include path, or asset reference to its definition and find references across the workspace.
|
|
70
|
+
- **Workspace symbols** — search across the workspace for `event` and `def` entities with the symbol picker.
|
|
71
|
+
- **Document links** — local and package-qualified include paths and file-valued keys are ctrl-clickable.
|
|
72
|
+
- **Semantic highlighting** — well-known Docassemble code and template regions are exposed through semantic tokens.
|
|
73
|
+
- **Formatting** — whole-document formatting and on-type indentation for `fields` blocks.
|
|
74
|
+
- **Quick fixes** — deterministic fixes for known diagnostics such as field-shorthand convention violations.
|
|
75
|
+
|
|
76
|
+
#### Extension Configuration
|
|
77
|
+
|
|
78
|
+
Convention rules can be enabled per project in `pyproject.toml`:
|
|
79
|
+
|
|
80
|
+
```toml
|
|
81
|
+
[tool.docassemble-lsp]
|
|
82
|
+
conventions = ["C102"]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The server resolves config per document — each file uses the nearest config found by walking up from the file's own directory — so no per-extension configuration is needed, and multi-root workspaces get per-project behavior: each project's files follow their own config file.
|
|
86
|
+
|
|
87
|
+
Projects without a `pyproject.toml` (e.g. a plain interview repository) can use a dedicated config file instead — `docassemble-lsp.toml`, `.docassemble-lsp.toml`, or `.config/docassemble-lsp.toml`, in that order of precedence within a directory:
|
|
88
|
+
|
|
89
|
+
```toml
|
|
90
|
+
conventions = ["C102"]
|
|
91
|
+
ignore-codes = ["E301"]
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The server walks up to the nearest config file, and a dedicated file wins over the `[tool.docassemble-lsp]` pyproject section in the same directory. The dedicated files accept the same keys as the pyproject section (`conventions`, `ignore-codes`, `yaml_path`, `args`, `check_args`, `format_args`, `lsp_args`).
|
|
95
|
+
|
|
96
|
+
Explicit `--conventions`/`--ignore-codes` flags on the `lsp` command apply to every document on top of the per-project config. The generic `args`/`lsp_args` keys are read from the server's working directory only (not per project); prefer the structured `conventions` and `ignore-codes` keys for per-project behavior.
|
|
97
|
+
|
|
98
|
+
#### Troubleshooting Completions
|
|
99
|
+
|
|
100
|
+
If autocomplete isn't showing classes or custom datatypes you expect:
|
|
101
|
+
|
|
102
|
+
- **Just created a new `.py` file?** Save any YAML file in the package. The LSP rebuilds its workspace index on save.
|
|
103
|
+
- **Installed a new docassemble package in `.venv`?** Restart the language server (Cmd+Shift+P → "Docassemble: Restart Language Server").
|
|
104
|
+
- **Renamed a class or datatype?** Save any YAML file to trigger a re-index.
|
|
105
|
+
|
|
106
|
+
The LSP uses a flat "over-offer" model: it indexes every Python module in your package and makes all classes available in completions, regardless of which YAML file declares the ``modules:`` directive. Docassemble catches any out-of-scope classes at runtime.
|
|
107
|
+
|
|
108
|
+
### Fresh
|
|
109
|
+
|
|
110
|
+
The [`fresh/`](https://github.com/jpagh/docassemble-yaml/tree/main/fresh) bundle adds Docassemble syntax highlighting, interview detection, and LSP wiring for the [Fresh](https://github.com/sinelaw/fresh) terminal editor. It launches this server as `docassemble-lsp lsp`; see [`fresh/README.md`](https://github.com/jpagh/docassemble-yaml/blob/main/fresh/README.md) for installation and configuration.
|
|
111
|
+
|
|
112
|
+
## Project Documentation
|
|
113
|
+
|
|
114
|
+
The internal architecture and implementation roadmap live under `docs/` in the repository:
|
|
115
|
+
|
|
116
|
+
- [`docs/ARCHITECTURE.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/ARCHITECTURE.md) explains the shared LSP/CLI architecture and service boundaries.
|
|
117
|
+
- [`docs/SUBAGENT_GUIDE.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/SUBAGENT_GUIDE.md) gives small implementation agents a safe workflow for future changes.
|
|
118
|
+
- [`docs/FEATURE_PATTERNS.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/FEATURE_PATTERNS.md) documents where each feature family should be extended.
|
|
119
|
+
- [`docs/ROADMAP.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/ROADMAP.md) tracks the current release-readiness and hardening plan.
|
|
120
|
+
- [`docs/INVENTORY.md`](https://github.com/jpagh/docassemble-yaml/blob/main/docs/INVENTORY.md) records the baseline Docassemble YAML key support surface.
|
|
121
|
+
|
|
122
|
+
## Fixtures And Development
|
|
123
|
+
|
|
124
|
+
The repo keeps a small package fixture modeled on a real Docassemble app include stack at `tests/fixtures/demo_package`. It mirrors the `main.yml -> x_main_include.yml -> x_events.yml` shape from a larger package while staying small enough for CI-backed navigation tests.
|
|
125
|
+
|
|
126
|
+
For local smoke testing against a real package checkout during development:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
uv run python -m docassemble_lsp check /path/to/docassemble-demo/docassemble/demo/data/questions
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
That real-package run is useful for manual validation, but tests should keep using the checked-in fixture so CI does not depend on an external repository.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "docassemble-lsp"
|
|
3
|
+
version = "26.10.0"
|
|
4
|
+
description = "Docassemble language server with shared core APIs for CLI and editors"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
keywords = [
|
|
10
|
+
"docassemble",
|
|
11
|
+
"lsp",
|
|
12
|
+
"yaml",
|
|
13
|
+
]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python",
|
|
16
|
+
"Topic :: Text Editors",
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"black>=26.1.0",
|
|
20
|
+
"esprima2>=6.0.0",
|
|
21
|
+
"jinja2>=3.1.6,<4",
|
|
22
|
+
"lsprotocol>=2025.0.0",
|
|
23
|
+
"mako>=1.3.12",
|
|
24
|
+
"pygls>=2.1.1",
|
|
25
|
+
"ruamel-yaml>=0.18.17",
|
|
26
|
+
"tomli>=2.3.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[[project.authors]]
|
|
30
|
+
name = "Jack Adamson"
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
"Bug Tracker" = "https://github.com/jpagh/docassemble-yaml/issues"
|
|
34
|
+
Homepage = "https://github.com/jpagh/docassemble-yaml"
|
|
35
|
+
Repository = "https://github.com/jpagh/docassemble-yaml"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
docassemble-lsp = "docassemble_lsp.cli:main"
|
|
39
|
+
|
|
40
|
+
[dependency-groups]
|
|
41
|
+
dev = [
|
|
42
|
+
"docassemble-base>=1.9.13",
|
|
43
|
+
"docassemble-webapp>=1.9.13",
|
|
44
|
+
"pytest>=9.1.1",
|
|
45
|
+
"pytest-cov>=7.1.0",
|
|
46
|
+
"pytest-xdist>=3.8.0",
|
|
47
|
+
]
|
|
48
|
+
test = [
|
|
49
|
+
"pytest>=9.1.1",
|
|
50
|
+
"pytest-xdist>=3.8.0",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[build-system]
|
|
54
|
+
requires = ["uv_build>=0.12.0,<0.13"]
|
|
55
|
+
build-backend = "uv_build"
|
|
56
|
+
|
|
57
|
+
[tool.pyrefly]
|
|
58
|
+
preset = "default"
|
|
59
|
+
project-includes = [
|
|
60
|
+
"**/*.py*",
|
|
61
|
+
"**/*.ipynb",
|
|
62
|
+
]
|
|
63
|
+
project-excludes = [
|
|
64
|
+
"tests/**",
|
|
65
|
+
"scripts/**",
|
|
66
|
+
"src/docassemble_lsp/data/**",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[tool.pytest.ini_options]
|
|
70
|
+
filterwarnings = ['ignore::DeprecationWarning:docassemble_pattern\.vector']
|
|
71
|
+
pythonpath = ["src"]
|
|
72
|
+
|
|
73
|
+
[tool.ruff]
|
|
74
|
+
line-length = 88
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "docassemble-lsp"
|
|
3
|
+
version = "26.10.0"
|
|
4
|
+
description = "Docassemble language server with shared core APIs for CLI and editors"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = [
|
|
9
|
+
"LICENSE",
|
|
10
|
+
]
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Jack Adamson" },
|
|
13
|
+
]
|
|
14
|
+
keywords = [
|
|
15
|
+
"docassemble",
|
|
16
|
+
"lsp",
|
|
17
|
+
"yaml",
|
|
18
|
+
]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Programming Language :: Python",
|
|
21
|
+
"Topic :: Text Editors",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"black>=26.1.0",
|
|
25
|
+
"esprima2>=6.0.0",
|
|
26
|
+
# The Jinja include resolver uses the private _parse hook and relies
|
|
27
|
+
# on get_template accepting Template instances (see core/jinja.py).
|
|
28
|
+
"jinja2>=3.1.6,<4",
|
|
29
|
+
"lsprotocol>=2025.0.0",
|
|
30
|
+
"mako>=1.3.12",
|
|
31
|
+
"pygls>=2.1.1",
|
|
32
|
+
"ruamel-yaml>=0.18.17",
|
|
33
|
+
"tomli>=2.3.0",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
"Bug Tracker" = "https://github.com/jpagh/docassemble-yaml/issues"
|
|
38
|
+
Homepage = "https://github.com/jpagh/docassemble-yaml"
|
|
39
|
+
Repository = "https://github.com/jpagh/docassemble-yaml"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
docassemble-lsp = "docassemble_lsp.cli:main"
|
|
43
|
+
|
|
44
|
+
[dependency-groups]
|
|
45
|
+
dev = [
|
|
46
|
+
"docassemble-base>=1.9.13",
|
|
47
|
+
"docassemble-webapp>=1.9.13",
|
|
48
|
+
"pytest>=9.1.1",
|
|
49
|
+
"pytest-cov>=7.1.0",
|
|
50
|
+
"pytest-xdist>=3.8.0",
|
|
51
|
+
]
|
|
52
|
+
test = [
|
|
53
|
+
"pytest>=9.1.1",
|
|
54
|
+
"pytest-xdist>=3.8.0",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[build-system]
|
|
58
|
+
requires = [
|
|
59
|
+
"uv_build>=0.12.0,<0.13",
|
|
60
|
+
]
|
|
61
|
+
build-backend = "uv_build"
|
|
62
|
+
|
|
63
|
+
[tool.pyrefly]
|
|
64
|
+
preset = "default"
|
|
65
|
+
project-includes = [
|
|
66
|
+
"**/*.py*",
|
|
67
|
+
"**/*.ipynb",
|
|
68
|
+
]
|
|
69
|
+
project-excludes = [
|
|
70
|
+
"tests/**",
|
|
71
|
+
"scripts/**",
|
|
72
|
+
"src/docassemble_lsp/data/**",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[tool.pytest.ini_options]
|
|
76
|
+
# docassemble-pattern 3.6.7 uses deprecated codecs.open() in
|
|
77
|
+
# docassemble_pattern.vector, which DeprecationWarns on py3.14+.
|
|
78
|
+
filterwarnings = [
|
|
79
|
+
"ignore::DeprecationWarning:docassemble_pattern\\.vector",
|
|
80
|
+
]
|
|
81
|
+
pythonpath = [
|
|
82
|
+
"src",
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
[tool.ruff]
|
|
86
|
+
line-length = 88
|