ace-editor

Retrieve line number of string in Ace Editor

我是研究僧i 提交于 2020-01-01 11:39:30
问题 I'm trying to retrieve the line number of a given string in the text displayed in the ace editor. Example: searching for "foo" Return: [ 4, 5 ] Condition: Line 4 and 5 in the content of the ace editor contains the "foo" string 回答1: Iterate over all lines and check indexOf function findFooLineNumbers(editor, foo) { var lines = editor.session.doc.getAllLines() var fooLineNumbers = [] for (var i = 0, l = lines.length; i < l; i++) { if (lines[i].indexOf(foo) != -1) fooLineNumbers.push(i) } return

Ace editor Processing mode?

南笙酒味 提交于 2019-12-25 08:48:19
问题 I uploaded a processing file to github. I want to show the code on my website. So I implement ACE editor in my site and ajaxed my proecessing code to the ace editor. But there is a problem. I want the code showed on my look as the code show in Processing IDE. But Ace editor support java language but no mode for processing. How can I solve this problem ? I could not find any package for Ace processing mode. 回答1: http://hello.processing.org/editor/ uses Ace, and it have a mode for processing

achartengine chart will not zoom even though zoom is enabled

心不动则不痛 提交于 2019-12-24 17:31:38
问题 I am running a data request from a service on a thread. I cannot seem to get pan or zoom to work for this app. Here is the method where I am setting it to allow zoom . I have also checked that zoom is enabled. private void getRPData2() { final ScadaDataList l = new ScadaDataList(); final long value = new Date().getTime() - 3 * TimeChart.DAY; new Thread(new Runnable() { public void run() { try { //System.out.println("made it"); l.Load(Cookie); final Date d = new Date(); runOnUiThread(new

Python syntax check in ace editor

青春壹個敷衍的年華 提交于 2019-12-24 11:28:28
问题 What I am trying to develop is a web-environment app which will let user write and syntax check his own python code. To the moment, I have embedded ACE editor to my app using the python mode. My problem is that ace does not include a javascript lib for python syntax check in order to implement it by using workers as described here How to integrate syntax check in Ace Editor using custom mode?. Through my search I have found modules like pyflakes or pylint. for syntax check which are both

Custom autocomplete in ace-editor does not work after “.”

佐手、 提交于 2019-12-24 07:58:36
问题 I want to use autocomplete in the ace editor. After the user types foo. I want to suggest foo.bar . Actually I used the following code: var langTools = ace.require("ace/ext/language_tools"); var staticWordCompleter = { identifierRegexps: [/[\.]/], getCompletions: function(editor, session, pos, prefix, callback) { console.log(prefix); if (prefix == "foo.") { var wordList = ["baar", "bar", "baz"]; callback(null, wordList.map(function(word) { return { caption: word, value: word, meta: "static" }

Set width of ace editor instance according to the length of characters in it

一曲冷凌霜 提交于 2019-12-24 07:38:46
问题 I am working on the project where I have created a custom Rich Text Editor using contenteditable attribute. In this rich text editor I want insert single line ace editor instance of which width will be set according to the number of characters in it. For restricting the ace editor instance to single line I have handled the "Enter" key event which does not let the ace instance to insert new line. var editor = ace.edit(script_editor); editor.commands.on("exec", function (e) { editor.container

Why is my Rails app redirecting to `data:,`?

点点圈 提交于 2019-12-24 05:07:04
问题 So when I save a record in my Rails 4 app this happens. Here's some details: I'm using the Ace editor. The data attribute is no where in my model or app. The form is a standard form_for (not remote). The record does save successfully but then it redirects to this weird ass URL. The code for the update is standard scaffold boilerplate. # PATCH/PUT /pages/1 # PATCH/PUT /pages/1.json def update respond_to do |format| if @page.update(page_params) format.html { redirect_to @page, notice: 'Page was

Adding a new language with “ace” library

房东的猫 提交于 2019-12-23 22:52:47
问题 I'm new to Ace, and I want to add a new language. I created the file named new_highlight_rules , the problem is I have to add tokens and corresponding regex in this file, and my new language is very complicated, so I have a lot of regex and rules to add. My question is: if I have the grammar of my language written for ANTLR, is there a practical way to add regexes and tokens? and is there any other way without using ANTLR? Please I'm new and any guidance, even very basic, can help me. 回答1: If

How to use mirror worker for ace editor with ace-builds

拟墨画扇 提交于 2019-12-23 09:17:13
问题 I am using ace-builds to build my ace editor app with webpack. I need to use a custom worker for syntax validation. The wiki page here suggests to extend a worker named mirror obtained by following. var Mirror = require("ace/worker/mirror").Mirror; But ace-builds does not seem to provide this worker. How do I create a custom worker for syntax validation using ace-builds? Any other advice on how to build an ace editor app with a custom syntax validating worker (for a custom programming

How can I get selected text in Ace editor?

若如初见. 提交于 2019-12-23 08:50:07
问题 I look into docs and also pick at the source code and I dind't find anything, all I see is selection and range objects, and methods that manipulate ranges. 回答1: It's better to use editor.getSelectedText() instead. 回答2: Found in Ace editor source code: editor.getSession().doc.getTextRange(editor.selection.getRange()); 来源: https://stackoverflow.com/questions/23996814/how-can-i-get-selected-text-in-ace-editor