eclipse-platform / eclipse.platform.ui

Eclipse Platform
https://projects.eclipse.org/projects/eclipse.platform
Eclipse Public License 2.0
81 stars 188 forks source link

IContentAssistProcessor.computeCompletionProposals dont't know if it's part of autoassist or on-demand assist #1102

Open zulus opened 1 year ago

zulus commented 1 year ago

During work on one of WWD bug (eclipse-wildwebdeveloper/wildwebdeveloper#1316) I realized that due Eclipse limitation is not possible to fix LSPE in clean way (eclipse/lsp4e#799)

For now IContentAssistProcessor.computeCompletionProposals is completely blind, and don't know if it was invoked by AutoAssistListener (triggered by char and some delay) or on demand (for example via ctrl/cmd+space)

Would by nice to have third parameter in #computeCompletionProposals, int/enum mode, or separate optional method computeAutoCompletionProposals (with default to computeCompletionProposals) that will allow introduce some differences depending to mode

To implement this, the eldest of the PDT :-) introduces own, extremely ugly, PHPContentAssistant

If you agree I could take care of this, but tell me which way you prefer ;-)

vogella commented 1 year ago

A new method computeCompletionProposals with this third parameter defaulting to the old one sounds good to me. I don't think we can change the existing method. Eldest of PDT please send your PR to the humble people of platform. :-)

zulus commented 1 year ago

A new method computeCompletionProposals with this third parameter defaulting to the old one sounds good to me. I don't think we can change the existing method. Eldest of PDT please send your PR to the humble people of platform. :-)

Via IContentAssistProcessorExtension2 ?

mickaelistria commented 1 year ago

Are there chances that more arguments get added in the future? If so, it may be good to anticipate it now and introduce a parameter object or record ContentAssistRequest encapsulating viewer, offset, event... and everything relevant and make this object @noextends. So in the future, instead of adding a new interface or a new API to implement with new signatures, we can just add entries to this object.

laeubi commented 1 year ago

@mickaelistria I thin this is a very good idea, the new method can then simply be a delegate

default ICompletionProposal[] computeCompletionProposals(ContentAssistRequest request) {
    return computeCompletionProposals(request.getTextViewer(), request.getOffset();
}

also one might add some helper methods to ContentAssistRequest like getting the line number and alike... such request might even make it possible to store values from one assistance processor to another or between invocations...

ghentschke commented 8 months ago

@zulus are you still working on this issue?

ghentschke commented 7 months ago

Hi, any progress here?