Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting breaks PostgreSQL code #105

Open
cs-clarence opened this issue Sep 6, 2022 · 8 comments
Open

Formatting breaks PostgreSQL code #105

cs-clarence opened this issue Sep 6, 2022 · 8 comments

Comments

@cs-clarence
Copy link

I'm using neovim with nanotee/sqls.nvim plugin but formatting doesn't seem to work properly.

For example, this code:

CREATE TABLE
  users (
    id BIGSERIAL PRIMARY KEY,
    username TEXT UNIQUE NOT NULL CHECK > 8,
    password TEXT NOT NULL
  );

Will be formatted to:

CREATETABLEusers(
  id BIGSERIALPRIMARYKEY,
  usernameTEXTUNIQUENOTNULLCHECK>8,
  passwordTEXTNOTNULL
);
@janneliukkonen
Copy link

Check whether you have two sqls LSP servers active same time.

@cs-clarence
Copy link
Author

Check whether you have two sqls LSP servers active same time.

I only have sqls for sql files

@guilty-p01nt3r
Copy link

guilty-p01nt3r commented Oct 4, 2022

Same Problem here:

NVIM v0.8.0-1210-gd367ed9b2
Build type: Release
LuaJIT 2.1.0-beta3
sqls version: 0.2.22

The only Langauge Server Attached to the session are copilot and sqls:
image

@CiaronHowell
Copy link

Running into the same issue:
image

After writing:
image

Output of LspInfo:
image

@AndrewWinterman
Copy link

just ran into same issue

@AWinterman
Copy link

I have a hunch the nvim plugin is allowing the document formatting params to be their defaults, meaning InsertSpaces is false here:

type FormattingOptions struct {
	TabSize                float64 `json:"tabSize"`
	InsertSpaces           bool    `json:"insertSpaces"`
	TrimTrailingWhitespace bool    `json:"trimTrailingWhitespace,omitempty"`
	InsertFinalNewline     bool    `json:"insertFinalNewline,omitempty"`
	TrimFinalNewlines      bool    `json:"trimFinalNewlines,omitempty"`
}

@AWinterman
Copy link

okay, this was actually quite silly, i had no conenctions configured because i thought the docs for the neovim plugin that wraps the underlying lsp plugin were all i needed to do.

@gipo355
Copy link

gipo355 commented Feb 6, 2024

same happening to me, breaking all queries with auto format

nixypanda added a commit to nixypanda/dotfiles that referenced this issue Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants