Skip to content
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

Provide Document Lifecycle Participant for tracking didOpen, did* #603

Closed
mickaelistria opened this issue Jan 19, 2020 · 7 comments · Fixed by #1091
Closed

Provide Document Lifecycle Participant for tracking didOpen, did* #603

mickaelistria opened this issue Jan 19, 2020 · 7 comments · Fixed by #1091
Assignees
Labels
debt This issue or enhancement is related to technical debt
Milestone

Comments

@mickaelistria
Copy link
Contributor

As we're working on the Maven extension, we'd like to keep in cache the built MavenProject model for files that are currently open, and to discard this MavenProject when files are closed.
I did look through the extension API and didn't find a way to listen to open/close. Is there a way to do that I missed, or is no solution implemented (yet)?

@angelozerr
Copy link
Contributor

I did look through the extension API and didn't find a way to listen to open/close. Is there a way to do that I missed, or is no solution implemented (yet)?

It's not implemented because today we had not this usecase. If I understand correctly, you need to track didOpen and didClose (and perhaps didChange ?) of text document service.

But I wonder if why you could not track those open/close files with Eclipse API (IResource listener?)

@mickaelistria
Copy link
Contributor Author

I don't think I need didOpen as we can lazily populate cache on 1st request to diagnostics, hover or whatever.
I don't think I need didChange because when receiving a request (onComplete, onDiagnostics...) we do look at document.getTextIndentifier().getVersion() to know whether we need to refresh the cache.
But for didClose, I didn't figure out a possible workaround.

@angelozerr
Copy link
Contributor

@mickaelistria I understand that you don't need didChange or didOpen for your usecase but I would like to provide a clean API like TextDocumentLifecycleParticipant to track didOpen, didChange and didClose. Instead having a simple URI, we could set in the parameter the DOMDocument which stores the URI.

@mickaelistria
Copy link
Contributor Author

Ok, as you wish. However, beware that implementing APIs without use-case doesn't usually lead to clean APIs ;)

@angelozerr
Copy link
Contributor

Ok, as you wish. However, beware that implementing APIs without use-case doesn't usually lead to clean APIs ;)

Yes you are right :) But my fear is to have a lot of participant as soon as we need a usecase. So perhaps we could start with TextDocumentLifecycleParticipant and provide only didClose method? What do you think about that?

@mickaelistria
Copy link
Contributor Author

That would work for me and be less work for you (and less things to change later if this needs to be refactored).

@angelozerr
Copy link
Contributor

@mickaelistria please keep in mind that LSP4XML should move to Eclipse.org and package name will be renamed (soon I hope)

@datho7561 datho7561 modified the milestone: 0.18.0 Jul 28, 2021
@angelozerr angelozerr changed the title How can extensions be notified of open/close file? Provide Document Lifecycle Participant for tracking didOpen, did* Jul 29, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 29, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 29, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 29, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 29, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 29, 2021
@angelozerr angelozerr added this to the 0.18.0 milestone Jul 29, 2021
@angelozerr angelozerr self-assigned this Jul 29, 2021
@angelozerr angelozerr added the debt This issue or enhancement is related to technical debt label Jul 29, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 29, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 29, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 29, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 30, 2021
angelozerr added a commit to angelozerr/lemminx that referenced this issue Jul 30, 2021
angelozerr added a commit that referenced this issue Jul 30, 2021
Fixes #603

Signed-off-by: azerr <azerr@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debt This issue or enhancement is related to technical debt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants