Skip to content

Conversation

@jasonlyu123
Copy link
Member

#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 disableSizeLimit compiler options in the tsconfig/jsconfig.

Copy link
Member

@dummdidumm dummdidumm left a 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;
Copy link
Member

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.

Copy link
Member Author

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) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dummdidumm dummdidumm merged commit 898555d into sveltejs:master Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants