-
Intellisence is very slow when using VS Code. Is there anything I can do to make it faster? It takes about 2 seconds to get the result of intellisence. It becomes worse when I install and import other plugins ( for example, remark-directive) To reproduce the issuepackage.json{
"name": "test",
"dependencies": {
"unified": "^10.1.2",
"unist-util-visit": "^4.1.0"
},
"devDependencies": {
"@types/mdast": "^3.0.3",
"typescript": "^4.7.4"
},
"type": "module"
} tsconfig.json{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"lib": ["esnext", "DOM"],
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"baseUrl": ".",
"sourceMap": true
}
} src/index.tsimport { visit } from 'unist-util-visit';
const myRemarkPlugin: import('unified').Plugin<[], import('mdast').Root> = () => (tree) => {
visit(tree, (node) => {
//node. <- very slow
});
}; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Right, PRs to |
Beta Was this translation helpful? Give feedback.
Right,
visit
can be slow.You can help it by passing a test.
And, split things up in different files, so that the file using expensive operations doesn‘t affect others.
PRs to
unist-util-visit
’s fancy types to improve this are welcome! Practically, it would be these types: https://github.com/syntax-tree/unist-util-visit-parents/blob/c4fdbdbdf9ce1a4549d2d6ba32a1f0eef92cf237/complex-types.d.ts#L43-L86.