├── .github
└── workflows
│ ├── publish.yml
│ └── test.yml
├── .gitignore
├── .pre-commit-config.yaml
├── LICENSE
├── README.md
├── assets
├── completion.gif
└── hover.gif
├── poetry.lock
├── pyproject.toml
├── systemd_language_server
├── __init__.py
├── assets
│ ├── systemd.automount.xml
│ ├── systemd.exec.xml
│ ├── systemd.kill.xml
│ ├── systemd.mount.xml
│ ├── systemd.path.xml
│ ├── systemd.scope.xml
│ ├── systemd.service.xml
│ ├── systemd.socket.xml
│ ├── systemd.swap.xml
│ ├── systemd.timer.xml
│ └── systemd.unit.xml
├── constants.py
├── server.py
└── unit.py
└── tests
├── __init__.py
├── conftest.py
├── data
├── test.mount
├── test.service
├── test.socket
└── test.timer
└── test_server.py
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: Publish to pypi
2 | on:
3 | release:
4 | types:
5 | - created
6 | workflow_dispatch:
7 |
8 | jobs:
9 | publish:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - uses: actions/checkout@v4
13 | - name: Set up Python
14 | uses: actions/setup-python@v5
15 | with:
16 | python-version: 3.11
17 | - name: Install Poetry
18 | run: pip install poetry
19 | - name: Configure poetry
20 | env:
21 | PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
22 | run: poetry config pypi-token.pypi $PYPI_TOKEN
23 | - name: Build package
24 | run: poetry build
25 | - name: Publish package
26 | run: poetry publish
27 |
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | name: Run test suite
2 | on:
3 | push:
4 | workflow_dispatch:
5 |
6 | jobs:
7 | test:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - uses: actions/checkout@v4
11 | - name: Set up Python
12 | uses: actions/setup-python@v5
13 | with:
14 | python-version: 3.11
15 | - name: Install Poetry
16 | run: pip install poetry
17 | - name: Install non-python dependencies
18 | run: sudo apt install --yes pandoc
19 | - name: Install dependencies
20 | run: poetry install
21 | - name: Test
22 | run: poetry run -- pytest
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.toptal.com/developers/gitignore/api/python
2 | # Edit at https://www.toptal.com/developers/gitignore?templates=python
3 |
4 | ### Python ###
5 | # Byte-compiled / optimized / DLL files
6 | __pycache__/
7 | *.py[cod]
8 | *$py.class
9 |
10 | # C extensions
11 | *.so
12 |
13 | # Distribution / packaging
14 | .Python
15 | build/
16 | develop-eggs/
17 | dist/
18 | downloads/
19 | eggs/
20 | .eggs/
21 | lib/
22 | lib64/
23 | parts/
24 | sdist/
25 | var/
26 | wheels/
27 | share/python-wheels/
28 | *.egg-info/
29 | .installed.cfg
30 | *.egg
31 | MANIFEST
32 |
33 | # PyInstaller
34 | # Usually these files are written by a python script from a template
35 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
36 | *.manifest
37 | *.spec
38 |
39 | # Installer logs
40 | pip-log.txt
41 | pip-delete-this-directory.txt
42 |
43 | # Unit test / coverage reports
44 | htmlcov/
45 | .tox/
46 | .nox/
47 | .coverage
48 | .coverage.*
49 | .cache
50 | nosetests.xml
51 | coverage.xml
52 | *.cover
53 | *.py,cover
54 | .hypothesis/
55 | .pytest_cache/
56 | cover/
57 |
58 | # Translations
59 | *.mo
60 | *.pot
61 |
62 | # Django stuff:
63 | *.log
64 | local_settings.py
65 | db.sqlite3
66 | db.sqlite3-journal
67 |
68 | # Flask stuff:
69 | instance/
70 | .webassets-cache
71 |
72 | # Scrapy stuff:
73 | .scrapy
74 |
75 | # Sphinx documentation
76 | docs/_build/
77 |
78 | # PyBuilder
79 | .pybuilder/
80 | target/
81 |
82 | # Jupyter Notebook
83 | .ipynb_checkpoints
84 |
85 | # IPython
86 | profile_default/
87 | ipython_config.py
88 |
89 | # pyenv
90 | # For a library or package, you might want to ignore these files since the code is
91 | # intended to run in multiple environments; otherwise, check them in:
92 | # .python-version
93 |
94 | # pipenv
95 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
97 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
98 | # install all needed dependencies.
99 | #Pipfile.lock
100 |
101 | # poetry
102 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103 | # This is especially recommended for binary packages to ensure reproducibility, and is more
104 | # commonly ignored for libraries.
105 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106 | #poetry.lock
107 |
108 | # pdm
109 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110 | #pdm.lock
111 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112 | # in version control.
113 | # https://pdm.fming.dev/#use-with-ide
114 | .pdm.toml
115 |
116 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117 | __pypackages__/
118 |
119 | # Celery stuff
120 | celerybeat-schedule
121 | celerybeat.pid
122 |
123 | # SageMath parsed files
124 | *.sage.py
125 |
126 | # Environments
127 | .env
128 | .venv
129 | env/
130 | venv/
131 | ENV/
132 | env.bak/
133 | venv.bak/
134 |
135 | # Spyder project settings
136 | .spyderproject
137 | .spyproject
138 |
139 | # Rope project settings
140 | .ropeproject
141 |
142 | # mkdocs documentation
143 | /site
144 |
145 | # mypy
146 | .mypy_cache/
147 | .dmypy.json
148 | dmypy.json
149 |
150 | # Pyre type checker
151 | .pyre/
152 |
153 | # pytype static type analyzer
154 | .pytype/
155 |
156 | # Cython debug symbols
157 | cython_debug/
158 |
159 | # PyCharm
160 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
162 | # and can be added to the global gitignore or merged into this file. For a more nuclear
163 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
164 | #.idea/
165 |
166 | ### Python Patch ###
167 | # Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
168 | poetry.toml
169 |
170 | # ruff
171 | .ruff_cache/
172 |
173 | # LSP config files
174 | pyrightconfig.json
175 |
176 | # End of https://www.toptal.com/developers/gitignore/api/python
177 |
178 | *.log
179 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | repos:
2 | - repo: https://github.com/psf/black
3 | rev: "24.1.1"
4 | hooks:
5 | - id: black
6 | - repo: https://github.com/PyCQA/isort
7 | rev: "5.13.2"
8 | hooks:
9 | - id: isort
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # systemd-language-server
2 |
3 | [](https://pypi.org/project/systemd-language-server)
4 | [](https://github.com/psacawa/systemd-language-server/actions)
5 | [](https://github.com/psacawa/systemd-language-server/blob/master/LICENSE)
6 |
7 | Language server for systemd unit files. Result of an exercise to learn the language server protocol.
8 |
9 | ## Supported Features
10 |
11 | ### `textDocument/completion`
12 |
13 | Completion for
14 |
15 | - unit file directives
16 | - unit file sections
17 |
18 |
19 | 
20 |
21 | ### `textDocument/hover`
22 |
23 | Documentation for directives supplied on hovering.
24 |
25 | 
26 |
27 | For markup in hover windows (i.e. the fancy highlighting), `pandoc` must be found in `$PATH`. Otherwise, there will be fallback to plain text.
28 |
29 | ## Installation
30 |
31 | ```
32 | pip install systemd-language-server
33 | ```
34 |
35 | ## Example Integrations
36 |
37 | ### coc.nvim
38 |
39 | In `coc-settings.json`, under `.languageserver`:
40 |
41 | ```json
42 | ...
43 | "systemd-language-server": {
44 | "command": "systemd-language-server",
45 | "filetypes": ["systemd"]
46 | }
47 | ...
48 | ```
49 |
50 | ### nvim-lspconfig
51 |
52 | ```lua
53 | local lspconfig = require 'lspconfig'
54 | local configs = require 'lspconfig.configs'
55 |
56 | if not configs.systemd_ls then
57 | configs.systemd_ls = {
58 | default_config = {
59 | cmd = { 'systemd-language-server' },
60 | filetypes = { 'systemd' },
61 | root_dir = function() return nil end,
62 | single_file_support = true,
63 | settings = {},
64 | },
65 | docs = {
66 | description = [[
67 | https://github.com/psacawa/systemd-language-server
68 |
69 | Language Server for Systemd unit files.
70 | ]]
71 | }
72 | }
73 | end
74 |
75 | lspconfig.systemd_ls.setup {}
76 | ```
77 |
78 | Courtesy of @ValdezFOmar
79 |
--------------------------------------------------------------------------------
/assets/completion.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psacawa/systemd-language-server/418a8e220fe489f5a846d687e9a0409ec4ec47c8/assets/completion.gif
--------------------------------------------------------------------------------
/assets/hover.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psacawa/systemd-language-server/418a8e220fe489f5a846d687e9a0409ec4ec47c8/assets/hover.gif
--------------------------------------------------------------------------------
/poetry.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
2 |
3 | [[package]]
4 | name = "attrs"
5 | version = "23.2.0"
6 | description = "Classes Without Boilerplate"
7 | optional = false
8 | python-versions = ">=3.7"
9 | files = [
10 | {file = "attrs-23.2.0-py3-none-any.whl", hash = "sha256:99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1"},
11 | {file = "attrs-23.2.0.tar.gz", hash = "sha256:935dc3b529c262f6cf76e50877d35a4bd3c1de194fd41f47a2b7ae8f19971f30"},
12 | ]
13 |
14 | [package.extras]
15 | cov = ["attrs[tests]", "coverage[toml] (>=5.3)"]
16 | dev = ["attrs[tests]", "pre-commit"]
17 | docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"]
18 | tests = ["attrs[tests-no-zope]", "zope-interface"]
19 | tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"]
20 | tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"]
21 |
22 | [[package]]
23 | name = "cattrs"
24 | version = "23.2.3"
25 | description = "Composable complex class support for attrs and dataclasses."
26 | optional = false
27 | python-versions = ">=3.8"
28 | files = [
29 | {file = "cattrs-23.2.3-py3-none-any.whl", hash = "sha256:0341994d94971052e9ee70662542699a3162ea1e0c62f7ce1b4a57f563685108"},
30 | {file = "cattrs-23.2.3.tar.gz", hash = "sha256:a934090d95abaa9e911dac357e3a8699e0b4b14f8529bcc7d2b1ad9d51672b9f"},
31 | ]
32 |
33 | [package.dependencies]
34 | attrs = ">=23.1.0"
35 | exceptiongroup = {version = ">=1.1.1", markers = "python_version < \"3.11\""}
36 | typing-extensions = {version = ">=4.1.0,<4.6.3 || >4.6.3", markers = "python_version < \"3.11\""}
37 |
38 | [package.extras]
39 | bson = ["pymongo (>=4.4.0)"]
40 | cbor2 = ["cbor2 (>=5.4.6)"]
41 | msgpack = ["msgpack (>=1.0.5)"]
42 | orjson = ["orjson (>=3.9.2)"]
43 | pyyaml = ["pyyaml (>=6.0)"]
44 | tomlkit = ["tomlkit (>=0.11.8)"]
45 | ujson = ["ujson (>=5.7.0)"]
46 |
47 | [[package]]
48 | name = "colorama"
49 | version = "0.4.6"
50 | description = "Cross-platform colored terminal text."
51 | optional = false
52 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
53 | files = [
54 | {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
55 | {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
56 | ]
57 |
58 | [[package]]
59 | name = "exceptiongroup"
60 | version = "1.2.0"
61 | description = "Backport of PEP 654 (exception groups)"
62 | optional = false
63 | python-versions = ">=3.7"
64 | files = [
65 | {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"},
66 | {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"},
67 | ]
68 |
69 | [package.extras]
70 | test = ["pytest (>=6)"]
71 |
72 | [[package]]
73 | name = "iniconfig"
74 | version = "2.0.0"
75 | description = "brain-dead simple config-ini parsing"
76 | optional = false
77 | python-versions = ">=3.7"
78 | files = [
79 | {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
80 | {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
81 | ]
82 |
83 | [[package]]
84 | name = "lsprotocol"
85 | version = "2023.0.1"
86 | description = "Python implementation of the Language Server Protocol."
87 | optional = false
88 | python-versions = ">=3.7"
89 | files = [
90 | {file = "lsprotocol-2023.0.1-py3-none-any.whl", hash = "sha256:c75223c9e4af2f24272b14c6375787438279369236cd568f596d4951052a60f2"},
91 | {file = "lsprotocol-2023.0.1.tar.gz", hash = "sha256:cc5c15130d2403c18b734304339e51242d3018a05c4f7d0f198ad6e0cd21861d"},
92 | ]
93 |
94 | [package.dependencies]
95 | attrs = ">=21.3.0"
96 | cattrs = "!=23.2.1"
97 |
98 | [[package]]
99 | name = "lxml"
100 | version = "5.1.0"
101 | description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API."
102 | optional = false
103 | python-versions = ">=3.6"
104 | files = [
105 | {file = "lxml-5.1.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:704f5572ff473a5f897745abebc6df40f22d4133c1e0a1f124e4f2bd3330ff7e"},
106 | {file = "lxml-5.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9d3c0f8567ffe7502d969c2c1b809892dc793b5d0665f602aad19895f8d508da"},
107 | {file = "lxml-5.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5fcfbebdb0c5d8d18b84118842f31965d59ee3e66996ac842e21f957eb76138c"},
108 | {file = "lxml-5.1.0-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2f37c6d7106a9d6f0708d4e164b707037b7380fcd0b04c5bd9cae1fb46a856fb"},
109 | {file = "lxml-5.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2befa20a13f1a75c751f47e00929fb3433d67eb9923c2c0b364de449121f447c"},
110 | {file = "lxml-5.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22b7ee4c35f374e2c20337a95502057964d7e35b996b1c667b5c65c567d2252a"},
111 | {file = "lxml-5.1.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:bf8443781533b8d37b295016a4b53c1494fa9a03573c09ca5104550c138d5c05"},
112 | {file = "lxml-5.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:82bddf0e72cb2af3cbba7cec1d2fd11fda0de6be8f4492223d4a268713ef2147"},
113 | {file = "lxml-5.1.0-cp310-cp310-win32.whl", hash = "sha256:b66aa6357b265670bb574f050ffceefb98549c721cf28351b748be1ef9577d93"},
114 | {file = "lxml-5.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:4946e7f59b7b6a9e27bef34422f645e9a368cb2be11bf1ef3cafc39a1f6ba68d"},
115 | {file = "lxml-5.1.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:14deca1460b4b0f6b01f1ddc9557704e8b365f55c63070463f6c18619ebf964f"},
116 | {file = "lxml-5.1.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ed8c3d2cd329bf779b7ed38db176738f3f8be637bb395ce9629fc76f78afe3d4"},
117 | {file = "lxml-5.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:436a943c2900bb98123b06437cdd30580a61340fbdb7b28aaf345a459c19046a"},
118 | {file = "lxml-5.1.0-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:acb6b2f96f60f70e7f34efe0c3ea34ca63f19ca63ce90019c6cbca6b676e81fa"},
119 | {file = "lxml-5.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:af8920ce4a55ff41167ddbc20077f5698c2e710ad3353d32a07d3264f3a2021e"},
120 | {file = "lxml-5.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7cfced4a069003d8913408e10ca8ed092c49a7f6cefee9bb74b6b3e860683b45"},
121 | {file = "lxml-5.1.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:9e5ac3437746189a9b4121db2a7b86056ac8786b12e88838696899328fc44bb2"},
122 | {file = "lxml-5.1.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:f4c9bda132ad108b387c33fabfea47866af87f4ea6ffb79418004f0521e63204"},
123 | {file = "lxml-5.1.0-cp311-cp311-win32.whl", hash = "sha256:bc64d1b1dab08f679fb89c368f4c05693f58a9faf744c4d390d7ed1d8223869b"},
124 | {file = "lxml-5.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:a5ab722ae5a873d8dcee1f5f45ddd93c34210aed44ff2dc643b5025981908cda"},
125 | {file = "lxml-5.1.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:9aa543980ab1fbf1720969af1d99095a548ea42e00361e727c58a40832439114"},
126 | {file = "lxml-5.1.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:6f11b77ec0979f7e4dc5ae081325a2946f1fe424148d3945f943ceaede98adb8"},
127 | {file = "lxml-5.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:a36c506e5f8aeb40680491d39ed94670487ce6614b9d27cabe45d94cd5d63e1e"},
128 | {file = "lxml-5.1.0-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f643ffd2669ffd4b5a3e9b41c909b72b2a1d5e4915da90a77e119b8d48ce867a"},
129 | {file = "lxml-5.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:16dd953fb719f0ffc5bc067428fc9e88f599e15723a85618c45847c96f11f431"},
130 | {file = "lxml-5.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:16018f7099245157564d7148165132c70adb272fb5a17c048ba70d9cc542a1a1"},
131 | {file = "lxml-5.1.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:82cd34f1081ae4ea2ede3d52f71b7be313756e99b4b5f829f89b12da552d3aa3"},
132 | {file = "lxml-5.1.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:19a1bc898ae9f06bccb7c3e1dfd73897ecbbd2c96afe9095a6026016e5ca97b8"},
133 | {file = "lxml-5.1.0-cp312-cp312-win32.whl", hash = "sha256:13521a321a25c641b9ea127ef478b580b5ec82aa2e9fc076c86169d161798b01"},
134 | {file = "lxml-5.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:1ad17c20e3666c035db502c78b86e58ff6b5991906e55bdbef94977700c72623"},
135 | {file = "lxml-5.1.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:24ef5a4631c0b6cceaf2dbca21687e29725b7c4e171f33a8f8ce23c12558ded1"},
136 | {file = "lxml-5.1.0-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8d2900b7f5318bc7ad8631d3d40190b95ef2aa8cc59473b73b294e4a55e9f30f"},
137 | {file = "lxml-5.1.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:601f4a75797d7a770daed8b42b97cd1bb1ba18bd51a9382077a6a247a12aa38d"},
138 | {file = "lxml-5.1.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b4b68c961b5cc402cbd99cca5eb2547e46ce77260eb705f4d117fd9c3f932b95"},
139 | {file = "lxml-5.1.0-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:afd825e30f8d1f521713a5669b63657bcfe5980a916c95855060048b88e1adb7"},
140 | {file = "lxml-5.1.0-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:262bc5f512a66b527d026518507e78c2f9c2bd9eb5c8aeeb9f0eb43fcb69dc67"},
141 | {file = "lxml-5.1.0-cp36-cp36m-win32.whl", hash = "sha256:e856c1c7255c739434489ec9c8aa9cdf5179785d10ff20add308b5d673bed5cd"},
142 | {file = "lxml-5.1.0-cp36-cp36m-win_amd64.whl", hash = "sha256:c7257171bb8d4432fe9d6fdde4d55fdbe663a63636a17f7f9aaba9bcb3153ad7"},
143 | {file = "lxml-5.1.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b9e240ae0ba96477682aa87899d94ddec1cc7926f9df29b1dd57b39e797d5ab5"},
144 | {file = "lxml-5.1.0-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a96f02ba1bcd330807fc060ed91d1f7a20853da6dd449e5da4b09bfcc08fdcf5"},
145 | {file = "lxml-5.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e3898ae2b58eeafedfe99e542a17859017d72d7f6a63de0f04f99c2cb125936"},
146 | {file = "lxml-5.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61c5a7edbd7c695e54fca029ceb351fc45cd8860119a0f83e48be44e1c464862"},
147 | {file = "lxml-5.1.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:3aeca824b38ca78d9ee2ab82bd9883083d0492d9d17df065ba3b94e88e4d7ee6"},
148 | {file = "lxml-5.1.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8f52fe6859b9db71ee609b0c0a70fea5f1e71c3462ecf144ca800d3f434f0764"},
149 | {file = "lxml-5.1.0-cp37-cp37m-win32.whl", hash = "sha256:d42e3a3fc18acc88b838efded0e6ec3edf3e328a58c68fbd36a7263a874906c8"},
150 | {file = "lxml-5.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:eac68f96539b32fce2c9b47eb7c25bb2582bdaf1bbb360d25f564ee9e04c542b"},
151 | {file = "lxml-5.1.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:ae15347a88cf8af0949a9872b57a320d2605ae069bcdf047677318bc0bba45b1"},
152 | {file = "lxml-5.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:c26aab6ea9c54d3bed716b8851c8bfc40cb249b8e9880e250d1eddde9f709bf5"},
153 | {file = "lxml-5.1.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:342e95bddec3a698ac24378d61996b3ee5ba9acfeb253986002ac53c9a5f6f84"},
154 | {file = "lxml-5.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:725e171e0b99a66ec8605ac77fa12239dbe061482ac854d25720e2294652eeaa"},
155 | {file = "lxml-5.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d184e0d5c918cff04cdde9dbdf9600e960161d773666958c9d7b565ccc60c45"},
156 | {file = "lxml-5.1.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:98f3f020a2b736566c707c8e034945c02aa94e124c24f77ca097c446f81b01f1"},
157 | {file = "lxml-5.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6d48fc57e7c1e3df57be5ae8614bab6d4e7b60f65c5457915c26892c41afc59e"},
158 | {file = "lxml-5.1.0-cp38-cp38-win32.whl", hash = "sha256:7ec465e6549ed97e9f1e5ed51c657c9ede767bc1c11552f7f4d022c4df4a977a"},
159 | {file = "lxml-5.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:b21b4031b53d25b0858d4e124f2f9131ffc1530431c6d1321805c90da78388d1"},
160 | {file = "lxml-5.1.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:52427a7eadc98f9e62cb1368a5079ae826f94f05755d2d567d93ee1bc3ceb354"},
161 | {file = "lxml-5.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6a2a2c724d97c1eb8cf966b16ca2915566a4904b9aad2ed9a09c748ffe14f969"},
162 | {file = "lxml-5.1.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:843b9c835580d52828d8f69ea4302537337a21e6b4f1ec711a52241ba4a824f3"},
163 | {file = "lxml-5.1.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9b99f564659cfa704a2dd82d0684207b1aadf7d02d33e54845f9fc78e06b7581"},
164 | {file = "lxml-5.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4f8b0c78e7aac24979ef09b7f50da871c2de2def043d468c4b41f512d831e912"},
165 | {file = "lxml-5.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9bcf86dfc8ff3e992fed847c077bd875d9e0ba2fa25d859c3a0f0f76f07f0c8d"},
166 | {file = "lxml-5.1.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:49a9b4af45e8b925e1cd6f3b15bbba2c81e7dba6dce170c677c9cda547411e14"},
167 | {file = "lxml-5.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:280f3edf15c2a967d923bcfb1f8f15337ad36f93525828b40a0f9d6c2ad24890"},
168 | {file = "lxml-5.1.0-cp39-cp39-win32.whl", hash = "sha256:ed7326563024b6e91fef6b6c7a1a2ff0a71b97793ac33dbbcf38f6005e51ff6e"},
169 | {file = "lxml-5.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:8d7b4beebb178e9183138f552238f7e6613162a42164233e2bda00cb3afac58f"},
170 | {file = "lxml-5.1.0-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:9bd0ae7cc2b85320abd5e0abad5ccee5564ed5f0cc90245d2f9a8ef330a8deae"},
171 | {file = "lxml-5.1.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d8c1d679df4361408b628f42b26a5d62bd3e9ba7f0c0e7969f925021554755aa"},
172 | {file = "lxml-5.1.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:2ad3a8ce9e8a767131061a22cd28fdffa3cd2dc193f399ff7b81777f3520e372"},
173 | {file = "lxml-5.1.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl", hash = "sha256:304128394c9c22b6569eba2a6d98392b56fbdfbad58f83ea702530be80d0f9df"},
174 | {file = "lxml-5.1.0-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d74fcaf87132ffc0447b3c685a9f862ffb5b43e70ea6beec2fb8057d5d2a1fea"},
175 | {file = "lxml-5.1.0-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:8cf5877f7ed384dabfdcc37922c3191bf27e55b498fecece9fd5c2c7aaa34c33"},
176 | {file = "lxml-5.1.0-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:877efb968c3d7eb2dad540b6cabf2f1d3c0fbf4b2d309a3c141f79c7e0061324"},
177 | {file = "lxml-5.1.0-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3f14a4fb1c1c402a22e6a341a24c1341b4a3def81b41cd354386dcb795f83897"},
178 | {file = "lxml-5.1.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:25663d6e99659544ee8fe1b89b1a8c0aaa5e34b103fab124b17fa958c4a324a6"},
179 | {file = "lxml-5.1.0-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:8b9f19df998761babaa7f09e6bc169294eefafd6149aaa272081cbddc7ba4ca3"},
180 | {file = "lxml-5.1.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5e53d7e6a98b64fe54775d23a7c669763451340c3d44ad5e3a3b48a1efbdc96f"},
181 | {file = "lxml-5.1.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:c3cd1fc1dc7c376c54440aeaaa0dcc803d2126732ff5c6b68ccd619f2e64be4f"},
182 | {file = "lxml-5.1.0.tar.gz", hash = "sha256:3eea6ed6e6c918e468e693c41ef07f3c3acc310b70ddd9cc72d9ef84bc9564ca"},
183 | ]
184 |
185 | [package.extras]
186 | cssselect = ["cssselect (>=0.7)"]
187 | html5 = ["html5lib"]
188 | htmlsoup = ["BeautifulSoup4"]
189 | source = ["Cython (>=3.0.7)"]
190 |
191 | [[package]]
192 | name = "packaging"
193 | version = "23.2"
194 | description = "Core utilities for Python packages"
195 | optional = false
196 | python-versions = ">=3.7"
197 | files = [
198 | {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"},
199 | {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"},
200 | ]
201 |
202 | [[package]]
203 | name = "pluggy"
204 | version = "1.4.0"
205 | description = "plugin and hook calling mechanisms for python"
206 | optional = false
207 | python-versions = ">=3.8"
208 | files = [
209 | {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"},
210 | {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"},
211 | ]
212 |
213 | [package.extras]
214 | dev = ["pre-commit", "tox"]
215 | testing = ["pytest", "pytest-benchmark"]
216 |
217 | [[package]]
218 | name = "pygls"
219 | version = "1.3.0"
220 | description = "A pythonic generic language server (pronounced like 'pie glass')"
221 | optional = false
222 | python-versions = ">=3.8"
223 | files = [
224 | {file = "pygls-1.3.0-py3-none-any.whl", hash = "sha256:d4a01414b6ed4e34e7e8fd29b77d3e88c29615df7d0bbff49bf019e15ec04b8f"},
225 | {file = "pygls-1.3.0.tar.gz", hash = "sha256:1b44ace89c9382437a717534f490eadc6fda7c0c6c16ac1eaaf5568e345e4fb8"},
226 | ]
227 |
228 | [package.dependencies]
229 | cattrs = ">=23.1.2"
230 | lsprotocol = "2023.0.1"
231 |
232 | [package.extras]
233 | ws = ["websockets (>=11.0.3)"]
234 |
235 | [[package]]
236 | name = "pytest"
237 | version = "7.4.4"
238 | description = "pytest: simple powerful testing with Python"
239 | optional = false
240 | python-versions = ">=3.7"
241 | files = [
242 | {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"},
243 | {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"},
244 | ]
245 |
246 | [package.dependencies]
247 | colorama = {version = "*", markers = "sys_platform == \"win32\""}
248 | exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
249 | iniconfig = "*"
250 | packaging = "*"
251 | pluggy = ">=0.12,<2.0"
252 | tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
253 |
254 | [package.extras]
255 | testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
256 |
257 | [[package]]
258 | name = "tomli"
259 | version = "2.0.1"
260 | description = "A lil' TOML parser"
261 | optional = false
262 | python-versions = ">=3.7"
263 | files = [
264 | {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
265 | {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
266 | ]
267 |
268 | [[package]]
269 | name = "typing-extensions"
270 | version = "4.10.0"
271 | description = "Backported and Experimental Type Hints for Python 3.8+"
272 | optional = false
273 | python-versions = ">=3.8"
274 | files = [
275 | {file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"},
276 | {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"},
277 | ]
278 |
279 | [metadata]
280 | lock-version = "2.0"
281 | python-versions = "^3.9"
282 | content-hash = "914d80fe2a2899200cd66650ff1f3e1125ff1065a38aaa0a3262f9b255cda15d"
283 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.poetry]
2 | name = 'systemd-language-server'
3 | version = '0.3.5'
4 | description = 'Language server for systemd unit files'
5 | authors = ["Paweł Sacawa "]
6 | readme = "README.md"
7 | packages = [{ include = "systemd_language_server" }]
8 | scripts = { "systemd-language-server" = "systemd_language_server.server:main" }
9 | keywords = ['systemd', 'language', 'server', 'lsp', 'completion']
10 | license = "GPL3.0"
11 | classifiers = [
12 | "Development Status :: 3 - Alpha",
13 | "Environment :: Console",
14 | "Intended Audience :: Developers",
15 | "Operating System :: OS Independent",
16 | "Topic :: Software Development",
17 | "Topic :: Text Editors :: Integrated Development Environments (IDE)",
18 | "Topic :: Utilities",
19 | ]
20 |
21 | repository = "https://github.com/psacawa/systemd-language-server"
22 |
23 |
24 | [tool.poetry.dependencies]
25 | pygls = "^1.3"
26 | python = "^3.9"
27 | lxml = "^5.0.0"
28 |
29 | [tool.poetry.dev-dependencies]
30 | pytest = "^7"
31 |
32 | [tool.isort]
33 | profile = "black"
34 |
35 | [build-system]
36 | requires = ["poetry-core"]
37 | build-backend = "poetry.core.masonry.api"
38 |
--------------------------------------------------------------------------------
/systemd_language_server/__init__.py:
--------------------------------------------------------------------------------
1 | __version__ = "0.3.5"
2 | __all__ = ["__version__"]
3 |
--------------------------------------------------------------------------------
/systemd_language_server/assets/systemd.automount.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | systemd.automount
9 | systemd
10 |
11 |
12 |
13 | systemd.automount
14 | 5
15 |
16 |
17 |
18 | systemd.automount
19 | Automount unit configuration
20 |
21 |
22 |
23 | automount.automount
24 |
25 |
26 |
27 | Description
28 |
29 | A unit configuration file whose name ends in .automount encodes information
30 | about a file system automount point controlled and supervised by systemd. Automount units may be used to
31 | implement on-demand mounting as well as parallelized mounting of file systems.
32 |
33 | This man page lists the configuration options specific to
34 | this unit type. See
35 | systemd.unit5
36 | for the common options of all unit configuration files. The common
37 | configuration items are configured in the generic [Unit] and
38 | [Install] sections. The automount specific configuration options
39 | are configured in the [Automount] section.
40 |
41 | Automount units must be named after the automount directories they control. Example: the automount
42 | point /home/lennart must be configured in a unit file
43 | home-lennart.automount. For details about the escaping logic used to convert a file
44 | system path to a unit name see
45 | systemd.unit5. Note
46 | that automount units cannot be templated, nor is it possible to add multiple names to an automount unit
47 | by creating symlinks to its unit file.
48 |
49 | For each automount unit file a matching mount unit file (see
50 | systemd.mount5
51 | for details) must exist which is activated when the automount path
52 | is accessed. Example: if an automount unit
53 | home-lennart.automount is active and the user
54 | accesses /home/lennart the mount unit
55 | home-lennart.mount will be activated.
56 |
57 | Note that automount units are separate from the mount itself, so you
58 | should not set After= or Requires=
59 | for mount dependencies here. For example, you should not set
60 | After=network-online.target or similar on network
61 | filesystems. Doing so may result in an ordering cycle.
62 |
63 | Note that automount support on Linux is privileged, automount units are hence only available in the
64 | system service manager (and root's user service manager), but not in unprivileged users' service
65 | managers.
66 |
67 | Note that automount units should not be nested. (The establishment of the inner automount point
68 | would unconditionally pin the outer mount point, defeating its purpose.)
69 |
70 |
71 |
72 | Automatic Dependencies
73 |
74 |
75 | Implicit Dependencies
76 |
77 | The following dependencies are implicitly added:
78 |
79 |
80 | If an automount unit is beneath another mount unit in the file system hierarchy, a
81 | requirement and ordering dependencies are created to the on the unit higher in the hierarchy.
82 |
83 |
84 | An implicit Before= dependency is created between an automount
85 | unit and the mount unit it activates.
86 |
87 |
88 |
89 |
90 | Default Dependencies
91 |
92 | The following dependencies are added unless DefaultDependencies=no is set:
93 |
94 |
95 | Automount units acquire automatic Before= and
96 | Conflicts= on umount.target in order to be stopped during
97 | shutdown.
98 |
99 | Automount units automatically gain an After= dependency
100 | on local-fs-pre.target, and a Before= dependency on
101 | local-fs.target.
102 |
103 |
104 |
105 |
106 |
107 | fstab
108 |
109 | Automount units may either be configured via unit files, or
110 | via /etc/fstab (see
111 | fstab5
112 | for details).
113 |
114 | For details how systemd parses
115 | /etc/fstab see
116 | systemd.mount5.
117 |
118 | If an automount point is configured in both
119 | /etc/fstab and a unit file, the configuration
120 | in the latter takes precedence.
121 |
122 |
123 |
124 | Options
125 |
126 | Automount unit files may include [Unit] and [Install] sections, which are described in
127 | systemd.unit5.
128 |
129 |
130 | Automount unit files must include an [Automount] section, which
131 | carries information about the file system automount points it
132 | supervises. The options specific to the [Automount] section of
133 | automount units are the following:
134 |
135 |
136 |
137 |
138 | Where=
139 | Takes an absolute path of a directory of the
140 | automount point. If the automount point does not exist at time
141 | that the automount point is installed, it is created. This
142 | string must be reflected in the unit filename. (See above.)
143 | This option is mandatory.
144 |
145 |
146 |
147 | ExtraOptions=
148 | Extra mount options to use when creating the autofs
149 | mountpoint. This takes a comma-separated list of options. This setting
150 | is optional. Note that the usual specifier expansion is applied to this
151 | setting, literal percent characters should hence be written as
152 | %%.
153 |
154 |
155 |
156 |
157 |
158 | DirectoryMode=
159 | Directories of automount points (and any
160 | parent directories) are automatically created if needed. This
161 | option specifies the file system access mode used when
162 | creating these directories. Takes an access mode in octal
163 | notation. Defaults to 0755.
164 |
165 |
166 |
167 | TimeoutIdleSec=
168 | Configures an idle timeout. Once the mount has been
169 | idle for the specified time, systemd will attempt to unmount. Takes a
170 | unit-less value in seconds, or a time span value such as "5min 20s".
171 | Pass 0 to disable the timeout logic. The timeout is disabled by
172 | default.
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 | See Also
183 |
184 | systemd1
185 | systemctl1
186 | systemd.unit5
187 | systemd.mount5
188 | mount8
189 | automount8
190 | systemd.directives7
191 |
192 |
193 |
194 |
195 |
--------------------------------------------------------------------------------
/systemd_language_server/assets/systemd.kill.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | systemd.kill
9 | systemd
10 |
11 |
12 |
13 | systemd.kill
14 | 5
15 |
16 |
17 |
18 | systemd.kill
19 | Process killing procedure
20 | configuration
21 |
22 |
23 |
24 | service.service,
25 | socket.socket,
26 | mount.mount,
27 | swap.swap,
28 | scope.scope
29 |
30 |
31 |
32 | Description
33 |
34 | Unit configuration files for services, sockets, mount
35 | points, swap devices and scopes share a subset of configuration
36 | options which define the killing procedure of processes belonging
37 | to the unit.
38 |
39 | This man page lists the configuration options shared by
40 | these five unit types. See
41 | systemd.unit5
42 | for the common options shared by all unit configuration files, and
43 | systemd.service5,
44 | systemd.socket5,
45 | systemd.swap5,
46 | systemd.mount5
47 | and
48 | systemd.scope5
49 | for more information on the configuration file options specific to
50 | each unit type.
51 |
52 | The kill procedure configuration options are configured in
53 | the [Service], [Socket], [Mount] or [Swap] section, depending on
54 | the unit type.
55 |
56 |
57 |
58 | Options
59 |
60 |
61 |
62 |
63 | KillMode=
64 | Specifies how processes of this unit shall be killed. One of
65 | , , ,
66 | .
67 |
68 | If set to , all remaining processes in the control group of this
69 | unit will be killed on unit stop (for services: after the stop command is executed, as configured
70 | with ExecStop=). If set to , the
71 | SIGTERM signal (see below) is sent to the main process while the subsequent
72 | SIGKILL signal (see below) is sent to all remaining processes of the unit's
73 | control group. If set to , only the main process itself is killed (not
74 | recommended!). If set to , no process is killed (strongly recommended
75 | against!). In this case, only the stop command will be executed on unit stop, but no process will be
76 | killed otherwise. Processes remaining alive after stop are left in their control group and the
77 | control group continues to exist after stop unless empty.
78 |
79 | Note that it is not recommended to set KillMode= to
80 | process or even none, as this allows processes to escape
81 | the service manager's lifecycle and resource management, and to remain running even while their
82 | service is considered stopped and is assumed to not consume any resources.
83 |
84 | Processes will first be terminated via SIGTERM (unless the signal to send
85 | is changed via KillSignal= or RestartKillSignal=). Optionally,
86 | this is immediately followed by a SIGHUP (if enabled with
87 | SendSIGHUP=). If processes still remain after:
88 |
89 | the main process of a unit has exited (applies to KillMode=:
90 | )
91 | the delay configured via the TimeoutStopSec= has passed
92 | (applies to KillMode=: , ,
93 | )
94 |
95 |
96 | the termination request is repeated with the SIGKILL signal or the signal specified via
97 | FinalKillSignal= (unless this is disabled via the SendSIGKILL=
98 | option). See kill2
99 | for more information.
100 |
101 | Defaults to .
102 |
103 |
104 |
105 |
106 |
107 | KillSignal=
108 | Specifies which signal to use when stopping a service. This controls the signal that
109 | is sent as first step of shutting down a unit (see above), and is usually followed by
110 | SIGKILL (see above and below). For a list of valid signals, see
111 | signal7.
112 | Defaults to SIGTERM.
113 |
114 | Note that, right after sending the signal specified in this setting, systemd will always send
115 | SIGCONT, to ensure that even suspended tasks can be terminated cleanly.
116 |
117 |
118 |
119 |
120 |
121 |
122 | RestartKillSignal=
123 | Specifies which signal to use when restarting a service. The same as
124 | KillSignal= described above, with the exception that this setting is used in a
125 | restart job. Not set by default, and the value of KillSignal= is used.
126 |
127 |
128 |
129 |
130 |
131 |
132 | SendSIGHUP=
133 | Specifies whether to send
134 | SIGHUP to remaining processes immediately
135 | after sending the signal configured with
136 | KillSignal=. This is useful to indicate to
137 | shells and shell-like programs that their connection has been
138 | severed. Takes a boolean value. Defaults to no.
139 |
140 |
141 |
142 |
143 |
144 |
145 | SendSIGKILL=
146 | Specifies whether to send
147 | SIGKILL (or the signal specified by
148 | FinalKillSignal=) to remaining processes
149 | after a timeout, if the normal shutdown procedure left
150 | processes of the service around. When disabled, a
151 | KillMode= of control-group
152 | or mixed service will not restart if
153 | processes from prior services exist within the control group.
154 | Takes a boolean value. Defaults to yes.
155 |
156 |
157 |
158 |
159 |
160 |
161 | FinalKillSignal=
162 | Specifies which signal to send to remaining
163 | processes after a timeout if SendSIGKILL=
164 | is enabled. The signal configured here should be one that is
165 | not typically caught and processed by services (SIGTERM
166 | is not suitable). Developers can find it useful to use this to
167 | generate a coredump to troubleshoot why a service did not
168 | terminate upon receiving the initial SIGTERM
169 | signal. This can be achieved by configuring LimitCORE=
170 | and setting FinalKillSignal= to either
171 | SIGQUIT or SIGABRT.
172 | Defaults to SIGKILL.
173 |
174 |
175 |
176 |
177 |
178 |
179 | WatchdogSignal=
180 | Specifies which signal to use to terminate the
181 | service when the watchdog timeout expires (enabled through
182 | WatchdogSec=). Defaults to SIGABRT.
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 | See Also
193 |
194 | systemd1
195 | systemctl1
196 | journalctl1
197 | systemd.unit5
198 | systemd.service5
199 | systemd.socket5
200 | systemd.swap5
201 | systemd.mount5
202 | systemd.exec5
203 | systemd.directives7
204 | kill2
205 | signal7
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/systemd_language_server/assets/systemd.mount.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | systemd.mount
9 | systemd
10 |
11 |
12 |
13 | systemd.mount
14 | 5
15 |
16 |
17 |
18 | systemd.mount
19 | Mount unit configuration
20 |
21 |
22 |
23 | mount.mount
24 |
25 |
26 |
27 | Description
28 |
29 | A unit configuration file whose name ends in
30 | .mount encodes information about a file system
31 | mount point controlled and supervised by systemd.
32 |
33 | This man page lists the configuration options specific to
34 | this unit type. See
35 | systemd.unit5
36 | for the common options of all unit configuration files. The common
37 | configuration items are configured in the generic [Unit] and
38 | [Install] sections. The mount specific configuration options are
39 | configured in the [Mount] section.
40 |
41 | Additional options are listed in
42 | systemd.exec5,
43 | which define the execution environment the
44 | mount8
45 | program is executed in, and in
46 | systemd.kill5,
47 | which define the way the processes are terminated, and in
48 | systemd.resource-control5,
49 | which configure resource control settings for the processes of the
50 | service.
51 |
52 | Note that the options User= and
53 | Group= are not useful for mount units.
54 | systemd passes two parameters to
55 | mount8;
56 | the values of What= and Where=.
57 | When invoked in this way,
58 | mount8
59 | does not read any options from /etc/fstab, and
60 | must be run as UID 0.
61 |
62 | Mount units must be named after the mount point directories they control. Example: the mount point
63 | /home/lennart must be configured in a unit file
64 | home-lennart.mount. For details about the escaping logic used to convert a file
65 | system path to a unit name, see
66 | systemd.unit5. Note
67 | that mount units cannot be templated, nor is possible to add multiple names to a mount unit by creating
68 | symlinks to its unit file.
69 |
70 | Optionally, a mount unit may be accompanied by an automount
71 | unit, to allow on-demand or parallelized mounting. See
72 | systemd.automount5.
73 |
74 | Mount points created at runtime (independently of unit files
75 | or /etc/fstab) will be monitored by systemd
76 | and appear like any other mount unit in systemd. See
77 | /proc/self/mountinfo description in
78 | proc5.
79 |
80 |
81 | Some file systems have special semantics as API file systems
82 | for kernel-to-userspace and userspace-to-userspace interfaces. Some
83 | of them may not be changed via mount units, and cannot be
84 | disabled. For a longer discussion see API
86 | File Systems.
87 |
88 | The
89 | systemd-mount1 command
90 | allows creating .mount and .automount units dynamically and
91 | transiently from the command line.
92 |
93 |
94 |
95 | Automatic Dependencies
96 |
97 |
98 | Implicit Dependencies
99 |
100 | The following dependencies are implicitly added:
101 |
102 |
103 | If a mount unit is beneath another mount unit in the file
104 | system hierarchy, both a requirement dependency and an ordering
105 | dependency between both units are created automatically.
106 |
107 | Block device backed file systems automatically gain Requires=,
108 | StopPropagatedFrom=, and After= type dependencies on the
109 | device unit encapsulating the block device (see x-systemd.device-bound= for details).
110 |
111 |
112 | If traditional file system quota is enabled for a mount unit, automatic
113 | Wants= and Before= dependencies on
114 | systemd-quotacheck.service and quotaon.service
115 | are added.
116 |
117 | Additional implicit dependencies may be added as result of execution and
118 | resource control parameters as documented in
119 | systemd.exec5
120 | and
121 | systemd.resource-control5.
122 |
123 |
124 |
125 |
126 |
127 | Default Dependencies
128 |
129 | The following dependencies are added unless DefaultDependencies=no is set:
130 |
131 |
132 | All mount units acquire automatic Before= and Conflicts= on
133 | umount.target in order to be stopped during shutdown.
134 |
135 | Mount units referring to local file systems automatically gain
136 | an After= dependency on local-fs-pre.target, and a
137 | Before= dependency on local-fs.target unless one or more
138 | mount options among , ,
139 | and is set. See below for detailed information.
140 |
141 | Additionally, an After= dependency on swap.target
142 | is added when the file system type is tmpfs.
143 |
144 |
145 | Network mount units automatically acquire After= dependencies on
146 | remote-fs-pre.target, network.target,
147 | plus After= and Wants= dependencies on network-online.target,
148 | and a Before= dependency on remote-fs.target, unless
149 | one or more mount options among , ,
150 | and is set.
151 |
152 |
153 | Mount units referring to local and network file systems are distinguished by their file system type
154 | specification. In some cases this is not sufficient (for example network block device based mounts, such as
155 | iSCSI), in which case may be added to the mount option string of the unit, which forces
156 | systemd to consider the mount unit a network mount.
157 |
158 |
159 |
160 |
161 | fstab
162 |
163 | Mount units may either be configured via unit files, or via /etc/fstab (see
164 | fstab5
165 | for details). Mounts listed in /etc/fstab will be converted into native units
166 | dynamically at boot and when the configuration of the system manager is reloaded. In general, configuring
167 | mount points through /etc/fstab is the preferred approach to manage mounts for
168 | humans. For tooling, writing mount units should be preferred over editing /etc/fstab.
169 | See systemd-fstab-generator8
170 | for details about the conversion from /etc/fstab to mount units.
171 |
172 | The NFS mount option for NFS background mounts
173 | as documented in nfs5
174 | is detected by systemd-fstab-generator and the options
175 | are transformed so that systemd fulfills the job-control implications of
176 | that option. Specifically systemd-fstab-generator acts
177 | as though x-systemd.mount-timeout=infinity,retry=10000 was
178 | prepended to the option list, and fg,nofail was appended.
179 | Depending on specific requirements, it may be appropriate to provide some of
180 | these options explicitly, or to make use of the
181 | x-systemd.automount option described below instead
182 | of using bg.
183 |
184 | When reading /etc/fstab a few special
185 | mount options are understood by systemd which influence how
186 | dependencies are created for mount points. systemd will create a
187 | dependency of type Wants= or
188 | (see option
189 | below), from either local-fs.target or
190 | remote-fs.target, depending whether the file
191 | system is local or remote.
192 |
193 |
194 |
195 |
196 |
197 |
198 | Configures a Requires= and
199 | an After= dependency between the created
200 | mount unit and another systemd unit, such as a device or mount
201 | unit. The argument should be a unit name, or an absolute path
202 | to a device node or mount point. This option may be specified
203 | more than once. This option is particularly useful for mount
204 | point declarations that need an additional device to be around
205 | (such as an external journal device for journal file systems)
206 | or an additional mount to be in place (such as an overlay file
207 | system that merges multiple mount points). See
208 | After= and Requires= in
209 | systemd.unit5
210 | for details.
211 |
212 | Note that this option always applies to the created mount unit
213 | only regardless whether has been
214 | specified.
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 | In the created mount unit, configures a
224 | Before= or After=
225 | dependency on another systemd unit, such as a mount unit.
226 | The argument should be a unit name or an absolute path
227 | to a mount point. This option may be specified more than once.
228 | This option is particularly useful for mount point declarations
229 | with option that are mounted
230 | asynchronously but need to be mounted before or after some unit
231 | start, for example, before local-fs.target
232 | unit.
233 | See Before= and After= in
234 | systemd.unit5
235 | for details.
236 |
237 | Note that these options always apply to the created mount unit
238 | only regardless whether has been
239 | specified.
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 | In the created mount unit, configures a WantedBy= or
249 | RequiredBy= dependency on another unit. This option may be specified more than once.
250 | If this is specified, the default dependencies (see above) other than umount.target
251 | on the created mount unit, e.g. local-fs.target, are not automatically created.
252 | Hence it is likely that some ordering dependencies need to be set up manually through
253 | and . See WantedBy=
254 | and RequiredBy= in
255 | systemd.unit5
256 | for details.
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 | Configures a
266 | RequiresMountsFor= or WantsMountsFor=
267 | dependency between the created mount unit and other mount units. The
268 | argument must be an absolute path. This option may be specified more than
269 | once. See RequiresMountsFor= or WantsMountsFor= in
270 | systemd.unit5
271 | for details.
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 | Takes a boolean argument. If true or no argument, a BindsTo= dependency
280 | on the backing device is set. If false, the mount unit is not stopped no matter whether the backing device
281 | is still present. This is useful when the file system is backed by volume managers. If not set, and the mount
282 | comes from unit fragments, i.e. generated from /etc/fstab by
283 | systemd-fstab-generator8 or loaded from
284 | a manually configured mount unit, a combination of Requires= and StopPropagatedFrom=
285 | dependencies is set on the backing device. If doesn't, only Requires= is used.
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 | An automount unit will be created for the file
294 | system. See
295 | systemd.automount5
296 | for details.
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 | Configures the idle timeout of the
305 | automount unit. See TimeoutIdleSec= in
306 | systemd.automount5
307 | for details.
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 | Configure how long systemd should wait for a
316 | device to show up before giving up on an entry from
317 | /etc/fstab. Specify a time in seconds or
318 | explicitly append a unit such as s,
319 | min, h,
320 | ms.
321 |
322 | Note that this option can only be used in
323 | /etc/fstab, and will be
324 | ignored when part of the Options=
325 | setting in a unit file.
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 | Configure how long systemd should wait for the
335 | mount command to finish before giving up on an entry from
336 | /etc/fstab. Specify a time in seconds or
337 | explicitly append a unit such as s,
338 | min, h,
339 | ms.
340 |
341 | Note that this option can only be used in
342 | /etc/fstab, and will be
343 | ignored when part of the Options=
344 | setting in a unit file.
345 |
346 | See TimeoutSec= below for
347 | details.
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 | The file system will be initialized
357 | on the device. If the device is not "empty", i.e. it contains any signature,
358 | the operation will be skipped. It is hence expected that this option
359 | remains set even after the device has been initialized.
360 |
361 | Note that this option can only be used in
362 | /etc/fstab, and will be ignored when part of the
363 | Options= setting in a unit file.
364 |
365 | See
366 | systemd-makefs@.service8.
367 |
368 |
369 | wipefs8
370 | may be used to remove any signatures from a block device to force
371 | to reinitialize the device.
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 | The file system will be grown to occupy the full block
381 | device. If the file system is already at maximum size, no action will
382 | be performed. It is hence expected that this option remains set even after
383 | the file system has been grown. Only certain file system types are supported,
384 | see
385 | systemd-makefs@.service8
386 | for details.
387 |
388 | Note that this option can only be used in
389 | /etc/fstab, and will be ignored when part of the
390 | Options= setting in a unit file.
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 | Measures file system identity information (mount point, type, label, UUID, partition
399 | label, partition UUID) into PCR 15 after the file system has been mounted. This ensures the
400 | systemd-pcrfs@.service8
401 | or systemd-pcrfs-root.service services are pulled in by the mount unit.
402 |
403 | Note that this option can only be used in /etc/fstab, and will be ignored
404 | when part of the Options= setting in a unit file. It is also implied for the root
405 | and /usr/ partitions discovered by
406 | systemd-gpt-auto-generator8.
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 | If a mount operation fails to mount the file system
415 | read-write, it normally tries mounting the file system read-only instead.
416 | This option disables that behaviour, and causes the mount to fail
417 | immediately instead. This option is translated into the
418 | ReadWriteOnly= setting in a unit file.
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 | Normally the file system type is used to determine if a
428 | mount is a "network mount", i.e. if it should only be started after the
429 | network is available. Using this option overrides this detection and
430 | specifies that the mount requires network.
431 |
432 | Network mount units are ordered between remote-fs-pre.target
433 | and remote-fs.target, instead of
434 | local-fs-pre.target and local-fs.target.
435 | They also pull in network-online.target and are ordered after
436 | it and network.target.
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 | With , the mount unit will not be added as a dependency for
447 | local-fs.target or remote-fs.target. This means that it
448 | will not be mounted automatically during boot, unless it is pulled in by some other unit. The
449 | option has the opposite meaning and is the default.
450 |
451 | Note that if (see above) is used, neither
452 | nor have any effect. The matching automount unit will
453 | be added as a dependency to the appropriate target.
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 | With , this mount will be only wanted, not required, by
463 | local-fs.target or remote-fs.target. Moreover the mount unit is not
464 | ordered before these target units. This means that the boot will continue without waiting for the mount unit
465 | and regardless whether the mount point can be mounted successfully.
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 | An additional filesystem to be mounted in the initrd. See
475 | initrd-fs.target description in
476 | systemd.special7. This
477 | is both an indicator to the initrd to mount this partition early and an indicator to the host to
478 | leave the partition mounted until final shutdown. Or in other words, if this flag is set it is
479 | assumed the mount shall be active during the entire regular runtime of the system, i.e. established
480 | before the initrd transitions into the host all the way until the host transitions to the final
481 | shutdown phase.
482 |
483 |
484 |
485 |
486 |
487 | If a mount point is configured in both
488 | /etc/fstab and a unit file that is stored
489 | below /usr/, the former will take precedence.
490 | If the unit file is stored below /etc/, it
491 | will take precedence. This means: native unit files take
492 | precedence over traditional configuration files, but this is
493 | superseded by the rule that configuration in
494 | /etc/ will always take precedence over
495 | configuration in /usr/.
496 |
497 |
498 |
499 | Options
500 |
501 | Mount unit files may include [Unit] and [Install] sections, which are described in
502 | systemd.unit5.
503 |
504 |
505 | Mount unit files must include a [Mount] section, which carries
506 | information about the file system mount points it supervises. A
507 | number of options that may be used in this section are shared with
508 | other unit types. These options are documented in
509 | systemd.exec5
510 | and
511 | systemd.kill5.
512 | The options specific to the [Mount] section of mount units are the
513 | following:
514 |
515 |
516 |
517 |
518 | What=
519 | Takes an absolute path or a fstab-style identifier of a device node, file or
520 | other resource to mount. See mount8 for
522 | details. If this refers to a device node, a dependency on the respective device unit is automatically
523 | created. (See
524 | systemd.device5
525 | for more information.) This option is mandatory. Note that the usual specifier expansion is applied
526 | to this setting, literal percent characters should hence be written as %%. If this mount is a bind mount and the specified path does not exist
528 | yet it is created as directory.
529 |
530 |
531 |
532 | Where=
533 | Takes an absolute path of a file or directory for the mount point; in particular, the
534 | destination cannot be a symbolic link. If the mount point does not exist at the time of mounting, it
535 | is created as either a directory or a file. The former is the usual case; the latter is done only if this mount
536 | is a bind mount and the source (What=) is not a directory.
537 | This string must be reflected in the unit filename. (See above.) This option
538 | is mandatory.
539 |
540 |
541 |
542 | Type=
543 | Takes a string for the file system type. See
544 | mount8
545 | for details. This setting is optional.
546 |
547 | If the type is overlay, and upperdir= or
548 | workdir= are specified as options and they don't exist, they will be created.
549 |
550 |
551 |
552 |
553 | Options=
554 |
555 | Mount options to use when mounting. This takes a comma-separated list of options. This setting
556 | is optional. Note that the usual specifier expansion is applied to this setting, literal percent characters
557 | should hence be written as %%.
558 |
559 |
560 |
561 | SloppyOptions=
562 |
563 | Takes a boolean argument. If true, parsing of
564 | the options specified in Options= is
565 | relaxed, and unknown mount options are tolerated. This
566 | corresponds with
567 | mount8's
568 | -s switch. Defaults to
569 | off.
570 |
571 |
572 |
573 |
574 |
575 | LazyUnmount=
576 |
577 | Takes a boolean argument. If true, detach the
578 | filesystem from the filesystem hierarchy at time of the unmount
579 | operation, and clean up all references to the filesystem as
580 | soon as they are not busy anymore.
581 | This corresponds with
582 | umount8's
583 | -l switch. Defaults to
584 | off.
585 |
586 |
587 |
588 |
589 |
590 | ReadWriteOnly=
591 |
592 | Takes a boolean argument. If false, a mount
593 | point that shall be mounted read-write but cannot be mounted
594 | so is retried to be mounted read-only. If true the operation
595 | will fail immediately after the read-write mount attempt did
596 | not succeed. This corresponds with
597 | mount8's
598 | -w switch. Defaults to
599 | off.
600 |
601 |
602 |
603 |
604 |
605 | ForceUnmount=
606 |
607 | Takes a boolean argument. If true, force an
608 | unmount (in case of an unreachable NFS system).
609 | This corresponds with
610 | umount8's
611 | -f switch. Defaults to
612 | off.
613 |
614 |
615 |
616 |
617 |
618 | DirectoryMode=
619 | Directories of mount points (and any parent
620 | directories) are automatically created if needed. This option
621 | specifies the file system access mode used when creating these
622 | directories. Takes an access mode in octal notation. Defaults
623 | to 0755.
624 |
625 |
626 |
627 | TimeoutSec=
628 | Configures the time to wait for the mount
629 | command to finish. If a command does not exit within the
630 | configured time, the mount will be considered failed and be
631 | shut down again. All commands still running will be terminated
632 | forcibly via SIGTERM, and after another
633 | delay of this time with SIGKILL. (See
634 | in
635 | systemd.kill5.)
636 | Takes a unit-less value in seconds, or a time span value such
637 | as "5min 20s". Pass 0 to disable the timeout logic. The
638 | default value is set from DefaultTimeoutStartSec= option in
639 | systemd-system.conf5.
640 |
641 |
642 |
643 |
644 |
645 |
646 |
647 |
648 | See Also
649 |
650 | systemd1
651 | systemctl1
652 | systemd-system.conf5
653 | systemd.unit5
654 | systemd.exec5
655 | systemd.kill5
656 | systemd.resource-control5
657 | systemd.service5
658 | systemd.device5
659 | proc5
660 | mount8
661 | systemd-fstab-generator8
662 | systemd.directives7
663 | systemd-mount1
664 |
665 |
666 |
667 |
668 |
--------------------------------------------------------------------------------
/systemd_language_server/assets/systemd.path.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | systemd.path
9 | systemd
10 |
11 |
12 |
13 | systemd.path
14 | 5
15 |
16 |
17 |
18 | systemd.path
19 | Path unit configuration
20 |
21 |
22 |
23 | path.path
24 |
25 |
26 |
27 | Description
28 |
29 | A unit configuration file whose name ends in
30 | .path encodes information about a path
31 | monitored by systemd, for path-based activation.
32 |
33 | This man page lists the configuration options specific to
34 | this unit type. See
35 | systemd.unit5
36 | for the common options of all unit configuration files. The common
37 | configuration items are configured in the generic [Unit] and
38 | [Install] sections. The path specific configuration options are
39 | configured in the [Path] section.
40 |
41 | For each path file, a matching unit file must exist,
42 | describing the unit to activate when the path changes. By default,
43 | a service by the same name as the path (except for the suffix) is
44 | activated. Example: a path file foo.path
45 | activates a matching service foo.service. The
46 | unit to activate may be controlled by Unit=
47 | (see below).
48 |
49 | Internally, path units use the
50 | inotify7
51 | API to monitor file systems. Due to that, it suffers by the same
52 | limitations as inotify, and for example cannot be used to monitor
53 | files or directories changed by other machines on remote NFS file
54 | systems.
55 |
56 | When a service unit triggered by a path unit terminates (regardless whether it exited successfully
57 | or failed), monitored paths are checked immediately again, and the service accordingly restarted
58 | instantly. As protection against busy looping in this trigger/start cycle, a start rate limit is enforced
59 | on the service unit, see StartLimitIntervalSec= and
60 | StartLimitBurst= in
61 | systemd.unit5. Unlike
62 | other service failures, the error condition that the start rate limit is hit is propagated from the
63 | service unit to the path unit and causes the path unit to fail as well, thus ending the loop.
64 |
65 |
66 |
67 | Automatic Dependencies
68 |
69 |
70 | Implicit Dependencies
71 |
72 | The following dependencies are implicitly added:
73 |
74 |
75 | If a path unit is beneath another mount unit in the file
76 | system hierarchy, both a requirement and an ordering dependency
77 | between both units are created automatically.
78 |
79 | An implicit Before= dependency is added
80 | between a path unit and the unit it is supposed to activate.
81 |
82 |
83 |
84 |
85 | Default Dependencies
86 |
87 | The following dependencies are added unless DefaultDependencies=no is set:
88 |
89 |
90 | Path units will automatically have dependencies of type Before= on
91 | paths.target,
92 | dependencies of type After= and Requires= on
93 | sysinit.target, and have dependencies of type Conflicts= and
94 | Before= on shutdown.target. These ensure that path units are terminated
95 | cleanly prior to system shutdown. Only path units involved with early boot or late system shutdown should
96 | disable DefaultDependencies= option.
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | Options
105 |
106 | Path unit files may include [Unit] and [Install] sections, which are described in
107 | systemd.unit5.
108 |
109 |
110 | Path unit files must include a [Path] section, which carries information about the path or paths it
111 | monitors. The options specific to the [Path] section of path units are the following:
112 |
113 |
114 |
115 | PathExists=
116 | PathExistsGlob=
117 | PathChanged=
118 | PathModified=
119 | DirectoryNotEmpty=
120 |
121 | Defines paths to monitor for certain changes:
122 | PathExists= may be used to watch the mere
123 | existence of a file or directory. If the file specified
124 | exists, the configured unit is activated.
125 | PathExistsGlob= works similarly, but checks
126 | for the existence of at least one file matching the globbing
127 | pattern specified. PathChanged= may be used
128 | to watch a file or directory and activate the configured unit
129 | whenever it changes. It is not activated on every write to the
130 | watched file but it is activated if the file which was open
131 | for writing gets closed. PathModified= is
132 | similar, but additionally it is activated also on simple
133 | writes to the watched file.
134 | DirectoryNotEmpty= may be used to watch a
135 | directory and activate the configured unit whenever it
136 | contains at least one file.
137 |
138 | The arguments of these directives must be absolute file
139 | system paths.
140 |
141 | Multiple directives may be combined, of the same and of
142 | different types, to watch multiple paths. If the empty string
143 | is assigned to any of these options, the list of paths to
144 | watch is reset, and any prior assignments of these options
145 | will not have any effect.
146 |
147 | If a path already exists (in case of
148 | PathExists= and
149 | PathExistsGlob=) or a directory already is
150 | not empty (in case of DirectoryNotEmpty=)
151 | at the time the path unit is activated, then the configured
152 | unit is immediately activated as well. Something similar does
153 | not apply to PathChanged= and
154 | PathModified=.
155 |
156 | If the path itself or any of the containing directories
157 | are not accessible, systemd will watch for
158 | permission changes and notice that conditions are satisfied
159 | when permissions allow that.
160 |
161 |
162 | Unit=
163 |
164 | The unit to activate when any of the
165 | configured paths changes. The argument is a unit name, whose
166 | suffix is not .path. If not specified, this
167 | value defaults to a service that has the same name as the path
168 | unit, except for the suffix. (See above.) It is recommended
169 | that the unit name that is activated and the unit name of the
170 | path unit are named identical, except for the
171 | suffix.
172 |
173 |
174 | MakeDirectory=
175 |
176 | Takes a boolean argument. If true, the
177 | directories to watch are created before watching. This option
178 | is ignored for PathExists= settings.
179 | Defaults to .
180 |
181 |
182 | DirectoryMode=
183 |
184 | If MakeDirectory= is
185 | enabled, use the mode specified here to create the directories
186 | in question. Takes an access mode in octal notation. Defaults
187 | to .
188 |
189 |
190 | TriggerLimitIntervalSec=
191 | TriggerLimitBurst=
192 |
193 | Configures a limit on how often this path unit may be activated within a specific
194 | time interval. The TriggerLimitIntervalSec= may be used to configure the length of
195 | the time interval in the usual time units us, ms,
196 | s, min, h, … and defaults to 2s. See
197 | systemd.time7 for
198 | details on the various time units understood. The TriggerLimitBurst= setting takes
199 | a positive integer value and specifies the number of permitted activations per time interval, and
200 | defaults to 200. Set either to 0 to disable any form of trigger rate limiting. If the limit is hit,
201 | the unit is placed into a failure mode, and will not watch the paths anymore until restarted. Note
202 | that this limit is enforced before the service activation is enqueued.
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 | See Also
213 | Environment variables with details on the trigger will be set for triggered units. See the
214 | section Environment Variables Set or Propagated by the Service Manager in
215 | systemd.exec5
216 | for more details.
217 |
218 | systemd1
219 | systemctl1
220 | systemd.unit5
221 | systemd.service5
222 | inotify7
223 | systemd.directives7
224 |
225 |
226 |
227 |
228 |
--------------------------------------------------------------------------------
/systemd_language_server/assets/systemd.scope.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | systemd.scope
9 | systemd
10 |
11 |
12 |
13 | systemd.scope
14 | 5
15 |
16 |
17 |
18 | systemd.scope
19 | Scope unit configuration
20 |
21 |
22 |
23 | scope.scope
24 |
25 |
26 |
27 | Description
28 |
29 | Scope units are not configured via unit configuration files,
30 | but are only created programmatically using the bus interfaces of
31 | systemd. They are named similar to filenames. A unit whose name
32 | ends in .scope refers to a scope unit. Scopes
33 | units manage a set of system processes. Unlike service units, scope
34 | units manage externally created processes, and do not fork off
35 | processes on its own.
36 |
37 | The main purpose of scope units is grouping worker processes
38 | of a system service for organization and for managing resources.
39 |
40 | systemd-run may
41 | be used to easily launch a command in a new scope unit from the
42 | command line.
43 |
44 | See the New
46 | Control Group Interfaces for an introduction on how to make
47 | use of scope units from programs.
48 |
49 | Note that, unlike service units, scope units have no "main" process: all processes in the scope are
50 | equivalent. The lifecycle of the scope unit is thus not bound to the lifetime of one specific process,
51 | but to the existence of at least one process in the scope. This also means that the exit statuses of
52 | these processes are not relevant for the scope unit failure state. Scope units may still enter a failure
53 | state, for example due to resource exhaustion or stop timeouts being reached, but not due to programs
54 | inside of them terminating uncleanly. Since processes managed as scope units generally remain children of
55 | the original process that forked them off, it is also the job of that process to collect their exit
56 | statuses and act on them as needed.
57 |
58 |
59 |
60 | Automatic Dependencies
61 |
62 |
63 | Implicit Dependencies
64 |
65 | Implicit dependencies may be added as result of
66 | resource control parameters as documented in
67 | systemd.resource-control5.
68 |
69 |
70 |
71 | Default Dependencies
72 |
73 | The following dependencies are added unless
74 | DefaultDependencies=no is set:
75 |
76 |
77 | Scope units will automatically have dependencies of
78 | type Conflicts= and
79 | Before= on
80 | shutdown.target. These ensure
81 | that scope units are removed prior to system
82 | shutdown. Only scope units involved with early boot or
83 | late system shutdown should disable
84 | DefaultDependencies= option.
85 |
86 |
87 |
88 |
89 |
90 | Options
91 |
92 | Scope files may include a [Unit] section, which is described in
93 | systemd.unit5.
94 |
95 |
96 | Scope files may include a [Scope]
97 | section, which carries information about the scope and the
98 | units it contains. A number of options that may be used in
99 | this section are shared with other unit types. These options are
100 | documented in
101 | systemd.kill5
102 | and
103 | systemd.resource-control5.
104 | The options specific to the [Scope] section
105 | of scope units are the following:
106 |
107 |
108 |
109 |
110 |
111 | RuntimeMaxSec=
112 |
113 | Configures a maximum time for the scope to run. If this is used and the scope has been
114 | active for longer than the specified time it is terminated and put into a failure state. Pass
115 | infinity (the default) to configure no runtime limit.
116 |
117 |
118 |
119 |
120 |
121 | RuntimeRandomizedExtraSec=
122 |
123 | This option modifies RuntimeMaxSec= by increasing the maximum runtime by an
124 | evenly distributed duration between 0 and the specified value (in seconds). If RuntimeMaxSec= is
125 | unspecified, then this feature will be disabled.
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 | See Also
137 |
138 | systemd1
139 | systemd-run1
140 | systemd.unit5
141 | systemd.resource-control5
142 | systemd.service5
143 | systemd.directives7.
144 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/systemd_language_server/assets/systemd.swap.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | systemd.swap
9 | systemd
10 |
11 |
12 |
13 | systemd.swap
14 | 5
15 |
16 |
17 |
18 | systemd.swap
19 | Swap unit configuration
20 |
21 |
22 |
23 | swap.swap
24 |
25 |
26 |
27 | Description
28 |
29 | A unit configuration file whose name ends in
30 | .swap encodes information about a swap device
31 | or file for memory paging controlled and supervised by
32 | systemd.
33 |
34 | This man page lists the configuration options specific to
35 | this unit type. See
36 | systemd.unit5
37 | for the common options of all unit configuration files. The common
38 | configuration items are configured in the generic [Unit] and
39 | [Install] sections. The swap specific configuration options are
40 | configured in the [Swap] section.
41 |
42 | Additional options are listed in
43 | systemd.exec5,
44 | which define the execution environment the swapon8
46 | program is executed in, in
47 | systemd.kill5,
48 | which define the way these processes are
49 | terminated, and in
50 | systemd.resource-control5,
51 | which configure resource control settings for these processes of the
52 | unit.
53 |
54 | Swap units must be named after the devices or files they control. Example: the swap device /dev/sda5 must be configured in a unit file dev-sda5.swap. For
56 | details about the escaping logic used to convert a file system path to a unit name, see
57 | systemd.unit5. Note that swap
58 | units cannot be templated, nor is possible to add multiple names to a swap unit by creating additional symlinks to
59 | it.
60 |
61 | Note that swap support on Linux is privileged, swap units are hence only available in the system
62 | service manager (and root's user service manager), but not in unprivileged user's service manager.
63 |
64 |
65 |
66 | Automatic Dependencies
67 |
68 |
69 | Implicit Dependencies
70 |
71 | The following dependencies are implicitly added:
72 |
73 |
74 | All swap units automatically get the
75 | BindsTo= and After=
76 | dependencies on the device units or the mount units of the files
77 | they are activated from.
78 |
79 |
80 | Additional implicit dependencies may be added as result of
81 | execution and resource control parameters as documented in
82 | systemd.exec5
83 | and
84 | systemd.resource-control5.
85 |
86 |
87 |
88 | Default Dependencies
89 |
90 | The following dependencies are added unless DefaultDependencies=no is set:
91 |
92 |
93 | Swap units automatically acquire a Conflicts= and a
94 | Before= dependency on umount.target so that they are deactivated at
95 | shutdown as well as a Before=swap.target dependency.
96 |
97 |
98 |
99 |
100 |
101 | fstab
102 |
103 | Swap units may either be configured via unit files, or via
104 | /etc/fstab (see
105 | fstab5
106 | for details). Swaps listed in /etc/fstab will
107 | be converted into native units dynamically at boot and when the
108 | configuration of the system manager is reloaded. See
109 | systemd-fstab-generator8
110 | for details about the conversion.
111 |
112 | If a swap device or file is configured in both
113 | /etc/fstab and a unit file, the configuration
114 | in the latter takes precedence.
115 |
116 | When reading /etc/fstab, a few special
117 | options are understood by systemd which influence how dependencies
118 | are created for swap units.
119 |
120 |
121 |
122 |
123 |
124 |
125 | With , the swap unit
126 | will not be added as a dependency for
127 | swap.target. This means that it will not
128 | be activated automatically during boot, unless it is pulled in
129 | by some other unit. The option has the
130 | opposite meaning and is the default.
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 | With , the swap unit
140 | will be only wanted, not required by
141 | swap.target. This means that the boot
142 | will continue even if this swap device is not activated
143 | successfully.
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 | The swap structure will be initialized on the device. If the device is not
155 | "empty", i.e. it contains any signature, the operation will be skipped. It is hence expected
156 | that this option remains set even after the device has been initialized.
157 |
158 | Note that this option can only be used in /etc/fstab, and will be
159 | ignored when part of the Options= setting in a unit file.
160 |
161 | See
162 | systemd-mkswap@.service8
163 | and the discussion of
164 | wipefs8
165 | in systemd.mount5.
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 | Options
175 |
176 | Swap unit files may include [Unit] and [Install] sections, which are described in
177 | systemd.unit5.
178 |
179 |
180 | Swap unit files must include a [Swap] section, which carries
181 | information about the swap device it supervises. A number of
182 | options that may be used in this section are shared with other
183 | unit types. These options are documented in
184 | systemd.exec5
185 | and
186 | systemd.kill5.
187 | The options specific to the [Swap] section of swap units are the
188 | following:
189 |
190 |
191 |
192 |
193 | What=
194 | Takes an absolute path or a fstab-style identifier of a device node or file to use
195 | for paging. See swapon8 for
197 | details. If this refers to a device node, a dependency on the respective device unit is automatically
198 | created. (See
199 | systemd.device5
200 | for more information.) If this refers to a file, a dependency on the respective mount unit is
201 | automatically created. (See
202 | systemd.mount5 for
203 | more information.) This option is mandatory. Note that the usual specifier expansion is applied to
204 | this setting, literal percent characters should hence be written as
205 | %%.
206 |
207 |
208 |
209 | Priority=
210 |
211 | Swap priority to use when activating the swap
212 | device or file. This takes an integer. This setting is
213 | optional and ignored when the priority is set by in the
214 | Options= key.
215 |
216 |
217 |
218 | Options=
219 |
220 | May contain an option string for the swap device. This may be used for controlling discard
221 | options among other functionality, if the swap backing device supports the discard or trim operation. (See
222 | swapon8
223 | for more information.) Note that the usual specifier expansion is applied to this setting, literal percent
224 | characters should hence be written as %%.
225 |
226 |
227 |
228 |
229 |
230 | TimeoutSec=
231 | Configures the time to wait for the swapon
232 | command to finish. If a command does not exit within the
233 | configured time, the swap will be considered failed and be
234 | shut down again. All commands still running will be terminated
235 | forcibly via SIGTERM, and after another
236 | delay of this time with SIGKILL. (See
237 | in
238 | systemd.kill5.)
239 | Takes a unit-less value in seconds, or a time span value such
240 | as "5min 20s". Pass 0 to disable the
241 | timeout logic. Defaults to
242 | DefaultTimeoutStartSec= from the manager
243 | configuration file (see
244 | systemd-system.conf5).
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 | See Also
254 |
255 | systemd1
256 | systemctl1
257 | systemd-system.conf5
258 | systemd.unit5
259 | systemd.exec5
260 | systemd.kill5
261 | systemd.resource-control5
262 | systemd.device5
263 | systemd.mount5
264 | swapon8
265 | systemd-fstab-generator8
266 | systemd.directives7
267 |
268 |
269 |
270 |
271 |
--------------------------------------------------------------------------------
/systemd_language_server/assets/systemd.timer.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 | systemd.timer
9 | systemd
10 |
11 |
12 |
13 | systemd.timer
14 | 5
15 |
16 |
17 |
18 | systemd.timer
19 | Timer unit configuration
20 |
21 |
22 |
23 | timer.timer
24 |
25 |
26 |
27 | Description
28 |
29 | A unit configuration file whose name ends in
30 | .timer encodes information about a timer
31 | controlled and supervised by systemd, for timer-based
32 | activation.
33 |
34 | This man page lists the configuration options specific to
35 | this unit type. See
36 | systemd.unit5
37 | for the common options of all unit configuration files. The common
38 | configuration items are configured in the generic [Unit] and
39 | [Install] sections. The timer specific configuration options are
40 | configured in the [Timer] section.
41 |
42 | For each timer file, a matching unit file must exist,
43 | describing the unit to activate when the timer elapses. By
44 | default, a service by the same name as the timer (except for the
45 | suffix) is activated. Example: a timer file
46 | foo.timer activates a matching service
47 | foo.service. The unit to activate may be
48 | controlled by Unit= (see below).
49 |
50 | Note that in case the unit to activate is already active at the time the timer elapses it is not restarted,
51 | but simply left running. There is no concept of spawning new service instances in this case. Due to this, services
52 | with RemainAfterExit=yes set (which stay around continuously even after the service's main
53 | process exited) are usually not suitable for activation via repetitive timers, as they will only be activated
54 | once, and then stay around forever. Target units, which by default do not deactivate on their own, can be
55 | activated repeatedly by timers by setting StopWhenUnneeded=yes on them. This will cause a
56 | target unit to be stopped immediately after its activation, if it is not a dependency of another running unit.
57 |
58 |
59 |
60 | Automatic Dependencies
61 |
62 |
63 | Implicit Dependencies
64 |
65 | The following dependencies are implicitly added:
66 |
67 |
68 | Timer units automatically gain a Before=
69 | dependency on the service they are supposed to activate.
70 |
71 |
72 |
73 |
74 | Default Dependencies
75 |
76 | The following dependencies are added unless DefaultDependencies=no is set:
77 |
78 |
79 | Timer units will automatically have dependencies of type Requires= and
80 | After= on sysinit.target, a dependency of type Before=
81 | on timers.target, as well as Conflicts= and Before= on
82 | shutdown.target to ensure that they are stopped cleanly prior to system shutdown. Only timer
83 | units involved with early boot or late system shutdown should disable the
84 | DefaultDependencies= option.
85 |
86 | Timer units with at least one OnCalendar= directive acquire a pair
87 | of additional After= dependencies on time-set.target and
88 | time-sync.target, in order to avoid being started before the system clock has
89 | been correctly set. See
90 | systemd.special7
91 | for details on these two targets.
92 |
93 |
94 |
95 |
96 |
97 | Options
98 |
99 | Timer unit files may include [Unit] and [Install] sections, which are described in
100 | systemd.unit5.
101 |
102 |
103 | Timer unit files must include a [Timer] section, which carries
104 | information about the timer it defines. The options specific to
105 | the [Timer] section of timer units are the following:
106 |
107 |
108 |
109 | OnActiveSec=
110 | OnBootSec=
111 | OnStartupSec=
112 | OnUnitActiveSec=
113 | OnUnitInactiveSec=
114 |
115 | Defines monotonic timers relative to different
116 | starting points:
117 |
118 |
119 | Settings and their starting points
120 |
121 |
122 |
123 |
124 | Setting
125 | Meaning
126 |
127 |
128 |
129 |
130 | OnActiveSec=
131 | Defines a timer relative to the moment the timer unit itself is activated.
132 |
133 |
134 | OnBootSec=
135 | Defines a timer relative to when the machine was booted up. In containers, for the system manager instance, this is mapped to OnStartupSec=, making both equivalent.
136 |
137 |
138 | OnStartupSec=
139 | Defines a timer relative to when the service manager was first started. For system timer units this is very similar to OnBootSec= as the system service manager is generally started very early at boot. It's primarily useful when configured in units running in the per-user service manager, as the user service manager is generally started on first login only, not already during boot.
140 |
141 |
142 | OnUnitActiveSec=
143 | Defines a timer relative to when the unit the timer unit is activating was last activated.
144 |
145 |
146 | OnUnitInactiveSec=
147 | Defines a timer relative to when the unit the timer unit is activating was last deactivated.
148 |
149 |
150 |
151 |
152 |
153 | Multiple directives may be combined of the same and of different types, in which case the timer
154 | unit will trigger whenever any of the specified timer expressions elapse. For example, by combining
155 | OnBootSec= and OnUnitActiveSec=, it is possible to define a
156 | timer that elapses in regular intervals and activates a specific service each time. Moreover, both
157 | monotonic time expressions and OnCalendar= calendar expressions may be combined in
158 | the same timer unit.
159 |
160 | The arguments to the directives are time spans
161 | configured in seconds. Example: "OnBootSec=50" means 50s after
162 | boot-up. The argument may also include time units. Example:
163 | "OnBootSec=5h 30min" means 5 hours and 30 minutes after
164 | boot-up. For details about the syntax of time spans, see
165 | systemd.time7.
166 |
167 | If a timer configured with OnBootSec=
168 | or OnStartupSec= is already in the past
169 | when the timer unit is activated, it will immediately elapse
170 | and the configured unit is started. This is not the case for
171 | timers defined in the other directives.
172 |
173 | These are monotonic timers, independent of wall-clock time and timezones. If the computer is
174 | temporarily suspended, the monotonic clock generally pauses, too. Note that if
175 | WakeSystem= is used, a different monotonic clock is selected that continues to
176 | advance while the system is suspended and thus can be used as the trigger to resume the
177 | system.
178 |
179 | If the empty string is assigned to any of these options, the list of timers is reset (both
180 | monotonic timers and OnCalendar= timers, see below), and all prior assignments
181 | will have no effect.
182 |
183 | Note that timers do not necessarily expire at the
184 | precise time configured with these settings, as they are
185 | subject to the AccuracySec= setting
186 | below.
187 |
188 |
189 |
190 | OnCalendar=
191 |
192 | Defines realtime (i.e. wallclock) timers with calendar event expressions. See
193 | systemd.time7 for
194 | more information on the syntax of calendar event expressions. Otherwise, the semantics are similar to
195 | OnActiveSec= and related settings.
196 |
197 | Note that timers do not necessarily expire at the precise time configured with this setting, as
198 | it is subject to the AccuracySec= setting below.
199 |
200 | May be specified more than once, in which case the timer unit will trigger whenever any of the
201 | specified expressions elapse. Moreover calendar timers and monotonic timers (see above) may be
202 | combined within the same timer unit.
203 |
204 | If the empty string is assigned to any of these options, the list of timers is reset (both
205 | OnCalendar= timers and monotonic timers, see above), and all prior assignments
206 | will have no effect.
207 |
208 | Note that calendar timers might be triggered at unexpected times if the system's realtime clock
209 | is not set correctly. Specifically, on systems that lack a battery-buffered Realtime Clock (RTC) it
210 | might be wise to enable systemd-time-wait-sync.service to ensure the clock is
211 | adjusted to a network time source before the timer event is set up. Timer units
212 | with at least one OnCalendar= expression are automatically ordered after
213 | time-sync.target, which systemd-time-wait-sync.service is
214 | ordered before.
215 |
216 | When a system is temporarily put to sleep (i.e. system suspend or hibernation) the realtime
217 | clock does not pause. When a calendar timer elapses while the system is sleeping it will not be acted
218 | on immediately, but once the system is later resumed it will catch up and process all timers that
219 | triggered while the system was sleeping. Note that if a calendar timer elapsed more than once while
220 | the system was continuously sleeping the timer will only result in a single service activation. If
221 | WakeSystem= (see below) is enabled a calendar time event elapsing while the system
222 | is suspended will cause the system to wake up (under the condition the system's hardware supports
223 | time-triggered wake-up functionality).
224 |
225 |
226 |
227 |
228 |
229 | AccuracySec=
230 |
231 | Specify the accuracy the timer shall elapse
232 | with. Defaults to 1min. The timer is scheduled to elapse
233 | within a time window starting with the time specified in
234 | OnCalendar=,
235 | OnActiveSec=,
236 | OnBootSec=,
237 | OnStartupSec=,
238 | OnUnitActiveSec= or
239 | OnUnitInactiveSec= and ending the time
240 | configured with AccuracySec= later. Within
241 | this time window, the expiry time will be placed at a
242 | host-specific, randomized, but stable position that is
243 | synchronized between all local timer units. This is done in
244 | order to optimize power consumption to suppress unnecessary
245 | CPU wake-ups. To get best accuracy, set this option to
246 | 1us. Note that the timer is still subject to the timer slack
247 | configured via
248 | systemd-system.conf5's
249 | TimerSlackNSec= setting. See
250 | prctl2
251 | for details. To optimize power consumption, make sure to set
252 | this value as high as possible and as low as
253 | necessary.
254 |
255 | Note that this setting is primarily a power saving option that allows coalescing CPU
256 | wake-ups. It should not be confused with RandomizedDelaySec= (see below) which
257 | adds a random value to the time the timer shall elapse next and whose purpose is the opposite: to
258 | stretch elapsing of timer events over a longer period to reduce workload spikes. For further details
259 | and explanations and how both settings play together, see below.
260 |
261 |
262 |
263 |
264 |
265 | RandomizedDelaySec=
266 |
267 | Delay the timer by a randomly selected, evenly distributed amount of time between 0
268 | and the specified time value. Defaults to 0, indicating that no randomized delay shall be applied.
269 | Each timer unit will determine this delay randomly before each iteration, and the delay will simply
270 | be added on top of the next determined elapsing time, unless modified with
271 | FixedRandomDelay=, see below.
272 |
273 | This setting is useful to stretch dispatching of similarly configured timer events over a
274 | certain time interval, to prevent them from firing all at the same time, possibly resulting in
275 | resource congestion.
276 |
277 | Note the relation to AccuracySec= above: the latter allows the service
278 | manager to coalesce timer events within a specified time range in order to minimize wakeups, while
279 | this setting does the opposite: it stretches timer events over an interval, to make it unlikely that
280 | they fire simultaneously. If RandomizedDelaySec= and
281 | AccuracySec= are used in conjunction, first the randomized delay is added, and
282 | then the result is possibly further shifted to coalesce it with other timer events happening on the
283 | system. As mentioned above AccuracySec= defaults to 1 minute and
284 | RandomizedDelaySec= to 0, thus encouraging coalescing of timer events. In order to
285 | optimally stretch timer events over a certain range of time, set
286 | AccuracySec=1us and RandomizedDelaySec= to some higher value.
287 |
288 |
289 |
290 |
291 |
292 |
293 | FixedRandomDelay=
294 |
295 | Takes a boolean argument. When enabled, the randomized offset specified by
296 | RandomizedDelaySec= is reused for all firings of the same timer. For a given timer
297 | unit, the offset depends on the machine ID, user identifier and timer name, which means that it is
298 | stable between restarts of the manager. This effectively creates a fixed offset for an individual
299 | timer, reducing the jitter in firings of this timer, while still avoiding firing at the same time as
300 | other similarly configured timers.
301 |
302 | This setting has no effect if RandomizedDelaySec= is set to 0. Defaults to
303 | .
304 |
305 |
306 |
307 |
308 |
309 | OnClockChange=
310 | OnTimezoneChange=
311 |
312 | These options take boolean arguments. When true, the service unit will be triggered
313 | when the system clock (CLOCK_REALTIME) jumps relative to the monotonic clock
314 | (CLOCK_MONOTONIC), or when the local system timezone is modified. These options
315 | can be used alone or in combination with other timer expressions (see above) within the same timer
316 | unit. These options default to .
317 |
318 |
319 |
320 |
321 |
322 | Unit=
323 |
324 | The unit to activate when this timer elapses.
325 | The argument is a unit name, whose suffix is not
326 | .timer. If not specified, this value
327 | defaults to a service that has the same name as the timer
328 | unit, except for the suffix. (See above.) It is recommended
329 | that the unit name that is activated and the unit name of the
330 | timer unit are named identically, except for the
331 | suffix.
332 |
333 |
334 |
335 | Persistent=
336 |
337 | Takes a boolean argument. If true, the time when the service unit was last triggered
338 | is stored on disk. When the timer is activated, the service unit is triggered immediately if it
339 | would have been triggered at least once during the time when the timer was inactive. Such triggering
340 | is nonetheless subject to the delay imposed by RandomizedDelaySec=.
341 | This is useful to catch up on missed runs of the service when the system was powered down. Note that
342 | this setting only has an effect on timers configured with OnCalendar=. Defaults to
343 | .
344 |
345 | Use systemctl clean --what=state … on the timer unit to remove the timestamp
346 | file maintained by this option from disk. In particular, use this command before uninstalling a timer
347 | unit. See
348 | systemctl1 for
349 | details.
350 |
351 |
352 |
353 |
354 |
355 | WakeSystem=
356 |
357 | Takes a boolean argument. If true, an elapsing timer will cause the system to resume
358 | from suspend, should it be suspended and if the system supports this. Note that this option will only
359 | make sure the system resumes on the appropriate times, it will not take care of suspending it again
360 | after any work that is to be done is finished. Defaults to
361 | .
362 |
363 | Note that this functionality requires privileges and is thus generally only available in the
364 | system service manager.
365 |
366 | Note that behaviour of monotonic clock timers (as configured with
367 | OnActiveSec=, OnBootSec=, OnStartupSec=,
368 | OnUnitActiveSec=, OnUnitInactiveSec=, see above) is altered
369 | depending on this option. If false, a monotonic clock is used that is paused during system suspend
370 | (CLOCK_MONOTONIC), if true a different monotonic clock is used that continues
371 | advancing during system suspend (CLOCK_BOOTTIME), see
372 | clock_getres2 for
373 | details.
374 |
375 |
376 |
377 |
378 |
379 | RemainAfterElapse=
380 |
381 | Takes a boolean argument. If true, a timer will stay loaded, and its state remains
382 | queryable even after it elapsed and the associated unit (as configured with Unit=,
383 | see above) deactivated again. If false, an elapsed timer unit that cannot elapse anymore is unloaded
384 | once its associated unit deactivated again. Turning this off is particularly useful for transient
385 | timer units. Note that this setting has an effect when repeatedly starting a timer unit: if
386 | RemainAfterElapse= is on, starting the timer a second time has no effect. However,
387 | if RemainAfterElapse= is off and the timer unit was already unloaded, it can be
388 | started again, and thus the service can be triggered multiple times. Defaults to
389 | .
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 | See Also
400 | Environment variables with details on the trigger will be set for triggered units. See the
401 | Environment Variables Set or Propagated by the Service Manager section in
402 | systemd.exec5
403 | for more details.
404 |
405 | systemd1
406 | systemctl1
407 | systemd.unit5
408 | systemd.service5
409 | systemd.time7
410 | systemd.directives7
411 | systemd-system.conf5
412 | prctl2
413 |
414 |
415 |
416 |
417 |
--------------------------------------------------------------------------------
/systemd_language_server/constants.py:
--------------------------------------------------------------------------------
1 | systemd_unit_directives = [
2 | "Description",
3 | "Documentation",
4 | "Wants",
5 | "Requires",
6 | "Requisite",
7 | "BindsTo",
8 | "PartOf",
9 | "Upholds",
10 | "Conflicts",
11 | "Before",
12 | "After",
13 | "OnFailure",
14 | "OnSuccess",
15 | "PropagatesReloadTo",
16 | "ReloadPropagatedFrom",
17 | "PropagatesStopTo",
18 | "StopPropagatedFrom",
19 | "JoinsNamespaceOf",
20 | "RequiresMountsFor",
21 | "WantsMountsFor",
22 | "OnSuccessJobMode",
23 | "OnFailureJobMode",
24 | "IgnoreOnIsolate",
25 | "StopWhenUnneeded",
26 | "RefuseManualStart",
27 | "RefuseManualStop",
28 | "AllowIsolate",
29 | "DefaultDependencies",
30 | "SurviveFinalKillSignal",
31 | "CollectMode",
32 | "FailureAction",
33 | "SuccessAction",
34 | "FailureActionExitStatus",
35 | "SuccessActionExitStatus",
36 | "JobTimeoutSec",
37 | "JobRunningTimeoutSec",
38 | "JobTimeoutAction",
39 | "JobTimeoutRebootArgument",
40 | "StartLimitIntervalSec",
41 | "StartLimitBurst",
42 | "StartLimitAction",
43 | "RebootArgument",
44 | "SourcePath",
45 | "ConditionArchitecture",
46 | "ConditionFirmware",
47 | "ConditionVirtualization",
48 | "ConditionHost",
49 | "ConditionKernelCommandLine",
50 | "ConditionKernelVersion",
51 | "ConditionCredential",
52 | "ConditionEnvironment",
53 | "ConditionSecurity",
54 | "ConditionCapability",
55 | "ConditionACPower",
56 | "ConditionNeedsUpdate",
57 | "ConditionFirstBoot",
58 | "ConditionPathExists",
59 | "ConditionPathExistsGlob",
60 | "ConditionPathIsDirectory",
61 | "ConditionPathIsSymbolicLink",
62 | "ConditionPathIsMountPoint",
63 | "ConditionPathIsReadWrite",
64 | "ConditionPathIsEncrypted",
65 | "ConditionDirectoryNotEmpty",
66 | "ConditionFileNotEmpty",
67 | "ConditionFileIsExecutable",
68 | "ConditionUser",
69 | "ConditionGroup",
70 | "ConditionControlGroupController",
71 | "ConditionMemory",
72 | "ConditionCPUs",
73 | "ConditionCPUFeature",
74 | "ConditionOSRelease",
75 | "ConditionMemoryPressure",
76 | "ConditionCPUPressure",
77 | "ConditionIOPressure",
78 | "AssertArchitecture",
79 | "AssertVirtualization",
80 | "AssertHost",
81 | "AssertKernelCommandLine",
82 | "AssertKernelVersion",
83 | "AssertCredential",
84 | "AssertEnvironment",
85 | "AssertSecurity",
86 | "AssertCapability",
87 | "AssertACPower",
88 | "AssertNeedsUpdate",
89 | "AssertFirstBoot",
90 | "AssertPathExists",
91 | "AssertPathExistsGlob",
92 | "AssertPathIsDirectory",
93 | "AssertPathIsSymbolicLink",
94 | "AssertPathIsMountPoint",
95 | "AssertPathIsReadWrite",
96 | "AssertPathIsEncrypted",
97 | "AssertDirectoryNotEmpty",
98 | "AssertFileNotEmpty",
99 | "AssertFileIsExecutable",
100 | "AssertUser",
101 | "AssertGroup",
102 | "AssertControlGroupController",
103 | "AssertMemory",
104 | "AssertCPUs",
105 | "AssertCPUFeature",
106 | "AssertOSRelease",
107 | "AssertMemoryPressure",
108 | "AssertCPUPressure",
109 | "AssertIOPressure",
110 | ]
111 |
112 | systemd_install_directives = [
113 | "Alias",
114 | "WantedBy",
115 | "RequiredBy",
116 | "UpheldBy",
117 | "Also",
118 | "DefaultInstance",
119 | ]
120 |
121 | systemd_service_directives = [
122 | "Type",
123 | "ExitType",
124 | "RemainAfterExit",
125 | "GuessMainPID",
126 | "PIDFile",
127 | "BusName",
128 | "ExecStart",
129 | "ExecStartPre",
130 | "ExecStartPost",
131 | "ExecCondition",
132 | "ExecReload",
133 | "ExecStop",
134 | "ExecStopPost",
135 | "RestartSec",
136 | "RestartSteps",
137 | "RestartMaxDelaySec",
138 | "TimeoutStartSec",
139 | "TimeoutStopSec",
140 | "TimeoutAbortSec",
141 | "TimeoutSec",
142 | "TimeoutStartFailureMode",
143 | "TimeoutStopFailureMode",
144 | "RuntimeMaxSec",
145 | "RuntimeRandomizedExtraSec",
146 | "WatchdogSec",
147 | "Restart",
148 | "RestartMode",
149 | "SuccessExitStatus",
150 | "RestartPreventExitStatus",
151 | "RestartForceExitStatus",
152 | "RootDirectoryStartOnly",
153 | "NonBlocking",
154 | "NotifyAccess",
155 | "Sockets",
156 | "FileDescriptorStoreMax",
157 | "FileDescriptorStorePreserve",
158 | "USBFunctionDescriptors",
159 | "USBFunctionStrings",
160 | "OOMPolicy",
161 | "OpenFile",
162 | "ReloadSignal",
163 | ]
164 |
165 | systemd_socket_directives = [
166 | "ListenStream",
167 | "ListenDatagram",
168 | "ListenSequentialPacket",
169 | "ListenFIFO",
170 | "ListenSpecial",
171 | "ListenNetlink",
172 | "ListenMessageQueue",
173 | "ListenUSBFunction",
174 | "SocketProtocol",
175 | "BindIPv6Only",
176 | "Backlog",
177 | "BindToDevice",
178 | "SocketUser",
179 | "SocketGroup",
180 | "SocketMode",
181 | "DirectoryMode",
182 | "Accept",
183 | "Writable",
184 | "FlushPending",
185 | "MaxConnections",
186 | "MaxConnectionsPerSource",
187 | "KeepAlive",
188 | "KeepAliveTimeSec",
189 | "KeepAliveIntervalSec",
190 | "KeepAliveProbes",
191 | "NoDelay",
192 | "Priority",
193 | "DeferAcceptSec",
194 | "ReceiveBuffer",
195 | "SendBuffer",
196 | "IPTOS",
197 | "IPTTL",
198 | "Mark",
199 | "ReusePort",
200 | "SmackLabel",
201 | "SmackLabelIPIn",
202 | "SmackLabelIPOut",
203 | "SELinuxContextFromNet",
204 | "PipeSize",
205 | "MessageQueueMaxMessages",
206 | "MessageQueueMessageSize",
207 | "FreeBind",
208 | "Transparent",
209 | "Broadcast",
210 | "PassCredentials",
211 | "PassSecurity",
212 | "PassPacketInfo",
213 | "Timestamping",
214 | "TCPCongestion",
215 | "ExecStartPre",
216 | "ExecStartPost",
217 | "ExecStopPre",
218 | "ExecStopPost",
219 | "TimeoutSec",
220 | "Service",
221 | "RemoveOnStop",
222 | "Symlinks",
223 | "FileDescriptorName",
224 | "TriggerLimitIntervalSec",
225 | "TriggerLimitBurst",
226 | "PollLimitIntervalSec",
227 | "PollLimitBurst",
228 | ]
229 |
230 | systemd_mount_directives = [
231 | "What",
232 | "Where",
233 | "Type",
234 | "Options",
235 | "SloppyOptions",
236 | "LazyUnmount",
237 | "ReadWriteOnly",
238 | "ForceUnmount",
239 | "DirectoryMode",
240 | "TimeoutSec",
241 | ]
242 |
243 | systemd_automount_directives = [
244 | "Where",
245 | "ExtraOptions",
246 | "DirectoryMode",
247 | "TimeoutIdleSec",
248 | ]
249 |
250 |
251 | systemd_timer_directives = [
252 | "OnActiveSec",
253 | "OnBootSec",
254 | "OnStartupSec",
255 | "OnUnitActiveSec",
256 | "OnUnitInactiveSec",
257 | "OnCalendar",
258 | "AccuracySec",
259 | "RandomizedDelaySec",
260 | "FixedRandomDelay",
261 | "OnClockChange",
262 | "OnTimezoneChange",
263 | "Unit",
264 | "Persistent",
265 | "WakeSystem",
266 | "RemainAfterElapse",
267 | ]
268 |
269 | systemd_scope_directives = [
270 | "RuntimeMaxSec",
271 | "RuntimeRandomizedExtraSec",
272 | ]
273 |
274 | systemd_swap_directives = [
275 | "What",
276 | "Priority",
277 | "Options",
278 | "TimeoutSec",
279 | ]
280 |
281 | systemd_path_directives = [
282 | "PathExists",
283 | "PathExistsGlob",
284 | "PathChanged",
285 | "PathModified",
286 | "DirectoryNotEmpty",
287 | "Unit",
288 | "MakeDirectory",
289 | "DirectoryMode",
290 | "TriggerLimitIntervalSec",
291 | "TriggerLimitBurst",
292 | ]
293 |
294 | # from systemd.exec(5)
295 | systemd_exec_directives = [
296 | "ExecSearchPath",
297 | "WorkingDirectory",
298 | "RootDirectory",
299 | "RootImage",
300 | "RootImageOptions",
301 | "RootEphemeral",
302 | "RootHash",
303 | "RootHashSignature",
304 | "RootVerity",
305 | "RootImagePolicy",
306 | "MountImagePolicy",
307 | "ExtensionImagePolicy",
308 | "MountAPIVFS",
309 | "ProtectProc",
310 | "ProcSubset",
311 | "BindPaths",
312 | "BindReadOnlyPaths",
313 | "MountImages",
314 | "ExtensionImages",
315 | "ExtensionDirectories",
316 | "User",
317 | "Group",
318 | "DynamicUser",
319 | "SupplementaryGroups",
320 | "SetLoginEnvironment",
321 | "PAMName",
322 | "CapabilityBoundingSet",
323 | "AmbientCapabilities",
324 | "NoNewPrivileges",
325 | "SecureBits",
326 | "SELinuxContext",
327 | "AppArmorProfile",
328 | "SmackProcessLabel",
329 | "LimitCPU",
330 | "LimitFSIZE",
331 | "LimitDATA",
332 | "LimitSTACK",
333 | "LimitCORE",
334 | "LimitRSS",
335 | "LimitNOFILE",
336 | "LimitAS",
337 | "LimitNPROC",
338 | "LimitMEMLOCK",
339 | "LimitLOCKS",
340 | "LimitSIGPENDING",
341 | "LimitMSGQUEUE",
342 | "LimitNICE",
343 | "LimitRTPRIO",
344 | "LimitRTTIME",
345 | "UMask",
346 | "CoredumpFilter",
347 | "KeyringMode",
348 | "OOMScoreAdjust",
349 | "TimerSlackNSec",
350 | "Personality",
351 | "IgnoreSIGPIPE",
352 | "Nice",
353 | "CPUSchedulingPolicy",
354 | "CPUSchedulingPriority",
355 | "CPUSchedulingResetOnFork",
356 | "CPUAffinity",
357 | "NUMAPolicy",
358 | "NUMAMask",
359 | "IOSchedulingClass",
360 | "IOSchedulingPriority",
361 | "ProtectSystem",
362 | "ProtectHome",
363 | "RuntimeDirectory",
364 | "StateDirectory",
365 | "CacheDirectory",
366 | "LogsDirectory",
367 | "ConfigurationDirectory",
368 | "RuntimeDirectoryMode",
369 | "StateDirectoryMode",
370 | "CacheDirectoryMode",
371 | "LogsDirectoryMode",
372 | "ConfigurationDirectoryMode",
373 | "RuntimeDirectoryPreserve",
374 | "TimeoutCleanSec",
375 | "ReadWritePaths",
376 | "ReadOnlyPaths",
377 | "InaccessiblePaths",
378 | "ExecPaths",
379 | "NoExecPaths",
380 | "TemporaryFileSystem",
381 | "PrivateTmp",
382 | "PrivateDevices",
383 | "PrivateNetwork",
384 | "NetworkNamespacePath",
385 | "PrivateIPC",
386 | "IPCNamespacePath",
387 | "MemoryKSM",
388 | "PrivateUsers",
389 | "ProtectHostname",
390 | "ProtectClock",
391 | "ProtectKernelTunables",
392 | "ProtectKernelModules",
393 | "ProtectKernelLogs",
394 | "ProtectControlGroups",
395 | "RestrictAddressFamilies",
396 | "RestrictFileSystems",
397 | "RestrictNamespaces",
398 | "LockPersonality",
399 | "MemoryDenyWriteExecute",
400 | "RestrictRealtime",
401 | "RestrictSUIDSGID",
402 | "RemoveIPC",
403 | "PrivateMounts",
404 | "MountFlags",
405 | "SystemCallFilter",
406 | "SystemCallErrorNumber",
407 | "SystemCallArchitectures",
408 | "SystemCallLog",
409 | "Environment",
410 | "EnvironmentFile",
411 | "PassEnvironment",
412 | "UnsetEnvironment",
413 | "StandardInput",
414 | "StandardOutput",
415 | "StandardError",
416 | "StandardInputText",
417 | "StandardInputData",
418 | "LogLevelMax",
419 | "LogExtraFields",
420 | "LogRateLimitIntervalSec",
421 | "LogRateLimitBurst",
422 | "LogFilterPatterns",
423 | "LogNamespace",
424 | "SyslogIdentifier",
425 | "SyslogFacility",
426 | "SyslogLevel",
427 | "SyslogLevelPrefix",
428 | "TTYPath",
429 | "TTYReset",
430 | "TTYVHangup",
431 | "TTYRows",
432 | "TTYColumns",
433 | "TTYVTDisallocate",
434 | "LoadCredential",
435 | "LoadCredentialEncrypted",
436 | "ImportCredential",
437 | "SetCredential",
438 | "SetCredentialEncrypted",
439 | "UtmpIdentifier",
440 | "UtmpMode",
441 | ]
442 |
443 | systemd_kill_directives = [
444 | "KillMode",
445 | "KillSignal",
446 | "RestartKillSignal",
447 | "SendSIGHUP",
448 | "SendSIGKILL",
449 | "FinalKillSignal",
450 | "WatchdogSignal",
451 | ]
452 |
--------------------------------------------------------------------------------
/systemd_language_server/server.py:
--------------------------------------------------------------------------------
1 | import logging
2 | import os
3 | import shutil
4 | import sys
5 | from argparse import ArgumentParser
6 |
7 | from lsprotocol.types import (
8 | INITIALIZE,
9 | TEXT_DOCUMENT_COMPLETION,
10 | TEXT_DOCUMENT_HOVER,
11 | CompletionItem,
12 | CompletionItemKind,
13 | CompletionList,
14 | CompletionOptions,
15 | CompletionParams,
16 | Hover,
17 | HoverParams,
18 | InitializedParams,
19 | Position,
20 | Range,
21 | )
22 | from pygls.server import LanguageServer
23 | from pygls.workspace import TextDocument
24 |
25 | from .unit import (
26 | UnitFileSection,
27 | UnitType,
28 | get_current_section,
29 | get_directives,
30 | get_documentation_content,
31 | get_unit_type,
32 | unit_type_to_unit_file_section,
33 | )
34 |
35 | logger = logging.getLogger("systemd_language_server")
36 | handler = logging.StreamHandler(sys.stderr)
37 | formatter = logging.Formatter("[%(levelname)s] %(message)s")
38 | handler.setFormatter(formatter)
39 | logger.addHandler(handler)
40 |
41 |
42 | class SystemdLanguageServer(LanguageServer):
43 | has_pandoc: bool = False
44 |
45 | def __init__(self, *args, **kwargs):
46 | super().__init__(*args, **kwargs)
47 | self.has_pandoc = shutil.which("pandoc") is not None
48 |
49 | # perhaps bizarrely, pygls LSP implementation forces dynamic feature registration
50 | # which frustrates a more tradition OOP design
51 |
52 | @self.feature(INITIALIZE)
53 | def initialize(params: InitializedParams):
54 | pass
55 |
56 | @self.feature(
57 | TEXT_DOCUMENT_COMPLETION, CompletionOptions(trigger_characters=["[', '="])
58 | )
59 | def textDocument_completion(params: CompletionParams) -> CompletionList | None:
60 | """Complete systemd unit properties. Determine the required completion type and
61 | dispatch it."""
62 | items = []
63 | uri = params.text_document.uri
64 | document = self.workspace.get_text_document(uri)
65 | current_line = document.lines[params.position.line].strip()
66 | unit_type = get_unit_type(document)
67 | section = get_current_section(document, params.position)
68 |
69 | if current_line == "[":
70 | return complete_unit_file_section(params, unit_type)
71 | elif "=" not in current_line:
72 | return complete_directive(params, unit_type, section, current_line)
73 | elif len(current_line.split("=")) == 2:
74 | return complete_directive_property(
75 | params, unit_type, section, current_line
76 | )
77 |
78 | @self.feature(TEXT_DOCUMENT_HOVER)
79 | def textDocument_hover(params: HoverParams):
80 | """Help for unit file directives."""
81 | document = self.workspace.get_text_document(params.text_document.uri)
82 | current_line = document.lines[params.position.line].strip()
83 | unit_type = get_unit_type(document)
84 | section = get_current_section(document, params.position)
85 |
86 | if "=" in current_line:
87 | directive = current_line.split("=")[0]
88 | hover_range = range_for_directive(document, params.position)
89 | contents = get_documentation_content(
90 | directive, unit_type, section, self.has_pandoc
91 | )
92 | if contents is None:
93 | return None
94 | return Hover(contents=contents, range=hover_range)
95 |
96 |
97 | server = SystemdLanguageServer("systemd-language-server", "v0.1")
98 |
99 |
100 | def complete_unit_file_section(params: CompletionParams, unit_type: UnitType):
101 | possible_sections = [UnitFileSection.install, UnitFileSection.unit]
102 | section = unit_type_to_unit_file_section(unit_type)
103 | if section is not None:
104 | possible_sections.append(section)
105 | items = [
106 | CompletionItem(
107 | label=sec.value, insert_text=sec.value + "]", kind=CompletionItemKind.Struct
108 | )
109 | for sec in possible_sections
110 | ]
111 | return CompletionList(is_incomplete=False, items=items)
112 |
113 |
114 | def complete_directive_property(
115 | params: CompletionParams,
116 | unit_type: UnitType,
117 | section: UnitFileSection | None,
118 | current_line: str,
119 | ):
120 | directive = current_line.split("=")[0]
121 | pass
122 |
123 |
124 | def complete_directive(
125 | params: CompletionParams,
126 | unit_type: UnitType,
127 | section: UnitFileSection | None,
128 | current_line: str,
129 | ):
130 | directives = get_directives(unit_type, section)
131 | items = [
132 | CompletionItem(label=s, insert_text=s + "=", kind=CompletionItemKind.Property)
133 | for s in directives
134 | if s.startswith(current_line)
135 | ]
136 | return CompletionList(is_incomplete=False, items=items)
137 |
138 |
139 | def range_for_directive(document: TextDocument, position: Position) -> Range:
140 | """Range indicating directive (before =)"""
141 | current_line = document.lines[position.line].strip()
142 | idx = current_line.find("=")
143 | return Range(Position(position.line, 0), Position(position.line, idx - 1))
144 |
145 |
146 | def get_parser():
147 | parser = ArgumentParser()
148 | parser.add_argument(
149 | "--log-level",
150 | type=str,
151 | default="info",
152 | choices=["debug", "info", "warning", "error", "critical"],
153 | )
154 | return parser
155 |
156 |
157 | def main():
158 | parser = get_parser()
159 | args = parser.parse_args(sys.argv[1:])
160 |
161 | if args.log_level is not None:
162 | pygls_logger = logging.getLogger("pygls.server")
163 | pygls_logger.setLevel(args.log_level.upper())
164 | logger.setLevel(args.log_level.upper())
165 |
166 | if os.isatty(sys.stdout.fileno()):
167 | logger.warning(
168 | "systemd-language-server is running from a TTY. "
169 | "Usually you want to integrate it to be launched by a text editor."
170 | )
171 |
172 | server.start_io()
173 |
--------------------------------------------------------------------------------
/systemd_language_server/unit.py:
--------------------------------------------------------------------------------
1 | import re
2 | import subprocess
3 | from enum import Enum
4 | from glob import glob
5 | from io import StringIO
6 | from pathlib import Path
7 |
8 | from lsprotocol.types import MarkupContent, MarkupKind, Position
9 | from lxml import etree # type: ignore
10 | from pygls.workspace import TextDocument
11 |
12 | from .constants import (
13 | systemd_automount_directives,
14 | systemd_exec_directives,
15 | systemd_install_directives,
16 | systemd_kill_directives,
17 | systemd_mount_directives,
18 | systemd_path_directives,
19 | systemd_scope_directives,
20 | systemd_service_directives,
21 | systemd_socket_directives,
22 | systemd_swap_directives,
23 | systemd_timer_directives,
24 | systemd_unit_directives,
25 | )
26 |
27 | # The ultimate source for information on unit files is the docbook files distributed with
28 | # systemd. Therefore, the following data is managed by the language server:
29 | # - unit type
30 | # - unit file sections
31 | # - directives
32 | # - directive values
33 | # - which docbook (.xml) directives are documented in
34 | # Data is resolved at runtime, to the extent possible, therefore docbooks are bundled
35 | # with systemd-language-server and parsed as required.
36 |
37 | SECTION_HEADER_PROG = re.compile(r"^\[(?P\w+)\]$")
38 |
39 |
40 | class UnitType(Enum):
41 | service = "service"
42 | socket = "socket"
43 | device = "device"
44 | mount = "mount"
45 | automount = "automount"
46 | swap = "swap"
47 | target = "target"
48 | path = "path"
49 | timer = "timer"
50 | slice = "slice"
51 | scope = "scope"
52 |
53 | def is_execable(self):
54 | return self in [
55 | UnitType.service,
56 | UnitType.socket,
57 | UnitType.mount,
58 | UnitType.swap,
59 | ]
60 |
61 |
62 | class UnitFileSection(Enum):
63 | unit = "Unit"
64 | install = "Install"
65 | service = "Service"
66 | socket = "Socket"
67 | mount = "Mount"
68 | automount = "Automount"
69 | scope = "Scope"
70 | swap = "Swap"
71 | path = "Path"
72 | timer = "Timer"
73 |
74 |
75 | _assets_dir = Path(__file__).absolute().parent / "assets"
76 | docbooks = glob("*.xml", root_dir=_assets_dir)
77 |
78 | # dict mapping docbook documentation file to the list of systemd unit directives
79 | # documented within
80 | directives = dict()
81 |
82 |
83 | def initialize_directive():
84 | for filename in docbooks:
85 | docbook_file = _assets_dir / filename
86 | tree = etree.parse(open(docbook_file).read())
87 | directives[filename] = tree.xpath()
88 | # TODO 10/02/20 psacawa: finish this
89 |
90 |
91 | def unit_type_to_unit_file_section(ut: UnitType) -> UnitFileSection | None:
92 | try:
93 | return UnitFileSection(ut.value.capitalize())
94 | except Exception:
95 | return None
96 |
97 |
98 | def unit_file_section_to_unit_type(ufs: UnitFileSection) -> UnitType | None:
99 | try:
100 | return UnitType(ufs.value.lower())
101 | except Exception:
102 | return None
103 |
104 |
105 | directive_dict = {
106 | UnitFileSection.service: systemd_service_directives,
107 | UnitFileSection.timer: systemd_timer_directives,
108 | UnitFileSection.socket: systemd_socket_directives,
109 | UnitFileSection.mount: systemd_mount_directives,
110 | UnitFileSection.automount: systemd_automount_directives,
111 | UnitFileSection.swap: systemd_swap_directives,
112 | UnitFileSection.path: systemd_path_directives,
113 | UnitFileSection.scope: systemd_scope_directives,
114 | }
115 |
116 |
117 | def convert_to_markdown(raw_varlistentry: bytes):
118 | """Use pandoc to convert docbook entry to markdown"""
119 | argv = "pandoc --from=docbook --to markdown -".split()
120 | proc = subprocess.run(argv, input=raw_varlistentry, stdout=subprocess.PIPE)
121 | return proc.stdout.decode()
122 |
123 |
124 | def get_documentation_content(
125 | directive: str,
126 | unit_type: UnitType,
127 | section: UnitFileSection | None,
128 | markdown_available=False,
129 | ) -> MarkupContent | None:
130 | """Get documentation for unit file directive."""
131 | docbooks = get_manual_sections(unit_type, section)
132 | for manual in docbooks:
133 | filepath = _assets_dir / manual
134 | stream = StringIO(open(filepath).read())
135 | tree = etree.parse(stream)
136 | for varlistentry in tree.xpath("//varlistentry"):
137 | directives_in_varlist: list[str] = [
138 | varname.text.strip("=")
139 | for varname in varlistentry.findall(".//term/varname")
140 | ]
141 | if directive not in directives_in_varlist:
142 | continue
143 | raw_varlistentry = etree.tostring(varlistentry)
144 | value = bytes()
145 | kind: MarkupKind
146 | if markdown_available:
147 | kind = MarkupKind.Markdown
148 | value = convert_to_markdown(raw_varlistentry)
149 | else:
150 | kind = MarkupKind.PlainText
151 | value = "".join((varlistentry.itertext()))
152 |
153 | return MarkupContent(kind=kind, value=value)
154 | return None
155 |
156 |
157 | def get_manual_sections(unit_type: UnitType, section: UnitFileSection | None):
158 | """Determine which docbook to search for documentation, based on unit type and file
159 | section. If no section is provided, search liberally, search liberally."""
160 | if section in [UnitFileSection.unit, UnitFileSection.install]:
161 | return ["systemd.unit.xml"]
162 | ret = ["systemd.{}.xml".format(unit_type.value.lower())]
163 | if section is None:
164 | ret += ["systemd.unit.xml", "systemd.install.xml"]
165 | if unit_type.is_execable():
166 | ret += ["systemd.exec.xml", "systemd.kill.xml"]
167 | return ret
168 |
169 |
170 | def get_directives(unit_type: UnitType, section: UnitFileSection | None) -> list[str]:
171 | # Two variants: i) the current unit file section is known, ii) it isn't (e.g. buffer
172 | # has no section headers yet). If it is, we supply completions value for the unit
173 | # type/section. Otherwise, we supply those valid for all sections.
174 | if section == UnitFileSection.unit:
175 | return systemd_unit_directives
176 | if section == UnitFileSection.install:
177 | return systemd_install_directives
178 |
179 | directives: list[str] = []
180 | if section is None:
181 | # if unit type has a corresponding unit file section, add it
182 | section_from_type = unit_type_to_unit_file_section(unit_type)
183 | if section_from_type is not None:
184 | directives += directive_dict[section_from_type]
185 | directives += systemd_unit_directives + systemd_install_directives
186 | else:
187 | directives = directive_dict[section]
188 |
189 | if unit_type.is_execable():
190 | directives += systemd_exec_directives + systemd_kill_directives
191 | return directives
192 |
193 |
194 | def get_unit_type(document):
195 | return UnitType(Path(document.uri).suffix.strip("."))
196 |
197 |
198 | def get_current_section(
199 | document: TextDocument, position: Position
200 | ) -> UnitFileSection | None:
201 | """Determine section of cursor in current document"""
202 |
203 | for i in reversed(range(0, position.line)):
204 | line = document.lines[i].strip()
205 | match = SECTION_HEADER_PROG.search(line)
206 | if match is not None:
207 | try:
208 | section = UnitFileSection(match.group("name"))
209 | return section
210 | except ValueError:
211 | pass
212 | return None
213 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psacawa/systemd-language-server/418a8e220fe489f5a846d687e9a0409ec4ec47c8/tests/__init__.py
--------------------------------------------------------------------------------
/tests/conftest.py:
--------------------------------------------------------------------------------
1 | import os
2 | from threading import Thread
3 | from typing import Iterable
4 |
5 | import pytest
6 | from lsprotocol.types import EXIT, SHUTDOWN
7 | from pygls.server import LanguageServer
8 |
9 | from systemd_language_server.server import SystemdLanguageServer
10 |
11 |
12 | @pytest.fixture()
13 | def client_server_pair() -> Iterable[tuple[LanguageServer, SystemdLanguageServer]]:
14 | """
15 | Fixture to create a client and server in their own threads communicating over a pair
16 | of pipes. Inspired by pygls.tests. client_server
17 | """
18 | r_cs, w_cs = os.pipe()
19 | r_sc, w_sc = os.pipe()
20 |
21 | thread_main = lambda client_or_server, read, write: client_or_server.start_io(
22 | os.fdopen(read, "rb"), os.fdopen(write, "wb")
23 | )
24 | client = LanguageServer("client", "v1")
25 | client_thread = Thread(target=thread_main, args=[client, r_sc, w_cs])
26 | client_thread.start()
27 |
28 | server = SystemdLanguageServer("systemd-server", "v0")
29 | server_thread = Thread(target=thread_main, args=[server, r_cs, w_sc])
30 | server_thread.start()
31 |
32 | # pytest stupid solution for fixture teardown is python genertors: the first yielded
33 | # value is the fixture, then the fixture is deconstructed
34 | yield client, server
35 |
36 | client.lsp.send_request(SHUTDOWN)
37 | client.lsp.notify(EXIT)
38 | client_thread.join()
39 | server_thread.join()
40 |
--------------------------------------------------------------------------------
/tests/data/test.mount:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psacawa/systemd-language-server/418a8e220fe489f5a846d687e9a0409ec4ec47c8/tests/data/test.mount
--------------------------------------------------------------------------------
/tests/data/test.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 |
3 |
--------------------------------------------------------------------------------
/tests/data/test.socket:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psacawa/systemd-language-server/418a8e220fe489f5a846d687e9a0409ec4ec47c8/tests/data/test.socket
--------------------------------------------------------------------------------
/tests/data/test.timer:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/psacawa/systemd-language-server/418a8e220fe489f5a846d687e9a0409ec4ec47c8/tests/data/test.timer
--------------------------------------------------------------------------------
/tests/test_server.py:
--------------------------------------------------------------------------------
1 | import re
2 | from concurrent.futures import TimeoutError
3 | from dataclasses import dataclass
4 | from pathlib import Path
5 |
6 | import pytest
7 | from lsprotocol.types import (
8 | INITIALIZE,
9 | TEXT_DOCUMENT_COMPLETION,
10 | TEXT_DOCUMENT_DID_CHANGE,
11 | TEXT_DOCUMENT_DID_OPEN,
12 | TEXT_DOCUMENT_HOVER,
13 | ClientCapabilities,
14 | CompletionList,
15 | CompletionParams,
16 | DidChangeTextDocumentParams,
17 | DidOpenTextDocumentParams,
18 | Hover,
19 | HoverParams,
20 | InitializeParams,
21 | MarkupContent,
22 | MarkupKind,
23 | Position,
24 | TextDocumentContentChangeEvent_Type2,
25 | TextDocumentIdentifier,
26 | TextDocumentItem,
27 | VersionedTextDocumentIdentifier,
28 | )
29 | from pygls.server import LanguageServer
30 |
31 | from systemd_language_server.server import SystemdLanguageServer
32 |
33 | ClientServerPair = tuple[LanguageServer, SystemdLanguageServer]
34 |
35 | MAX_SERVER_INIT_RETRIES = 5
36 |
37 |
38 | def client_init(client: LanguageServer, datadir: Path):
39 | for _ in range(MAX_SERVER_INIT_RETRIES):
40 | try:
41 | client.lsp.send_request(
42 | INITIALIZE,
43 | InitializeParams(
44 | process_id=123,
45 | root_uri=datadir.as_uri(),
46 | capabilities=ClientCapabilities(),
47 | ),
48 | ).result(timeout=1)
49 | except TimeoutError:
50 | pass
51 | except:
52 | break
53 |
54 |
55 | def client_open(client: LanguageServer, path: Path, text: str | None = None):
56 | if text is None:
57 | text = path.read_text()
58 | client.lsp.notify(
59 | TEXT_DOCUMENT_DID_OPEN,
60 | DidOpenTextDocumentParams(
61 | TextDocumentItem(
62 | text=text, uri=path.as_uri(), language_id="systemd", version=1
63 | ),
64 | ),
65 | )
66 |
67 |
68 | @dataclass
69 | class CompletionTestParams:
70 | filename: str | None
71 | text: str
72 | position: tuple[int, int]
73 | contains_completion_labels: list[str]
74 | excludes_completion_labels: list[str]
75 |
76 |
77 | # WorkingDirectory - systmed.exec.xml
78 | # ExecStart - systmed.service.xml
79 | # KillMode - systmed.kill.xml
80 |
81 | no_section_test = CompletionTestParams(
82 | "test.service",
83 | "\n\n",
84 | (1, 0),
85 | ["Description", "ExecStart", "WorkingDirectory", "WantedBy", "KillMode"],
86 | [],
87 | )
88 | unit_section_test = CompletionTestParams(
89 | "test.service",
90 | "[Unit]\n\n",
91 | (1, 0),
92 | ["Description"],
93 | ["ExecStart", "WorkingDirectory", "WantedBy", "KillMode"],
94 | )
95 | install_section_test = CompletionTestParams(
96 | "test.service",
97 | "[Install]\n\n",
98 | (1, 0),
99 | ["WantedBy"],
100 | ["Description", "WorkingDirectory", "ExecStart", "KillMode"],
101 | )
102 | service_section_test = CompletionTestParams(
103 | "test.service",
104 | "[Service]\n\n",
105 | (1, 0),
106 | ["ExecStart", "WorkingDirectory", "KillMode"],
107 | ["Description", "WantedBy"],
108 | )
109 | socket_section_test = CompletionTestParams(
110 | "test.socket",
111 | "[Socket]\n\n",
112 | (1, 0),
113 | ["ListenStream", "WorkingDirectory", "KillMode"],
114 | ["ExecStart", "Description", "WantedBy"],
115 | )
116 | mount_section_test = CompletionTestParams(
117 | "test.mount",
118 | "[Mount]\n\n",
119 | (1, 0),
120 | ["What", "Where", "WorkingDirectory", "KillMode"],
121 | ["ExecStart", "Description", "WantedBy"],
122 | )
123 | timer_section_test = CompletionTestParams(
124 | "test.timer",
125 | "[Timer]\n\n",
126 | (1, 0),
127 | ["OnCalendar"],
128 | ["ExecStart", "Description", "WantedBy"],
129 | )
130 |
131 | # completing "Exec"... in [Service] works as intended
132 | service_directive_test = CompletionTestParams(
133 | "test.service",
134 | "[Service]\nExec\n",
135 | (1, 4),
136 | ["ExecStart", "ExecStartPre", "ExecStartPost"],
137 | ["WorkingDirectory", "KillMode"],
138 | )
139 |
140 |
141 | @pytest.mark.parametrize(
142 | "params",
143 | [
144 | no_section_test,
145 | unit_section_test,
146 | install_section_test,
147 | service_section_test,
148 | socket_section_test,
149 | mount_section_test,
150 | timer_section_test,
151 | service_directive_test,
152 | ],
153 | )
154 | def test_completion(client_server_pair: ClientServerPair, params: CompletionTestParams):
155 | client, server = client_server_pair
156 |
157 | datadir = Path(__file__).parent / "data"
158 | assert params.filename is not None
159 | unit_file = datadir / params.filename
160 | uri = unit_file.as_uri()
161 |
162 | client_init(client, datadir)
163 | client_open(client, unit_file)
164 |
165 | client.lsp.notify(
166 | TEXT_DOCUMENT_DID_CHANGE,
167 | params=DidChangeTextDocumentParams(
168 | text_document=VersionedTextDocumentIdentifier(version=1, uri=uri),
169 | content_changes=[TextDocumentContentChangeEvent_Type2(text=params.text)],
170 | ),
171 | )
172 |
173 | completion_list: CompletionList = client.lsp.send_request(
174 | TEXT_DOCUMENT_COMPLETION,
175 | params=CompletionParams(
176 | text_document=TextDocumentIdentifier(uri=uri),
177 | position=Position(*params.position),
178 | context=None,
179 | ),
180 | ).result(timeout=1)
181 | assert isinstance(completion_list, CompletionList)
182 | labels = [i.label for i in completion_list.items]
183 | for contained_label in params.contains_completion_labels:
184 | assert contained_label in labels
185 | for excluded_label in params.excludes_completion_labels:
186 | assert not excluded_label in labels
187 |
188 |
189 | @dataclass
190 | class HoverTestParams:
191 | filename: str | None
192 | text: str
193 | position: tuple[int, int]
194 | has_pandoc: bool
195 | pattern_returned: str | None
196 |
197 |
198 | execstart_hover_markdown_test = HoverTestParams(
199 | "test.service",
200 | "[Service]\nExecStart=\n\n",
201 | (1, 0),
202 | True,
203 | r"Unless `Type=` is `oneshot`", # from systemd.service.xml,
204 | )
205 | unit_hover_test = HoverTestParams(
206 | "test.service",
207 | "[Unit]\nDescription=\n\n",
208 | (1, 0),
209 | False,
210 | r"A short human readable title", # from systemd.unit.xml,
211 | )
212 | service_hover_test = HoverTestParams(
213 | "test.service",
214 | "[Service]\nExecStart=\n\n",
215 | (1, 0),
216 | False,
217 | r"Commands that are executed when this service is started.", # from systemd.service.xml,
218 | )
219 | kill_hover_test = HoverTestParams(
220 | "test.service",
221 | "[Service]\nKillMode=\n\n",
222 | (1, 0),
223 | False,
224 | r"Specifies how processes", # from systemd.kill.xml,
225 | )
226 | install_hover_test = HoverTestParams(
227 | "test.service",
228 | "[Install]\nWantedBy=\n\n",
229 | (1, 0),
230 | False,
231 | r"This option may be used more than once,", # from systemd.unit.xml,
232 | )
233 |
234 | fake_directive_hover_test = HoverTestParams(
235 | "test.service", "[Install]\nFakeDirective=\n\n", (1, 0), False, None
236 | )
237 | wrong_section_hover_test = HoverTestParams(
238 | "test.service", "[Install]\nExecStart=\n\n", (1, 0), False, None
239 | )
240 |
241 |
242 | @pytest.mark.parametrize(
243 | "params",
244 | [
245 | execstart_hover_markdown_test,
246 | unit_hover_test,
247 | service_hover_test,
248 | kill_hover_test,
249 | install_hover_test,
250 | fake_directive_hover_test,
251 | wrong_section_hover_test,
252 | ],
253 | )
254 | def test_hover(client_server_pair: ClientServerPair, params: HoverTestParams):
255 | client, server = client_server_pair
256 | server.has_pandoc = params.has_pandoc
257 |
258 | datadir = Path(__file__).parent / "data"
259 | assert params.filename is not None
260 | unit_file = datadir / params.filename
261 | uri = unit_file.as_uri()
262 |
263 | client_init(client, datadir)
264 | client_open(client, unit_file)
265 |
266 | client.lsp.notify(
267 | TEXT_DOCUMENT_DID_CHANGE,
268 | params=DidChangeTextDocumentParams(
269 | text_document=VersionedTextDocumentIdentifier(version=1, uri=uri),
270 | content_changes=[TextDocumentContentChangeEvent_Type2(text=params.text)],
271 | ),
272 | )
273 |
274 | hover: Hover = client.lsp.send_request(
275 | TEXT_DOCUMENT_HOVER,
276 | params=HoverParams(
277 | text_document=TextDocumentIdentifier(uri=uri),
278 | position=Position(*params.position),
279 | ),
280 | ).result(timeout=1)
281 |
282 | if params.pattern_returned is None:
283 | assert hover is None
284 | return
285 |
286 | assert isinstance(hover, Hover)
287 |
288 | content = hover.contents
289 | assert isinstance(content, MarkupContent)
290 | assert (content.kind == MarkupKind.Markdown) == params.has_pandoc
291 | assert re.search(params.pattern_returned, content.value) is not None
292 |
--------------------------------------------------------------------------------