lean4monaco 1.0.46 → 1.1.0

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.
Files changed (209) hide show
  1. package/README.md +75 -0
  2. package/dist/JuliaMono-Regular.ttf +0 -0
  3. package/dist/css/custom.css +7 -1
  4. package/dist/infowebview.d.ts +3 -4
  5. package/dist/infowebview.js +4 -4
  6. package/dist/lean4-infoview/codicon.ttf +0 -0
  7. package/dist/lean4-infoview/esm-shims/react-dom.d.ts +5 -0
  8. package/dist/lean4-infoview/esm-shims/react-jsx-runtime.d.ts +5 -0
  9. package/dist/lean4-infoview/esm-shims/react.d.ts +5 -0
  10. package/dist/lean4-infoview/index.css +4161 -0
  11. package/dist/lean4-infoview/index.d.ts +16 -0
  12. package/dist/lean4-infoview/index.development.js +37312 -0
  13. package/dist/lean4-infoview/index.production.min.js +1528 -0
  14. package/dist/lean4-infoview/infoview/collapsing.d.ts +12 -0
  15. package/dist/lean4-infoview/infoview/contexts.d.ts +10 -0
  16. package/dist/lean4-infoview/infoview/editorConnection.d.ts +22 -0
  17. package/dist/lean4-infoview/infoview/errors.d.ts +14 -0
  18. package/dist/lean4-infoview/infoview/event.d.ts +33 -0
  19. package/dist/lean4-infoview/infoview/goalLocation.d.ts +61 -0
  20. package/dist/lean4-infoview/infoview/goals.d.ts +46 -0
  21. package/dist/lean4-infoview/infoview/info.d.ts +18 -0
  22. package/dist/lean4-infoview/infoview/infos.d.ts +2 -0
  23. package/dist/lean4-infoview/infoview/interactiveCode.d.ts +19 -0
  24. package/dist/lean4-infoview/infoview/main.d.ts +13 -0
  25. package/dist/lean4-infoview/infoview/messages.d.ts +19 -0
  26. package/dist/lean4-infoview/infoview/rpcSessions.d.ts +11 -0
  27. package/dist/lean4-infoview/infoview/serverVersion.d.ts +10 -0
  28. package/dist/lean4-infoview/infoview/tooltips.d.ts +32 -0
  29. package/dist/lean4-infoview/infoview/traceExplorer.d.ts +11 -0
  30. package/dist/lean4-infoview/infoview/userWidget.d.ts +39 -0
  31. package/dist/lean4-infoview/infoview/util.d.ts +144 -0
  32. package/dist/lean4-infoview/loader.d.ts +20 -0
  33. package/dist/lean4-infoview/loader.development.js +1006 -0
  34. package/dist/lean4-infoview/loader.production.min.js +1 -0
  35. package/dist/lean4-infoview/react-dom.development.js +30537 -0
  36. package/dist/lean4-infoview/react-dom.production.min.js +21 -0
  37. package/dist/lean4-infoview/react-jsx-runtime.development.js +1362 -0
  38. package/dist/lean4-infoview/react-jsx-runtime.production.min.js +1 -0
  39. package/dist/lean4-infoview/react.development.js +2823 -0
  40. package/dist/lean4-infoview/react.production.min.js +1 -0
  41. package/dist/leanmonaco.js +5 -4
  42. package/dist/monaco-lean4/vscode-lean4/package.json +944 -0
  43. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.d.ts +9 -0
  44. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.js +20 -0
  45. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationHoverProvider.d.ts +12 -0
  46. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationHoverProvider.js +40 -0
  47. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.d.ts +20 -0
  48. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.js +79 -0
  49. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationConfig.d.ts +13 -0
  50. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationConfig.js +29 -0
  51. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.d.ts +28 -0
  52. package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.js +124 -0
  53. package/dist/monaco-lean4/vscode-lean4/src/config.d.ts +33 -0
  54. package/dist/monaco-lean4/vscode-lean4/src/config.js +119 -0
  55. package/dist/monaco-lean4/vscode-lean4/src/diagnostics/setupNotifs.d.ts +27 -0
  56. package/dist/monaco-lean4/vscode-lean4/src/diagnostics/setupNotifs.js +133 -0
  57. package/dist/monaco-lean4/vscode-lean4/src/infoview.d.ts +69 -0
  58. package/dist/monaco-lean4/vscode-lean4/src/infoview.js +711 -0
  59. package/dist/monaco-lean4/vscode-lean4/src/leanclient.d.ts +67 -0
  60. package/dist/monaco-lean4/vscode-lean4/src/leanclient.js +443 -0
  61. package/dist/monaco-lean4/vscode-lean4/src/rpc.d.ts +16 -0
  62. package/dist/monaco-lean4/vscode-lean4/src/rpc.js +102 -0
  63. package/dist/monaco-lean4/vscode-lean4/src/taskgutter.d.ts +11 -0
  64. package/dist/monaco-lean4/vscode-lean4/src/taskgutter.js +130 -0
  65. package/dist/monaco-lean4/vscode-lean4/src/utils/batch.d.ts +37 -0
  66. package/dist/monaco-lean4/vscode-lean4/src/utils/batch.js +203 -0
  67. package/dist/monaco-lean4/vscode-lean4/src/utils/clientProvider.d.ts +41 -0
  68. package/dist/monaco-lean4/vscode-lean4/src/utils/clientProvider.js +205 -0
  69. package/dist/monaco-lean4/vscode-lean4/src/utils/converters.d.ts +16 -0
  70. package/dist/monaco-lean4/vscode-lean4/src/utils/converters.js +129 -0
  71. package/dist/monaco-lean4/vscode-lean4/src/utils/elan.d.ts +3 -0
  72. package/dist/monaco-lean4/vscode-lean4/src/utils/elan.js +4 -0
  73. package/dist/monaco-lean4/vscode-lean4/src/utils/envPath.d.ts +21 -0
  74. package/dist/monaco-lean4/vscode-lean4/src/utils/envPath.js +53 -0
  75. package/dist/monaco-lean4/vscode-lean4/src/utils/exturi.d.ts +35 -0
  76. package/dist/monaco-lean4/vscode-lean4/src/utils/exturi.js +136 -0
  77. package/dist/monaco-lean4/vscode-lean4/src/utils/fsHelper.d.ts +17 -0
  78. package/dist/monaco-lean4/vscode-lean4/src/utils/fsHelper.js +36 -0
  79. package/dist/monaco-lean4/vscode-lean4/src/utils/leanInstaller.d.ts +37 -0
  80. package/dist/monaco-lean4/vscode-lean4/src/utils/leanInstaller.js +210 -0
  81. package/dist/monaco-lean4/vscode-lean4/src/utils/logger.d.ts +7 -0
  82. package/dist/monaco-lean4/vscode-lean4/src/utils/logger.js +20 -0
  83. package/dist/monaco-lean4/vscode-lean4/src/utils/notifs.d.ts +24 -0
  84. package/dist/monaco-lean4/vscode-lean4/src/utils/notifs.js +110 -0
  85. package/dist/monaco-lean4/vscode-lean4/src/utils/projectInfo.d.ts +9 -0
  86. package/dist/monaco-lean4/vscode-lean4/src/utils/projectInfo.js +125 -0
  87. package/dist/monacoleanclient.d.ts +1 -2
  88. package/dist/monacoleanclient.js +3 -3
  89. package/dist/vscode-lean4/lean4-infoview/package.json +25 -23
  90. package/dist/vscode-lean4/lean4-infoview/src/infoview/highlightjs.css +210 -0
  91. package/dist/vscode-lean4/lean4-infoview/tsconfig.json +6 -2
  92. package/dist/vscode-lean4/lean4-infoview-api/package.json +1 -1
  93. package/dist/vscode-lean4/lean4-unicode-input/package.json +1 -1
  94. package/dist/vscode-lean4/lean4-unicode-input/src/abbreviations.json +12 -12
  95. package/dist/vscode-lean4/lean4-unicode-input-component/package.json +2 -2
  96. package/dist/vscode-lean4/package-lock.json +6129 -3245
  97. package/dist/vscode-lean4/vscode-lean4/language-configuration.json +1 -1
  98. package/dist/vscode-lean4/vscode-lean4/loogleview/static/index.css +19 -16
  99. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-dark.svg +91 -0
  100. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-i-dark.svg +114 -0
  101. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-i-light.svg +114 -0
  102. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-i-passthrough-dark.svg +109 -0
  103. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-i-passthrough-light.svg +109 -0
  104. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-init-dark.svg +100 -0
  105. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-init-light.svg +100 -0
  106. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-l-dark.svg +123 -0
  107. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-l-light.svg +123 -0
  108. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-l-passthrough-dark.svg +109 -0
  109. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-l-passthrough-light.svg +109 -0
  110. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-light.svg +91 -0
  111. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-t-dark.svg +123 -0
  112. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-t-light.svg +123 -0
  113. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-t-passthrough-dark.svg +118 -0
  114. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-t-passthrough-light.svg +118 -0
  115. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-dark.svg +138 -0
  116. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-i-passthrough-dark.svg +160 -0
  117. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-i-passthrough-light.svg +160 -0
  118. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-l-passthrough-dark.svg +158 -0
  119. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-l-passthrough-light.svg +158 -0
  120. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-light.svg +138 -0
  121. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-t-passthrough-dark.svg +169 -0
  122. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-t-passthrough-light.svg +169 -0
  123. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-dark.svg +147 -0
  124. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-i-passthrough-dark.svg +170 -0
  125. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-i-passthrough-light.svg +170 -0
  126. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-l-passthrough-dark.svg +167 -0
  127. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-l-passthrough-light.svg +167 -0
  128. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-light.svg +147 -0
  129. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-t-passthrough-dark.svg +179 -0
  130. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-t-passthrough-light.svg +179 -0
  131. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-dark.svg +165 -0
  132. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-i-passthrough-dark.svg +187 -0
  133. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-i-passthrough-light.svg +187 -0
  134. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-l-passthrough-dark.svg +185 -0
  135. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-l-passthrough-light.svg +185 -0
  136. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-light.svg +165 -0
  137. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-t-passthrough-dark.svg +196 -0
  138. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-t-passthrough-light.svg +196 -0
  139. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-dark.svg +184 -0
  140. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-i-passthrough-dark.svg +206 -0
  141. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-i-passthrough-light.svg +206 -0
  142. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-l-passthrough-dark.svg +204 -0
  143. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-l-passthrough-light.svg +204 -0
  144. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-light.svg +184 -0
  145. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-t-passthrough-dark.svg +215 -0
  146. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-t-passthrough-light.svg +215 -0
  147. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-dark.svg +132 -0
  148. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-i-passthrough-dark.svg +154 -0
  149. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-i-passthrough-light.svg +154 -0
  150. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-l-passthrough-dark.svg +152 -0
  151. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-l-passthrough-light.svg +152 -0
  152. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-light.svg +132 -0
  153. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-t-passthrough-dark.svg +163 -0
  154. package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-t-passthrough-light.svg +163 -0
  155. package/dist/vscode-lean4/vscode-lean4/moogleview/static/index.css +198 -0
  156. package/dist/vscode-lean4/vscode-lean4/moogleview/tsconfig.json +10 -0
  157. package/dist/vscode-lean4/vscode-lean4/package.json +638 -18
  158. package/dist/vscode-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.d.ts +2 -2
  159. package/dist/vscode-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.js +2 -2
  160. package/dist/vscode-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.d.ts +2 -3
  161. package/dist/vscode-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.js +3 -5
  162. package/dist/vscode-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.d.ts +1 -2
  163. package/dist/vscode-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.js +4 -8
  164. package/dist/vscode-lean4/vscode-lean4/src/config.d.ts +14 -1
  165. package/dist/vscode-lean4/vscode-lean4/src/config.js +56 -5
  166. package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupDiagnoser.d.ts +36 -5
  167. package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupDiagnoser.js +59 -23
  168. package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupDiagnostics.d.ts +22 -17
  169. package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupDiagnostics.js +182 -119
  170. package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupNotifs.d.ts +33 -20
  171. package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupNotifs.js +235 -89
  172. package/dist/vscode-lean4/vscode-lean4/src/infoview.d.ts +7 -18
  173. package/dist/vscode-lean4/vscode-lean4/src/infoview.js +217 -102
  174. package/dist/vscode-lean4/vscode-lean4/src/leanclient.d.ts +12 -7
  175. package/dist/vscode-lean4/vscode-lean4/src/leanclient.js +187 -64
  176. package/dist/vscode-lean4/vscode-lean4/src/taskgutter.d.ts +35 -3
  177. package/dist/vscode-lean4/vscode-lean4/src/taskgutter.js +533 -93
  178. package/dist/vscode-lean4/vscode-lean4/src/utils/batch.d.ts +12 -4
  179. package/dist/vscode-lean4/vscode-lean4/src/utils/batch.js +78 -72
  180. package/dist/vscode-lean4/vscode-lean4/src/utils/clientProvider.d.ts +9 -9
  181. package/dist/vscode-lean4/vscode-lean4/src/utils/clientProvider.js +121 -77
  182. package/dist/vscode-lean4/vscode-lean4/src/utils/converters.d.ts +15 -0
  183. package/dist/vscode-lean4/vscode-lean4/src/utils/converters.js +9 -0
  184. package/dist/vscode-lean4/vscode-lean4/src/utils/elan.d.ts +179 -1
  185. package/dist/vscode-lean4/vscode-lean4/src/utils/elan.js +422 -3
  186. package/dist/vscode-lean4/vscode-lean4/src/utils/exturi.d.ts +3 -1
  187. package/dist/vscode-lean4/vscode-lean4/src/utils/exturi.js +11 -11
  188. package/dist/vscode-lean4/vscode-lean4/src/utils/groupBy.d.ts +2 -0
  189. package/dist/vscode-lean4/vscode-lean4/src/utils/groupBy.js +17 -0
  190. package/dist/vscode-lean4/vscode-lean4/src/utils/internalErrors.d.ts +2 -0
  191. package/dist/vscode-lean4/vscode-lean4/src/utils/internalErrors.js +35 -0
  192. package/dist/vscode-lean4/vscode-lean4/src/utils/leanCmdRunner.d.ts +34 -0
  193. package/dist/vscode-lean4/vscode-lean4/src/utils/leanCmdRunner.js +249 -0
  194. package/dist/vscode-lean4/vscode-lean4/src/utils/leanEditorProvider.d.ts +83 -0
  195. package/dist/vscode-lean4/vscode-lean4/src/utils/leanEditorProvider.js +323 -0
  196. package/dist/vscode-lean4/vscode-lean4/src/utils/leanInstaller.d.ts +41 -12
  197. package/dist/vscode-lean4/vscode-lean4/src/utils/leanInstaller.js +245 -128
  198. package/dist/vscode-lean4/vscode-lean4/src/utils/notifs.d.ts +27 -22
  199. package/dist/vscode-lean4/vscode-lean4/src/utils/notifs.js +177 -82
  200. package/dist/vscode-lean4/vscode-lean4/src/utils/projectInfo.d.ts +11 -4
  201. package/dist/vscode-lean4/vscode-lean4/src/utils/projectInfo.js +18 -16
  202. package/dist/vscode-lean4/vscode-lean4/src/utils/semverRegex.d.ts +1 -0
  203. package/dist/vscode-lean4/vscode-lean4/src/utils/semverRegex.js +2 -0
  204. package/dist/vscode-lean4/vscode-lean4/src/utils/viewColumn.d.ts +3 -0
  205. package/dist/vscode-lean4/vscode-lean4/src/utils/viewColumn.js +22 -0
  206. package/dist/vscode-lean4/vscode-lean4/tsconfig.json +2 -1
  207. package/dist/vscode-lean4/vscode-lean4/webview/tsconfig.json +3 -1
  208. package/dist/vscode.css +7 -0
  209. package/package.json +7 -5
@@ -1,4 +1,6 @@
1
- import { commands, window } from 'vscode';
1
+ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */
2
+ import { Disposable, commands, window } from 'vscode';
3
+ import { lean } from './leanEditorProvider';
2
4
  function toNotif(severity) {
3
5
  switch (severity) {
4
6
  case 'Information':
@@ -9,6 +11,78 @@ function toNotif(severity) {
9
11
  return window.showErrorMessage;
10
12
  }
11
13
  }
14
+ export async function setStickyNotificationActiveButHidden(isActiveButHidden) {
15
+ await commands.executeCommand('setContext', 'lean4.isStickyNotificationActiveButHidden', isActiveButHidden);
16
+ }
17
+ let activeStickyNotification;
18
+ let nextStickyNotification;
19
+ let activeDisplayFn;
20
+ function makeSticky(n) {
21
+ if (activeStickyNotification !== undefined) {
22
+ nextStickyNotification = n;
23
+ return Disposable.from();
24
+ }
25
+ activeStickyNotification = n;
26
+ let isDisplaying = false;
27
+ // eslint-disable-next-line prefer-const
28
+ let d;
29
+ const display = async () => {
30
+ if (isDisplaying) {
31
+ return;
32
+ }
33
+ await setStickyNotificationActiveButHidden(false);
34
+ isDisplaying = true;
35
+ try {
36
+ await activeStickyNotification?.options.onDisplay();
37
+ let gotNewStickyNotification = false;
38
+ let r;
39
+ let continueDisplaying;
40
+ do {
41
+ gotNewStickyNotification = false;
42
+ r = await activeStickyNotification?.displayNotification();
43
+ continueDisplaying =
44
+ r === undefined || ((await activeStickyNotification?.options.onInput(r, true)) ?? false);
45
+ if (nextStickyNotification !== undefined) {
46
+ activeStickyNotification = nextStickyNotification;
47
+ nextStickyNotification = undefined;
48
+ gotNewStickyNotification = true;
49
+ }
50
+ } while ((r !== undefined && continueDisplaying) || gotNewStickyNotification);
51
+ if (!continueDisplaying) {
52
+ activeStickyNotification = undefined;
53
+ await setStickyNotificationActiveButHidden(false);
54
+ d?.dispose();
55
+ }
56
+ else {
57
+ await setStickyNotificationActiveButHidden(true);
58
+ }
59
+ }
60
+ catch (e) {
61
+ activeStickyNotification = undefined;
62
+ nextStickyNotification = undefined;
63
+ await setStickyNotificationActiveButHidden(false);
64
+ d?.dispose();
65
+ console.log(e);
66
+ }
67
+ finally {
68
+ isDisplaying = false;
69
+ }
70
+ };
71
+ activeDisplayFn = display;
72
+ d = Disposable.from(lean.onDidRevealLeanEditor(async () => await display()), {
73
+ dispose: () => {
74
+ activeStickyNotification = undefined;
75
+ activeDisplayFn = undefined;
76
+ },
77
+ });
78
+ void display();
79
+ return d;
80
+ }
81
+ export function displayActiveStickyNotification() {
82
+ if (activeDisplayFn !== undefined) {
83
+ void activeDisplayFn();
84
+ }
85
+ }
12
86
  export function displayNotification(severity, message, finalizer) {
13
87
  void (async () => {
14
88
  await toNotif(severity)(message, {});
@@ -17,94 +91,115 @@ export function displayNotification(severity, message, finalizer) {
17
91
  }
18
92
  })();
19
93
  }
20
- export async function displayNotificationWithInput(severity, message, ...items) {
21
- return await toNotif(severity)(message, { modal: true }, ...items);
22
- }
23
- export function displayNotificationWithOptionalInput(severity, message, input, action, finalizer) {
94
+ export function displayStickyNotification(severity, message, options) {
95
+ return makeSticky({
96
+ displayNotification: async () => (await toNotif(severity)(message, {})),
97
+ options,
98
+ });
99
+ }
100
+ export async function displayNotificationWithInput(severity, message, items, defaultItem) {
101
+ if (defaultItem === undefined) {
102
+ // VS Code renders buttons for modal notifications in the reverse order (which it doesn't do for non-modal notifications),
103
+ // so we reverse them for consistency.
104
+ // The close button is placed to the left of the primary button.
105
+ return await toNotif(severity)(message, { modal: true }, ...[...items].reverse());
106
+ }
107
+ let notif;
108
+ switch (severity) {
109
+ case 'Information':
110
+ notif = window.showInformationMessage;
111
+ break;
112
+ case 'Warning':
113
+ notif = window.showWarningMessage;
114
+ break;
115
+ case 'Error':
116
+ notif = window.showErrorMessage;
117
+ break;
118
+ }
119
+ const messageItems = items.map(item => ({
120
+ title: item,
121
+ isCloseAffordance: false,
122
+ }));
123
+ // VS Code always moves the `isCloseAffordance: true` button to the left of the primary button.
124
+ messageItems.push({
125
+ title: defaultItem,
126
+ isCloseAffordance: true,
127
+ });
128
+ messageItems.reverse();
129
+ const choice = await notif(message, { modal: true }, ...messageItems);
130
+ return choice?.title;
131
+ }
132
+ export async function displayModalNotification(severity, message) {
133
+ await displayNotificationWithInput(severity, message, [], 'Close');
134
+ }
135
+ export function displayNotificationWithOptionalInput(severity, message, inputs, finalizer) {
24
136
  void (async () => {
25
- const choice = await toNotif(severity)(message, {}, input);
26
- if (choice === input) {
27
- action();
137
+ const choice = await toNotif(severity)(message, {}, ...inputs.map(i => i.input));
138
+ const chosenInput = inputs.find(i => i.input === choice);
139
+ if (chosenInput !== undefined) {
140
+ chosenInput.action();
28
141
  }
29
142
  if (finalizer) {
30
143
  finalizer();
31
144
  }
32
145
  })();
33
146
  }
34
- export function displayNotificationWithOutput(severity, message, finalizer) {
35
- displayNotificationWithOptionalInput(severity, message, 'Show Output', () => commands.executeCommand('lean4.troubleshooting.showOutput'), finalizer);
36
- }
37
- export function displayNotificationWithSetupGuide(severity, message, finalizer) {
38
- displayNotificationWithOptionalInput(severity, message, 'Open Setup Guide', () => commands.executeCommand('lean4.docs.showSetupGuide'), finalizer);
39
- }
40
- export function displayError(message, finalizer) {
41
- displayNotification('Error', message, finalizer);
42
- }
43
- export async function displayErrorWithInput(message, ...items) {
44
- return await displayNotificationWithInput('Error', message, ...items);
45
- }
46
- export function displayErrorWithOptionalInput(message, input, action, finalizer) {
47
- displayNotificationWithOptionalInput('Error', message, input, action, finalizer);
48
- }
49
- export function displayErrorWithOutput(message, finalizer) {
50
- displayNotificationWithOutput('Error', message, finalizer);
51
- }
52
- export function displayErrorWithSetupGuide(message, finalizer) {
53
- displayNotificationWithSetupGuide('Error', message, finalizer);
54
- }
55
- export function displayWarning(message, finalizer) {
56
- displayNotification('Warning', message, finalizer);
57
- }
58
- export async function displayModalWarning(message) {
59
- const choice = await window.showWarningMessage(message, { modal: true }, 'Proceed Regardless');
60
- return choice === 'Proceed Regardless' ? 'Proceed' : 'Abort';
61
- }
62
- export async function displayWarningWithInput(message, ...items) {
63
- return await displayNotificationWithInput('Warning', message, ...items);
64
- }
65
- export function displayWarningWithOptionalInput(message, input, action, finalizer) {
66
- displayNotificationWithOptionalInput('Warning', message, input, action, finalizer);
67
- }
68
- export function displayWarningWithOutput(message, finalizer) {
69
- displayNotificationWithOutput('Warning', message, finalizer);
70
- }
71
- export async function displayModalWarningWithOutput(message) {
72
- const choice = await window.showWarningMessage(message, 'Show Output', 'Proceed Regardless');
73
- if (choice === undefined) {
74
- return 'Abort';
147
+ export function displayStickyNotificationWithOptionalInput(severity, message, options, inputs) {
148
+ const updatedOptions = {
149
+ ...options,
150
+ onInput: async (lastChoice, continueDisplaying) => {
151
+ const chosenInput = inputs.find(i => i.input === lastChoice);
152
+ if (chosenInput !== undefined) {
153
+ await chosenInput.action();
154
+ continueDisplaying = chosenInput.continueDisplaying;
155
+ }
156
+ return options.onInput(lastChoice, continueDisplaying);
157
+ },
158
+ };
159
+ return makeSticky({
160
+ displayNotification: async () => await toNotif(severity)(message, {}, ...inputs.map(i => i.input)),
161
+ options: updatedOptions,
162
+ });
163
+ }
164
+ export function displayNotificationWithOutput(severity, message, otherInputs = [], finalizer) {
165
+ displayNotificationWithOptionalInput(severity, message, [
166
+ { input: 'Show Output', action: () => commands.executeCommand('lean4.troubleshooting.showOutput') },
167
+ ...otherInputs,
168
+ ], finalizer);
169
+ }
170
+ export async function displayModalNotificationWithOutput(severity, message, otherItems = [], defaultItem) {
171
+ const choice = await displayNotificationWithInput(severity, message, ['Show Output', ...otherItems], defaultItem);
172
+ if (choice === 'Show Output') {
173
+ await commands.executeCommand('lean4.troubleshooting.showOutput');
75
174
  }
76
- if (choice === 'Proceed Regardless') {
77
- return 'Proceed';
175
+ return choice;
176
+ }
177
+ export function displayStickyNotificationWithOutput(severity, message, options, otherInputs = []) {
178
+ const showOutputItem = {
179
+ input: 'Show Output',
180
+ continueDisplaying: true,
181
+ action: async () => await commands.executeCommand('lean4.troubleshooting.showOutput'),
182
+ };
183
+ return displayStickyNotificationWithOptionalInput(severity, message, options, [showOutputItem, ...otherInputs]);
184
+ }
185
+ export function displayNotificationWithSetupGuide(severity, message, otherInputs = [], finalizer) {
186
+ displayNotificationWithOptionalInput(severity, message, [
187
+ { input: 'Open Setup Guide', action: () => commands.executeCommand('lean4.docs.showSetupGuide') },
188
+ ...otherInputs,
189
+ ], finalizer);
190
+ }
191
+ export function displayStickyNotificationWithSetupGuide(severity, message, options, otherInputs = []) {
192
+ const openSetupGuideItem = {
193
+ input: 'Open Setup Guide',
194
+ continueDisplaying: true,
195
+ action: async () => await commands.executeCommand('lean4.docs.showSetupGuide'),
196
+ };
197
+ return displayStickyNotificationWithOptionalInput(severity, message, options, [openSetupGuideItem, ...otherInputs]);
198
+ }
199
+ export async function displayModalNotificationWithSetupGuide(severity, message, otherItems = [], defaultItem) {
200
+ const choice = await displayNotificationWithInput(severity, message, ['Open Setup Guide', ...otherItems], defaultItem);
201
+ if (choice === 'Open Setup Guide') {
202
+ await commands.executeCommand('lean4.docs.showSetupGuide');
78
203
  }
79
- await commands.executeCommand('lean4.troubleshooting.showOutput');
80
- return 'Abort';
81
- }
82
- export function displayWarningWithSetupGuide(message, finalizer) {
83
- displayNotificationWithSetupGuide('Warning', message, finalizer);
84
- }
85
- export async function displayModalWarningWithSetupGuide(message) {
86
- const choice = await window.showWarningMessage(message, 'Open Setup Guide', 'Proceed Regardless');
87
- if (choice === undefined) {
88
- return 'Abort';
89
- }
90
- if (choice === 'Proceed Regardless') {
91
- return 'Proceed';
92
- }
93
- await commands.executeCommand('lean4.docs.showSetupGuide');
94
- return 'Abort';
95
- }
96
- export function displayInformation(message, finalizer) {
97
- displayNotification('Information', message, finalizer);
98
- }
99
- export async function displayInformationWithInput(message, ...items) {
100
- return await displayNotificationWithInput('Information', message, ...items);
101
- }
102
- export function displayInformationWithOptionalInput(message, input, action, finalizer) {
103
- displayNotificationWithOptionalInput('Information', message, input, action, finalizer);
104
- }
105
- export function displayInformationWithOutput(message, finalizer) {
106
- displayNotificationWithOutput('Information', message, finalizer);
107
- }
108
- export function displayInformationWithSetupGuide(message, finalizer) {
109
- displayNotificationWithSetupGuide('Information', message, finalizer);
204
+ return choice;
110
205
  }
@@ -2,10 +2,14 @@ import { ExtUri, FileUri } from './exturi';
2
2
  export declare function isCoreLean4Directory(path: FileUri): Promise<boolean>;
3
3
  type ProjectRootInfo = {
4
4
  kind: 'Success';
5
- projectRootUri: FileUri;
5
+ projectRootUri: ExtUri;
6
6
  toolchainUri: FileUri | undefined;
7
7
  } | {
8
8
  kind: 'FileNotFound';
9
+ } | {
10
+ kind: 'LakefileWithoutToolchain';
11
+ projectRootUri: FileUri;
12
+ lakefileUri: FileUri;
9
13
  };
10
14
  type ToolchainInfo = {
11
15
  uri: FileUri;
@@ -13,13 +17,16 @@ type ToolchainInfo = {
13
17
  };
14
18
  type ProjectInfo = {
15
19
  kind: 'Success';
16
- projectRootUri: FileUri;
20
+ projectRootUri: ExtUri;
17
21
  toolchainInfo: ToolchainInfo | undefined;
18
22
  } | {
19
23
  kind: 'FileNotFound';
24
+ } | {
25
+ kind: 'LakefileWithoutToolchain';
26
+ projectRootUri: FileUri;
27
+ lakefileUri: FileUri;
20
28
  };
21
- export declare function findLeanProjectRootInfo(uri: FileUri): Promise<ProjectRootInfo>;
22
- export declare function findLeanProjectRoot(uri: FileUri): Promise<FileUri | 'FileNotFound'>;
29
+ export declare function findLeanProjectRootInfo(uri: ExtUri): Promise<ProjectRootInfo>;
23
30
  export declare function findLeanProjectInfo(uri: FileUri): Promise<ProjectInfo>;
24
31
  export declare function isValidLeanProject(projectFolder: FileUri): Promise<boolean>;
25
32
  export declare function checkParentFoldersForLeanProject(folder: FileUri): Promise<FileUri | undefined>;
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'fs';
2
- import { FileUri, getWorkspaceFolderUri } from './exturi';
3
- import { dirExists, fileExists } from './fsHelper';
4
2
  import path from 'path';
3
+ import { FileUri, isWorkspaceFolder, UntitledUri } from './exturi';
4
+ import { dirExists, fileExists } from './fsHelper';
5
5
  // Detect lean4 root directory (works for both lean4 repo and nightly distribution)
6
6
  export async function isCoreLean4Directory(path) {
7
7
  const licensePath = path.join('LICENSE').fsPath;
@@ -23,9 +23,10 @@ export async function isCoreLean4Directory(path) {
23
23
  }
24
24
  // Find the root of a Lean project and the Uri for the 'lean-toolchain' file found there.
25
25
  export async function findLeanProjectRootInfo(uri) {
26
- const toolchainFileName = 'lean-toolchain';
26
+ if (uri.scheme === 'untitled') {
27
+ return { kind: 'Success', projectRootUri: new UntitledUri(), toolchainUri: undefined };
28
+ }
27
29
  let path = uri;
28
- const containingWsFolderUri = getWorkspaceFolderUri(uri);
29
30
  try {
30
31
  if ((await fs.promises.stat(path.fsPath)).isFile()) {
31
32
  path = uri.join('..');
@@ -37,7 +38,9 @@ export async function findLeanProjectRootInfo(uri) {
37
38
  let bestFolder = path;
38
39
  let bestLeanToolchain;
39
40
  while (true) {
40
- const leanToolchain = path.join(toolchainFileName);
41
+ const leanToolchain = path.join('lean-toolchain');
42
+ const lakefileLean = path.join('lakefile.lean');
43
+ const lakefileToml = path.join('lakefile.toml');
41
44
  if (await fileExists(leanToolchain.fsPath)) {
42
45
  bestFolder = path;
43
46
  bestLeanToolchain = leanToolchain;
@@ -48,7 +51,13 @@ export async function findLeanProjectRootInfo(uri) {
48
51
  // Stop searching in case users accidentally created a lean-toolchain file above the core directory
49
52
  break;
50
53
  }
51
- if (containingWsFolderUri !== undefined && path.equals(containingWsFolderUri)) {
54
+ else if (await fileExists(lakefileLean.fsPath)) {
55
+ return { kind: 'LakefileWithoutToolchain', projectRootUri: path, lakefileUri: lakefileLean };
56
+ }
57
+ else if (await fileExists(lakefileToml.fsPath)) {
58
+ return { kind: 'LakefileWithoutToolchain', projectRootUri: path, lakefileUri: lakefileToml };
59
+ }
60
+ if (isWorkspaceFolder(path)) {
52
61
  if (bestLeanToolchain === undefined) {
53
62
  // If we haven't found a toolchain yet, prefer the workspace folder as the project scope for the file,
54
63
  // but keep looking in case there is a lean-toolchain above the workspace folder
@@ -69,15 +78,6 @@ export async function findLeanProjectRootInfo(uri) {
69
78
  }
70
79
  return { kind: 'Success', projectRootUri: bestFolder, toolchainUri: bestLeanToolchain };
71
80
  }
72
- export async function findLeanProjectRoot(uri) {
73
- const info = await findLeanProjectRootInfo(uri);
74
- switch (info.kind) {
75
- case 'Success':
76
- return info.projectRootUri;
77
- case 'FileNotFound':
78
- return 'FileNotFound';
79
- }
80
- }
81
81
  export async function findLeanProjectInfo(uri) {
82
82
  const info = await findLeanProjectRootInfo(uri);
83
83
  switch (info.kind) {
@@ -88,7 +88,9 @@ export async function findLeanProjectInfo(uri) {
88
88
  }
89
89
  return { kind: 'Success', projectRootUri: info.projectRootUri, toolchainInfo };
90
90
  case 'FileNotFound':
91
- return { kind: 'FileNotFound' };
91
+ return info;
92
+ case 'LakefileWithoutToolchain':
93
+ return info;
92
94
  }
93
95
  }
94
96
  async function readLeanToolchainFile(toolchainFileUri) {
@@ -0,0 +1 @@
1
+ export declare const semVerRegex: RegExp;
@@ -0,0 +1,2 @@
1
+ // Suggested at https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
2
+ export const semVerRegex = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
@@ -0,0 +1,3 @@
1
+ import { ViewColumn } from 'vscode';
2
+ export declare function viewColumnOfInfoView(): ViewColumn;
3
+ export declare function viewColumnOfActiveTextEditor(): ViewColumn;
@@ -0,0 +1,22 @@
1
+ import { TabInputWebview, ViewColumn, window } from 'vscode';
2
+ export function viewColumnOfInfoView() {
3
+ for (const tabGroup of window.tabGroups.all) {
4
+ const tab = tabGroup.tabs.find(tab => tab.input instanceof TabInputWebview && tab.input.viewType === 'mainThreadWebview-lean4_infoview');
5
+ if (tab !== undefined) {
6
+ return tabGroup.viewColumn;
7
+ }
8
+ }
9
+ // We do not use `ViewColumn.Beside` here because `ViewColumn.Beside` will never
10
+ // add a tab to a locked tab group.
11
+ // This is especially problematic because locking the tab group of the InfoView
12
+ // is a workaround for https://github.com/microsoft/vscode/issues/212679
13
+ // and using `ViewColumn.Beside` will retain an empty locked tab group when restarting VS Code.
14
+ const activeColumn = window.activeTextEditor?.viewColumn;
15
+ if (activeColumn === undefined) {
16
+ return ViewColumn.Two;
17
+ }
18
+ return activeColumn + 1;
19
+ }
20
+ export function viewColumnOfActiveTextEditor() {
21
+ return window.activeTextEditor?.viewColumn ?? ViewColumn.One;
22
+ }
@@ -8,8 +8,9 @@
8
8
  "lib": ["es6", "ES2021", "es2020.string"],
9
9
  "sourceMap": true,
10
10
  "alwaysStrict": true,
11
- "rootDir": "./",
11
+ "rootDir": "../..",
12
12
  "noImplicitAny": true,
13
+ "noFallthroughCasesInSwitch": true,
13
14
  "strictNullChecks": true,
14
15
  "esModuleInterop": true
15
16
  },
@@ -5,7 +5,9 @@
5
5
  "strict": true,
6
6
  "lib": ["dom", "es6"],
7
7
  "rootDir": "../",
8
- "sourceMap": true
8
+ "sourceMap": true,
9
+ "module": "esnext",
10
+ "moduleResolution": "bundler"
9
11
  },
10
12
  "include": ["./**/*"]
11
13
  }
@@ -0,0 +1,7 @@
1
+ :root {
2
+ --vscode-font-weight:normal;
3
+ --vscode-font-size:13px;
4
+ --vscode-editor-font-family: 'JuliaMono', 'Source Code Pro', 'STIX Two Math', monospace;
5
+ --vscode-editor-font-weight:normal;
6
+ --vscode-editor-font-size:15px;
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lean4monaco",
3
- "version": "1.0.46",
3
+ "version": "1.1.0",
4
4
  "description": "Monaco Editor support for the Lean 4 theorem prover.",
5
5
  "keywords": [
6
6
  "lean",
@@ -42,14 +42,16 @@
42
42
  "test": "npm run demo:setup && concurrently --hide 0 --kill-others \"npm start\" \"wait-on http://localhost:5173 && cypress run\" -n server,cypress -s command-cypress"
43
43
  },
44
44
  "dependencies": {
45
- "@leanprover/infoview": "^0.7.3",
46
- "@leanprover/infoview-api": "^0.4.0",
47
- "@leanprover/unicode-input": "^0.1.2",
45
+ "@leanprover/infoview": "~0.8.5",
46
+ "@leanprover/infoview-api": "~0.7.0",
47
+ "@leanprover/unicode-input": "~0.1.4",
48
+ "@leanprover/unicode-input-component": "~0.1.4",
48
49
  "concurrently": "^8.2.2",
49
50
  "import-meta-resolve": "^4.1.0",
50
51
  "memfs": "^4.9.3",
51
52
  "monaco-editor-wrapper": "^5.3.1",
52
- "semver": "^7.6.2"
53
+ "semver": "^7.6.2",
54
+ "zod": "^3.22.4"
53
55
  },
54
56
  "devDependencies": {
55
57
  "@types/node": "^22.1.0",