Repository navigation
chore(example): rebuild the monaco-editor example with Vite - #264
Merged
Merged
Conversation
- Replace webpack + Svelte + monaco-languageclient 0.13 with Vite and monaco-editor, plus a small LSP bridge (src/lspClient.ts) covering what the server implements: text sync, diagnostics, completion, code actions, workspace/applyEdit, executeCommand and the custom notifications - server/server.ts runs sql-language-server per WebSocket connection on /lsp and serves dist/ when built; Vite proxies /lsp during development - Replace the sequelize migrations with db/init.sql, loaded by postgres and mysql through docker-entrypoint-initdb.d and into sqlite by setup:sqlite - The example now works without Docker using sqlite - docker-compose: drop --openssl-legacy-provider and x86_64 platform pins, use new volume names for postgres 17 / mysql 8.4 data, and keep the pnpm store in a volume instead of the mounted repository - Type-check and build the example in CI
pnpm 11 reads pnpm_config_* environment variables, so npm_config_store_dir was ignored and the store was still created in the mounted repository.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 7 of the maintenance plan: rebuild
example/monaco_editor.Why not monaco-languageclient
The current monaco-languageclient (11.x) depends on ~35
@codingame/monaco-vscode-*packages that get major releases every few weeks, which is a lot of upkeep for a one-page demo. monaco-editor's own native LSP client (lsp.MonacoLspClient, 0.55+) only exposesnew MonacoLspClient(transport), so it cannot sendrootPath, listen to the server's custom notifications (sqlLanguageServer.finishSetup/error), or sendworkspace/executeCommand. So this uses a small hand-written bridge instead.What's here
src/lspClient.ts(~270 lines): text sync, publishDiagnostics -> markers, completion, code actions (with the original LSP diagnostics),workspace/applyEdit,workspace/configuration,executeCommand, custom notifications, auto-reconnect when the server restartsserver/server.ts: runs sql-language-server in-process per WebSocket connection on/lsp(viavscode-ws-jsonrpc); also servesdist/afterpnpm builddb/init.sql: one sample schema for all adapters. Postgres / MySQL load it viadocker-entrypoint-initdb.d;pnpm setup:sqlitecreatessample.sqlite3withnode:sqlite. The example now works without Docker (sqlite).docker-compose
NODE_OPTIONS=--openssl-legacy-provider(webpack 4-era workaround) and thelinux/x86_64platform pinspostgres17/mysql84, so old postgres 10 data does not break startuppnpm_config_store_dir; pnpm 11 ignoresnpm_config_*). Before,pnpm installinside the container created.pnpm-store/in the mounted repository.CI
pnpm typecheckincludes the example, and CI runsvite buildfor itTest plan
pnpm dev(Vite) andpnpm build && pnpm start: lint squiggles appear,SELECT * FROMcompletion listsusers/postsfrom sqlite, "Fix all auto-fixable problems" rewrites the query, no page errorsdocker compose upfrom fresh node_modules volumes: install succeeds, no.pnpm-store/is created in the repository, the connection selector lists sqlite / postgres / mysql, and completion listsusers/postsfor sqlite andpostgres_db.users/mysql_db.usersafter switchingKnown server issue found while testing (not changed here)
SettingStore.setSettingmerges the new connection into the previous state (Object.assign({}, this.state, newSetting)), so fields the new connection does not set leak from the old one. After switching mysql -> sqlite, completion showsmysql_db.usersfor sqlite tables. The same happens in VS Code. Worth a separate fix.