You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: EXTENDING.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,13 +11,19 @@ To avoid naming conflicts, all hook-related settings and config sections must be
11
11
12
12
It is recommended to use the package name containing the hook as a namespace.
13
13
14
+
Settings keys in `[settings]` and package sections are namespaced with a `namespace-` prefix.
15
+
Dedicated hook config sections are named either exactly `[namespace]` or `[namespace:subsection]`.
16
+
The `:` separator is used on purpose: it cannot occur in a package name, so a hook namespace
17
+
can never accidentally claim a package section whose name merely starts with the same letters
18
+
(e.g. a `uv` hook must not swallow a package named `uvst.addon`).
19
+
14
20
This looks like so:
15
21
16
22
```INI
17
23
[settings]
18
24
myextension-global_setting = 1
19
25
20
-
[myextension-section]
26
+
[myextension:section]
21
27
setting = value
22
28
23
29
[foo.bar]
@@ -49,7 +55,7 @@ class MyExtension(Hook):
49
55
50
56
# Example: Access hook-specific sections
51
57
for section_name, section_config in state.configuration.hooks.items():
52
-
if section_name.startswith('myextension-'):
58
+
if section_name=='myextension'or section_name.startswith('myextension:'):
53
59
# Process your hook's configuration
54
60
pass
55
61
@@ -100,7 +106,7 @@ Replace:
100
106
101
107
- Use your package name as namespace prefix
102
108
- All settings: `namespace-setting_name`
103
-
- All sections: `[namespace-section]`
109
+
- All sections: `[namespace]` or `[namespace:section]` (the `:` separator cannot occur in a package name, so it prevents collisions with package sections)
0 commit comments