How can I build a completion list web service?

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 7 years ago by Craig - Varigence, Inc.
Version: 12.1.0561
Avatar

I have a Silverlight Actipro syntax editor hosted on a website, that needs Intellisense. Unfortunately, some of the code I use (to help populate the completion list) isn't Silverlight compatible, due to some types missing from Silverlight. To workaround this issue, I started thinking about a web service that could provide the completion list when prompted, given the editor's text and the caret position.

  1. Are there any examples of such a service that I could take a look at?
  2. Assuming the answer to #1 is no, is there a way to request a CompletionProvider session that doesn't need an actual syntax editor to be created? I ask since WCF threads won't play nice with WPF objects (I believe because a WCF thread is STA but WPF objects need it to be MTA, or vice versa). Thus, I'd like my CompletionProvider to run, with me informing it of the editor text and caret position.

Thanks,

-Craig

Comments (3)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Craig,

I assume here that you want to load an assembly for reflection data that is not Silverlight-compatible and use it for your automated completion list?  If so, check out the .NET Languages Add-on's "Assemblies" topic.  The last section in there tells you how you can save cache data from the WPF version and load it up in the Silverlight version.  That way you could have automated IntelliPrompt for any .NET assembly even with the editor in Silverlight.


Actipro Software Support

Posted 7 years ago by Craig - Varigence, Inc.
Avatar

Your assumption isn't quite accurate. Our syntax language uses a custom completion provider because it nests languages. For instance, C# can be nested within XML, similar to ASP.NET. To handle this scenario (and for other reasons), we need to perform custom parsing of our editor's text to determine the appropriate completion list, quick info, etc...

For our Silverlight application, we want to have the same completion provider functionality. However, because our language's model and custom code uses types that are missing from Silverlight, I can't simply reproduce the .NET projects in our Silverlight solution. Thus, I'm investigating an approach of using a WCF service that can return completion lists when text, and a caret position, are provided. The WCF Service allows me to encapsulate my .NET logic while the Silverlight application can use a small completion provider that simply communicates with the WCF service for results.

However, I have two main concerns about this approach: 1. Potential delays between the user triggering intellisense and the intellisense data returning from the service. 2. Silverlight's requirement that web service calls are async, which is awkward given the synchronous nature of the completion provider.

I was wondering/hoping if Actipro ever experimented with this approach, or perhaps had a sample I could learn from.

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Craig,

Sorry we don't have anything at the moment that does async requests for completion data.  I'd think that relying on web services could potentially be a performance killer in some scenarios where there is any network latency.

We do however have an internal sample of an ASP-like language where it has full automated IntelliPrompt for the C# sections inside ASP-like tags, and it ignores the rest of the non-ASP content.  I'm not sure if that would help you or not.  If you are interested in that sample, please e-mail our support address to ask for it.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.