These notes are fairly surface-level as I'm finding this solution inadequate for my use case. But I'll leave up what little I have learned so hopefully it'll save the reader some time.
First thing to note: you can open a terminal at any time, so you're not handcuffed to the GUI. One way is to right click on a folder and click "open in integrated terminal". This is the same terminal environment you start your server in. YMMV how usable this terminal actually is for things like copy and paste, etc.
Fun fact: any changes made on the filesystem will be reflected in the code-server interface and editor.
When you open a project, a .vscode
directory will be created. This directory
has a few useful project-specific settings files.
tasks.json
lets you specify tasks to be run -- compilation, linting, the build
system, etc. [Introduction to
tasks]
An example tasks.json
file for cosmo:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "make MODE=dbg",
"type": "shell",
"command": "make all ${config:makeJobs} MODE=dbg -O",
"presentation": {
"reveal": "always"
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Note the ${config:makeJobs}
. tasks.json
supports limited variable
substitution. In
this case, it's referring to a variable in the settings.json
file:
{
"makeJobs": "-j8",
}
I could put this variable in my application-wide settings as well at
~/.local/share/code-server/User/settings.json
.
launches.json
lets you specify executables to be run and (usually) debugged.
[Configuring launch.json for C/C++
debugging]
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "hello.com",
"type": "gdb",
"request": "launch",
"target": "./o/dbg/examples/hello.com.dbg",
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText"
}
]
}
(This debugging experience is pretty neat when you're used to just gdb.)
VScode has lots of integrations for Node, Ruby, C#, and other modern languages. Unfortunately I am allergic to modernity and was left wanting for a non-allergenic substitute. I wanted make jobs integrated into the environment, and ms-vscode.makefile-tools is the only solution I found. Unfortunately this addon isn't very reliable. It can get (millions of) build targets adequately by reading the makefile. However, to get launch targets (a pretty convenient feature to build and run executables in one go) it depends on parsing the output of make. As of April 2022 this parsing can get thrown off by:
- multiple jobs through
-j
- jobs changing directories, resulting in different relative paths
- silencing the output beyond what V=1 shows
- shell commands including subshells through backticks
`foo`
(but not${foo}
apparently)
For more, see this article.
I was never able to get cosmo's build targets to appear. If you're struggling as
well, try using make
with V=1 --output-sync=recurse
, and if really necessary
-j1
.
The official vscode marketplace isn't actually what code-server uses, instead choosing to integrate addons from OpenVSX.