tauri-apps / create-tauri-app

Rapidly scaffold out a new tauri app project.
Apache License 2.0
940 stars 81 forks source link

Include `$schema` property in tauri.conf.json for intellisense #725

Open Ciantic opened 1 week ago

Ciantic commented 1 week ago

VSCode has ability to check and provide intellisense for JSON files with schema.json, if you have property called "$schema", e.g.:

image

Tauri already has schema.json files made for this, but it's not added by the templates, thus the users don't get the benefit of error checking in the editor.

You can try this intellisense by giving an URL to e.g. esm.sh like this:

{
    "$schema": "https://esm.sh/@tauri-apps/cli/schema.json",
    "build": {  
        "beforeBuildCommand": "",
        "beforeDevCommand": "",
        "devPath": "html",
        "distDir": "html",
        "withGlobalTauri": true
    }
}

Thanks!

amrbashir commented 1 week ago

you can also use Tauri vscode extension which provides completion for v1 and v2 apps, it will also check if you have the cli installed in node_modules and will use the schema from there if needed, otherwise will pull it from github.

amrbashir commented 1 week ago

I am gonna keep this issue open as I want to eventually support providing schema through https://schema.tauri.app, https://schema.tauri.app/v1.2.4 and https://schema.tauri.app/v2. Once that is implemented, we can add that in the templates.