
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@typefox/monaco-editor-react
Advanced tools
React component for Monaco-Editor and Monaco Languageclient
This packages provides a React component that wraps the functionality of monaco-languageclient and all its tools.
All changes are noted in the CHANGELOG.
This is npm package is part of the monaco-languageclient mono repo.
You find detailed information in the official documentation.
If interested, check [quick start for local development]](https://github.com/TypeFox/monaco-languageclient#getting-started).
A detailed list of examples is contained in the GitHub repository, please see this listing.
You can import the monaco react component for easy use in an existing React project. Below you can see a quick example of a fully functional implementation in TypeScript. The react component uses the same configuration objects you using monaco-languageclient
directly with TypeScript/JavaScript.
The language client on start can connect to a language server either via jsonrpc over a websocket to an exernal server process, or directly in the browser where the language server runs in a web worker. In both cases they use the Language Server Protocol to communicate. The react component is limited to one language client per component.
import * as vscode from 'vscode';
// Import Monaco Language Client components
import { configureDefaultWorkerFactory } from 'monaco-languageclient/workerFactory';
import type { MonacoVscodeApiConfig } from 'monaco-languageclient/vscodeApiWrapper';
import type { LanguageClientConfig } from 'monaco-languageclient/lcwrapper';
import type { EditorAppConfig } from 'monaco-languageclient/editorApp';
import { MonacoEditorReactComp } from '@typefox/monaco-editor-react';
import React from 'react';
import ReactDOM from 'react-dom/client';
export const createEditorAndLanguageClient = async () => {
const languageId = 'mylang';
const code = '// initial editor content';
const codeUri = '/workspace/hello.mylang';
// Monaco VSCode API configuration
const vscodeApiConfig: MonacoVscodeApiConfig = {
$type: 'extended',
viewsConfig: {
$type: 'EditorService',
// the div to which monaco-editor is added
htmlContainer: document.getElementById('monaco-editor-root')!
},
userConfiguration: {
json: JSON.stringify({
'workbench.colorTheme': 'Default Dark Modern',
'editor.wordBasedSuggestions': 'off'
})
},
monacoWorkerFactory: configureDefaultWorkerFactory
};
// Language client configuration
const languageClientConfig: LanguageClientConfig = {
languageId,
connection: {
options: {
$type: 'WebSocketUrl',
// at this url the language server for myLang must be reachable
url: 'ws://localhost:30000/myLangLS'
}
},
clientOptions: {
documentSelector: [languageId],
orkspaceFolder: {
index: 0,
name: 'workspace',
uri: vscode.Uri.file('/workspace')
}
}
};
// editor app / monaco-editor configuration
const editorAppConfig: EditorAppConfig = {
codeResources: {
main: {
text: code,
uri: codeUri
}
}
};
const root = ReactDOM.createRoot(document.getElementById('react-root')!);
const App = () => {
return (
<div style={{ 'backgroundColor': '#1f1f1f' }} >
<MonacoEditorReactComp
vscodeApiConfig={vscodeApiConfig}
editorAppConfig={editorAppConfig}
languageClientConfig={languageClientConfig}
style={{ 'height': '100%' }}
onError={(e) => {
console.error(e);
}} />
</div>
);
};
root.render(<App />);
};
createEditorAndLanguageClient();
FAQs
React component for Monaco-Editor and Monaco Languageclient
The npm package @typefox/monaco-editor-react receives a total of 2,233 weekly downloads. As such, @typefox/monaco-editor-react popularity was classified as popular.
We found that @typefox/monaco-editor-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.