Just another addition which might scratch your head a little bit. It took me a couple of hours.
My settings.json
:
{
"licenser.license": "MPLv2",
"editor.defaultFormatter": "denoland.vscode-deno",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always",
},
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"[javascript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"deno.enable": true,
"deno.config": "./deno.jsonc",
}
My deno.jsonc
:
{
"compilerOptions": {
"allowJs": false,
"lib": ["deno.window"],
"strict": true
},
"lint": {
"include": ["src/"],
"exclude": ["src/testdata/", "data/fixtures/**/*.ts"],
"rules": {
"tags": ["recommended"],
"include": ["ban-untagged-todo"],
"exclude": ["no-unused-vars"]
}
},
"fmt": {
"useTabs": false,
"lineWidth": 80,
"indentWidth": 2,
"semiColons": true,
"singleQuote": true,
"proseWrap": "preserve",
"include": ["src/", "main.ts"],
"exclude": ["src/testdata/", "data/fixtures/**/*.ts"]
},
"lock": false,
"nodeModulesDir": false,
"test": {
"include": ["src/"],
"exclude": ["src/testdata/", "data/fixtures/**/*.ts"]
},
"tasks": {
"start": "deno run main.ts"
},
"imports": {}
}
In your settings.json
, the formatter works only when I add [typescript]
part.
And also, check your fmt.include
. I forgot to add main.ts
into it.
"[typescript]": {"editor.defaultFormatter": "denoland.vscode-deno"}
– Garpike