vscode_deno icon indicating copy to clipboard operation
vscode_deno copied to clipboard

LSP loses deno namespace info when switching from node subdirectory to deno subdirectory

Open scarf005 opened this issue 3 months ago • 0 comments

Describe the bug

Deno LSP occasionally loses tsconfig lib info when working in mixed nodejs and deno environment.

To Reproduce

It's not guaranteed to be reproducible, but i got into this bug via

  1. create a new vite react+typescript project
  2. add deno.json and settings.json to only enable deno in scripts/ subdirectory
  3. work on vite(node) project
  4. return to scripts/, suddenly lib info is gone such as "lib": ["deno.window"],

.vscode/settings.json

{
	"deno.config": "./deno.jsonc",
	"deno.enablePaths": ["scripts"],
	"[typescript][typescriptreact][json][jsonc]": {
		"editor.defaultFormatter": "denoland.vscode-deno"
	}
}

deno.jsonc

{
	"exclude": ["dist"],
	"fmt": {
		"semiColons": false,
		"useTabs": true,
		"proseWrap": "never"
	}
}

tsconfig.json

{
	"compilerOptions": {
		"target": "ES2020",
		"useDefineForClassFields": true,
		"lib": ["ES2020", "DOM", "DOM.Iterable"],
		"module": "ESNext",
		"skipLibCheck": true,

		/* Bundler mode */
		"moduleResolution": "bundler",
		"allowImportingTsExtensions": true,
		"resolveJsonModule": true,
		"isolatedModules": true,
		"noEmit": true,
		"jsx": "react-jsx",

		/* Linting */
		"strict": true,
		"noUnusedLocals": true,
		"noUnusedParameters": true,
		"noFallthroughCasesInSwitch": true
	},
	"include": ["src"],
	"exclude": ["scripts"],
	"references": [{ "path": "./tsconfig.node.json" }]
}

Expected behavior

Deno LSP should not use the information from package.json if there's already an deno.jsonc.

Could not set npm package requirements. Error getting response at https://registry.npmjs.org/@mantine/core for package "@mantine/core": An npm specifier not found in cache: "@mantine/core", --cached-only is specified.

for example, despite having enablePaths defined, vscode deno extension tries to analyze node path (src/App.tsx) which is not in enablePaths, ending up in error.

Screenshots

https://github.com/denoland/vscode_deno/assets/54838975/375f5152-9add-4f5c-ae32-9bf86f107750

Versions

vscode: 1.87.0 deno: 1.41.3+2ce6451 extension: v3.35.1

scarf005 avatar Mar 21 '24 06:03 scarf005