simolus3 / drift

Drift is an easy to use, reactive, typesafe persistence library for Dart & Flutter.
https://drift.simonbinder.eu/
MIT License
2.64k stars 370 forks source link

Syntax highlighting of .drift files in VSCode (almost perfect) #473

Open JCKodel opened 4 years ago

JCKodel commented 4 years ago

To get syntax highlighting (at least the colors), I've configurated my VS code as this:

{
    "[sql]": {
        "editor.formatOnSave": false,
        "editor.formatOnPaste": false,
        "editor.formatOnType": false
    },
    "files.associations": {
        "**/*.moor": "sql"
    }
}

This will result in: image

It works, but it shows errors because it tries to parse it as an MSSQL script.

When I set the language mode to sql.none, it works as intended:

1) Click here image

2) Change to none here: image

The, I get the .moor file with coloring and autocomplete (throught the moor extension), without any errors (as intended).

image

My question is: how to automatically configure the .moor extension to sql language mode, with NONE pre selected?

North101 commented 4 years ago

I believe this is what you're looking for: https://scottaddie.com/2016/04/10/file-to-language-associations-in-visual-studio-code/

simolus3 commented 4 years ago

After https://github.com/Dart-Code/Dart-Code/pull/2203 gets released (might take some time, the underlying apis are still experimental in VS Code) moor will be able to contribute its own highlighting.

You can already use moor's IDE with the Dart extension for VS Code. This will enable error reporting, folding, outline and (partly) navigation and auto-complete. It's still a bit buggy, but it might help.

JCKodel commented 4 years ago

I believe this is what you're looking for: https://scottaddie.com/2016/04/10/file-to-language-associations-in-visual-studio-code/

Not really. I already did all, except disable the MSSQL parsing automatically.

You can already use moor's IDE with the Dart extension for VS Code. This will enable error reporting, folding, outline and (partly) navigation and auto-complete. It's still a bit buggy, but it might help.

I'm already doing this (and I really don't care much for intellisense). But moor's IDE don't have syntax highlighting (it treats the file as text, with all text white).

JCKodel commented 4 years ago

Solved removing all sql extensions from VSCode (it will still recognize sql files with color syntax highlighting, but won't try to parse it).

As I use Microsoft SQL Server Management Studio or Azure Data Studio for SQL stuff, that plugin will not be missed.

listepo commented 11 months ago

Any news about vscode extension for .drift files?