FAQ Database Discussion Community


How to add some known objects to ace editors syntax checker?

javascript,jquery,ace-editor
we're using the ACE editor to write javascript code that's interpreted on the server side. So the server has a JavaScript interface and can execute submitted code to accomplish some task from the outside. The server implements some new objects that are not known by ACE. So ACE shows a...

Wrap behaviour in Ace.js, take indentation into account?

javascript,ace-editor
Does the ace editor provide an option for the wrap mode which takes the indentation into consideration? Like This: Currently wrap: true produces this: ...

The ace editor not displaying some code

html,ace-editor
I'm using the ace editor and I noticed when I read in some lua file it wasn't matching 100% to what the file really had in it when I placed the data inside the ace editor div. You can see this effect at the link below. Notice how in the...

How to change the content inside an ace editor when I clicked on another file?

javascript,reactjs,ace-editor
I'm learning Reactjs and want to write a web editor. There will be a file list on the left, and an editor in the middle. When I click on a file, the content of the editor will be changed. We are using brace which is a commonjs-compatible version of ACE...

Dynamically update syntax highlighting for the Ace Editor + Requirejs

javascript,requirejs,ace-editor
I need to dynamically change the set of keywords that need to highlight. Here was the answer to a similar theme, but my project already has require.js and when I use the code from the response then I have an error: Module name "DynHighlightRules" has not been loaded yet for...

Ace editor replace text

angularjs,ace-editor
I'm using ui-ace, I succeed to replace the selection text as the following: $ace_editor.session.replace($ace_editor.selection.getRange(), "Hii"); But my problem is that this way don't update the ng-model, did I forget something to do?...

Is there a way to hide the line numbers in Ace Editor?

javascript,ace-editor
Is there any way to remove the line numbers when using the ace editor? Similar to removing the print margin as shown below? editor.setShowPrintMargin(false); ...

How to load ace editor with requirejs from CDN?

javascript,requirejs,ace-editor
I am trying to load the ace editor from a CDN with requirejs. Here is a plunkr which illustrates my problem. Ace is not defined in the following case: requirejs.config({ paths: { ace: ['//cdnjs.cloudflare.com/ajax/libs/ace/1.1.9/ace'] } }) $('h1').text("loading ace..."); requirejs([ 'ace'], function(ace) { $('h1').text("ace loaded.") console.log(ace) ace.edit('#editor') return }) ...

Ace Code Editor : Caching mode object

javascript,ace-editor
I have a webapp where I have to show the ace editor in multiple places. So I have a common routine that loads the ace editor with a given root element (code in coffee) editor = window.ace.edit(root) editor.setTheme("ace/theme/github") editor.getSession().setMode("ace/mode/json") The issue I have is that every time I set the...

How to implement the “auto pairing of quotes” feature in custom mode in ace-editor

autocomplete,quotes,ace-editor
I want to add "auto pairing of quotes" feature in my custom mode. I find the solution that add editor.setBehavioursEnabled(true), but it seems like only work for existing mode. I know I perhaps miss some code in my custom mode. Can anyone point out which code is response for this...

Get an HTML element's line number

html,dom,element,codemirror,ace-editor
Was wondering if there is a better way to find an elements line number in the sources code. This is what i've go so far: // Get the item that the user is clicking on: var focused = doc.getSelection().anchorNode; if(focused.nodeType == 3){ // text node focused = focused.parentNode; } //...

Caret position on github ace editor

javascript,google-chrome-extension,ace-editor
I'm developing a chrome extension where I can insert text inside github web editor. The inserted text should be at the caret position, which I can't figure out how get it. The github editor, which is an ace editor, has this HTML code: <div class="commit-create"> <textarea id="blob_contents" class="file-editor-textarea js-blob-contents js-code-textarea"...

Destroy an open autocomplete popup in Ace editor

javascript,autocomplete,ace-editor
I'm using the Ace Editor with autocompletion turned on. The editor appears in a modal frame on the page. If the modal frame is closed (i.e. the editor is removed from the DOM) while an autocomplete popup is open, the popup gets stuck and can't be closed. What's the right...

Ace editor - save/send session on server via POST

javascript,php,variables,session,ace-editor
I write online webpage editor and I would like save current view/work on server, for restore in future. I also want do multiple tabs. I know, that is editor.getSession() and editor.setSession(). JS: var editor = ace.edit("description"); editor.session.setMode("ace/mode/javascript"); editor.setTheme("ace/theme/tomorrow"); editor.setShowPrintMargin(false); editor.setOptions({ enableBasicAutocompletion: true, enableSnippets: true }); Now I try save session...

Has anyone created a MIPS syntax highlighter for Ace Editor?

user-interface,mips,ace-editor
I'm trying to create a MIPS syntax highlighting. There's a copy of the .tmLanguage file to be used for TextMate markup and the like on GitHub here. I'm also aware that Ace Editor's ability to perform a conversion on this file. The setup did not seem nontrivial, and I ran...

How to find out the keyword in ace-editor

keyword,ace-editor
For ace-editor, I want to select one line and find out all the keywords within the line and output into the console. Which APIs from ace-editor that I can use for this purpose, and how to achieve the goal. Thanks.

Ace editor in SVG Foreign Object

javascript,svg,d3.js,ace-editor
How would one add an Ace Editor to a D3 SVG? Is this possible? What is the best way to go about doing so? Below is my attempt to to create a foreignObject element and add the editor to it, to no avail: var w = window.innerWidth, h = window.innerHeight;...

How use jquery getJSON with a local variable

javascript,jquery,ajax,json,ace-editor
i want to extend the completions of Ace Editor, and i need a json of word, this is my code: function load_completions() { var object = $('#preview').attr('class'); $.ajax({ type: "POST", url: "test_editor_ajax.php", data: {action:'load_completion', object:object}, cache: false, success: function(json){ var adminCompleter = { getCompletions: function(editor, session, pos, prefix, callback) {...

Modify the gutter of Ajax.org Cloud9 Editor (Ace Editor)

javascript,codemirror,ace-editor,code-editor
I have an Ace Editor embedded on my website in which I allow the users to type in it. Currently, the built in function automatically shows the line number for every line inserted like this: Is there a way for me to set the content in the gutter manually and...

Ace JS Editor - Enable/Disable Undo and Redo buttons in editor

javascript,ace-editor
I'm having some issues trying to implement a way to have my undo and redo buttons automatically become enabled or disabled based on the UndoManager. var editor = ace.edit(editorElement); editor.on('change', function (e) { var um = editor.getSession().getUndoManager(); $('button.undo').attr('disabled', um.hasUndo() ? false : true ); $('button.redo').attr('disabled', um.hasRedo() ? false : true...

ACE Editor Autocomplete - custom strings

javascript,google-chrome-extension,autocomplete,ace-editor
I'm using ACE Editor within a Chrome extension. I'm using ACE's Autocomplete feature but I want to be able to completely define a list of static strings to use for the autocomplete, instead of any local strings or snippets. (In the future I might be using something more sophisticated than...

ace editor find code snippet

javascript,ace-editor
i have setup ace to render html code let's say for example that he renderer the following code 1 <html> 2 <body> 3 <table> 4 <tr> 5 <td> 6 test 7 </td> I would like to get the line number for a given fragment of my code, so for example...

How to build our own tokens in acejs editor [closed]

token,ace-editor
In acejs editor, we have a lot of build-in tokens, like string, command, and keyword. We can give different color and event handler according to tokens. Here, I wonder it's possible to create our own customer tokens.

Ace editor - insert text at position

ace-editor
I'm working on a real-time collaborative editor within Ace editor, and I couldn't find any docs on inserting text at a certain position within the editor (Aka, the position the other user types at.) Any ideas?

Ace editor inside tab div not resizing with browser window (demo code inside)

node-webkit,ace-editor
So ultimately I'm trying to do this in node-webkit. I experience the similar issue there but this allows me to show it on the web side and I'm not sure what's going on. If you go to the following link below but in a browser that is not maximized, then...

Create custom mode of ace-editor without requireJS [closed]

requirejs,ace-editor
I want to create an angular service module can generate custom mode of ace-editor. But for creating custom mode of ace-editor, it used requireJS. I don't want to use it in my angular service module. So I wonder how to create custom mode of ace-editor without requireJS?

Is it possible to call a function after typing each keyword in ace-editor

callback,keyword,ace-editor
What I want to do is that in ace-editor, each time when I finished typing a keyword, a function can be called automatically. For example, I TYPE the keyword "new" in ace-editor. After I finished typing, an alert function will be called and say "you have typed the keyword 'new'"....

Custom autocompleter and periods (.)

ace-editor
I can't seem to make getCompletions function to trigger in my custom completer when using custom prefix extraction regex identifierRegexps Basically I am trying to create an autocompleter which will trigger on periods (.) preceded by letters. E.g. In "foo." when the period is typed I would like to present...

How to get Range when using angular ui ace?

javascript,angularjs,ace-editor
Does anyone know how i can get Range with angular ui ace? If i am directly embedding ace in my html, i could probably do something like this: var editor = ace.edit("editor"); editor.setTheme("ace/theme/monokai"); editor.getSession().setMode("ace/mode/javascript"); var Range = ace.require('ace/range').Range; But how can i get this with angular ui ace? I have...

what is the return value of getsession.insert in ace editor?

javascript,angularjs,node.js,ace-editor
The documentation for ace editor is not very clear on what the return value is for these two functions in editsession: addmarker insert edit session api ref the addmarker is not actually adding a marker for me, and the insert is not inserting any lines in the editor. Which is...

Autocompletion for multiple js files in Cloud9

javascript,autocomplete,cloud9-ide,ace-editor
I'm trying to move my workspace to c9 because the Ace editor's autocompletion really pleased me when I worked on NodeJS projects. But now I would like to work on JS files client-sided. It is from this point autocompletion going wrong. Indeed, there is nothing such as "require" command in...

Removing listeners from an ace-editor [duplicate]

ace-editor
This question already has an answer here: With the ACE Editor, how can I unbind an event? 1 answer With editor.on('change', ...) I added a listener, now I need to remove it again. editor.off(fromEditorOnReturnedFunction) didn't work....

Where to set Ace editor blockScrolling?

javascript,jquery,ace-editor
When I use ace (with jquery-ace) to change a textarea to ace-editor, it shows this warning on the console: Automatically scrolling cursor into view after selection change this will be disabled in the next version set editor.$blockScrolling = Infinity to disable this message Where to set that editor.$blockScrolling variable to...