ç§ã¯Zedã¨ããã¨ãã£ã¿ã¼ã§æ®æ®µScalaã®ã³ã¼ããæ¸ãã¦ãã¾ããScalaã®è¨èªãµã¼ãã¨ãã¦ä»£è¡¨çãªãã®ã«Metalsã¨ãããã®ãããã¾ãã
Zedã«ã¯Metalsåãã®æ¡å¼µæ©è½ãããããããå°å ¥ãããã¨ã§Zedã§ãScalaã®ã³ã¼ãæ¯æ´ãåãããã¨ãã§ãã¾ãã
ããããç§ã¯é·ããMetalsãç°å¸¸ã«éãåé¡ã«è¦ããããã¦ãã¾ãããããã§2025å¹´ã®ãæ£æãå©ç¨ãã¦ãã®åå ã調ã¹ã¾ããã
ãã®è¨äºã¯Metalsãç´æ¥ä½¿ã£ã¦ããçãã人åãã®è¨äºã§ããVSCodeã§ã¯ã¾ãéãè¨å®ãããæ°ãããã®ã§åèç¨åº¦ã«ãã¦ãã ãã
Armã¢ã¼ããã¯ãã£ã®Metalsãåãã¦ããã確èªãã
ç§ã¯Appleã®M1ã¨ããCPUã®ãã½ã³ã³ãå©ç¨ãã¦ãã¾ããM1ã¯X86ã§ã¯ãªãArmã¢ã¼ããã¯ãã£ã®CPUã§ãããMacã®å ´åã¯Rossetaã使ããã¨ã§ãX86ã¢ã¼ããã¯ãã£ã®ã½ããã¦ã§ã¢ãåãããã¨ãã§ãã¾ãã
ãã¡ãããArmã¢ã¼ããã¯ãã£ã®ã½ããã¦ã§ã¢ãåãããã»ãããªã¼ãã¼ããããå°ãªãããã©ã¼ãã³ã¹ãåä¸ãã¾ãã
Metalsã®ã¤ã³ã¹ãã¼ã«ã«ãã使ãããCoursierã«ã¯ãArmçãç¨æããã¦ãã¾ãããHomebrewçµç±ã§ã¤ã³ã¹ãã¼ã«ããå ´åã¯ããã©ã«ãã§X86çãã¤ã³ã¹ãã¼ã«ãããã¨ããç½ ãããã¾ãã*1
Metalsãç¾å¨ã©ã®ã¢ã¼ããã¯ãã£ã§åä½ãã¦ãããã¯ps aux | grep metals
ã§è¡¨ç¤ºãããPIDãã¢ã¯ãã£ããã£ã¢ãã¿ã§èª¿ã¹ãã¨ãã«ã種é¡ãã«Intelã¨è¡¨ç¤ºãããå ´åã¯X86ã¢ã¼ããã¯ãã£ã®Rosettaã«ããã¨ãã¥ã¬ã¼ã·ã§ã³ã§èµ·åãã¦ãã¾ãã
ãã®å ´åã¯Armã¢ã¼ããã¯ãã£ã®ãã®ãåã¤ã³ã¹ãã¼ã«ãããã¨ããããããã¾ãã
cs uninstall --all # Coursierã§ã¤ã³ã¹ãã¼ã«ãããããã±ã¼ã¸ããã¹ã¦ã¢ã³ã¤ã³ã¹ãã¼ã«ãã brew uninstall coursier/formulas/coursier # Homebrewããåé¤ # Armçãã¤ã³ã¹ãã¼ã« curl -fL https://github.com/VirtusLab/coursier-m1/releases/latest/download/cs-aarch64-apple-darwin.gz | gzip -d > cs chmod +x cs ./cs setup
Metalsããã«ãçµæã常ã«åå©ç¨ããããè¨å®ãã
Scalaã§ã¯ãã«ããé«éåããããBloopã¨ãããã«ããµã¼ãã使ãããã®ãä¸è¬çãªããã§ãã
Metalsã¯Bloopã«Scalaãã¡ã¤ã«ãã¤ã³ãã¼ãããããã©ãããé¸ã¶ãã¨ãã§ããï¼*2ã®ã§ãããZedã§ã¯ãªããèãããªãã®ã§å¸¸ã«ã¤ã³ãã¼ãããããLSPãè¨å®ãã¾ãã
{ "lsp": { "metals": { "autoImportBuild": "all" } } }
Metals/Bloopã«å²ãå½ã¦ãã¡ã¢ãªã®éãå¢ãã
Metalsã»Bloopã¨ãã«JVMä¸ã§åä½ãã¦ãã¾ããJVMã§ã¯åä½ããã¢ããªã±ã¼ã·ã§ã³ã«å¯¾ãã¦å²ãå½ã¦ãããã¡ã¢ãªéã決ã¾ã£ã¦ããããããè¶ ããå ´åã¯GCãå®è¡ããã¾ãã
ãããã®å²å½éãå¢ãããã¨ã§ãåä½ã®é«éåãæå¾ ã§ãã¾ãã
{ "lsp": { "metals": { "ammoniteJvmProperties": ["-Xmx2G"], "bloopJvmProperties": ["-Xmx2G"] } } }
以ä¸ãèªåãè¡ã£ããMetalsãé«éåããããã®Tipsã§ããä»ã®ãé«éåããããã®ã³ããªã©ããã°æãã¦ããã ããã°å¹¸ãã§ãã
*1:Armã«å¯¾å¿ããPRãåºã¦ãããæ¾ç½®ããã¦ããã
*2:ããã¾ãèªåãããã£ã¦ããªã