`
zhaozhongwei
  • 浏览: 52551 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

dltk & php

阅读更多

dltk code Completion

org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalComputer#computeCompletionProposals

the Language specific proposals is on top of Template proposals

 

if want to change the proposals' older,could store the configure the older in the preference page and

store it(format like "computeScriptCompletionProposals,computeTemplateCompletionProposals,other"),and ScriptCompletionProposalComputer's subclass override computeCompletionProposals,split the stored value then iterate them and then judge it use if ,finally call the corresponding method,so the older is under control.

 


code completion contexts : CompletionContextResolver.java    /org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts

 


php completion engine    PHPCompletionEngine.java    /org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist

php evaluate expression    PHPWatchExpressionDelegate.java    /org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/watch


php text hover    PHPDebugTextHover.java    /org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/hovers

 

 

 

 

Bug 207699
Static class variables do not show up in the Variables view when debugging in the PHP Debug perspective

because the value is got from PHPValue#getVariables,requestVariables,actually the RemoteDebugger send a
GetVariableValueRequest
response = (GetVariableValueResponse) connection
                    .sendRequest(request);
...
return response.getVarResult();

and then ExpressionsValueDeserializer#deserializer use VariableReader to deserialize the value

it seems there is no method to get a static variable's value



java hit count store the hitcount number in BreakpointRequestImpl(EventRequestImpl).fCountFilters,
and then write to JDWP bytestream(outData)
JavaBreakpoint#configureRequestHitCount
    protected void configureRequestHitCount(EventRequest request) throws CoreException {
        int hitCount= getHitCount();
        if (hitCount > 0) {
            request.addCountFilter(hitCount);//store to EventRequestImpl.fCountFilters
            request.putProperty(HIT_COUNT, new Integer(hitCount));
        }
    }
   
writeInt(((Integer)fCountFilters.get(i)).intValue(), "count filter", outData);

so if want to add hit count support to pdt,it must be supported by the debugger

link with debug view is completed through PHPThread#setBreakpoints which is called by
PHPDebugTarget#breakpointHit.

the php debug is through the ui ,then new request for the special action then receive response.
when start a php debug,pdt will add all breakpoints to the remote debugger(AddBreakpointRequest)


get content type for a text viewer and the text offset
            IDocument document= viewer.getDocument();
            String type= TextUtilities.getContentType(document, getDocumentPartitioning(), offset, true);

php code assist works in the html contest,this is for PHPStructuredTextViewerConfiguration#getContentAssistProcessors


type <input type="hi in php file entry "ctrl" + "space" will not show "hidden".
this because php PHPTokenizer(about line 1944)

// JSP attribute value start - complex single quoted
                assembleEmbeddedContainer(XML_TAG_ATTRIBUTE_VALUE_SQUOTE,
                        XML_TAG_ATTRIBUTE_VALUE_SQUOTE);

this make XML_TAG_ATTRIBUTE_VALUE_SQUOTE ContextRegionContainer type not AttributeValueRegion type.

and then in HTMLContentAssistProcessor#addAttributeValueProposals method (line 343)

// d210858, if the region's a container, don't suggest the
// enumerated values as they probably won't help
boolean existingComplicatedValue = (contentAssistRequest.getRegion() != null) && (contentAssistRequest.getRegion() instanceof ITextRegionContainer);
if (!existingComplicatedValue) {
...
}

so the "hidden" string not popup when entry "ctrl" + "space"


editor base wtp,its code assist is computed in CompoundContentAssistProcessor#computeCompletionProposals
here has some relation with StructuredTextViewerConfigurationHTML#getContentAssistProcessors,subclass
reimplement this method to deal with the partition types that it is interested in.




    <!-- PHP Model Handler -->
    <extension
        point="org.eclipse.wst.sse.core.modelHandler">
        <modelHandler
            default="yes"
            class="org.eclipse.php.internal.core.documentModel.handler.PHPModelHandler"
            associatedContentTypeId="org.eclipse.php.core.phpsource"
            id="org.eclipse.php.core.documentModel.handler">
        </modelHandler>
    </extension>
   
    org.eclipse.php.internal.core.documentModel.handler.PHPModelHandler
   
    public IDocumentLoader getDocumentLoader() {
        return new PHPDocumentLoader();
    }
   
    in PHPDocumentLoader
   
    protected IEncodedDocument newEncodedDocument() {
        IEncodedDocument doc = super.newEncodedDocument();
        assert doc instanceof BasicStructuredDocument;
        ((BasicStructuredDocument) doc)
                .setReParser(new PhpStructuredDocumentReParser());

        // doc.setPreferredLineDelimiter( "\n" );
        return doc;
    }

    public RegionParser getParser() {
        PhpSourceParser parser = new PhpSourceParser();
        // for the "static HTML" case, we need to initialize
        // Blocktags here.
        addHTMLishTag(parser, "script"); //$NON-NLS-1$
        addHTMLishTag(parser, "style"); //$NON-NLS-1$
        return parser;
    }

when change something in php editor will call PhpStructuredDocumentReParser#reparse,
then PhpSourceParser#parseNodes,then PHPTokenizer#getNextToken
then ContextRegionContainer...will be instanced


ScriptCompletionProcessor


PHPStructuredEditor#

        resAction = new TextOperationAction(
                DLTKEditorMessages.getBundleForConstructedKeys(),
                "ShowOutline.", this, PHPStructuredTextViewer.SHOW_OUTLINE, true); //$NON-NLS-1$
        resAction
                .setActionDefinitionId(IScriptEditorActionDefinitionIds.SHOW_OUTLINE); //$NON-NLS-1$
        setAction(IScriptEditorActionDefinitionIds.SHOW_OUTLINE, resAction);
       
PHPStructuredTextViewer#configure

        fOutlinePresenter = phpConfiguration.getOutlinePresenter(this);
        if (fOutlinePresenter != null) {
            fOutlinePresenter.install(this);
        }
       
       
PHPStructuredTextViewer#doOperation

        case SHOW_OUTLINE:
            if (fOutlinePresenter != null) {
                fOutlinePresenter.showInformation();
            }
            return;
           
PHPStructuredTextViewerConfiguration#getOutlinePresenter

 

 

 

 

refactor is in DeltaProcessor#updateModel,ModelUpdater#traverseDelta,SourceModule#close

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics