具有自动完成的基于Web的代码编辑器
我正在为我的
个人项目构建基于 Web 的代码编辑器。我想让它像 VS code 一样工作,但面临一些问题。
我正在使用 ACE 编辑器。
这是我在尝试自动完成时得到的结果。
我在尝试编写“os.(something)”时获得了所有可用的建议,而不是仅仅获得了语言和包的具体建议。
我想要的是这个。
在这张图片中,如您所见,我仅收到与操作系统包相关的建议。
guys
I'm building the web based code editor for my personal project.I want to make it work like VS code but facing some issues.
I'm using ACE editor.
This is what I get while trying with autocompletion.
I'm getting all the available suggestions while trying to write "os.(something)", rather then just getting the language and package specific suggestions.
What I want is this.
In this pic as you can see I'm getting suggetion related to os package only.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据您使用Reirect-JS的设置,您可能还需要在页面的HTML中包含一个额外的JavaScript文件。您需要编写此简单的脚本来使用自动完成功能。
演示: httpps://githbithub.com/ajaxorg/ajaxorg/ajaxorg/ace/blob/ master/demo/autocompletion.html
参考: https://github.com/ajaxorg/ace/wiki/how-to-to-now-to-enable-autocomplete-inocomplete-in-the-ace-editor
Depending on your setup with require-js, you may also need to include an additional javascript file in the html for your page. You need to write this simple script to working with the auto completion feature.
Demo: https://github.com/ajaxorg/ace/blob/master/demo/autocompletion.html
Reference: https://github.com/ajaxorg/ace/wiki/How-to-enable-Autocomplete-in-the-Ace-editor
基于 HTML、JS、CSS
functioncompile() { document.GetElementById('code').value = document.GetElementById('code').value.replaceAll('snippet1', 'Snippet1Value').replaceAll('snippet2', 'SnippetValue'). ...
例如:当您输入
_text_
(并将snippet1
设置为)时,您的textarea 将写入
。要创建选择器,请使用 json.contextmenu-library。
我知道,这只是一个计划,怎么做才是。
HTML, JS, CSS Based
<textarea onkeyup=compile() id=code>
. It should be big enaugt for code.<script> </script>
function compile() { document.GetElementById('code').value = document.GetElementById('code').value.replaceAll('snippet1', 'Snippet1Value').replaceAll('snippet2', 'SnippetValue'). ...
E.g.: When you enter
_text_
(and you setsnippet1
to<input type=text>
) then your textarea will write<input type=text>
. To create an picker, use a contextmenu-library at json.I know, this is only an plan how to do is.