Text editors, IDEs: Difference between revisions

From Helpful
Jump to navigation Jump to search
m (Helpful moved page Text editors to Text editors, IDEs)
mNo edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{old}}
{{#addbodyclass:tag_prog}}
{{stub}}
{{stub}}
=Text editors=


Markers:
Markers:
Line 66: Line 69:
programmer tools
programmer tools
indent, astyle
indent, astyle
=IDEs=
===Visual Studio Code===
vscode is an editor {{comment|('Visual Studio' seems to be mentioned only for branding reasons, it shares little with VS)}} that runs in win+lin+osx (because it is itself a browser+javascript based thing).
More interestingly, it happens to take extensions to do a ''lot'' of things,
so with enough added installation it can be a full-blown IDE, supporting more languages that targeted IDEs.
(That said, if you're developing for windows, you may be better of with Visual Studio, community edition)
It lets you work remotely, over SSH[https://code.visualstudio.com/docs/remote/faq].
<!--
This has its flaws - it seems distinct logins do not always pick up on what extensions have been installed before (by others?),
so will  which isn't great for a reproducable execution environment.
-->
====vscode keyboard shortcuts====
* {{key|F1}}  - command palette (including things that extensions provide)
* {{key|F12}} - go to definition (this feature seems increasingly broken, though?)
:: {{keyhold|Ctrl}}{{key|K}} {{key|F12}} - show definition to the side
* {{keyhold|Ctrl}}{{key|K}} {{key|Z}} - Zen mode (uncluttered), {{key|Esc}}{{key|Esc}} to quit)
* {{keyhold|Ctrl}}{{keyhold|Shift}}{{key|Space}} - show function parameter help
'''Overview'''
* {{keyhold|Ctrl}}{{keyhold|Shift}}{{key|[}}, {{keyhold|Ctrl}}{{keyhold|Shift}}{{key|]}} - fold/expand code block
* {{key|F8}} - go to next problem
'''Formatting, refactoring and such'''
* {{keyhold|Alt}}{{key|Up}}, {{keyhold|Alt}}{{key|Down}} - move line
* Without a selection, {{keyhold|Ctrl}}{{key|X}}, {{keyhold|Ctrl}}{{key|C}} work on the line you're on.
* {{keyhold|Ctrl}}{{key|[}}, {{keyhold|Ctrl}}{{key|]}} - indentation
* {{keyhold|Ctrl}}{{key|/}} - toggle comments
* {{keyhold|Ctrl}}{{key|H}}
:: {{key|Ctrl}}{{key|Shift}}{{key|H}} - replace in many files (which exactly, though?  All in workspace?)
* {{key|F2}} - rename symbol (more language-aware replace)
'''Multi-cursor'''
: {{keyhold|Ctrl}}{{keyhold|Alt}}{{key|Up}} / {{keyhold|Ctrl}}{{keyhold|Alt}}{{key|Down}} - put cursor in same position on previous/next line
: {{keyhold|Alt}}Click - add via mouse
: {{keyhold|Ctrl}}{{key|D}} selects next occurrence of the word you're currently on (by substring, not symbol?)
: {{keyhold|Ctrl}}{{key|F2}} selects all occurrences (by substring, not symbol)
====Issues====
<!--
=====:failed to save ''filename'': unexpected type"=====
-->
=====lots of memory / CPU use=====
<!--
So, I like the ability to work over SSH.
I am less fond of the fact that vscode processes tend to consume gigabytes of memory and make my server [[trash]] unpredictably.
In my case it wasn't vscode but an extension, pylance, which seems to looks at absolutely everything,
combined with the fact I have one big directory/repository with all my projects, as well as a whole bunch of supporting data in subdirectories.
You can add ignores to pylance in the settings.
-->
=====cannot activate the X extension because it depends on the Y extension=====
Seems moderately likely to be some incompatibility between local and remote versions.
uninstall python, pylance, and jupyter (whichever of them you have) and installing them again is one good way to update them and tends to solve a lot of cases.
<!--
pylance is a somethat specific case, in that it became part of the python extension at some point.
-->
If each vscode client gets confused about what's on a single server state,
and each needs to alter both sides' state to fix it,
that may be the cause of the problem in the first place, so... good luck playing whack-a-mole.
Why would reloading the window help?
Iono.
=====Unable to watch for file changes. Please follow the instructions link to resolve this issue.=====
{{stub}}
When logged into a linux server, [[inotify]] is used to get sooner-rather-than-later updates about what files other programs change within the workspace.
The lazy thing is to increase the amount of things that can be watched.
There is a default maximum to how many files eac user can watch via inotify - classically 8K, now more often tens of thousands, which should be enough for most workspaces.
Things to check
* current limit, e.g. {{inlineode|cat /proc/sys/fs/inotify/max_user_watches}}
* symlinks -- I had a slimmed down dev environment that happened to symlink to a directory containing a half-a-million-file dataset.
Also keep in mind that remote logins to the same user will each watch the same set of things. In my case each adds 25K watches.
But maybe you actually want to reduce that.
* Seeing what files are watched
** If you can restart (and don't mind running an instance from the CLI you will want to quit later), you can do {{inlinecode|strace -fe inotify_add_watch code}}
** If you need it on an already-started instance, then note this is not a fast query, because it watches inodes, and to get filenames from inodes isn't a cheap operation
::: also there is no existing tool, but things like [https://github.com/mikesart/inotify-info inotify-info] help
* to exclude things, see vscode's {{inlinecode|files.watcherExclude}} setting. This seems to by default already exclude things like:
**/.git/objects/**
**/.git/subtree-cache/**
**/node_modules/*/**
**/.hg/store/**
See also: https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc
====="Go to definition" doesn't function=====
{{stub}}
Note that how this functions, and why it breaks, varies a little by langauge.
<!--
For example, in python this seems related to the "impoty XXX could not be resolved"
Note that the vscode environment ''may not'' match the CLI you use,
in part because the environment may not be the same.
Further, [https://stackoverflow.com/questions/53653083/how-to-correctly-set-pythonpath-for-visual-studio-code]
* debugging is different,
* linting is probably different yet
It has its own environment definitions,
often based on picking up
and if you work remotely, those get a little trickier.
If you define a venv/conda environment in the current workspace you may get somewhat
-->
=====pylance doesn't function=====
It does that. Try to install a different version and see if that helps.
<!--
=====pylance takes all my CPU=====
It does that, seemingly when VS code tells it to look at lots and lots of code.
-->
=====pylance talks nonsense, seems to be talking about completely different code=====
Yeahhhh... I dunno yet.
One issue I suspect is related is that pylance extension doesn't seem to prioritize
reporting on the code actually open above reading (large) data files in the same directory - it would get behind.
===Visual Studio===
<!--
(These days) Comes in Community, Professional, Enterprise editions.
Community is free, and covers all the functional basics.
: some fancier features are stripped out, particularly debugging. You will have to pay for those.
Until 2017 there was also Express, which where somewhat more featured variants of the, replaced by Community, which ''mostly'' seem to differ in that Community has more restricted licensing{{verify}}.
Professional is like Community in features, and like Enterprise in licensing{{verify}} [https://visualstudio.microsoft.com/vs/compare/]
Enterprise is everything.
tl;dr: if you focus on the MS ecosystem, it's a great tool, and professional programmers may well want to pay for the convenience.
If you focus on a larger mix of languages, you may not care.
https://stackoverflow.com/questions/30527522/what-are-the-differences-between-visual-studio-code-and-visual-studio
https://docs.microsoft.com/en-us/archive/blogs/wael-kdouh/should-i-use-visual-studio-2017-or-vs-code-for-my-next-angular-application
-->
===Zed (osx)===
https://zed.dev/


[[Category:Programming]]
[[Category:Programming]]

Latest revision as of 11:46, 22 April 2024

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.


Text editors

Markers:

  • (+ssh) can load and save over ssh mostly transparently (Note also that applications like WinSCP also allow a decent solution for remote editing through watching local changes on files you have opened.)
  • (-syntax) does not have syntax highlighting (most do, though language supports always varies)

Pretty much all of the below do syntax highlighting.


Windows

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.
  • notepad (-syntax)
  • Notepad2 (third party; simple like notepad, but with syntax highlighting and a few other handy things)
  • notepad++
  • ultraedit (+ssh)

Linux

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.


  • kate (+ssh)
  • kwrite (+ssh)
  • kdevelop (+ssh)
  • NVU (web-specific)


Unsorted

programmer tools indent, astyle


IDEs

Visual Studio Code

vscode is an editor ('Visual Studio' seems to be mentioned only for branding reasons, it shares little with VS) that runs in win+lin+osx (because it is itself a browser+javascript based thing).

More interestingly, it happens to take extensions to do a lot of things, so with enough added installation it can be a full-blown IDE, supporting more languages that targeted IDEs. (That said, if you're developing for windows, you may be better of with Visual Studio, community edition)


It lets you work remotely, over SSH[1].


vscode keyboard shortcuts

  • F1 - command palette (including things that extensions provide)
  • F12 - go to definition (this feature seems increasingly broken, though?)
CtrlK F12 - show definition to the side


  • CtrlK Z - Zen mode (uncluttered), EscEsc to quit)


  • CtrlShiftSpace - show function parameter help


Overview

  • CtrlShift[, CtrlShift] - fold/expand code block
  • F8 - go to next problem


Formatting, refactoring and such

  • AltUp, AltDown - move line
  • Without a selection, CtrlX, CtrlC work on the line you're on.
  • Ctrl[, Ctrl] - indentation
  • Ctrl/ - toggle comments


  • CtrlH
CtrlShiftH - replace in many files (which exactly, though? All in workspace?)
  • F2 - rename symbol (more language-aware replace)


Multi-cursor

CtrlAltUp / CtrlAltDown - put cursor in same position on previous/next line
AltClick - add via mouse
CtrlD selects next occurrence of the word you're currently on (by substring, not symbol?)
CtrlF2 selects all occurrences (by substring, not symbol)

Issues

lots of memory / CPU use
cannot activate the X extension because it depends on the Y extension

Seems moderately likely to be some incompatibility between local and remote versions.

uninstall python, pylance, and jupyter (whichever of them you have) and installing them again is one good way to update them and tends to solve a lot of cases.



If each vscode client gets confused about what's on a single server state, and each needs to alter both sides' state to fix it, that may be the cause of the problem in the first place, so... good luck playing whack-a-mole.


Why would reloading the window help?

Iono.


Unable to watch for file changes. Please follow the instructions link to resolve this issue.
This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.

When logged into a linux server, inotify is used to get sooner-rather-than-later updates about what files other programs change within the workspace.


The lazy thing is to increase the amount of things that can be watched.

There is a default maximum to how many files eac user can watch via inotify - classically 8K, now more often tens of thousands, which should be enough for most workspaces.

Things to check

  • current limit, e.g. Template:Inlineode
  • symlinks -- I had a slimmed down dev environment that happened to symlink to a directory containing a half-a-million-file dataset.


Also keep in mind that remote logins to the same user will each watch the same set of things. In my case each adds 25K watches.


But maybe you actually want to reduce that.

  • Seeing what files are watched
    • If you can restart (and don't mind running an instance from the CLI you will want to quit later), you can do strace -fe inotify_add_watch code
    • If you need it on an already-started instance, then note this is not a fast query, because it watches inodes, and to get filenames from inodes isn't a cheap operation
also there is no existing tool, but things like inotify-info help


  • to exclude things, see vscode's files.watcherExclude setting. This seems to by default already exclude things like:
**/.git/objects/**
**/.git/subtree-cache/**
**/node_modules/*/**
**/.hg/store/**


See also: https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc

"Go to definition" doesn't function
This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.

Note that how this functions, and why it breaks, varies a little by langauge.





pylance doesn't function

It does that. Try to install a different version and see if that helps.


pylance talks nonsense, seems to be talking about completely different code

Yeahhhh... I dunno yet.


One issue I suspect is related is that pylance extension doesn't seem to prioritize reporting on the code actually open above reading (large) data files in the same directory - it would get behind.



Visual Studio

Zed (osx)

https://zed.dev/