deno icon indicating copy to clipboard operation
deno copied to clipboard

Deno doesn't work in VSCode workspaces properly

Open nikitavoloboev opened this issue 10 months ago • 3 comments

I have a workspace that looks like this:

image

I enabled deno in the workspace:

image

However when I do this some files in workspace gives errors due to deno:

image

This file uses Bun APIs so should not be linted with Deno.

I tried to solve it by making a file ~/src/ts/.vscode/settings.json with this content:

{
    "deno.enable": false
}

It makes errors go away:

image

Great. However I have this repo that is actual Deno project in ~/src/ts/packages/ts-utils (GitHub repo).

And if I do "deno.enable": false above, Deno breaks down on that project.

In workspace:

image

Standalone:

CleanShot 2024-04-05 at 16 51 28@2x

Please help solve this. Big blocker in adopting Deno for me.

deno --version
deno 1.42.1 (release, aarch64-apple-darwin)
v8 12.3.219.9
typescript 5.4.3

nikitavoloboev avatar Apr 05 '24 12:04 nikitavoloboev

image

Deno even fails to ignore the lints when it shouldn't so I can't solve above with this either. 😿

nikitavoloboev avatar Apr 05 '24 12:04 nikitavoloboev

Ideally what I want is not to have the deno.enable: true inside my .code-workspace I open.

But I want VSCode Deno extension to use this:

image

This should be enough to not have Deno extension breaking down.

image

nikitavoloboev avatar Apr 05 '24 13:04 nikitavoloboev

I, as well, am having some issues with vscode workspaces. I have a regular deno project so no bun is involved. But I do have the setup where I have a subdirectory with deno code that I want to be linted, formatted, and enabled for deno scripts, and for the rest of the project, I do not want to use deno.

The issues that I am having are related to manually formatting my deno scripts which are typescript code. When I use the VSCode key combination 'Shift + Alt + F' to format my deno scripts, I get the following message box: image

I only get this when I have my project opened as a vscode workspace. If I open the project in a standard way at the root of the project/repo, formatting works fine, I get no message box, and I also do not get any strange enable vs disable behavior.

[!Note] I am running deno version v1.43.1 and the extension version is v3.37.0

At this point, it seems obvious to me that the issue is related to deno support with VSCode workspaces.

I have a docusaurus website where I am using deno for dev stuff and cicd related things. This is why I have the workspaces.

The project is open source named VelaptorDocs and you can see what I have set up there.

Here is my vscode workspace

{
	"folders": [
		{
			"name": "VelaptorDocs",
			"path": ".",
		},
		{
			"name": "SampleProjects",
			"path": "./SampleProjects",
		},
		{
			"name": "CICD",
			"path": ".github/cicd",
		}
	],
	"settings": {
        "testing.followRunningTest": true,
        "testing.gutterEnabled": false,
        "testing.openTesting": "neverOpen",
		"typescript.referencesCodeLens.enabled": true,
		"powershell.cwd": "VelaptorDocs",
	}
}
I have 2 `setting.json` files. One is in the standard location at the root `.vscode` directory shown below

{
	"deno.enable": false,
	"cSpell.words": [
		"cicd",
		"clsx",
		"defaultdocumentation",
		"Infima",
		"Kinson",
		"KXVA",
		"Multiauthor",
		"Playmegames",
		"preinstall",
		"Reguler",
		"Structs",
		"tailwindcss",
		"Texinfo",
		"typecheck",
		"Velaptor"
	],
	"files.exclude": {
		".docusaurus/": true,
		"node_modules": true,
		"VelaptorDocs.code-workspace": true,
		"build/": true,
		".github/cicd/": true,
		".config": false,
		"RepoSrc/": true,
		"*.lock": true,
		"SampleProjects": true,
	},
	"search.exclude": {
		"**/node_modules": true,
		"**/bower_components": true,
		"**/*.code-search": true,
		"build/": true
	},
	"[typescriptreact]": {
		"editor.defaultFormatter": "vscode.typescript-language-features",
		"editor.insertSpaces": false,
		"editor.tabSize": 3,
	},
	"[typescript]": {
		"editor.defaultFormatter": "vscode.typescript-language-features",
		"editor.insertSpaces": false,
		"editor.tabSize": 4,
	},
	"[yaml]": {
		"editor.insertSpaces": true,
		"editor.tabSize": 2,
	},
	"[jsonc]": {
		"editor.insertSpaces": false,
		"editor.tabSize": 4,
	},
	"[mdx]": {
		"editor.insertSpaces": true,
		"editor.tabSize": 4,
	},
	"editor.detectIndentation": false,
	"[github-actions-workflow]": {
		"editor.tabSize": 2,
		"editor.insertSpaces": true
	}
}

The other 'settings.json' file is in the .github/cicd/.vscode/ directory. File is shown below:

{
	"deno.enable": true,
	"deno.config": "../deno.json",
	"cSpell.words": [
		"cicd",
		"defaultdocumentation",
		"docu",
		"Kinson",
		"Velaptor"
	],
}

I have tried simple projects with minimum files just to try and get it working. I have also tried disabling all extensions except for the deno extension to see if that would help.

CalvinWilkinson avatar May 03 '24 08:05 CalvinWilkinson

In ~/src/ts/.vscode/settings.json, have:

{
  "deno.enablePaths": ["packages/ts-utils"],
}

Please comment here if that doesn't work.

nayeemrmn avatar Jun 28 '24 16:06 nayeemrmn