Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change from webpack to vite #3

Merged
merged 14 commits into from
Oct 27, 2023
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
client/dist
server/build
client/public/package_versions.json
dist
Binary file removed client/public/onigasm.wasm
Binary file not shown.
1 change: 0 additions & 1 deletion client/src/editor/abbreviation/AbbreviationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export class AbbreviationProvider {
// );
}

@computed
private get symbolsByAbbreviation(): SymbolsByAbbreviation {
// There are only like 1000 symbols. Building an index is not required yet.
return {
Expand Down
26 changes: 13 additions & 13 deletions client/src/editor/leanclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
PublishDiagnosticsParams,
CloseAction, ErrorAction,
RevealOutputChannelOn,
State
} from 'monaco-languageclient'
import { State } from 'vscode-languageclient'
import * as ls from 'vscode-languageserver-protocol'
import { toSocket, WebSocketMessageReader, WebSocketMessageWriter } from 'vscode-ws-jsonrpc'

Expand Down Expand Up @@ -606,16 +606,16 @@ export class LeanClient implements Disposable {
// return false
// }

private extractVersion (v: string | undefined): SemVer {
if (!v) return new SemVer('0.0.0')
const prefix = 'Lake version'
if (v.startsWith(prefix)) v = v.slice(prefix.length).trim()
const pos = v.indexOf('(')
if (pos > 0) v = v.slice(0, pos).trim()
try {
return new SemVer(v)
} catch {
return new SemVer('0.0.0')
}
}
// private extractVersion (v: string | undefined): SemVer {
// if (!v) return new SemVer('0.0.0')
// const prefix = 'Lake version'
// if (v.startsWith(prefix)) v = v.slice(prefix.length).trim()
// const pos = v.indexOf('(')
// if (pos > 0) v = v.slice(0, pos).trim()
// try {
// return new SemVer(v)
// } catch {
// return new SemVer('0.0.0')
// }
// }
joneugster marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 3 additions & 1 deletion client/src/monacoSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js'
import { MonacoServices } from 'monaco-languageclient';
import { StandaloneServices } from 'vscode/services';
import getMessageServiceOverride from 'vscode/service-override/messages';
//@ts-ignore
import onigasmUrl from 'onigasm/lib/onigasm.wasm?url'

export function monacoSetup () {

Expand Down Expand Up @@ -62,7 +64,7 @@ export function monacoSetup () {
// Load onigasm
(async () => {
try {
await loadWASM('./onigasm.wasm')
await loadWASM(onigasmUrl)
} catch (err) {
// Hot module replacement can cause us to run this code twice and that's ok.
if (!(err as Error).message?.startsWith('Onigasm#init has been called')) {
Expand Down
28 changes: 28 additions & 0 deletions index.html
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought files from client/public are copied to the server. Why do we need this copy?

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8" />
<title>Lean 4 Web</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>
<div id="root"></div>
<noscript>
<p>You need to enable JavaScript to use the lean4web editor, as it is a <a href="https://react.dev">React app</a>.</p>
<p>Contact details:</p>
<p>
<a href="https://www.math.hhu.de/lehrstuehle-/-personen-/-ansprechpartner/innen/lehrstuehle-des-mathematischen-instituts/lehrstuhl-fuer-algebraische-geometrie/team/dr-alexander-bentkamp">Alexander Bentkamp</a>,&nbsp;
<a href="https://www.math.hhu.de/lehrstuehle-/-personen-/-ansprechpartner/innen/lehrstuehle-des-mathematischen-instituts/lehrstuhl-fuer-algebraische-geometrie/team/jon-eugster">Jon Eugster</a><br />
Mathematisches Institut der Heinrich-Heine-Universität Düsseldorf<br />
Universitätsstr. 1<br />
40225 Düsseldorf<br />
Germany<br />
+49 211 81-12173<br />
</p>
</noscript>
<script type="module" src="/client/src/index.tsx"></script>
</body>

</html>
Loading