How to fix newline indentation in recent version of vscode - visual-studio-code

I've been using VSCode (vscode) with the amVim extension for approximately 2+ years. I use vscode almost every day, and update it immediately every time it notifies me of a new version, which it checks for on startup. In the current and previous version I've had a new problem with indentation when I add a line to a source file. I've experienced this problem when editing *.go, *.vue, and *.css files, but mostly I've been working in Go files since the last two releases, so I've mostly seen it there. I did not notice this issue prior to the last two vscode releases.
When I add a newline with ENTER or SHIFT+o or any other means I've tried, it often adds the line with too little indentation. Whether this happens appears to depend on context, like how I recently moved the cursor, or where was the cursor when I added the newline, but I haven't figured out clear rules for when it will get the indentation right. I'd say it happens about half the time.
I haven't found a consistent workaround, so now when I add a newline I often have to hit tab until I reach the correct indentation. I can't predict whether this will happen, so when I add a newline I have to pause and look at the result instead of continuing to type. Alternatively, I write code at the wrong indentation and then hit save or auto-indent once it's syntactically complete to correct the indentation, but the code is harder to read and review until the indentation is right.
My current vscode version is 1.75.1, and amVim version is v1.34.0. I'm on Fedora 37 x64 (Linux). (My vscode Go extension is v0.37.1.)
I tried searching and browsing issues in both vscode and amVim Github repos and didn't see anything matching my issue, and I tried searching here as well without finding a match.

Related

VS Code issues on save

This problem is very weird to describe...
Sometimes null characters are added to the end of the open document.
Other times lines are deleted from the end of the document.
I feel like these must be related in a way.
I cannot reliably reproduce the error. But it seems to be connected to when I save the document since it happens much more frequently when autosave is enabled.
Installed extensions are:
Python,
Jupyter,
GithubCopilot,
R
The problem appears as soon as the jupyter extension is enabled.
The funny thing is I have the exact same setup on my desktop with absolutely no problems.
I tried removing visual studio code and the files created in the following folders:
%APPDATA%\Code and %USERPROFILE%.vscode - along with the other extension files like .jupyter.
Reinstalled everything.
Same problem.
You may install the Prettier extension. Prettier would suggest you add a blank line at the end of files so it may prevent cutting the final line in your saved files. I usually use this method.
You can find it on VS Code Marketplace or the documentation.

Can't use VSCode BetterWhitespace ext: "WhiteSpace detected that you set "editor.renderWhitespace" to "selection". The extension will now disabled."

I'm trying to use the BetterWhitespace extension with VSCode, but when I install it, I get a message saying WhiteSpace detected that you set "editor.renderWhitespace" to "selection". The extension will now disabled.
I've tried reinstalling, changing VSCode's default editor.renderWhitespace settings to other values such as all, and removing that line altogether just to check if that's the source of conflict with this plugin, but none of that has worked so far - I get the same message.
What can I do to get it to work?
The last commit on the extension's repo on GitHub was 4 years ago and the repo is archived, so I couldn't open an issue to ask the author there (I'm hoping this problem is not just because it's out of date). Thanks!
Per #riov8's comment, changing the setting to none works and the extension is activated. However it doesn't look as expected. While this answers my question of how to get past that error in my OP, the characters don't have any gaps in between so they just look like one continuous line, and there's a very slight but noticeable lag before the characters appear when I select text.
Unless someone knows anything about modifying the extension itself to correct this, I will have to drop it after all.

Indentation for files that don't have a registered formatter

It seems that I am getting this problem since version 1.18, honestly I don't remember.
With VSCodeVim installed I used to press the = key to get my code (Elixir, embedded elixir, ...) indented properly.
Am I missing something, like a configuration, that would allow me to re-indent my files without having a nagging "Formatter for file x not installed".
This is honestly the only things that nags me with VSCode so far, love the speed, the capabilities and the UI...
Just posting my comment as an answer
Try using the reindent lines command. This command should work for many languages even if you don't have a formatting extension for that language installed
Select the contents of file.Bottom right corner shows spaces/tabs: 2/4. You can click on that and indent the whole file.

Emacs indentation screwed up

I recently upgraded to emacs 24.3.1 in order to use a new mode for programming in D. I seem to have introduced some problem with my other modes now (Java, C++ C I'm just using whatever comes with emacs). When I scroll up/down in a buffer, the text displayed is totally messed up. As in lines mixed together, indentation screwy, cursor not modifying where it looks like it is. If I hit ctrl-l the screen refreshes and all is good. I noticed this problem every once in a while with my previous version when editing C .h files. But now it's happening on every single buffer. I can't work with it. Every time I move up/down I have to refresh the screen. I can't find anything similar to my problem with a google search. Might end up being an issue with some incompatible version of a dependency. Here's my system stats.
CentOS release 5.4 (Final)
linux 2.6.18-164.el5
emacs 24.3.1
I don't even know what other libs emacs might depend on. I'll be happy to post versions of anything that might be relevant.
Thanks
Since you say that this happens also with emacs -Q, i.e., without your init file, consider filing a bug report: M-x report-emacs-bug. For that, try to give a short, reprocible recipe, starting with emacs -Q. Emacs Dev will take a look and let you know whether they think there is a bug.
Using report-emacs-bug also automatically gathers info about your Emacs version etc., and includes it with your bug description.

Macro not working as expected in Notepad++

I just installed notepad++ and i am having some problems with macros in it.
i have a simple text file below:
hi
i am here
this is the third line
i kept the cursor at the first line before "hi".Now i selected start recording macro in the menu.i typed 'hi' before 'hi'(the actual word in the line) like below and pressed [Home] key in the keyboard and then pressed down arrow.Now i selected stop recording macro from the menu
hihi
i am here
this is the third line
but when i run the macro i am getting the following output
hihi
hˆi«i am here
hˆi«this is the third line
Could anybody please tell me where is the problem?
Upgrade to, at least, version 5.8.2 where that problem was fixed. I was experiencing the same problem, upgraded to version 5.8.5 and the problem is gone.
http://notepad-plus-plus.org/release/5.8.2
Fix macro recording bug for the non-ASCII characters.
same here as for Matt. For language, I was in normal text.
As mentioned in my comment at top, I have also been experiencing this same issue. Strange characters inserted when playing back a macro. This worked OK with previous versions, but appears to have been a bug introduced with version 5.7
It does appear to be an encoding issue. I have been able to workaround this issue by switching to UTF-8 encoding whilst recording the macro - as mentioned in the comment of this bug report.
This has been reported as a bug several times recently. Many are still open, however, one is reported as fixed. And is reported as fixed in the current release (5.8.2) - which also introduces several new features as regards macros. However, nothing later than v5.7 is yet available from the auto-updater within Notepad++ itself. However, you can manually download the latest installer from SourceForge.net.
I turned off the auto complete feature and this fixed the issue for me.
How do I stop Notepad++ from showing autocomplete for all words in the file
I had a problem, I typed in some code and it came out wrong in macro.
Then I neglected the advice to type the code and not paste it, and so I copy/pasted the code I needed and it worked fine.
So my advice: write it somewhere else and copy/paste when you start macro.