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": [
194 "cSpell.ignoreRegExpList": [
195 "\\\"(DIRC|FSMN|REUC|UNTR)\\\"",
196 "\\\\u[0-9a-fA-Fx]{4}\\b",
197 "\\b(filfre|frotz|xyzzy)\\b",
198 "\\bCMIT_FMT_DEFAULT\\b",
200 "\\bGET_OID_DISAMBIGUATORS\\b",
201 "\\bHASH_RENORMALIZE\\b",
202 "\\bTREESAMEness\\b",
204 "\\Wchar *\\*\\W*utfs\\W",
211 die
"Could not write settings.json"
213 # Infer some setup-specific locations/names
215 GCCPATH
="$(which gcc)"
216 GDBPATH
="$(which gdb)"
217 MAKECOMMAND
="make -j5 DEVELOPER=1"
220 case "$(uname -s)" in
222 GCCPATH
="$(cygpath -am "$GCCPATH")"
223 GDBPATH
="$(cygpath -am "$GDBPATH")"
224 MAKE_BASH
="$(cygpath -am /git-cmd.exe) --command=usr\\\\bin\\\\bash.exe"
225 MAKECOMMAND
="$MAKE_BASH -lc \\\"$MAKECOMMAND\\\""
239 cat >.vscode
/tasks.json.new
<<EOF ||
241 // See https://go.microsoft.com/fwlink/?LinkId=733558
242 // for the documentation about the tasks.json format
248 "command": "$MAKECOMMAND",
257 die
"Could not install default build task"
261 cat >.vscode
/launch.json.new
<<EOF ||
263 // Use IntelliSense to learn about possible attributes.
264 // Hover to view descriptions of existing attributes.
265 // For more information, visit:
266 // https://go.microsoft.com/fwlink/?linkid=830387
270 "name": "(gdb) Launch",
273 "program": "\${workspaceFolder}/git$X",
275 "stopAtEntry": false,
276 "cwd": "\${workspaceFolder}",
279 "miDebuggerPath": "$GDBPATH",
282 "description": "Enable pretty-printing for gdb",
283 "text": "-enable-pretty-printing",
284 "ignoreFailures": true
291 die
"Could not write launch configuration"
293 # C/C++ extension settings
295 make -f - OSNAME
=$OSNAME GCCPATH
="$GCCPATH" vscode-init \
296 >.vscode
/c_cpp_properties.json
<<\EOF ||
300 @mkdir
-p .vscode
&& \
302 for e
in $
(ALL_CFLAGS
) \
303 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
304 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
305 '-DBINDIR="$(bindir_relative_SQ)"' \
306 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"' \
307 '-DDEFAULT_GIT_TEMPLATE_DIR="$(template_dir_SQ)"' \
308 '-DETC_GITCONFIG="$(ETC_GITCONFIG_SQ)"' \
309 '-DETC_GITATTRIBUTES="$(ETC_GITATTRIBUTES_SQ)"' \
310 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
311 '-DCURL_DISABLE_TYPECHECK', \
312 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
313 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
314 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'; do \
317 incs
="$$(printf '% 16s"$
${workspaceRoot}",\n%s' \
321 incs
="$$(printf '% 16s"%s
",\n%s' \
322 "" "$
${e#-I}" "$
$incs")" \
325 incs
="$$(printf '% 16s"$
${workspaceRoot}/%s
",\n%s' \
326 "" "$
${e#-I}" "$
$incs")" \
329 defs
="$$(printf '% 16s"%s
",\n%s' \
330 "" "$$
(echo "$${e#-D}" |
sed 's/"/\\&/g')" \
336 echo ' "configurations": [' && \
338 echo ' "name": "$(OSNAME)",' && \
339 echo ' "intelliSenseMode": "clang-x64",' && \
340 echo ' "includePath": [' && \
341 echo "$$incs" |
sort |
sed '$$s/,$$//' && \
343 echo ' "defines": [' && \
344 echo "$$defs" |
sort |
sed '$$s/,$$//' && \
346 echo ' "browse": {' && \
347 echo ' "limitSymbolsToIncludedHeaders": true,' && \
348 echo ' "databaseFilename": "",' && \
349 echo ' "path": [' && \
350 echo ' "$${workspaceRoot}"' && \
353 echo ' "cStandard": "c11",' && \
354 echo ' "cppStandard": "c++17",' && \
355 echo ' "compilerPath": "$(GCCPATH)"' && \
358 echo ' "version": 4' && \
361 die
"Could not write settings for the C/C++ extension"
363 for file in .vscode
/settings.json .vscode
/tasks.json .vscode
/launch.json
367 if git
diff --no-index --quiet --exit-code $file $file.new
371 printf "The file $file.new has these changes:\n\n"
372 git
--no-pager diff --no-index $file $file.new
373 printf "\n\nMaybe \`mv $file.new $file\`?\n\n"