ÔÚLinuxÉÏʹÓÃVisual Studio Code¾ÙÐй¤Òµ×Ô¶¯»¯¿ª·¢µÄÍƼöÉèÖÃ
ÔÚlinuxÉÏʹÓÃvisual studio code¾ÙÐй¤Òµ×Ô¶¯»¯¿ª·¢µÄÍƼöÉèÖÃ
СÐò£º
Ëæ׏¤Òµ×Ô¶¯»¯µÄ¿ìËÙÉú³¤£¬Ô½À´Ô½¶àµÄ¿ª·¢Ö°Ô±×îÏȽÓÄÉÏÖ´úµÄ¿ª·¢¹¤¾ßÀ´Ìá¸ßЧÂʺʹúÂëÖÊÁ¿¡£Visual Studio Code£¨ÒÔϼò³ÆVS Code£©×÷Ϊһ¿îÇáÁ¿¼¶¡¢¿çƽ̨µÄ´úÂë±à¼Æ÷£¬Êܵ½ÁËÖڶ࿪·¢Ö°Ô±µÄÇàíù¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxƽ̨ÉÏʹÓÃVS Code¾ÙÐй¤Òµ×Ô¶¯»¯¿ª·¢£¬²¢ÍƼöһЩ±Ø±¸µÄÉèÖÃÏî¡£
Ò»¡¢×°ÖÃVS Code£º
ÔÚLinuxϵͳÉÏ×°ÖÃVS CodeºÜÊǼòÆÓ£¬Ö»ÐèÖ´ÐÐÈçÏÂÏÂÁ
sudo apt update sudo apt install code
µÇ¼ºó¸´ÖÆ
×°ÖÃÍê³Éºó£¬¿ÉÒÔÔÚÓ¦ÓóÌÐò²Ëµ¥ÖÐÕÒµ½VS Code£¬²¢Æô¶¯Ëü¡£
¶þ¡¢×°ÖÃÀ©Õ¹²å¼þ£º
VS CodeÖ§³Öͨ¹ýÀ©Õ¹²å¼þÀ´¸»ºñÆ书Ч¡£ÔÚ¹¤Òµ×Ô¶¯»¯¿ª·¢Àú³ÌÖУ¬ÎÒÃÇ¿ÉÒÔ×°ÖÃһЩ³£ÓõIJå¼þÀ´Ìá¸ß¿ª·¢Ð§ÂÊ¡£ÒÔÏÂÊÇһЩÍƼöµÄ²å¼þ£º
Docker£ºÓÃÓÚÖÎÀíºÍ²Ù×÷ÈÝÆ÷»¯µÄ¹¤Òµ×Ô¶¯»¯Ó¦ÓóÌÐò¡£
Python£ºÊÊÓÃÓÚPythonÓïÑԵĴúÂë±à¼¡¢µ÷ÊÔºÍÌáÐѹ¦Ð§¡£
C/C++£ºÓÃÓÚC/C++ÓïÑԵĴúÂë±à¼ºÍÌáÐѹ¦Ð§¡£
Git£ºÌṩGit°æ±¾¿ØÖƵĹ¦Ð§¡£
ÔÚVS CodeÖÐ×°ÖÃÀ©Õ¹²å¼þºÜÊǼòÆÓ£¬Ö»Ðè°´Ï¿ì½Ý¼ü¡°Ctrl+Shift+X¡±£¬È»ºóËÑË÷²å¼þÃû³Æ£¬²¢µã»÷¡°×°Öá±°´Å¥¼´¿É¡£
Èý¡¢ÉèÖÃÖնˣº
ÎÞÂÛÊǵ÷ÊÔ´úÂ룬ÕÕ¾ÉÖ´ÐÐһЩÏÂÁÎÒÃǶ¼Àë²»¿ªÖնˡ£ÔÚVS CodeÖУ¬ÎÒÃÇ¿ÉÒÔÉèÖü¯³ÉÖնˣ¬Ê¹µÃ¿ª·¢Àú³ÌÔ½·¢Ë³³©¡£ÔÚVS Code²Ëµ¥ÖÐÑ¡Ôñ¡°Éó²é¡±£¬È»ºóµã»÷¡°Öնˡ±¼´¿É·¿ªÖÕ¶ËÃæ°å¡£
ËÄ¡¢ÉèÖôúÂëÃûÌû¯£º
Ò»ÖµĴúÂëÆøÑæÆøÑæÊÇ°ü¹Ü´úÂëÖÊÁ¿µÄÖ÷ÒªÖ¸±êÖ®Ò»¡£ÔÚVS CodeÖУ¬ÎÒÃÇ¿ÉÒÔʹÓá°Prettier¡±²å¼þÀ´×Ô¶¯ÃûÌû¯ÎÒÃǵĴúÂë¡£ÔÚVS Code²Ëµ¥ÖÐÑ¡Ôñ¡°Éó²é¡±£¬È»ºóµã»÷¡°À©Õ¹²å¼þ¡±£¬ËÑË÷²¢×°Öá°Prettier¡±²å¼þ¡£
×°ÖÃÍê³Éºó£¬ÎÒÃÇÐèÒª¾ÙÐÐһЩÉèÖã¬ÒÔʹµÃPrettier²å¼þÄܹ»×Ô¶¯ÃûÌû¯ÎÒÃǵĴúÂë¡£ÔÚVS CodeµÄÓû§ÉèÖÃÖУ¬ÕÒµ½PrettierµÄÉèÖÃÏ²¢¾ÙÐÐÈçÏÂÉèÖãº
{ "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true }
µÇ¼ºó¸´ÖÆ
ÉèÖÃÍê³Éºó£¬Ã¿´ÎÉúÑÄÎļþʱ£¬Prettier¶¼»á×Ô¶¯ÃûÌû¯ÎÒÃǵĴúÂë¡£
Îå¡¢ÉèÖõ÷ÊÔ¹¦Ð§£º
µ÷ÊÔÊÇ¿ª·¢Àú³ÌÖбز»¿ÉÉٵİ취֮һ¡£ÔÚVS CodeÖУ¬ÎÒÃÇ¿ÉÒÔÉèÖõ÷ÊÔ¹¦Ð§ÒÔ±ã¸üºÃµØÆÊÎöºÍÐÞ¸´´úÂëÖеÄÎÊÌâ¡£ÒÔÏÂÊÇһЩ³£¼ûµÄµ÷ÊÔÉèÖÃʾÀý¡£
Pythonµ÷ÊÔ£º
ÔÚVS CodeÖе÷ÊÔPython´úÂëºÜÊÇÀû±ã¡£ÎÒÃÇÖ»Ðè°´Ï¿ì½Ý¼ü¡°Ctrl+Shift+D¡±£¬È»ºóµã»÷µ÷ÊÔÊÓͼµÄ¡°³ÝÂÖ¡±°´Å¥£¬ÔÚµ¯³öµÄ½çÃæÖеã»÷¡°Ìí¼ÓÉèÖá±À´ÉèÖõ÷ÊÔÆ÷¡£ÒÔÏÂÊÇÒ»¸öʾÀýÉèÖÃÎļþ£º
{ "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}" } ] }
µÇ¼ºó¸´ÖÆ
ÉèÖÃÍê³Éºó£¬¿ÉÒÔͨ¹ýÑ¡ÖдúÂëÖеÄij¸ö¶Ïµã£¬²¢°´Ï¿ì½Ý¼ü¡°F5¡±À´Æô¶¯µ÷ÊÔ¡£
C/C++µ÷ÊÔ£º
ÔÚVS CodeÖе÷ÊÔC/C++´úÂëÒ²ºÜÊÇÀû±ã¡£ÎÒÃÇÖ»Ðè°´Ï¿ì½Ý¼ü¡°Ctrl+Shift+D¡±£¬È»ºóµã»÷µ÷ÊÔÊÓͼµÄ¡°³ÝÂÖ¡±°´Å¥£¬ÔÚµ¯³öµÄ½çÃæÖеã»÷¡°Ìí¼ÓÉèÖá±À´ÉèÖõ÷ÊÔÆ÷¡£ÒÔÏÂÊÇÒ»¸öʾÀýÉèÖÃÎļþ£º
{ "version": "0.2.0", "configurations": [ { "name": "C++ Launch", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/a.out", "args": [], "stopAtEntry": true, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "/usr/bin/gdb" } ] }
µÇ¼ºó¸´ÖÆ
ÉèÖÃÍê³Éºó£¬¿ÉÒÔͨ¹ýÑ¡ÖдúÂëÖеÄij¸ö¶Ïµã£¬²¢°´Ï¿ì½Ý¼ü¡°F5¡±À´Æô¶¯µ÷ÊÔ¡£
½áÓ
ͨ¹ýÉÏÊöµÄÉèÖã¬ÎÒÃÇ¿ÉÒÔÔÚLinuxƽ̨ÉÏʹÓÃVS Code¾ÙÐй¤Òµ×Ô¶¯»¯¿ª·¢£¬²¢Ìá¸ß¿ª·¢Ð§ÂʺʹúÂëÖÊÁ¿¡£ËäÈ»£¬ÒÔÉÏÖ»ÊÇһЩ»ù±¾µÄÉèÖÃÏËæ׏¤Òµ×Ô¶¯»¯ÐÐÒµµÄÒ»Ö±Éú³¤£¬ÎÒÃÇ»¹¿ÉÒÔƾ֤ÏÖʵÐèÇó¾ÙÐÐÔ½·¢¸öÐÔ»¯µÄÉèÖá£Ï£ÍûÕâƪÎÄÕ¶ÔÄúµÄ¹¤Òµ×Ô¶¯»¯¿ª·¢Ö®Â·ÓÐËù×ÊÖú£¡
ÒÔÉϾÍÊÇÔÚLinuxÉÏʹÓÃVisual Studio Code¾ÙÐй¤Òµ×Ô¶¯»¯¿ª·¢µÄÍƼöÉèÖõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡