8 cd "$(dirname "$0")"/..
/.. ||
9 die
"Could not cd to top-level directory"
12 die
"Could not create .vscode/"
16 cat >.vscode
/settings.json.new
<<\EOF ||
18 "C_Cpp.intelliSenseEngine": "Default",
19 "C_Cpp.intelliSenseEngineFallback": "Disabled",
21 "editor.wordWrap": "wordWrapColumn",
22 "editor.wordWrapColumn": 72
25 "editor.detectIndentation": false
,
26 "editor.insertSpaces": false
,
28 "files.trimTrailingWhitespace": true
31 "editor.detectIndentation": false
,
32 "editor.insertSpaces": false
,
34 "files.trimTrailingWhitespace": true
36 "files.associations": {
40 "cSpell.ignorePaths": [
193 "cSpell.ignoreRegExpList": [
194 "\\\"(DIRC|FSMN|REUC|UNTR)\\\"",
195 "\\\\u[0-9a-fA-Fx]{4}\\b",
196 "\\b(filfre|frotz|xyzzy)\\b",
197 "\\bCMIT_FMT_DEFAULT\\b",
199 "\\bGET_OID_DISAMBIGUATORS\\b",
200 "\\bHASH_RENORMALIZE\\b",
201 "\\bTREESAMEness\\b",
203 "\\Wchar *\\*\\W*utfs\\W",
210 die
"Could not write settings.json"
212 # Infer some setup-specific locations/names
214 GCCPATH
="$(which gcc)"
215 GDBPATH
="$(which gdb)"
216 MAKECOMMAND
="make -j5 DEVELOPER=1"
219 case "$(uname -s)" in
221 GCCPATH
="$(cygpath -am "$GCCPATH")"
222 GDBPATH
="$(cygpath -am "$GDBPATH")"
223 MAKE_BASH
="$(cygpath -am /git-cmd.exe) --command=usr\\\\bin\\\\bash.exe"
224 MAKECOMMAND
="$MAKE_BASH -lc \\\"$MAKECOMMAND\\\""
238 cat >.vscode
/tasks.json.new
<<EOF ||
240 // See https://go.microsoft.com/fwlink/?LinkId=733558
241 // for the documentation about the tasks.json format
247 "command": "$MAKECOMMAND",
256 die
"Could not install default build task"
260 cat >.vscode
/launch.json.new
<<EOF ||
262 // Use IntelliSense to learn about possible attributes.
263 // Hover to view descriptions of existing attributes.
264 // For more information, visit:
265 // https://go.microsoft.com/fwlink/?linkid=830387
269 "name": "(gdb) Launch",
272 "program": "\${workspaceFolder}/git$X",
274 "stopAtEntry": false,
275 "cwd": "\${workspaceFolder}",
278 "miDebuggerPath": "$GDBPATH",
281 "description": "Enable pretty-printing for gdb",
282 "text": "-enable-pretty-printing",
283 "ignoreFailures": true
290 die
"Could not write launch configuration"
292 # C/C++ extension settings
294 make -f - OSNAME
=$OSNAME GCCPATH
="$GCCPATH" vscode-init \
295 >.vscode
/c_cpp_properties.json
<<\EOF ||
299 @mkdir
-p .vscode
&& \
301 for e
in $
(ALL_CFLAGS
) \
302 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
303 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
304 '-DBINDIR="$(bindir_relative_SQ)"' \
305 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"' \
306 '-DDEFAULT_GIT_TEMPLATE_DIR="$(template_dir_SQ)"' \
307 '-DETC_GITCONFIG="$(ETC_GITCONFIG_SQ)"' \
308 '-DETC_GITATTRIBUTES="$(ETC_GITATTRIBUTES_SQ)"' \
309 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
310 '-DCURL_DISABLE_TYPECHECK', \
311 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
312 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
313 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'; do \
316 incs
="$$(printf '% 16s"$
${workspaceRoot}",\n%s' \
320 incs
="$$(printf '% 16s"%s
",\n%s' \
321 "" "$
${e#-I}" "$
$incs")" \
324 incs
="$$(printf '% 16s"$
${workspaceRoot}/%s
",\n%s' \
325 "" "$
${e#-I}" "$
$incs")" \
328 defs
="$$(printf '% 16s"%s
",\n%s' \
329 "" "$$
(echo "$${e#-D}" |
sed 's/"/\\&/g')" \
335 echo ' "configurations": [' && \
337 echo ' "name": "$(OSNAME)",' && \
338 echo ' "intelliSenseMode": "clang-x64",' && \
339 echo ' "includePath": [' && \
340 echo "$$incs" |
sort |
sed '$$s/,$$//' && \
342 echo ' "defines": [' && \
343 echo "$$defs" |
sort |
sed '$$s/,$$//' && \
345 echo ' "browse": {' && \
346 echo ' "limitSymbolsToIncludedHeaders": true,' && \
347 echo ' "databaseFilename": "",' && \
348 echo ' "path": [' && \
349 echo ' "$${workspaceRoot}"' && \
352 echo ' "cStandard": "c11",' && \
353 echo ' "cppStandard": "c++17",' && \
354 echo ' "compilerPath": "$(GCCPATH)"' && \
357 echo ' "version": 4' && \
360 die
"Could not write settings for the C/C++ extension"
362 for file in .vscode
/settings.json .vscode
/tasks.json .vscode
/launch.json
366 if git
diff --no-index --quiet --exit-code $file $file.new
370 printf "The file $file.new has these changes:\n\n"
371 git
--no-pager diff --no-index $file $file.new
372 printf "\n\nMaybe \`mv $file.new $file\`?\n\n"