Adding Rust (programming language) syntax to Notepad++? - windows

I would like to use Notepad++ as I learn Rust. Is it possible to do this? If it is, how do I do it?

You can use Notepad++ to edit the source files, nothing else is needed.
If you want syntax coloring, a syntax file is available, the README has an explanation on how to import the XML file.
For compiling and running the code, you can just use the command line.
I don't think there is a plugin for code completion yet, but it could be implemented with racer.
I like Notepad++, but there are more plugins for Sublime Text, Atom, or VS Code. You can also use Visual Studio.

Related

Advanced code style in Clion

I want to have google-style like code style checker that would automatically run within Clion.
However, what I found as solutions (predeclared code style for google and others, direct Editor settings and EditorConfig support in Clion help) are all rather primitive. For example, I want to use snake case with final underscore for class member fileds (e.g. my_class_member_) and usual snake case for function arguments (e.g. some_argument), and none of the suggested options would do the trick as far as I am concerned. Furthermore, some politics associated with endless loops and so are to be added, which is even more context-specific.
I consider creating cpplint.py-like script for this, but it is going to be very time-consuming and is likely to be run outside Clion. Are there any elegant ways to solve my problem?
Yeah, you able to do this! Look into Clion plug-in Clion-cpplint and use with cpplint.py script, provided by Google. You will get highlights on the fly when you are editing C++ source code.
You able to install add-on through Plugins tab in settings. In the end you will get something like:

How to compile SML using SMLNJ while the code is in Notepad++?

I'm completely new to SML and I have no idea how to work with anything related to it.
I am supposed to use the SMLNJ compiler and I'm currently coding using Notepad++.
But how do I compile the program exactly? Do I copy and paste the code in the SMLNJ command line thing? Or is there an environment for SMLNJ I can actually code in and compile my code?
PLEASE HELP!
If by "compile" you mean "compile to a stand-alone executable" -- don't worry about that when first learning the language as a full answer is somewhat involved. In principle it is possible, though there seems to be practical issues (as this excellent answer details).
On the other hand, SML/NJ has a command-line based REPL (Read-Evaluate-Print-Loop) which actually is an compiler. It is an incremental compiler -- meaning that it compiles newly defined functions in the context of currently defined functions. At the very first you will be experimenting with short snippets typed directly into the REPL. Sooner rather than later you will want to write the code in something like NotePad++ . Just write the file, save it with a .sml extension, then in the REPL type
use "filename";
and it loads and compiles your definitions.
A trick that I sometimes use is the following. On the top of my files I have a comment like this:
(* val _ = (use "C:/Programs/sets.sml", OS.Process.system "cls"); *)
Here sets.sml just happens to be an SML file I have on my machine. When I get done editing the file I save it and then copy the insides of the comment (beginning with val and extending to the semicolon) to the clipboard and then paste it into an open SML REPL (using the edit menu for the command window which pops up when you hit the icon in the upper left hand corner of the command window). This loads the definitions and presents you with a cleared REPL for experimenting with your definitions.
Notepad++ seems to lack a syntax definition file for SML (although it has one for F#, which might be close enough). Personally, I do most of my SML using Textpad. This isn't open source but is reasonably priced nagware which is roughly comparable to Notepad++. From their website you can download a useful SML syntax-definition file which does a nice job of logically highlighting your code. I even created a Textpad tool (which for unknown reasons only works sporadically) for automatically saving the file, opening SML, and invoking use on the file name.

how do I create readable C++/CX document from XML generated by Visual Studio 2015

My project is written in C++/CX on VS2015 and I am seeking a way to generate API documentation.
After googling and stackoverflow, I have tried doxygen, VSDocman,NDoc, Atomineer Pro Documentation and SandCastle, I found these tools do not support C++/CX syntax, therefore, they cannot generate correct document.
I also tried to generate XML file which VS supports. But it's hard to read XML file.
How do I generate API documentation from C++/CX? Thanks for any suggestion
There are a lot of misconceptions about the C++/CX language extension. You tried too many products that have no hope of getting you anywhere. First and foremost is that it is a native C++ extension and does not generate a .NET compatible assembly. So knock out any that try to use Reflection to parse metadata. Out goes NDoc, VSDocman, Sandcastle. Atomineer is out, it is just an editor add-in.
So all you got left is doxygen.
Sure, it doesn't know about C++/CX out of the box. The FAQ points out that in order to make it compatible with a language, you need to modify src/scanner.l
Having a look at it, I see it already supports the C++/CLI extension. That's another C++ language extension that supports generating MSIL. C++/CX syntax is very close to C++/CLI. Just some minor differences, like the gcnew keyword is too misleading and replaced by ref new. But that's not the kind of syntax that doxygen cares about, it just wants to know about declarations. Those keywords are the same.
So the only obstacle I can guess at is that you just forgot to tell it about the language. It can't guess at it correctly from just the filename extension, .cpp and .h will get it to parse plain C++. Modify or add this line in the config file:
CPP_CLI_SUPPORT = YES
And tweak scanner.l if necessary.

CoffeeScript Intellisense

I use Visual Studio for development and I am quite used to Intellisense. But when writting CoffeeScript you don't really get any Syntax Checking or Intellisense.
Is there a plugin for VS that would allow this?
Thanks
You can't have more than syntax checking/coloring with coffeescript (on any IDE) AFAIK.
As an alternative, you can use TypeScript to get the full Visual Studio tooling support (and stay close to the javascript), or some transcompilers that transform code to javascript, for C# there is Saltarelle and for CIL (.NET bytecode, so compatible with any .NET language), I just found JSIL but I have no idea how well it works.
Note than the generated code "look" can be important for debugging and using external libraries get a bit of work to be included in Typed languages.
For js code readability I would recommand TypeScript (similar to coffeescript, even easier, but less powerfull as a language).
Saltarelle code looks readable (didn't tried a lot), for JSIL I have no idea.
A list of languages that compiles to JS: https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS
Webstorm and all of the JetBrains IDEs recently added some code completion and refactoring support. It knows what methods are in my own classes and will prompt to complete as I type. The red squiggly underline compile as you type is not quite there yet but it is coming. I bet Webstorm is the first to implement CS source map also. They have added so much in the last 11 months.
Check this out: http://visualstudiogallery.msdn.microsoft.com/2b96d16a-c986-4501-8f97-8008f9db141a
Here is another: http://chirpy.codeplex.com/
I think this should do what you want.

How Is Syntax Highlighting Built?

I'm now building a developers editor using Lazarus and as every good developers editor, it needs to have a syntax highlighting, because of this that I want to know some things:
How is syntax highlight normally built(using many ifs to change the font on a TextField?
TSynEdit is very nice to do this?
How to use TSynEdit(links and resources)?
You can actually see an excellent example for yourself if you look at the editor for SharpDevelop. It's implemented in C# but uses great OOP that should be readily portable to other platforms or languages.
Most home-brewed syntax highlighters tend to use the MS Windows RichText control but they're usually slow and clunky and really slow down when a lot of code is added.
You could read the source code of Eclipse or VIM. In Eclipse you will find an Abstract Syntax Tree base. On top of it are parsers that are carefully written to be tolerant of errors, since code in progress often does not satisfy the full grammar of the language. The highlighting uses the information in the syntax tree.

Resources