Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

VS Code Tips for FORM Developers

Takahiro Ueda edited this pageOct 14, 2025 ·17 revisions

SinceVisual Studio Code (VS Code) isused by many people, it would be helpful to introduce some useful configuration tips (i.e.,workspace settings in.vscode/*.json) for VS Code here.

For simplicity, we assume a Linux environment, the local repository is cloned fromyour fork:

git clone git@github.com:YOUR_GITHUB_USER_NAME/form.gitcd formgit remote add upstream https://github.com/vermaseren/form.git

and the build directory (using out-of-source build) isbuild:

autoreconf -fivmkdir -p buildpushd build../configure --enable-debugecho'*'>.gitignorepopd

The following commands configure Git to ignore the workspace settings:

mkdir -p .vscodeecho'*'>.vscode/.gitignore

Basic Editor Settings

VS Code'sauto-formatter is useful, so you may have it enabled globally. However, because the FORM source code is written in somewhat unique coding style, applying the formatter leads to massive changes that you do not desire. If this is the case, you need to turn it off in your workspace settings. Moreover, whitespaces and end-of-line settings should be adjusted for the FORM source code.

.vscode/settings.json:

{"editor.defaultFormatter":null,"editor.formatOnPaste":false,"editor.formatOnSave":false,"editor.formatOnType":false,"files.eol":"\n","files.insertFinalNewline":true,"files.trimTrailingWhitespace":false}

Folding

The FORM source code utilizesfolding extensively with the fold markers#[ and#]. Unfortunately, as of April 2024, VS Codedoes not support folding based on custom markers. This is implemented, for example, by the following extension:

The configuration is as follows:

.vscode/settings.json:

{"editor.foldingStrategy":"auto","editor.defaultFoldingRangeProvider":null,"[c]": {"editor.defaultFoldingRangeProvider":"zokugun.explicit-folding","explicitFolding.rules": [            {"begin":"#[","end":"#]"            },            {"beginRegex":"#if(?:n?def)?","middleRegex":"#el(?:se|if)","endRegex":"#endif"            }        ]    },"[cpp]": {"editor.defaultFoldingRangeProvider":"zokugun.explicit-folding","explicitFolding.rules": [            {"begin":"#[","end":"#]"            },            {"beginRegex":"#if(?:n?def)?","middleRegex":"#el(?:se|if)","endRegex":"#endif"            }        ]    },"[form]": {"editor.defaultFoldingRangeProvider":"zokugun.explicit-folding","explicitFolding.rules": [            {"begin":"#[","end":"#]"            }        ]    }}

Whitespaces

Because the FORM source code contains intentional trailing whitespaces in some places, the following plugin to display them can be useful:

C/C++

At a minimum, the following extension is needed:

  • C/C++ (ms-vscode.cpptools)

However, to avoid seeing the pop-up message

Do you want to install the recommended 'C/C++ Extension Pack' extension from Microsoft for the C language?

every time you launch VS Code and open a C file for the first time after starting, you may install the following recommended extension:

Intellisense configuration is as follows. Note that some POSIX symbols require that_POSIX_C_SOURCE is properly defined (e.g.,pthread_rwlock_t).

.vscode/settings.json:

{"C_Cpp.default.includePath": ["${workspaceFolder}/build","${workspaceFolder}/build/sources","${workspaceFolder}/extern/zstd/zlibWrapper"    ],"C_Cpp.default.defines": ["_POSIX_C_SOURCE=200809L","HAVE_CONFIG_H"    ]}

.vscode/c_cpp_properties.json:

{"configurations": [        {"name":"form"        },        {"name":"vorm","defines": ["${default}","DEBUGGING"            ]        },        {"name":"tform","defines": ["${default}","WITHPTHREADS"            ]        },        {"name":"tvorm","defines": ["${default}","WITHPTHREADS","DEBUGGING"            ]        },        {"name":"parform","defines": ["${default}","WITHMPI","PF_WITHGETENV","PF_WITHLOG"            ]        },        {"name":"parvorm","defines": ["${default}","PF_WITHGETENV","PF_WITHLOG","DEBUGGING"            ]        }    ],"version":4,"enableConfigurationSquiggles":true}

Debugging configuration with GDB, runningtest.frm, is as follows.

.vscode/launch.json:

{"version":"0.2.0","configurations": [        {"name":"(gdb) vorm test.frm","type":"cppdbg","request":"launch","program":"${workspaceFolder}/build/sources/vorm","args": ["test.frm"            ],"cwd":"${workspaceFolder}","environment": [],"stopAtEntry":false,"externalConsole":false,"MIMode":"gdb","preLaunchTask":"make-vorm","setupCommands": [                {"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true                },                {"description":"Set Disassembly Flavor to Intel","text":"-gdb-set disassembly-flavor intel","ignoreFailures":true                }            ]        },        {"name":"(gdb) tvorm -w4 test.frm","type":"cppdbg","request":"launch","program":"${workspaceFolder}/build/sources/tvorm","args": ["-w4","test.frm"            ],"cwd":"${workspaceFolder}","environment": [],"stopAtEntry":false,"externalConsole":false,"MIMode":"gdb","preLaunchTask":"make-tvorm","setupCommands": [                {"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true                },                {"description":"Set Disassembly Flavor to Intel","text":"-gdb-set disassembly-flavor intel","ignoreFailures":true                }            ]        }    ]}

.vscode/tasks.json:

{"version":"2.0.0","tasks": [        {"label":"make-vorm","type":"shell","command":"make -j $(nproc) vorm","options": {"cwd":"${workspaceFolder}/build/sources"            },"problemMatcher": ["$gcc"            ],"group": {"kind":"build","isDefault":true            }        },        {"label":"make-tvorm","type":"shell","command":"make -j $(nproc) tvorm","options": {"cwd":"${workspaceFolder}/build/sources"            },"problemMatcher": ["$gcc"            ],"group": {"kind":"build","isDefault":true            }        }    ]}

FORM

.vscode/settings.json:

{"files.associations": {"*.h":"c"    }}

Git

GitHub Actions

Autotools

Spell Checker

.vscode/settings.json:

{"cSpell.maxNumberOfProblems":1000,"cSpell.enabledFileTypes": {"automake":true,"c":true,"cpp":true,"form":true,"github-actions-workflow":true,"json":true,"m4":true,"markdown":true,"ruby":true,"yaml":true    }}

.vscode/cspell.json:

{"version":"0.2","language":"en-GB","allowCompoundWords":true,"words": ["__cplusplus","AddCoef","AGMFUNCTION","ARGTOARG","ARLTOARL","ATENDOFMODULE","autoreconf","auxjjm","auxjm","auxr_","BHEAD","boomlijst","BUCKETTOBERELEASED","BUILTINDOLLARS","CanCommu","CBUF","CDELETE","CDELTA","CDOLLAR","CDUBIOUS","CEXPRESSION","CFLAGS","CFUN","CFUNCTION","chainin","CINDEX","Civita","clearcbuf","ClearfFloat","CNUMBER","Cnumlhs","COEFFI","color","compactify","CompCoef","ComprTop","CPPFLAGS","cprocedureExtension","CSYMBOL","CXXFLAGS","daemonization","ddterms","DEDUPARG","DESY","DetCommu","DICT_DOSPECIALS","DICT_INDOLLARS","DICT_NOTINDOLLARS","DISTHOOK_VERSION","DO_UFFLE","DoArgPlode","DoesCommu","DoIfydef","DoinParallel","DOLARGUMENT","DOLINDEX","DOLNUMBER","DOLOOP","dolooplevel","doloopnest","DOLSUBTERM","DOLUNDEFINED","DOLWILDARGS","DOLZERO","DonotinParallel","DOONEEXPRESSION","DoShtuffle","DOTPBIT","DROPGEXPRESSION","DROPHGEXPRESSION","DROPHLEXPRESSION","DUBIOUSV","DUMFUN","dumnumflag","DUMPINTERMS","DUMPTOPARALLEL","ebufnum","EESYMBOL","EMPTYININDEX","EMSYMBOL","enddo","ENDOFINPUT","Eside","EXCHN","EXECUTINGIF","FindrNumber","finishcbuf","finishuf","fpcompressed","fpincompressed","FROMBRAC","FUNTOFUN","GAMMAI","GETCOEF","gextrasymbols","GFIVE","gfunpowers","ggextrasymbols","ggnumextrasym","GMINUS","gnumelements","gnumextrasym","GPLUS","GRCC_MAXFLINES","GRCC_MAXMPARTICLES","GRCC_MAXMPARTICLES2","GRCC_MAXPSLIST","GRCC_OPT_Outgrf","GRCC_OPT_SymmFinal","GRCC_OPT_SymmInitial","GRCC_QGRAF_OPT_CYCLI","GRCC_QGRAF_OPT_NOSIGMA","GRCC_QGRAF_OPT_NOSNAIL","GRCC_QGRAF_OPT_NOTADPOLE","GRCC","grccmodel","greedymaxperc","HAAKJE","HIDE_UNDOC_MEMBERS","HIDEGEXPRESSION","hparallelflag","HTOZARG","identityofthreads","IFDOLLAR","IFDOLLAREXTRA","IFISFACTORIZED","ifnomatch","indi1","indi2","INDTOIND","INDTOSUB","inicbufs","inictable","iniwranf","inparallelflag","inprimelist","INTOHIDEGEXPRESSION","iranf","ISCOMPRESSED","ISFACTORIZED","ISFORTRAN90","ISGEPOS","ISGEPOSINC","ISLYNDON","ISLYNDONR","ISNOTFORTRAN90","ISNOTZEROPOS","ISPOSPOS","ISUNMODIFIED","ISZERO","Kaneko","KEYWORDV","LDFLAGS","LEVICIVITA","lhdollarerror","lhdollarflag","LHSIDE","LHSIDEX","lijst","listofavailables","LNFUNCTION","LPARENTHESIS","LRPARENTHESES","m4_bregexp","m4_esyscmd_s","m4_esyscmd","m4_ifndef","Mathematica","MATHEMATICAMODE","MAXENAME","MAXFLEVELS","MAXFPATCHES","MAXIF","MAXINNAMETREE","MAXNCPLG","maxnlegs","MAXNUMBEROFNONCOMTERMS","MAXWILDC","MCTS","mctsconstant","mctsdecaymode","MCTSEXPANDTREE","mctsnumexpand","mctsnumkeep","mctsnumrepeat","mctstimelimit","MINIMUMNUMBEROFTERMS","Misha","mnumlhs","mnumrhs","Moebius","moebiustable","moebiustablesize","mparallelflag","mpfaux_","mpfdelta1","MPFR","mpftab1","mpftab2","mpiexec","mpirun","Mully","ncmod","NCOPY","NCOPYB","NCOPYI","ncouplings","NestPoin","Nikhef","nindices","ninterms","nlegs","NOFUNPOWERS","NOINVERSES","NOLYNDON","NOPARALLEL","NoScrat2","NOSNAILS","NOTADPOLES","numberofindexblocks","numberofsortbots","numberofterms","numberofthreads","numberofthreadslock","numberofworkers","numdollars","numdum","NUMFACS","numfunnies","numinprimelist","numlegs","numrbufs","NUMTOIND","NUMTOSYM","numxsymbol","nvertices","NwildC","O_CSEGREEDY","O_FORWARDORBACKWARD","oldcbuf","oldnumpotmoddollars","Olduflags","OMPI_SKIP_MPICXX","ONEPI","onfile","Opteron","optimtimes","outtohide","parvorm","PERMP","PFORTRANMODE","PoinFill","PRENOACTION","PRETYPEDO","PRETYPEIF","PRINTLFILE","PRINTON","pthreads","PVFUNV","PVFUNWP","QGRAF","RaisPow","rbufs","RCYCLESYMMETRIC","ReadijObject","REDLENG","reken","ResizeNCWORD","RHSIDE","RLONG","RPARENTHESIS","RunDedup","RWLOCKR","RWLOCKW","ScratSize","setexterntopo","setinterntopo","setOutgrf","SETTONUM","SFHSIZE","SHcombi","SHcombisize","SIZEFACS","SKIPGEXPRESSION","SKIPUNHIDEGEXPRESSION","SmallEsize","SMAXFPATCHES","SNUMBER","SSORTIOSIZE","stuffle","SUMF1","SUMF2","SUMMEDIND","SYMTONUM","SYMTOSUB","SYMTOSYM","TCONJUGATE","TDELTA","TDIVIDE","TDOLLAR","TDUBIOUS","TENDOFIT","Tentukov","Tentyukov","TFORM","TFUN","TFUNCLOSE","TFUNCTION","TFUNOPEN","TGENINDEX","ThreadScratOutSize","TINDEX","TMINUS","TMULTIPLY","TNUMBER","TOBEFACTORED","TOBEUNFACTORED","TOLONG","TOLYNDON","TOLYNDONR","TOPO","topofavailables","TOPOLYNOMIALFLAG","TORAT","totalnumberofthreads","totnum","TPLUS","TPOWER","TRACEN","TraceNgen","TransEname","TSETDOL","TSGAMMA","TSYMBOL","TVECTOR","tvorm","TWILDARG","TYPEDETCURDUM","TYPEDOLOOP","TYPEENDDOLOOP","TYPEFPRINT","TYPEIF","TYPEINEXPRESSION","TYPEISFUN","TYPEISMYSTERY","TYPEISSUB","TYPESTUFFLE","TYPETOPOLYNOMIAL","TYPETORAT","TYPETOSPECTATOR","unfactorize","UNHIDEGEXPRESSION","UNHIDELEXPRESSION","UNRWLOCK","UWORD","V2Ileg","VARTYPEROOTOFUNITY","VECTBIT","VECTOMIN","VECTOSUB","VECTOVEC","Vermaseren","vorm","VORTRANMODE","WCOPY","WITHMPI","WITHONEPI","WITHZSTD","wranf","wranfcall","wranfia","wranfnpair1","wranfnpair2","wranfseed","WriteUnfinString","wsizeof","xsymbol","zbufnum","Zeuthen","ziobuffer","ziosize","zsparray","zstd","ZTOHARG",    ],"overrides": [        {"filename":"sources/grcc.cc","words": ["addArtic","adjmat","aelegs","agraph","agrcount","aparticle","argag","argemg","argmg","articuls","bicol","bicount","bidef","bidef","biinitE","bilow","bipart","bisearchME","blksp","blkstk","blkstkptr","blkt","cdeg","cDiag","cgen","chkMomConsv","cldeg","clmat","clnum","clord","clst","cltyp","CLWIGHTD","CLWIGHTO","cmaxd","cmaxdeg","cmind","cnlist","cple","cplgcp","cplglg","cplgnvl","cplgvl","csav","ctloop","ctyp","curcl","defaultv","dega","eclass","econn","edgen","EDGEPORDER","edlg","edtype","edup","edupv","egraph","egrph","emom","endmg","eplist","erearg","esize","esum","esym","extj","extk","extMomConsv","exto","fgcnt","freelg","iinp","ilegs","ilst","intrct","itlist","jdir","jgho","jmaj","klow","lastlg","lastv","lmom","loopm","lsum","mclss","mdlfn","mdlfp","mgraph","minopi2p","modl","momdir","momj","momk","momset","mopi","multp","mwopi","mwsum","mxdeg","nadj2ptv","nAOPI","nart","narticuls","nartps","nbacked","nblksp","nbridges","nccl","nclist","nclss","ncouple","ncplgcp","nctopic","ndart","ndcl","ndeg","ndtyp","ndtype","neblocks","neclass","nedg","NEWOUTPY","nextn","nextot","nfin","ngelem","ngen","ngho","ngraphs","ngrp","nilst","nini","ninitl","nleg","nlgs","nlpopic","nmaj","nmedges","nmgraphs","nMOPI","nnod","nnods","noden","nopi","nopic","nopicomp","nopis","nopisp","npall","nplistn","nplst","npuass","nqgopt","nrlist","nsym","nucl","nvrt","nvtx","opicomp","opics","opiext","opiloop","opisp","opistk","opistkptr","opit","optn","outag","outgrf","outgrfp","outgrpp","outmg","pdass","permg","pgtypenames","pinp","plistc","plistn","plst","pnclass","prlevel","prmsg","proct0","proct1","prtcl","ptcl","ptypec","ptypen","puass","qgopt","qgref","reord","reordLeg","savc0","savc1","sdeg","sgho","sortb","sorti","sprc","sptbl","subtrSet","tcpl0","tnvl","totalc","vclss","vdeg","vextlp","wAOPI","wgraphs","wMOPI","wopi","wscon","wsopi",            ]        },        {"filename":"sources/grcc.h","words": ["addArtic","adjmat","aelegs","agraph","agrcount","aparticle","argag","argemg","argmg","articuls","awopi","awsum","bicol","bicount","bidef","biinitE","bilow","bipart","bisearchME","blksp","blkstk","blkstkptr","cdeg","cDiag","cgen","chkMomConsv","cldeg","clexl","clmat","clnum","clord","clst","cmaxd","cmaxdeg","cmind","cnlist","cplgcp","cplglg","cplgnvl","cplgvl","csav","ctloop","ctyp","curcl","dega","eblk","eclass","econn","edgen","edtype","egraph","egrph","emom","endmg","esym","extMomConsv","extn","freelg","grccparam.h","iinp","ilst","intrct","klow","lastlg","lastv","lmom","loopm","mgraph","modl","momdir","momset","mopi","multp","mwopi","mwsum","mxdeg","nadj2ptv","nagraphs","nAOPI","nart","narticuls","nartps","nbacked","nblksp","nbridges","nclist","nclss","ncouple","ncplgcp","nctopic","ndcl","ndtp","ndtype","neblocks","neclass","nedg","nelm","nextot","nfin","ngen","ngraphs","nilst","ninitl","nlgs","nlpopic","nmedges","nmgraphs","nMOPI","nnod","nnods","noden","nopi","nopic","nopicomp","nopisp","nplst","npuass","nqgopt","nsym","opicomp","opics","opiext","opiloop","opisp","opistk","opistkptr","optn","outag","outgrf","outgrfp","outgrpp","outmg","pdass","permg","pinp","plst","pnclass","ptcl","puass","qgopt","qgref","reord","reordLeg","sdeg","sprc","sptbl","totalc","wAOPI","wgraphs","wMOPI","wopi","wscon","wsopi",            ]        },        {"filename":"sources/grccparam.h","words": ["agraph","cdeg","cldeg","clnum","cltyp","cmaxd","cmind","coupl","cple","ctyp","defaultv","eind","finaln","initlc","initln","intrct","mgraph","ncouple","ninitl","nplistn","plistc","plistn","ptcl","ptypec","ptypen","sind",            ]        }    ]}

Use the following command to list all words not recognised by cspell:

npx cspell --words-only --exclude extern$(git ls-files)| sort| uniq -c| sort -nr

Clone this wiki locally


[8]ページ先頭

©2009-2025 Movatter.jp