-
-
Notifications
You must be signed in to change notification settings - Fork 223
(perf) typescript language service size limit #1194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dummdidumm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! The approach looks good. Left some comments.
| continue; | ||
| } | ||
|
|
||
| totalNonTsFileSize += ts.sys.getFileSize?.(fileName) ?? 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity: Is this performance heavy to check that? How often is this called? My fear is that if this results in many IO operations, that it slows down the intellisense for people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, it only runs on startup and when there're new .ts or .js files added. With the file-count-check, it should not be very often. It's 10-20ms on my SSD with 300-500 project files workspaces, and 20-30ms on a hard drive. So I guess it shouldn't be too noticeable to most people.
| snapshotManager.updateProjectFiles(); | ||
| const projectFileCountAfter = snapshotManager.getProjectFileNames().length; | ||
|
|
||
| if (projectFileCountAfter <= projectFileCountBefore) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
#965
Add a size limit for typescript language service similar to the one in the tsserver. When the size limit exceeds, ts language service goes into a reduced mode. Project-wide IntelliSense is disabled. It would only use the files opened in the client. Kind of like when you don't have a tsconfig.json file. When this happens a warning message will show up.
Noted if you have a really big project and you have excluded everything needed but it still exceeds this limit. You can disable it with the
disableSizeLimitcompiler options in the tsconfig/jsconfig.