Formatting Scala files in Visual Studio code - visual-studio-code

I am working on a legacy code base where someone configured the tab to be 3 spaces and saved the files.
I want to reformat the files so that each file is indented with 4 spaces.
Can VSCode do that? When I select a file content and select format from edit menu it says no code formatter for .scala files

The accepted answer is deprecated! See vscode-scalafmt.
Use Metals instead.

Sounds like you might want to try the Scalafmt extension for Visual Studio Code.
EDIT:
I can't delete this answer as it is the accepted one, but the answer of #pme seems to be the correct one now.

Related

Is there a way to auto format modified code in Visual Studio Code (VS code)?

I just discovered the Command+ Shift+ f (for mac user) and it's very helpfull.
But somehow, I would like to know if there is a way to automate the code format at save for the added/modified code.
I dont want to do it on the whole file because it's gonna uglify the git history on modified blocks.
I recommend you to use "Prettier-Code formatter" extension. you just press 'ctrl+s'(for linux) and "command + s"(for mac) to format the file that you want to format. It will format code when you want to format. I still use auto save mode. I think it's very useful.

Visual Studio Code Does Not Format .cs files

couple of weeks ago I installed Visual Studio Code on my Windows machine. It is lightweight and I love it. But there is one problem that drives me crazy. The program cannot format .cs files. If I open .Net Core project, there is no problem on formatting. I changed the language from bottom right to C# and saved the file locally still no success. Is there any way to format code in single .cs file? I know there is already an asked question here for this problem but the solutions does not apply if there is no project created.
Use the command pallet (crtl-shift-P), type "format" and select "format code". Assuming the extension for the current language supports that.
TypeScript does, but C# does not.
You could raise an issue (if one does not already exist).

Copy code whilst preserving syntax highlighting in Visual Studio Code

I am using Visual Studio Code and want to copy code from it, but I want to preserve the syntax highlighting.
I want something like "Copy as HTML" , "Copy as HTML with syntax and background intact" or the like. What extensions or plugins do I need to use to get this functionality?
This is not currently possible, you can +1 the issue to help prioritize it https://github.com/Microsoft/vscode/issues/3518

Visual studio code extension: How can I add error markers to files in the explorer?

I have written a validator for my vscode extension, which uses a DiagnosticCollection to set errors for files. This works and the errors are shown when a file is opened.
I would now like to mark files in the explorer, so that it is easy to find files with errors. Here is an example]of how it looks in Eclipse:
Is it possible to do this in a vscode extension? Is there already an extension doing this?
Unfortunately, you can't do that.
There is an open issue asking something related to Git, but not as open as you want. Maybe using the API described in this another issue you could create a new panel with the marked files.
It is still experimental, BTW...

Which tools exists for byte-level inspection of files?

I have a partially corrupted MS-Word file which I'd like to inspect in the byte-level.
HexEdit is pretty nice (allows you to edit files too)
What you need is a hex editor. Some text editors can run in this mode. I always used PSPadfor this
As always there's emacs, hexl-mode allows you to view and edit hex-files.
I like the freeware hex editor xvi32 for this kind of task.
I'm sure there are many, but Ultraedit does this.
If you have Visual Studio installed, you can add the .dat extension to the file and open it in Visual Studio to get a hex/ASCII display.
010 Editor is nice for looking at files that follow some template, it'll try to turn the raw data into meaningful labeled values for you.
Take a gander at BeyondCompare for file comparisons; version 3 has comparisons for Word files as well. You'd be surprised at how often you'll use it once you have it.