-
Notifications
You must be signed in to change notification settings - Fork 14
Keep projects open on tsserver via OpenExternalProject #160
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
@@ -91,8 +92,8 @@ | |||
* @param insertString | |||
* @throws TypeScriptException | |||
*/ | |||
void changeFile(String fileName, int line, int offset, int endLine, int endOffset, String insertString) | |||
throws TypeScriptException; | |||
void changeFile(String fileName, int line, int offset, int endLine, int endOffset, |
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.
Please use the same Java Format preferences (Eclipse [built-in].
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.
I had the correct preferences configured, but somehow the format on save did not include some lines. I'm double-checking that now.
String projectName = projectDir.getCanonicalPath(); | ||
List<String> rootFiles = new ArrayList<>(); | ||
for (String tsconfigFilePath : getTsconfigFilePaths()) { | ||
rootFiles.add(new File(projectDir, tsconfigFilePath).getCanonicalPath()); |
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.
Please use FileUtils.getPath(new File(projectDir, tsconfigFilePath)) to normalize path.
List<String> result = new ArrayList<>(tsconfigBuildPaths.length); | ||
for (ITsconfigBuildPath tsconfigBuildPath : tsconfigBuildPaths) { | ||
IFile tsconfigFile = tsconfigBuildPath.getTsconfigFile(); | ||
result.add(tsconfigFile.getLocation().makeRelativeTo(tsconfigFile.getProject().getLocation()).toString()); |
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.
Please use WorkbenchResourceUtil.getRelativePath(tsconfigFile, tsconfigFile.getProject())
Wow great PR @lorenzodallavecchia! Thanks! I have added some little comments. Please fix it. |
Required requests are use to have some requests waiting for the response to other requests. This would be required for openExternalProject (see angelozerr#142). Also adjusted the code so that: - async methods return CompletableFuture and never throw, - sync methods block for the future result and throw in case of error.
The server can now correctly handle files that are not open, including finding references, etc. The performance should also be better, since the project is not recreated on the server each time the "first" file is opened. Closes angelozerr#142
This is no longer needed because the server does not loose track of files. Reverts commit babde9c.
3db8141
to
d807513
Compare
302ce8b
to
d0129a1
Compare
Thanks a lot @lorenzodallavecchia ! Very cool PR. |
@lorenzodallavecchia now when I open file, the editor is freezing because of waitForFuture. I would like really avoid freezing editor. Could you fix that please? |
@lorenzodallavecchia I have uncomment the use of waitForFuture to avoid freeze of editor. Don't hesitate to do PR if you find a better solution. I would like to avoid freezing the editor. |
…est to avoid freeze. See #160 (comment)" This reverts commit b73e5cc.
@lorenzodallavecchia I'm really sorry. I have reverted your PR because the editor froze every time. And sometimes it freezees Eclipse IDE (I had to kill it). I would like to do a release this month, so I would like to have a stable version. I would like to integrate your PR but not for 1.2.0 and study why there are so many freeze. Hope you will understand. |
@angelozerr don't worry: I understand. The freezing problem is really strange I did test opening and closing editors many times and experienced absolutely no freezing. Also, that waiting stuff should not actually change anything compared to now because:
So, overall really really strange. |
@lorenzodallavecchia I will try to investigate more but my "main" project that I test is https://github.com/Microsoft/vscode which is big. For instance when I open https://github.com/Microsoft/vscode/blob/master/extensions/javascript/src/features/packageJSONContribution.ts there is a little freeze. After when I navigate quicly (must find what I do exactly), Eclipse IS freeze and I must kill it. |
Hi @angelozerr, I finally had time to look into this issue again. I tried checking out https://github.com/Microsoft/vscode into a single Eclipse project. Then I opened many files (up to 60 at the same time) and navigated back and forth using Ctrl+click and outlines. Can you give me other pointers about how to reproduce the issue? Otherwise I think I would have to remake this PR without the CompletableFuture change: it would be more fragile but still hopefully able to fix #142. |
Hi @lorenzodallavecchia ! Glad to have your news:) To be honnest with you, I had tested quicly, but I would like really avoid having freezing when user open an editor even if tsserver is not available. Today it works like this. The only freeze that it exists today is when user open completion, hyperlink but for other features (outline, mark occurences, etc), the editor doesn't freeze. For completion, Oxygen should provide an async completion (hope it will resolve the freeze problem). For Hyperlink, hope Eclipse guys will fix that. I will b every glad to have a PR, but please avoid having freeze even the first time when editor is opened. Hope you will understand my wish. I'm very busy with other topics like autoimport with completion, integrates angular language service (inside HTML) and CodeLens, so it's difficult for me to help you with your issue. Any PR are welcome! |
Thanks for helping out @angelozerr. I completely agree with the design principle of postponing waits as much as possible. I think I will investigate inside tsserver to be sure that even if |
@lorenzodallavecchia I think you should study too the VSCode TypeScript client. For instance https://github.com/Microsoft/vscode/blob/master/extensions/typescript/src/typescriptServiceClient.ts#L697 which consumes |
Ok @angelozerr, I finally have a clear understanding of this problem. First of all, VSCode is not using The fix I proposed in this PR was causing a slowdown when editing VSCode because it caused all TS projects to be loaded when opening just a single file. While this enables cross-project checking, it also wastes a lot of resources. I tried removing the wait for Unfortunately, this situation is a limitation of TypeScript and I think we would have to wait for them to implement microsoft/TypeScript#3469. That issue will introduce a way for a |
Many thank's @lorenzodallavecchia for your great feedback! If I have understood, we must wait for microsoft/TypeScript#3469 to fix this issue. |
This change makes tsserver aware of existing Eclipse projects, so that it does not forget about project state when all files are closed.
Closes #142.