ACE编辑器自动完成关键字为大写 [英] ACE editor autocompletion keywords in upper case

查看:273
本文介绍了ACE编辑器自动完成关键字为大写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ACE编辑器,该编辑器具有基于sql模式的自定义突出显示模式,并且一切正常,但是我以大写形式定义了关键字,并且当autocompleter显示可用选项时,所有这些都为小写形式。

I have an ACE editor with a custom highlight mode, based on sql mode, and all is working fine, but I am defining keywords in upper case, and when autocompleter shows the available options, all of them are in lower case.

我检查了旧的sql模式(在进行修改之前),其行为完全相同。

I have checked the old sql mode (before my modifications) and the behaviour is exactly the same.

有什么方法可以将此选项转换为大写吗?

Is there any way of converting this options to upper case?

我已经查看过问题,但是我一直找不到解决方法。
我还尝试将所有 toLowerCase()函数删除到 ext-language-tools.js 中,但仍以小写形式显示选项。

I have review this question, but I have been unable to find a way to do it. I have also tried to remove all toLowerCase() functions into ext-language-tools.js, but still showing options in lower case.

谢谢!

推荐答案

这是一个非常肮脏的解决方法,但是您可以尝试通过添加以下内容来调整 ext-language_tools.js

It's a very dirty workaround, but you can try tweaking ext-language_tools.js by adding the following.

代码如下:

this.filterCompletions = function(items, needle) {
    var results = [];
    var upper = needle.toUpperCase();
    var lower = needle.toLowerCase();
    loop: for (var i = 0, item; item = items[i]; i++) {       
        var caption = item.value || item.caption || item.snippet;
        if (!caption) continue;

将其更改为以下内容,其中'keyword''builtinFunctions'是要大写的补全组:

Change it to read the following, where 'keyword' and 'builtinFunctions' are the groups of completions you want to capitalize:

this.filterCompletions = function(items, needle) {
    var results = [];
    var upper = needle.toUpperCase();
    var lower = needle.toLowerCase();
    loop: for (var i = 0, item; item = items[i]; i++) {
        if (item.meta === 'keyword' || item.meta === 'builtinFunctions'){
            items[i].name = items[i].name.toUpperCase();
            items[i].value = items[i].value.toUpperCase();
        }
        var caption = item.value || item.caption || item.snippet;
        if (!caption) continue;

这篇关于ACE编辑器自动完成关键字为大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆