Generate Javascript intellisense file for a .NET Class - javascript

I have a .net control which is intended for use as an ActiveX control in web pages, instantiated thus:
<object id="TheControl" name="TheControl" classid="clsid:012937D0-E1D8-4a80-A17F-DEADBEEFF00D"></object>
Is there a way to take the XML documentation generated by Visual Studio for TheControl and transform it into a .js file that Visual Studio could then consume to provide intellisense for an instance of the control in a page?

You would either have to use .NET Reflection to get a list of all properties and methods, or write an XML parser tool to get the same list, and then generate .JS source code from it.
I think both of these would take about the same effort to write, but the Reflection approach can also be used with just the ActiveX file- if you don't have Visual Studio handy to generate the documentation XML.
If all you want is an "empty shell" .JS file for the properties and methods, then the code in this article should provide a good basis:
http://www.codeproject.com/KB/dotnet/Reflection.aspx

Related

XML to/from Java/Kotlin, cross-platform

I have an XML format specified with XSD and I want to generate the corresponding Java (or Kotlin) sources including (de)serialization. I know JAXB, but as far as I understand, it heavily relies on reflection. This is no option for me, because I want the generated sources to be ready for transpilation to JavaScript (by GWT or Kotlin/JavaScript for example). Because of this, these are the requirements:
Using an XSD schema, generate the corresponding Java or Kotlin source code
Do not use reflection, but plain old Java classes which include serialize/deserialize methods
Inject an XML IO interface (like StaX) with the required methods (which I can instatiate depending on the target: JVM, JavaScript, Android, ...)
Do you know a tool for this task or do I have to create my own solution?

Kotlin: What is a kjsm file?

I have been trying to use the Kotlin -> js compiler by following this tutorial.
When I run kotlinc-js --help, then the help text mentions the following:
-kjsm Generate kjsm-files (for creating libraries)
What is a kjsm file?
A kjsm-file is a Kotlin JavaScript Meta file (see KotlinJavaScriptMetaFileType).
Such a file appears to be used to provide meta data for native JavaScript objects so that the Kotlin compiler can type-check things and so that an IDE can provide code completion, etc. e.g. If you look in kotlin-js-library-1.0.6.jar you will find, among other kjsm-files, a Window.kjsm file which defines the Window Web API available in web browsers.
You would want to generate your own kjsm-files whenever you are creating a library so that your interfaces can be used by the compiler/IDE in modules which depend on your Kotlin JavaScript library.

Difference between *.intellisense.js and entry in _references.js

I've noticed in Visual Studio 2015 that, when creating a new ASP.NET MVC Web project, it automatically adds a jquery-1.10.2.intellisense.js file. Reading Microsoft's documentation on *.intellisense.js files provided me no clarity, and I'd like to know what this really does. If it adds intellisense into Visual Studio, then how is it different from the /// <reference path="jquery-1.10.2.js" /> entry in _references.js?
The _references.js file would give the user intellisense for what's in that file, which would be function names and signatures (parameter names).
The intellisense file contains additional XML comments that Visual Studio can read to give the user more information. E.g., it can add a ///<summary></summary> line to summarize the function, a list of ///<param name="">description</param> to give additional information for parameters, etc.
Since not all people use jQuery in a Visual Studio Environment, the intellisense file was created later after VS added in better support for JavaScript.
Here's an example of creating JavaScript XML comments for VS intellisense: https://msdn.microsoft.com/en-us/library/bb514138.aspx

Detect duplicate code within ASP.NET MVC project in Visual Studio

Is there any way at all to detect duplicate code within ASP.NET MVC project in Visual Studio 2013 Professional???
I want to detect duplicate JavaScript functions within the cshtml files in the Views.
I've been searching forever and can't find a viable solution.
Our JavaScript CloneDR code duplication detector should be able to do this. (This obviously isn't part of VS 2013.)
Its parser can read plain Javascript, and/or html-like pages that contain JavaScript chunks in Script tags, and/or HTML script attributes (e.g., OnXXX= ). You can hand it lots of files and it will find clones across the files.
You can see examples of what it detects at the link.

ms:script tags in XSLT

I am attempting to migrate an ASP Classic application to .Net 4.0 (4.5 would also be acceptable). The application is responsible for performing XSL Transformations using Javascript extension functions. The ASP Classic application currently uses MSXML 4.0 to perform the transformations.
I am running into problems in .Net when I try and use the XslCompiledTransform class to process a transform that includes javascript extensions. It works for simple examples but we have a fairly extensive javascript library and I am seeing error as the test cases become increasingly complex. The most frustrating of these errors are syntax errors, for example the .Net parser doesn't seem to like statements outside of functions.
Can anyone tell me which class is used to parse and compile the javascript extensions and if there is thorough documentation anywhere. Also can the the javascript processor object be replaced with a custom object (in a similar manner to a UriResolver).
Also, is it possible to use the parser rules to have Visual Studio highlight javascript syntax errors when viewing the file. I am pretty sure it already does this for javascript code that is used in web pages and such, but the syntax rules seem to be different in XSLT.
AFAIR XslCompiledTransform uses CodeDom to compile embedded scripts. The way it works is that XslCompiledTransform creates a code file that is then passed to CodeDom for compilation. I believe MSXML uses a different JavaScript engine than the one used by CodeDom. Hence the compilation problem. In addition (it's been a while since I looked at it) there may be some additional processing happening to make the scripts compilable (I remember that for scripts in C# there was a class created and all functions were put to this class).
Note that the assemblies created by CodeDom are loaded to the appdomain where the transformation is executed. This may lead to OutOfMemory exceptions since the CLR does not allow to unload assemblies - I wrote about this some time ago here: http://blogs.msdn.com/b/xmlteam/archive/2011/09/26/effective-xml-part-5-something-went-really-wrong-outofmemoryexception-and-stackoverflowexception-thrown-when-using-xslcompiledtransform.aspx

Categories

Resources