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

[bug] type display doesn't work correctly with deno.json imports #19121

Closed
Lenni009 opened this issue May 13, 2023 · 4 comments
Closed

[bug] type display doesn't work correctly with deno.json imports #19121

Lenni009 opened this issue May 13, 2023 · 4 comments
Labels
bug Something isn't working correctly lsp related to the language server

Comments

@Lenni009
Copy link
Contributor

Lenni009 commented May 13, 2023

Let's say we're importing parse from https://deno.land/std/flags/mod.ts.
If we do that at the top of the file with import { parse } from <url>, everything works fine. If I do the parse(Deno.args), and hover over it, I get the correct interface displayed:
grafik

If I import it via deno.json, and then just do import { parse } from 'flags', it has the any type.

deno.json:

{
  "imports": {
    "flags": "https://deno.land/[email protected]/flags/mod.ts",
  }
}

grafik

Just copying the URL to the main TS file instead of the json immediately brings back the type.

Expected:
Always display the proper type information, like it does when importing directly from the URL, without import map.

@Lenni009 Lenni009 changed the title [bug] type checking doesn't work correctly with deno.json imports [bug] type display doesn't work correctly with deno.json imports May 13, 2023
@bartlomieju
Copy link
Member

@dsherret could you take a look at this problem?

@bartlomieju bartlomieju added bug Something isn't working correctly lsp related to the language server labels May 13, 2023
@nayeemrmn
Copy link
Collaborator

Looks fixed

@nayeemrmn
Copy link
Collaborator

grafik

Actually looking at this it seems the flags import is unresolved. So the LSP is probably not detecting the import map. Maybe your deno.json is not in the root directory? If so, that's tracked in #14245 and denoland/vscode_deno#787.

@Lenni009
Copy link
Contributor Author

Just tested again, and it worked as expected. Now that you mention it, the import really does look unresolved. I wasn't very experienced back when I opened this issue 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly lsp related to the language server
Projects
None yet
Development

No branches or pull requests

3 participants