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

Monaco #2117

Merged
merged 46 commits into from
Aug 15, 2019
Merged

Monaco #2117

merged 46 commits into from
Aug 15, 2019

Conversation

bcolloran
Copy link
Contributor

This may now be working at parity with codemirror, but i need extra eyes and review to kick the tires. I guess the one thing that is for sure not working is the fetch chunk code highlighting mode. i can look at that next.

Pull Request checklist

  • Documentation: If this feature has or requires documentation, the relevant docs have been updated.
  • Changelog: This PR updates the changelog with any user-visible changes.
  • Tests: This PR includes thorough tests or an explanation of why it does not

bcolloran added 27 commits July 15, 2019 15:37
(make the monaco component fully controlled)
- indent/dedent
- commenting
- autoSurround
...
@bcolloran
Copy link
Contributor Author

fetch chunk highlighting now working. last explicit bug i'm now aware of: chunk delim lines without an explicit type don't highlight correctly.

@hamilton @mdboom @wlach we should figure out what the parity-with-codemirror criteria are for Monaco. Getting all the magic of language servers working is still a ways off, but i think i can see a path to some cool stuff that is pretty attainable

Copy link
Contributor

@mdboom mdboom left a comment

Choose a reason for hiding this comment

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

This is really cool.

Personal preference: I don't know if the overview thing is that helpful -- maybe turn it off to save real estate or make it toggleable, if possible.

The 2 spaces for tabs for Python thing is going to ruffle some feathers. If there's a way to do that on a cell-by-cell basis, that would be awesome, but I couldn't find it in the API docs.

There is some sort of autocompletion going on -- it looks like it pulls words from elsewhere in the document. It's a little weird since it pulls candidates from markdown cells. If it could be limited to looking in cells of the same time (no idea how hard that is) that could be really useful, otherwise, maybe turn it off?

@@ -19,8 +16,6 @@ const PYODIDE_URL = process.env.USE_LOCAL_PYODIDE
const pyLanguageDefinition = {
languageId: "py",
displayName: "Python",
codeMirrorMode: "python",
Copy link
Contributor

Choose a reason for hiding this comment

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

We'll want to replace this with something for Monaco so that third-party language plugins can get syntax highlighting. Does it look hard to do that dynamically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i don't think it should be hard, but i think we can address that down the line. there will be a bit more thinking to do on this topic, but not too bad.

Copy link
Contributor

@wlach wlach left a comment

Choose a reason for hiding this comment

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

Preliminarily, this seems like a really nice improvement!

I tend to agree that the overview should be skipped. I have a "tabs" sidebar, so every pixel of space in the editor is precious. Here's how it looks for me now:

image

On a similar note, it would be nice if we used less space for the line numbers -- right now the seem to be taking up 50px of space, most of which is just empty space. I'd rather we just compacted them to just fit the current number of lines, expanding them as needed.

Agree also that the autocompletion doesn't seem to be super useful as is, more often than not the suggestions seem unhelpful / get in the way. I would definitely turn it off until we can make it only pull stuff from the same cell type.

@@ -55,9 +56,16 @@ module.exports = env => {
entry: {
iodide: `${APP_DIR}/editor/index.jsx`,
"iodide.eval-frame": `${APP_DIR}/eval-frame/index.jsx`,
"server.home": `${APP_DIR}/server/index.jsx`
"server.home": `${APP_DIR}/server/index.jsx`,
// "editor.worker": 'monaco-editor/esm/vs/editor/editor.worker.js'
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover from some earlier work?

// test: /\.css$/,
// include: MONACO_PATH,
// use: [MiniCssExtractPlugin.loader, "css-loader"]
// },
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a WIP or can we just take it out?

md: [mdLang, mdConf],
css: [cssLang, cssConf],
py: [pyLang, pyConf]
}).forEach(lang => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to update the language plugin documentation for any new conventions here?

@bcolloran
Copy link
Contributor Author

(oh, also removed the minimap)

@wlach wlach temporarily deployed to iodide-staging August 13, 2019 02:40 Inactive
@wlach
Copy link
Contributor

wlach commented Aug 13, 2019

I deployed this to https://definitely-staging.iodide.io in case anyone wants to give it a whirl. Will give actual feedback tomorrow.

@teonbrooks
Copy link
Contributor

so far planning around with the editor, i think the languages shared refs make sense. i understand the inclusion of the fetch cells as well, that is the loaded data gets its variable assignment there, but what i have noticed with this is that it parts of the url are included in the autocomplete list.

@bcolloran
Copy link
Contributor Author

@teonbrooks -- ok i fooled around with it a bit more, and tried to tighten things up a bit. Since I already had the regex handy from something else, i added a filter so that only the variable names in fetch chunks are added to the autocomplete list, and i added a rudimentary heuristic so that only things in css chunks starting with "#" or "." (ids and classes) are added to the list. please take another look when you can and let me know if you see any other merge blockers.

thanks for helping with the QA @teonbrooks !

@@ -141,7 +138,6 @@ module.exports = env => {
filename: `[name].${APP_VERSION_STRING}.css`
}),
new WriteFilePlugin()
// Use an external helper script, due to https://github.com/1337programming/webpack-shell-plugin/issues/41
Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment for code that was removed

@@ -2,10 +2,8 @@ require("dotenv").config();
const webpack = require("webpack");
const path = require("path");
const fs = require("fs");
const CreateFileWebpack = require("create-file-webpack");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this and the one below were no longer used. noticed this while cleaning out stuff i'd been doing in this file.

@wlach wlach temporarily deployed to iodide-staging August 14, 2019 18:18 Inactive
@teonbrooks
Copy link
Contributor

@bcolloran that did it for me. looks good!

@bcolloran bcolloran marked this pull request as ready for review August 14, 2019 18:40
@bcolloran
Copy link
Contributor Author

note to self: WIP of webpack.config.js with stuff for loading monaco here:
https://gist.github.com/bcolloran/9ad3686b793795bcd03ae285aa24b8e1

Copy link
Contributor

@wlach wlach left a comment

Choose a reason for hiding this comment

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

This is working great! I have some minor nits, but in general everything here is looking good.

Copy link
Contributor

@wlach wlach left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks for adding more tests and keeping things 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants