lean4monaco 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -123,11 +123,7 @@ export class LeanMonaco {
123
123
  // Load fonts
124
124
  const fontFiles = [
125
125
  new FontFace("JuliaMono", `url(${new URL("./fonts/JuliaMono-Regular.ttf", import.meta.url)})`),
126
- new FontFace("Noto Color Emoji", `url(${new URL("./fonts/NotoColorEmoji-Regular.ttf", import.meta.url)})`),
127
- // new FontFace(
128
- // "LeanWeb",
129
- // `url(${new URL("./fonts/LeanWeb-Regular.otf", import.meta.url)})`,
130
- // )
126
+ new FontFace("Noto Color Emoji", `url(${new URL("./fonts/NotoColorEmoji-Subset.ttf", import.meta.url)})`),
131
127
  ];
132
128
  fontFiles.map(font => {
133
129
  document.fonts.add(font);
@@ -153,7 +149,7 @@ export class LeanMonaco {
153
149
  "editor.acceptSuggestionOnEnter": "off", // since there are plenty suggestions
154
150
  // other options
155
151
  "editor.renderWhitespace": "trailing",
156
- "editor.fontFamily": "'JuliaMono', 'Noto Color Emoji'",
152
+ "editor.fontFamily": "'Noto Color Emoji', 'JuliaMono'",
157
153
  "editor.wordWrap": "on",
158
154
  "editor.wrappingStrategy": "advanced",
159
155
  "workbench.colorTheme": "Visual Studio Light",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lean4monaco",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Monaco Editor support for the Lean 4 theorem prover.",
5
5
  "keywords": [
6
6
  "lean",
@@ -42,7 +42,8 @@
42
42
  "test:bare": "wait-on http://localhost:5173 && cypress run",
43
43
  "test": "npm run demo:setup && concurrently --hide 0 --kill-others \"npm start\" \"npm run test:bare\" -n server,cypress -s command-cypress",
44
44
  "test:windows:bare": "wait-on http://localhost:5173 && CYPRESS_USER_AGENT_OS=\"Windows NT 10.0; Win64; x64\" cypress run --browser chromium",
45
- "test:windows": "npm run demo:setup && concurrently --hide 0 --kill-others \"npm start\" \"npm run test:windows:bare\" -n server,cypress -s command-cypress"
45
+ "test:windows": "npm run demo:setup && concurrently --hide 0 --kill-others \"npm start\" \"npm run test:windows:bare\" -n server,cypress -s command-cypress",
46
+ "font:subset": "source scripts/.python/bin/activate && scripts/subset-font.sh"
46
47
  },
47
48
  "dependencies": {
48
49
  "@leanprover/infoview": "~0.8.5",
@@ -1,94 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
5
- <g>
6
- <g>
7
- <g>
8
- <path style="fill:#FFC107;" d="M7.45,123.27c2.27,2.46,11.62-1.83,19-5.27c5.53-2.57,27.66-11.65,38.66-16.36
9
- c2.97-1.27,7.29-2.93,10.4-7.02c2.76-3.64,10.08-19.1-4.66-34.76c-14.96-15.9-30.37-11.51-36.13-7.43
10
- c-3.39,2.4-6.15,7.81-7.39,10.56c-5.24,11.62-12.71,32.91-15.75,41.28C9.35,110.44,5.2,120.83,7.45,123.27z"/>
11
- <path style="fill:#FF8F00;" d="M25.85,66.49c0.14,1.74,0.49,4.57,1.69,10.02c0.82,3.74,2.16,7.66,3.25,10.25
12
- c3.27,7.79,7.86,10.93,12.51,13.45c7.9,4.28,13.27,5.08,13.27,5.08l-6.44,2.63c0,0-3.9-0.81-9.22-3.43
13
- c-5.07-2.5-10.35-6.73-14.21-15.01c-1.67-3.59-2.64-7.07-3.2-9.83c-0.69-3.42-0.8-5.36-0.8-5.36L25.85,66.49z"/>
14
- <path style="fill:#FF8F00;" d="M17.94,86.77c0,0,0.8,6.49,6.16,14.68c6.28,9.58,15.05,11.15,15.05,11.15l-5.83,2.4
15
- c0,0-6.51-1.99-12.7-10.44c-3.86-5.27-4.94-11.57-4.94-11.57L17.94,86.77z"/>
16
- <path style="fill:#FF8F00;" d="M12.39,102.15c0,0,1.46,5.6,4.66,9.78c3.81,4.99,8.66,6.44,8.66,6.44l-4.47,1.98
17
- c0,0-3.39-0.71-7.1-5.41c-2.82-3.57-3.62-7.67-3.62-7.67L12.39,102.15z"/>
18
- <g style="opacity:0.44;">
19
- <path style="fill:#FFFDE7;" d="M9.96,116.37L9.96,116.37c-0.2-0.45-0.2-0.96,0.01-1.4l25.47-52.82l4.19,15.75l-26.8,38.71
20
- C12.11,117.69,10.49,117.55,9.96,116.37z"/>
21
- </g>
22
- <linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="74.3843" y1="61.8385" x2="44.617" y2="79.6989">
23
- <stop offset="0.0235" style="stop-color:#8F4700"/>
24
- <stop offset="1" style="stop-color:#703E2D"/>
25
- </linearGradient>
26
- <path style="fill:url(#SVGID_1_);" d="M41.65,83.19c11.9,13.92,25.45,12.18,29.96,8.66c4.52-3.53,8.09-15.66-3.76-29.35
27
- c-12.42-14.34-26.48-10.25-29.73-7.15S30.73,70.42,41.65,83.19z"/>
28
- <g>
29
- <path style="fill:#03A9F4;" d="M82.52,88.92c-4.34-3.64-6.65-2.99-9.75-1.7c-4,1.66-10.29,2.89-18.83,0l2.57-6.19
30
- c5.07,1.71,8.74,0.88,11.91-0.99c4.08-2.4,9.66-5.69,18.34,1.6c3.62,3.04,7.33,5.06,10.05,4.14c1.98-0.66,3.03-3.61,3.56-5.96
31
- c0.05-0.21,0.13-0.81,0.19-1.34c0.48-3.67,1.28-11.59,7.18-15.64c6.31-4.33,12.94-4.33,12.94-4.33l1.2,11.92
32
- c-3.05-0.45-5.17,0.17-6.96,1.16c-6.74,3.75-0.87,18.15-11.36,22.99C93.47,99.27,85.22,91.18,82.52,88.92z"/>
33
- </g>
34
- <g>
35
- <path style="fill:#F44336;" d="M45.4,73.72l-4.34-3.89c7.97-8.9,5.87-15.44,4.34-20.2c-0.31-0.96-0.6-1.87-0.79-2.74
36
- c-0.68-3.08-0.82-5.76-0.61-8.1c-3.06-3.81-4.41-7.8-4.5-8.07c-1.86-5.63-0.46-11.12,2.75-16.27C48.74,4,60.49,4,60.49,4
37
- l3.92,10.49c-2.98-0.12-12.75,0.03-15.75,4.76c-3.79,5.96-1.3,9.64-1.12,10.06c0.73-0.95,1.47-1.71,2.13-2.3
38
- c4.79-4.25,8.95-4.86,11.6-4.62c2.98,0.27,5.68,1.77,7.61,4.23c2.11,2.7,2.98,6.21,2.31,9.4c-0.65,3.11-2.72,5.74-5.83,7.41
39
- c-5.43,2.92-9.95,2.52-12.98,1.51c0.02,0.07,0.03,0.15,0.05,0.22c0.11,0.5,0.33,1.2,0.59,2.01
40
- C54.79,52.65,58.08,61.35,45.4,73.72z M52.75,36.19c0.58,0.42,1.19,0.77,1.82,1.02c2.1,0.84,4.39,0.56,6.99-0.84
41
- c1.53-0.82,1.71-1.7,1.77-1.99c0.18-0.87-0.12-1.98-0.77-2.81c-0.57-0.73-1.23-1.11-2.02-1.19c-1.5-0.13-3.53,0.82-5.56,2.63
42
- C54.01,33.88,53.27,34.95,52.75,36.19z"/>
43
- </g>
44
- <g>
45
- <path style="fill:#F48FB1;" d="M62.77,75.35l-6.21-0.17c0,0,2.95-16.66,12.5-19.46c1.79-0.52,3.75-1.05,5.72-1.34
46
- c1.17-0.18,3.02-0.45,3.93-0.79c0.21-1.57-0.45-3.57-1.19-5.84c-0.58-1.76-1.18-3.57-1.5-5.55c-0.62-3.86,0.41-7.27,2.9-9.62
47
- c3.04-2.85,7.95-3.76,13.49-2.5c3.16,0.72,5.49,2.27,7.54,3.63c2.93,1.95,4.64,2.94,8.22,0.53c4.33-2.92-1.33-14.35-4.34-20.95
48
- l11.23-4.68c1.51,3.3,8.8,20.28,3.99,29.97c-1.62,3.26-4.41,5.42-8.07,6.23c-7.96,1.78-12.62-1.32-16.02-3.58
49
- c-1.61-1.07-3.02-1.91-4.55-2.35c-10.63-3.03,4.21,12.61-2.74,19.64c-4.17,4.21-14.36,5.32-15.02,5.48
50
- C66.09,65.58,62.77,75.35,62.77,75.35z"/>
51
- </g>
52
- </g>
53
- <path style="fill:#C92B27;" d="M43.99,38.79c-0.19,2.2-0.28,3.51,0.29,6.37c2.75,2.02,8.74,2.02,8.74,2.02
54
- c-0.26-0.81-0.49-1.51-0.59-2.01c-0.02-0.07-0.03-0.15-0.05-0.22C46.29,41.91,43.99,38.79,43.99,38.79z"/>
55
- </g>
56
- <g>
57
- <polygon style="fill:#FFC107;" points="31.53,48.64 21.19,43.57 26.34,36.13 34.45,41.5 "/>
58
- </g>
59
- <g>
60
- <path style="fill:#FB8C00;" d="M16.29,34.6c-5.28-0.71-10.66-5.19-11.25-5.7l5.19-6.09c1.57,1.33,4.9,3.56,7.13,3.86L16.29,34.6z"
61
- />
62
- </g>
63
- <g>
64
- <path style="fill:#03A9F4;" d="M25.61,21.27l-7.6-2.49c0.87-2.66,1.1-5.53,0.65-8.3l7.9-1.27C27.21,13.23,26.88,17.4,25.61,21.27z
65
- "/>
66
- </g>
67
- <g>
68
-
69
- <rect x="74.11" y="14.35" transform="matrix(0.9769 -0.2137 0.2137 0.9769 -2.3917 17.1437)" style="fill:#FB8C00;" width="8" height="10.56"/>
70
- </g>
71
- <g>
72
- <path style="fill:#FFC107;" d="M92.46,17.77l-5.5-5.81c2.88-2.73,3.54-6.3,3.54-6.34l7.9,1.29C98.3,7.54,97.29,13.2,92.46,17.77z"
73
- />
74
- </g>
75
- <g>
76
-
77
- <rect x="96.54" y="47.3" transform="matrix(0.9545 -0.2983 0.2983 0.9545 -10.7408 32.2313)" style="fill:#FB8C00;" width="7.32" height="8"/>
78
- </g>
79
- <g>
80
- <path style="fill:#F44336;" d="M97.55,113.03l-7.95-0.94c0.34-2.83-1.77-6.3-2.35-7.07l6.4-4.8
81
- C94.13,100.85,98.3,106.62,97.55,113.03z"/>
82
- </g>
83
- <g>
84
- <path style="fill:#FB8C00;" d="M120.37,102.89c-2.99-0.45-6.05-0.63-9.07-0.52l-0.27-8c3.51-0.12,7.06,0.08,10.53,0.61
85
- L120.37,102.89z"/>
86
- </g>
87
- <g>
88
-
89
- <rect x="112.29" y="109.43" transform="matrix(0.7026 -0.7116 0.7116 0.7026 -47.1516 116.922)" style="fill:#F48FB1;" width="8" height="10.87"/>
90
- </g>
91
-
92
- <rect x="88.29" y="65.14" transform="matrix(0.6583 0.7527 -0.7527 0.6583 84.0086 -46.0064)" style="fill:#F44336;" width="8.78" height="8.78"/>
93
- </g>
94
- </svg>
@@ -1,63 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="レイヤー_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
4
- y="0px" viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
5
- <g>
6
- <g>
7
- <path style="fill:#F45125;" d="M110.28,61.32l2.63,8.84c0,0,7.24-1.6,7.62,3.2c0.38,4.8-6.77,8-6.77,8l2.26,10.63
8
- c0,0,7.9-6.4,8-15.61c0,0,0.66-11.29-6.11-13.92C113.67,60.85,110.28,61.32,110.28,61.32z"/>
9
- <path style="fill:#F45125;" d="M68.71,94.99c0,0-11.1-4.7-16.46,1.98c-0.75,0.94-1.41,1.88-2.16,2.82
10
- c-0.56,0.75-1.13,1.5-1.69,2.16c-0.47,0.56-1.03,1.13-1.69,1.5c-0.66,0.38-1.32,0.66-2.07,0.85c-0.94,0.19-1.88,0.19-2.82,0.09
11
- c-1.32-0.09-2.63-0.38-3.95-0.66c-0.47-0.09-0.85-0.19-1.22-0.28c-0.09,0-0.19-0.09-0.28-0.09s-0.19-0.09-0.28-0.09
12
- c-0.38,0.09,0.19,0.75,0.38,0.94c0.28,0.28,0.56,0.66,0.85,0.94c0.85,0.75,1.69,1.5,2.73,1.98c1.32,0.66,2.73,1.03,4.14,1.13
13
- c0.09,0,0.38,0,0.47,0.09c0.19,0.19-0.28,0.47-0.47,0.56c-0.28,0.19-0.47,0.28-0.75,0.38c-0.85,0.38-1.79,0.56-2.63,0.75
14
- c-0.85,0.19-1.69,0.28-2.45,0.28c-0.47,0-0.85,0.09-1.22,0.09c-0.28,0-0.56-0.09-0.85,0s0.09,0.47,0.28,0.56
15
- c0.38,0.19,0.75,0.47,1.13,0.66c1.13,0.56,2.26,1.03,3.39,1.32c1.5,0.38,3.1,0.56,4.61,0.38c1.32-0.19,2.63-0.56,3.86-1.03
16
- c6.77-3.1,6.21-9.59,12.42-10.16c4.61-0.38,11.1,2.07,11.1,2.07L68.71,94.99z"/>
17
- <path style="fill:#F45125;" d="M19.79,38.28c0,0-12.13,1.98-15.24,12.79C0.61,64.9,20.26,69.5,20.26,69.5l1.22-9.41
18
- c0,0-13.07-1.32-12.32-6.3c0.94-6.21,11.85-5.64,11.85-5.64L19.79,38.28z"/>
19
- <path style="fill:#F45125;" d="M20.73,70.92c0,0-1.88,0.56-4.61,2.54c-1.88,1.32-4.42,3.01-6.87,5.93
20
- c-1.22,1.41-2.16,3.1-2.82,4.89c-0.47,1.22-0.66,2.45-0.66,3.76c0,0.28,0,0.56,0,0.85c0,0.09,0,0.85,0.28,0.66
21
- c0.09-0.09,0.19-0.38,0.28-0.47c0.19-0.47,0.47-0.85,0.75-1.22c0.85-1.13,1.88-2.16,3.01-3.01c0.38-0.28,0.75-0.47,1.13-0.66
22
- c0.28-0.28,0.75-0.66,0.94-0.28c0.09,0.19-0.09,0.47-0.19,0.66c-0.09,0.28-0.19,0.66-0.19,0.94c-0.38,1.5-0.56,3.01-0.75,4.51
23
- c-0.09,0.85-0.09,1.69,0,2.45c0,0.38,0.09,0.85,0.09,1.22c0,0.19,0.09,0.38,0.09,0.56c0,0.19,0.19,0.47,0.38,0.19
24
- c0.09-0.09,0.09-0.19,0.19-0.38c0.19-0.28,0.28-0.66,0.47-0.94c0.47-0.85,0.94-1.69,1.5-2.63c0.66-1.13,1.41-2.16,2.16-3.1
25
- c0.85-1.13,1.88-2.26,2.92-3.2c1.13-1.03,2.35-2.07,3.67-2.92c0.75-0.47,1.6-0.94,2.45-1.32L20.73,70.92z"/>
26
- <g>
27
- <path style="fill:#FCC21B;" d="M116.4,79.29c-1.13-5.55-2.73-11.01-4.51-16.46c-1.5-4.61-3.1-9.31-5.83-13.36
28
- c-1.22-1.79-3.01-3.01-5.27-3.86c-4.33-1.69-9.97-1.98-13.73-1.98c-5.64,0-11.48,1.22-16.74,3.67
29
- c-1.88,5.64-7.05,19.94-14.86,26.34c0.47,2.63,1.03,5.36,1.79,8c1.32,4.61,3.01,9.22,4.61,13.83c1.5,4.42,3.29,8.84,6.58,12.23
30
- c0.85,0.94,1.88,1.69,2.82,2.45c2.26,1.88,4.99,3.01,7.71,3.95c2.54,0.85,5.17,1.5,7.81,2.07c4.7,1.03,11.48,2.82,16.08,0.66
31
- c2.54-1.13,4.61-2.92,6.3-5.08c1.79-2.26,3.2-4.8,4.42-7.43c1.88-3.95,3.86-8.37,4.14-12.89
32
- C117.99,87.38,117.24,83.24,116.4,79.29z"/>
33
- <path style="fill:#429ADF;" d="M77.64,33.57c-0.28-1.03-1.03-2.07-1.6-3.01c-6.3-11.01-20.04-16.27-32.26-15.52
34
- c-3.76,0.28-9.31,0.85-13.54,2.73c-2.07,0.94-3.86,2.35-4.99,4.14c-2.54,4.23-3.76,8.94-5.08,13.64
35
- C18.67,41,17.35,46.55,16.5,52.2c-0.75,4.89-1.41,10.25-0.09,15.14c1.03,3.86,3.29,9.22,5.74,12.32
36
- c2.73,3.39,6.58,7.34,10.72,8.84c0.75,0.28,1.6,0.47,2.45,0.66c1.6,0.28,3.29,0.47,4.89,0.19c0.94-0.19,1.98-0.28,2.92-0.56
37
- c1.88-0.47,3.67-1.13,5.46-1.79c7.52-3.01,13.64-7.43,17.68-14.58c1.69-3.1,3.1-6.4,4.42-9.69c0.09-0.19,0.19-0.38,0.19-0.56
38
- c1.98-5.46,3.29-11.19,4.61-16.84c0.66-2.73,1.41-5.55,1.79-8.37C77.55,35.92,77.92,34.7,77.64,33.57z"/>
39
- </g>
40
- </g>
41
- <path style="fill:#193D51;" d="M23.09,40.53c1.69-3.1,5.74-5.55,9.31-5.08c0.56,0.09,1.22,0.19,1.79,0.47
42
- c3.57,1.5,5.74,4.99,4.89,8.56c-0.19,0.75-0.66,0.85-1.22,0.38c-1.98-1.69-3.57-3.01-6.21-3.67c-2.16-0.56-4.61-0.28-6.68,0.28
43
- c-0.47,0.09-1.22,0.56-1.69,0.38C22.61,41.57,22.9,40.91,23.09,40.53z"/>
44
- <path style="fill:#193D51;" d="M62.21,64.9c-1.03,1.6-2.45,3.01-3.86,4.33c-0.38,0.28-0.66,0.66-1.03,0.94
45
- c-5.64,4.7-13.26,7.05-20.51,5.27c-1.98-0.47-4.14-1.5-5.74-2.73c-1.22-0.94-2.45-2.16-3.48-3.39c-1.88-2.26-3.29-4.89-4.23-7.62
46
- c-0.47-1.41-0.75-2.73-0.94-4.23c0-0.47-0.66-5.46,0.85-4.8c0.38,0.19,0.66,0.47,0.94,0.75c0.28,0.38,0.47,0.75,0.75,1.03
47
- c0.66,0.85,1.32,1.69,2.07,2.45c2.35,2.73,5.27,4.89,8.56,6.4c2.26,1.03,4.7,1.6,7.15,1.79c1.41,0.09,2.73,0.19,4.14,0.09
48
- c5.08-0.28,10.25-1.79,14.86-3.76c0.38-0.19,0.85-0.47,1.32-0.47C64.66,61.04,62.5,64.52,62.21,64.9z"/>
49
- <path style="fill:#193D51;" d="M67.58,51.16c0,0.47-0.19,1.13-0.75,1.03c-0.47-0.09-0.85-0.94-1.13-1.22
50
- c-1.32-1.69-3.86-3.57-6.4-4.14c-3.01-0.75-5.27,0.56-8.28,0.85c-0.85,0.09-1.32-0.28-0.94-1.03c1.6-3.48,5.83-6.21,10.25-5.46
51
- c0.75,0.09,1.41,0.28,2.07,0.56C66.26,43.36,67.86,47.59,67.58,51.16z"/>
52
- <path style="fill:#9B7515;" d="M91.84,63.86c4.23,2.73,9.69,3.48,14.58,3.2c1.41-0.09,2.26,0.09,1.88,1.69
53
- c-0.75,3.29-3.86,5.17-6.87,5.83c-0.75,0.19-1.5,0.19-2.26,0.19c-1.41-0.09-2.82-0.66-4.04-1.5c-2.63-1.79-4.61-4.89-5.17-8
54
- C89.68,63.67,90.25,62.83,91.84,63.86z"/>
55
- <path style="fill:#9B7515;" d="M65.22,80.79C64,79.57,64.66,79,65.98,78.25c4.51-2.35,9.03-5.93,11.38-10.63
56
- c0.85-1.79,1.79-1.41,2.45,0.28c1.13,3.1,1.03,6.87-0.38,9.88c-0.66,1.41-1.6,2.63-2.82,3.57c-0.66,0.47-1.32,0.75-2.07,1.03
57
- C71.43,83.33,67.58,83.24,65.22,80.79z"/>
58
- <path style="fill:#9B7515;" d="M110,96.41c-0.38,0-0.94-0.38-1.41-0.66c-0.47-0.28-0.94-0.66-1.22-0.85
59
- c-1.13-0.56-2.45-1.13-3.67-1.5c-3.76-1.22-7.9-1.22-11.57,0c-2.63,0.85-5.17,2.45-7.24,4.33c-2.26,2.16-3.95,4.8-6.11,7.05
60
- c-0.28,0.28-0.56,0.56-0.85,0.75c-0.56,0.28-1.13-0.09-1.32-0.66c-0.94-3.95,1.69-9.5,3.67-12.89c2.26-3.76,5.55-6.77,9.78-8
61
- c2.07-0.66,4.33-0.66,6.49-0.38c6.3,0.94,12.79,5.93,14.02,11.66C110.56,95.75,110.47,96.5,110,96.41z"/>
62
- </g>
63
- </svg>
@@ -1,17 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 24.1.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
5
- <g>
6
- <polygon style="fill:#FFA000;stroke:#F44336;stroke-width:3;stroke-miterlimit:10;" points="68.27,8.51 84.11,41.67 119.44,9.79
7
- 101.38,55.43 121.05,50.12 102.4,76.63 119.43,82.5 102.03,90.77 118.96,119.8 86.77,99.89 79.87,121.43 69.65,98.4 40.65,120.18
8
- 49.47,95.33 9.5,103.37 39.42,81.1 7.89,58.4 43.85,61.51 10.6,10.52 64,45.51 "/>
9
- <radialGradient id="SVGID_1_" cx="77.5873" cy="75.7353" r="26.3653" gradientUnits="userSpaceOnUse">
10
- <stop offset="0" style="stop-color:#FFFDE7"/>
11
- <stop offset="1" style="stop-color:#FFF176"/>
12
- </radialGradient>
13
- <polygon style="fill:url(#SVGID_1_);stroke:#FFEB3B;stroke-width:2;stroke-miterlimit:10;" points="72.63,34.77 82.17,59.48
14
- 101.05,38.17 86.86,67.91 104.07,62.74 88.12,78.59 101.48,82.98 88.68,84.87 98.87,99.31 82.31,88.73 78.5,101.05 72.63,86.96
15
- 57.98,98.12 64,84.45 41,89.47 57.95,79.19 35.84,68.56 60.33,70.84 40.22,39.29 71.1,60.17 "/>
16
- </g>
17
- </svg>
@@ -1,17 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
5
- <g>
6
- <path style="fill:#689F38;" d="M116.46,3.96h-104c-4.42,0-8,3.58-8,8v104c0,4.42,3.58,8,8,8h104c4.42,0,8-3.58,8-8v-104
7
- C124.46,7.54,120.88,3.96,116.46,3.96z"/>
8
- <path style="fill:#7CB342;" d="M110.16,3.96h-98.2c-4.13,0.03-7.47,3.37-7.5,7.5v97.9c-0.01,4.14,3.34,7.49,7.48,7.5
9
- c0.01,0,0.01,0,0.02,0h98.1c4.14,0.01,7.49-3.34,7.5-7.48c0-0.01,0-0.01,0-0.02v-97.9c0.09-4.05-3.13-7.41-7.18-7.5
10
- C110.31,3.96,110.23,3.96,110.16,3.96z"/>
11
- <path style="opacity:0.3;fill:#FFFFFF;enable-background:new ;" d="M40.16,12.86c0-2.3-1.6-3-10.8-2.7c-7.7,0.3-11.5,1.2-13.8,4
12
- s-2.9,8.5-3,15.3c0,4.8,0,9.3,2.5,9.3c3.4,0,3.4-7.9,6.2-12.3C26.66,17.76,40.16,15.86,40.16,12.86z"/>
13
- <path style="fill:#FBF9F9;" d="M43.26,109.46c-3.96,0.11-7.51-2.42-8.7-6.2l-15.1-45.5c-1.46-4.81,1.26-9.9,6.07-11.36
14
- c4.65-1.41,9.59,1.08,11.23,5.66l9.8,29.5l47.1-59.6c3.12-3.95,8.85-4.62,12.8-1.5s4.62,8.85,1.5,12.8l-57.6,72.7
15
- C48.65,108.15,46.04,109.44,43.26,109.46z"/>
16
- </g>
17
- </svg>
@@ -1,26 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 25.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve">
5
- <path style="fill:#CC3333;" d="M58.9,78.6l-41.3,41.9c-1.5,1.5-3.2,2.5-5,3c4.1,1.2,8.6,0.2,11.8-3l38.2-38.1c0.8-0.8,2.1-0.8,2.8,0
6
- l0,0l-3.7-3.8C61,77.8,59.7,77.8,58.9,78.6z"/>
7
- <path style="fill:#CC3333;" d="M82.3,65.4c-0.8-0.8-0.8-2,0-2.8l38.2-38.1c4.7-4.7,4.7-12.3,0-17s-12.2-4.7-16.9,0L65.4,45.6
8
- c-0.8,0.8-2,0.8-2.8,0L24.5,7.5c-4.7-4.7-12.3-4.7-17,0c-0.4,0.4-0.7,0.8-1,1.2C6.7,8.4,6.9,8.2,7.1,8c4.7-4.6,10.1-2.5,14.8,2.2
9
- l37.6,38.5c0.8,0.8,2,0.8,2.8,0l39.3-39.2c4.7-4.7,9.4-5.1,14.1-0.4s3.9,9.6-0.8,14.3L75.6,62.6c-0.8,0.8-0.8,2,0,2.8
10
- c0,0,38.1,38.2,38,38.2c4.7,4.7,6.5,10,1.8,14.7s-10.6,3.5-15.3-1.1l3.4,3.4c4.7,4.7,12.3,4.7,17,0s4.7-12.2,0-16.9
11
- C120.5,103.6,82.3,65.4,82.3,65.4z"/>
12
- <path style="fill:#F44336;" d="M115.4,118.3c4.7-4.7,2.9-10-1.8-14.7c0.1,0-38-38.2-38-38.2c-0.8-0.8-0.8-2,0-2.8l39.3-39.2
13
- c4.7-4.7,5.5-9.6,0.8-14.3s-9.4-4.3-14.1,0.4L62.3,48.7c-0.8,0.8-2,0.8-2.8,0L21.9,10.2C17.2,5.5,11.8,3.4,7.1,8
14
- C6.9,8.2,6.7,8.4,6.5,8.7c-3.7,4.7-3.3,11.4,1,15.7l38.1,38.2c0.8,0.8,0.8,2.1,0,2.8L7.5,103.5c-4.7,4.7-4.7,12.3,0,17
15
- c1.5,1.5,3.2,2.5,5,3c1.8-0.6,3.6-1.6,5-3l41.3-41.9c0.8-0.8,2.1-0.8,2.8,0l3.7,3.8l34.7,34.8C104.8,121.8,110.7,123,115.4,118.3z"
16
- />
17
- <g>
18
- <path style="opacity:0.2;fill:#FFFFFF;enable-background:new ;" d="M55,56.4c-1.1-1.6-32.3-33.1-32.3-33.1s-2.3-2.6-4.7-0.8
19
- c-2.2,1.7-1.1,4.3,0.1,5.6s29,29.7,30.4,30.9c1.3,1.2,3.9,1.4,5.5,0.6S55.8,57.5,55,56.4z"/>
20
- <circle style="opacity:0.2;fill:#FFFFFF;enable-background:new ;" cx="12.2" cy="19" r="3.3"/>
21
- </g>
22
- <g>
23
- <path style="opacity:0.2;fill:#FFFFFF;enable-background:new ;" d="M72.1,81.8c1.1,1.6,32.8,32.6,32.8,32.6s2.3,2.6,4.7,0.7
24
- c2.2-1.7,1-4.3-0.2-5.6C108.2,108.2,80,80.2,78.6,79c-1.3-1.2-3.9-1.3-5.5-0.5S71.3,80.7,72.1,81.8z"/>
25
- </g>
26
- </svg>
Binary file
@@ -1,4 +0,0 @@
1
- import { OutputChannel } from "vscode";
2
- import { ExtUri } from "./vscode-lean4/vscode-lean4/src/utils/exturi";
3
- import { PreconditionCheckResult } from "./vscode-lean4/vscode-lean4/src/diagnostics/setupNotifs";
4
- export declare function checkLean4ProjectPreconditions(channel: OutputChannel, folderUri: ExtUri): Promise<PreconditionCheckResult>;
@@ -1,3 +0,0 @@
1
- export async function checkLean4ProjectPreconditions(channel, folderUri) {
2
- return 'Fulfilled';
3
- }
@@ -1,81 +0,0 @@
1
- import { Disposable, OutputChannel } from 'vscode';
2
- import { ExecutionResult } from './batch';
3
- import { NotificationSeverity, StickyInput, StickyNotificationOptions } from './notifs';
4
- export type LinuxPackageManager = {
5
- kind: 'Apt';
6
- isPkExecAvailable: boolean;
7
- } | {
8
- kind: 'Dnf';
9
- isPkExecAvailable: boolean;
10
- } | {
11
- kind: 'Other';
12
- };
13
- export type DependencyInstallationMethod = {
14
- kind: 'Automatic';
15
- shell: 'Windows' | 'Unix';
16
- script: string;
17
- manualBackupScript: string | undefined;
18
- pathExtensions: string[];
19
- } | {
20
- kind: 'Manual';
21
- script: string | undefined;
22
- };
23
- export type MissingDependencyInstallationProcedure = {
24
- kind: 'Linux';
25
- isGitAvailable: boolean;
26
- isCurlAvailable: boolean;
27
- packageManager: LinuxPackageManager;
28
- } | {
29
- kind: 'MacOS';
30
- isGitAvailable: boolean;
31
- isCurlAvailable: true;
32
- } | {
33
- kind: 'Windows';
34
- isGitAvailable: boolean;
35
- isCurlAvailable: true;
36
- isWinGetAvailable: boolean;
37
- } | {
38
- kind: 'Other';
39
- isGitAvailable: boolean;
40
- isCurlAvailable: boolean;
41
- };
42
- export type DependencyInstallationProcedure = {
43
- kind: 'AllDepsInstalled';
44
- } | (MissingDependencyInstallationProcedure & {
45
- method: DependencyInstallationMethod;
46
- });
47
- export type DependencyInstallationResult = {
48
- kind: 'Success';
49
- } | {
50
- kind: 'Error';
51
- result: ExecutionResult;
52
- } | {
53
- kind: 'Cancelled';
54
- } | {
55
- kind: 'PendingInstall';
56
- };
57
- export declare function depInstallationLocations(): string[];
58
- export declare class DepInstaller implements Disposable {
59
- readonly outputChannel: OutputChannel;
60
- private pendingInstall;
61
- private diagnoser;
62
- private subscriptions;
63
- constructor(outputChannel: OutputChannel);
64
- displayInstallDependenciesPrompt(severity: NotificationSeverity, reason: string | undefined): Promise<'Success' | 'PendingInstall' | 'Failure'>;
65
- displayStickyInstallDependenciesPrompt(severity: NotificationSeverity, reason: string | undefined, options: StickyNotificationOptions<string>, otherItems?: StickyInput<string>[]): Promise<Disposable>;
66
- private installMissingDepsAndDisplayNotification;
67
- installMissingDeps(p: MissingDependencyInstallationProcedure & {
68
- method: DependencyInstallationMethod;
69
- }): Promise<DependencyInstallationResult>;
70
- private addDepsToProcessEnv;
71
- determineDependencyInstallationProcedure(): Promise<DependencyInstallationProcedure>;
72
- private determineMissingDependencyInstallationProcedure;
73
- private runCommand;
74
- dispose(): void;
75
- }
76
- export declare function missingDepsSentence(p: MissingDependencyInstallationProcedure): string;
77
- export declare function sentenceJoin(entries: string[]): string;
78
- export declare function missingDeps(p: MissingDependencyInstallationProcedure): string[];
79
- export declare function unsuccessfulDependencyInstallationPrompt(p: MissingDependencyInstallationProcedure & {
80
- method: DependencyInstallationMethod;
81
- }): string;
@@ -1,372 +0,0 @@
1
- import * as os from 'os';
2
- import path from 'path';
3
- import { commands, Disposable, env } from 'vscode';
4
- import { SetupDiagnoser } from '../diagnostics/setupDiagnoser';
5
- import { batchExecuteWithProgress, displayModalResultError, ExecutionExitCode, } from './batch';
6
- import { addToProcessEnvPATH } from './envPath';
7
- import { displayModalNotification, displayNotification, displayNotificationWithInput, displayStickyNotificationWithOptionalInput, } from './notifs';
8
- const gitInstallDir = path.join('c:', 'Program Files', 'Git', 'cmd');
9
- export function depInstallationLocations() {
10
- switch (os.type()) {
11
- case 'Linux':
12
- // Installation locations of Git and curl should already be in PATH on most Linux systems
13
- return [];
14
- case 'Darwin':
15
- // MacOS ships with a dummy executable for Git that is already in the PATH, which is replaced
16
- // with the real executable when Apple Command Line Tools is installed.
17
- return [];
18
- case 'Windows_NT':
19
- return [gitInstallDir];
20
- }
21
- return [];
22
- }
23
- const windowsRawGitInstallScript = `$gitInstallerUrl = "https://github.com/git-for-windows/git/releases/download/v2.50.1.windows.1/Git-2.50.1-64-bit.exe"
24
- $installDir = "%TEMP%\\lean4-vscode-extension"
25
- $gitInstallerLoc = "$installDir\\GitInstaller.exe"
26
- New-Item -ItemType Directory -Path $installDir -Force
27
- Invoke-WebRequest -Uri $gitInstallerUrl -OutFile $gitInstallerLoc
28
- & $gitInstallerLoc /VERYSILENT /NORESTART /SP-
29
- exit $LASTEXITCODE`;
30
- const macOsInstallScript = `set -e
31
- touch "/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
32
- aclt_label="$(/usr/sbin/softwareupdate -l |
33
- grep -B 1 -E 'Command Line Tools' |
34
- awk -F'*' '/^ *\\*/ {print $2}' |
35
- sed -e 's/^ *Label: //' -e 's/^ *//' |
36
- sort -V |
37
- tail -n1 |
38
- tr -d '\n')"
39
- /usr/sbin/softwareupdate -i "$aclt_label"`;
40
- export class DepInstaller {
41
- outputChannel;
42
- pendingInstall = false;
43
- diagnoser;
44
- subscriptions = [];
45
- constructor(outputChannel) {
46
- this.outputChannel = outputChannel;
47
- this.diagnoser = new SetupDiagnoser({
48
- channel: outputChannel,
49
- cwdUri: undefined,
50
- context: 'Dependency Installation',
51
- });
52
- this.subscriptions.push(commands.registerCommand('lean4.setup.installDeps', () => this.displayInstallDependenciesPrompt('Information', undefined)));
53
- }
54
- async displayInstallDependenciesPrompt(severity, reason) {
55
- const p = await this.determineDependencyInstallationProcedure();
56
- if (p.kind === 'AllDepsInstalled') {
57
- displayNotification('Information', 'All dependencies of Lean (Git and curl) are already installed.');
58
- return 'Success';
59
- }
60
- if (p.method.kind === 'Manual') {
61
- await displayManualInstallationPrompt(severity, reason, p);
62
- return 'Failure';
63
- }
64
- const choice = await displayNotificationWithInput(severity, installDependenciesPrompt(reason, p), ['Proceed']);
65
- if (choice !== 'Proceed') {
66
- return 'Failure';
67
- }
68
- return await this.installMissingDepsAndDisplayNotification(p);
69
- }
70
- async displayStickyInstallDependenciesPrompt(severity, reason, options, otherItems = []) {
71
- const p = await this.determineDependencyInstallationProcedure();
72
- if (p.kind === 'AllDepsInstalled') {
73
- displayNotification('Information', 'All dependencies of Lean (Git and curl) are already installed.');
74
- return Disposable.from();
75
- }
76
- if (p.method.kind === 'Manual') {
77
- return await displayStickyManualInstallationPrompt(severity, reason, p, options, otherItems);
78
- }
79
- const installDepsItem = {
80
- input: 'Install Dependencies',
81
- continueDisplaying: false,
82
- action: async () => {
83
- await this.installMissingDepsAndDisplayNotification(p);
84
- },
85
- };
86
- return displayStickyNotificationWithOptionalInput(severity, installDependenciesPrompt(reason, p), options, [
87
- installDepsItem,
88
- ...otherItems,
89
- ]);
90
- }
91
- async installMissingDepsAndDisplayNotification(p) {
92
- const r = await this.installMissingDeps(p);
93
- switch (r.kind) {
94
- case 'Success':
95
- displayNotification('Information', 'Dependency installation successful!');
96
- return 'Success';
97
- case 'Error':
98
- await displayModalResultError(r.result, unsuccessfulDependencyInstallationPrompt(p));
99
- return 'Failure';
100
- case 'Cancelled':
101
- return 'Failure';
102
- case 'PendingInstall':
103
- return 'PendingInstall';
104
- }
105
- }
106
- async installMissingDeps(p) {
107
- if (p.method.kind === 'Manual') {
108
- throw new Error('got manual installation method in `installMissingDeps`');
109
- }
110
- if (this.pendingInstall) {
111
- displayNotification('Error', 'Dependencies are already being installed.');
112
- return { kind: 'PendingInstall' };
113
- }
114
- this.pendingInstall = true;
115
- try {
116
- const installationResult = await this.runCommand(p.method.script, [], 'Installing missing dependencies', p.method.shell);
117
- switch (installationResult.exitCode) {
118
- case ExecutionExitCode.Success:
119
- this.addDepsToProcessEnv(p.method);
120
- return { kind: 'Success' };
121
- case ExecutionExitCode.CannotLaunch:
122
- case ExecutionExitCode.ExecutionError:
123
- return { kind: 'Error', result: installationResult };
124
- case ExecutionExitCode.Cancelled:
125
- return { kind: 'Cancelled' };
126
- }
127
- }
128
- finally {
129
- this.pendingInstall = false;
130
- }
131
- }
132
- addDepsToProcessEnv(method) {
133
- if (method.kind !== 'Automatic') {
134
- return;
135
- }
136
- for (const pathExt of method.pathExtensions) {
137
- addToProcessEnvPATH(pathExt);
138
- }
139
- }
140
- async determineDependencyInstallationProcedure() {
141
- const p = await this.determineMissingDependencyInstallationProcedure();
142
- if (p === undefined) {
143
- return { kind: 'AllDepsInstalled' };
144
- }
145
- return { ...p, method: dependencyInstallationMethod(p) };
146
- }
147
- async determineMissingDependencyInstallationProcedure() {
148
- const isCurlAvailable = await this.diagnoser.checkCurlAvailable();
149
- const isGitAvailable = await this.diagnoser.checkGitAvailable();
150
- if (isCurlAvailable && isGitAvailable) {
151
- return undefined;
152
- }
153
- switch (os.type()) {
154
- case 'Linux':
155
- const isAptAvailable = await this.diagnoser.checkAptGetAvailable();
156
- if (isAptAvailable) {
157
- const isPkExecAvailable = await this.diagnoser.checkPkExecAvailable();
158
- return {
159
- kind: 'Linux',
160
- isCurlAvailable,
161
- isGitAvailable,
162
- packageManager: { kind: 'Apt', isPkExecAvailable },
163
- };
164
- }
165
- const isDnfAvailable = await this.diagnoser.checkDnfAvailable();
166
- if (isDnfAvailable) {
167
- const isPkExecAvailable = await this.diagnoser.checkPkExecAvailable();
168
- return {
169
- kind: 'Linux',
170
- isCurlAvailable,
171
- isGitAvailable,
172
- packageManager: { kind: 'Dnf', isPkExecAvailable },
173
- };
174
- }
175
- return {
176
- kind: 'Linux',
177
- isCurlAvailable,
178
- isGitAvailable,
179
- packageManager: { kind: 'Other' },
180
- };
181
- case 'Darwin':
182
- return {
183
- kind: 'MacOS',
184
- isCurlAvailable: true,
185
- isGitAvailable,
186
- };
187
- case 'Windows_NT':
188
- const isWinGetAvailable = await this.diagnoser.checkWinGetAvailable();
189
- return {
190
- kind: 'Windows',
191
- isCurlAvailable: true,
192
- isGitAvailable,
193
- isWinGetAvailable,
194
- };
195
- }
196
- return {
197
- kind: 'Other',
198
- isCurlAvailable,
199
- isGitAvailable,
200
- };
201
- }
202
- async runCommand(executablePath, args, title, shell) {
203
- const options = {
204
- allowCancellation: true,
205
- channel: this.outputChannel,
206
- shell,
207
- };
208
- return batchExecuteWithProgress(executablePath, args, 'Dependency Installation', title, options);
209
- }
210
- dispose() {
211
- for (const s of this.subscriptions) {
212
- s.dispose();
213
- }
214
- }
215
- }
216
- function dependencyInstallationMethod(p) {
217
- switch (p.kind) {
218
- case 'Linux':
219
- switch (p.packageManager.kind) {
220
- case 'Apt':
221
- const manualAptScript = `sudo apt update && sudo apt install ${missingDeps(p).join(' ')}`;
222
- if (!p.packageManager.isPkExecAvailable) {
223
- return {
224
- kind: 'Manual',
225
- script: manualAptScript,
226
- };
227
- }
228
- return {
229
- kind: 'Automatic',
230
- shell: 'Unix',
231
- // `ulimit -Sn 1024`: https://github.com/microsoft/vscode/issues/237427
232
- script: `ulimit -Sn 1024; pkexec bash -c 'export DEBIAN_FRONTEND=noninteractive; apt-get update -y && apt-get install -y ${missingDeps(p).join(' ')}'`,
233
- manualBackupScript: manualAptScript,
234
- pathExtensions: [],
235
- };
236
- case 'Dnf':
237
- const manualDnfScript = `sudo dnf install ${missingDeps(p).join(' ')}`;
238
- if (!p.packageManager.isPkExecAvailable) {
239
- return {
240
- kind: 'Manual',
241
- script: manualDnfScript,
242
- };
243
- }
244
- return {
245
- kind: 'Automatic',
246
- shell: 'Unix',
247
- script: `pkexec dnf install -y ${missingDeps(p).join(' ')}`,
248
- manualBackupScript: manualDnfScript,
249
- pathExtensions: [],
250
- };
251
- case 'Other':
252
- return {
253
- kind: 'Manual',
254
- script: undefined,
255
- };
256
- }
257
- case 'MacOS':
258
- return {
259
- kind: 'Automatic',
260
- shell: 'Unix',
261
- script: macOsInstallScript,
262
- manualBackupScript: macOsInstallScript,
263
- pathExtensions: [],
264
- };
265
- case 'Windows':
266
- if (!p.isWinGetAvailable) {
267
- return {
268
- kind: 'Automatic',
269
- shell: 'Windows',
270
- script: windowsRawGitInstallScript,
271
- manualBackupScript: undefined,
272
- pathExtensions: [gitInstallDir],
273
- };
274
- }
275
- const windowsWingetGitInstallScript = 'winget install -e --id Git.Git --silent --accept-package-agreements --accept-source-agreements --disable-interactivity';
276
- return {
277
- kind: 'Automatic',
278
- shell: 'Windows',
279
- script: windowsWingetGitInstallScript,
280
- manualBackupScript: windowsWingetGitInstallScript,
281
- pathExtensions: [gitInstallDir],
282
- };
283
- case 'Other':
284
- return {
285
- kind: 'Manual',
286
- script: undefined,
287
- };
288
- }
289
- }
290
- async function displayManualInstallationPrompt(severity, reason, p) {
291
- let reasonPrefix = '';
292
- if (reason !== undefined) {
293
- reasonPrefix = `${reason} `;
294
- }
295
- if (p.method.script === undefined) {
296
- await displayModalNotification(severity, `${reasonPrefix}Please install ${missingDepsSentence(p)} and restart VS Code.`);
297
- return;
298
- }
299
- const prompt = `${reasonPrefix}Please install ${missingDepsSentence(p)} from a terminal using the script below and restart VS Code.\n\n${p.method.script}`;
300
- const copyToClipboardInput = 'Copy Script to Clipboard';
301
- const choice = await displayNotificationWithInput('Information', prompt, [copyToClipboardInput], 'Close');
302
- if (choice === copyToClipboardInput) {
303
- await env.clipboard.writeText(p.method.script);
304
- }
305
- }
306
- async function displayStickyManualInstallationPrompt(severity, reason, p, options, otherItems = []) {
307
- let reasonPrefix = '';
308
- if (reason !== undefined) {
309
- reasonPrefix = `${reason} `;
310
- }
311
- const script = p.method.script;
312
- if (script === undefined) {
313
- await displayModalNotification(severity, `${reasonPrefix}Please install ${missingDepsSentence(p)} and restart VS Code.`);
314
- return Disposable.from();
315
- }
316
- const prompt = `${reasonPrefix}Please install ${missingDepsSentence(p)} from a [terminal](command:workbench.action.terminal.new) using the script below and restart VS Code.\n\n${script}`;
317
- const copyToClipboardItem = {
318
- input: 'Copy Script to Clipboard',
319
- continueDisplaying: true,
320
- action: async () => {
321
- await env.clipboard.writeText(script);
322
- },
323
- };
324
- return displayStickyNotificationWithOptionalInput(severity, prompt, options, [copyToClipboardItem, ...otherItems]);
325
- }
326
- export function missingDepsSentence(p) {
327
- return sentenceJoin(missingDeps(p).map(d => '`' + d + '`'));
328
- }
329
- export function sentenceJoin(entries) {
330
- if (entries.length === 0) {
331
- throw new Error('Cannot join empty array.');
332
- }
333
- if (entries.length === 1) {
334
- return entries[0];
335
- }
336
- if (entries.length === 2) {
337
- return `${entries[0]} and ${entries[1]}`;
338
- }
339
- return `${entries.slice(0, entries.length - 1).join(', ')} and ${entries[entries.length - 1]}`;
340
- }
341
- export function missingDeps(p) {
342
- const missingDeps = [];
343
- if (!p.isGitAvailable) {
344
- missingDeps.push('git');
345
- }
346
- if (!p.isCurlAvailable) {
347
- missingDeps.push('curl');
348
- }
349
- return missingDeps;
350
- }
351
- function installDependenciesPrompt(reason, p) {
352
- if (p.method.kind === 'Manual') {
353
- throw new Error('cannot display installDependenciesPrompt for manual installation');
354
- }
355
- let reasonPrefix = '';
356
- if (reason !== undefined) {
357
- reasonPrefix = `${reason} `;
358
- }
359
- return `${reasonPrefix}Do you wish to install ${missingDepsSentence(p)}?`;
360
- }
361
- export function unsuccessfulDependencyInstallationPrompt(p) {
362
- if (p.method.kind === 'Manual') {
363
- throw new Error('cannot display unsuccessfulDependencyInstallationPrompt for manual installation');
364
- }
365
- if (p.method.manualBackupScript === undefined) {
366
- return `Installation of ${missingDepsSentence(p)} unsuccessful.`;
367
- }
368
- return `Installation of ${missingDepsSentence(p)} unsuccessful.
369
- If you are unable to figure out the issue from the command output below, you can also try running the following manual installation script from a terminal:
370
-
371
- ${p.method.manualBackupScript}`;
372
- }