microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.27k stars 29.31k forks source link

Suggestion and auto-complete is very very very slow. #95200

Closed abheist closed 4 years ago

abheist commented 4 years ago

Issue Type: Performance Issue and my settings are

{
    "editor.fontSize": 16,
    "editor.lineHeight": 28,
    "editor.letterSpacing": 0.5,
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true,
    "editor.formatOnType": true,
    "workbench.iconTheme": "material-icon-theme",
    "editor.codeActionsOnSave": {
        "source.fixAll": true
    },
    "prettier.requireConfig": true,
    "git.autofetch": true,
    "editor.fontLigatures": true,
    "editor.fontFamily": "Fira Code, Menlo, Monaco, 'Courier New', monospace",
    "workbench.colorTheme": "Night Owl",
    "editor.detectIndentation": true,
    "emmet.includeLanguages": {
        "javascript": "javascriptreact",
        "jsx-sublime-babel-tags": "javascriptreact"
    },
    "emmet.triggerExpansionOnTab": true,
    "vsintellicode.features.python.deepLearning": "enabled",
    "typescript.suggest.completeFunctionCalls": true,
    "javascript.suggest.completeFunctionCalls": true,
    "editor.snippetSuggestions": "top",
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "emmet.showSuggestionsAsSnippets": true,
    "editor.tabCompletion": "on",
    "editor.quickSuggestions": true,
    "editor.quickSuggestionsDelay": 0,
    "files.associations": {
        "*.js": "javascriptreact",
    },
    "[javascriptreact]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "[jsonc]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "workbench.colorCustomizations": {
        "[Night Owl]": {
            "activityBar.background": "#000C1D",
            "activityBar.border": "#102a44",
            "sideBar.background": "#001122",
            "sideBar.border": "#102a44",
            "sideBar.foreground": "#8BADC1"
        },
        "[Night Owl No Italics]": {
            "activityBar.background": "#000C1D",
            "activityBar.border": "#102a44",
            "sideBar.background": "#001122",
            "sideBar.border": "#102a44",
            "sideBar.foreground": "#8BADC1"
        }
    },
    "bracket-pair-colorizer-2.forceIterationColorCycle": true,
}

still when I write anything in reactJS fils with extention of .js. The autocomplete dialog appears after many seconds and is dead slow.

VS Code version: Code - Insiders 1.45.0-insider (c8826e4ff5246775ebee0fb932402de6af55ddc8, 2020-04-14T05:52:37.373Z) OS version: Darwin x64 19.4.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled| |Load (avg)|2, 2, 2| |Memory (System)|16.00GB (2.65GB free)| |Process Argv|../goldenSwan.code-workspace| |Screen Reader|no| |VM|0%|
Process Info ``` CPU % Mem MB PID Process 23 98 79319 code-insiders main 0 66 79364 gpu-process 0 16 79366 utility 0 279 79367 window (WriteUpFunc.js — goldenSwan (Workspace)) 0 147 79370 extensionHost 0 33 79401 /Applications/Visual Studio Code - Insiders.app/Contents/Frameworks/Code - Insiders Helper (Renderer).app/Contents/MacOS/Code - Insiders Helper (Renderer) /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/json-language-features/server/dist/jsonServerMain --node-ipc --clientProcessId=79370 0 82 79411 electron_node tsserver.js 0 573 79412 electron_node tsserver.js 0 66 79414 electron_node typingsInstaller.js typesMap.js 0 82 79413 electron_node eslintServer.js 0 33 79371 watcherService 0 33 79378 searchService 0 98 79396 shared-process 0 0 79448 /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command= 0 82 79445 window (Issue Reporter) ```
Workspace Info ``` | Window (WriteUpFunc.js — goldenSwan (Workspace)) | Folder (goldenSwan-frontend): 168 files | File types: js(41) svg(37) woff2(21) woff(18) json(6) png(5) css(4) | eslintignore(1) eslintrc(1) gitignore(1) | Conf files: jsconfig.json(1) package.json(1) launch.json(1) | settings.json(1) | Launch Configs: pwa-chrome; ```
Extensions (8) Extension|Author (truncated)|Version ---|---|--- path-intellisense|chr|1.4.2 bracket-pair-colorizer-2|Coe|0.0.29 vscode-eslint|dba|2.1.2 es7-react-js-snippets|dsz|2.7.1 prettier-vscode|esb|4.3.0 material-icon-theme|PKi|4.0.1 vscodeintellicode|Vis|1.2.6 html-css-class-completion|Zig|1.19.0 (1 theme extensions excluded)
vscodebot[bot] commented 4 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

abheist commented 4 years ago

And just tested more. It working damn fast with TypeScript projects. i.e: create-react-app with TypeScript or Angular.

Though It's very slow in pureJS.

Found this ⚡️sign coming in status bar while working with TypeScript and not coming while working with JS.

Screenshot 2020-04-14 at 4 09 23 PM
mjbvz commented 4 years ago

Does this reproduce extensions disabled?

abheist commented 4 years ago

Disabled all the extension, the problem still coming. will it be the case because of the packages I'm using? I'm attaching gif for more help, PFA.

Packages, I'm using are:

"@apollo/client": "^3.0.0-beta.41",
"@apollo/link-context": "^2.0.0-beta.3",
"draft-js": "^0.11.5",
"formik": "^2.1.4",
"graphql": "^14.6.0",
"immutable": "^4.0.0-rc.12",
"prop-types": "^15.7.2",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0",
"react-toastify": "^5.5.0",
"reakit": "^1.0.0-beta.16",
"styled-components": "^5.0.1",
"styled-icons": "^10.2.1",
"styled-theming": "^2.2.0",
"yup": "^0.28.3"

And I found this related issue with styled-components, not sure though: https://github.com/Microsoft/vscode/issues/71751#issuecomment-480126916 I tried installing "@types/styled-components": "^5.1.0", but it also doesn't help.

Screen Recording 2020-04-16 at 1 34 19 AM

mjbvz commented 4 years ago

Thanks for testing.

Can you also please try upgrading your workspace to use typescript@next by installing this extension and restarting VS Code

I see much better perf using typescript@next in a simple file with those dependencies installed. If you can share your project, I can also test using that

abheist commented 4 years ago

https://github.com/abheist/goldenSwan-frontend

you can test it here 👆

I also tried using @types in devDependencies. as mentioned in other threads. Still no progress. 😕

mjbvz commented 4 years ago

Did using typescript@next help?

abheist commented 4 years ago

Yep, a bit. The suggestion within code gets a bit better. But when I'm trying to import it directly by writing: imp and press tab or control+space, it starts to show loading... and complete the tab in ~4 seconds. and this behaviour is when I disabled the react snippets extension

ghost commented 4 years ago

TS 3.9 caused this issue when I updated to 1.46. Suggestions take much longer to show up and CPU temperature increases more than normal. After configuring VSCode to use TS 3.8.3 it went back to normal again.

mjbvz commented 4 years ago

@abheist If you still see this with TS 3.9+, please try collecting the TS Server log:

  1. Set "typescript.tsserver.log": "verbose",
  2. Restart VS Code and reproduce the problem
  3. In VS Code, run the TypeScript: Open TS Server log command
  4. This should open a large log file called tsserver.log

If you can share this log, it may help us track down what is taking so long

⚠️Warning: The TypeScript log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on Github, just let me know and we can arrange something else. On our side, we only use these logs to investigate issues like this

github-actions[bot] commented 4 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!