Skip to content

Commit 9f99cff

Browse files
committed
1.3.0
1 parent 881a6df commit 9f99cff

File tree

5 files changed

+112
-21
lines changed

5 files changed

+112
-21
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ All notable changes to the "PostgreSQL Hacker Helper" extension will be document
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.0]
9+
10+
### Added
11+
12+
- Formatting using `pg_bsd_indent` with `Format Document` VS Code functionality.
13+
Supported for PostgreSQL starting from 10 version.
14+
15+
- Show elements to which `Bitmapset` and `Relids` points: Relids (`RangeTblEntry` and `RelOptInfo`) or index in array (show element of that array)
16+
17+
### Changed
18+
19+
- Integration with VS Code logging (output channel). Now can specify log level in `Output` window.
20+
821
## [1.2.1]
922

1023
### Changed

README.md

+81-17
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
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

2020
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.
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
3544
using [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
122172
functionality of new versions. So, use latest VS Code versions to get new
123173
features earlier.
124174

175+
For using formatter minimal supported version is `10`.
176+
125177
## Known Issues
126178

127179
Known 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

143205
Add check for breakpoint in `bms_first_member` to avoid infinite loop.
@@ -194,7 +256,8 @@ Add more special members.
194256

195257
Separate 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

199262
Setup 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...

package.json

+18-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"name": "postgresql-hacker-helper",
33
"displayName": "PostgreSQL Hacker Helper",
44
"description": "Extension to assist Postgres hackers - source code developers",
5-
"version": "1.2.1",
5+
"version": "1.3.0",
66
"engines": {
77
"vscode": "^1.30.0"
88
},
99
"categories": [
10-
"Debuggers"
10+
"Debuggers",
11+
"Formatters"
1112
],
1213
"icon": "resources/logo.png",
1314
"activationEvents": [
@@ -27,7 +28,8 @@
2728
"postgres",
2829
"pgsql",
2930
"pg",
30-
"c"
31+
"c",
32+
"pgindent"
3133
],
3234
"contributes": {
3335
"commands": [
@@ -55,6 +57,12 @@
5557
"title": "Refresh configuration file",
5658
"shortTitle": "Refresh config file",
5759
"category": "PgSQL"
60+
},
61+
{
62+
"command": "postgresql-hacker-helper.formatterShowDiff",
63+
"title": "Show diff preview for PostgreSQL formatter",
64+
"shortTitle": "Diff PostgreSQL formatter",
65+
"category": "PgSQL"
5866
}
5967
],
6068
"menus": {
@@ -118,6 +126,12 @@
118126
],
119127
"default": "INFO",
120128
"description": "Minimum level of log messages to display in Output view"
129+
},
130+
"postgresql-hacker-helper.pg_bsd_indentPath": {
131+
"title": "Path to pg_bsd_indent",
132+
"type": "string",
133+
"default": "src/tools/pg_bsd_indent/pg_bsd_indent",
134+
"description": "Path to pg_bsd_indent executable used to format file. If not specified, pg_bsd_indent will be search in all available location, and maybe built"
121135
}
122136
}
123137
},
@@ -148,4 +162,4 @@
148162
"@vscode/test-cli": "^0.0.9",
149163
"@vscode/test-electron": "^2.4.0"
150164
}
151-
}
165+
}

resources/bitmapset-refs.gif

1.21 MB
Loading

resources/formatter-work.gif

904 KB
Loading

0 commit comments

Comments
 (0)