Describe the bug
When saving a file and denoland.vscode-deno is used as a default formatter, I get incorrect formatted files. The documentation states that the extension uses the deno.json config file for formatting. The problem with that is, that it does not respect custom linter plugins and thus formats the files incorrectly. It looks like the extension does a deno fmt instead of a deno lint --fix.
To Reproduce
- Use this custom plugin (or any other plugin):
export default {
name: 'colon-spacing',
rules: {
'after-function': {
create(context): Deno.lint.LintVisitor {
return {
TSTypeAnnotation(node): void {
if (node.parent.type === 'FunctionDeclaration') {
const functionStart = node.parent.range[0];
const sectionEnd = node.range[0];
const index =
context.sourceCode.getText(node.parent).substring(0, sectionEnd - functionStart).search(/\) *$/) + 1;
const sectionStart = functionStart + index;
if (index !== -1 && sectionEnd - sectionStart !== 1) {
context.report({
message: `Wrong colon spacing.`,
range: [sectionStart - 1, sectionEnd + 1],
fix(fixer) {
return fixer.replaceTextRange([sectionStart, sectionEnd], ' ');
}
});
}
}
}
};
}
}
}
} satisfies Deno.lint.Plugin;
- Use the example code:
export function Foo(prop1: string, prop2: number) : string {
return 'Hello World!';
}
- Saving the file, using
denoland.vscode-deno as formatter will result in the following:
- export function Foo(prop1: string, prop2: number) : string {
+ export function Foo(prop1: string, prop2: number): string {
return 'Hello World!';
}
- But formatting, using
deno lint --fix results in:
- export function Foo(prop1: string, prop2: number) : string {
+ export function Foo(prop1: string, prop2: number) : string {
return 'Hello World!';
}
Expected behavior
The VS-Code extension should respect the custom linter plugins, provided in the deno.json config.
Versions
- vscode:
1.105.1
- deno:
2.5.6
- extension:
v3.46.1
Describe the bug
When saving a file and
denoland.vscode-denois used as a default formatter, I get incorrect formatted files. The documentation states that the extension uses the deno.json config file for formatting. The problem with that is, that it does not respect custom linter plugins and thus formats the files incorrectly. It looks like the extension does adeno fmtinstead of adeno lint --fix.To Reproduce
denoland.vscode-denoas formatter will result in the following:deno lint --fixresults in:Expected behavior
The VS-Code extension should respect the custom linter plugins, provided in the
deno.jsonconfig.Versions
1.105.12.5.6v3.46.1