Issues Proffering Language Service

后端 未结 1 507
予麋鹿
予麋鹿 2021-01-29 01:51

I have found two ways of proffering a language service on the internet.

The first way involves using a IOleComponentManager and registering a timer to call

相关标签:
1条回答
  • 2021-01-29 01:58

    It looks like at least the missing functionality requires using the IOleComponentManager method that registers a timer to call the language service during idle periods.

    Using dotPeek, I found that OnSynchronizeDropdowns() gets called from OnCaretMoved() for synchronizing the selected item when you click around in the editor. OnCaretMoved() itself appears to only be called from the LanguageService.OnIdle() method, which I believe requires the use of the idle timer.

    After digging some more, I also found that the error list requires that the ParseRequest.Reason be set to ParseReason.Check, otherwise it ignores the call. Digging through the code some more, the only place I found that parse reason being used was in Source.OnIdle().

    Update: I believe I have confirmed that registering an idle timer is required for these two pieces of functionality. From MSDN on LanguageService.OnIdle:

    Note This method is not called unless you set up your own timer and call this method from the timer handler.

    The base method calls OnCaretMoved if the caret has moved since last time OnIdle was called. The base method then calls the OnIdle method on the Source object for the current view. If the current Source object cannot be obtained, the base method does nothing at all, including not calling OnCaretMoved.

    0 讨论(0)
提交回复
热议问题