again
again5mo ago

deno fmt doesn't work properly using Visual Studio Code and WSL2

I am using: - Visual Studio Code 1.91.1 - Deno extension (in WSL: UBUNTU) v3.38.0 - WSL extension v0.88.2 - Deno 1.45.3 - WSL2 .vscode/settings.json:
{
"deno.enable": true,
"deno.unstable": true,
"editor.defaultFormatter": "denoland.vscode-deno",
"editor.formatOnSave": true
}
{
"deno.enable": true,
"deno.unstable": true,
"editor.defaultFormatter": "denoland.vscode-deno",
"editor.formatOnSave": true
}
Whenever I save a file it automatically formats to the visual studio code settings (4 spaces for json/js/ts files). I have no user preferences. deno fmt filename works properly because it indents the file to 2 spaces (default deno fmt settings). I just want to know if anyone has the same problem ?
No description
6 Replies
Deno AI Helper
Deno AI Helper5mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the information you've provided, your settings seem to be correctly set up for using deno fmt with Visual Studio Code and WSL2. One thing to note is that you are using an older version of Visual Studio Code (1.91.1) and Deno (1.45.3). The current versions of these tools may have received updates that could potentially resolve your issue. It might be beneficial to update both Visual Studio Code and Deno to their latest versions and see if the problem persists. Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of the advice given. If updating does not resolve the issue, you may want to check if there are any conflicting settings in your workspace settings or if there are other extensions that could be interfering with the Deno extension's formatting capabilities.
again
againOP5mo ago
it didn't help
Deno AI Helper
Deno AI Helper5mo ago
I'm sorry to hear that the issue persists. Since the advice provided did not resolve the problem and there's no specific solution in the official Deno documentation, it might be helpful to consider the following steps: 1. Ensure that there are no conflicting formatter extensions enabled in your Visual Studio Code that might be overriding the Deno formatter. 2. Check if there are any workspace-specific settings that could be interfering with the Deno formatter. 3. Try disabling and re-enabling the Deno extension in Visual Studio Code to see if that resets the formatter behavior. 4. Look for any open issues on the Deno extension's GitHub repository that might be similar to your problem, or consider opening a new issue there. Remember to also check the output or problems pane in Visual Studio Code for any errors or warnings that might provide more insight into the issue. Since these suggestions are not from the official Deno documentation, please verify their accuracy and applicability to your situation. If the problem continues, engaging with the Deno community through forums or the Deno extension's GitHub repository may help you find a solution.
again
againOP5mo ago
It seems like it is not a WSL2 specific issue: I could reproduce it in Windows environment
drom765
drom7655mo ago
the docs starts with: Deno ships with a built-in code formatter that will auto-format the following files: .js .ts .jsx .tsx .md .markdown .json .jsonc So i believe it works as intended. Sorry, i misinterpreted the problem.
again
againOP5mo ago
I do not want to deviate from the default behavior: I want it. Whenever I create a new file example.ts/js/json... Visual Studio Code always assume that the identation should be 4 spaces instead of deno 2 spaces default