Bug 569402

Summary: Support resolving hyperlinks without freezing UI Thread.
Product: [Eclipse Project] Platform Reporter: Johan Compagner <jcompagner>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: gautier.desaintmartinlacaze, loskutov, mistria, mlippert
Version: 4.18   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 569372    

Description Johan Compagner CLA 2020-12-02 10:30:14 EST
see also the discussion here:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=569372

WWD (or the lsp4j/lsp4e) uses language services to resolve stuff for them, like validation, code completion but also finding declarations (finding links)

That means that there is an IO operation to another process (nodejs) but the HyperLinkManager uses IHyperlinkDetector, that lsp4e implements, that should return:
IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks);

problem is that this forces everything to be done in the ui thread, it would be nice if this interface would be reactive.

like that we can have IReactiveHyperlinkDetector:

CompletableFuture<IHyperlink[]> detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks);

which a impl of IHyperlinkDetector can also extend and if that is the case HyperLinkManager  is working more async.

Problem is that for 1 file there can be more like 3 also a few legacy impls and HyperLinkManager wants in the end 1 list that it then wants to show.
So those impls maybe can be called also directly in the ui, but the actual show waits then for the fututure to complete first.
Or we have a default WrappingReactiveHyperlinkDetector  that just wraps the legacy once into one and also calls that outside of the ui thread
But his could be a bit tricky because of the param ITextViewer  where they get ui stuff from like the styledtext, and they are maybe not allowed to access UI stuff from outside of the ui thread.
Comment 1 Johan Compagner CLA 2020-12-03 07:39:56 EST
i see that this is a duplicate of:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=506467

a case from 4 years ago.. with the same "solution" described in the comments.
Comment 2 Andrey Loskutov CLA 2020-12-03 08:05:56 EST
(In reply to Johan Compagner from comment #1)
> i see that this is a duplicate of:
> 
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=506467
> 
> a case from 4 years ago.. with the same "solution" described in the comments.

Thanks, marking as dup of bugĀ 506467.

*** This bug has been marked as a duplicate of bug 506467 ***