Instancing Monaco Editor is just 5 by 5 Pixels even with `automaticLayout: true` [Workaround] [Closed]
See original GitHub issue-
Try to reproduce in VS Code and file issue directly at: Impossible
-
Otherwise, provide steps that reproduce the problem in VS Code web at:
- Install Monaco Editor
npm install monaco-editor
- Install Monaco Editor WebPack Plugin
npm install monaco-editor-webpack-plugin
- Add to
webpack.mix.js
const mix = require('laravel-mix');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.webpackConfig(webpack => {
return {
plugins: [
new MonacoWebpackPlugin({
// available options are documented at https://github.com/Microsoft/monaco-editor-webpack-plugin#options
languages: ['javascript', 'python'],
// Features doesn't work ( https://github.com/microsoft/monaco-editor-webpack-plugin/issues/109 )
features: [
'accessibilityHelp', 'bracketMatching', 'caretOperations', 'clipboard', 'codeAction',
'codelens', 'colorDetector', 'comment', 'contextmenu', 'coreCommands','cursorUndo',
'dnd', 'find', 'folding', 'fontZoom', 'format', 'gotoError', 'gotoLine', 'gotoSymbol',
'hover', 'iPadShowKeyboard', 'inPlaceReplace', 'inspectTokens', 'linesOperations',
'links', 'multicursor', 'parameterHints', 'quickCommand', 'quickOutline', 'referenceSearch',
'rename', 'smartSelect', 'snippets', 'suggest', 'toggleHighContrast', 'toggleTabFocusMode',
'transpose', 'wordHighlighter', 'wordOperations', 'wordPartOperations']
}),
// new BundleAnalyzerPlugin()
]
};
});
- Add to
Editor.vue
<template>
<div id="monaco-editor-container"></div>
</template>
<script>
import * as monaco from 'monaco-editor';
export default {
mounted() {
monaco.editor.create(document.getElementById("monaco-editor-container"), {
value: "function hello() {\n\talert('Hello world!');\n}",
language: "python",
automaticLayout: true
});
}
}
</script>
<style>
</style>
- Register Component:
...
Vue.component('vue-monaco-editor', require('./components/Monaco/Editor.vue').default);
...
- Use Component:
<vue-monaco-editor></vue-monaco-editor>
-
Otherwise, provide steps that reproduce the problem at the Monaco Editor homepage None
-
Otherwise, provide a Playground code snippet None
-
Otherwise, provide a self-contained git repository / HTML page None
monaco-editor version: npm -v monaco-editor
6.13.4
Browser: Chrome
OS: Winows 10
Playground code that reproduces the issue: None
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Monaco Editor
The Monaco Editor is the code editor that powers VS Code. A good page describing the code editor's features is here. It is...
Read more >Monaco Editor force resize editor - Stack Overflow
I enlarge first and then reduce the height by making the developer console larger/smaller. ... I would expect that with automaticLayout: true you ......
Read more >February 2020 (version 1.43) - Visual Studio Code
By default, Go to Definition via mouse opens a separate editor but with the new setting editor.definitionLinkOpensInPeek as true , the gesture will...
Read more >Building a code editor with Monaco - Expo Blog
I work on Snack, an online code editor for React Native apps. In the past, Snack's code editor used Ace Editor, but we've...
Read more >Graphik font github - Caritas Castellaneta
5. woff 2 Source: fonts[1]. 3. Influenced by other popular geometric, minimalist sans-serif typefaces of the new millennium. It is much faster and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks David. I tried that but in fact that the Editor is inside a
tab-pane
from Bootstrap that doesn’t work. Also theautomaticLayout: true
Option doesn’t work and is expensive in general. I could remove my Workaround and fix it by using aResizeObserver
:Starting release 0.21, Monaco will do exactly that =), or fallback to polling if not supported.