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,16 +1,22 @@
1
- import { Disposable, DocumentHighlightKind, EventEmitter, ProgressLocation, Range, window, workspace, } from 'vscode';
2
- import { DiagnosticSeverity, RevealOutputChannelOn, State, } from 'vscode-languageclient/node';
3
- import { getElaborationDelay, getFallBackToStringOccurrenceHighlighting, shouldAutofocusOutput } from './config';
1
+ import { Disposable, DocumentHighlightKind, EventEmitter, ProgressLocation, Range, window, } from 'vscode';
2
+ import { DiagnosticSeverity, LanguageClient, RevealOutputChannelOn, State, } from 'vscode-languageclient/node';
3
+ import { getElaborationDelay, getFallBackToStringOccurrenceHighlighting, serverArgs, serverLoggingEnabled, serverLoggingPath, shouldAutofocusOutput, } from './config';
4
4
  import { logger } from './utils/logger';
5
5
  // @ts-ignore
6
6
  import { SemVer } from 'semver';
7
- import { c2pConverter, p2cConverter, patchConverters, setDependencyBuildMode } from './utils/converters';
7
+ import { formatCommandExecutionOutput } from './utils/batch';
8
+ import { c2pConverter, p2cConverter, patchConverters, setDependencyBuildMode, } from './utils/converters';
9
+ import { elanInstalledToolchains } from './utils/elan';
8
10
  import { parseExtUri, toExtUri } from './utils/exturi';
9
- import { displayError, displayErrorWithOptionalInput, displayErrorWithOutput, displayInformationWithOptionalInput, } from './utils/notifs';
10
- import path from 'path';
11
+ import { lean } from './utils/leanEditorProvider';
12
+ import { displayNotification, displayNotificationWithOptionalInput, displayNotificationWithOutput, } from './utils/notifs';
13
+ import { willUseLakeServer } from './utils/projectInfo';
14
+ const leanClientCapabilities = {
15
+ silentDiagnosticSupport: true,
16
+ };
11
17
  const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
12
18
  export class LeanClient {
13
- setupClient;
19
+ setupLanguageClient;
14
20
  running;
15
21
  client;
16
22
  outputChannel;
@@ -18,7 +24,6 @@ export class LeanClient {
18
24
  subscriptions = [];
19
25
  noPrompt = false;
20
26
  showingRestartMessage = false;
21
- elanDefaultToolchain;
22
27
  isRestarting = false;
23
28
  staleDepNotifier;
24
29
  openServerDocuments = new Set();
@@ -47,16 +52,11 @@ export class LeanClient {
47
52
  restartedWorker = this.restartedWorkerEmitter.event;
48
53
  serverFailedEmitter = new EventEmitter();
49
54
  serverFailed = this.serverFailedEmitter.event;
50
- constructor(folderUri, outputChannel, elanDefaultToolchain, setupClient) {
51
- this.setupClient = setupClient;
52
- this.outputChannel = outputChannel; // can be null when opening adhoc files.
55
+ constructor(folderUri, outputChannel, setupLanguageClient) {
56
+ this.setupLanguageClient = setupLanguageClient;
57
+ this.outputChannel = outputChannel;
53
58
  this.folderUri = folderUri;
54
- this.elanDefaultToolchain = elanDefaultToolchain;
55
- this.subscriptions.push(new Disposable(() => {
56
- if (this.staleDepNotifier) {
57
- this.staleDepNotifier.dispose();
58
- }
59
- }));
59
+ this.subscriptions.push(new Disposable(() => this.staleDepNotifier?.dispose()));
60
60
  }
61
61
  dispose() {
62
62
  this.subscriptions.forEach(s => s.dispose());
@@ -81,25 +81,49 @@ export class LeanClient {
81
81
  restartItem = 'Restart Lean Server on this file';
82
82
  messageTitle = 'The Lean Server has stopped processing this file.';
83
83
  }
84
- displayErrorWithOptionalInput(messageTitle, restartItem, () => {
85
- if (restartFile && uri !== undefined) {
86
- const document = workspace.textDocuments.find(doc => uri.equalsUri(doc.uri));
87
- if (document) {
88
- void this.restartFile(document);
89
- }
90
- }
91
- else {
92
- void this.start();
93
- }
94
- }, finalizer);
84
+ displayNotificationWithOptionalInput('Error', messageTitle, [
85
+ {
86
+ input: restartItem,
87
+ action: () => {
88
+ if (restartFile && uri !== undefined) {
89
+ const document = lean.getLeanDocumentByUri(uri);
90
+ if (document !== undefined) {
91
+ void this.restartFile(document);
92
+ }
93
+ }
94
+ else {
95
+ void this.start();
96
+ }
97
+ },
98
+ },
99
+ ], finalizer);
95
100
  }
96
101
  async restart() {
97
102
  if (this.isRestarting) {
98
- displayError('Client is already being started.');
103
+ displayNotification('Error', 'Client is already being started.');
99
104
  return;
100
105
  }
101
106
  this.isRestarting = true;
102
107
  try {
108
+ let defaultToolchain;
109
+ if (this.folderUri.scheme === 'untitled') {
110
+ const installedToolchainsResult = await elanInstalledToolchains();
111
+ switch (installedToolchainsResult.kind) {
112
+ case 'Success':
113
+ if (installedToolchainsResult.defaultToolchain === undefined) {
114
+ this.serverFailedEmitter.fire('No default Lean version set - cannot launch client for untitled file.');
115
+ return;
116
+ }
117
+ defaultToolchain = installedToolchainsResult.defaultToolchain;
118
+ break;
119
+ case 'ElanNotFound':
120
+ defaultToolchain = undefined;
121
+ break;
122
+ case 'ExecutionError':
123
+ this.serverFailedEmitter.fire(`Cannot determine Lean version information for launching a client for an untitled file: ${installedToolchainsResult.message}`);
124
+ return;
125
+ }
126
+ }
103
127
  logger.log('[LeanClient] Restarting Lean Server');
104
128
  if (this.isStarted()) {
105
129
  await this.stop();
@@ -107,21 +131,54 @@ export class LeanClient {
107
131
  this.restartingEmitter.fire(undefined);
108
132
  const progressOptions = {
109
133
  location: ProgressLocation.Notification,
110
- title: 'Starting Lean language client',
134
+ title: '[Server Startup] Starting Lean language server and cloning missing packages [(Click for details)](command:lean4.troubleshooting.showOutput)',
111
135
  cancellable: false,
112
136
  };
113
- await window.withProgress(progressOptions, async (progress) => await this.startClient(progress));
137
+ await window.withProgress(progressOptions, async (progress) => await this.startClient(progress, defaultToolchain));
114
138
  }
115
139
  finally {
116
140
  this.isRestarting = false;
117
141
  }
118
142
  }
119
- async startClient(progress) {
143
+ async determineToolchainOverride(defaultToolchain) {
144
+ /*
145
+ const cwdUri = this.folderUri.scheme === 'file' ? this.folderUri : undefined
146
+ const toolchainDecision = await leanRunner.decideToolchain({
147
+ channel: this.outputChannel,
148
+ context: 'Server Startup',
149
+ cwdUri,
150
+ toolchainUpdateMode: 'PromptAboutUpdate',
151
+ })
152
+
153
+ if (toolchainDecision.kind === 'Error') {
154
+ return toolchainDecision
155
+ }
156
+
157
+ if (toolchainDecision.kind === 'RunWithSpecificToolchain') {
158
+ return { kind: 'Override', toolchain: toolchainDecision.toolchain }
159
+ }
160
+
161
+ toolchainDecision.kind satisfies 'RunWithActiveToolchain'
162
+
163
+ if (this.folderUri.scheme === 'untitled' && defaultToolchain !== undefined) {
164
+ // Fixes issue #227, for adhoc files it would pick up the cwd from the open folder
165
+ // which is not what we want. For adhoc files we want the (default) toolchain instead.
166
+ return { kind: 'Override', toolchain: defaultToolchain }
167
+ }
168
+ */
169
+ return { kind: 'NoOverride' };
170
+ }
171
+ async startClient(progress, defaultToolchain) {
120
172
  // Should only be called from `restart`
121
173
  const startTime = Date.now();
122
- progress.report({ increment: 0 });
123
- this.client = await this.setupClient(this.obtainClientOptions(), this.folderUri, this.elanDefaultToolchain);
124
- patchConverters(this.client.protocol2CodeConverter, this.client.code2ProtocolConverter);
174
+ progress.report({});
175
+ const toolchainOverrideResult = await this.determineToolchainOverride(defaultToolchain);
176
+ if (toolchainOverrideResult.kind === 'Error') {
177
+ this.serverFailedEmitter.fire(`Error while starting client: ${toolchainOverrideResult.message}`);
178
+ return;
179
+ }
180
+ const toolchainOverride = toolchainOverrideResult.kind === 'Override' ? toolchainOverrideResult.toolchain : undefined;
181
+ this.client = await this.setupLanguageClient(this.obtainClientOptions());
125
182
  let insideRestart = true;
126
183
  try {
127
184
  this.client.onDidChangeState(async (s) => {
@@ -148,7 +205,6 @@ export class LeanClient {
148
205
  }
149
206
  }
150
207
  });
151
- progress.report({ increment: 80 });
152
208
  await this.client.start();
153
209
  const version = this.client.initializeResult?.serverInfo?.version;
154
210
  if (version && new SemVer(version).compare('0.2.0') < 0) {
@@ -166,7 +222,6 @@ export class LeanClient {
166
222
  this.outputChannel.appendLine(msg);
167
223
  this.serverFailedEmitter.fire(msg);
168
224
  insideRestart = false;
169
- return;
170
225
  }
171
226
  // HACK(WN): Register a default notification handler to fire on custom notifications.
172
227
  // A mechanism to do this is provided in vscode-jsonrpc. One can register a `StarNotificationHandler`
@@ -199,7 +254,7 @@ export class LeanClient {
199
254
  const finalizer = () => {
200
255
  stderrMsgBoxVisible = false;
201
256
  };
202
- displayErrorWithOutput(`Lean server printed an error:\n${chunk.toString()}`, finalizer);
257
+ displayNotificationWithOutput('Error', `Lean server printed an error:\n${chunk.toString()}`, [], finalizer);
203
258
  }
204
259
  });
205
260
  this.restartedEmitter.fire(undefined);
@@ -210,7 +265,7 @@ export class LeanClient {
210
265
  if (fileUri === undefined) {
211
266
  return;
212
267
  }
213
- const fileName = fileUri.scheme === 'file' ? path.basename(fileUri.fsPath) : 'untitled';
268
+ const fileName = fileUri.scheme === 'file' ? fileUri.baseName() : 'untitled';
214
269
  const isImportsOutdatedError = params.diagnostics.some(d => d.severity === DiagnosticSeverity.Error &&
215
270
  d.message.includes('Imports are out of date and must be rebuilt') &&
216
271
  d.range.start.line === 0 &&
@@ -222,25 +277,34 @@ export class LeanClient {
222
277
  }
223
278
  const message = `Imports of '${fileName}' are out of date and must be rebuilt. Restarting the file will rebuild them.`;
224
279
  const input = 'Restart File';
225
- displayInformationWithOptionalInput(message, input, () => {
226
- const document = workspace.textDocuments.find(doc => fileUri.equalsUri(doc.uri));
227
- if (!document || document.isClosed) {
228
- displayError(`'${fileName}' was closed in the meantime. Imports will not be rebuilt.`);
229
- return;
230
- }
231
- void this.restartFile(document);
232
- });
280
+ displayNotificationWithOptionalInput('Information', message, [
281
+ {
282
+ input,
283
+ action: () => {
284
+ const document = lean.getLeanDocumentByUri(fileUri);
285
+ if (document === undefined) {
286
+ displayNotification('Error', `'${fileName}' was closed in the meantime. Imports will not be rebuilt.`);
287
+ return;
288
+ }
289
+ void this.restartFile(document);
290
+ },
291
+ },
292
+ ]);
233
293
  }
234
294
  async withStoppedClient(action) {
235
295
  if (this.isRestarting) {
236
296
  return 'IsRestarting';
237
297
  }
238
298
  this.isRestarting = true; // Ensure that client cannot be restarted in the mean-time
239
- if (this.isStarted()) {
240
- await this.stop();
299
+ try {
300
+ if (this.isStarted()) {
301
+ await this.stop();
302
+ }
303
+ await action();
304
+ }
305
+ finally {
306
+ this.isRestarting = false;
241
307
  }
242
- await action();
243
- this.isRestarting = false;
244
308
  await this.restart();
245
309
  return 'Success';
246
310
  }
@@ -286,27 +350,31 @@ export class LeanClient {
286
350
  this.openServerDocuments = new Set();
287
351
  this.running = false;
288
352
  }
289
- async restartFile(doc) {
290
- if (this.client === undefined || !this.running)
291
- return; // there was a problem starting lean server.
292
- const docUri = toExtUri(doc.uri);
293
- if (docUri === undefined) {
353
+ async restartFile(leanDoc) {
354
+ const extUri = leanDoc.extUri;
355
+ const formattedFileName = extUri.scheme === 'file' ? extUri.baseName() : extUri.toString();
356
+ const formattedProjectName = this.folderUri.scheme === 'file' ? this.folderUri.fsPath : this.folderUri.toString();
357
+ if (this.client === undefined || !this.running) {
358
+ displayNotification('Error', `Cannot restart '${formattedFileName}': The language server for the project at '${formattedProjectName}' is stopped.`);
294
359
  return;
295
360
  }
296
- if (!this.isInFolderManagedByThisClient(docUri)) {
361
+ if (!this.isInFolderManagedByThisClient(extUri)) {
362
+ displayNotification('Error', `Cannot restart '${formattedFileName}': The project at '${formattedProjectName}' does not contain the file.`);
297
363
  return;
298
364
  }
299
- const uri = docUri.toString();
365
+ const uri = extUri.toString();
300
366
  if (!this.openServerDocuments.delete(uri)) {
367
+ displayNotification('Error', `Cannot restart '${formattedFileName}': The file has never been opened in the language server for the project at '${formattedProjectName}'.`);
301
368
  return;
302
369
  }
303
370
  logger.log(`[LeanClient] Restarting File: ${uri}`);
304
- await this.client.sendNotification('textDocument/didClose', this.client.code2ProtocolConverter.asCloseTextDocumentParams(doc));
371
+ await this.client.sendNotification('textDocument/didClose', this.client.code2ProtocolConverter.asCloseTextDocumentParams(leanDoc.doc));
305
372
  if (this.openServerDocuments.has(uri)) {
373
+ displayNotification('Error', `Cannot restart '${formattedFileName}': The file has already been opened in the language server for the project at '${formattedProjectName}' since initiating the restart.`);
306
374
  return;
307
375
  }
308
376
  this.openServerDocuments.add(uri);
309
- await this.client.sendNotification('textDocument/didOpen', setDependencyBuildMode(this.client.code2ProtocolConverter.asOpenTextDocumentParams(doc), 'once'));
377
+ await this.client.sendNotification('textDocument/didOpen', setDependencyBuildMode(this.client.code2ProtocolConverter.asOpenTextDocumentParams(leanDoc.doc), 'once'));
310
378
  this.restartedWorkerEmitter.fire(uri);
311
379
  }
312
380
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
@@ -314,7 +382,7 @@ export class LeanClient {
314
382
  return this.running && this.client
315
383
  ? this.client.sendRequest(method, params)
316
384
  : new Promise((_, reject) => {
317
- reject('Client is not running');
385
+ reject('No connection to Lean');
318
386
  });
319
387
  }
320
388
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
@@ -327,6 +395,40 @@ export class LeanClient {
327
395
  get initializeResult() {
328
396
  return this.running ? this.client?.initializeResult : undefined;
329
397
  }
398
+ async determineServerOptions(toolchainOverride) {
399
+ const env = Object.assign({}, process.env);
400
+ if (serverLoggingEnabled()) {
401
+ env.LEAN_SERVER_LOG_DIR = serverLoggingPath();
402
+ }
403
+ const [serverExecutable, options] = await this.determineExecutable();
404
+ if (toolchainOverride) {
405
+ options.unshift('+' + toolchainOverride);
406
+ }
407
+ const cwd = this.folderUri.scheme === 'file' ? this.folderUri.fsPath : undefined;
408
+ if (cwd) {
409
+ // Add folder name to command-line so that it shows up in `ps aux`.
410
+ options.push(cwd);
411
+ }
412
+ else {
413
+ options.push('untitled');
414
+ }
415
+ return {
416
+ command: serverExecutable,
417
+ args: options.concat(serverArgs()),
418
+ options: {
419
+ cwd,
420
+ env,
421
+ },
422
+ };
423
+ }
424
+ async determineExecutable() {
425
+ if (await willUseLakeServer(this.folderUri)) {
426
+ return ['lake', ['serve', '--']];
427
+ }
428
+ else {
429
+ return ['lean', ['--server']];
430
+ }
431
+ }
330
432
  obtainClientOptions() {
331
433
  const documentSelector = {
332
434
  language: 'lean4',
@@ -334,10 +436,11 @@ export class LeanClient {
334
436
  let workspaceFolder;
335
437
  documentSelector.scheme = this.folderUri.scheme;
336
438
  if (this.folderUri.scheme === 'file') {
337
- documentSelector.pattern = `${this.folderUri.fsPath}/**/*`;
439
+ const escapedPath = this.folderUri.fsPath.replace(/[?*()[\]{}]/g, '[$&]');
440
+ documentSelector.pattern = `${escapedPath}/**/*`;
338
441
  workspaceFolder = {
339
442
  uri: this.folderUri.asUri(),
340
- name: path.basename(this.folderUri.fsPath),
443
+ name: this.folderUri.baseName(),
341
444
  index: 0, // the language client library does not actually need this index
342
445
  };
343
446
  }
@@ -356,7 +459,8 @@ export class LeanClient {
356
459
  },
357
460
  middleware: {
358
461
  handleDiagnostics: (uri, diagnostics, next) => {
359
- next(uri, diagnostics);
462
+ const diagnosticsInVsCode = diagnostics.filter(d => !('isSilent' in d && d.isSilent));
463
+ next(uri, diagnosticsInVsCode);
360
464
  const uri_ = c2pConverter.asUri(uri);
361
465
  const diagnostics_ = [];
362
466
  for (const d of diagnostics) {
@@ -436,4 +540,23 @@ export class LeanClient {
436
540
  },
437
541
  };
438
542
  }
543
+ async setupClient(toolchainOverride) {
544
+ const serverOptions = await this.determineServerOptions(toolchainOverride);
545
+ const clientOptions = this.obtainClientOptions();
546
+ this.outputChannel.appendLine(formatCommandExecutionOutput(serverOptions.options?.cwd, serverOptions.command, serverOptions.args ?? []));
547
+ const client = new LanguageClient('lean4', 'Lean 4', serverOptions, clientOptions);
548
+ const leanCapabilityFeature = {
549
+ initialize(_1, _2) { },
550
+ getState() {
551
+ return { kind: 'static' };
552
+ },
553
+ fillClientCapabilities(capabilities) {
554
+ capabilities.lean = leanClientCapabilities;
555
+ },
556
+ clear() { },
557
+ };
558
+ client.registerFeature(leanCapabilityFeature);
559
+ patchConverters(client.protocol2CodeConverter, client.code2ProtocolConverter);
560
+ return client;
561
+ }
439
562
  }
@@ -1,11 +1,43 @@
1
1
  import { Disposable, ExtensionContext } from 'vscode';
2
2
  import { LeanClientProvider } from './utils/clientProvider';
3
+ import { LeanDiagnostic } from './utils/converters';
4
+ type DiagStart = 'None' | {
5
+ kind: 'Error' | 'Warning' | 'GoalsAccomplished';
6
+ range: 'SingleLine' | 'MultiLine';
7
+ };
8
+ interface DiagnosticGutterDeco {
9
+ line: number;
10
+ diagStart: DiagStart;
11
+ isPreviousDiagContinue: boolean;
12
+ isPreviousDiagEnd: boolean;
13
+ }
14
+ declare const diagnosticGutterDecoKinds: readonly ["error", "error-init", "error-i", "error-i-passthrough", "error-l", "error-l-passthrough", "error-t", "error-t-passthrough", "warning", "warning-i-passthrough", "warning-l-passthrough", "warning-t-passthrough", "goals-accomplished-checkmark", "goals-accomplished-checkmark-i-passthrough", "goals-accomplished-checkmark-l-passthrough", "goals-accomplished-checkmark-t-passthrough", "goals-accomplished-circled-checkmark", "goals-accomplished-circled-checkmark-i-passthrough", "goals-accomplished-circled-checkmark-l-passthrough", "goals-accomplished-circled-checkmark-t-passthrough", "goals-accomplished-octopus", "goals-accomplished-octopus-i-passthrough", "goals-accomplished-octopus-l-passthrough", "goals-accomplished-octopus-t-passthrough", "goals-accomplished-tada", "goals-accomplished-tada-i-passthrough", "goals-accomplished-tada-l-passthrough", "goals-accomplished-tada-t-passthrough"];
15
+ type DiagnosticGutterDecoKind = (typeof diagnosticGutterDecoKinds)[number];
3
16
  export declare class LeanTaskGutter implements Disposable {
4
- private decorations;
5
- private status;
17
+ private context;
18
+ private processingDecorationType;
19
+ private fatalErrorDecorationType;
20
+ private unsolvedGoalsDecorationType;
21
+ private diagnosticGutterDecorationTypes;
6
22
  private gutters;
7
23
  private subscriptions;
24
+ private showDiagnosticGutterDecorations;
25
+ private goalsAccomplishedDecorationKind;
26
+ private showUnsolvedGoalsDecoration;
8
27
  constructor(client: LeanClientProvider, context: ExtensionContext);
9
- private updateDecos;
28
+ private checkContext;
29
+ private getGutter;
30
+ private onDidChangeColorTheme;
31
+ private onDidReveal;
32
+ private onProgressChanged;
33
+ private onDiagnosticsChanged;
34
+ private computeDiagnosticGutterDecoStates;
35
+ computeDiagnosticGutterDecos(diagnostics: LeanDiagnostic[]): DiagnosticGutterDeco[];
36
+ isGutterDecoDiagnostic(d: LeanDiagnostic): boolean;
37
+ getGoalsAccomplishedDiagnosticGutterDecoKindName(): string;
38
+ determineSingleLineDiagnosticGutterDecoKind(d: DiagnosticGutterDeco, name: string): DiagnosticGutterDecoKind;
39
+ determineDiagnosticGutterDecoKind(d: DiagnosticGutterDeco): DiagnosticGutterDecoKind | undefined;
40
+ private computeUnsolvedGoalsDecoState;
10
41
  dispose(): void;
11
42
  }
43
+ export {};