Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno doesn't work in VSCode workspaces properly #23245

Closed
nikitavoloboev opened this issue Apr 5, 2024 · 4 comments
Closed

Deno doesn't work in VSCode workspaces properly #23245

nikitavoloboev opened this issue Apr 5, 2024 · 4 comments
Labels
lsp related to the language server question a question about the use of Deno

Comments

@nikitavoloboev
Copy link

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 nikitavoloboev changed the title Deno doesn't work Deno doesn't work in VSCode workspaces properly Apr 5, 2024
@nikitavoloboev
Copy link
Author

image

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

@nikitavoloboev
Copy link
Author

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

@CalvinWilkinson
Copy link

CalvinWilkinson commented May 3, 2024

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.

@lucacasonato lucacasonato added feat new feature (which has been agreed to/accepted) lsp related to the language server labels Jun 11, 2024
@nayeemrmn
Copy link
Collaborator

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

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

Please comment here if that doesn't work.

@nayeemrmn nayeemrmn added question a question about the use of Deno and removed feat new feature (which has been agreed to/accepted) labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lsp related to the language server question a question about the use of Deno
Projects
None yet
Development

No branches or pull requests

4 participants