-
Notifications
You must be signed in to change notification settings - Fork 47
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
Can not load language due to _EditorSimpleWorker.loadForeignModule error #87
Comments
You need to make sure that the Monaco Editor version is |
It won't help, because the root cause is import from src/workers/TrinoSQLWorker.js import TrinoSQL from 'dt-sql-parser/dist/parser/trinosql';
import { BaseSQLWorker } from 'monaco-sql-languages/out/esm/baseSQLWorker';
export class TrinoSQLWorker extends BaseSQLWorker {
constructor(ctx) {
super();
this._ctx = ctx;
this.parser = new TrinoSQL();
}
}
export function create(ctx, createData) {
return new TrinoSQLWorker(ctx, createData);
} src/workers/trinosql.worker.js import * as EditorWorker from 'monaco-editor/esm/vs/editor/editor.worker';
import { TrinoSQLWorker } from './TrinoSQLWorker.js';
self.onmessage = () => {
EditorWorker.initialize((ctx, createData) => {
return new TrinoSQLWorker(ctx, createData);
});
}; Also I'd like to mention that language support works fine with latest |
Can you provide the versions of the dependencies associated with this problem in your project? Includes vite, monaco-sql-languages and React Monaco Editor. Of course, the best-case scenario is that you create a minimal demo that reproduces the problem, if you will. This will help us resolve the issue faster |
Sure, here they are (changing monaco version to 0.31.0 won't change anything): {
"monaco-editor": "^0.44.0",
"@monaco-editor/react": "^4.6.0",
"monaco-sql-languages": "^0.12.0-beta.7",
"vite": "^5.0.6",
}
I'll try to provide a sandbox. |
Yes, monaco-sql-languagues works with the latest version of monaco-editor in most cases. However, this depends on whether the latest version of monaco-editor changes to the handling of languageWorkers. |
Sorry for being late with repro. Great that you've found this bug. |
Indeed, I'm experiencing the same problem. The codebase registers the syntax correctly, but using the yarn add monaco-sql-languages dependency causes the registration to fail. Even if I build with webpack and install the correct dependencies, it still prompts an assertion error message. I also can't resolve the syntax error message caused by using vite webpack build error message /* config-overrides.js */
/*
...
Consistent with monaco-sql-languages#using-the-monaco-editor-webpack-plugin configuration
...
*/
module.exports = function override(config, env) {
config.plugins = [...config.plugins, monacoWebpackPlugin];
return config;
}; webpack - package.json "@dtinsight/molecule": "^1.3.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"monaco-sql-languages": "^0.12.0-beta.7",
"reflect-metadata": "^0.1.13",
"rollup-plugin-node-polyfills": "^0.2.1",
"rollup-plugin-polyfill-node": "^0.12.0",
"util": "link:rollup-plugin-node-polyfills/polyfills/util",
"assert": "link:rollup-plugin-node-polyfills/polyfills/assert",
"buffer": "^6.0.3" |
@resetsix You need to install the assert package to fix this. see webpack doc about this problem . |
Glad to receive your reply. I also found out that the reason for the error report is that webpack no longer provides However, I have a new problem, after registering the syntax with Although
my "@dtinsight/molecule": "^1.3.0",
"monaco-editor-webpack-plugin": "^7.1.0",
"monaco-sql-languages": "^0.12.0-beta.7",
"dt-sql-parser": "^4.0.0-beta.4.8",
"assert": "^2.1.0",
"util": "^0.12.5" It's a real pain in the ass. |
@resetsix @glebcha Regarding the sourceMap of dt-sql-parser, we will release a new package to remove the sourceMap in the near future. In fact, dt-sql-parser is compiled using tsc only, and sourceMap is not required. Previously, our main focus was on supporting more sql-languages, and I'm sorry that these issues have caused you so much trouble. We'll resolve integration issues as soon as possible and provide examples of integrations. |
Thank you so much, really appreciate your help! Please ping me to test new implementations, will be happy to help you. |
I'm also more than willing to help with testing in any way I can if I can |
Correlation issue vite #15359 |
Referring to monaco-sql-languages-vite, this issue can be bypassed. This may not be the ultimate solution, I'll keep track of the issue. The relevant integration documentation will be updated at a later date. |
@resetsix Version |
I see,thank u for all your efforts |
Integrating samples and integrating doc are all done now. Integration in Vite is still not supported at this time. |
Can I count on your support with Vite integration? |
I'm following up on this issue, but there's no more progress at the moment. The Monaco SQL Languages website is currently being built with vite, but it requires |
Is there any progress on this issue? We are planning to move to Monaco but this is a blocker. |
@HaydenOrz Monaco SQL Languages is broken with [email protected], but only in production build. UPDATE: This setup works fine import 'monaco-editor/esm/vs/editor/browser/coreCommands.js';
import 'monaco-editor/esm/vs/editor/contrib/comment/browser/comment.js';
import 'monaco-editor/esm/vs/editor/contrib/comment/browser/blockCommentCommand.js';
import 'monaco-editor/esm/vs/editor/contrib/comment/browser/lineCommentCommand.js';
import 'monaco-editor/esm/vs/editor/contrib/find/browser/findController.js';
import 'monaco-editor/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js';
import 'monaco-editor/esm/vs/editor/contrib/snippet/browser/snippetController2.js';
import 'monaco-editor/esm/vs/editor/contrib/suggest/browser/suggestController.js';
import 'monaco-sql-languages/out/esm/trinosql/trinosql.contribution';
import {
setupLanguageFeatures,
LanguageIdEnum,
} from 'monaco-sql-languages';
import { initMonacoEnvironment } from './language-worker.ts';
export function initMonacoEditor() {
initMonacoEnvironment();
setupLanguageFeatures({
languageId: LanguageIdEnum.TRINO,
});
} |
Sorry, there is no further progress at this time. We plan to replace the antlr4 runtime of dt-sql-parser with antlr4ng in the future, which should fix the issue, but it will take a lot of time. |
Thanks for your efforts, There are currently ways to work around this issue using some unofficial plugins, such as the approach taken by the monaco-sql-languagues website. However, as mentioned in the documentation, this is not a final solution and we hope that monaco-sql-languages can be easily integrated into vite projects without introducing any additional overhead. |
@glebcha @ankit-shopflo @resetsix Hi, here's the happy news. I've done my preliminary work on the antlr4 runtime migration of dt-sql-parser DTStack/dt-sql-parser#261, and it's been much smoother than expected. Now you can install In this release, the issue of integration with Vite has been resolved. In addition , dependencies such as You can see the latest integration documentation and the latest integration examples on this branch |
@glebcha @ankit-shopflo @resetsix monaco-sql-languages 0.12.0-beta.11 has been released: We have confirmed that the issue is fixed on this version, please install this version to fix this issue. In addition to this, there are some breaking changes on this release, if the upgrade causes an exception, please check the latest documentation. This issue will be closed within a week if it is not active. |
@HaydenOrz thank you so much for efforts! P.S.: do you have plans to support the latest monaco version? |
At the moment it looks like moanco-sql-lanuages already supports the latest version of monaco. I didn't see any issues when monaco-sql-languages was running on the latest monaco. But this needs more testing. If you find that monaco-sql-languages is running unexpectedly on the latest version of monaco, please let us know by opening a new issue. |
Using Vite and standard configuration like yours https://github.com/DTStack/monaco-sql-languages/blob/main/website/vite.config.ts
languageWorker.ts
monacoInit.ts
Editor.tsx
The text was updated successfully, but these errors were encountered: