swagger-api / swagger-editor

Swagger Editor
https://editor.swagger.io
Apache License 2.0
8.94k stars 2.26k forks source link

The 2 in "oauth2" is syntax-highlighted in a funny way. #17

Closed earth2marsh closed 10 years ago

earth2marsh commented 10 years ago

phonics

mohsen1 commented 10 years ago

@earth2marsh These are the Regular Expressions that decides oauth2 is two tokens, a string token and a constant token:

Try changing those regex on your build and see if you can make that accept oauth2 is one string token.

These lines of code could be found at mode-yaml.js file in this app

earth2marsh commented 10 years ago

OK, here is a refiddle: http://refiddle.com/refiddles/536d185075622d7b97cb0100

I've updated line 81 of mode-yaml.js in the app, but I'm not seeing the change. Is there something special I need to do to rebuild it?

earth2marsh commented 10 years ago

Correction, it's line 129 in mode-yaml.js. The new pattern should be: /[+\-]{1}?[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?\b/

mohsen1 commented 10 years ago

@earth2marsh my bad, we are using the minified files of ace.

Try changing this /bower_components/ace-builds/src-min-noconflict/mode-yaml.js

It doesn't worth setting up Ace build system. editing minified code is hard but it's just a try :)

mohsen1 commented 10 years ago

@earth2marsh also, the regexs are cascading, the later they come in the array, the more powerful they are.

earth2marsh commented 10 years ago

@mohsen1 great, that worked! But that asset is part of gitignore. Do I commit it anyway?

And should I submit it as a merge request back to ACE?

mohsen1 commented 10 years ago

fixed by 73fdc92