MCPcopy Create free account
hub / github.com/SpartanJ/eepp / onTextInput

Method onTextInput

src/tools/ecode/plugins/autocomplete/autocompleteplugin.cpp:557–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

555}
556
557bool AutoCompletePlugin::onTextInput( UICodeEditor* editor, const TextInputEvent& event ) {
558 std::string partialSymbol( getPartialSymbol( &editor->getDocument() ) );
559
560 auto lang = editor->getDocumentRef()->getSyntaxDefinition().getLSPName();
561 auto cap = mCapabilities.find( lang );
562 if ( cap != mCapabilities.end() ) {
563 if ( cap->second.signatureHelpProvider.provider ) {
564 bool requestedSignatureHelp = false;
565 const auto& signatureTrigger = cap->second.signatureHelpProvider.triggerCharacters;
566 if ( std::find( signatureTrigger.begin(), signatureTrigger.end(), event.getChar() ) !=
567 signatureTrigger.end() ) {
568 requestSignatureHelp( editor );
569 requestedSignatureHelp = true;
570 }
571 if ( mSignatureHelpVisible && !requestedSignatureHelp ) {
572 auto doc = editor->getDocumentRef();
573 auto curPos = doc->getSelection().start();
574 if ( curPos.line() != mSignatureHelpPosition.line() ||
575 curPos < doc->startOfWord( doc->positionOffset( mSignatureHelpPosition, 1 ) ) )
576 resetSignatureHelp();
577 }
578 }
579
580 if ( cap->second.completionProvider.provider ) {
581 const auto& triggerCharacters = cap->second.completionProvider.triggerCharacters;
582 if ( partialSymbol.size() >= 1 ||
583 std::find( triggerCharacters.begin(), triggerCharacters.end(), event.getChar() ) !=
584 triggerCharacters.end() ) {
585 updateSuggestions( partialSymbol, editor );
586 } else {
587 resetSuggestions( editor );
588 }
589 }
590 return false;
591 }
592
593 if ( partialSymbol.size() >= 3 ) {
594 updateSuggestions( partialSymbol, editor );
595 } else {
596 resetSuggestions( editor );
597 }
598 return false;
599}
600
601void AutoCompletePlugin::updateDocCache( TextDocument* doc ) {
602 ScopedOp op(

Callers 1

inputCallbackFunction · 0.45

Calls 12

findFunction · 0.85
getDocumentMethod · 0.80
getDocumentRefMethod · 0.80
getCharMethod · 0.80
startOfWordMethod · 0.80
positionOffsetMethod · 0.80
findMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
startMethod · 0.45
getSelectionMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected