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

feat(lsp): multi deno.json resolver scopes #24206

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

nayeemrmn
Copy link
Collaborator

Closes denoland/vscode_deno#787.
Closes denoland/vscode_deno#938.

After this, remaining TODOs are:

  • Separate TS type checking environments across deno.json scopes (different global declarations, tsconfigs etc).
  • Inheritance of properties in workspace members. This must be fleshed out and implemented in the CLI first.

}
spawn(async move { resolver.set_npm_reqs(&package_reqs).await })
.await
.ok();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the warn? It's sometimes useful to see.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see it was moved into the resolver. Nvm.

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nayeemrmn nayeemrmn merged commit 5dec3fd into denoland:main Jun 17, 2024
17 checks passed
@nayeemrmn nayeemrmn deleted the lsp-resolver-scopes branch June 17, 2024 20:54
@felipecrs
Copy link

Is it correct to say that with this PR I can remove my deno.enabledPaths from .vscode/settings.json provided each of these enabled paths already have a deno.jsonc?

@nayeemrmn
Copy link
Collaborator Author

@felipecrs The purpose of deno.enablePaths is to disable Deno for everything outside of those paths, perhaps you didn't need it in the first place.

@felipecrs
Copy link

Not really, that was exactly why I needed it. I had a project with both node.js and deno.

This means deno.jsonc will be discovered regardless of where it's set in the workspace, but once discovered, Deno will be enabled for the entire workspace.

Therefore, I still need deno.enablePaths for my node.js + deno projects.

Is this understanding correct?

@nayeemrmn
Copy link
Collaborator Author

@felipecrs Yes. However, if you like you can delete the deno.jsonc in your root directory and only have it in each Deno-enabled subdirectory. This will work now. You can then remove deno.enablePaths.

@felipecrs
Copy link

felipecrs commented Jun 17, 2024

Perfect! I didn't have deno.jsonc in my workspace's root, only in my deno-enabled subdirectories.

I guess this means that, for my use case, I can remove deno.enablePaths after all. :)

bartlomieju pushed a commit that referenced this pull request Jun 18, 2024
Follow up to #24206 which broke deno_std intellisense.
bartlomieju pushed a commit that referenced this pull request Jun 18, 2024
Follow up to #24206 which broke deno_std intellisense.
@char
Copy link
Contributor

char commented Jun 26, 2024

This has broken my setup:

project1/
  mod.ts
  deno.json { imports: { myDep: "https://esm.sh/..." } }
project2/
  mod.ts
  deno.json { imports: { myDep: "./vendor/myDep.ts", project1: "../project1/mod.ts" } }
  vendor/
    myDep.ts

I want to use the vendored dependency at runtime - previously I could open the project2 subfolder in the editor and everything could work, but now anything imported from project1 inside project2 has broken IntelliSense when using types from myDep. This seems like a divergence from CLI behavior (when running Deno, everything is resolved using the initial deno.json config's import settings)

Where do I go from here? I can try a workspaces config to take advantage of #24246 but it would mean my parent deno.json config needs every subproject's dependencies in its import map, rather than only having relevant deps available to the import resolver

@nayeemrmn
Copy link
Collaborator Author

@char It's necessary to diverge from CLI behaviour when multiple scopes are involved because the editor doesn't have a concept of an entrypoint, for most usages it has to respect the nearest scope of each file. I'm not sure what to do in your case, there's no one for one substitute configuration, but it's an unusual case.

zebreus pushed a commit to zebreus/deno that referenced this pull request Jul 8, 2024
zebreus pushed a commit to zebreus/deno that referenced this pull request Jul 8, 2024
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

Successfully merging this pull request may close these issues.

deno.json not recognized if not at root of workspace Allow using different deno configs for different dirs
4 participants