22
33![ Logo] ( resources/logo.png )
44
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.
88
99## Features
1010
@@ -18,27 +18,37 @@ They appear in separate action view.
1818![ Overview of extension] ( resources/overview.gif )
1919
2020It 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.
2223
23- Also, there are intrinsics for some types:
24+ ### Show contents of containers
2425
25- - ` List ` elements are displayed according their types
26+ Extension support showing contents of containers: ` List ` (including subtypes)
27+ and ` Bitmapset ` .
2628
2729![ List * expansion] ( resources/list.gif )
2830
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.
3140
3241![ Planner expansion] ( resources/planner.gif )
3342
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
3544using [ pgsql_hacker_helper.json] ( #pgsql_hacker_helperjson ) configuration file.
3645
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
4047
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 )
4252
4353### Dump ` Node * ` state to log
4454
@@ -48,6 +58,41 @@ context menu you also will be able to do so.
4858
4959![ call pprint] ( resources/dump.gif )
5060
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+
5196## Customization
5297
5398### pgsql_hacker_helper.json
@@ -98,12 +143,17 @@ For more info check [configuration file documentation](./docs/config_file.md).
98143
99144## Extension Settings
100145
101- There are 2 settings:
146+ There are 3 settings:
102147
103148- 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)
105151- Files with NodeTag files - list of paths points to files that contain NodeTags.
106152 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)
107157
108158## Compatibility
109159
@@ -122,6 +172,8 @@ Also, extension will target latest VS Code version and try to use the full
122172functionality of new versions. So, use latest VS Code versions to get new
123173features earlier.
124174
175+ For using formatter minimal supported version is ` 10 ` .
176+
125177## Known Issues
126178
127179Known issues:
@@ -138,6 +190,16 @@ Known issues:
138190
139191## Release Notes
140192
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+
141203### 1.2.1
142204
143205Add check for breakpoint in ` bms_first_member ` to avoid infinite loop.
@@ -194,7 +256,8 @@ Add more special members.
194256
195257Separate json configuration file to add your own special members.
196258
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.
198261
199262Setup logging infrastructure. Availability to change minimum log level.
200263
@@ -214,4 +277,5 @@ Call `pprint(Node *)` on selected variable in `Variables` view.
214277
215278## Contributing
216279
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