tsserver and intellisense hang indefinitely on "loading intellisense status" and "loading..." when using assertion function and complex conditional type
See original GitHub issueBug Report
🔎 Search Terms
tsserver typescript langauge server loading intellisense status indefinite error forever asserts assertion function vscode conditional type
🕗 Version & Regression Information
- This changed between versions
4.7.4
and4.8.0-beta
and happens in all versions up to4.9.0-dev.20221015
⏯ Playground Link
Unfortunately, painstakingly copy-pasting all the types from the various packages into the playground doesn’t allow me to reproduce the issue. So instead, I’ve created a minimal example repository that demonstrates the issue: https://github.com/Xunnamius/mre-typescript-issue-51188
💻 Code
import { visit, SKIP, type Visitor } from 'unist-util-visit';
import type { Content as MdastContent } from 'mdast';
function assertNonNullable<T>(
value: T,
err: string
): asserts value is NonNullable<T> {
if (value === null) {
throw new Error(err);
}
}
export function visitAndReveal<Tree extends MdastContent>(
tree: Tree,
visitor?: Visitor,
reverse?: boolean
) {
visit(
tree,
'hidden',
(node, index, parent) => {
// UNCOMMENTING THIS WILL KILL INTELLISENSE
// assertNonNullable(
// index,
// 'error while revealing hidden node: node index is missing'
// );
// UNCOMMENTING THIS WILL KILL INTELLISENSE
// assertNonNullable(
// parent,
// 'error while revealing hidden node: node parent is missing'
//);
return visitor?.(node, index, parent) ?? [SKIP, index];
},
reverse
);
}
🙁 Actual behavior
Tsserver and intellisense in vscode (latest version) hang when using a TypeScript version >=4.8.0-beta
. See video example below.
🙂 Expected behavior
Tsserver/intellisense does not hang in latest versions of vscode and TypeScript.
https://user-images.githubusercontent.com/656017/195998496-e83d5c99-dc27-4867-8bcc-aa3d6a54ff55.mp4
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How To Fix Visual Studio Code IntelliSense Loading Infinitely
In this short article, I'm sharing the reason of this issue and my way of fixing it. How VS Code Infinite IntelliSense Loading...
Read more >IntelliJ IDEA 2019.2 EAP (192.4205.1 build) Release Notes
Feature IDEA‑210929 Provide ability to copy a TBX link to a settings
Feature IDEA‑210961 Implement action for Slow Startup Profiling
Feature IDEA‑111333 Provide Sublime Text...
Read more >visual studio code - Intellisense stuck on loading with typescript
I've also to check if "TypeScript and JavaScript Language Features" was enable. Here is my tsconfig.json { "compilerOptions": { "noImplicitAny": ...
Read more >NixOS - DistroWatch.com
In NixOS, the entire operating system, including the kernel, applications, system packages and configuration files, are built by the Nix package manager. Nix ......
Read more >Untitled
... .experts-exchange.com/questions/26298885/rst-MoveLast-taking-forever.html ... -remove-the-table-from-set-integrity-pending-state-in-db2-after-load.html ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That error is caused by our type instantiation governor when a single source element gives rise to >5M type instantiations. Any code that triggers this is definitely highly suspect. It looks like you were barely managing to squeeze under the limit in 4.7, so I would strongly recommend simplifying the types. In particular, the
InclusiveDescendant<...>
type appears expensive. I think it is trying to reduce the set of possible descendant types. I don’t know how important that added precision is, but it clearly comes at a very high cost.Thanks for taking a look! I had a suspicion complexity was a problem after some other small issues with the types coming from the unist-util-visit package. For example, sometimes TS would give me “Type instantiation is excessively deep and possibly infinite” seemingly at random, then I’d restart the language server, and it would return the expected type.
cc unified team: @wooorm