monaco-editor实现代码输入自动填充完成效果代码

代码语言:html

所属分类:其他

代码描述:monaco-editor实现代码输入自动填充完成效果代码

代码标签: monaco-editor 代码 输入 自动 填充 完成

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum=1.0,minimum=1.0,user-scalable=0" />
    <title>BFW NEW PAGE</title>
    <script src="//repo.bfw.wiki/bfwrepo/js/monaco-editor/loader.js"></script>
<style>
    body{
        height: 100vh;
        width: 100vw;
    }
</style>
</head>

<body>
    <div id="container" style="height: 100%"></div>

    <script>
        require.config({ paths: { 'vs': '//repo.bfw.wiki/bfwrepo/js/monaco-editor' } });
         
	require(['vs/editor/editor.main'], function () {

function createDependencyProposals(range) {
	// returning a static list of proposals, not even looking at the prefix (filtering is done by the Monaco editor),
	// here you could do a server side lookup
	return [
		{
			label: '"lodash"',
			kind: monaco.languages.CompletionItemKind.Function,
			documentation: 'The Lodash library exported as Node.js modules.',
			insertText: '"lodash": "*"',
			range: range
		},
		{
			label: '"express"',
			kind: monaco.languages.CompletionItemKind.Function,
			documentation: 'Fast, unopinionated, minimalist web framework',
			insertText: '"express": "*"',
			range: range
		},
		{
			label: '"mkdirp"',
			kind: monaco.languages.CompletionItemKind.Function,
			documentation: .........完整代码请登录后点击上方下载按钮下载查看

网友评论0