Skip to content

Commit 2223d18

Browse files
feat: prepare for renaming to postgres-language-server (#52)
1 parent 3df16b9 commit 2223d18

File tree

39 files changed

+789
-396
lines changed

39 files changed

+789
-396
lines changed

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# PostgresTools Extension for VS Code
1+
# Postgres Language Server Extension for VS Code
22

3-
The **PostgresTools extension for Visual Studio Code** brings PostgreSQL inline suggestions, linting, and type checks to VSCode and VSCode-based editors.
3+
The **Postgres Language Server extension for Visual Studio Code** brings PostgreSQL inline suggestions, linting, and type checks to VSCode and VSCode-based editors.
44

55
It does so by implementing an LSP client and launching an LSP Server in the background.
66

@@ -12,16 +12,16 @@ The [Language Server Protocol](https://microsoft.github.io/language-server-proto
1212

1313
**First**, you need the LSP server binary. The [Postgres language server](https://github.com/supabase-community/postgres-language-server) is written in Rust and is therefore compiled to various binaries for various machines. You can set it up via one of five strategies. The extensions will check them in the following order:
1414

15-
- The `postgrestools.bin` VSCode setting can point to a binary with relative or absolute paths. You can use this if you want to download a specific binary from one of the [Postgres language server](https://github.com/supabase-community/postgres-language-server) releases and place it in your project.
16-
- **Recommended**: If you use node, you can simply run `npm i -D @postgrestools/postgrestools@latest`. Once you restart the extension, it should look for the server binary in your `node_modules`.
17-
- If you use node but you install your packages via Yarn Plug'n'Play, you can still install `@postgrestools/postgrestools`, and the extension will check your `.pnp.cjs` file for a binary.
18-
- You can install the LSP server globally (e.g. via `brew` or by downloading a binary from the GitHub releases). Make sure that its binary is exposed in your $PATH – the extension will search it for a `postgrestools` on Darwin/Linux or a `postgrestools.exe` on Windows.
19-
- If no LSP server binary can be found via the above strategies, you will be prompted to download a binary from `postgrestools`'s GitHub Releases. You can also do this later via the [Download Server Command](#useful-commands). Note that the above strategies will still take precedence.
15+
- The `postgres-language-server.bin` VSCode setting can point to a binary with relative or absolute paths. You can use this if you want to download a specific binary from one of the [Postgres language server](https://github.com/supabase-community/postgres-language-server) releases and place it in your project.
16+
- **Recommended**: If you use node, you can simply run `npm i -D @postgres-language-server/cli@latest`. Once you restart the extension, it should look for the server binary in your `node_modules`.
17+
- If you use node but you install your packages via Yarn Plug'n'Play, you can still install `@postgres-language-server/cli`, and the extension will check your `.pnp.cjs` file for a binary.
18+
- You can install the LSP server globally (e.g. via `brew` or by downloading a binary from the GitHub releases). Make sure that its binary is exposed in your $PATH – the extension will search it for a `postgres-language-server` on Darwin/Linux or a `postgres-language-server.exe` on Windows.
19+
- If no LSP server binary can be found via the above strategies, you will be prompted to download a binary from the Postgres language server's GitHub Releases. You can also do this later via the [Download Server Command](#useful-commands). Note that the above strategies will still take precedence.
2020
The found binary is copied to a temporary location in your VS Code extensions folder and run from there. When you restart the extension, the copied binary will be used, and the above places won't be searched.
2121

2222
## Setting Up Your Project
2323

24-
**Second**, you need a `postgrestools.jsonc` file at the root of your repository (or, use a custom file location and point to it via the `postgrestools.configFile` setting). You can find sane defaults in the [docs](https://pgtools.dev/#configuration).
24+
**Second**, you need a `postgres-language-server.jsonc` file at the root of your repository (or, use a custom file location and point to it via the `postgres-language-server.configFile` setting). You can find sane defaults in the [docs](https://pgtools.dev/#configuration).
2525

2626
When you specify the `db` section, the LSP server will connect to your database and gather intel from there. This makes it possible to provide autocompletions and type checks.
2727

@@ -43,57 +43,57 @@ Once you have [everything running locally](https://supabase.com/docs/guides/loca
4343

4444
It'll have the following format: `postgresql://<username>:<password>@<host>:<port>/<database>`.
4545

46-
If you extract the values, add them to your `postgrestools.jsonc` file, and restart the extension, you should be ready to go.
46+
If you extract the values, add them to your `postgres-language-server.jsonc` file, and restart the extension, you should be ready to go.
4747

4848
You can also run the LSP server against your remote database, but this might lead to small latencies and a small performance overhead (the LSP server runs `prepare` statements against your database for the type checking).
4949

5050
You should find your remote database settings at `https://supabase.com/dashboard/project/<yourProjectId>/settings/database?showConnect=true`.
5151

5252
## Useful Commands
5353

54-
The extension adds seven commands to your VS Code Command Palette. They are all prefixed by `PostgresTools`.
54+
The extension adds seven commands to your VS Code Command Palette. They are all prefixed by `Postgres Language Server`.
5555

56-
- `PostgresTools: Hard Reset (Delete All Temp and Global Binaries)` is your troubleshooting weapon. It will basically remove all binaries that were copied and downloaded _by the extension_ (not those you have installed or copied yourself). The extension will then again search for a server binary via the strategies mentioned in [the setup](#setting-up-the-lsp-server).
57-
- `PostgresTools: Download Server` lets you select and download the server binary. It'll be the matching version for your machine. If you set `postgrestools.allowDownloadPrereleases` to true in yor VS Code settings, you'll be able to select prereleases.
58-
- `PostgresTools: Get Current Version` will print the current version and the strategy with which the server binary was found.
59-
- `PostgresTools: Start` and `PostgresTools: Stop` will stop or start the LSP server and the client.
60-
- `PostgresTools: Restart` runs stop and start in succession.
61-
- `PostgresTools: Copy Latest Server Logfile` copies the latest server log file to your currently opened repo. The log file is meant to be attached to GitHub issues, it can sometimes help us to debug.
56+
- `Postgres Language Server: Hard Reset (Delete All Temp and Global Binaries)` is your troubleshooting weapon. It will basically remove all binaries that were copied and downloaded _by the extension_ (not those you have installed or copied yourself). The extension will then again search for a server binary via the strategies mentioned in [the setup](#setting-up-the-lsp-server).
57+
- `Postgres Language Server: Download Server` lets you select and download the server binary. It'll be the matching version for your machine. If you set `postgres-language-server.allowDownloadPrereleases` to true in yor VS Code settings, you'll be able to select prereleases.
58+
- `Postgres Language Server: Get Current Version` will print the current version and the strategy with which the server binary was found.
59+
- `Postgres Language Server: Start` and `Postgres Language Server: Stop` will stop or start the LSP server and the client.
60+
- `Postgres Language Server: Restart` runs stop and start in succession.
61+
- `Postgres Language Server: Copy Latest Server Logfile` copies the latest server log file to your currently opened repo. The log file is meant to be attached to GitHub issues, it can sometimes help us to debug.
6262

6363
## Multi-Root Workspaces
6464

6565
You can use the extension in a multi-root workspace setting, but there are a few caveats:
6666

67-
- You should use at least version 0.8.0 of the binary. You can upgrade it in your `package.json` or run `PostgresTools: Hard Reset (..)`.
68-
- You can specify a `postgrestools.bin` and a `postgrestools.configFile` in your `.code-workspace` file, but you need to use an absolute path. The binary and the setting will then be used for all your workspace folders.
69-
- If you don't specify a config file, the binary will look for a `postgrestools.jsonc` file at the every workspace folder's root level. If the file isn't there, the extension will be disabled for the folder. The individual `configFile` settings of the folders are ignored.
67+
- You should use at least version 0.8.0 of the binary. You can upgrade it in your `package.json` or run `Postgres Language Server: Hard Reset (..)`.
68+
- You can specify a `postgres-language-server.bin` and a `postgres-language-server.configFile` in your `.code-workspace` file, but you need to use an absolute path. The binary and the setting will then be used for all your workspace folders.
69+
- If you don't specify a config file, the binary will look for a `postgres-language-server.jsonc` file at the every workspace folder's root level. If the file isn't there, the extension will be disabled for the folder. The individual `configFile` settings of the folders are ignored.
7070
- The binary will currently only change database connections when a new file is opened, not when you alternate focus between two files. So, you might get linting/completions from a different database than you'd expect. For now, you can simply reopen the file, but we'll fix this soon 🙌
7171

7272
## Troubleshooting
7373

74-
1. First, try restarting the extension via the `PostgresTools: Hard Reset (...)` command mentioned above.
75-
2. Open your VS Code Terminal, select the tab `Output`, and select one of the `postgrestools` extensions on the right. You might see what went wrong in the logs.
76-
3. If you want to open a GitHub issue, it can sometimes help us if you attach the LSP server log file. We provide the `PostgresTools: Copy Latest Server Logfile` command to make that as easy as possible.
74+
1. First, try restarting the extension via the `Postgres Language Server: Hard Reset (...)` command mentioned above.
75+
2. Open your VS Code Terminal, select the tab `Output`, and select one of the `postgres-language-server` extensions on the right. You might see what went wrong in the logs.
76+
3. If you want to open a GitHub issue, it can sometimes help us if you attach the LSP server log file. We provide the `Postgres Language Server: Copy Latest Server Logfile` command to make that as easy as possible.
7777

7878
## FAQ
7979

80-
### I've installed the package via NPM but getting an `Error: Cannot find module '@postgrestools/cli-x86_64-windows-msvc/postgrestools.exe'`.
80+
### I've installed the package via NPM but getting an `Error: Cannot find module '@postgres-language-server/cli-x86_64-windows-msvc/postgres-language-server.exe'`.
8181

8282
The platform-specific package is installed as an `optionalDependency`. If it can't be installed for whatever reason, `npm` won't complain. It's likely that something went wrong during the installation.
8383

84-
Another known issue is that npm installs the optional dependency at an unexpected location. It _should_ be located at `node_modules/@postgrestools/cli-aarch64-apple-darwin` (or another platform-specific package).
84+
Another known issue is that npm installs the optional dependency at an unexpected location. It _should_ be located at `node_modules/@postgres-language-server/cli-aarch64-apple-darwin` (or another platform-specific package).
8585

8686
If you can't find the platform specific package, please just rerun `npm install` a couple of times.
8787

88-
If that still doesn't help, run `npm uninstall @postgrestools/postgrestools` and use the download server strategy mentioned [here.](#setting-up-the-lsp-server)
88+
If that still doesn't help, run `npm uninstall @postgres-language-server/cli` and use the download server strategy mentioned [here.](#setting-up-the-lsp-server)
8989

90-
### Why am I prompted to install the PostgresTools binary?
90+
### Why am I prompted to install the Postgres Language Server binary?
9191

9292
You will only be prompted if all other [strategies](#setting-up-the-lsp-server) fail. If you set out to use a different strategy, make sure the binary/node package is actually at the expected location:
9393

94-
- Using the `postgrestool.bin` setting -> Is the binary at the configured location?
94+
- Using the `postgres-language-server.bin` setting -> Is the binary at the configured location?
9595
- Using `npm` or `yarn` -> Are the `node_modules` installed correctly?
96-
- Using the `PATH` environment variable -> Can you run `$ postgrestools --version`, is the binary at the expected location?
96+
- Using the `PATH` environment variable -> Can you run `$ postgres-language-server --version`, is the binary at the expected location?
9797

9898
## Issues
9999

package.json

Lines changed: 69 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "postgrestools",
33
"publisher": "Supabase",
4+
"displayName": "Postgres Language Server",
45
"description": "Postgres Language Server right in your IDE.",
56
"version": "1.3.1",
67
"repository": {
78
"type": "git",
8-
"url": "https://github.com/supabase-community/postgrestools-vscode"
9+
"url": "https://github.com/supabase-community/postgres-language-server-vscode"
910
},
1011
"bugs": {
1112
"url": "https://github.com/supabase-community/postgres-language-server"
@@ -21,7 +22,9 @@
2122
"Formatters"
2223
],
2324
"keywords": [
24-
"postgrestools",
25+
"postgres-language-server",
26+
"language server",
27+
"language-server",
2528
"lsp",
2629
"postgres",
2730
"supabase"
@@ -33,58 +36,62 @@
3336
"contributes": {
3437
"commands": [
3538
{
36-
"title": "PostgresTools: Start",
37-
"command": "postgrestools.start"
39+
"title": "Postgres Language Server: Start",
40+
"command": "postgres-language-server.start"
3841
},
3942
{
40-
"title": "PostgresTools: Stop",
41-
"command": "postgrestools.stop"
43+
"title": "Postgres Language Server: Stop",
44+
"command": "postgres-language-server.stop"
4245
},
4346
{
44-
"title": "PostgresTools: Restart",
45-
"command": "postgrestools.restart"
47+
"title": "Postgres Language Server: Restart",
48+
"command": "postgres-language-server.restart"
4649
},
4750
{
48-
"title": "PostgresTools: Download Server",
49-
"command": "postgrestools.download"
51+
"title": "Postgres Language Server: Download Server",
52+
"command": "postgres-language-server.download"
5053
},
5154
{
52-
"title": "PostgresTools: Hard Reset (Delete All Temp & Global Binaries)",
53-
"command": "postgrestools.reset"
55+
"title": "Postgres Language Server: Hard Reset (Delete All Temp & Global Binaries)",
56+
"command": "postgres-language-server.reset"
5457
},
5558
{
56-
"title": "PostgresTools: Get Current Version",
57-
"command": "postgrestools.currentVersion"
59+
"title": "Postgres Language Server: Get Current Version",
60+
"command": "postgres-language-server.currentVersion"
5861
},
5962
{
60-
"title": "PostgresTools: Copy Latest Server Logfile",
61-
"command": "postgrestools.copyLatestLogfile"
63+
"title": "Postgres Language Server: Copy Latest Server Logfile",
64+
"command": "postgres-language-server.copyLatestLogfile"
6265
}
6366
],
6467
"configuration": {
65-
"title": "PostgresTools",
68+
"title": "Postgres Language Server",
6669
"properties": {
6770
"postgrestools.enabled": {
6871
"type": "boolean",
6972
"description": "Whether to enable the PostgresTools extension.",
73+
"deprecationMessage": "`postgrestools` has been renamed to `postgres-language-server`.",
7074
"default": true,
7175
"scope": "resource"
7276
},
7377
"postgrestools.allowDownloadPrereleases": {
7478
"type": "boolean",
7579
"description": "Allows selecting prereleases when downloading the binary via this extension",
7680
"default": false,
81+
"deprecationMessage": "`postgrestools` has been renamed to `postgres-language-server`.",
7782
"scope": "resource"
7883
},
7984
"postgrestools.allowVersionChecks": {
8085
"type": "boolean",
8186
"description": "If set, the extension will check periodically whether a new version for PostgresTools is available and if so notify the user.",
8287
"default": true,
88+
"deprecationMessage": "`postgrestools` has been renamed to `postgres-language-server`.",
8389
"scope": "resource"
8490
},
8591
"postgrestools.configFile": {
8692
"type": "string",
8793
"description": "Path to the `postgrestools.jsonc` file. You don't need to set this if the file is on root level of your project.",
94+
"deprecationMessage": "`postgrestools` has been renamed to `postgres-language-server`.",
8895
"scope": "resource"
8996
},
9097
"postgrestools.bin": {
@@ -109,6 +116,51 @@
109116
]
110117
}
111118
],
119+
"deprecationMessage": "`postgrestools` has been renamed to `postgres-language-server`.",
120+
"scope": "resource"
121+
},
122+
"postgres-language-server.enabled": {
123+
"type": "boolean",
124+
"description": "Whether to enable the postgres-language-server extension.",
125+
"scope": "resource"
126+
},
127+
"postgres-language-server.allowDownloadPrereleases": {
128+
"type": "boolean",
129+
"description": "Allows selecting prereleases when downloading the binary via this extension",
130+
"scope": "resource"
131+
},
132+
"postgres-language-server.allowVersionChecks": {
133+
"type": "boolean",
134+
"description": "If set, the extension will check periodically whether a new version for postgres-language-server is available and if so notify the user.",
135+
"scope": "resource"
136+
},
137+
"postgres-language-server.configFile": {
138+
"type": "string",
139+
"description": "Path to the `postgres-language-server.jsonc` file. You don't need to set this if the file is on root level of your project.",
140+
"scope": "resource"
141+
},
142+
"postgres-language-server.bin": {
143+
"oneOf": [
144+
{
145+
"type": "string",
146+
"description": "Path to the postgres-language-server Language Server binary",
147+
"examples": [
148+
"/path/to/postgres-language-server",
149+
"./path/to/postgres-language-server"
150+
]
151+
},
152+
{
153+
"type": "object",
154+
"description": "Platform-specific paths to the postgres-language-server Language Server binary",
155+
"examples": [
156+
{
157+
"linux-x64": "/path/to/postgres-language-server",
158+
"darwin-arm64": "./path/to/postgres-language-server",
159+
"win32-x64": "/path/to/postgres-language-server.exe"
160+
}
161+
]
162+
}
163+
],
112164
"scope": "resource"
113165
}
114166
}

0 commit comments

Comments
 (0)