Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@codingame/monaco-editor-wrapper
Advanced tools
Configured monaco-vscode-api with tools and extensions
Monaco editor wrapper uses and configures monaco-vscode-api for you
It also includes some tools allowing to add some missing features to monaco-editor:
preventAlwaysConsumeTouchEvent
, mobile feature corresponding to the alwaysConsumeMouseWheel
monaco-editor optioncollapseCodeSectionsFromRanges
allows to create and collapse a code sectioncollapseCodeSections
allows to create and collapse a code section between 2 tokensregisterTextDecorationProvider
allows to compute decorations on all existing editorshideCodeWithoutDecoration
allows to hide code parts that have a specific decorationlockCodeWithDecoration
allows to make read-only code parts within a specific decorationlockCodeWithoutDecoration
allows to make read-only code parts outside of a specific decorationupdateEditorKeybindingsMode
allows to apply vim or emacs keybindingsextractRangesFromTokens
allows to extract the code sections between a start token and an end tokennpm install @codingame/monaco-editor-wrapper
You need to call the exposed initialize
function, and wait for the returned promise.
You will then be able to interact with the monaco-editor api (by importing monaco-editor
) OR the VSCode api (by importing vscode
)
Instead of using monaco.editor.createModel
, it is recommended to use monaco.editor.createModelReference
to create models.
It makes it possible for the VSCode service to reference that file by it's reference without breaking (for instance when following file links in source code using LSP).
By default, only a minimal set of features is registered (vscode extensions, editor/model services, languages, textmate, dialogs, configuration/keybindings, snippets, accessibility...)
There are some optional features that can be enabled by importing a specific export:
@codingame/monaco-editor-wrapper/features/extensionHostWorker
enables the worker extension host which allows to run VSCode extensions@codingame/monaco-editor-wrapper/features/notifications
enables the VSCode notifications instead of logging into the console@codingame/monaco-editor-wrapper/features/workbench
allows to use the full VSCode workbench@codingame/monaco-editor-wrapper/features/typescriptStandalone
enables the monaco standalone typescript language feature workerThose feature can be used if the workbench feature is enabled:
@codingame/monaco-editor-wrapper/features/viewPanels
enables a few panels (timeline, outline, output, markers, explorer)@codingame/monaco-editor-wrapper/features/search
enables the search panel@codingame/monaco-editor-wrapper/features/extensionGallery
enables the extension gallery panel and the possibility to install extensions from the marketplace@codingame/monaco-editor-wrapper/features/terminal
enables the terminal panel@codingame/monaco-editor-wrapper/features/testing
enables the testing panelsBy default, monaco-editor contains worker to achieve IntelliSense in CSS, SCSS, JavaScript, TypeScript, JSON and HTML.
It's not possible to use them with this lib. However they can be replaced by the corresponding VSCode extension.
To enable them, install and import for following packages:
import '@codingame/monaco-vscode-json-language-features-default-extension'
import '@codingame/monaco-vscode-typescript-language-features-default-extension'
import '@codingame/monaco-vscode-css-language-features-default-extension'
import '@codingame/monaco-vscode-html-language-features-default-extension'
You also need to import @codingame/monaco-editor-wrapper/features/extensionHostWorker
to allows the VSCode extensions to run in a webworker.
This library exposed some functions to manage the user global configuration:
registerDefaultConfigurations
Allows registering default values for some configuration keys which can be overriddenupdateUserConfiguration
Update the user configuration, overrides the default configuration, uses the same syntax as VS Code configurationgetUserConfiguration
Get back the current user configurationonUserConfigurationChange
Get notified when the user configuration change (either after calling updateUserConfiguration or from internal configuration update)getConfiguration
Allows to get a given configuration key in a given languageonConfigurationChanged
Listen to configuration changeupdateKeybindings
aAlows to update the editor keybindings with the same syntax as in VS CodeupdateEditorKeybindingsMode
Switch between vim
, emacs
or classic
keybindingsFAQs
Configured monaco-vscode-api with tools and extensions
We found that @codingame/monaco-editor-wrapper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.