Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/contrib/vscode/init.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / contrib / vscode / init.sh` 376 lines ยท 8732 bytes Raw Blame History 1 #!/bin/sh 2 3 die () { 4 echo "$*" >&2 5 exit 1 6 } 7 8 cd "$(dirname "$0")"/../.. || 9 die "Could not cd to top-level directory" 10 11 mkdir -p .vscode || 12 die "Could not create .vscode/" 13 14 # General settings 15 16 cat >.vscode/settings.json.new <<\EOF || 17 { 18 "C_Cpp.intelliSenseEngine": "Default", 19 "C_Cpp.intelliSenseEngineFallback": "Disabled", 20 "[git-commit]": { 21 "editor.wordWrap": "wordWrapColumn", 22 "editor.wordWrapColumn": 72 23 }, 24 "[c]": { 25 "editor.detectIndentation": false, 26 "editor.insertSpaces": false, 27 "editor.tabSize": 8, 28 "files.trimTrailingWhitespace": true 29 }, 30 "[txt]": { 31 "editor.detectIndentation": false, 32 "editor.insertSpaces": false, 33 "editor.tabSize": 8, 34 "files.trimTrailingWhitespace": true 35 }, 36 "files.associations": { 37 "*.h": "c", 38 "*.c": "c" 39 }, 40 "cSpell.ignorePaths": [ 41 ], 42 "cSpell.words": [ 43 "DATAW", 44 "DBCACHED", 45 "DFCHECK", 46 "DTYPE", 47 "Hamano", 48 "HCAST", 49 "HEXSZ", 50 "HKEY", 51 "HKLM", 52 "IFGITLINK", 53 "IFINVALID", 54 "ISBROKEN", 55 "ISGITLINK", 56 "ISSYMREF", 57 "Junio", 58 "LPDWORD", 59 "LPPROC", 60 "LPWSTR", 61 "MSVCRT", 62 "NOARG", 63 "NOCOMPLETE", 64 "NOINHERIT", 65 "RENORMALIZE", 66 "STARTF", 67 "STARTUPINFOEXW", 68 "Schindelin", 69 "UCRT", 70 "YESNO", 71 "argcp", 72 "beginthreadex", 73 "committish", 74 "contentp", 75 "cpath", 76 "cpidx", 77 "ctim", 78 "dequote", 79 "envw", 80 "ewah", 81 "fdata", 82 "fherr", 83 "fhin", 84 "fhout", 85 "fragp", 86 "fsmonitor", 87 "hnsec", 88 "idents", 89 "includeif", 90 "interpr", 91 "iprog", 92 "isexe", 93 "iskeychar", 94 "kompare", 95 "mktag", 96 "mktree", 97 "mmblob", 98 "mmbuffer", 99 "mmfile", 100 "noenv", 101 "nparents", 102 "ntpath", 103 "ondisk", 104 "ooid", 105 "oplen", 106 "osdl", 107 "pnew", 108 "pold", 109 "ppinfo", 110 "pushf", 111 "pushv", 112 "rawsz", 113 "rebasing", 114 "reencode", 115 "repo", 116 "rerere", 117 "scld", 118 "sharedrepo", 119 "spawnv", 120 "spawnve", 121 "spawnvpe", 122 "strdup'ing", 123 "submodule", 124 "submodules", 125 "topath", 126 "topo", 127 "tpatch", 128 "unexecutable", 129 "unhide", 130 "unkc", 131 "unkv", 132 "unmark", 133 "unmatch", 134 "unsets", 135 "unshown", 136 "untracked", 137 "untrackedcache", 138 "unuse", 139 "upos", 140 "uval", 141 "vreportf", 142 "wargs", 143 "wargv", 144 "wbuffer", 145 "wcmd", 146 "wcsnicmp", 147 "wcstoutfdup", 148 "wdeltaenv", 149 "wdir", 150 "wenv", 151 "wenvblk", 152 "wenvcmp", 153 "wenviron", 154 "wenvpos", 155 "wenvsz", 156 "wfile", 157 "wfilename", 158 "wfopen", 159 "wfreopen", 160 "wfullpath", 161 "which'll", 162 "wlink", 163 "wmain", 164 "wmkdir", 165 "wmktemp", 166 "wnewpath", 167 "wotype", 168 "wpath", 169 "wpathname", 170 "wpgmptr", 171 "wpnew", 172 "wpointer", 173 "wpold", 174 "wpos", 175 "wputenv", 176 "wrmdir", 177 "wship", 178 "wtarget", 179 "wtemplate", 180 "wunlink", 181 "xcalloc", 182 "xgetcwd", 183 "xmallocz", 184 "xmemdupz", 185 "xmmap", 186 "xopts", 187 "xrealloc", 188 "xsnprintf", 189 "xutftowcs", 190 "xutftowcsn", 191 "xwcstoutf" 192 ], 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", 198 "\\bde-munge\\b", 199 "\\bGET_OID_DISAMBIGUATORS\\b", 200 "\\bHASH_RENORMALIZE\\b", 201 "\\bTREESAMEness\\b", 202 "\\bUSE_STDEV\\b", 203 "\\Wchar *\\*\\W*utfs\\W", 204 "cURL's", 205 "ntifs\\.h", 206 ], 207 } 208 EOF 209 die "Could not write settings.json" 210 211 # Infer some setup-specific locations/names 212 213 GCCPATH="$(which gcc)" 214 GDBPATH="$(which gdb)" 215 MAKECOMMAND="make -j5 DEVELOPER=1" 216 OSNAME= 217 X= 218 case "$(uname -s)" in 219 MINGW*) 220 GCCPATH="$(cygpath -am "$GCCPATH")" 221 GDBPATH="$(cygpath -am "$GDBPATH")" 222 MAKE_BASH="$(cygpath -am /git-cmd.exe) --command=usr\\\\bin\\\\bash.exe" 223 MAKECOMMAND="$MAKE_BASH -lc \\\"$MAKECOMMAND\\\"" 224 OSNAME=Win32 225 X=.exe 226 ;; 227 Linux) 228 OSNAME=Linux 229 ;; 230 Darwin) 231 OSNAME=macOS 232 ;; 233 esac 234 235 # Default build task 236 237 cat >.vscode/tasks.json.new <.vscode/launch.json.new <.vscode/c_cpp_properties.json <<\EOF || 295 include Makefile 296 297 vscode-init: 298 @mkdir -p .vscode && \ 299 incs= && defs= && \ 300 for e in $(ALL_CFLAGS) \ 301 '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' \ 302 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \ 303 '-DBINDIR="$(bindir_relative_SQ)"' \ 304 '-DFALLBACK_RUNTIME_PREFIX="$(prefix_SQ)"' \ 305 '-DDEFAULT_GIT_TEMPLATE_DIR="$(template_dir_SQ)"' \ 306 '-DETC_GITCONFIG="$(ETC_GITCONFIG_SQ)"' \ 307 '-DETC_GITATTRIBUTES="$(ETC_GITATTRIBUTES_SQ)"' \ 308 '-DGIT_LOCALE_PATH="$(localedir_relative_SQ)"' \ 309 '-DCURL_DISABLE_TYPECHECK', \ 310 '-DGIT_HTML_PATH="$(htmldir_relative_SQ)"' \ 311 '-DGIT_MAN_PATH="$(mandir_relative_SQ)"' \ 312 '-DGIT_INFO_PATH="$(infodir_relative_SQ)"'; do \ 313 case "$$e" in \ 314 -I.) \ 315 incs="$$(printf '% 16s"$${workspaceRoot}",\n%s' \ 316 "" "$$incs")" \ 317 ;; \ 318 -I/*) \ 319 incs="$$(printf '% 16s"%s",\n%s' \ 320 "" "$${e#-I}" "$$incs")" \ 321 ;; \ 322 -I*) \ 323 incs="$$(printf '% 16s"$${workspaceRoot}/%s",\n%s' \ 324 "" "$${e#-I}" "$$incs")" \ 325 ;; \ 326 -D*) \ 327 defs="$$(printf '% 16s"%s",\n%s' \ 328 "" "$$(echo "$${e#-D}" | sed 's/"/\\&/g')" \ 329 "$$defs")" \ 330 ;; \ 331 esac; \ 332 done && \ 333 echo '{' && \ 334 echo ' "configurations": [' && \ 335 echo ' {' && \ 336 echo ' "name": "$(OSNAME)",' && \ 337 echo ' "intelliSenseMode": "clang-x64",' && \ 338 echo ' "includePath": [' && \ 339 echo "$$incs" | sort | sed '$$s/,$$//' && \ 340 echo ' ],' && \ 341 echo ' "defines": [' && \ 342 echo "$$defs" | sort | sed '$$s/,$$//' && \ 343 echo ' ],' && \ 344 echo ' "browse": {' && \ 345 echo ' "limitSymbolsToIncludedHeaders": true,' && \ 346 echo ' "databaseFilename": "",' && \ 347 echo ' "path": [' && \ 348 echo ' "$${workspaceRoot}"' && \ 349 echo ' ]' && \ 350 echo ' },' && \ 351 echo ' "cStandard": "c11",' && \ 352 echo ' "cppStandard": "c++17",' && \ 353 echo ' "compilerPath": "$(GCCPATH)"' && \ 354 echo ' }' && \ 355 echo ' ],' && \ 356 echo ' "version": 4' && \ 357 echo '}' 358 EOF 359 die "Could not write settings for the C/C++ extension" 360 361 for file in .vscode/settings.json .vscode/tasks.json .vscode/launch.json 362 do 363 if test -f $file 364 then 365 if git diff --no-index --quiet --exit-code $file $file.new 366 then 367 rm $file.new 368 else 369 printf "The file $file.new has these changes:\n\n" 370 git --no-pager diff --no-index $file $file.new 371 printf "\n\nMaybe \`mv $file.new $file\`?\n\n" 372 fi 373 else 374 mv $file.new $file 375 fi 376 done