1

I have a SQL file that's parsed through a PostgreSQL database with no error and I have an annoying highlighting issue in VSCode. msgs is a type of an array of TEXTs.

CREATE TABLE users_chat
(
    id SERIAL PRIMARY KEY,
    user_id INTEGER,
    friend_id INTEGER,
    msgs TEXT[]
);

The [] is getting a red squiggly line and the file is red in the folder. It's annoying.

What can I do to get rid of it?

3
  • 2
    I'd guess Visual Studio Code doesn't know Postgres syntax. May an extension can teach it? Maybe this one? Commented Aug 1, 2020 at 21:07
  • didn't work. interesting extension tho might play with that one later. Commented Aug 1, 2020 at 21:19
  • thanks for pointing me in the right direction with teaching vscode the syntax that helped me google some other things and got an answer that worked. Commented Aug 1, 2020 at 21:28

2 Answers 2

5

Visual Studio Code vs SQL Formatting vscode
Win: Ctrl+Shift+P / Mac: Cmd+Shift+P
And then type "Change Language Mode".
Then type 'postgresql'

Sign up to request clarification or add additional context in comments.

Comments

2

Besides @frogtoprincejs's answer, you could also rename your ".sql" files to ".psql" so VS Code will automatically interpret it as PostgreSQL

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.