denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.27k stars 5.41k forks source link

Deno 2.1.2 - VS Code auto import not working for npm/jsr packages. #27144

Open tenkoverse opened 5 days ago

tenkoverse commented 5 days ago

I have never been able to get auto import for VS Code working for some packages.

I have always had this problem with deno.

In this case for example, npm:effect.

I was hoping that over time it would sort itself out but it hasn't.

I am using the Deno VS Code extension.

-- I have also tried to get this working with the Oak jsr package. But it also doesn't auto import.

To Reproduce:

In deno.json


{
  "imports": {
    "effect": "npm:effect@^3.10.19"
  },
  "nodeModulesDir":"auto"
}

Create a index.ts file and try to auto import Effect image

You are able to get autocomplete on the npm:effect like so image

But even if it's there, it still doesn't want to import Effect image

Only manual importing works image

VSCODE

Version: 1.95.3
Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
Date: 2024-11-13T14:50:04.152Z (2 wks ago)
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Darwin x64 23.6.0

DENO

deno 2.1.2 (stable, release, x86_64-apple-darwin)
v8 13.0.245.12-rusty
typescript 5.6.2

DENO VS-CODE EXTENSION:

Deno
v3.42.0
tenkoverse commented 5 days ago

Here is the output of the Deno Lanugage Server Status in case it's useful

# Deno Language Server Status

## Workspace Settings

```json
{
  "enable": true,
  "disablePaths": [],
  "enablePaths": null,
  "cache": null,
  "cacheOnSave": true,
  "certificateStores": null,
  "config": null,
  "importMap": null,
  "codeLens": {
    "implementations": false,
    "references": false,
    "referencesAllFunctions": false,
    "test": false
  },
  "internalDebug": false,
  "internalInspect": false,
  "logFile": false,
  "lint": true,
  "documentPreloadLimit": 1000,
  "suggest": {
    "imports": {
      "autoDiscover": true,
      "hosts": {
        "https://deno.land": true
      }
    }
  },
  "testing": {
    "args": [
      "--allow-all",
      "--no-check"
    ]
  },
  "tlsCertificate": null,
  "unsafelyIgnoreCertificateErrors": null,
  "unstable": [],
  "javascript": {
    "inlayHints": {
      "parameterNames": {
        "enabled": "none",
        "suppressWhenArgumentMatchesName": true
      },
      "parameterTypes": {
        "enabled": false
      },
      "variableTypes": {
        "enabled": false,
        "suppressWhenTypeMatchesName": true
      },
      "propertyDeclarationTypes": {
        "enabled": false
      },
      "functionLikeReturnTypes": {
        "enabled": false
      },
      "enumMemberValues": {
        "enabled": false
      }
    },
    "preferences": {
      "importModuleSpecifier": "shortest",
      "jsxAttributeCompletionStyle": "auto",
      "autoImportFileExcludePatterns": [],
      "useAliasesForRenames": true,
      "quoteStyle": "auto",
      "preferTypeOnlyAutoImports": false
    },
    "suggest": {
      "completeFunctionCalls": false,
      "includeAutomaticOptionalChainCompletions": true,
      "includeCompletionsForImportStatements": true,
      "names": true,
      "paths": true,
      "autoImports": true,
      "enabled": true,
      "classMemberSnippets": {
        "enabled": true
      },
      "objectLiteralMethodSnippets": {
        "enabled": true
      }
    },
    "updateImportsOnFileMove": {
      "enabled": "prompt"
    }
  },
  "typescript": {
    "inlayHints": {
      "parameterNames": {
        "enabled": "none",
        "suppressWhenArgumentMatchesName": true
      },
      "parameterTypes": {
        "enabled": false
      },
      "variableTypes": {
        "enabled": false,
        "suppressWhenTypeMatchesName": true
      },
      "propertyDeclarationTypes": {
        "enabled": false
      },
      "functionLikeReturnTypes": {
        "enabled": false
      },
      "enumMemberValues": {
        "enabled": false
      }
    },
    "preferences": {
      "importModuleSpecifier": "shortest",
      "jsxAttributeCompletionStyle": "auto",
      "autoImportFileExcludePatterns": [],
      "useAliasesForRenames": true,
      "quoteStyle": "auto",
      "preferTypeOnlyAutoImports": false
    },
    "suggest": {
      "completeFunctionCalls": false,
      "includeAutomaticOptionalChainCompletions": true,
      "includeCompletionsForImportStatements": true,
      "names": true,
      "paths": true,
      "autoImports": true,
      "enabled": true,
      "classMemberSnippets": {
        "enabled": true
      },
      "objectLiteralMethodSnippets": {
        "enabled": true
      }
    },
    "updateImportsOnFileMove": {
      "enabled": "prompt"
    }
  }
}

Workspace Details

Performance (last 3 000 entries)

Name Count Duration
lsp.code_action 2 4.373ms
lsp.code_lens 6 0.005ms
lsp.completion 8 18.98ms
lsp.completion_resolve 1 5.811ms
lsp.did_change 16 0.537ms
lsp.did_open 2 0.477ms
lsp.document_highlight 1 1.135ms
lsp.document_symbol 5 544.426ms
lsp.folding_range 6 259.522ms
lsp.get_navigation_tree 5 544.392ms
lsp.initialize 1 180.015ms
lsp.semantic_tokens_full 5 350.092ms
lsp.semantic_tokens_range 1 0.003ms
lsp.testing_update 17 1.192ms
lsp.update_cache 1 0.007ms
lsp.update_diagnostics_deps 17 0.268ms
lsp.update_diagnostics_lint 17 0.661ms
lsp.update_diagnostics_ts 4 388.249ms
lsp.update_global_cache 1 4.937ms
tsc.host.$getAssets 1 14.392ms
tsc.host.$getDiagnostics 4 2.465ms
tsc.host.$getSupportedCodeFixes 1 0.781ms
tsc.host.getApplicableRefactors 4 435.926ms
tsc.host.getCodeFixesAtPosition 2 1.537ms
tsc.host.getCompletionEntryDetails 1 5.02ms
tsc.host.getCompletionsAtPosition 8 17.474ms
tsc.host.getDocumentHighlights 1 0.937ms
tsc.host.getEncodedSemanticClassifications 5 1.936ms
tsc.host.getNavigationTree 4 0.483ms
tsc.host.getOutliningSpans 6 0.514ms
tsc.op.op_is_node_file 89 0.003ms
tsc.op.op_load 323 0.068ms
tsc.op.op_release 314 0.01ms
tsc.op.op_resolve 285 2.124ms
tsc.op.op_script_names 1 0.045ms
tsc.op.op_script_version 8 0.016ms
tsc.request.$getAssets 1 18.646ms
tsc.request.$getSupportedCodeFixes 1 154.322ms
tsc.request.getApplicableRefactors 2 2.278ms
tsc.request.getCodeFixesAtPosition 2 1.741ms
tsc.request.getCompletionEntryDetails 1 5.2ms
tsc.request.getCompletionsAtPosition 8 17.843ms
tsc.request.getDocumentHighlights 1 1.056ms
tsc.request.getEncodedSemanticClassifications 5 349.962ms
tsc.request.getNavigationTree 4 680.403ms
tsc.request.getOutliningSpans 6 259.433ms

Performance (total)

Name Count Duration
lsp.code_action 4 8.745ms
lsp.code_lens 6 0.029ms
lsp.completion 8 151.843ms
lsp.completion_resolve 1 5.811ms
lsp.did_change 16 8.600ms
lsp.did_open 2 0.953ms
lsp.document_highlight 1 1.135ms
lsp.document_symbol 5 2722.130ms
lsp.folding_range 6 1557.134ms
lsp.get_navigation_tree 5 2721.960ms
lsp.initialize 1 180.015ms
lsp.semantic_tokens_full 5 1750.458ms
lsp.semantic_tokens_range 1 0.003ms
lsp.testing_update 17 20.267ms
lsp.update_cache 1 0.007ms
lsp.update_diagnostics_deps 17 4.560ms
lsp.update_diagnostics_lint 17 11.243ms
lsp.update_diagnostics_ts 4 1552.997ms
lsp.update_global_cache 1 4.937ms
lsp.virtual_text_document 1 0.000ms
tsc.host.$getAssets 1 14.392ms
tsc.host.$getDiagnostics 4 9.859ms
tsc.host.$getSupportedCodeFixes 1 0.781ms
tsc.host.getApplicableRefactors 4 1743.702ms
tsc.host.getCodeFixesAtPosition 2 3.074ms
tsc.host.getCompletionEntryDetails 1 5.020ms
tsc.host.getCompletionsAtPosition 8 139.792ms
tsc.host.getDocumentHighlights 1 0.937ms
tsc.host.getEncodedSemanticClassifications 5 9.679ms
tsc.host.getNavigationTree 4 1.931ms
tsc.host.getOutliningSpans 6 3.082ms
tsc.op.op_is_node_file 89 0.233ms
tsc.op.op_load 323 22.023ms
tsc.op.op_release 314 3.144ms
tsc.op.op_resolve 285 605.312ms
tsc.op.op_script_names 1 0.045ms
tsc.op.op_script_version 8 0.125ms
tsc.request.$getAssets 1 18.646ms
tsc.request.$getSupportedCodeFixes 1 154.322ms
tsc.request.getApplicableRefactors 4 4.557ms
tsc.request.getCodeFixesAtPosition 2 3.482ms
tsc.request.getCompletionEntryDetails 1 5.200ms
tsc.request.getCompletionsAtPosition 8 142.747ms
tsc.request.getDocumentHighlights 1 1.056ms
tsc.request.getEncodedSemanticClassifications 5 1749.811ms
tsc.request.getNavigationTree 4 2721.610ms
tsc.request.getOutliningSpans 6 1556.597ms