-
Notifications
You must be signed in to change notification settings - Fork 5
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
Editor & Linter #3
Comments
This is a follow up on my comment here: erosman/support#632 (comment) It took a while because I had lost my drive that contained my Monaco version and for some reason deleted my fork of erosman/support that also contained that version. Here is the latest commit that I could find, if you are curious about how I implemented Manaco. Note on building
You'll need to edit a couple of files diff --git a/.scripts/generateVersion.js b/.scripts/generateVersion.js
index d3d359f..7d2b28d 100644
--- a/.scripts/generateVersion.js
+++ b/.scripts/generateVersion.js
@@ -3,9 +3,9 @@ import git from 'isomorphic-git'
const pad = (cal) => (cal < 10 ? '0' : '') + cal
const logs = await git.log({
fs,
- dir: '/home/admin/Repos/github.com/DrakeTDL/FireMonkey',
- ref: 'modifications'
fs,
+ dir: '</path/to/source>',
+ ref: '282bcabfb54f5aca15a42b331527203285309f1c'
})
// const dates: Set<[number, number]> = new Set()
let dates = {}
diff --git a/web-ext-config.js b/web-ext-config.js
index 19d6d95..df5888c 100644
--- a/web-ext-config.js
+++ b/web-ext-config.js
@@ -1,7 +1,7 @@
import { writeFile } from "fs/promises"
import webExt from "web-ext"
import generateVersion from './.scripts/generateVersion.js'
-import manifest from './manifest.json' assert { type: 'json' }
+import manifest from './manifest.json' with { type: 'json' }
const version = `${generateVersion[0][0]}${generateVersion[0][1]}`
if (manifest.version.endsWith(version)) |
I was trying to compile the monaco-editor using webpack but run into errors. Are these all the files needed or would they have other dependencies? <!-- Monaco Editor -->
<script src="../../node_modules/monaco-editor/min/vs/loader.js" defer></script>
<script src="../../node_modules/monaco-editor/min/vs/editor/editor.main.nls.js" defer></script>
<script src="../../node_modules/monaco-editor/min/vs/editor/editor.main.js" defer></script>
<link rel="stylesheet" data-name="vs/editor/editor.main"
href="../../node_modules/monaco-editor/min/vs/editor/editor.main.css" /> |
Only those files are needed to get a basic editor setup. |
Do you have a finished zip of the extension to test? |
Yea: firemonkey-2.67.202303161.zip Although, its unfortunately wasn't the latest version as I thought as there are a couple issues that I know I fixed. |
CDN examples: |
Perhaps I misunderstood what you meant here. Did you mean a zip of my version of FireMonkey or a simple extension that's using Monaco?
What files does it load exactly? It would honestly be helpful if you could tell a little bit about your workflow. Like, when packaging FireMonkey, do you just zip it or do you use scripts and/or 3rd party tools (eg. web-ext)? I just remember you mentioned that you don't use libraries. I assume that include tools like npm. If that's the case, I'll need to take a different approach. Sidenote: I saw microsoft/monaco-editor#4793, following what you did, and I didn't get the errors you got when I built Sidenot II: I remember you saying in an issue that your development workflow didn't include git, that was 4-5 years ago now. Is that still true today or not? if not, would you accept Pull Requests? |
I wanted to see the end product.
Everything in the
I do everything on my own computer and then zip it. I don’t use any tools. I don’t use Github either.
I have npm which I use for ESLint, StyleLInt, etc for VS Code extensions, but I don’t use it to develop addons.
I don’t know what the problem is. I wanted to compile monco-editor and use is as standalone JS files. Do you have the same set up? ├── css-loader@7.1.2
It is the same now. |
I managed to get webpack to output (although with some errors).
It generated 35 files which were 17.6 MB. I think I better use a ready-made CDN versions.
|
The only thing different was my OS. I don't use Ubuntu, but still a Linux based distro nonetheless. I'll open a draft PR in a couple days (currently busy with other stuff). |
@DrakeTDL I have been testing with Webpack and got it to work. However, it generates more files than the one you had done which I think is due to using ESM. I would prefer to use ESM if possible (but the ESM doesn’t have a cc. @cyfung1031 |
# To download the lastest monaco version and extract files to a desired path
$ curl $(npm view monaco-editor dist.tarball) | tar -zxvf - -C /path/to/src/lib/monaco \
--strip-components=2 \
package/min/vs/loader.js \
package/min/vs/editor/editor.main.js \
package/min/vs/editor/editor.main.css \
package/min/vs/base/worker/workerMain.js \
package/min/vs/basic-languages/css/css.js \
package/min/vs/language/css/cssMode.js \
package/min/vs/language/css/cssWorker.js \
package/min/vs/basic-languages/javascript/javascript.js \
package/min/vs/language/typescript/tsMode.js \
package/min/vs/language/typescript/tsWorker.js \
package/min/vs/base/browser/ui/codicons/codicon/codicon.ttf Monaco has no external dependencies.
AFAIK, you need the Typescript related files if you want the fancy stuff like auto-completion and hover tooltip in JavaScript. The issue I came accross but didn't know how to fix was with the Web Workers. |
I already have npm (11.0.0) and monaco-editor (0.52.2) |
Would this help? |
I have already tried that, both with and without Monaco Editor WebPack Plugin. mode: 'production'
mode: 'development'
|
I think it's best to use esm webpack. I was having problems with using the
I found out that this sample (browser-esm-webpack-monaco-plugin) does exactly what you want. You can limit what is included with bundle. Limiting it to I created a fork to showcase it: https://github.com/DrakeTDL/firemonkey/tree/monaco. |
What command do you use to generate the files in the terminal? https://github.com/DrakeTDL/firemonkey/blob/monaco/src/lib/monaco/monaco.js Webpack generated 12 files but they are 32.7mb or 5mb zipped. "content_security_policy": "script-src 'self' 'wasm-unsafe-eval' 'unsafe-eval'",
|
To generate to the files, run Also the
It's possible to remove Monaco features that you don't plan on using, to get that size down a bit.
What do you mean by that? Does AMO not allow extensions to use that value? |
Correct.
I tried it and it became smaller 12.3mb and 2.9mb zipped, since they are minified. I have to test it to see how it works out. |
I haven’t tested it yet, but there is another consideration. The best option would be either ...
|
At the moment, FireMonkey uses CodeMirror 5 for the code editor.
CodeMirror 5 uses CSSLint & JSHint for linting.
Unfortunately, CSSLint has been abandoned (last release Sep 20, 2016), therefore it doesn't support newer CSS implementations.
JSHint hasn't been updated for a while.
I have been considering the update of the editor, but haven't been able to find a guide.
Note
There is a major consideration with bundling of software. In FireMonkey, some CodeMirror files have been updated to add more specific features. Such updates will not be possible with bundling packages.
CodeMirror 6
CodeMirror 6 - codemirror/dev
interactive-examples.mdn.mozilla.net
Monaco Editor
Monaco Editor
Ace
Ace - Ace
Webpack
See also:
The text was updated successfully, but these errors were encountered: