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: Support IntelliSense autocomplete for valid registries when using import map specifiers #752

Open
jsejcksn opened this issue Nov 29, 2022 · 4 comments

Comments

@jsejcksn
Copy link
Contributor

jsejcksn commented Nov 29, 2022

I would like to see IntelliSense autocompletion for imports from valid registries when those registries have been mapped to arbitrary specifiers using an import map.

I'm aware that this issue is being tracked in the CLI repo in regard to LSP support at this issue. I'm creating an issue here in this repo specifically for tracking behavior about the extension in VS Code, and to document the current behavior (below).

I have an example directory structure like this:

% ls -AF
.vscode/		import_map.json
deno.jsonc		main.ts

% cat .vscode/settings.json 
{
  "deno.enable": true
}

% cat deno.jsonc 
{
  "importMap": "./import_map.json"
}

% cat import_map.json 
{
  "imports": {
    "std/": "https://deno.land/[email protected]/"
  }
}

% cat main.ts 

% deno --version
deno 1.28.2 (release, x86_64-apple-darwin)
v8 10.9.194.1
typescript 4.8.3

If I open the directory as a workspace in VS Code, and then open the file main.ts in an editor tab, and begin to type an import statement which uses the full URL for the standard library specifier in the import map, I get IntelliSense autocompletions. Here's a screenshot example to illustrate:

Screen Shot 2022-11-29 at 03 29 48

However, If I try to use the import map specifier for the same registry, the IntelliSense does not provide autocompletions beyond the specifier itself. It is aware that the mapped specifier exists:

Screen Shot 2022-11-29 at 03 31 16

But doesn't provide any further suggestions:

Screen Shot 2022-11-29 at 03 31 47

Further observations:

If I type out the complete path for a valid module in the registry using the literal URL, the module is cached as soon as I stop typing, without even needing to save the file:

Screen Shot 2022-11-29 at 03 37 04

But when using the import map specifier path to a module, I get a diagnostic signal (red wavy underlines) with conflicting information in the quick info box — it states that the dependency is resolved, but also that it is uncached or missing:

Screen Shot 2022-11-29 at 03 39 15

I must manually save the file and invoke the palette command "Deno: Cache Dependencies" in order to resolve the diagnostic issue:

Screen Shot 2022-11-29 at 03 40 29

I would, of course, like to see this behavior for export statements as well.


Related:

@bartlomieju
Copy link
Member

@jsejcksn do you still experience this problem with Deno v1.35? I believe this has been fixed.

@jsejcksn
Copy link
Contributor Author

@jsejcksn do you still experience this problem with Deno v1.35? I believe this has been fixed.

@bartlomieju Sure: I'll budget some time today to test and report back here.

@jsejcksn
Copy link
Contributor Author

jsejcksn commented Jul 11, 2023

@bartlomieju It now appears that autocompletion doesn't work at all with import map specifiers (except for modules that have been resolved in the same language server session?)

I recorded a screen capture of a basic test (attached to the bottom of this message), and here's text output of the files and software versions:

% ls -AF
.vscode/		import_map.json
deno.jsonc		main.ts

% cat .vscode/settings.json
{
  "deno.enable": true
}

% cat deno.jsonc
{
  "importMap": "./import_map.json"
}

% cat import_map.json
{
  "imports": {
    "std/": "https://deno.land/[email protected]/"
  }
}

% cat main.ts

% code --version
1.80.0
660393deaaa6d1996740ff4880f1bad43768c814
arm64

% code --list-extensions --show-versions | grep "deno"
[email protected]

% deno --version
deno 1.35.0 (release, aarch64-apple-darwin)
v8 11.6.189.7
typescript 5.1.6

gh_vscode_deno_752.mov

@bartlomieju
Copy link
Member

@dsherret could you take a look here?

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

2 participants