📜 ⬆️ ⬇️

Convenient development in Notepad ++

Before I begin, I want to immediately explain that in this article I do not propose to use Notepad ++ instead of any IDE. An IDE sharpened to fit your goals will always be better than a regular text editor, even though most of them are written in Java, more than 2 gigs of RAM are released, and generally insanely slow. However, the deep integration of IDE with version control systems, debuggers, “Go to definition” functions and other features make them indispensable.
In this article, I want to consider the case when you need to develop something serious in a system for which the IDE simply does not exist. In my case, this is the development of scripts for the game engine FOnline, which was already written more than once in Habré.

Some information about the FOnline engine:

The process of writing scripts currently consists of the following steps:

Of course, in such conditions it is rather difficult to develop something, there is neither a ready-made framework for testing (no TDD), or a debugger.
But some conveniences with some limitations in Notepad ++ still manage to be realized:

Of course, this is not enough for convenient development, but at least something.
Further in this article I want to tell you in detail how to implement all this in Notepad ++, but in order to avoid unnecessary questions, I will first tell you what functions I would like to see in npp, but which I did NOT manage to implement:

Now in order.

Syntax highlighting

The basic feature of notepad ++. It is configured including through the interface of the npp itself.

In general, the ability to flexibly customize a user-defined language in npp has been around for a long time, but not everyone knows that this feature has recently moved to a qualitatively new level called UDL 2.0.
Key features: the formation of a list of keywords, the definition of the syntax of the blocks, folding these blocks, the definition of numeric formats and, of course, customization of styles for all of this separately.

Note:
Do not try to manually edit the UDL settings while running npp, it will erase all changes when you exit the program.
')
Autocompletion

The same basic npp feature, but not edited in the interface, this time you need to manually edit xml.
Key features: autocomplete reserved words and functions, creating descriptions for them, prompts for function parameters and information about returned values. In addition, overloaded functions are supported.
Details about setting here.

Note:
For autocomplete to work correctly, it is necessary that the lines in xml be correctly sorted in alphabetical order (details about sorting, taking into account special characters and numbers, were somewhere on the official wiki). It must be admitted that this moment is rather annoying, in the absence of the xml interface, you really have to edit it manually (writing your bike for generation is somehow lazy).

Clever compiler output processing

When I first started implementing the environment for developing FOnline scripts, I had to use the usual batch file call for syntax checking of scripts for a long time, passing it the way to the script. However, then one of the members of our community posted instructions on how to configure EditPlus to work with FOnline. It turned out that in this editor the possibility of parsing the output of compilers is there initially. At that time I was sure that such opportunities are only in the IDE and no one will bother with this functionality for a text editor. However, if there is such functionality in EditPlus, I still decided to go through the N ++ plugins again. To my surprise, a solution for notepad ++ was found: the NppExec plugin.
The settings are quite flexible, I will not describe the process, everything is quite simple, just show the result:


Note
The plugin does not allow you to add a button to launch the compiler on the toolbar, however, the Custom toolbar plugin does an excellent job with this task.

“Go to definition” function and display of entity list

In short, the SourceCookifier plugin is suitable for this purpose.
Opportunities:

But if we talk in more detail, we can not say about the cons:

Note:
  1. It is worth noting that I didn’t understand much about SourceCookifier and I can’t guarantee that the above is 100% correct. If someone notices mistakes, I will be glad to receive information.
  2. if you need the “go to definition” function for any more or less well-known language, you should look at the TagsJump plugin, there are already quick transitions between files

Document Map

Recently, this trendy functionality is available in n ++ right out of the box.
Works.

Fast transition to the previous cursor position

Plugin Location Navigate.
Works within the same file.
In addition, it highlights the saved and unsaved file changes that occurred since the launch of n ++.

Note:
It is worth noting that the main function of this plugin is implemented in the SourceCookifier plugin described above.

Brackets, quotes ...

The placement of double quotes and closing brackets is done by the XBrackets Lite plugin. The solution is far from ideal, but at least some.

Note:
In the n ++ naked settings, you can also enable automatic substitution of paired characters, but there this function is implemented completely clumsy and would be more annoying.

Afterword


At the moment, this is almost everything that I managed to squeeze out of the good old Notepad ++.
Of course, you can complain a lot that Notepad ++ exists only under Windows, that the sublime is much better than Notepad ++. It can be advised to switch to EditPlus or full-fledged IDEs (for which, of course, you have to implement most of the necessary functionality on your own). You can remember about Geany with its considerable possibilities to expand the functionality. But, based on personal experience, for the tasks described above notepad ++ is best suited. Perhaps I am mistaken, I can even assume that the above is already implemented in Sublime without too much cost. But, as in the case of notepad ++, all this functionality is most often scattered around a bunch of plugins and various documentation. And, if so, I would love to read more about them.
Thank you for your attention, be healthy.

Source: https://habr.com/ru/post/220081/


All Articles