Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Detect Opened File in Ace Editor #289

Closed
azuharu opened this issue Jan 21, 2020 · 3 comments · Fixed by #400
Closed

Auto Detect Opened File in Ace Editor #289

azuharu opened this issue Jan 21, 2020 · 3 comments · Fixed by #400

Comments

@azuharu
Copy link

azuharu commented Jan 21, 2020

Hi there, I wonder if we can set automatically opened file in ace editor?

in my case, I open php files, but selected mode is Javascript

image

Thank you

@nk932714
Copy link

nk932714 commented Jun 4, 2020

duplicate of #183

yes it would be awesome if it automatically detects file-type.

here I'm editing .php file but it is showing as JavaScript.

image

@nk932714
Copy link

nk932714 commented Jun 5, 2020

@prasathmani

not sure what the problem is
image
after inspect i found that code is working fine.
image
but still ace editor is not switching automatically to php

@EV-soft
Copy link

EV-soft commented Jun 5, 2020

The problem is that the selector always displays "javascript" as the first choice.
It cannot reflect current choice. (It is part of the ACE system)

Incidentally, there is another problem by simply specifying file extension as document type. It only succeeds in: .php, .xml, .html, .text and a few others.

For example, it fails with: .htm, .txt .js and many others, since the system's defined document types must be specified.
For this to work, a file extension to document type must be converted.

Here is the list of document types:

        "aceMode":{
            "javascript":"JavaScript",
            "abap":"ABAP",
            "abc":"ABC",
            "actionscript":"ActionScript",
            "ada":"ADA",
            "apache_conf":"Apache Conf",
            "asciidoc":"AsciiDoc",
            "asl":"ASL",
            "assembly_x86":"Assembly x86",
            "autohotkey":"AutoHotKey",
            "apex":"Apex",
            "batchfile":"BatchFile",
            "bro":"Bro",
            "c_cpp":"C and C++",
            "c9search":"C9Search",
            "cirru":"Cirru",
            "clojure":"Clojure",
            "cobol":"Cobol",
            "coffee":"CoffeeScript",
            "coldfusion":"ColdFusion",
            "csharp":"C#",
            "csound_document":"Csound Document",
            "csound_orchestra":"Csound",
            "csound_score":"Csound Score",
            "css":"CSS",
            "curly":"Curly",
            "d":"D",
            "dart":"Dart",
            "diff":"Diff",
            "dockerfile":"Dockerfile",
            "dot":"Dot",
            "drools":"Drools",
            "edifact":"Edifact",
            "eiffel":"Eiffel",
            "ejs":"EJS",
            "elixir":"Elixir",
            "elm":"Elm",
            "erlang":"Erlang",
            "forth":"Forth",
            "fortran":"Fortran",
            "fsharp":"FSharp",
            "fsl":"FSL",
            "ftl":"FreeMarker",
            "gcode":"Gcode",
            "gherkin":"Gherkin",
            "gitignore":"Gitignore",
            "glsl":"Glsl",
            "gobstones":"Gobstones",
            "golang":"Go",
            "graphqlschema":"GraphQLSchema",
            "groovy":"Groovy",
            "haml":"HAML",
            "handlebars":"Handlebars",
            "haskell":"Haskell",
            "haskell_cabal":"Haskell Cabal",
            "haxe":"haXe",
            "hjson":"Hjson",
            "html":"HTML",
            "html_elixir":"HTML (Elixir)",
            "html_ruby":"HTML (Ruby)",
            "ini":"INI",
            "io":"Io",
            "jack":"Jack",
            "jade":"Jade",
            "java":"Java",
            "json":"JSON",
            "jsoniq":"JSONiq",
            "jsp":"JSP",
            "jssm":"JSSM",
            "jsx":"JSX",
            "julia":"Julia",
            "kotlin":"Kotlin",
            "latex":"LaTeX",
            "less":"LESS",
            "liquid":"Liquid",
            "lisp":"Lisp",
            "livescript":"LiveScript",
            "logiql":"LogiQL",
            "lsl":"LSL",
            "lua":"Lua",
            "luapage":"LuaPage",
            "lucene":"Lucene",
            "makefile":"Makefile",
            "markdown":"Markdown",
            "mask":"Mask",
            "matlab":"MATLAB",
            "maze":"Maze",
            "mel":"MEL",
            "mixal":"MIXAL",
            "mushcode":"MUSHCode",
            "mysql":"MySQL",
            "nix":"Nix",
            "nsis":"NSIS",
            "objectivec":"Objective-C",
            "ocaml":"OCaml",
            "pascal":"Pascal",
            "perl":"Perl",
            "perl6":"Perl 6",
            "pgsql":"pgSQL",
            "php_laravel_blade":"PHP (Blade Template)",
            "php":"PHP",
            "puppet":"Puppet",
            "pig":"Pig",
            "powershell":"Powershell",
            "praat":"Praat",
            "prolog":"Prolog",
            "properties":"Properties",
            "protobuf":"Protobuf",
            "python":"Python",
            "r":"R",
            "razor":"Razor",
            "rdoc":"RDoc",
            "red":"Red",
            "rhtml":"RHTML",
            "rst":"RST",
            "ruby":"Ruby",
            "rust":"Rust",
            "sass":"SASS",
            "scad":"SCAD",
            "scala":"Scala",
            "scheme":"Scheme",
            "scss":"SCSS",
            "sh":"SH",
            "sjs":"SJS",
            "slim":"Slim",
            "smarty":"Smarty",
            "snippets":"snippets",
            "soy_template":"Soy Template",
            "space":"Space",
            "sql":"SQL",
            "sqlserver":"SQLServer",
            "stylus":"Stylus",
            "svg":"SVG",
            "swift":"Swift",
            "tcl":"Tcl",
            "terraform":"Terraform",
            "tex":"Tex",
            "text":"Text",
            "textile":"Textile",
            "toml":"Toml",
            "tsx":"TSX",
            "twig":"Twig",
            "typescript":"Typescript",
            "vala":"Vala",
            "vbscript":"VBScript",
            "velocity":"Velocity",
            "verilog":"Verilog",
            "vhdl":"VHDL",
            "visualforce":"Visualforce",
            "wollok":"Wollok",
            "xml":"XML",
            "xquery":"XQuery",
            "yaml":"YAML",
            "django":"Django"
        },

And here is a link to all the .js modules that can be used.
https://github.com/ajaxorg/ace/tree/master/lib/ace/mode

prasathmani pushed a commit that referenced this issue Jul 20, 2020
Fixes setting drop down boxes to the current ace editor mode and theme on page load.
ner00 pushed a commit to ner00/tinyfilemanager that referenced this issue May 7, 2023
Fixes setting drop down boxes to the current ace editor mode and theme on page load.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants