Can not capture *.cshtml file

12 visualizações
Pular para a primeira mensagem não lida

taodongl

não lida,
4 de jul. de 2017, 04:19:3104/07/2017
para resharper-plugins
I implement DaemonStage to analyze *.cshtml file.
But I find it doesn't work. (I set breakpoint in `return ...` but nothing occurs) 

    [DaemonStage(StagesAfter = new[] { typeof(LanguageSpecificDaemonStage) })]
    public class RazorFileDaeMonStage : DaemonStageBase<IRazorFile>
    {
        protected override IDaemonStageProcess CreateDaemonProcess(IDaemonProcess process, DaemonProcessKind processKind, IRazorFile file,
            IContextBoundSettingsStore settingsStore)
        {
            return new Process(process, file, settingsStore);
        }
        ... ...
    }


Matt Ellis

não lida,
4 de jul. de 2017, 07:03:1204/07/2017
para resharper-plugins
What's your implementation of GetPsiFiles? If that returns nothing, then CreateDaemonProcess won't get called.

taodongl

não lida,
4 de jul. de 2017, 21:35:2004/07/2017
para resharper-plugins

Oh, there was a typo in GetPsiFiles function. now I can capture RazorFile.

       

        protected override IEnumerable<IRazorFile> GetPsiFiles(IPsiSourceFile sourceFile)       
        {
            if (sourceFile != null && sourceFile.PrimaryPsiLanguage.Is<RazorLanguage>())
                return sourceFile.GetPsiFiles<RazorLanguage>().Cast<IRazorFile>();
            return EmptyList<IRazorFile>.Instance;
        }


But another issue is:

I want to get string: "Use this area to provide additional information." which defined in *.cshtml.(please see the snapshot in below)

But I cannot get HTMLTOKEN whose nodetype is TEXT. 


                        public override void ProcessBeforeInterior(ITreeNode element)
            {
                switch (element)
                {
                    case IHtmlToken htmlToken:
                        if (htmlToken.NodeType == LanguageManager.Instance.GetService<RazorTokenNodeTypes, RazorLanguage>().TEXT)
                        {
                            ... ...
                        }
                        break;
                }
                ... ...
            }






在 2017年7月4日星期二 UTC+8下午7:03:12,Matt Ellis写道:

Matt Ellis

não lida,
7 de jul. de 2017, 09:10:2607/07/2017
para resharper-plugins
I would have expected that to work. I can only really suggest looking in the debugger to see what's happening - are you being passed all IHtmlToken instances, and if you are, and you're getting the HtmlToken, what is the node type? What class is it?
Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem