repo_name stringlengths 1 62 | dataset stringclasses 1
value | lang stringclasses 11
values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -4,7 +4,7 @@ import { execSync, exec } from "child_process";
import { confirm } from "@clack/prompts";
import chalk from "chalk";
-// import { removeDirectory } from "./fileController";
+import { removeDirectory } from "./fileController"; | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
在导入模块的时候,建议按照字母顺序进行排序,以提高代码的可读性和维护性。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -25,8 +25,9 @@ process.stdin.on("data", (key) => {
});
// 模板创建主函数
-export default async function createAppTest(projectName: string, options) {
+export default async function createAppTest(projectName: string, options: Record<string, any>) {
const rootDirectory = resolveApp(projectName);
+ console.log(!option... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
在创建项目文件夹之前,应该先检查`rootDirectory`是否已经存在。如果存在且未设置`force`选项,则应该显示确认提示。如果用户确认,再删除现有目录后再创建新目录。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -36,9 +37,15 @@ export default async function createAppTest(projectName: string, options) {
});
// 删除已存在文件并创建新文件
- console.log(shouldContinue);
+ if (shouldContinue === true) {
+ removeDirectory(rootDirectory, false);
+ } else {
+ process.exit(1);
+ }
- await execSync(`mkdir ${... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
在删除已存在文件并创建新文件的逻辑中,可以使用`fs.mkdirSync`替换`execSync`命令来创建目录。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 46 | xun082 | uaenaTzx | @@ -36,9 +37,15 @@ export default async function createAppTest(projectName: string, options) {
});
// 删除已存在文件并创建新文件
- console.log(shouldContinue);
+ if (shouldContinue === true) {
+ removeDirectory(rootDirectory, false);
+ } else {
+ process.exit(1);
+ }
- await execSync(`mkdir ${... | 这个独立出来不好吗,有点冗余 |
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -24,22 +24,37 @@ process.stdin.on("data", (key) => {
}
});
-// 模板创建主函数
-export default async function createAppTest(projectName: string, options) {
- const rootDirectory = resolveApp(projectName);
+// 创建项目文件夹
+async function createFolder(rootDirectory: string, options: Record<string, any>) { | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
`createFolder`函数的参数`options`类型为`Record<string, any>`,建议添加更具体的类型注解,以提高代码的可读性和可维护性。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -24,22 +24,37 @@ process.stdin.on("data", (key) => {
}
});
-// 模板创建主函数
-export default async function createAppTest(projectName: string, options) {
- const rootDirectory = resolveApp(projectName);
+// 创建项目文件夹
+async function createFolder(rootDirectory: string, options: Record<string, any>) {
+ // 检查目录是否存在
+ ... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
在询问用户是否覆盖同名文件时,建议提供更明确的提示信息,以便用户能够做出准确的选择。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -24,22 +24,37 @@ process.stdin.on("data", (key) => {
}
});
-// 模板创建主函数
-export default async function createAppTest(projectName: string, options) {
- const rootDirectory = resolveApp(projectName);
+// 创建项目文件夹
+async function createFolder(rootDirectory: string, options: Record<string, any>) {
+ // 检查目录是否存在
+ ... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
调用`removeDirectory`函数时,第二个参数传递了一个布尔值`false`,但是根据代码逻辑,应该传递`options.force`的值。请确认是否存在错误。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -24,22 +24,37 @@ process.stdin.on("data", (key) => {
}
});
-// 模板创建主函数
-export default async function createAppTest(projectName: string, options) {
- const rootDirectory = resolveApp(projectName);
+// 创建项目文件夹
+async function createFolder(rootDirectory: string, options: Record<string, any>) {
+ // 检查目录是否存在
+ ... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
在用户选择不覆盖同名文件时,调用`process.exit(1)`退出程序可能会导致意外的行为。建议使用更合适的方式处理这种情况,例如抛出异常或返回错误码。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -24,22 +24,37 @@ process.stdin.on("data", (key) => {
}
});
-// 模板创建主函数
-export default async function createAppTest(projectName: string, options) {
- const rootDirectory = resolveApp(projectName);
+// 创建项目文件夹
+async function createFolder(rootDirectory: string, options: Record<string, any>) {
+ // 检查目录是否存在
+ ... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
创建目录时,使用了`fs.mkdirSync`方法,并传递了`{ recursive: true }`选项。请注意,`recursive`选项在Node.js版本10.12.0及以上才可用。如果要兼容较旧的Node.js版本,请确保在使用`recursive`选项之前进行检查。
<!-- This is an auto-generated comment by OSS CodeR... |
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -24,22 +24,37 @@ process.stdin.on("data", (key) => {
}
});
-// 模板创建主函数
-export default async function createAppTest(projectName: string, options) {
- const rootDirectory = resolveApp(projectName);
+// 创建项目文件夹
+async function createFolder(rootDirectory: string, options: Record<string, any>) {
+ // 检查目录是否存在
+ ... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
`createAppTest`函数的参数`options`缺少类型注解,请添加相应的类型注解,以提高代码的可读性和可维护性。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 46 | xun082 | github-actions[bot] | @@ -24,22 +24,37 @@ process.stdin.on("data", (key) => {
}
});
-// 模板创建主函数
-export default async function createAppTest(projectName: string, options) {
- const rootDirectory = resolveApp(projectName);
+// 创建项目文件夹
+async function createFolder(rootDirectory: string, options: Record<string, any>) {
+ // 检查目录是否存在
+ ... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
调用`createFolder`函数时,第二个参数传递了`options`,但是在旧代码中并没有传递该参数。请确认是否存在错误。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 42 | xun082 | github-actions[bot] | @@ -8,10 +8,6 @@ import { join } from "node:path";
import { packageVersion } from "./constants";
-/**
- * @param directoryPath 删除文件的路径,默认 node_modules
- * @param verbose 如果为true,则显示删除信息
- */
/**
* @author moment
* @param directoryPath 删除文件的路径,默认 node_modules | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
在`fileController.ts`文件中,删除了一个注释块和一个参数说明的注释。这可能会导致其他开发人员对该函数的理解产生困惑。建议保留参数说明的注释以提供更多的上下文信息。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 39 | xun082 | github-actions[bot] | @@ -4,10 +4,11 @@ import { execSync, exec } from "child_process";
import { confirm } from "@clack/prompts";
import chalk from "chalk";
-import { removeDirectory } from "./fileController";
+// import { removeDirectory } from "./fileController";
import { projectSelect } from "./select";
import isGitInstalled from "... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
这里注释掉了`removeDirectory`的调用,但是没有提供替代的代码。请确认是否有意为之。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 39 | xun082 | github-actions[bot] | @@ -4,10 +4,11 @@ import { execSync, exec } from "child_process";
import { confirm } from "@clack/prompts";
import chalk from "chalk";
-import { removeDirectory } from "./fileController";
+// import { removeDirectory } from "./fileController";
import { projectSelect } from "./select";
import isGitInstalled from "... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
> Note: This review was outside of the patch, but no patch was found that overlapped with it. Original lines [22-23]
这里创建了一个`Preset`对象,但是没有使用它。请确认是否有意为之。
<!-- This is an auto-generated comme... |
create-neat | github_2023 | typescript | 39 | xun082 | github-actions[bot] | @@ -36,21 +37,34 @@ export default async function createAppTest(projectName: string, options) {
});
// 删除已存在文件并创建新文件
- if (shouldContinue === true) {
- removeDirectory(projectName, true);
- } else process.exit(1);
+ console.log(shouldContinue);
execSync(`mkdir ${rootDirectory}`); | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
这里使用了`execSync`来执行命令`mkdir`,但是没有处理可能的异常情况。建议添加错误处理逻辑。
<!-- This is an auto-generated comment by OSS CodeRabbit --> |
create-neat | github_2023 | typescript | 39 | xun082 | github-actions[bot] | @@ -36,21 +37,34 @@ export default async function createAppTest(projectName: string, options) {
});
// 删除已存在文件并创建新文件
- if (shouldContinue === true) {
- removeDirectory(projectName, true);
- } else process.exit(1);
+ console.log(shouldContinue);
execSync(`mkdir ${rootDirectory}`);
}
... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
在这个代码块中,创建了一个`packageContent`对象,并将其传递给`PackageAPI`类的`createPackageJson`方法。然而,在新的代码中,没有展示如何使用`PackageAPI`类的实例。请提供相关的代码以确保`createPackageJson`方法被正确调用。
<!-- This is an auto-generated comment by O... |
create-neat | github_2023 | typescript | 39 | xun082 | github-actions[bot] | @@ -62,10 +76,10 @@ export default async function createAppTest(projectName: string, options) {
// todo: 插件未开发,先模拟过程
// 安装插件至 package.json
- Object.keys(preset.plugins).forEach(async (plugin) => {
- console.log(plugin, "installed");
+ Object.keys(packageContent.devDependencies).forEach(async (dep) => {
+ ... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
在这个代码块中,遍历了`packageContent.devDependencies`对象的键,并打印了每个键。然而,在新的代码中,没有展示如何安装依赖项。请提供相关的代码以确保依赖项被正确安装。
102:
这里打印了生成README.md文件的消息,但是没有展示具体的文件内容和创建过程。请提供相关的代码以确保README.md文件被正确创建。
以上是对`packages/core... |
nextjs-openai-doc-search | github_2023 | others | 35 | supabase-community | thorwebdev | @@ -6,7 +6,7 @@ This starter takes all the `.mdx` files in the `pages` directory and processes t
Deploy this starter to Vercel. The Supabase integration will automatically set the required environment variables and configure your [Database Schema](./supabase/migrations/20230406025118_init.sql). All you have to do is... | @MildTomato does `external-id=nextjs-open-ai-doc-search` still work for v2 or do we need to update it to `https://github.com/supabase-community/nextjs-openai-doc-search/tree/main`? |
nextjs-openai-doc-search | github_2023 | others | 29 | supabase-community | gregnr | @@ -80,6 +82,12 @@ Make sure you have Docker installed and running locally. Then run
supabase start
```
+To retrieve ```NEXT_PUBLIC_SUPABASE_ANON_KEY``` and ```SUPABASE_SERVICE_ROLE_KEY``` you have to run | ```suggestion
To retrieve `NEXT_PUBLIC_SUPABASE_ANON_KEY` and `SUPABASE_SERVICE_ROLE_KEY` run:
``` |
nextjs-openai-doc-search | github_2023 | others | 29 | supabase-community | gregnr | @@ -69,8 +69,10 @@ The initialization of the database, including the setup of the `pgvector` extens
### Configuration
-- `cp .env.example .env`
+- `cp .env.example .env` or rename `.env.example` into .env
- Set your `OPENAI_KEY` in the newly created `.env` file.
+- Set ```NEXT_PUBLIC_SUPABASE_ANON_KEY``` and ```S... | ```suggestion
- Set `NEXT_PUBLIC_SUPABASE_ANON_KEY` and `SUPABASE_SERVICE_ROLE_KEY` in `.env`
``` |
nextjs-openai-doc-search | github_2023 | others | 29 | supabase-community | gregnr | @@ -69,8 +69,10 @@ The initialization of the database, including the setup of the `pgvector` extens
### Configuration
-- `cp .env.example .env`
+- `cp .env.example .env` or rename `.env.example` into .env | Might be best to stick with the `cp` for documentation purposes in case users want to fork/continue using this git repo. (`.env` shouldn't be committed to source control with creds/secrets so typically you would leave the `.env.example` in the repo). |
nextjs-openai-doc-search | github_2023 | others | 29 | supabase-community | gregnr | @@ -88,6 +96,13 @@ In a new terminal window, run
pnpm dev
```
+### Using your custom .mdx docs
+1. Make sure your documentation is in .mdx format. This can be done by renaming exisiting(or compatible) markdown .md file | ```suggestion
1. By default your documentation will need to be in `.mdx` format. This can be done by renaming existing (or compatible) markdown `.md` file.
``` |
nextjs-openai-doc-search | github_2023 | others | 29 | supabase-community | gregnr | @@ -88,6 +96,13 @@ In a new terminal window, run
pnpm dev
```
+### Using your custom .mdx docs
+1. Make sure your documentation is in .mdx format. This can be done by renaming exisiting(or compatible) markdown .md file
+2. Run ```pnpm run embeddings``` to regenerate embeddings. | ```suggestion
2. Run `pnpm run embeddings` to regenerate embeddings.
``` |
nextjs-openai-doc-search | github_2023 | others | 29 | supabase-community | gregnr | @@ -88,6 +96,13 @@ In a new terminal window, run
pnpm dev
```
+### Using your custom .mdx docs
+1. Make sure your documentation is in .mdx format. This can be done by renaming exisiting(or compatible) markdown .md file
+2. Run ```pnpm run embeddings``` to regenerate embeddings.
+>Note: Make sure supabase is running... | ```suggestion
> Note: Make sure supabase is running. To check, run `supabase status`. If is not running run `supabase start`.
``` |
nextjs-openai-doc-search | github_2023 | others | 29 | supabase-community | gregnr | @@ -88,6 +96,13 @@ In a new terminal window, run
pnpm dev
```
+### Using your custom .mdx docs
+1. Make sure your documentation is in .mdx format. This can be done by renaming exisiting(or compatible) markdown .md file
+2. Run ```pnpm run embeddings``` to regenerate embeddings.
+>Note: Make sure supabase is running... | ```suggestion
3. Run `pnpm dev` again to refresh NextJS localhost:3000 rendered page.
``` |
nextjs-openai-doc-search | github_2023 | others | 29 | supabase-community | gregnr | @@ -88,6 +96,12 @@ In a new terminal window, run
pnpm dev
```
+### Using your custom .mdx docs
+1. By default your documentation will need to be in `.mdx` format. This can be done by renaming existing (or compatible) markdown `.md` file.
+2. Run `pnpm run embeddings` to regenerate embeddings.
+> Note: Make sure sup... | ```suggestion
> Note: Make sure supabase is running. To check, run `supabase status`. If is not running run `supabase start`.
``` |
nextjs-openai-doc-search | github_2023 | others | 25 | supabase-community | gregnr | @@ -8,7 +8,8 @@
"start": "next start",
"lint": "next lint",
"format": "prettier --write \"./**/*.{js,jsx,ts,tsx,css,md,json}\"",
- "embeddings": "tsx lib/generate-embeddings.ts"
+ "embeddings": "tsx lib/generate-embeddings.ts",
+ "embeddings:r": "tsx lib/generate-embeddings.ts --refresh" | ```suggestion
"embeddings:refresh": "tsx lib/generate-embeddings.ts --refresh"
``` |
supabase-go | github_2023 | go | 11 | supabase-community | tranhoangvuit | @@ -2,35 +2,49 @@ package supabase
import (
"errors"
+ "log"
+ "time"
+ "github.com/supabase-community/functions-go"
+ "github.com/supabase-community/gotrue-go"
+ "github.com/supabase-community/gotrue-go/types"
+ postgrest "github.com/supabase-community/postgrest-go"
storage_go "github.com/supabase-community/s... | Because we already implemented two main function of rest in this lib, so we don't need to call via `.Rest`. It's same idea with `supabase-js`
If it's okie, can you remove this comment? |
supabase-go | github_2023 | go | 11 | supabase-community | tranhoangvuit | @@ -76,3 +93,74 @@ func (c *Client) From(table string) *postgrest.QueryBuilder {
func (c *Client) Rpc(name, count string, rpcBody interface{}) string {
return c.rest.Rpc(name, count, rpcBody)
}
+
+func (c *Client) SignInWithEmailPassword(email, password string) (types.Session, error) { | can you move these function to auth package here? https://github.com/supabase-community/gotrue-go |
supabase-go | github_2023 | go | 9 | supabase-community | tranhoangvuit | @@ -3,64 +3,70 @@ package supabase
import (
"errors"
+ "github.com/supabase-community/gotrue-go"
+ "github.com/supabase-community/gotrue-go/types"
+ postgrest "github.com/supabase-community/postgrest-go"
storage_go "github.com/supabase-community/storage-go"
- "github.com/supabase/postgrest-go"
)
const (
RE... | I think we should heep it in struct will be better, in the feature, if we have more fields, we can put it in struct instead of parameters.
The second issue, I want to make it consistent format with `supabase-js` library:
```
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {
gl... |
supabase-go | github_2023 | go | 9 | supabase-community | tranhoangvuit | @@ -3,64 +3,70 @@ package supabase
import (
"errors"
+ "github.com/supabase-community/gotrue-go"
+ "github.com/supabase-community/gotrue-go/types"
+ postgrest "github.com/supabase-community/postgrest-go"
storage_go "github.com/supabase-community/storage-go"
- "github.com/supabase/postgrest-go"
)
const (
RE... | Thanks, let remove it. |
supabase-go | github_2023 | go | 9 | supabase-community | tranhoangvuit | @@ -3,64 +3,68 @@ package supabase
import (
"errors"
+ "github.com/supabase-community/gotrue-go"
+ "github.com/supabase-community/gotrue-go/types"
+ postgrest "github.com/supabase-community/postgrest-go"
storage_go "github.com/supabase-community/storage-go"
- "github.com/supabase/postgrest-go"
)
const (
RE... | It seems that the new code is the same as the old one if we continue to use a struct as a parameter. |
supabase-go | github_2023 | go | 9 | supabase-community | tranhoangvuit | @@ -76,3 +87,39 @@ func (c *Client) From(table string) *postgrest.QueryBuilder {
func (c *Client) Rpc(name, count string, rpcBody interface{}) string {
return c.rest.Rpc(name, count, rpcBody)
}
+
+func (c *Client) SignInWithEmailPassword(email, password string) error { | We will merge this first, but it will be removed soon, because it should belong to auth. |
postgres_lsp | github_2023 | others | 257 | supabase-community | psteinroe | @@ -0,0 +1,26 @@
+use crate::session::Session;
+use pgt_text_size::TextSize;
+use tower_lsp::lsp_types;
+
+pub fn get_cursor_position( | maybe we can just put the "converter" create into the lsp crate and then put this one alongside everything else |
postgres_lsp | github_2023 | others | 257 | supabase-community | psteinroe | @@ -0,0 +1,114 @@
+use crate::session::Session;
+use anyhow::{Result, anyhow};
+use tower_lsp::lsp_types::{
+ self, CodeAction, CodeActionDisabled, CodeActionOrCommand, Command, ExecuteCommandParams,
+ MessageType,
+};
+
+use pgt_workspace::code_actions::{
+ CodeActionKind, CodeActionsParams, CommandActionCate... | dont we need to invalidate the schema cache for this? |
postgres_lsp | github_2023 | others | 257 | supabase-community | psteinroe | @@ -0,0 +1,65 @@
+use crate::workspace::StatementId;
+use pgt_configuration::RuleSelector;
+use pgt_fs::PgTPath;
+use pgt_text_size::TextSize;
+
+#[derive(Debug, serde::Serialize, serde::Deserialize)]
+#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
+pub struct CodeActionsParams {
+ pub path: PgTPath,
... | maybe we can put this in to a `features/` directory? we could also structure the other feature params and types in a similar manner. |
postgres_lsp | github_2023 | others | 257 | supabase-community | psteinroe | @@ -253,6 +259,88 @@ impl Workspace for WorkspaceServer {
Ok(self.is_ignored(params.pgt_path.as_path()))
}
+ fn pull_code_actions(
+ &self,
+ params: code_actions::CodeActionsParams,
+ ) -> Result<code_actions::CodeActionsResult, WorkspaceError> {
+ let doc = self
+ ... | we should check that the statement is valid by checking if there is a pg_query AST for it |
postgres_lsp | github_2023 | others | 259 | supabase-community | juleswritescode | @@ -88,9 +102,48 @@ Make sure to check out the other options. We will provide guides for specific us
We recommend installing an editor plugin to get the most out of Postgres Language Tools.
-> [!NOTE]
-> We will update this section once we have published the binaries.
+### VSCode
+
+TODO
+
+### Neovim
+
+You will ... | ```suggestion
If your editor is able to interact with a server and send [JSON-RPC](https://www.jsonrpc.org) requests, you only need to configure the editor to run that command.
``` |
postgres_lsp | github_2023 | others | 259 | supabase-community | juleswritescode | @@ -88,9 +102,48 @@ Make sure to check out the other options. We will provide guides for specific us
We recommend installing an editor plugin to get the most out of Postgres Language Tools.
-> [!NOTE]
-> We will update this section once we have published the binaries.
+### VSCode
+
+TODO
+
+### Neovim
+
+You will ... | ```suggestion
In order to do so, you first need to start a daemon process with the start command:
``` |
postgres_lsp | github_2023 | others | 259 | supabase-community | juleswritescode | @@ -88,9 +102,48 @@ Make sure to check out the other options. We will provide guides for specific us
We recommend installing an editor plugin to get the most out of Postgres Language Tools.
-> [!NOTE]
-> We will update this section once we have published the binaries.
+### VSCode
+
+TODO
+
+### Neovim
+
+You will ... | ```suggestion
For other operative systems, you can find the folder in the system’s temporary directory.
You can change the location of the `pgt-logs` folder via the `PGT_LOG_PATH` variable.
``` |
postgres_lsp | github_2023 | others | 259 | supabase-community | juleswritescode | @@ -88,9 +102,48 @@ Make sure to check out the other options. We will provide guides for specific us
We recommend installing an editor plugin to get the most out of Postgres Language Tools.
-> [!NOTE]
-> We will update this section once we have published the binaries.
+### VSCode
+
+TODO
+
+### Neovim
+
+You will ... | ```suggestion
Postgres Tools has first-class LSP support. If your editor does implement LSP, then the integration of Postgres Tools should be seamless.
``` |
postgres_lsp | github_2023 | others | 259 | supabase-community | juleswritescode | @@ -25,8 +25,22 @@ Our current focus is on refining and enhancing these core features while buildin
## Installation
-> [!NOTE]
-> We will update this section once we have published the binaries.
+To install Postgres Tools, grab the executable for your platform from the [latest CLI release](https://github.com/supab... | ```suggestion
To install Postgres Tools, grab the executable for your platform from the [latest CLI release](https://github.com/supabase-community/postgres_lsp/releases/latest) on GitHub and give it execution permission.
``` |
postgres_lsp | github_2023 | others | 259 | supabase-community | juleswritescode | @@ -25,8 +25,22 @@ Our current focus is on refining and enhancing these core features while buildin
## Installation
-> [!NOTE]
-> We will update this section once we have published the binaries.
+To install Postgres Tools, grab the executable for your platform from the [latest CLI release](https://github.com/supab... | ```suggestion
If you are using Node, you can also install the CLI via NPM. Run the following commands in a directory containing a `package.json` file.
``` |
postgres_lsp | github_2023 | others | 255 | supabase-community | juleswritescode | @@ -441,7 +441,7 @@ async fn server_shutdown() -> Result<()> {
let cancellation = factory.cancellation();
let cancellation = cancellation.notified();
- // this is called when `pglt stop` is run by the user
+ // this is called when `pgt stop` is run by the user | ```suggestion
// this is called when `postgrestools stop` is run by the user
``` |
postgres_lsp | github_2023 | others | 240 | supabase-community | juleswritescode | @@ -41,6 +41,7 @@ After running the `init` command, you’ll have a `pglt.jsonc` file in your dire
```json
{
+ "": "https://supabase-community.github.io/postgres_lsp/schemas/0.0.0/schema.json", | sollte der key nicht $schema sein? |
postgres_lsp | github_2023 | others | 240 | supabase-community | juleswritescode | @@ -11,33 +11,34 @@ install-tools:
cargo install cargo-binstall
cargo binstall cargo-insta taplo-cli
cargo binstall --git "https://github.com/astral-sh/uv" uv
-
+ bun install
# Upgrades the tools needed to develop
upgrade-tools:
cargo install cargo-binstall --force
- cargo binstall cargo-insta taplo-cli --f... | ist der wasm kram noch n überbleibsel von deinen versuchen? |
postgres_lsp | github_2023 | others | 240 | supabase-community | juleswritescode | @@ -11,33 +11,34 @@ install-tools:
cargo install cargo-binstall
cargo binstall cargo-insta taplo-cli
cargo binstall --git "https://github.com/astral-sh/uv" uv
-
+ bun install | funktioniert das lokal, wenn in der `bun.lock` die ganzen `<placeholder>` values stehen? |
postgres_lsp | github_2023 | others | 240 | supabase-community | juleswritescode | @@ -0,0 +1,34 @@
+{
+ "name": "@pglt/backend-jsonrpc",
+ "version": "<placeholder>",
+ "main": "dist/index.js",
+ "scripts": {
+ "test": "bun test",
+ "test:ci": "bun build && bun test",
+ "build": "bun build ./src/index.ts --outdir ./dist --target node"
+ },
+ "files": ["dist/", "README.md"],
+ "repository": {
+ "... | die `musl's` sind bisher nicht supported in `generate-package.mjs` |
postgres_lsp | github_2023 | typescript | 240 | supabase-community | juleswritescode | @@ -0,0 +1,36 @@
+/**
+ * Gets the path of the Biome binary for the current platform | ```suggestion
* Gets the path of the PGLT binary for the current platform
``` |
postgres_lsp | github_2023 | typescript | 240 | supabase-community | juleswritescode | @@ -0,0 +1,47 @@
+import { spawn } from "node:child_process";
+import { type Socket, connect } from "node:net";
+
+function getSocket(command: string): Promise<string> {
+ return new Promise((resolve, reject) => {
+ const process = spawn(command, ["__print_socket"], {
+ stdio: "pipe",
+ });
+
+ process.on("error",... | ```suggestion
* Ensure the PGLT daemon server is running and create a Socket connected to the RPC channel
``` |
postgres_lsp | github_2023 | typescript | 240 | supabase-community | juleswritescode | @@ -0,0 +1,47 @@
+import { spawn } from "node:child_process";
+import { type Socket, connect } from "node:net";
+
+function getSocket(command: string): Promise<string> {
+ return new Promise((resolve, reject) => {
+ const process = spawn(command, ["__print_socket"], {
+ stdio: "pipe",
+ });
+
+ process.on("error",... | ```suggestion
* @param command Path to the PGLT daemon binary
``` |
postgres_lsp | github_2023 | typescript | 240 | supabase-community | juleswritescode | @@ -0,0 +1,453 @@
+// Generated file, do not edit by hand, see `xtask/codegen` | epic |
postgres_lsp | github_2023 | others | 239 | supabase-community | juleswritescode | @@ -168,7 +169,20 @@ pub fn create_config(
}
})?;
- let contents = toml::ser::to_string_pretty(&configuration)
+ // we now check if biome is installed inside `node_modules` and if so, we use the schema from there | 
|
postgres_lsp | github_2023 | others | 239 | supabase-community | juleswritescode | @@ -168,7 +169,20 @@ pub fn create_config(
}
})?;
- let contents = toml::ser::to_string_pretty(&configuration)
+ // we now check if biome is installed inside `node_modules` and if so, we use the schema from there
+ if VERSION == "0.0.0" {
+ let schema_path = Path::new("./node_modules/@pg... | den Part verstehe ich nicht so ganz, die früheste Version auf NPM wird ja >0.1.0 sein? |
postgres_lsp | github_2023 | others | 239 | supabase-community | juleswritescode | @@ -186,3 +200,68 @@ pub fn to_analyser_rules(settings: &Settings) -> AnalyserRules {
}
analyser_rules
}
+
+/// Takes a string of jsonc content and returns a comment free version
+/// which should parse fine as regular json.
+/// Nested block comments are supported.
+pub fn strip_jsonc_comments(jsonc_input: ... | wollen wir hierfür noch ein paar unit tests hinzufügen? |
postgres_lsp | github_2023 | others | 237 | supabase-community | juleswritescode | @@ -142,6 +146,21 @@ impl Parser {
}
}
+ /// Look ahead to the next relevant token *after the next token* | Der Kommentar innerhalb der \*\* ist n bisschen confusing, es ist zwar under the hood `next_pos + 1` aber für clients der API im Prinzip `current + 1`, oder? So liest es sich unten jedenfalls bei dem Ordinality check |
postgres_lsp | github_2023 | others | 216 | supabase-community | juleswritescode | @@ -0,0 +1,13 @@
+-- test
+select id, name, test1231234123, unknown from co;
+
+-- in between two statements
+
+select 14433313331333 -- after a statement | sanity check: `;` fehlt? |
postgres_lsp | github_2023 | others | 216 | supabase-community | juleswritescode | @@ -55,8 +55,8 @@ jobs:
- name: Abort
if: steps.validate-release.outputs.has-release != 'true'
run: |
- {
- echo "Tag ${{ github.event.inputs.release_tag }} not found."
+ {
+ echo "Tag ${{ github.event.inputs.release-tag }} not found." | \*angry old man noises\* |
postgres_lsp | github_2023 | others | 216 | supabase-community | juleswritescode | @@ -61,8 +61,18 @@ pub static WHITESPACE_TOKENS: &[SyntaxKind] = &[
SyntaxKind::SqlComment,
];
-static PATTERN_LEXER: LazyLock<Regex> =
- LazyLock::new(|| Regex::new(r"(?P<whitespace> +)|(?P<newline>\r?\n+)|(?P<tab>\t+)").unwrap());
+static PATTERN_LEXER: LazyLock<Regex> = LazyLock::new(|| {
+ #[cfg(windo... | machste das noch in dem PR? |
postgres_lsp | github_2023 | others | 219 | supabase-community | juleswritescode | @@ -0,0 +1,63 @@
+use pglt_diagnostics::{Diagnostic, MessageAndDescription};
+use text_size::TextRange;
+
+/// A specialized diagnostic for scan errors.
+///
+/// Scan diagnostics are always **fatal errors**.
+#[derive(Clone, Debug, Diagnostic, PartialEq)]
+#[diagnostic(category = "syntax", severity = Fatal)]
+pub stru... | what happens if we have multiple matches in an input? Is that possible? |
postgres_lsp | github_2023 | others | 219 | supabase-community | juleswritescode | @@ -0,0 +1,63 @@
+use pglt_diagnostics::{Diagnostic, MessageAndDescription};
+use text_size::TextRange;
+
+/// A specialized diagnostic for scan errors.
+///
+/// Scan diagnostics are always **fatal errors**.
+#[derive(Clone, Debug, Diagnostic, PartialEq)]
+#[diagnostic(category = "syntax", severity = Fatal)]
+pub stru... | the diagnostics should have distinct ranges, should we assert that as well? |
postgres_lsp | github_2023 | others | 219 | supabase-community | juleswritescode | @@ -235,7 +259,22 @@ impl Document {
.get(usize::from(affected_range.start())..usize::from(affected_range.end()))
.unwrap();
- let new_ranges = pglt_statement_splitter::split(changed_content).ranges;
+ let (new_ranges, diags) =
+ document::split_w... | hard to see in the github diff, but is `self` not a `Document` and we can check the fatal_error helper? |
postgres_lsp | github_2023 | others | 219 | supabase-community | juleswritescode | @@ -289,7 +328,22 @@ impl Document {
.get(usize::from(full_affected_range.start())..usize::from(full_affected_range.end()))
.unwrap();
- let new_ranges = pglt_statement_splitter::split(changed_content).ranges;
+ let (new_ranges, diags) =
+ document::split_with_diagno... | hard to see in the github diff, but is `self` not a `Document` and we can check the fatal_error helper? |
postgres_lsp | github_2023 | others | 219 | supabase-community | juleswritescode | @@ -69,37 +75,55 @@ impl Document {
changes
}
- /// Applies a full change to the document and returns the affected statements
- fn apply_full_change(&mut self, text: &str) -> Vec<StatementChange> {
+ /// Helper method to drain all positions and return them as deleted statements
+ fn drain_po... | hard to see in the github diff, but is `self` not a `Document` and we can check the fatal_error helper? |
postgres_lsp | github_2023 | others | 219 | supabase-community | juleswritescode | @@ -289,7 +328,22 @@ impl Document {
.get(usize::from(full_affected_range.start())..usize::from(full_affected_range.end()))
.unwrap();
- let new_ranges = pglt_statement_splitter::split(changed_content).ranges;
+ let (new_ranges, diags) =
+ document::split_with_diagno... | nit: duplicate logic |
postgres_lsp | github_2023 | others | 215 | supabase-community | psteinroe | @@ -0,0 +1,36 @@
+{
+ "name": "pglt",
+ "version": "0.1.0",
+ "bin": {
+ "pglt": "bin/pglt"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/supabase/postgres_lsp.git",
+ "directory": "packages/@pglt/pglt"
+ },
+ "author": "Philipp Steinrötter",
+ "contributors": [
+ {
+ ... | Can you change this to supabase community and just list me as a contributor? |
postgres_lsp | github_2023 | others | 214 | supabase-community | juleswritescode | @@ -0,0 +1,341 @@
+use anyhow::bail;
+use anyhow::Context;
+use anyhow::Error;
+use anyhow::Result;
+use futures::channel::mpsc::{channel, Sender};
+use futures::Sink;
+use futures::SinkExt;
+use futures::Stream;
+use futures::StreamExt;
+use pglt_lsp::LSPServer;
+use pglt_lsp::ServerFactory;
+use serde::de::Deserializ... | the use statements look a bit odd? something wrong with your nvim config? |
postgres_lsp | github_2023 | others | 214 | supabase-community | juleswritescode | @@ -0,0 +1,341 @@
+use anyhow::bail;
+use anyhow::Context;
+use anyhow::Error;
+use anyhow::Result;
+use futures::channel::mpsc::{channel, Sender};
+use futures::Sink;
+use futures::SinkExt;
+use futures::Stream;
+use futures::StreamExt;
+use pglt_lsp::LSPServer;
+use pglt_lsp::ServerFactory;
+use serde::de::Deserializ... | pretty cool |
postgres_lsp | github_2023 | others | 214 | supabase-community | juleswritescode | @@ -0,0 +1,341 @@
+use anyhow::bail;
+use anyhow::Context;
+use anyhow::Error;
+use anyhow::Result;
+use futures::channel::mpsc::{channel, Sender};
+use futures::Sink;
+use futures::SinkExt;
+use futures::Stream;
+use futures::StreamExt;
+use pglt_lsp::LSPServer;
+use pglt_lsp::ServerFactory;
+use serde::de::Deserializ... | Are we shutting down here? |
postgres_lsp | github_2023 | others | 214 | supabase-community | juleswritescode | @@ -0,0 +1,341 @@
+use anyhow::bail;
+use anyhow::Context;
+use anyhow::Error;
+use anyhow::Result;
+use futures::channel::mpsc::{channel, Sender};
+use futures::Sink;
+use futures::SinkExt;
+use futures::Stream;
+use futures::StreamExt;
+use pglt_lsp::LSPServer;
+use pglt_lsp::ServerFactory;
+use serde::de::Deserializ... | Hmm, would it be more flexible to let test callers handle the response themselves? |
postgres_lsp | github_2023 | others | 214 | supabase-community | juleswritescode | @@ -0,0 +1,341 @@
+use anyhow::bail;
+use anyhow::Context;
+use anyhow::Error;
+use anyhow::Result;
+use futures::channel::mpsc::{channel, Sender};
+use futures::Sink;
+use futures::SinkExt;
+use futures::Stream;
+use futures::StreamExt;
+use pglt_lsp::LSPServer;
+use pglt_lsp::ServerFactory;
+use serde::de::Deserializ... | Just a feeling: I think we need to be careful about what we abstract away and what we force the tests to do themselves.
For methods that are always called like `shutdown`, `initialize` etc. I think it makes sense to provide convenience methods.
But I'm not super about e.g. `open_document` – a bug might slip in be... |
postgres_lsp | github_2023 | others | 208 | supabase-community | psteinroe | @@ -0,0 +1,67 @@
+use pglt_analyse::{context::RuleContext, declare_lint_rule, Rule, RuleDiagnostic, RuleSource};
+use pglt_console::markup;
+
+declare_lint_rule! {
+ /// Adding a new column that is NOT NULL and has no default value to an existing table effectively makes it required.
+ ///
+ /// This will fail ... | we should pass the current postgres version to the rules! |
postgres_lsp | github_2023 | others | 206 | supabase-community | juleswritescode | @@ -124,7 +124,9 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
body: ${{ steps.create_changelog.outputs.content }}
tag_name: ${{ steps.create_changelog.outputs.version }}
- files: pglt_*
+ files: |
+ pglt_*
+ docs/schemas/latest/schema.json | Nice! Should we also regenerate the schema as part of the release workflow? |
postgres_lsp | github_2023 | others | 204 | supabase-community | juleswritescode | @@ -0,0 +1,464 @@
+use anyhow::{bail, Result};
+use biome_string_case::Case;
+use pglt_analyse::{AnalyserOptions, AnalysisFilter, RuleFilter, RuleMetadata};
+use pglt_analyser::{Analyser, AnalyserConfig};
+use pglt_console::StdDisplay;
+use pglt_diagnostics::{Diagnostic, DiagnosticExt, PrintDiagnostic};
+use pglt_query... | I just realized that the `declare_lint_rule` macro will use doc comment and attach it as a `.doc` property. I'm impressed 🤯 |
postgres_lsp | github_2023 | others | 204 | supabase-community | juleswritescode | @@ -0,0 +1,464 @@
+use anyhow::{bail, Result};
+use biome_string_case::Case;
+use pglt_analyse::{AnalyserOptions, AnalysisFilter, RuleFilter, RuleMetadata};
+use pglt_analyser::{Analyser, AnalyserConfig};
+use pglt_console::StdDisplay;
+use pglt_diagnostics::{Diagnostic, DiagnosticExt, PrintDiagnostic};
+use pglt_query... | rust is such a great language |
postgres_lsp | github_2023 | others | 204 | supabase-community | juleswritescode | @@ -0,0 +1,55 @@
+use pglt_analyse::{GroupCategory, RegistryVisitor, Rule, RuleCategory, RuleGroup, RuleMetadata};
+use regex::Regex;
+use std::collections::BTreeMap;
+
+pub(crate) fn replace_section(
+ content: &str,
+ section_identifier: &str,
+ replacement: &str,
+) -> String {
+ let pattern = format!(
+... | ```suggestion
/// group (e.g. "safety") -> <list of rules>
/// where <list of rules> is:
/// <rule name> -> metadata
``` |
postgres_lsp | github_2023 | others | 200 | supabase-community | juleswritescode | @@ -61,28 +61,28 @@ jobs:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
- name: 🛠️ Run Build
- run: cargo build -p pg_cli --release --target ${{ matrix.config.target }}
+ run: cargo build -p pglt_cli --release --target ${{ matrix.config.target }}
# window... | ```suggestion
cp target/${{ matrix.config.target }}/release/pglt_cli.exe ./dist/pglt_${{ matrix.config.target }}
``` |
postgres_lsp | github_2023 | others | 200 | supabase-community | juleswritescode | @@ -61,28 +61,28 @@ jobs:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
- name: 🛠️ Run Build
- run: cargo build -p pg_cli --release --target ${{ matrix.config.target }}
+ run: cargo build -p pglt_cli --release --target ${{ matrix.config.target }}
# window... | ```suggestion
cp target/${{ matrix.config.target }}/release/pglt_cli ./dist/pglt_${{ matrix.config.target }}
``` |
postgres_lsp | github_2023 | others | 202 | supabase-community | juleswritescode | @@ -0,0 +1,3 @@
+# Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv)
+libpg_query/ | 
|
postgres_lsp | github_2023 | others | 202 | supabase-community | juleswritescode | @@ -2,105 +2,29 @@
# Postgres Language Server
-A Language Server for Postgres. Not SQL with flavors, just Postgres.
+A collection of language tools and a Language Server Protocol (LSP) implementation for Postgres, focusing on developer experience and reliable SQL tooling.
-> [!WARNING]
-> This is in active devel... | great addition!!! |
postgres_lsp | github_2023 | others | 202 | supabase-community | juleswritescode | @@ -2,105 +2,29 @@
# Postgres Language Server
-A Language Server for Postgres. Not SQL with flavors, just Postgres.
+A collection of language tools and a Language Server Protocol (LSP) implementation for Postgres, focusing on developer experience and reliable SQL tooling.
-> [!WARNING]
-> This is in active devel... | 
|
postgres_lsp | github_2023 | others | 194 | supabase-community | psteinroe | @@ -36,15 +40,7 @@ impl Default for DatabaseConfiguration {
username: "postgres".to_string(),
password: "postgres".to_string(),
database: "postgres".to_string(),
+ conn_timeout_secs: Some(10), | 10 seconds is a long time :D usually the connection will happen either within <1s or never, maybe we should set this a bit lower to report issues earlier? |
postgres_lsp | github_2023 | others | 194 | supabase-community | psteinroe | @@ -42,6 +41,30 @@ impl SchemaCache {
})
}
+ fn pool_to_conn_str(pool: &PgPool) -> String { | mhh Connection Str Logic and cache keys on the schema cache feels like a leaking abstraction... why not handling this on the schema cache manager itself? After all, it should manage the schema cache for the workspace and can also be knowledgable of the connection string and handle caching? |
postgres_lsp | github_2023 | others | 194 | supabase-community | psteinroe | @@ -18,6 +18,10 @@ pub struct CliOptions {
#[bpaf(long("use-server"), switch, fallback(false))]
pub use_server: bool,
+ /// Skip over files containing syntax errors instead of emitting an error diagnostic. | Maybe I am misunderstanding, but is this the correct comment? I thought it would simply not connect to the db and still provide everything we can like lint and Syntax diagnostics |
postgres_lsp | github_2023 | others | 194 | supabase-community | psteinroe | @@ -26,6 +26,10 @@ pub struct DatabaseConfiguration {
/// The name of the database.
#[partial(bpaf(long("database")))]
pub database: String,
+
+ /// The connection timeout in seconds.
+ #[partial(bpaf(long("conn_timeout")))]
+ pub conn_timeout_secs: Option<u16>, | Not sure, but maybe we can set the default via bpaf? |
postgres_lsp | github_2023 | others | 172 | supabase-community | juleswritescode | @@ -13,6 +13,10 @@ username = "postgres"
password = "postgres"
database = "postgres"
+[migrations]
+migrations_dir = "migrations"
+after = 20230912094327 | should we remove it? or comment out the properties? |
postgres_lsp | github_2023 | others | 172 | supabase-community | juleswritescode | @@ -0,0 +1,116 @@
+use std::path::Path;
+
+#[derive(Debug)]
+pub(crate) struct Migration {
+ pub(crate) timestamp: u64,
+ pub(crate) name: String,
+}
+
+/// Get the migration associated with a path, if it is a migration file
+pub(crate) fn get_migration(path: &Path, migrations_dir: &Path) -> Option<Migration> {
+... | I don't fully understand what we're checking here – are we checking what happens if the .sql file is empty? or if it doesn't match the pattern? |
postgres_lsp | github_2023 | others | 172 | supabase-community | juleswritescode | @@ -0,0 +1,116 @@
+use std::path::Path;
+
+#[derive(Debug)]
+pub(crate) struct Migration {
+ pub(crate) timestamp: u64,
+ pub(crate) name: String,
+}
+
+/// Get the migration associated with a path, if it is a migration file
+pub(crate) fn get_migration(path: &Path, migrations_dir: &Path) -> Option<Migration> {
+... | very cool! |
postgres_lsp | github_2023 | others | 172 | supabase-community | juleswritescode | @@ -0,0 +1,116 @@
+use std::path::Path;
+
+#[derive(Debug)]
+pub(crate) struct Migration {
+ pub(crate) timestamp: u64,
+ pub(crate) name: String,
+}
+
+/// Get the migration associated with a path, if it is a migration file
+pub(crate) fn get_migration(path: &Path, migrations_dir: &Path) -> Option<Migration> {
+... | I really liked the explanation in the PR description about how popular tools all use similar migrations formats. Should we add a comment somewhere here that we expect a \<TimestampInMs>_\<rest> format? |
postgres_lsp | github_2023 | others | 172 | supabase-community | juleswritescode | @@ -56,7 +62,7 @@ impl CommandRunner for CheckCommandPayload {
}
fn should_write(&self) -> bool {
- self.write || self.fix
+ false | sanity check: did you just change this for debugging? |
postgres_lsp | github_2023 | others | 172 | supabase-community | juleswritescode | @@ -0,0 +1,17 @@
+use biome_deserialize_macros::{Merge, Partial};
+use bpaf::Bpaf;
+use serde::{Deserialize, Serialize};
+
+/// The configuration of the filesystem
+#[derive(Clone, Debug, Deserialize, Eq, Partial, PartialEq, Serialize, Default)]
+#[partial(derive(Bpaf, Clone, Eq, PartialEq, Merge))]
+#[partial(serde(re... | I don't know if we use [bpaf-derive](https://crates.io/crates/bpaf_derive/0.1.0), but if we do, we *could* also parse into a `PathBuf`.
Examples of that were hard to find, so maybe that's not the recommended way – I'm not sure |
postgres_lsp | github_2023 | others | 172 | supabase-community | juleswritescode | @@ -150,13 +157,31 @@ impl WorkspaceServer {
Ok(())
}
+ fn is_ignored_by_migration_config(&self, path: &Path) -> bool {
+ let set = self.settings();
+ set.as_ref()
+ .migrations
+ .as_ref()
+ .and_then(|migration_settings| {
+ tracing::inf... | very sweet! |
postgres_lsp | github_2023 | others | 172 | supabase-community | juleswritescode | @@ -150,13 +157,28 @@ impl WorkspaceServer {
Ok(())
}
+ fn is_ignored_by_migration_config(&self, path: &Path) -> bool {
+ let set = self.settings();
+ set.as_ref()
+ .migrations
+ .as_ref()
+ .and_then(|migration_settings| {
+ let ignore_b... | What happens if we pass a migrations_dir but no `after`? Wouldn't the `and_then` return `None`, so the function would always return `false`? |
postgres_lsp | github_2023 | others | 169 | supabase-community | juleswritescode | @@ -0,0 +1,27 @@
+// pub conn: &'a PgPool,
+// pub sql: &'a str,
+// pub ast: &'a pg_query_ext::NodeEnum,
+// pub tree: Option<&'a tree_sitter::Tree>, | ```suggestion
``` |
postgres_lsp | github_2023 | others | 169 | supabase-community | juleswritescode | @@ -25,90 +29,28 @@ pub struct TypeError {
pub constraint: Option<String>,
}
-pub async fn check_sql<'a>(params: TypecheckerParams<'a>) -> Vec<TypeError> {
- let mut errs = vec![];
-
- // prpeared statements work only for select, insert, update, delete, and cte
- if match params.ast {
- pg_query... | ```suggestion
``` |
postgres_lsp | github_2023 | others | 169 | supabase-community | juleswritescode | @@ -336,50 +339,95 @@ impl Workspace for WorkspaceServer {
filter,
});
- let diagnostics: Vec<SDiagnostic> = doc
- .iter_statements_with_range()
- .flat_map(|(stmt, r)| {
- let mut stmt_diagnostics = vec![];
-
- stmt_diagnostics.extend(s... | Nit: `.read().and_then(|p| p.get_pool())` ?
Not sure if there could ever be a `None` in `self.connection` |
postgres_lsp | github_2023 | others | 169 | supabase-community | juleswritescode | @@ -336,50 +339,95 @@ impl Workspace for WorkspaceServer {
filter,
});
- let diagnostics: Vec<SDiagnostic> = doc
- .iter_statements_with_range()
- .flat_map(|(stmt, r)| {
- let mut stmt_diagnostics = vec![];
-
- stmt_diagnostics.extend(s... | that's a nice API 🙃 |
postgres_lsp | github_2023 | others | 169 | supabase-community | juleswritescode | @@ -0,0 +1,217 @@
+use std::io;
+
+use pg_console::markup;
+use pg_diagnostics::{Advices, Diagnostic, LogCategory, MessageAndDescription, Severity, Visit};
+use sqlx::postgres::{PgDatabaseError, PgSeverity};
+use text_size::TextRange;
+
+/// A specialized diagnostic for the typechecker.
+///
+/// Type diagnostics are a... | I'm not 100% sure, but I think `TextRange::end` is _exclusive_ – maybe we need to add 1 here |
postgres_lsp | github_2023 | others | 167 | supabase-community | juleswritescode | @@ -26,8 +26,7 @@ pub fn parse(sql: &str) -> Result<NodeEnum> {
.nodes()
.iter()
.find(|n| n.1 == 1)
- .unwrap()
- .0
- .to_enum()
- })
+ .map(|n| n.0.to_enum())
+ .ok_or_else(|| Error::Parse("Unable to find root node".to_s... |  |
postgres_lsp | github_2023 | others | 167 | supabase-community | juleswritescode | @@ -368,7 +368,7 @@ impl Pattern {
/// `Pattern` using the default match options (i.e. `MatchOptions::new()`).
pub fn matches_path(&self, path: &Path) -> bool {
// FIXME (#9639): This needs to handle non-utf8 paths
- path.to_str().map_or(false, |s| self.matches(s))
+ path.to_str().is_so... | these changes come from the `lint` in the justfile, right? awesome! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.