📜 ⬆️ ⬇️

Notes for the source editor (development environment)


This article focuses on improvements and embellishments that could complement the already quite advanced development environment.

KDPV :


The rule of one window of one button


This is the main idea, which, I believe, should be adopted both by the existing development environments and the new ones, which are still only at the design stage. The number of settings in existing IDEs has grown so much that it has become very difficult to navigate. The salvation in this situation [ in relation to the display settings ] I see in the system of visually context-sensitive settings. In a nutshell, two buttons should be reserved: one for the editing cursor (caret \ caret), for example F1, and another for the mouse pointer / cursor, for example F4 {in principle, you can abandon F4 in favor of only one button [ F1 ] , if it turns out to ~ 100% guess the user's intention, namely, track the last movement and watch it was the last action associated with moving the editing cursor, or moving the mouse cursor}.

Pressing F1 opens a window with a brief reference, as well as a button with settings that relate only to the area enclosed by the frame of the current character pointed to by the editing cursor. So it would be very convenient to customize the display, for example, the background color of the line with a breakpoint (breakpoint) and in general any elements of the program text that fall into a box delineated by the size of the character under the cursor, that is, you get something like a magnifying glass.
An example of the practical benefits of tuning through F1
In PHP, I don’t like the dollar sign in front of the variable name. So that it does not irritate so much, it can be made translucent.
For example: .
All 3 $ signs in this line of code are displayed in different colors, and using the rule of one button you can easily configure their display.

Clicking on F4 opens a similar window, only referring to a circular area [ diameter ~ 10 pixels ] around the mouse cursor. In this way, it would be easy to disable all unnecessary interface elements (as well as turn on by hovering the mouse over the place where they were), for example the display of added / modified lines, which for some reason still cannot be disabled in PyCharm and PhpStorm .
')

Beautiful code display


First, as can be seen in the figure at the beginning of the article, I propose, in addition to the vertical "rulers" displayed in many IDEs, to add more horizontal ones.
Secondly, many double operators can be displayed as single characters: ══ instead of ==, ≠ instead of! =, Etc. (Somewhere on Habré there was an article dedicated to such decorations (not this one , but similar), unfortunately, I can’t find it now.) This setting is well hidden under the single F1 button - this way you can easily turn off the replacement for a specific character (for example , replace C with ∈), or disable all replacements at once.

Debugging HTML Watch, virtual properties \ properties and freeze \ freeze


An input field for code that generates HTML, which is displayed in a separate window that can be moved or attached to existing elements of the development environment.
(The need arose when I debugged a lexical analyzer, I thought that it would be convenient to see not just an integer variable indicating the current position, but to track the current position visually.)
[ Of course, there should be [ it is not in PyCharm ] the ability to display multi-line strings in the same way as in MS Visual Studio. ]
In general, you can use HTML Visualizer as a workaround in MS Visual Studio by specifying the name of a function specially added for this in Python. [ Actually, I propose to give the ability to insert multi-line code in the Watch. ]

When you look at the properties (members-data) of an object, I propose to add at the end [ after all real properties ] a plus to add expressions [ virtual properties ] , for example: when viewing the node_expression type node_expression variable, it is convenient to add the virtual property value, calculated as self.token.value(source) . A grouping mechanism is also needed, since most of the properties of an object need not be watched often and could be hidden under a group.

Another feature I lack in existing debuggers is the freezing of expression values. For example, there is such a function in Python:
 def set_scope_recursive(sn, scope): sn.scope = scope for child in sn.children: set_scope_recursive(child, scope) 
Being on the line for child in sn.children: add the expression sn.children Watch window. Then on line set_scope_recursive(child, scope) press F11 (Step Into). Now sn.children in the Watch window is updated. And in this case it would be more convenient if it was not updated, but remained "frozen", so that you can see on which node from the original sn.children array we are at the moment. From the point of view of the interface, right-click on the expression and the context menu item Freeze \ Freeze.
[ Perhaps, it would be more correct not to freeze / fix specified expressions, but to tie them to the call stack level, because if you get inside any function, all expressions in the Watch window based on local variables break [ and so that they do not break, they can be tied to the call stack level at which they were added} ] . ]

Compilation error messages


I believe that it does not make sense to show a lot of errors in the list, but it makes sense to show one most accurate error, and immediately set the cursor [ and show this file location ] to this error after pressing F5 (Run / Debug). After all, you can always return to the previous view by pressing Ctrl + - or another customized shortcut.

Custom tab size


A gift for those who love tabs instead of spaces for indentation, and especially for those who distinguish between indentation and alignment . The idea is that in the tab size field \ tab size you can enter a fractional number of characters. How do you tabulate, say, 3 and a half characters? Or π (pi) characters?

Undo / Redo tree


Did you encounter a situation when, after rolling back a long number of steps with the Undo operation, instead of Redo, you accidentally pressed a key on the keyboard, which immediately made the Redo operation impossible?
Personally, I use the Undo operation often enough to review \ see the latest changes in the current file, and I would be happy if not a full replacement of two Undo and Redo stacks with a change tree, then at least the presence of a mechanism to protect against loss of changes due to accidental clicking keys. As such a mechanism and for compatibility with existing behavior in most text editors, I suggest using the new keyboard shortcut Ctrl + Shift + Y, which will first cancel the accidental keystroke (without putting it on the Redo stack) and then continue the Redo operation.

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


All Articles