-
Notifications
You must be signed in to change notification settings - Fork 53
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
Storing VirtualFile instead of Document for opened document #1082
Comments
Just wondering because they don't have the same scope if I remember correctly |
What do you mean with scope? |
The motivation about changing Document to VirtualFile is when I'm trying to understand #1081 I read https://plugins.jetbrains.com/docs/intellij/documents.html#how-long-does-a-document-persist They say:
And today we store the Document. |
Agree but when document is closed it should be evicted. I mean Document has Project scope and VirtualFile has app/JVM scope. So if the same file is opened in 2 different projects, you need to make sure LSP is properly setup with regards to editors |
How to have this usecase? I'm trying to have this usecase for trying to have this issue #1081 Anyway, Language server accessor which creates the language servers is mapped with a project scope,so I think we will have no problem. |
|
Thanks! It seems that Document instance are the same for the 2projects. |
So maybe they have the same scope, getting too old |
I don't know. In conclusion,are you OK to swith to VirtualFile? |
I can't answer that would require me to look deeper into the code and do some testing. But if they have the same scope that would be ok |
Ok thanks for your feedback @jeffmaury ! I will try it. |
While working on #1185 I notice that we spend our time to convert Document to VirtualFile (ex : to get the Uri of the document, we get the VirtualFile). In other words all code API are using Document but internally we convert it to VirtualFile to get some information like Uri. |
Fixes redhat-developer#1082 Signed-off-by: azerr <[email protected]>
Fixes redhat-developer#1082 Signed-off-by: azerr <[email protected]>
Fixes redhat-developer#1082 Signed-off-by: azerr <[email protected]>
Fixes redhat-developer#1082 Signed-off-by: azerr <[email protected]>
Fixes redhat-developer#1082 Signed-off-by: azerr <[email protected]>
Fixes redhat-developer#1082 Signed-off-by: azerr <[email protected]>
Fixes redhat-developer#1082 Signed-off-by: azerr <[email protected]>
Fixes #1082 Signed-off-by: azerr <[email protected]>
The LanguageServerWrapper works with Document instead of VirtualFile. I think this choice has been done because LSP4E works like this. LSP4E did this choice because they wanted to manage IFile, File and editor without file.
In IJ, VirtualFile is a File, but it exists an implementation LightVirtualFile which is independant of the file system (the content is in memory instead of get it from the file system), so I wonder if we could remove the
Map<URI, DocumentContentSynchronizer>
and uses just onlyList<VirtualFile>
for the opened file.I think it will simplify the code.
@jeffmaury what do you think about this idea?
The text was updated successfully, but these errors were encountered: