Abnormally slow performance of VSCode Intellisense #30

Closed
opened 2024-04-12 17:32:35 +03:00 by coolroman · 2 comments
coolroman commented 2024-04-12 17:32:35 +03:00 (Migrated from github.com)

After any change to the source code in a file with mtcute imports Intellisense operations take up to 5-10 sec to perform.

To Reproduce

Try to invoke .call method for TelegramClient object, e.g.:

const tg = new TelegramClient({...});
tg.call({...})

After typing "tg." it takes 5-10 sec to show method list.

Expected behavior

"Go to Definition" and "Autocomplete" operations perform in less than 1 sec.

Logs

Info 492 [17:26:49.904] request:
{
"seq": 99,
"type": "request",
"command": "quickinfo",
"arguments": {
"file": "/Users/.../mtcute/test/index.ts",
"line": 42,
"offset": 27
}
}
Perf 493 [17:26:49.916] 99::quickinfo: elapsed time (in milliseconds) 12.0900

Environment

  • OS: MacOS 14.4.1
  • Runtime: Node.js 20
  • mtcute version: 0.10.1

Additional context
The codesandbox repo below can be opened locally with VSCode.

CodeSandbox

<!-- describe the bug --> After any change to the source code in a file with mtcute imports Intellisense operations take up to 5-10 sec to perform. ## To Reproduce Try to invoke .call method for TelegramClient object, e.g.: ```typescript const tg = new TelegramClient({...}); tg.call({...}) ``` After typing "tg." it takes 5-10 sec to show method list. ## Expected behavior "Go to Definition" and "Autocomplete" operations perform in less than 1 sec. ## Logs > Info 492 [17:26:49.904] request: > { > "seq": 99, > "type": "request", > "command": "quickinfo", > "arguments": { > "file": "/Users/.../mtcute/test/index.ts", > "line": 42, > "offset": 27 > } > } > Perf 493 [17:26:49.916] 99::quickinfo: elapsed time (in milliseconds) 12.0900 > ## Environment - OS: MacOS 14.4.1 - Runtime: Node.js 20 - mtcute version: 0.10.1 **Additional context** The codesandbox repo below can be opened locally with VSCode. [CodeSandbox](https://codesandbox.io/p/devbox/eloquent-feistel-9vvlcg?file=%2Findex.ts%3A53%2C7&layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522cluwqzlo000063b6klxqfgrz7%2522%252C%2522sizes%2522%253A%255B70%252C30%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522cluwqzlo000023b6kui7cql5q%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522cluwqzlo000043b6k1aicskpe%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522cluwqzlo000053b6k53xynk63%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B100%252C0%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522cluwqzlo000023b6kui7cql5q%2522%253A%257B%2522id%2522%253A%2522cluwqzlo000023b6kui7cql5q%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cluwr3imm00023b6ki72f2qqq%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A53%252C%2522startColumn%2522%253A7%252C%2522endLineNumber%2522%253A53%252C%2522endColumn%2522%253A7%257D%255D%252C%2522filepath%2522%253A%2522%252Findex.ts%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522activeTabId%2522%253A%2522cluwr3imm00023b6ki72f2qqq%2522%257D%252C%2522cluwqzlo000053b6k53xynk63%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522cluwqzlo000053b6k53xynk63%2522%257D%252C%2522cluwqzlo000043b6k1aicskpe%2522%253A%257B%2522id%2522%253A%2522cluwqzlo000043b6k1aicskpe%2522%252C%2522activeTabId%2522%253A%2522cluwr1mv500dj3b6k932prtsi%2522%252C%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cluwqzlo000033b6kiaomn4d0%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522start%2522%257D%252C%257B%2522id%2522%253A%2522cluwr1mv500dj3b6k932prtsi%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522TERMINAL%2522%252C%2522shellId%2522%253A%2522cluwr1n4v005pd8g6hq4n47i0%2522%257D%255D%257D%257D%252C%2522showDevtools%2522%253Afalse%252C%2522showShells%2522%253Atrue%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D)
teidesu commented 2024-04-12 22:47:29 +03:00 (Migrated from github.com)

i feel like this is an issue with vscode/tsserver in itself, which doesn't handle large discriminated unions too well.

if i remove the tg.call() call things seem to become better, so it's probably because of that. or the use of the MustEqual<T> helper in the .call().
either way, it's unlikely there's much i can do to improve things performance-wise

i'll keep this issue open for now, things might improve with the upcoming esm codegen rewrite

i feel like this is an issue with vscode/tsserver in itself, which doesn't handle large discriminated unions too well. if i remove the `tg.call()` call things seem to become better, so it's probably because of that. or the use of the `MustEqual<T>` helper in the `.call()`. either way, it's unlikely there's much i can do to improve things performance-wise i'll keep this issue open for now, things *might* improve with the upcoming esm codegen rewrite
teidesu commented 2024-04-13 00:29:57 +03:00 (Migrated from github.com)

ok in fact it is related to MustEqual

ok in fact it *is* related to `MustEqual`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: teidesu/mtcute#30
No description provided.