question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tree-shaking is removing methods from CodeEditorWidget

See original GitHub issue

When upgrading monaco-editor from 0.13.1 to 0.14.3, some of the methods we (ab)use in GitKraken’s integration of Monaco disappeared: CodeEditorWidget._registerDecorationType CordEditorWidget.setDecorations Although these methods were technically not part of the exposed editor API, we bit the bullet and hoped that there wouldn’t be any Monaco code changes that would cause issues down the line.

Fast forwards to today: they’re no longer defined on an editor instance. However, they’re still part of the Monaco source code for CodeEditorWidget. I believe the tree-shaking introduced in 0.14.0 is shaking them out during the compile/bundle step.

I recognize that it probably isn’t a priority for the release bundle to expose access to internal APIs. Would it be possible to make these an official part of the API? Is there some other way to achieve parity?

monaco-editor version: 0.14.3 Browser: Electron 1.8.4 OS: Mac OS X, Windows, Linux

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
emmax86commented, Aug 30, 2018

Woohoo! After I got it. Thanks a bunch @alexandrudima!

Here’s the gist of how I solved the issue, posted here for posterity:

const customCSS = `
  .${className}::before {
  display: inline-block;
  border-width: ...;
  border-style: ...;
  border-color: ...;
  margin: ...;
  padding-left: ...;
  color: ...
  content: ...;
  width: ...;
  }
`
someStyleDomNode.innerText += customCSS;
const decorationOptions = {
  beforeContentClassName: ${className},
    isWholeLine: true,
    stickiness: 3,
    overviewRuler: {
      color: ...,
      darkColor: ...,
      position: 4
    }
}
0reactions
alexdimacommented, Aug 29, 2018
  • isWholeLine affects the rendering when using className. doc
  • rangeBehavior => stickiness. doc
  • overviewRulerLane => overviewRuler. doc
Read more comments on GitHub >

github_iconTop Results From Across the Web

Tree-shaking is removing methods from CodeEditorWidget
When upgrading monaco-editor from 0.13.1 to 0.14.3, some of the methods we (ab)use in GitKraken's integration of Monaco disappeared:
Read more >
Tree Shaking - webpack
Tree Shaking. Tree shaking is a term commonly used in the JavaScript context for dead-code elimination. It relies on the static structure of...
Read more >
Reduce JavaScript payloads with tree shaking - web.dev
Tree shaking is a form of dead code elimination. The term was popularized by Rollup, but the concept of dead code elimination has...
Read more >
Tree-shaking versus dead code elimination | by Rich Harris
It doesn't currently remove things like unused methods from objects that are used, and there are times when it is forced to assume...
Read more >
Tree shaking and code splitting in webpack - LogRocket Blog
Tree shaking, also known as dead code elimination, is the practice of removing unused code in your production build.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found