Linux VM Tips and Tricks
Shell Configuration
This works well in $HOME/.bashrc on your Linux VM. It enhances the user experience by setting some nice configuration for each shell.
Bash startup
$HOME/.bashrc
Readline (used by bash to handle what you type)
$HOME/.inputrc
Nicer docker ps output
Add this property to your $HOME/.docker/config.json:
Quiet shell startup
Create an empty file called $HOME/.hushlogin (touch $HOME/.hushlogin)
Fewer issues with docker mounts and permissions
Create a folder like $HOME/var/docker/mount and put a folder in there for each service you want to mount things for and put the things you want to mount in those subfolders. So, for example, if you want to mount a file called Config.json in a docker container for the service_bus service you would have it in $HOME/var/docker/mount/service_bus. If anything gets assigned to root you can then take that folder $HOME/var/docker/service_bus and move it to the /tmp folder and create a new one to hold the Config.json file and you will be fine. All files in the /tmp folder get deleted when the Linux VM is restarted.
VSCode Configuration
settings.json
For each of the code sections below we are talking about a set of properties in JSON format that can be added to your settings.json file for vscode. Each section tells a little about the purpose of those properties. These are currently listed in no particular order.
Diff will ignore whitespace by default
ESLint “fix” will run and fix all problems when you save
Things I like the editor to do when I write code
The inseetSpace… ones are to keep the editor from helping me too much. The autoImport… ones prevent automatic import of node:test because we are not using it. It helps autoimport find vitest instead. And that last one is because I don’t usually mean to do “deconstruct to a new name” like {original: aliased} if I try to rename original. I mean to just change it directly.
Launch configurations for debugging (not in container)
Examples of how to exclude/exclude some things from search
Opening a folder opens a new vscode instance
No “splash” or “editor” open when vscode starts
tasks.json
The example tasks.json file below defines a task that can be used to run ESLint on all the files in the project. One really useful thing about this task is that it will add problem markers to vscode that can show up in the appropriate panel about PROBLEMS. It has one problem per row and they are clickable and take you to the place where the problem was found in the code directly. The task provided by the ESLint plugin works pretty well, but this gives better feedback in my opinion. When there are no problems it will output a “0” to the task output. That way you can tell when it completes the lint check even if there are no problems.