ã®è¨äºãè¦ã¦ã確ãã«ããã©ãããã¨æã£ãã
ãã ãã®è¨äºã¯IntelliJã®è¨äºã ã£ããç§ã¯Visual Studio Code (VSCode) ã使ã£ã¦ããã®ã§èª¿ã¹ã¦å¯¾å¿ããã
Visual Studio Code (VSCode) 㧠èªåè£å®ãããããã«ããããã«ã¯ 対å¿ããã¦ã¼ã¶ã¼ã¹ãããããå©ç¨ãã¾ã
ã³ãã³ããã¬ãããéã:
VSCode ä¸ã§ Ctrl+Shift+P (Windows/Linux) ã¾ã㯠Cmd+Shift+P (Mac) ãæ¼ãã¦ãã³ãã³ããã¬ãããéãã¾ãã
ã¦ã¼ã¶ã¼ã¹ãããããæ¤ç´¢:
ã³ãã³ããã¬ããã« ãConfigure User Snippetsã ã¨å ¥åãã表示ããããªãã·ã§ã³ãããããé¸æãã¾ãã
è¨èªã®é¸æ:
ãã®å ´å㯠javascript ã¾ã㯠javascriptreactï¼ãã React ã使ç¨ãã¦ããå ´åï¼ã®ãããããã¾ãã¯ä¸¡æ¹ã§ã¹ãããããå©ç¨ãããå ´åãããããã®è¨èªã®ã¹ãããããã¡ã¤ã«ãé¸æãã¾ãã
ã¹ããããã®è¿½å (ä¾1):
ã¹ãããããã¡ã¤ã«ãéãããã以ä¸ã®ã¹ããããããã¡ã¤ã«ã«è¿½å ãã¾ãã
"Rocket Log": { "prefix": "log", "body": [ "console.log(\"ð====${TM_FILENAME}: L: ${TM_LINE_NUMBER} ====ð\");", "console.log(\"$1: \", $1);" ], "description": "Log output to console with filename and line number" }
ãã®å®ç¾©ã§ã¯ãlog
ã¨å
¥åãã¦å±éãããã¨ã§ãæåã®è¡ã«ã¯ãã¡ã¤ã«åã¨è¡çªå·ãå«ããã±ãããã¼ã¯ã®ãã³ã¬ã¼ã·ã§ã³ãã次ã®è¡ã«ã¯å¤æ°ã®ãã°åºåãæ¿å
¥ããã¾ãã$1
ã¯
ã«ã¼ã½ã«ãæåã«ç½®ãããä½ç½®ã§ãããã«å¤æ°åãå
¥åããã¨ããã®å¤æ°ã®å
容ããã°ã«åºåãããããã«ãªãã¾ãã
è£è¶³ï¼ VSCode ã®ã¹ããããã§ã¯ããã¡ã¤ã«åã ${TM_FILENAME}ãè¡çªå·ã ${TM_LINE_NUMBER} ã¨ããå½¢ã§ã
ã¹ããããã®è¿½å (ä¾2):
ã¹ãããããã¡ã¤ã«ãéãããã以ä¸ã®ã¹ããããããã¡ã¤ã«ã«è¿½å ãã¾ãããã®ã¹ããããå®ç¾©ã§ã¯ãcons ã¨å ¥åãããã¨ã§ console.log("$VARIABLES$: ", $VARIABLES$) ãæ¿å ¥ããããã«è¨å®ãã¦ãã¾ãã
"Print to console": { "prefix": "cons", "body": [ "console.log(\"$1: \", $1);" ], "description": "Log output to console" }
ãã®ã¹ããããã§ã¯ã$1 ã¯ã«ã¼ã½ã«ã移åããä½ç½®ã示ãã¦ãããcons ã¨æã£ãå¾ã«ã¹ãããããå±éãããã¨ãèªåçã«æåã®å¤æ°ã®ä½ç½®ã«ã«ã¼ã½ã«ã移åãã¾ããå¤æ°åãå ¥åããå¾ã« Tab ãã¼ãæ¼ãã¨ãåãå¤æ°åã $VARIABLES$ ã®ä½ç½®ã«ãæ¿å ¥ããã¾ãã
ä¿åãã¦çµäº:
ã¹ããããã追å ãããããã¡ã¤ã«ãä¿åãã¦éãã¾ãã
ããã§è¨å®ã¯å®äºã§ããlogãcons ã¨å ¥åã㦠Tab ãã¼ãæ¼ããã¨ã§ãå®ç¾©ããã¹ãããããå±éãããããã«ãªãã¾ãããããã¹ãããããæå¾ éãã«åä½ããªãå ´åã¯ãVSCode ãåèµ·åãã¦ãã ããã