date |
---|
2025-01-06 |
[Pull Request][pr] & [Issues][issues]
<project-root>
+ artifacts/vscode contains built *.vsix extension file and list file
+ cache a generated directory for cached http response
+ docs documents for development
+ out a directory for built source code
+ scripts contains some miscellaneous scripts for this project
+ src
+ analyzer contains some cli tools for analyzing the hint data and documents
+ assets contains the icon of this extension
+ commands source code related to Visual Studio Code commands
+ config source code related to Visual Studio Code configurations
+ docs source code for transforming and generating documents for displaying
+ hint-data
+ custom-directives contains manually maintained systemd directive data,
for those deprecated, removed, custom directives
+ custom-value-enum contains manually maintained systemd enumeration value data,
for value auto-completion
+ fetch scripts for fetching hint-data/enumeration/docs
- systemd-all.ts
+ manager managers for loading and searching hint-data
+ manifest contains generated hint-data manifest json files
+ lint contains some linting rules and source code of linting process
+ parser-v2 a parser for systemd unit file, mkosi file and podman quadlet unit files
+ parser old parser source code
+ syntax systemd configuration grammar files (tmLanguage) and its generator
- systemd.tmLanguage
- generate-tmLanguage.ts
+ utils utilities
- build-contributes.ts a generator for VSCode-related fields in package.json
- index.ts the entry point of this extension
+ test
- ts a script for executing any Typescript file in this project
Note
- Only Node.js LTS versions are supported
- The classic yarn cannot be used in this project.
- https://code.visualstudio.com/api
- The difference between web extension and desktop extension: https://code.visualstudio.com/api/extension-guides/web-extensions
git clone https://github.com/hangxingliu/vscode-systemd.git
cd vscode-systemd
# Install full dependencies:
yarn install
# OR You can install without optional dependencies:
# These optional dependencies will not break the building of this project,
# but they are used for linting, testing, and release
yarn install --ignore-optional
After executing commands such as yarn build:ts
or webpack
,
the built/bundled source code will be generated into the out
directory.
Up to now, the out
directory contains two distinct types of file structures:
- Bundled by the command
webpack
(or package scriptsbuild
,build:webpack
). In this scenario, the directory contains only a few files, including a bundled script file namedindex.js
, asset files, and language grammar files.
- This structure is intended for the bundled extension, ensuring that no unnecessary files are included in the final extension file.
- Built using the command
swc
(or package scriptbuild:ts
). Here, the directory holds many built JavaScript files alongside other files.
- This structure is advantageous for development and debugging purposes.
To clean the out
directory, you can execute the package script clean
(yarn run clean
)
# This package script `build` does the following tasks:
# 1. clean up the `out` directory for previously generated files.
# 2. bundle the script by the `webpack` command.
# 3. copy asset files into the `out` directory
yarn run build
./ts src/path/to/typescript-file.ts
# debug mode:
./ts inspect src/path/to/typescript-file.ts
./ts --inspect-brk src/path/to/typescript-file.ts
The entrypoint of the grammar syntax rules: src/syntax/syntax.ts
Executing the generator src/syntax/generate-tmLanguage.ts
to generate systemd.tmLanguage
xml file from the grammar syntax rules.
yarn build:ts && yarn build build:syntax
Please check out the document UPDATE-HINT-DATA.md for more information about how to update all hint data (systemd documents, directives, ...) to the latest and the relevant SOP.
Please take a look at the file src/syntax/const-sections.ts
Please add/modify them in the directory src/hint-data/custom-directives
Please add/modify them in the directory src/hint-data/custom-value-enum