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

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

Open
scarf005 opened this issue Mar 21, 2024 · 0 comments

Comments

@scarf005
Copy link

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

2024-03-21_08-37-44.mp4

Versions

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant