denoland / vscode_deno

Visual Studio Code plugin for Deno
https://marketplace.visualstudio.com/items?itemName=denoland.vscode-deno
MIT License
1.48k stars 144 forks source link

Very slow intellisense (tab completion / ctrl+space menu) #824

Closed qgates closed 4 months ago

qgates commented 1 year ago

With vscode_deno enabled, typing 'log' followed by pressing tab to expand the console.log() snippet, results in a 'Loading' tooltip for 1-4 seconds before completion occurs. Similar behaviour when pressing ctrl+space to bring up a list of available completions.

Expected behavior

Intellisense completion and menus should appear more or less instantly. Disabling vscode_deno extension restores that behaviour.

Versions

vscode: 1.76.1 deno: 1.31.3 extension: 3.17.0

Platform

Windows 10 22H2, i9 12900, PCIE4 512G NVME (Samsung), 32G RAM

qgates commented 1 year ago

Experiencing similar delays when attempting to autocomplete (tab) or raise intellisense popup (ctrl+space) for object member.

For example:

let x = {a: 'test', b: 'test'}
x. // [ctrl+space] here results in 3s 'Loading...'
// before popup with 'a (property' etc.
bartlomieju commented 1 year ago

Could you post output from the "Deno" tab in your VScode?

qgates commented 1 year ago

Could you post output from the "Deno" tab in your VScode?

@bartlomieju Not sure what you mean by the 'Deno tab'... Do you mean Deno Language Server in the Output panel?

qgates commented 1 year ago

@bartlomieju it feels like having the deno cache folder deno-dir inside the project folder X:\elogsrv\apisrv\ is slowing things right down when it's specified in deno.cache. If I do one of the following:

Intellisense is nice and snappy again.

Anyway here's everything vaguely useful I can find...

Output from Deno: Language Server Status

Workspace Settings

{
  "enable": false,
  "enablePaths": [],
  "cache": "./deno-dir",
  "certificateStores": null,
  "config": null,
  "importMap": null,
  "codeLens": {
    "implementations": false,
    "references": false,
    "referencesAllFunctions": false,
    "test": false
  },
  "inlayHints": {
    "parameterNames": {
      "enabled": "none",
      "suppressWhenArgumentMatchesName": true
    },
    "parameterTypes": {
      "enabled": false
    },
    "variableTypes": {
      "enabled": false,
      "suppressWhenTypeMatchesName": true
    },
    "propertyDeclarationTypes": {
      "enabled": false
    },
    "functionLikeReturnTypes": {
      "enabled": false
    },
    "enumMemberValues": {
      "enabled": false
    }
  },
  "internalDebug": false,
  "lint": true,
  "suggest": {
    "completeFunctionCalls": false,
    "names": true,
    "paths": true,
    "autoImports": true,
    "imports": {
      "autoDiscover": true,
      "hosts": {
        "https://crux.land": true,
        "https://deno.land": true,
        "https://x.nest.land": true
      }
    }
  },
  "testing": {
    "args": [
      "--allow-all",
      "--no-check"
    ],
    "enable": true
  },
  "tlsCertificate": null,
  "unsafelyIgnoreCertificateErrors": null,
  "unstable": true
}

Workspace Details

Performance

Name Duration Count
code_action 801ms 8
completion 984ms 4
did_change 143ms 13
document_symbol 778ms 7
folding_range 348ms 2
get_navigation_tree 778ms 7
op_load 0ms 2865
op_resolve 3ms 11
request 236ms 41
testing_update 22ms 13
update_diagnostics_deps 37ms 13
update_diagnostics_lint 2ms 13
update_diagnostics_ts 710ms 3
qgates commented 1 year ago

I seem to have pinpointed the issue. Deno is running on a ubuntu server inside virtualbox on a Win10 host. Vscode is running on the host and deno is also present on the host for LSP duties. Development branch is shared from the ubuntu guest and mapped to host drive letter X:. Everything works fine, but for some reason deno-vscode's deno.cache, when set to a folder on the share via drive letter or UNC path, exhibits this slow behaviour. Copying the deno-dir to a local drive and pointing deno.cache to it restores intellisense responsiveness.

I've investigated potential bottlenecks between host/guest via samba fairly thoroughly and conclude that everything is performing optimally. File copies, browsing etc. all perform at near enough native speed. Why then is intellisense so slow when the target of deno.cache is on a samba share? It's feels as though in-memory caching of objects is disabled when deno-dir isn't a local folder. Is the slowdown due to (local) deno language server over samba, or down to deno-vscode as its client?

Fwiw, for all other editing over samba, when vscode-deno is not in use intellisense works perfectly, so this issue seems specific to vscode-deno and not generally to vscode's use of language servers when working on source trees across samba shares.

nayeemrmn commented 4 months ago

Significant performance gains have been made with completions, closing for now.