mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
improve ace mode recognition
This commit is contained in:
parent
2029ec2535
commit
8887ab78c0
1 changed files with 14 additions and 2 deletions
|
@ -231,9 +231,21 @@ define [
|
||||||
# see if we can lookup a suitable mode from ace
|
# see if we can lookup a suitable mode from ace
|
||||||
# but fall back to text by default
|
# but fall back to text by default
|
||||||
try
|
try
|
||||||
|
if scope.fileName.match(/\.(Rtex|bbl)$/i)
|
||||||
|
# recognise Rtex and bbl as latex
|
||||||
|
mode = "ace/mode/latex"
|
||||||
|
else if scope.fileName.match(/\.(sty|cls|clo)$/)
|
||||||
|
# recognise some common files as tex
|
||||||
|
mode = "ace/mode/tex"
|
||||||
|
else
|
||||||
mode = ModeList.getModeForPath(scope.fileName).mode
|
mode = ModeList.getModeForPath(scope.fileName).mode
|
||||||
|
# we prefer plain_text mode over text mode because ace's
|
||||||
|
# text mode is actually for code and has unwanted
|
||||||
|
# indenting (see wrapMethod in ace edit_session.js)
|
||||||
|
if mode is "ace/mode/text"
|
||||||
|
mode = "ace/mode/plain_text"
|
||||||
catch
|
catch
|
||||||
mode = "ace/mode/text"
|
mode = "ace/mode/plain_text"
|
||||||
|
|
||||||
# create our new session
|
# create our new session
|
||||||
session = new EditSession(lines, mode)
|
session = new EditSession(lines, mode)
|
||||||
|
|
Loading…
Reference in a new issue