2
2
3
3
![ Logo] ( resources/logo.png )
4
4
5
- This is a Visual Studio Code extension to assist PostgreSQL source code developers.
6
- It allows to investigate ` Node * ` variables to obtain it's real type based on ` NodeTag `
7
- and provide some other utilities.
5
+ This is a Visual Studio Code extension to assist PostgreSQL source code
6
+ developers. It allows to investigate ` Node * ` variables to obtain it's real type
7
+ based on ` NodeTag ` and provide some other utilities.
8
8
9
9
## Features
10
10
@@ -18,27 +18,37 @@ They appear in separate action view.
18
18
![ Overview of extension] ( resources/overview.gif )
19
19
20
20
It behaves like Debug->Variables view, but no colorization (limitations of VS
21
- Code Extension framework) and automatically detects real type of ` Node * ` variables.
21
+ Code Extension framework) and automatically detects real type of ` Node * `
22
+ variables.
22
23
23
- Also, there are intrinsics for some types:
24
+ ### Show contents of containers
24
25
25
- - ` List ` elements are displayed according their types
26
+ Extension support showing contents of containers: ` List ` (including subtypes)
27
+ and ` Bitmapset ` .
26
28
27
29
![ List * expansion] ( resources/list.gif )
28
30
29
- - Support for special members like ` PlannerInfo->simple_rel_array ` - array is
30
- displayed using it's length
31
+ ` Bitmapset ` elements are displayed:
32
+
33
+ - ` $elements$ ` - elements of set (array of integers)
34
+ - ` $length$ ` - number of entries in set
35
+
36
+ ![ Bitmapset expansion] ( resources/bitmapset.gif )
37
+
38
+ Also, there is support for C-arrays (like ` PlannerInfo->simple_rel_array ` ) -
39
+ array is displayed using it's length.
31
40
32
41
![ Planner expansion] ( resources/planner.gif )
33
42
34
- Currently, there are 36 registered special members, but you can add your own
43
+ Currently, there are 36 registered array members, but you can add your own
35
44
using [ pgsql_hacker_helper.json] ( #pgsql_hacker_helperjson ) configuration file.
36
45
37
- - ` Bitmapset ` elements are displayed:
38
- - ` $elements$ ` - elements of set (array of integers)
39
- - ` $length$ ` - number of entries in set
46
+ ### Show where Bitmapset references
40
47
41
- ![ Bitmapset expansion] ( resources/bitmapset.gif )
48
+ ` Bitmapset ` and ` Relids ` often store indexes of other elements in other places.
49
+ Extension knows 53 such elements. I.e. ` PlannerInfo->all_relids ` or ` RelOptInfo->eclass_indexes ` .
50
+
51
+ ![ Bitmapset references] ( resources/bitmapset-refs.gif )
42
52
43
53
### Dump ` Node * ` state to log
44
54
@@ -48,6 +58,41 @@ context menu you also will be able to do so.
48
58
49
59
![ call pprint] ( resources/dump.gif )
50
60
61
+ ### Formatting
62
+
63
+ Extension uses ` pgindent ` for formatting C code. It integrates with VS Code
64
+ extension and available with ` Format Document ` or ` Ctrl + Shift + I ` shortcut
65
+ (or another key binding if overridden).
66
+
67
+ To enable this set formatter for C in settings (i.e. ` .vscode/settings.json `
68
+ for workspace):
69
+
70
+ ``` json
71
+ {
72
+ "[c]" : {
73
+ "editor.defaultFormatter" : " ash-blade.postgresql-hacker-helper"
74
+ }
75
+ }
76
+ ```
77
+
78
+ Or specify formatter manually using ` Format Document With... ` . Select
79
+ ` PostgreSQL Hacker Helper ` in pick up box.
80
+
81
+ ![ Formatter work] ( resources/formatter-work.gif )
82
+
83
+ Feature supported for PostgreSQL starting from 10 version.
84
+
85
+ > This feature using tools from ` src/tools ` . If they are unavailable extension
86
+ > will try to build or download them.
87
+ >
88
+ > Primary tool required is ` pg_bsd_indent ` . If PostgreSQL version lower than
89
+ > 16 extension will ask you for ` pg_config ` path - it is required to build
90
+ > ` pg_bsd_indent ` .
91
+ > Look for warning message from extension in left bottom corner.
92
+
93
+ Using command ` PgSQL: Show diff preview for PostgreSQL formatter ` you can
94
+ preview changes made by formatter.
95
+
51
96
## Customization
52
97
53
98
### pgsql_hacker_helper.json
@@ -98,12 +143,17 @@ For more info check [configuration file documentation](./docs/config_file.md).
98
143
99
144
## Extension Settings
100
145
101
- There are 2 settings:
146
+ There are 3 settings:
102
147
103
148
- Log level - set minimum level of log messages in Output channel.
104
- By default - ` INFO `
149
+ By default - ` INFO ` (if using VS Code 1.74.0 ang greater use ` Output ` channel
150
+ logger settings)
105
151
- Files with NodeTag files - list of paths points to files that contain NodeTags.
106
152
By default - ` src/include/nodes/nodes.h ` , ` src/include/nodes/nodetags.h `
153
+ - Custom path to ` pg_bsd_indent ` . Use it if you have pg_bsd_indent installed
154
+ globally. If not specified, it will be searched in ` src/tools ` directory.
155
+ If required, it will be downloaded and installed (` wget ` required to download
156
+ sources)
107
157
108
158
## Compatibility
109
159
@@ -122,6 +172,8 @@ Also, extension will target latest VS Code version and try to use the full
122
172
functionality of new versions. So, use latest VS Code versions to get new
123
173
features earlier.
124
174
175
+ For using formatter minimal supported version is ` 10 ` .
176
+
125
177
## Known Issues
126
178
127
179
Known issues:
@@ -138,6 +190,16 @@ Known issues:
138
190
139
191
## Release Notes
140
192
193
+ ### 1.3.0
194
+
195
+ Add formatting functionality using ` pg_bsd_indent ` integrated with VS Code:
196
+ can use with ` Format Document ` command or ` Ctrl + Shift + I ` (keybinding).
197
+
198
+ Add showing ` RangeTblEntry ` and ` RelOptInfo ` to which Bitmapset points.
199
+ ` RangeTblEntry ` shown from ` Query->rtable ` , ` RelOptInfo ` - from
200
+ ` PlannerInfo->simple_rel_array ` . Referencing also available for other Bitmapsets
201
+ which points not to rte or rel.
202
+
141
203
### 1.2.1
142
204
143
205
Add check for breakpoint in ` bms_first_member ` to avoid infinite loop.
@@ -194,7 +256,8 @@ Add more special members.
194
256
195
257
Separate json configuration file to add your own special members.
196
258
197
- Specifying real NodeTag in variable name if it differs from declared type. Shows in square brackets.
259
+ Specifying real NodeTag in variable name if it differs from declared type. Shows
260
+ in square brackets.
198
261
199
262
Setup logging infrastructure. Availability to change minimum log level.
200
263
@@ -214,4 +277,5 @@ Call `pprint(Node *)` on selected variable in `Variables` view.
214
277
215
278
## Contributing
216
279
217
- Go to [ Issues] ( https://github.com/ashenBlade/postgres-dev-helper/issues ) if you want to say something: bugs, features, etc...
280
+ Go to [ Issues] ( https://github.com/ashenBlade/postgres-dev-helper/issues ) if you
281
+ want to say something: bugs, features, etc...
0 commit comments