go back

Here we describe how to start a new independent copy of Code-OSS.

First of all you need to decide a directory where Code-OSS will store its data, for example let us say ~/projects/myprg/code and create the directory code will be empty.

The command line may be:

code  --profile myprg --user-data-dir ~/projects/myprg/code/datadir --extensions-dir ~/projects/myprg/code/extensions "$@"

Using profile, user data dir, and extension dir one ensures that the execution is independent.

To find the configuration json files, use CTRL-P to open the search bar and type >json (don't forget the greater than symbol).

The starting settings are:

"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false,
"workbench.enableExperiments": false,
"workbench.settings.enableNaturalLanguageSearch": false,
"editor.fontFamily": "\"Iosevka paopao\", monospace",
"editor.fontSize": 16,

Extensions

Kaleidoscope

Colors are fun to look at, Kaleidoscope adhamu is fun and colorful looking.

Vim

The vim extension Vim vscodevim introduces few vim-like behaviors to make easier to navigate the code. Here are the settings, notably the `“vim.handleKeys”` is important to free CTRL-P.

"vim.autoindent": false,
"vim.normalModeKeyBindingsNonRecursive": [
  {
    "before": ["<bs>"],
    "after": ["<c-u>"]
  },
  {
    "before": ["<space>"],
    "after": ["<c-d>"]
  },
  {
    "before": [":"],
    "after": [";"]
  },
  {
    "before": [";"],
    "after": [":"]
  }
],
"vim.handleKeys": {
  "<C-p>": false
  "<C-k>": false,
  "<C-q>": false,
  "<C-t>": false
},

ClangD

The ClangD llvm-vs-code-extensions extension uses the clang compiler toolkit to have code completion, go-to-definition, underlined errors, and similar features while editing in Code-OSS.

ClangD works fine with CMake project, just be sure that in the main CMakeLists.txt just below the project line there is the line:

set( CMAKE_EXPORT_COMPILE_COMMANDS ON )

After calling cmake from an empty build directory you will get the compile_commands.json file needed by ClangD to work.

Here are a possible starting setting set:

"editor.formatOnSave": true,
"clangd.path": "/usr/bin/clangd",
"clangd.arguments": [
  "--compile-commands-dir=/path/to/your/compile_commands_dir/",
  "--fallback-style=chromium",
  "--clang-tidy",
  "--log=info", 
  "--all-scopes-completion",
  "--completion-style=detailed",
  "--header-insertion=never",
  "--background-index", 
  "--pretty"
]

If working with someone else code you may want to disable the formatOnSave option.