Friday finking: IDE 'macro expansions'
dn
PythonList at DancesWithMice.info
Fri Mar 17 17:00:11 EDT 2023
On 18/03/2023 02.44, Thomas Passin wrote:
> On 3/17/2023 9:38 AM, Simon Ward wrote:
>> On Fri, Mar 17, 2023 at 02:05:50PM +0100, Roel Schroeven wrote:
>>> Even better than simply highlighting is (IMO) a thing called "Rainbow
>>> Braces" or "Bracket Pair Colorization" I recently learned about: both
>>> braces of a matching pair get the same color, while other pairs get
>>> other colors. I have to say I like it quite a lot. It's in VS Code
>>> these days; possible there are implementations or extensions for
>>> other editors and IDEs as well.
>>
>> VS Code also supports ‘semantic highlighting’: Instead of simply
>> highlighting syntax, highlight the same identifiers in the same
>> colours, with the aim of helping you see them through the flow of the
>> code.
>
> Even with a simple "Find" command I don't like that behavior, let alone
> for programming. I find that all those other marked instances make it
> harder for me to read the surrounding material. They are good for
> moving from one instance to another, but otherwise they get in the way
> for me.
Haven't seen the coloring feature as-described. As the number of
identifiers increased, suspect it would become gaudy or the color
shading too subtle for my eyes.
+1 'Busy pictures' can be distracting.
That said, the syntax-highlighting can provide the occasional cue that
something has gone-wrong. However, will I recognise it from the
mis-coloring, or from other evidence first?
The semantic point might be easily under-estimated. A 'simple find' may
not be helpful - a web-search for Python turns-up irrelevant information
about snakes!
Regarding the tracing of an identifier: PyCharm has two features:
- with cursor/caret on/at a single use of an identifier, it will
highlight other usage, elsewhere in that module's code
- (context menu) FindUsages will bring-up a two-pane window. The
left-pane shows a tree-structure of the project, modules, etc, down to a
listing of each code-line where the identifier is used. Highlighting one
of those (at a time), will show the context around that particular
line/usage. The right-pane is editable!
The great thing about these features is that they are semantically-aware
(is that a real term?). For example, if I were (foolish enough) to name
an identifier "the", such searches will not 'hit' the same word inside a
comment or docstring.
Better still, the above motivation continues into a (context menu)
Refactor facility. This, one might consider to be a semantic
Find-Replace. Often employ when helping others to clarify their
code/Code Review - or when I'm 'just coding' and have quickly defined an
identifier without a lot of thought, but later (ie when come to make use
of it) realise a better alternative and more descriptive name.
--
Regards,
=dn
More information about the Python-list
mailing list