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 "editor.wordWrap": "wordWrapColumn",
29 "editor.wordWrapColumn": 80,
30 "files.trimTrailingWhitespace": true
32 "files.associations": {
36 "cSpell.ignorePaths": [
190 "cSpell.ignoreRegExpList": [
191 "\\\"(DIRC|FSMN|REUC|UNTR)\\\"",
192 "\\\\u[0-9a-fA-Fx]{4}\\b",
193 "\\b(filfre|frotz|xyzzy)\\b",
194 "\\bCMIT_FMT_DEFAULT\\b",
196 "\\bGET_OID_DISAMBIGUATORS\\b",
197 "\\bHASH_RENORMALIZE\\b",
198 "\\bTREESAMEness\\b",
200 "\\Wchar *\\*\\W*utfs\\W",
207 die
"Could not write settings.json"
209 # Infer some setup-specific locations/names
211 GCCPATH
="$(which gcc)"
212 GDBPATH
="$(which gdb)"
213 MAKECOMMAND
="make -j5 DEVELOPER=1"
216 case "$(uname -s)" in
218 GCCPATH
="$(cygpath -am "$GCCPATH")"
219 GDBPATH
="$(cygpath -am "$GDBPATH")"
220 MAKE_BASH
="$(cygpath -am /git-cmd.exe) --command=usr\\\\bin\\\\bash.exe"
221 MAKECOMMAND
="$MAKE_BASH -lc \\\"$MAKECOMMAND\\\""
235 cat >.vscode
/tasks.json.new
<<EOF ||
237 // See https://go.microsoft.com/fwlink/?LinkId=733558
238 // for the documentation about the tasks.json format
244 "command": "$MAKECOMMAND",
253 die
"Could not install default build task"
257 cat >.vscode
/launch.json.new
<<EOF ||
259 // Use IntelliSense to learn about possible attributes.
260 // Hover to view descriptions of existing attributes.
261 // For more information, visit:
262 // https://go.microsoft.com/fwlink/?linkid=830387
266 "name": "(gdb) Launch",
269 "program": "\${workspaceFolder}/git$X",
271 "stopAtEntry": false,
272 "cwd": "\${workspaceFolder}",
275 "miDebuggerPath": "$GDBPATH",
278 "description": "Enable pretty-printing for gdb",
279 "text": "-enable-pretty-printing",
280 "ignoreFailures": true
287 die
"Could not write launch configuration"
289 # C/C++ extension settings
291 make -f - OSNAME
=$OSNAME GCCPATH
="$GCCPATH" vscode-init \
292 >.vscode
/c_cpp_properties.json
<<\EOF ||
296 @mkdir
-p .vscode
&& \
298 for e
in $
(ALL_CFLAGS
) \
299 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \
300 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
301 '-DBINDIR="$(bindir_relative_SQ)"' \
302 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"' \
303 '-DDEFAULT_GIT_TEMPLATE_DIR="$(template_dir_SQ)"' \
304 '-DETC_GITCONFIG="$(ETC_GITCONFIG_SQ)"' \
305 '-DETC_GITATTRIBUTES="$(ETC_GITATTRIBUTES_SQ)"' \
306 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \
307 '-DCURL_DISABLE_TYPECHECK', \
308 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \
309 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \
310 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'; do \
313 incs
="$$(printf '% 16s"$
${workspaceRoot}",\n%s' \
317 incs
="$$(printf '% 16s"%s
",\n%s' \
318 "" "$
${e#-I}" "$
$incs")" \
321 incs
="$$(printf '% 16s"$
${workspaceRoot}/%s
",\n%s' \
322 "" "$
${e#-I}" "$
$incs")" \
325 defs
="$$(printf '% 16s"%s
",\n%s' \
326 "" "$$
(echo "$${e#-D}" |
sed 's/"/\\&/g')" \
332 echo ' "configurations": [' && \
334 echo ' "name": "$(OSNAME)",' && \
335 echo ' "intelliSenseMode": "clang-x64",' && \
336 echo ' "includePath": [' && \
337 echo "$$incs" |
sort |
sed '$$s/,$$//' && \
339 echo ' "defines": [' && \
340 echo "$$defs" |
sort |
sed '$$s/,$$//' && \
342 echo ' "browse": {' && \
343 echo ' "limitSymbolsToIncludedHeaders": true,' && \
344 echo ' "databaseFilename": "",' && \
345 echo ' "path": [' && \
346 echo ' "$${workspaceRoot}"' && \
349 echo ' "cStandard": "c11",' && \
350 echo ' "cppStandard": "c++17",' && \
351 echo ' "compilerPath": "$(GCCPATH)"' && \
354 echo ' "version": 4' && \
357 die
"Could not write settings for the C/C++ extension"
359 for file in .vscode
/settings.json .vscode
/tasks.json .vscode
/launch.json
363 if git
diff --no-index --quiet --exit-code $file $file.new
367 printf "The file $file.new has these changes:\n\n"
368 git
--no-pager diff --no-index $file $file.new
369 printf "\n\nMaybe \`mv $file.new $file\`?\n\n"